home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / gdb-4.16-base.tgz / gdb-4.16-base.tar / fsf / gdb / sim / ppc / corefile.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-01-22  |  3.6 KB  |  152 lines

  1. /*  This file is part of the program psim.
  2.  
  3.     Copyright (C) 1994-1996, Andrew Cagney <cagney@highland.com.au>
  4.  
  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.
  9.  
  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.
  14.  
  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.
  18.  
  19.     */
  20.  
  21.  
  22. #ifndef _CORE_H_
  23. #define _CORE_H_
  24.  
  25. /* basic types */
  26.  
  27. typedef struct _core core;
  28. typedef struct _core_map core_map;
  29.  
  30. /* constructor */
  31.  
  32. INLINE_CORE\
  33. (core *) core_create
  34. (device *root);
  35.  
  36. INLINE_CORE\
  37. (device *) core_device_create
  38. (void);
  39.  
  40.  
  41.  
  42. /* the core has three sub mappings that the more efficient
  43.    read/write fixed quantity functions use */
  44.  
  45. INLINE_CORE\
  46. (core_map *) core_readable
  47. (core *memory);
  48.  
  49. INLINE_CORE\
  50. (core_map *) core_writeable
  51. (core *memory);
  52.  
  53. INLINE_CORE\
  54. (core_map *) core_executable
  55. (core *memory);
  56.  
  57.  
  58.  
  59. /* operators to add/remove a mapping in the core
  60.  
  61.    callback-memory:
  62.  
  63.    All access are passed onto the specified devices callback routines
  64.    after being `translated'.  DEFAULT indicates that the specified
  65.    memory should be called if all other mappings fail.
  66.    
  67.    For callback-memory, the device must be specified.
  68.  
  69.    raw-memory:
  70.  
  71.    While RAM could be implemented using the callback interface
  72.    core instead treats it as the common case including the code
  73.    directly in the read/write operators.
  74.  
  75.    For raw-memory, the device is ignored and the core alloc's a
  76.    block to act as the memory.
  77.  
  78.    default-memory:
  79.  
  80.    Should, for the core, there be no defined mapping for a given
  81.    address then the default map (if present) is called.
  82.  
  83.    For default-memory, the device must be specified. */
  84.  
  85. INLINE_CORE\
  86. (void) core_attach
  87. (core *map,
  88.  attach_type attach,
  89.  int address_space,
  90.  access_type access,
  91.  unsigned_word addr,
  92.  unsigned nr_bytes, /* host limited */
  93.  device *device); /*callback/default*/
  94.  
  95. /* Variable sized read/write:
  96.  
  97.    Transfer (zero) a variable size block of data between the host and
  98.    target (possibly byte swapping it).  Should any problems occure,
  99.    the number of bytes actually transfered is returned. */
  100.  
  101. INLINE_CORE\
  102. (unsigned) core_map_read_buffer
  103. (core_map *map,
  104.  void *buffer,
  105.  unsigned_word addr,
  106.  unsigned nr_bytes);
  107.  
  108. INLINE_CORE\
  109. (unsigned) core_map_write_buffer
  110. (core_map *map,
  111.  const void *buffer,
  112.  unsigned_word addr,
  113.  unsigned nr_bytes);
  114.  
  115.  
  116. /* Fixed sized read/write:
  117.  
  118.    Transfer a fixed amout of memory between the host and target.  The
  119.    memory always being translated and the operation always aborting
  120.    should a problem occure */
  121.  
  122. #define DECLARE_CORE_WRITE_N(N) \
  123. INLINE_CORE\
  124. (void) core_map_write_##N \
  125. (core_map *map, \
  126.  unsigned_word addr, \
  127.  unsigned_##N val, \
  128.  cpu *processor, \
  129.  unsigned_word cia);
  130.  
  131. DECLARE_CORE_WRITE_N(1)
  132. DECLARE_CORE_WRITE_N(2)
  133. DECLARE_CORE_WRITE_N(4)
  134. DECLARE_CORE_WRITE_N(8)
  135. DECLARE_CORE_WRITE_N(word)
  136.  
  137. #define DECLARE_CORE_READ_N(N) \
  138. INLINE_CORE\
  139. (unsigned_##N) core_map_read_##N \
  140. (core_map *map, \
  141.  unsigned_word addr, \
  142.  cpu *processor, \
  143.  unsigned_word cia);
  144.  
  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)
  150.  
  151. #endif
  152.