revision 173:b006aaba9dff
summary |
tree |
shortlog |
changelog |
graph |
changeset |
raw | bz2 | zip | gz changeset | 173:b006aaba9dff |
parent | 172:59cf18b4cfb2 |
child | 174:a89c507a9a8d |
author | nkeynes |
date | Tue Jun 27 11:04:03 2006 +0000 (14 years ago) |
Report AICA RTC using it's own clock rather than the system gettimeofday.
![]() | src/aica/aica.c | view | annotate | diff | log |
1.1 --- a/src/aica/aica.c Tue Jun 27 11:02:48 2006 +00001.2 +++ b/src/aica/aica.c Tue Jun 27 11:04:03 2006 +00001.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.14 +/* 20 years in seconds */1.15 +#define RTC_OFFSET 6311520001.16 +unsigned int aica_time_of_day = 0;1.17 +1.18 /**1.19 * Initialize the AICA subsystem. Note requires that1.20 */1.21 @@ -58,8 +62,13 @@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.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.47 -/* 20 years in seconds */1.48 -#define RTC_OFFSET 6311520001.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.74 MMIO_REGION_WRITE_STUBFN( AICARTC )
.