This is the mail archive of the ecos-patches@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

MPC555 serial exception fix


A small fix to prevent an exception occuring when buffer overrun /
parity / line noise / frame error(s) occur.
The scsr register should be treated as read-only and is cleared by
reading the data register, not by attempting to clear any set bits.

I've also added line status callback support, although nothing other
than PPPd seems to use it, and only then for modem carrier dectection.

I've submitted a copyright assignment form to assign@gnu.org, in case it
is needed, and am awaiting a reply.

Regards,

Steven Clugston

Mechanical and Systems Engineering
Newcastle University
Stephenson Building
Claremont Road
Newcastle-upon-Tyne
NE1 7RU
UK

Index: ecos/packages/devs/serial/powerpc/mpc555/current/ChangeLog
===================================================================
RCS file:
/cvs/ecos/ecos/packages/devs/serial/powerpc/mpc555/current/ChangeLog,v
retrieving revision 1.1
diff -u -r1.1 ChangeLog
--- ecos/packages/devs/serial/powerpc/mpc555/current/ChangeLog	6 May
2008 19:04:21 -0000	1.1
+++ ecos/packages/devs/serial/powerpc/mpc555/current/ChangeLog	13 May
2008 13:19:14 -0000
@@ -1,3 +1,9 @@
+2008-05-13  Steven Clugston  <steven.clugston@ncl.ac.uk>
+  * cdl/ser_powerpc_mpc555.cdl: Add line status
+  * src/mpc555_serial_with_ints.c: 
+    Fixed exception caused by attempt to clear scsr bits.
+    Add line status callbacks
+
 2008-04-06  Steven Clugston <steven.clugston@ncl.ac.uk>
 
 	* Refactored cme555 package to more generic mpc555
Index:
ecos/packages/devs/serial/powerpc/mpc555/current/cdl/ser_powerpc_mpc555.
cdl
===================================================================
RCS file:
/cvs/ecos/ecos/packages/devs/serial/powerpc/mpc555/current/cdl/ser_power
pc_mpc555.cdl,v
retrieving revision 1.1
diff -u -r1.1 ser_powerpc_mpc555.cdl
---
ecos/packages/devs/serial/powerpc/mpc555/current/cdl/ser_powerpc_mpc555.
cdl	6 May 2008 19:04:21 -0000	1.1
+++
ecos/packages/devs/serial/powerpc/mpc555/current/cdl/ser_powerpc_mpc555.
cdl	13 May 2008 13:19:14 -0000
@@ -32,6 +32,9 @@
 ##
 ## This exception does not invalidate any other reasons why a work
based on
 ## this file might be covered by the GNU General Public License.
+##
+## Alternative licenses for eCos may be arranged by contacting Red Hat,
Inc.
+## at http://sources.redhat.com/ecos/ecos-license/
 ## -------------------------------------------
 #####ECOSGPLCOPYRIGHTEND####
 # ====================================================================
@@ -72,6 +75,7 @@
     display       "mpc555 PowerPC serial port A driver"
     flavor        bool
     default_value 0
+    implements    CYGINT_IO_SERIAL_LINE_STATUS_HW
     description   "
         This option includes the serial device driver for the mpc555
         PowerPC port A."
@@ -110,6 +114,7 @@
     display       "mpc555 PowerPC serial port B driver"
     flavor        bool
     default_value 1
+    implements    CYGINT_IO_SERIAL_LINE_STATUS_HW
     description   "
         This option includes the serial device driver for the mpc555
         PowerPC port B."
Index:
ecos/packages/devs/serial/powerpc/mpc555/current/src/mpc555_serial_with_
ints.c
===================================================================
RCS file:
/cvs/ecos/ecos/packages/devs/serial/powerpc/mpc555/current/src/mpc555_se
rial_with_ints.c,v
retrieving revision 1.1
diff -u -r1.1 mpc555_serial_with_ints.c
---
ecos/packages/devs/serial/powerpc/mpc555/current/src/mpc555_serial_with_
ints.c	6 May 2008 19:04:21 -0000	1.1
+++
ecos/packages/devs/serial/powerpc/mpc555/current/src/mpc555_serial_with_
ints.c	13 May 2008 13:19:14 -0000
@@ -32,6 +32,9 @@
 //
 // This exception does not invalidate any other reasons why a work
based on
 // this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat,
Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
 // -------------------------------------------
 //####ECOSGPLCOPYRIGHTEND####
 
