filename | src/mem.h |
changeset | 430:467519b050f4 |
prev | 422:61a0598e07ff |
next | 466:a6935f46ed78 |
author | nkeynes |
date | Thu Oct 11 08:22:03 2007 +0000 (16 years ago) |
permissions | -rw-r--r-- |
last change | Add speed meter to main window Add sunken border around video area Add debugger menu item Move logging out to util.c |
view | annotate | diff | log | raw |
1 /**
2 * $Id: mem.h,v 1.13 2007-10-08 12:06:01 nkeynes Exp $
3 *
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)
6 *
7 * Copyright (c) 2005 Nathan Keynes.
8 *
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.
13 *
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.
18 */
20 #ifndef dream_mem_H
21 #define dream_mem_H
23 #include <stdint.h>
24 #include "dream.h"
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
30 typedef struct mem_region {
31 uint32_t base;
32 uint32_t size;
33 const char *name;
34 char *mem;
35 int flags;
36 } *mem_region_t;
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 void *mem_create_ram_region( uint32_t base, uint32_t size, const char *name );
49 void *mem_create_repeating_ram_region( uint32_t base, uint32_t size, const char *name,
50 uint32_t repeat_offset, uint32_t last_repeat );
51 void *mem_load_rom( const gchar *name, uint32_t base, uint32_t size, uint32_t crc );
52 void *mem_alloc_pages( int n );
53 char *mem_get_region( uint32_t addr );
54 char *mem_get_region_by_name( const char *name );
55 int mem_has_page( uint32_t addr );
56 char *mem_get_page( uint32_t addr );
57 int mem_load_block( const gchar *filename, uint32_t base, uint32_t size );
58 int mem_save_block( const gchar *filename, uint32_t base, uint32_t size );
59 void mem_set_trace( uint32_t addr, int flag );
60 void mem_init( void );
61 void mem_reset( void );
62 void mem_copy_from_sh4( unsigned char *dest, sh4addr_t src, size_t count );
63 void mem_copy_to_sh4( sh4addr_t dest, unsigned char *src, size_t count );
65 #define ENABLE_DEBUG_MODE 1
67 struct breakpoint_struct {
68 uint32_t address;
69 int type;
70 };
72 #define MAX_BREAKPOINTS 32
73 #define BREAK_NONE 0
74 #define BREAK_ONESHOT 1
75 #define BREAK_KEEP 2
77 #undef ENABLE_WATCH
79 #define WATCH_WRITE 1
80 #define WATCH_READ 2
81 #define WATCH_EXEC 3 /* AKA Breakpoint :) */
83 #define MEM_FLAG_ROM 4 /* Mem region is ROM-based */
84 #define MEM_FLAG_RAM 6
86 typedef struct watch_point *watch_point_t;
88 watch_point_t mem_new_watch( uint32_t start, uint32_t end, int flags );
89 void mem_delete_watch( watch_point_t watch );
90 watch_point_t mem_is_watched( uint32_t addr, int size, int op );
92 extern char **page_map;
93 #ifdef __cplusplus
94 }
95 #endif
96 #endif
.