Search
lxdream.org :: lxdream/src/aica/aica.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/aica/aica.c
changeset 131:4c25f1b20664
prev106:9048bac046c3
next173:b006aaba9dff
author nkeynes
date Thu Jun 15 10:25:45 2006 +0000 (17 years ago)
permissions -rw-r--r--
last change Add P4 I/O tracing
Add ability to set I/O trace by region address
file annotate diff log raw
1.1 --- a/src/aica/aica.c Tue Mar 14 12:45:53 2006 +0000
1.2 +++ b/src/aica/aica.c Thu Jun 15 10:25:45 2006 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: aica.c,v 1.17 2006-03-14 12:45:53 nkeynes Exp $
1.6 + * $Id: aica.c,v 1.18 2006-03-30 11:27:11 nkeynes Exp $
1.7 *
1.8 * This is the core sound system (ie the bit which does the actual work)
1.9 *
1.10 @@ -18,6 +18,7 @@
1.11
1.12 #define MODULE aica_module
1.13
1.14 +#include <time.h>
1.15 #include "dream.h"
1.16 #include "dreamcast.h"
1.17 #include "mem.h"
1.18 @@ -219,6 +220,30 @@
1.19 }
1.20 }
1.21
1.22 +/* 20 years in seconds */
1.23 +#define RTC_OFFSET 631152000
1.24 +
1.25 +int32_t mmio_region_AICARTC_read( uint32_t reg )
1.26 +{
1.27 + struct timeval tv;
1.28 +
1.29 + switch( reg ) {
1.30 + case AICA_RTCHI:
1.31 + if( gettimeofday( &tv, NULL ) == 0 ) {
1.32 + return ((uint32_t)(tv.tv_sec + RTC_OFFSET)) >> 16;
1.33 + }
1.34 + break;
1.35 + case AICA_RTCLO:
1.36 + if( gettimeofday( &tv, NULL ) == 0 ) {
1.37 + return ((uint32_t)(tv.tv_sec + RTC_OFFSET)) & 0xFFFF;
1.38 + }
1.39 + break;
1.40 + }
1.41 + return 0;
1.42 +}
1.43 +
1.44 +MMIO_REGION_WRITE_STUBFN( AICARTC )
1.45 +
1.46 /**
1.47 * Translate the channel frequency to a sample rate. The frequency is a
1.48 * 14-bit floating point number, where bits 0..9 is the mantissa,
.