Search
lxdream.org :: lxdream/src/mem.h :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/mem.h
changeset 929:fd8cb0c82f5f
prev912:c5606ea44232
next931:430048ea8b71
author nkeynes
date Sat Dec 20 03:01:40 2008 +0000 (11 years ago)
branchlxdream-mem
permissions -rw-r--r--
last change First pass experiment using cached decoding.
file annotate diff log raw
1.1 --- a/src/mem.h Fri Oct 31 03:24:49 2008 +0000
1.2 +++ b/src/mem.h Sat Dec 20 03:01:40 2008 +0000
1.3 @@ -27,12 +27,24 @@
1.4 extern "C" {
1.5 #endif
1.6
1.7 +typedef struct mem_region_fn {
1.8 + FASTCALL int32_t (*read_long)(sh4addr_t addr);
1.9 + FASTCALL void (*write_long)(sh4addr_t addr, uint32_t val);
1.10 + FASTCALL int32_t (*read_word)(sh4addr_t addr);
1.11 + FASTCALL void (*write_word)(sh4addr_t addr, uint32_t val);
1.12 + FASTCALL int32_t (*read_byte)(sh4addr_t addr);
1.13 + FASTCALL void (*write_byte)(sh4addr_t addr, uint32_t val);
1.14 + FASTCALL void (*read_burst)(unsigned char *dest, sh4addr_t addr);
1.15 + FASTCALL void (*write_burst)(sh4addr_t addr, unsigned char *src);
1.16 +} *mem_region_fn_t;
1.17 +
1.18 typedef struct mem_region {
1.19 uint32_t base;
1.20 uint32_t size;
1.21 const char *name;
1.22 sh4ptr_t mem;
1.23 uint32_t flags;
1.24 + mem_region_fn_t fn;
1.25 } *mem_region_t;
1.26
1.27 #define MAX_IO_REGIONS 24
1.28 @@ -45,8 +57,8 @@
1.29 #define MEM_REGION_AUDIO_SCRATCH "Audio Scratch RAM"
1.30 #define MEM_REGION_FLASH "System Flash"
1.31
1.32 -void *mem_create_ram_region( uint32_t base, uint32_t size, const char *name );
1.33 -void *mem_create_repeating_ram_region( uint32_t base, uint32_t size, const char *name,
1.34 +void *mem_create_ram_region( uint32_t base, uint32_t size, const char *name, mem_region_fn_t fn );
1.35 +void *mem_create_repeating_ram_region( uint32_t base, uint32_t size, const char *name, mem_region_fn_t fn,
1.36 uint32_t repeat_offset, uint32_t last_repeat );
1.37 /**
1.38 * Load a ROM image from the specified filename. If the memory region has not
1.39 @@ -55,7 +67,7 @@
1.40 * @return TRUE if the image was loaded successfully (irrespective of CRC failure).
1.41 */
1.42 gboolean mem_load_rom( const gchar *filename, uint32_t base, uint32_t size,
1.43 - uint32_t crc, const gchar *region_name );
1.44 + uint32_t crc, const gchar *region_name, mem_region_fn_t fn );
1.45 void *mem_alloc_pages( int n );
1.46 sh4ptr_t mem_get_region( uint32_t addr );
1.47 sh4ptr_t mem_get_region_by_name( const char *name );
.