Search
lxdream.org :: lxdream/src/aica/armmem.c
lxdream 0.9.1
released Jun 29
Download Now
filename src/aica/armmem.c
changeset 14:fc481a638848
prev11:0a82ef380c45
next31:495e480360d7
author nkeynes
date Mon Dec 12 10:37:41 2005 +0000 (14 years ago)
permissions -rw-r--r--
last change Use cpu-specific is_valid_page function
view annotate diff log raw
     1 #include <stdlib.h>
     2 #include "dream.h"
     3 #include "mem.h"
     5 char *arm_mem = NULL;
     7 void arm_mem_init() {
     8     arm_mem = mem_get_region_by_name( MEM_REGION_AUDIO );
    10 }
    12 int arm_has_page( uint32_t addr ) {
    13     return ( addr < 0x00200000 ||
    14 	     (addr >= 0x00800000 && addr <= 0x00805000 ) );
    15 }
    17 int32_t arm_read_long( uint32_t addr ) {
    18     if( addr < 0x00200000 ) {
    19 	return *(int32_t *)(arm_mem + addr);
    20 	/* Main sound ram */
    21     } else if( addr >= 0x00800000 && addr <= 0x00803000 ) {
    22 	/* Sound registers / scratch ram */
    23     } else {
    24 	/* Undefined memory */
    25 	ERROR( "Attempted long read to undefined page: %08X",
    26 	       addr );
    27 	return 0;
    28     }
    29 }
    31 int16_t arm_read_word( uint32_t addr ) {
    32     if( addr < 0x00200000 ) {
    33 	return *(int16_t *)(arm_mem + addr);
    34 	/* Main sound ram */
    35     } else {
    36 	/* Undefined memory */
    37 	ERROR( "Attempted word read to undefined page: %08X",
    38 	       addr );
    39 	return 0;
    40     }
    42 }
    44 int8_t arm_read_byte( uint32_t addr ) {
    45     if( addr < 0x00200000 ) {
    46 	return *(int8_t *)(arm_mem + addr);
    47 	/* Main sound ram */
    48     } else {
    49 	/* Undefined memory */
    50 	ERROR( "Attempted byte read to undefined page: %08X",
    51 	       addr );
    52 	return 0;
    53     }
    54 }
    56 uint32_t arm_read_long_user( uint32_t addr ) {
    58 }
    60 uint32_t arm_read_byte_user( uint32_t addr ) {
    62 }
.