Search
lxdream.org :: lxdream/src/aica/aica.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/aica/aica.c
changeset 173:b006aaba9dff
prev131:4c25f1b20664
next241:776e46e58d6d
author nkeynes
date Thu Dec 14 12:31:38 2006 +0000 (17 years ago)
permissions -rw-r--r--
last change Add preliminary linux native CD driver support
file annotate diff log raw
1.1 --- a/src/aica/aica.c Thu Mar 30 11:27:11 2006 +0000
1.2 +++ b/src/aica/aica.c Thu Dec 14 12:31:38 2006 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: aica.c,v 1.18 2006-03-30 11:27:11 nkeynes Exp $
1.6 + * $Id: aica.c,v 1.19 2006-06-27 11:04:03 nkeynes Exp $
1.7 *
1.8 * This is the core sound system (ie the bit which does the actual work)
1.9 *
1.10 @@ -44,6 +44,10 @@
1.11 aica_start, aica_run_slice, aica_stop,
1.12 aica_save_state, aica_load_state };
1.13
1.14 +/* 20 years in seconds */
1.15 +#define RTC_OFFSET 631152000
1.16 +unsigned int aica_time_of_day = 0;
1.17 +
1.18 /**
1.19 * Initialize the AICA subsystem. Note requires that
1.20 */
1.21 @@ -58,8 +62,13 @@
1.22
1.23 void aica_reset( void )
1.24 {
1.25 + struct timeval tv;
1.26 arm_reset();
1.27 aica_event(2); /* Pre-deliver a timer interrupt */
1.28 +
1.29 + // gettimeofday( &tv, NULL );
1.30 + // aica_time_of_day = tv.tv_sec + RTC_OFFSET;
1.31 + aica_time_of_day = 0x5bfc8900;
1.32 }
1.33
1.34 void aica_start( void )
1.35 @@ -89,6 +98,7 @@
1.36 if( nanosecs_done > 1000000000 ) {
1.37 samples_done -= AICA_SAMPLE_RATE;
1.38 nanosecs_done -= 1000000000;
1.39 + aica_time_of_day++;
1.40 }
1.41 return nanosecs;
1.42 }
1.43 @@ -220,26 +230,21 @@
1.44 }
1.45 }
1.46
1.47 -/* 20 years in seconds */
1.48 -#define RTC_OFFSET 631152000
1.49
1.50 int32_t mmio_region_AICARTC_read( uint32_t reg )
1.51 {
1.52 struct timeval tv;
1.53 -
1.54 + int32_t rv = 0;
1.55 switch( reg ) {
1.56 case AICA_RTCHI:
1.57 - if( gettimeofday( &tv, NULL ) == 0 ) {
1.58 - return ((uint32_t)(tv.tv_sec + RTC_OFFSET)) >> 16;
1.59 - }
1.60 + rv = (aica_time_of_day >> 16) & 0xFFFF;
1.61 break;
1.62 case AICA_RTCLO:
1.63 - if( gettimeofday( &tv, NULL ) == 0 ) {
1.64 - return ((uint32_t)(tv.tv_sec + RTC_OFFSET)) & 0xFFFF;
1.65 - }
1.66 + rv = aica_time_of_day & 0xFFFF;
1.67 break;
1.68 }
1.69 - return 0;
1.70 + DEBUG( "Read AICA RTC %d => %08X", reg, rv );
1.71 + return rv;
1.72 }
1.73
1.74 MMIO_REGION_WRITE_STUBFN( AICARTC )
.