2 * $Id: mem.h,v 1.10 2006-07-02 04:59:00 nkeynes Exp $
4 * mem is responsible for creating and maintaining the overall system memory
5 * map, as visible from the SH4 processor. (Note the ARM has a different map)
7 * Copyright (c) 2005 Nathan Keynes.
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
30 typedef struct mem_region {
38 #define MAX_IO_REGIONS 24
39 #define MAX_MEM_REGIONS 8
41 #define MEM_REGION_BIOS "Bios ROM"
42 #define MEM_REGION_MAIN "System RAM"
43 #define MEM_REGION_VIDEO "Video RAM"
44 #define MEM_REGION_AUDIO "Audio RAM"
45 #define MEM_REGION_AUDIO_SCRATCH "Audio Scratch RAM"
46 #define MEM_REGION_FLASH "System Flash"
48 #define MB * (1024 * 1024)
51 void *mem_create_ram_region( uint32_t base, uint32_t size, char *name );
52 void *mem_create_repeating_ram_region( uint32_t base, uint32_t size, char *name,
53 uint32_t repeat_offset, uint32_t last_repeat );
54 void *mem_load_rom( char *name, uint32_t base, uint32_t size, uint32_t crc );
55 void *mem_alloc_pages( int n );
56 char *mem_get_region( uint32_t addr );
57 char *mem_get_region_by_name( char *name );
58 int mem_has_page( uint32_t addr );
59 char *mem_get_page( uint32_t addr );
60 int mem_load_block( const gchar *filename, uint32_t base, uint32_t size );
61 int mem_save_block( const gchar *filename, uint32_t base, uint32_t size );
62 void mem_set_trace( uint32_t addr, int flag );
63 void mem_init( void );
64 void mem_reset( void );
66 #define ENABLE_DEBUG_MODE 1
68 struct breakpoint_struct {
73 #define MAX_BREAKPOINTS 32
75 #define BREAK_ONESHOT 1
78 #define ENABLE_WATCH 1
82 #define WATCH_EXEC 3 /* AKA Breakpoint :) */
84 #define MEM_FLAG_ROM 4 /* Mem region is ROM-based */
85 #define MEM_FLAG_RAM 6
87 typedef struct watch_point *watch_point_t;
89 watch_point_t mem_new_watch( uint32_t start, uint32_t end, int flags );
90 void mem_delete_watch( watch_point_t watch );
91 watch_point_t mem_is_watched( uint32_t addr, int size, int op );
93 typedef uint32_t sh4addr_t;
95 extern char **page_map;
.