Search
lxdream.org :: lxdream/src/aica/armmem.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/aica/armmem.c
changeset 37:1d84f4c18816
prev31:495e480360d7
next40:852ee31ace0d
author nkeynes
date Mon Dec 26 06:38:51 2005 +0000 (14 years ago)
permissions -rw-r--r--
last change More ARM work-in-progress - idle loop works now :)
file annotate diff log raw
1.1 --- a/src/aica/armmem.c Sun Dec 25 08:24:11 2005 +0000
1.2 +++ b/src/aica/armmem.c Mon Dec 26 06:38:51 2005 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: armmem.c,v 1.4 2005-12-25 08:24:11 nkeynes Exp $
1.6 + * $Id: armmem.c,v 1.5 2005-12-26 06:38:51 nkeynes Exp $
1.7 *
1.8 * Implements the ARM's memory map.
1.9 *
1.10 @@ -32,21 +32,34 @@
1.11 (addr >= 0x00800000 && addr <= 0x00805000 ) );
1.12 }
1.13
1.14 -int32_t arm_read_long( uint32_t addr ) {
1.15 +uint32_t arm_read_long( uint32_t addr ) {
1.16 if( addr < 0x00200000 ) {
1.17 return *(int32_t *)(arm_mem + addr);
1.18 /* Main sound ram */
1.19 - } else if( addr >= 0x00800000 && addr <= 0x00803000 ) {
1.20 - /* Sound registers / scratch ram */
1.21 } else {
1.22 - /* Undefined memory */
1.23 - ERROR( "Attempted long read to undefined page: %08X",
1.24 - addr );
1.25 - return 0;
1.26 + switch( addr & 0xFFFFF000 ) {
1.27 + case 0x00800000:
1.28 + return mmio_region_AICA0_read(addr);
1.29 + break;
1.30 + case 0x00801000:
1.31 + return mmio_region_AICA1_read(addr);
1.32 + break;
1.33 + case 0x00802000:
1.34 + return mmio_region_AICA2_read(addr);
1.35 + break;
1.36 + case 0x00803000:
1.37 + break;
1.38 + case 0x00804000:
1.39 + break;
1.40 + }
1.41 }
1.42 + ERROR( "Attempted long read to undefined page: %08X",
1.43 + addr );
1.44 + /* Undefined memory */
1.45 + return 0;
1.46 }
1.47
1.48 -int16_t arm_read_word( uint32_t addr ) {
1.49 +uint32_t arm_read_word( uint32_t addr ) {
1.50 if( addr < 0x00200000 ) {
1.51 return *(int16_t *)(arm_mem + addr);
1.52 /* Main sound ram */
1.53 @@ -59,9 +72,9 @@
1.54
1.55 }
1.56
1.57 -int8_t arm_read_byte( uint32_t addr ) {
1.58 +uint32_t arm_read_byte( uint32_t addr ) {
1.59 if( addr < 0x00200000 ) {
1.60 - return *(int8_t *)(arm_mem + addr);
1.61 + return (uint32_t)(*(uint8_t *)(arm_mem + addr));
1.62 /* Main sound ram */
1.63 } else {
1.64 /* Undefined memory */
1.65 @@ -71,10 +84,37 @@
1.66 }
1.67 }
1.68
1.69 +void arm_write_long( uint32_t addr, uint32_t value )
1.70 +{
1.71 + if( addr < 0x00200000 ) {
1.72 + *(uint32_t *)(arm_mem + addr) = value;
1.73 + } else {
1.74 + }
1.75 +}
1.76 +
1.77 +void arm_write_byte( uint32_t addr, uint32_t value )
1.78 +{
1.79 + if( addr < 0x00200000 ) {
1.80 + *(uint8_t *)(arm_mem+addr) = (uint8_t)value;
1.81 + } else {
1.82 + }
1.83 +}
1.84 +
1.85 +/* User translations - TODO */
1.86 +
1.87 uint32_t arm_read_long_user( uint32_t addr ) {
1.88 -
1.89 + return arm_read_long( addr );
1.90 }
1.91
1.92 uint32_t arm_read_byte_user( uint32_t addr ) {
1.93 + return arm_read_byte( addr );
1.94 +}
1.95
1.96 +void arm_write_long_user( uint32_t addr, uint32_t val ) {
1.97 + arm_write_long( addr, val );
1.98 }
1.99 +
1.100 +void arm_write_byte_user( uint32_t addr, uint32_t val )
1.101 +{
1.102 + arm_write_byte( addr, val );
1.103 +}
.