filename | src/sh4/scif.c |
changeset | 30:89b30313d757 |
prev | 23:1ec3acd0594d |
next | 32:bf0bc2c524b8 |
author | nkeynes |
date | Sun Dec 25 05:57:00 2005 +0000 (18 years ago) |
permissions | -rw-r--r-- |
last change | Change timeslice to nanoseconds (was microseconds) Generize single step (now steps through active CPU) Add lots of header blocks |
file | annotate | diff | log | raw |
1.1 --- a/src/sh4/scif.c Fri Dec 23 11:44:55 2005 +00001.2 +++ b/src/sh4/scif.c Sun Dec 25 05:57:00 2005 +00001.3 @@ -1,5 +1,5 @@1.4 /**1.5 - * $Id: scif.c,v 1.4 2005-12-23 11:44:55 nkeynes Exp $1.6 + * $Id: scif.c,v 1.5 2005-12-25 05:57:00 nkeynes Exp $1.7 * SCIF (Serial Communication Interface with FIFO) implementation - part of the1.8 * SH4 standard on-chip peripheral set. The SCIF is hooked up to the DCs1.9 * external serial port1.10 @@ -172,6 +172,9 @@1.11 */1.12 gboolean SCIF_rcvd_last_tick = FALSE;1.14 +uint32_t SCIF_tick_period = 0;1.15 +uint32_t SCIF_tick_remainder = 0;1.16 +1.17 void SCIF_save_state( FILE *f )1.18 {1.19 fwrite( &SCIF_recvq, sizeof(SCIF_recvq), 1, f );1.20 @@ -441,6 +444,9 @@1.21 if( serial_device != NULL && serial_device->set_line_speed != NULL )1.22 serial_device->set_line_speed( baudrate );1.23 INFO( "SCIF baud rate set to %d", baudrate );1.24 +1.25 + SCIF_tick_period = sh4_peripheral_period * (32 * mult * (bbr+1));1.26 +1.27 /*1.28 clock_set_tick_rate( CLOCK_SCIF, baudrate / 10 );1.29 */1.30 @@ -610,8 +616,16 @@1.31 SCIF_rcvd_last_tick = rcvd;1.32 }1.34 -void SCIF_run_slice( int microsecs )1.35 +void SCIF_reset( void )1.36 {1.37 - /* TODO */1.38 - SCIF_clock_tick();1.39 + SCIF_tick_remainder = 0;1.40 }1.41 +1.42 +void SCIF_run_slice( uint32_t nanosecs )1.43 +{1.44 + SCIF_tick_remainder += nanosecs;1.45 + while( SCIF_tick_remainder >= SCIF_tick_period ) {1.46 + SCIF_tick_remainder -= SCIF_tick_period;1.47 + SCIF_clock_tick();1.48 + }1.49 +}
.