diff options
author | bouyer <bouyer> | 2004-05-02 20:08:14 +0000 |
---|---|---|
committer | bouyer <bouyer> | 2004-05-02 20:08:14 +0000 |
commit | 6db1c98af0c99e9397a8510dcbf4d969c95d8650 (patch) | |
tree | 59eb366b36b3fb4089fbb06e6dc33b2d40423692 | |
parent | d490ded0e5dc31e12d047634263cb17e789ccc9f (diff) | |
download | pkgsrc-6db1c98af0c99e9397a8510dcbf4d969c95d8650.tar.gz |
Bug fixes and cleanups for the uart emulator. Submitted on sourceforge as
bug id 944916 and 946541.
-rw-r--r-- | emulators/gpsim/Makefile | 3 | ||||
-rw-r--r-- | emulators/gpsim/distinfo | 7 | ||||
-rw-r--r-- | emulators/gpsim/patches/patch-ab | 27 | ||||
-rw-r--r-- | emulators/gpsim/patches/patch-ac | 34 | ||||
-rw-r--r-- | emulators/gpsim/patches/patch-ad | 39 | ||||
-rw-r--r-- | emulators/gpsim/patches/patch-ae | 187 | ||||
-rw-r--r-- | emulators/gpsim/patches/patch-af | 21 |
7 files changed, 316 insertions, 2 deletions
diff --git a/emulators/gpsim/Makefile b/emulators/gpsim/Makefile index f623ff93525..79f45662eb4 100644 --- a/emulators/gpsim/Makefile +++ b/emulators/gpsim/Makefile @@ -1,7 +1,8 @@ -# $NetBSD: Makefile,v 1.12 2004/04/26 22:34:17 snj Exp $ +# $NetBSD: Makefile,v 1.13 2004/05/02 20:08:14 bouyer Exp $ # DISTNAME= gpsim-0.21.2 +PKGREVISION= 1 CATEGORIES= emulators MASTER_SITES= http://www.dattalo.com/gnupic/ diff --git a/emulators/gpsim/distinfo b/emulators/gpsim/distinfo index f46e60d49af..1ee69e107e2 100644 --- a/emulators/gpsim/distinfo +++ b/emulators/gpsim/distinfo @@ -1,5 +1,10 @@ -$NetBSD: distinfo,v 1.4 2004/04/26 22:34:17 snj Exp $ +$NetBSD: distinfo,v 1.5 2004/05/02 20:08:14 bouyer Exp $ SHA1 (gpsim-0.21.2.tar.gz) = 9c16a1288f0c83923395d01e9749d56a087707f9 Size (gpsim-0.21.2.tar.gz) = 721817 bytes SHA1 (patch-aa) = 3d548f5ed918f35384b3e813453d63b8adfceebc +SHA1 (patch-ab) = 10c7ac1ced267081ec25180a53b6881c4dc4326e +SHA1 (patch-ac) = 51b3a74c28157d97b43a7b101bd103a98ae46c2e +SHA1 (patch-ad) = dcd0f4570e593a9523fd30025221fa49a92164bc +SHA1 (patch-ae) = ba466ee447913ea80893470c6f769ca0c96b2ff9 +SHA1 (patch-af) = fd29b01c78458891928880af6f8cbf6df784d92c diff --git a/emulators/gpsim/patches/patch-ab b/emulators/gpsim/patches/patch-ab new file mode 100644 index 00000000000..0c3c2be25e3 --- /dev/null +++ b/emulators/gpsim/patches/patch-ab @@ -0,0 +1,27 @@ +$NetBSD: patch-ab,v 1.3 2004/05/02 20:08:14 bouyer Exp $ + +--- src/16bit-registers.cc.orig 2004-04-29 23:30:57.000000000 +0200 ++++ src/16bit-registers.cc 2004-04-29 23:33:09.000000000 +0200 +@@ -1181,7 +1181,6 @@ + + bool TXREG_16::is_empty(void) + { +- cout << "Txreg_16::empty\n"; + if(pir_set) + return(pir_set->get_txif()); + return 0; +@@ -1192,14 +1191,12 @@ + { + if(pir_set) + pir_set->set_txif(); +- cout << "Txreg_16::empty\n"; + } + + void TXREG_16::full(void) + { + if(pir_set) + pir_set->clear_txif(); +- cout << "Txreg_16::full\n"; + } + + void TXREG_16::assign_pir_set(PIR_SET *new_pir_set) diff --git a/emulators/gpsim/patches/patch-ac b/emulators/gpsim/patches/patch-ac new file mode 100644 index 00000000000..1ede5fb30e0 --- /dev/null +++ b/emulators/gpsim/patches/patch-ac @@ -0,0 +1,34 @@ +$NetBSD: patch-ac,v 1.3 2004/05/02 20:08:14 bouyer Exp $ + +--- src/pir.cc.orig 2004-01-31 03:58:03.000000000 +0100 ++++ src/pir.cc 2004-04-29 23:32:37.000000000 +0200 +@@ -40,6 +40,14 @@ + } + + ++void PIR1v1::set_txif(void) ++{ ++ trace.register_write(address,value); ++ value |= TXIF; ++ if( value & pie->value ) ++ intcon->peripheral_interrupt(); ++} ++ + void PIR1v1::clear_txif(void) + { + value &= ~TXIF; +@@ -56,6 +64,14 @@ + + + ++void PIR1v2::set_txif(void) ++{ ++ trace.register_write(address,value); ++ value |= TXIF; ++ if( value & pie->value ) ++ intcon->peripheral_interrupt(); ++} ++ + void PIR1v2::clear_txif(void) + { + value &= ~TXIF; diff --git a/emulators/gpsim/patches/patch-ad b/emulators/gpsim/patches/patch-ad new file mode 100644 index 00000000000..b94a48ee1e8 --- /dev/null +++ b/emulators/gpsim/patches/patch-ad @@ -0,0 +1,39 @@ +$NetBSD: patch-ad,v 1.3 2004/05/02 20:08:14 bouyer Exp $ + +--- src/pir.h.orig 2004-02-07 03:50:52.000000000 +0100 ++++ src/pir.h 2004-04-29 23:32:37.000000000 +0200 +@@ -93,11 +93,7 @@ + put(get() | SSPIF); + } + +- inline void set_txif(void) +- { +- put(get() | TXIF); +- } +- ++ void set_txif(void); + inline void set_rcif(void) + { + put(get() | RCIF); +@@ -178,11 +174,7 @@ + put(get() | SSPIF); + } + +- inline void set_txif(void) +- { +- put(get() | TXIF); +- } +- ++ void set_txif(void); + inline void set_rcif(void) + { + put(get() | RCIF); +@@ -205,7 +197,7 @@ + void clear_txif(void); + unsigned int get_rcif(void) + { +- return value & TXIF; ++ return value & RCIF; + } + void clear_rcif(void); + diff --git a/emulators/gpsim/patches/patch-ae b/emulators/gpsim/patches/patch-ae new file mode 100644 index 00000000000..1148c1fae02 --- /dev/null +++ b/emulators/gpsim/patches/patch-ae @@ -0,0 +1,187 @@ +$NetBSD: patch-ae,v 1.3 2004/05/02 20:08:14 bouyer Exp $ + +--- src/uart.cc.orig 2004-01-31 03:58:04.000000000 +0100 ++++ src/uart.cc 2004-04-30 18:56:31.000000000 +0200 +@@ -139,11 +139,16 @@ + cout << "TXSTA - enabling transmitter\n"; + if(txreg) { + cout << " TXSTA - does have a txreg\n"; +- if(txreg->is_empty()) + txreg->empty(); +- else ++#if 0 ++ if(txreg->is_empty()) { ++ txreg->empty(); ++ } else { ++ cout << "start_transmitting1" << endl; + start_transmitting(); + } ++#endif ++ } + } else + stop_transmitting(); + } +@@ -431,47 +436,53 @@ + void _RCSTA::receive_a_bit(unsigned int bit) + { + +- if(bit_count) +- { ++ // If we're waiting for the start bit and this isn't it then ++ // we don't need to look any further ++ // cout << "receive_a_bit state " << state << "bit " << bit << endl; ++ if( state == RCSTA_MAYBE_START) { ++ if (bit) ++ state = RCSTA_WAITING_FOR_START; ++ else ++ state = RCSTA_RECEIVING; ++ return; ++ } ++ if (bit_count == 0) { ++ // we should now have the stop bit ++ if (bit) { ++ // got the stop bit ++ // If the rxreg has data from a previous reception then ++ // we have a receiver overrun error. ++ // cout << "rcsta.rsr is full\n"; ++ ++ if((value & RX9) == 0) ++ rsr >>= 1; ++ ++ // copy the rsr to the fifo ++ if(rcreg) ++ rcreg->push( rsr & 0xff); ++ //cout << "_RCSTA::receive_a_bit received 0x" << (rsr & 0xff) << endl; ++ ++ } else { ++ //not stop bit; discard the data and go back receiving ++ } ++ // If we're continuously receiving, then set up for the next byte. ++ // FIXME -- may want to set a half bit delay before re-starting... ++ if(value & CREN) ++ start_receiving(); ++ else ++ state = RCSTA_DISABLED; ++ return; ++ } + +- // If we're waiting for the start bit and this isn't it then +- // we don't need to look any further +- if( (state == RCSTA_WAITING_FOR_START) && bit) +- return; +- +- // Copy the bit into the Receive Shift Register +- if(bit) +- rsr |= 1<<9; +- +- //cout << "Receive bit #" << bit_count << ": " << (rsr&(1<<9)) << '\n'; +- +- rsr >>= 1; +- +- if(--bit_count == 0) +- { +- // rsr is full. +- +- // If the rxreg has data from a previous reception then +- // we have a receiver overrun error. +- //cout << "rcsta.rsr is full\n"; +- +- if((value & RX9) == 0) +- rsr >>= 1; +- +- // copy the rsr to the fifo +- if(rcreg) +- rcreg->push( rsr & 0xff); +- +- // If we're continuously receiving, then set up for the next byte. +- // FIXME -- may want to set a half bit delay before re-starting... +- if(value & CREN) +- start_receiving(); +- else +- state = RCSTA_DISABLED; + +- } ++ // Copy the bit into the Receive Shift Register ++ if(bit) ++ rsr |= 1<<9; + +- } ++ //cout << "Receive bit #" << bit_count << ": " << (rsr&(1<<9)) << '\n'; ++ ++ rsr >>= 1; ++ bit_count--; + + } + +@@ -494,11 +505,11 @@ + // Is this a 9-bit data reception? + if(value & RX9) + { +- bit_count = 10; ++ bit_count = 9; + } + else + { +- bit_count = 9; ++ bit_count = 8; + } + + state = RCSTA_WAITING_FOR_START; +@@ -526,11 +537,11 @@ + if(txsta && (txsta->value & _TXSTA::BRGH)) + set_callback_break(BRGH_FIRST_MID_SAMPLE); + else +- set_callback_break(BRGH_FIRST_MID_SAMPLE); ++ set_callback_break(BRGL_FIRST_MID_SAMPLE); + + sample = 0; +- state = RCSTA_WAITING_MID1; +- ++ sample_state = RCSTA_WAITING_MID1; ++ state = RCSTA_MAYBE_START; + } + + void _RCSTA::callback(void) +@@ -538,7 +549,7 @@ + + //cout << "RCSTA callback " << (cycles.value) << '\n'; + +- switch(state) { ++ switch(sample_state) { + case RCSTA_WAITING_MID1: + if(uart_port->get_bit(rx_bit)) + sample++; +@@ -548,7 +559,7 @@ + else + set_callback_break(BRGL_SECOND_MID_SAMPLE - BRGL_FIRST_MID_SAMPLE); + +- state = RCSTA_WAITING_MID2; ++ sample_state = RCSTA_WAITING_MID2; + + break; + +@@ -561,7 +572,7 @@ + else + set_callback_break(BRGL_THIRD_MID_SAMPLE - BRGL_SECOND_MID_SAMPLE); + +- state = RCSTA_WAITING_MID3; ++ sample_state = RCSTA_WAITING_MID3; + + break; + +@@ -573,13 +584,13 @@ + sample = 0; + + // If this wasn't the last bit then go ahead and set a break for the next bit. +- if(state==RCSTA_WAITING_MID3) { ++ if(state==RCSTA_RECEIVING) { + if(txsta && (txsta->value & _TXSTA::BRGH)) + set_callback_break(TOTAL_BRGH_STATES -(BRGH_THIRD_MID_SAMPLE - BRGH_FIRST_MID_SAMPLE)); + else + set_callback_break(TOTAL_BRGL_STATES -(BRGL_THIRD_MID_SAMPLE - BRGL_FIRST_MID_SAMPLE)); + +- state = RCSTA_WAITING_MID1; ++ sample_state = RCSTA_WAITING_MID1; + } + + break; diff --git a/emulators/gpsim/patches/patch-af b/emulators/gpsim/patches/patch-af new file mode 100644 index 00000000000..cedbb30e9e5 --- /dev/null +++ b/emulators/gpsim/patches/patch-af @@ -0,0 +1,21 @@ +$NetBSD: patch-af,v 1.1 2004/05/02 20:08:14 bouyer Exp $ + +--- src/uart.h.orig 2003-12-31 19:04:42.000000000 +0100 ++++ src/uart.h 2004-05-02 20:32:52.000000000 +0200 +@@ -135,6 +135,7 @@ + enum { + RCSTA_DISABLED, + RCSTA_WAITING_FOR_START, ++ RCSTA_MAYBE_START, + RCSTA_WAITING_MID1, + RCSTA_WAITING_MID2, + RCSTA_WAITING_MID3, +@@ -162,7 +163,7 @@ + unsigned int rsr; + unsigned int bit_count; + unsigned int rx_bit; +- unsigned int sample,state; ++ unsigned int sample,state, sample_state; + guint64 future_cycle, last_cycle; + + _RCSTA(void); |