//======================================================================
====
@@ -609,14 +612,38 @@
   cyg_uint16 scdr;
   cyg_uint16 scsr;
 
-  // Allways read out the received character, in order to clear
receiver flags
-  HAL_READ_UINT16(port + MPC555_SERIAL_SCxDR, scdr);
+#ifdef CYGOPT_IO_SERIAL_SUPPORT_LINE_STATUS
+  cyg_serial_line_status_t stat;
+#endif
 
   HAL_READ_UINT16(port + MPC555_SERIAL_SCxSR, scsr);
+  // Always read out the received character, in order to clear receiver
flags
+  HAL_READ_UINT16(port + MPC555_SERIAL_SCxDR, scdr);
+  
   if(scsr & (cyg_uint16)MPC555_SERIAL_SCxSR_ERRORS)
   {
-    scsr &= ~((cyg_uint16)MPC555_SERIAL_SCxSR_ERRORS);
-    HAL_WRITE_UINT16(port + MPC555_SERIAL_SCxSR, scsr);
+#ifdef CYGOPT_IO_SERIAL_SUPPORT_LINE_STATUS
+    if(scsr & MPC555_SERIAL_SCxSR_OR)
+    {
+      stat.which = CYGNUM_SERIAL_STATUS_OVERRUNERR;
+      (chan->callbacks->indicate_status)(chan, &stat);
+    } 
+    if(scsr & MPC555_SERIAL_SCxSR_NF)
+    {
+      stat.which = CYGNUM_SERIAL_STATUS_NOISEERR;
+      (chan->callbacks->indicate_status)(chan, &stat);
+    } 
+    if(scsr & MPC555_SERIAL_SCxSR_FE)
+    {
+      stat.which = CYGNUM_SERIAL_STATUS_FRAMEERR;
+      (chan->callbacks->indicate_status)(chan, &stat);
+    } 
+    if(scsr & MPC555_SERIAL_SCxSR_PF)
+    {
+      stat.which = CYGNUM_SERIAL_STATUS_PARITYERR;
+      (chan->callbacks->indicate_status)(chan, &stat);
+    }
+#endif
   }
   else
   {
Index: ecos/packages/io/serial/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/serial/current/ChangeLog,v
retrieving revision 1.72
diff -u -r1.72 ChangeLog
--- ecos/packages/io/serial/current/ChangeLog	30 Jan 2008 18:39:11
-0000	1.72
+++ ecos/packages/io/serial/current/ChangeLog	13 May 2008 13:19:29
-0000
@@ -1,3 +1,7 @@
+2008-05-13  Steven Clugston  <steven.clugston@ncl.ac.uk>
+
+	* tests/ser_test_protocol.inl : Add mpc555 generic platform
+  
 2008-01-30  Andrew Lunn  <andrew.lunn@ascom.ch>
 
 	* src/common/termiostty.c (termios_lookup): Add missing set of
Index: ecos/packages/io/serial/current/tests/ser_test_protocol.inl
===================================================================
RCS file:
/cvs/ecos/ecos/packages/io/serial/current/tests/ser_test_protocol.inl,v
retrieving revision 1.31
diff -u -r1.31 ser_test_protocol.inl
--- ecos/packages/io/serial/current/tests/ser_test_protocol.inl	3 Aug
2005 21:00:34 -0000	1.31
+++ ecos/packages/io/serial/current/tests/ser_test_protocol.inl	13 May
2008 13:19:29 -0000
@@ -113,6 +113,15 @@
 #  define TEST_TTY_DEV CYGDAT_IO_SERIAL_TTY_TTY0_DEV
 # endif
 #endif
+#if defined(CYGPKG_HAL_POWERPC_MPC5xx)                \
+    && defined(CYGPKG_IO_SERIAL_POWERPC_MPC555)                \
+    && defined(CYGPKG_IO_SERIAL_POWERPC_MPC555_SERIAL_A)
+# define TEST_CRASH_ID "mpc555"
+# define TEST_SER_DEV CYGDAT_IO_SERIAL_POWERPC_MPC555_SERIAL_A_NAME
+# if defined(CYGPKG_IO_SERIAL_TTY_TTY0)
+#  define TEST_TTY_DEV CYGDAT_IO_SERIAL_TTY_TTY0_DEV
+# endif
+#endif
 
 // We can't rely on haldiag for ser_filter detection - it may not
define
 // a working character reading function.

Attachment: mpc555_serial.diff
Description: mpc555_serial.diff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]