Search
lxdream.org :: lxdream/src/aica/armmem.c
lxdream 0.9.1
released Jun 29
Download Now
filename src/aica/armmem.c
changeset 11:0a82ef380c45
prev7:976a16e92aab
next14:fc481a638848
author nkeynes
date Sun Dec 11 12:00:09 2005 +0000 (15 years ago)
permissions -rw-r--r--
last change Moved arm material under aica/
Hooked arm disasm up
file annotate diff log raw
nkeynes@11
     1
#include <stdlib.h>
nkeynes@11
     2
#include "dream.h"
nkeynes@7
     3
#include "mem.h"
nkeynes@7
     4
nkeynes@11
     5
char *arm_mem = NULL;
nkeynes@11
     6
nkeynes@7
     7
void arm_mem_init() {
nkeynes@11
     8
    arm_mem = mem_get_region_by_name( MEM_REGION_AUDIO );
nkeynes@11
     9
    
nkeynes@7
    10
}
nkeynes@7
    11
nkeynes@11
    12
int32_t arm_read_long( uint32_t addr ) {
nkeynes@11
    13
    if( addr < 0x00200000 ) {
nkeynes@11
    14
	return *(int32_t *)(arm_mem + addr);
nkeynes@11
    15
	/* Main sound ram */
nkeynes@11
    16
    } else if( addr >= 0x00800000 && addr <= 0x00803000 ) {
nkeynes@11
    17
	/* Sound registers / scratch ram */
nkeynes@11
    18
    } else {
nkeynes@11
    19
	/* Undefined memory */
nkeynes@11
    20
	ERROR( "Attempted long read to undefined page: %08X",
nkeynes@11
    21
	       addr );
nkeynes@11
    22
	return 0;
nkeynes@11
    23
    }
nkeynes@7
    24
}
nkeynes@7
    25
nkeynes@11
    26
int16_t arm_read_word( uint32_t addr ) {
nkeynes@11
    27
    if( addr < 0x00200000 ) {
nkeynes@11
    28
	return *(int16_t *)(arm_mem + addr);
nkeynes@11
    29
	/* Main sound ram */
nkeynes@11
    30
    } else {
nkeynes@11
    31
	/* Undefined memory */
nkeynes@11
    32
	ERROR( "Attempted word read to undefined page: %08X",
nkeynes@11
    33
	       addr );
nkeynes@11
    34
	return 0;
nkeynes@11
    35
    }
nkeynes@11
    36
nkeynes@7
    37
}
nkeynes@7
    38
nkeynes@11
    39
int8_t arm_read_byte( uint32_t addr ) {
nkeynes@11
    40
    if( addr < 0x00200000 ) {
nkeynes@11
    41
	return *(int8_t *)(arm_mem + addr);
nkeynes@11
    42
	/* Main sound ram */
nkeynes@11
    43
    } else {
nkeynes@11
    44
	/* Undefined memory */
nkeynes@11
    45
	ERROR( "Attempted byte read to undefined page: %08X",
nkeynes@11
    46
	       addr );
nkeynes@11
    47
	return 0;
nkeynes@11
    48
    }
nkeynes@7
    49
}
nkeynes@7
    50
nkeynes@11
    51
uint32_t arm_read_long_user( uint32_t addr ) {
nkeynes@11
    52
nkeynes@11
    53
}
nkeynes@11
    54
nkeynes@11
    55
uint32_t arm_read_byte_user( uint32_t addr ) {
nkeynes@11
    56
nkeynes@11
    57
}
.