1 /* This file is part of the program psim.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 typedef struct _core core;
28 typedef struct _core_map core_map;
32 core INLINE_CORE *core_create
35 device INLINE_CORE *core_device_create
40 /* the core has three sub mappings that the more efficient
41 read/write fixed quantity functions use */
43 core_map INLINE_CORE *core_readable
46 core_map INLINE_CORE *core_writeable
49 core_map INLINE_CORE *core_executable
54 /* operators to add/remove a mapping in the core
58 All access are passed onto the specified devices callback routines
59 after being `translated'. DEFAULT indicates that the specified
60 memory should be called if all other mappings fail.
62 For callback-memory, the device must be specified.
66 While RAM could be implemented using the callback interface
67 core instead treats it as the common case including the code
68 directly in the read/write operators.
70 For raw-memory, the device is ignored and the core alloc's a
71 block to act as the memory.
75 Should, for the core, there be no defined mapping for a given
76 address then the default map (if present) is called.
78 For default-memory, the device must be specified. */
80 void INLINE_CORE core_attach
86 unsigned nr_bytes, /* host limited */
87 device *device); /*callback/default*/
89 void INLINE_CORE core_detach
94 unsigned nr_bytes, /* host limited */
96 device *device); /*callback/default*/
99 /* Variable sized read/write:
101 Transfer (zero) a variable size block of data between the host and
102 target (possibly byte swapping it). Should any problems occure,
103 the number of bytes actually transfered is returned. */
105 unsigned INLINE_CORE core_map_read_buffer
111 unsigned INLINE_CORE core_map_write_buffer
118 /* Fixed sized read/write:
120 Transfer a fixed amout of memory between the host and target. The
121 memory always being translated and the operation always aborting
122 should a problem occure */
124 #define DECLARE_CORE_WRITE_N(N) \
125 void INLINE_CORE core_map_write_##N \
127 unsigned_word addr, \
132 DECLARE_CORE_WRITE_N(1)
133 DECLARE_CORE_WRITE_N(2)
134 DECLARE_CORE_WRITE_N(4)
135 DECLARE_CORE_WRITE_N(8)
136 DECLARE_CORE_WRITE_N(word)
138 #define DECLARE_CORE_READ_N(N) \
139 unsigned_##N INLINE_CORE core_map_read_##N \
141 unsigned_word addr, \
145 DECLARE_CORE_READ_N(1)
146 DECLARE_CORE_READ_N(2)
147 DECLARE_CORE_READ_N(4)
148 DECLARE_CORE_READ_N(8)
149 DECLARE_CORE_READ_N(word)