revision 301:1ace395139c3
summary |
tree |
shortlog |
changelog |
graph |
changeset |
raw | bz2 | zip | gz changeset | 301:1ace395139c3 |
parent | 300:a8ae4aeb0b42 |
child | 302:96b5cc24309c |
author | nkeynes |
date | Wed Jan 17 09:37:22 2007 +0000 (17 years ago) |
Implement writing to the RTC registers
src/aica/aica.c | view | annotate | diff | log | ||
src/aica/aica.h | view | annotate | diff | log |
1.1 --- a/src/aica/aica.c Wed Jan 17 09:21:55 2007 +00001.2 +++ b/src/aica/aica.c Wed Jan 17 09:37:22 2007 +00001.3 @@ -1,5 +1,5 @@1.4 /**1.5 - * $Id: aica.c,v 1.20 2006-12-15 10:19:06 nkeynes Exp $1.6 + * $Id: aica.c,v 1.21 2007-01-17 09:37:22 nkeynes Exp $1.7 *1.8 * This is the core sound system (ie the bit which does the actual work)1.9 *1.10 @@ -247,8 +247,27 @@1.11 return rv;1.12 }1.14 -MMIO_REGION_WRITE_STUBFN( AICARTC )1.16 +void mmio_region_AICARTC_write( uint32_t reg, uint32_t val )1.17 +{1.18 + switch( reg ) {1.19 + case AICA_RTCEN:1.20 + MMIO_WRITE( AICARTC, reg, val&0x01 );1.21 + break;1.22 + case AICA_RTCLO:1.23 + if( MMIO_READ( AICARTC, AICA_RTCEN ) & 0x01 ) {1.24 + aica_time_of_day = (aica_time_of_day & 0xFFFF0000) | (val & 0xFFFF);1.25 + }1.26 + break;1.27 + case AICA_RTCHI:1.28 + if( MMIO_READ( AICARTC, AICA_RTCEN ) & 0x01 ) {1.29 + aica_time_of_day = (aica_time_of_day & 0xFFFF) | (val<<16);1.30 + MMIO_WRITE( AICARTC, AICA_RTCEN, 0 );1.31 + }1.32 + break;1.33 + }1.34 +}1.35 +1.36 /**1.37 * Translate the channel frequency to a sample rate. The frequency is a1.38 * 14-bit floating point number, where bits 0..9 is the mantissa,
2.1 --- a/src/aica/aica.h Wed Jan 17 09:21:55 2007 +00002.2 +++ b/src/aica/aica.h Wed Jan 17 09:37:22 2007 +00002.3 @@ -1,5 +1,5 @@2.4 /**2.5 - * $Id: aica.h,v 1.9 2006-03-30 11:27:11 nkeynes Exp $2.6 + * $Id: aica.h,v 1.10 2007-01-17 09:37:22 nkeynes Exp $2.7 *2.8 * MMIO definitions for the AICA sound chip. Note that the regions defined2.9 * here are relative to the SH4 memory map (0x00700000 based), rather than2.10 @@ -48,6 +48,7 @@2.11 MMIO_REGION_BEGIN( 0x00710000, AICARTC, "AICA Sound System RTC" )2.12 LONG_PORT( 0x000, AICA_RTCHI, PORT_R, 0, "RTC High 16-bits" )2.13 LONG_PORT( 0x004, AICA_RTCLO, PORT_R, 0, "RTC Low 16-bits" )2.14 + LONG_PORT( 0x008, AICA_RTCEN, PORT_W, 0, "RTC write enable" )2.15 MMIO_REGION_END2.17 MMIO_REGION_LIST_BEGIN( spu )
.