Search
lxdream.org :: lxdream/src/mem.h
lxdream 0.9.1
released Jun 29
Download Now
filename src/mem.h
changeset 18:9a1b5d75703f
prev11:0a82ef380c45
next19:9da7a8e38f9d
author nkeynes
date Thu Dec 15 13:33:14 2005 +0000 (14 years ago)
permissions -rw-r--r--
last change Implement save states
file annotate diff log raw
nkeynes@10
     1
#ifndef dream_sh4_mem_H
nkeynes@10
     2
#define dream_sh4_mem_H
nkeynes@10
     3
nkeynes@10
     4
#include <stdint.h>
nkeynes@10
     5
nkeynes@10
     6
#ifdef __cplusplus
nkeynes@10
     7
extern "C" {
nkeynes@10
     8
#endif
nkeynes@10
     9
nkeynes@10
    10
typedef struct mem_region {
nkeynes@10
    11
    uint32_t base;
nkeynes@10
    12
    uint32_t size;
nkeynes@10
    13
    char *name;
nkeynes@10
    14
    char *mem;
nkeynes@10
    15
    int flags;
nkeynes@10
    16
} *mem_region_t;
nkeynes@10
    17
nkeynes@10
    18
#define MAX_IO_REGIONS 24
nkeynes@10
    19
#define MAX_MEM_REGIONS 8
nkeynes@10
    20
nkeynes@10
    21
#define MEM_REGION_MAIN "System RAM"
nkeynes@10
    22
#define MEM_REGION_VIDEO "Video RAM"
nkeynes@10
    23
#define MEM_REGION_AUDIO "Audio RAM"
nkeynes@10
    24
#define MEM_REGION_AUDIO_SCRATCH "Audio Scratch RAM"
nkeynes@10
    25
nkeynes@10
    26
#define MB * (1024 * 1024)
nkeynes@10
    27
#define KB * 1024
nkeynes@10
    28
nkeynes@10
    29
void *mem_create_ram_region( uint32_t base, uint32_t size, char *name );
nkeynes@10
    30
void *mem_load_rom( char *name, uint32_t base, uint32_t size, uint32_t crc );
nkeynes@10
    31
char *mem_get_region( uint32_t addr );
nkeynes@10
    32
char *mem_get_region_by_name( char *name );
nkeynes@10
    33
int mem_has_page( uint32_t addr );
nkeynes@10
    34
char *mem_get_page( uint32_t addr );
nkeynes@10
    35
nkeynes@10
    36
void mem_init( void );
nkeynes@10
    37
void mem_reset( void );
nkeynes@10
    38
nkeynes@10
    39
#define ENABLE_WATCH 1
nkeynes@10
    40
nkeynes@10
    41
#define WATCH_WRITE 1
nkeynes@10
    42
#define WATCH_READ  2
nkeynes@10
    43
#define WATCH_EXEC  3  /* AKA Breakpoint :) */
nkeynes@10
    44
nkeynes@18
    45
#define MEM_FLAG_ROM 4 /* Mem region is ROM-based */
nkeynes@18
    46
#define MEM_FLAG_RAM 6 
nkeynes@18
    47
nkeynes@10
    48
typedef struct watch_point *watch_point_t;
nkeynes@10
    49
nkeynes@10
    50
watch_point_t mem_new_watch( uint32_t start, uint32_t end, int flags );
nkeynes@10
    51
void mem_delete_watch( watch_point_t watch );
nkeynes@10
    52
watch_point_t mem_is_watched( uint32_t addr, int size, int op );
nkeynes@10
    53
nkeynes@10
    54
extern char **page_map;
nkeynes@10
    55
#ifdef __cplusplus
nkeynes@10
    56
}
nkeynes@10
    57
#endif
nkeynes@10
    58
#endif
.