pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/emulators/gpsim Bug fixes and cleanups for the uart em...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/4273d501fc73
branches:  trunk
changeset: 474594:4273d501fc73
user:      bouyer <bouyer%pkgsrc.org@localhost>
date:      Sun May 02 20:08:14 2004 +0000

description:
Bug fixes and cleanups for the uart emulator. Submitted on sourceforge as
bug id 944916 and 946541.

diffstat:

 emulators/gpsim/Makefile         |    3 +-
 emulators/gpsim/distinfo         |    7 +-
 emulators/gpsim/patches/patch-ab |   27 +++++
 emulators/gpsim/patches/patch-ac |   34 +++++++
 emulators/gpsim/patches/patch-ad |   39 ++++++++
 emulators/gpsim/patches/patch-ae |  187 +++++++++++++++++++++++++++++++++++++++
 emulators/gpsim/patches/patch-af |   21 ++++
 7 files changed, 316 insertions(+), 2 deletions(-)

diffs (truncated from 356 to 300 lines):

diff -r ba96b9970960 -r 4273d501fc73 emulators/gpsim/Makefile
--- a/emulators/gpsim/Makefile  Sun May 02 20:07:36 2004 +0000
+++ b/emulators/gpsim/Makefile  Sun May 02 20:08:14 2004 +0000
@@ -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 -r ba96b9970960 -r 4273d501fc73 emulators/gpsim/distinfo
--- a/emulators/gpsim/distinfo  Sun May 02 20:07:36 2004 +0000
+++ b/emulators/gpsim/distinfo  Sun May 02 20:08:14 2004 +0000
@@ -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 -r ba96b9970960 -r 4273d501fc73 emulators/gpsim/patches/patch-ab
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/emulators/gpsim/patches/patch-ab  Sun May 02 20:08:14 2004 +0000
@@ -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 -r ba96b9970960 -r 4273d501fc73 emulators/gpsim/patches/patch-ac
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/emulators/gpsim/patches/patch-ac  Sun May 02 20:08:14 2004 +0000
@@ -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 -r ba96b9970960 -r 4273d501fc73 emulators/gpsim/patches/patch-ad
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/emulators/gpsim/patches/patch-ad  Sun May 02 20:08:14 2004 +0000
@@ -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 -r ba96b9970960 -r 4273d501fc73 emulators/gpsim/patches/patch-ae
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/emulators/gpsim/patches/patch-ae  Sun May 02 20:08:14 2004 +0000
@@ -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);



Home | Main Index | Thread Index | Old Index