Search
lxdream.org :: lxdream/src/mem.h
lxdream 0.9.1
released Jun 29
Download Now
filename src/mem.h
changeset 101:5a22f3699b67
prev43:0cf3e339cc59
next146:f91fa34ab219
author nkeynes
date Tue Mar 14 11:44:04 2006 +0000 (18 years ago)
permissions -rw-r--r--
last change Remove call-slot-delay on syscall
ensure dreamcast_stop on error conditions for the time being
view annotate diff log raw
     1 /**
     2  * $Id: mem.h,v 1.7 2006-03-13 12:37:06 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>
    25 #ifdef __cplusplus
    26 extern "C" {
    27 #endif
    29 typedef struct mem_region {
    30     uint32_t base;
    31     uint32_t size;
    32     char *name;
    33     char *mem;
    34     int flags;
    35 } *mem_region_t;
    37 #define MAX_IO_REGIONS 24
    38 #define MAX_MEM_REGIONS 8
    40 #define MEM_REGION_MAIN "System RAM"
    41 #define MEM_REGION_VIDEO "Video RAM"
    42 #define MEM_REGION_AUDIO "Audio RAM"
    43 #define MEM_REGION_AUDIO_SCRATCH "Audio Scratch RAM"
    45 #define MB * (1024 * 1024)
    46 #define KB * 1024
    48 void *mem_create_ram_region( uint32_t base, uint32_t size, char *name );
    49 void *mem_load_rom( char *name, uint32_t base, uint32_t size, uint32_t crc );
    50 void *mem_alloc_pages( int n );
    51 char *mem_get_region( uint32_t addr );
    52 char *mem_get_region_by_name( char *name );
    53 int mem_has_page( uint32_t addr );
    54 char *mem_get_page( uint32_t addr );
    56 void mem_init( void );
    57 void mem_reset( void );
    59 #define ENABLE_DEBUG_MODE 1
    61 struct breakpoint_struct {
    62     uint32_t address;
    63     int type;
    64 };
    66 #define MAX_BREAKPOINTS 32
    67 #define BREAK_NONE 0
    68 #define BREAK_ONESHOT 1
    69 #define BREAK_KEEP 2
    71 #define ENABLE_WATCH 1
    73 #define WATCH_WRITE 1
    74 #define WATCH_READ  2
    75 #define WATCH_EXEC  3  /* AKA Breakpoint :) */
    77 #define MEM_FLAG_ROM 4 /* Mem region is ROM-based */
    78 #define MEM_FLAG_RAM 6 
    80 typedef struct watch_point *watch_point_t;
    82 watch_point_t mem_new_watch( uint32_t start, uint32_t end, int flags );
    83 void mem_delete_watch( watch_point_t watch );
    84 watch_point_t mem_is_watched( uint32_t addr, int size, int op );
    86 typedef uint32_t sh4addr_t;
    88 extern char **page_map;
    89 #ifdef __cplusplus
    90 }
    91 #endif
    92 #endif
.