change log for rtems (2011-03-03)

rtems-vc at rtems.org rtems-vc at rtems.org
Thu Mar 3 14:10:28 UTC 2011


 *joel* (on branch rtems-4-10-branch):
Formatting.

M 1.2760  cpukit/ChangeLog
M 1.2346.2.80  cpukit/ChangeLog

diff -u rtems/cpukit/ChangeLog:1.2759 rtems/cpukit/ChangeLog:1.2760
--- rtems/cpukit/ChangeLog:1.2759	Thu Mar  3 00:22:47 2011
+++ rtems/cpukit/ChangeLog	Thu Mar  3 07:34:45 2011
@@ -1,8 +1,9 @@
 2011-03-03	Chris Johns <chrisj at rtems.org>
 
-	* libcsupport/src/mknod.c, libfs/src/rfs/rtems-rfs-inode.c: PR
-	1749. Fix the incorrect handling of the file type in the mode
-	value to reject invalid types as per the standard.
+	PR 1749/filesystem
+	* libcsupport/src/mknod.c, libfs/src/rfs/rtems-rfs-inode.c:
+	Fix the incorrect handling of the file type in the mode value
+	to reject invalid types as per the standard.
  
 2011-03-02	Ralf Corsépius <ralf.corsepius at rtems.org>
 

diff -u rtems/cpukit/ChangeLog:1.2346.2.79 rtems/cpukit/ChangeLog:1.2346.2.80
--- rtems/cpukit/ChangeLog:1.2346.2.79	Thu Mar  3 00:33:14 2011
+++ rtems/cpukit/ChangeLog	Thu Mar  3 07:34:34 2011
@@ -1,8 +1,9 @@
 2011-03-03	Chris Johns <chrisj at rtems.org>
 
-	* libcsupport/src/mknod.c, libfs/src/rfs/rtems-rfs-inode.c: PR
-	1749. Fix the incorrect handling of the file type in the mode
-	value to reject invalid types as per the standard.
+	PR 1749/filesystem
+	* libcsupport/src/mknod.c, libfs/src/rfs/rtems-rfs-inode.c: 
+	Fix the incorrect handling of the file type in the mode value 
+	to reject invalid types as per the standard.
 
 2011-02-08	Brett Swimley <bswimley at advanced.pro>
 


 *joel* (on branch rtems-4-9-branch):
2011-03-03	Chris Johns <chrisj at rtems.org>

	PR 1749/filesystem
	* libcsupport/src/mknod.c: Fix the incorrect handling of the file type
	in the mode value o reject invalid types as per the standard.

M 1.1539.2.71  cpukit/ChangeLog
M 1.13.6.1  cpukit/libcsupport/src/mknod.c

diff -u rtems/cpukit/ChangeLog:1.1539.2.70 rtems/cpukit/ChangeLog:1.1539.2.71
--- rtems/cpukit/ChangeLog:1.1539.2.70	Fri Jan 21 13:40:35 2011
+++ rtems/cpukit/ChangeLog	Thu Mar  3 07:38:50 2011
@@ -1,3 +1,9 @@
+2011-03-03	Chris Johns <chrisj at rtems.org>
+
+	PR 1749/filesystem
+	* libcsupport/src/mknod.c: Fix the incorrect handling of the file type
+	in the mode value o reject invalid types as per the standard.
+
 2011-01-21	Eric Norum <wenorum at lbl.gov>
 
 	* libmisc/capture/capture.c: Avoid using TCB of task just deleted.

diff -u rtems/cpukit/libcsupport/src/mknod.c:1.13 rtems/cpukit/libcsupport/src/mknod.c:1.13.6.1
--- rtems/cpukit/libcsupport/src/mknod.c:1.13	Sun Apr 18 01:05:34 2004
+++ rtems/cpukit/libcsupport/src/mknod.c	Thu Mar  3 07:38:52 2011
@@ -40,8 +40,19 @@
   const char                         *name_start;
   int                                 result;
 
-  if ( !(mode & (S_IFREG|S_IFCHR|S_IFBLK|S_IFIFO) ) )
-    rtems_set_errno_and_return_minus_one( EINVAL );
+  /*
+   * The file type is field within the mode. Check we have a sane mode set.
+   */
+  switch (mode & S_IFMT) {
+    case S_IFDIR:
+    case S_IFCHR:
+    case S_IFBLK:
+    case S_IFREG:
+    case S_IFIFO:
+      break;
+    default:
+      rtems_set_errno_and_return_minus_one( EINVAL );
+  }
 
   if ( S_ISFIFO(mode) )
     rtems_set_errno_and_return_minus_one( ENOTSUP );


 *joel*:
2011-03-03	Joel Sherrill <joel.sherrilL at OARcorp.com>

	PR 1750/bsps
	* console/erc32_console.c, make/custom/erc32.cfg: The new console
	driver did not support polled mode. It also had a bug in which it
	could lose a transmitter interrupt.

M  1.163  c/src/lib/libbsp/sparc/erc32/ChangeLog
M    1.3  c/src/lib/libbsp/sparc/erc32/console/erc32_console.c
M    1.5  c/src/lib/libbsp/sparc/erc32/make/custom/erc32.cfg

diff -u rtems/c/src/lib/libbsp/sparc/erc32/ChangeLog:1.162 rtems/c/src/lib/libbsp/sparc/erc32/ChangeLog:1.163
--- rtems/c/src/lib/libbsp/sparc/erc32/ChangeLog:1.162	Mon Feb 28 14:14:29 2011
+++ rtems/c/src/lib/libbsp/sparc/erc32/ChangeLog	Thu Mar  3 08:03:40 2011
@@ -1,3 +1,10 @@
+2011-03-03	Joel Sherrill <joel.sherrilL at OARcorp.com>
+
+	PR 1750/bsps
+	* console/erc32_console.c, make/custom/erc32.cfg: The new console
+	driver did not support polled mode. It also had a bug in which it
+	could lose a transmitter interrupt.
+
 2011-02-28	Joel Sherrill <joel.sherrill at oarcorp.com>
 
 	* console/erc32_console.c: Add polled support. Tinker with interrupt

diff -u rtems/c/src/lib/libbsp/sparc/erc32/console/erc32_console.c:1.2 rtems/c/src/lib/libbsp/sparc/erc32/console/erc32_console.c:1.3
--- rtems/c/src/lib/libbsp/sparc/erc32/console/erc32_console.c:1.2	Mon Feb 28 14:14:29 2011
+++ rtems/c/src/lib/libbsp/sparc/erc32/console/erc32_console.c	Thu Mar  3 08:03:41 2011
@@ -36,25 +36,25 @@
 
 static uint8_t erc32_console_get_register(uint32_t addr, uint8_t i)
 {
-    volatile uint32_t *reg = (volatile uint32_t *)addr;
-    return (uint8_t) reg [i];
+  volatile uint32_t *reg = (volatile uint32_t *)addr;
+  return (uint8_t) reg [i];
 }
 
 static void erc32_console_set_register(uint32_t addr, uint8_t i, uint8_t val)
 {
-    volatile uint32_t *reg = (volatile uint32_t *)addr;
-    reg [i] = val;
+  volatile uint32_t *reg = (volatile uint32_t *)addr;
+  reg [i] = val;
 }
 
 static int erc32_console_first_open(int major, int minor, void *arg);
 
 #if (CONSOLE_USE_INTERRUPTS)
-static ssize_t erc32_console_write_support_int(
+  static ssize_t erc32_console_write_support_int(
     int minor, const char *buf, size_t len);
 #else
-int console_inbyte_nonblocking( int port );
-static ssize_t erc32_console_write_support_polled(
-    int minor, const char *buf, size_t len);
+  int console_inbyte_nonblocking( int port );
+  static ssize_t erc32_console_write_support_polled(
+      int minor, const char *buf, size_t len);
 #endif
 static void erc32_console_initialize(int minor);
 
@@ -87,44 +87,44 @@
 #endif
 
 console_tbl Console_Port_Tbl [] = {
-    {
-      .sDeviceName = "/dev/console_a",
-      .deviceType = SERIAL_CUSTOM,
-      .pDeviceFns = &erc32_fns,
-      .deviceProbe = NULL,
-      .pDeviceFlow = NULL,
-      .ulMargin = 16,
-      .ulHysteresis = 8,
-      .pDeviceParams = (void *) -1,  /* could be baud rate */
-      .ulCtrlPort1 = 0,
-      .ulCtrlPort2 = 0,
-      .ulDataPort = 0,
-      .getRegister = erc32_console_get_register,
-      .setRegister = erc32_console_set_register,
-      .getData = NULL,
-      .setData = NULL,
-      .ulClock = 16,
-      .ulIntVector = ERC32_INTERRUPT_UART_A_RX_TX
-    },
-    {
-      .sDeviceName = "/dev/console_b",
-      .deviceType = SERIAL_CUSTOM,
-      .pDeviceFns = &erc32_fns,
-      .deviceProbe = NULL,
-      .pDeviceFlow = NULL,
-      .ulMargin = 16,
-      .ulHysteresis = 8,
-      .pDeviceParams = (void *) -1,  /* could be baud rate */
-      .ulCtrlPort1 = 0,
-      .ulCtrlPort2 = 0,
-      .ulDataPort = 0,
-      .getRegister = erc32_console_get_register,
-      .setRegister = erc32_console_set_register,
-      .getData = NULL,
-      .setData = NULL,
-      .ulClock = 16,
-      .ulIntVector = ERC32_INTERRUPT_UART_B_RX_TX
-    },
+  {
+    .sDeviceName = "/dev/console_a",
+    .deviceType = SERIAL_CUSTOM,
+    .pDeviceFns = &erc32_fns,
+    .deviceProbe = NULL,
+    .pDeviceFlow = NULL,
+    .ulMargin = 16,
+    .ulHysteresis = 8,
+    .pDeviceParams = (void *) -1,  /* could be baud rate */
+    .ulCtrlPort1 = 0,
+    .ulCtrlPort2 = 0,
+    .ulDataPort = 0,
+    .getRegister = erc32_console_get_register,
+    .setRegister = erc32_console_set_register,
+    .getData = NULL,
+    .setData = NULL,
+    .ulClock = 16,
+    .ulIntVector = ERC32_INTERRUPT_UART_A_RX_TX
+  },
+  {
+    .sDeviceName = "/dev/console_b",
+    .deviceType = SERIAL_CUSTOM,
+    .pDeviceFns = &erc32_fns,
+    .deviceProbe = NULL,
+    .pDeviceFlow = NULL,
+    .ulMargin = 16,
+    .ulHysteresis = 8,
+    .pDeviceParams = (void *) -1,  /* could be baud rate */
+    .ulCtrlPort1 = 0,
+    .ulCtrlPort2 = 0,
+    .ulDataPort = 0,
+    .getRegister = erc32_console_get_register,
+    .setRegister = erc32_console_set_register,
+    .getData = NULL,
+    .setData = NULL,
+    .ulClock = 16,
+    .ulIntVector = ERC32_INTERRUPT_UART_B_RX_TX
+  },
 };
 
 /* always exactly two uarts for erc32 */
@@ -136,130 +136,130 @@
 
 static int erc32_console_first_open(int major, int minor, void *arg)
 {
-    /* Check minor number */
-    if (minor < 0 || minor > 1) {
-        return -1;
-    }
-    
-    rtems_libio_open_close_args_t *oca = arg;
-    struct rtems_termios_tty *tty = oca->iop->data1;
-    console_tbl *ct = &Console_Port_Tbl [minor];
-    console_data *cd = &Console_Port_Data [minor];
-    
-    cd->termios_data = tty;
-    rtems_termios_set_initial_baud(tty, (int32_t)ct->pDeviceParams);
-    
-    return 0;
+  /* Check minor number */
+  if (minor < 0 || minor > 1) {
+    return -1;
+  }
+  
+  rtems_libio_open_close_args_t *oca = arg;
+  struct rtems_termios_tty *tty = oca->iop->data1;
+  console_tbl *ct = &Console_Port_Tbl [minor];
+  console_data *cd = &Console_Port_Data [minor];
+  
+  cd->termios_data = tty;
+  rtems_termios_set_initial_baud(tty, (int32_t)ct->pDeviceParams);
+  
+  return 0;
 }
 
 #if (CONSOLE_USE_INTERRUPTS)
 static ssize_t erc32_console_write_support_int(int minor, const char *buf, size_t len)
 {
-    console_data *cd = &Console_Port_Data[minor];
-    int k = 0;
+  console_data *cd = &Console_Port_Data[minor];
+  int k = 0;
 
-    if (minor == 0) { /* uart a */
-        for (k = 0; k < len && (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_THEA); k ++) {
-            ERC32_MEC.UART_Channel_A = (unsigned char)buf[k];
-        }
-        ERC32_Force_interrupt(ERC32_INTERRUPT_UART_A_RX_TX);
-    } else { /* uart b */
-        for (k = 0; k < len && (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_THEB); k ++) {
-            ERC32_MEC.UART_Channel_B = (unsigned char)buf[k];
-        }
-        ERC32_Force_interrupt(ERC32_INTERRUPT_UART_B_RX_TX);
+  if (minor == 0) { /* uart a */
+    for (k = 0;
+         k < len && (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_THEA); k ++) {
+      ERC32_MEC.UART_Channel_A = (unsigned char)buf[k];
     }
-    
-    if (len > 0) {
-        cd->pDeviceContext = (void *)k;
-        cd->bActive = true;
+    ERC32_Force_interrupt(ERC32_INTERRUPT_UART_A_RX_TX);
+  } else { /* uart b */
+    for (k = 0;
+         k < len && (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_THEB); k ++) {
+      ERC32_MEC.UART_Channel_B = (unsigned char)buf[k];
     }
-    
-    return 0;
+    ERC32_Force_interrupt(ERC32_INTERRUPT_UART_B_RX_TX);
+  }
+  
+  if (len > 0) {
+    cd->pDeviceContext = (void *)k;
+    cd->bActive = true;
+  }
+  
+  return 0;
 }
 
 static void erc32_console_isr_a(
-    rtems_vector_number vector
+  rtems_vector_number vector
 )
 {
-    console_data *cd = &Console_Port_Data[0];
+  console_data *cd = &Console_Port_Data[0];
 
-    /* check for error */
-    if (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_ERRA) {
-        ERC32_MEC.UART_Status = ERC32_MEC_UART_STATUS_CLRA;
-        ERC32_MEC.Control = ERC32_MEC.Control;
-    }
+  /* check for error */
+  if (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_ERRA) {
+    ERC32_MEC.UART_Status = ERC32_MEC_UART_STATUS_CLRA;
+    ERC32_MEC.Control = ERC32_MEC.Control;
+  }
 
-    do {
-        int chars_to_dequeue = (int)cd->pDeviceContext;
-        int rv = 0;
-        int i = 0;
-        char buf[CONSOLE_BUF_SIZE];
+  do {
+    int chars_to_dequeue = (int)cd->pDeviceContext;
+    int rv = 0;
+    int i = 0;
+    char buf[CONSOLE_BUF_SIZE];
         
-        /* enqueue received chars */
-        while (i < CONSOLE_BUF_SIZE) {
-            if (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_DRA) {
-                buf[i] = ERC32_MEC.UART_Channel_A;
-                ++i;
-            } else {
-                break;
-            }
-        }
-        rtems_termios_enqueue_raw_characters(cd->termios_data, buf, i);
+    /* enqueue received chars */
+    while (i < CONSOLE_BUF_SIZE) {
+      if (!(ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_DRA))
+        break;
+      buf[i] = ERC32_MEC.UART_Channel_A;
+      ++i;
+    }
+    if ( i ) 
+      rtems_termios_enqueue_raw_characters(cd->termios_data, buf, i);
 
-        /* dequeue transmitted chars */
+    /* dequeue transmitted chars */
+    if (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_THEA) {
+      rv = rtems_termios_dequeue_characters(
+         cd->termios_data, chars_to_dequeue);
+      if ( !rv ) {
         cd->pDeviceContext = 0;
-        if (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_THEA) {
-          rv = rtems_termios_dequeue_characters(
-             cd->termios_data, chars_to_dequeue);
-          if ( !rv ) {
-            cd->bActive = false;
-            ERC32_Clear_interrupt (ERC32_INTERRUPT_UART_A_RX_TX);
-          }
-        }
-    } while (ERC32_Is_interrupt_pending (ERC32_INTERRUPT_UART_A_RX_TX));
+        cd->bActive = false;
+      }
+      ERC32_Clear_interrupt (ERC32_INTERRUPT_UART_A_RX_TX);
+    }
+  } while (ERC32_Is_interrupt_pending (ERC32_INTERRUPT_UART_A_RX_TX));
 }
 
 static void erc32_console_isr_b(
-    rtems_vector_number vector
+  rtems_vector_number vector
 )
 {
-    console_data *cd = &Console_Port_Data[1];
+  console_data *cd = &Console_Port_Data[1];
 
-    /* check for error */
-    if (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_ERRB) {
-        ERC32_MEC.UART_Status = ERC32_MEC_UART_STATUS_CLRB;
-        ERC32_MEC.Control = ERC32_MEC.Control;
-    }
+  /* check for error */
+  if (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_ERRB) {
+      ERC32_MEC.UART_Status = ERC32_MEC_UART_STATUS_CLRB;
+      ERC32_MEC.Control = ERC32_MEC.Control;
+  }
 
-    do {
-        int chars_to_dequeue = (int)cd->pDeviceContext;
-        int rv = 0;
-        int i = 0;
-        char buf[CONSOLE_BUF_SIZE];
+  do {
+    int chars_to_dequeue = (int)cd->pDeviceContext;
+    int rv = 0;
+    int i = 0;
+    char buf[CONSOLE_BUF_SIZE];
         
-        /* enqueue received chars */
-        while (i < CONSOLE_BUF_SIZE) {
-            if (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_DRB) {
-                buf[i] = ERC32_MEC.UART_Channel_B;
-                ++i;
-            } else {
-                break;
-            }
-        }
-        rtems_termios_enqueue_raw_characters(cd->termios_data, buf, i);
+    /* enqueue received chars */
+    while (i < CONSOLE_BUF_SIZE) {
+      if (!(ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_DRB))
+        break;
+      buf[i] = ERC32_MEC.UART_Channel_B;
+      ++i;
+    }
+    if ( i ) 
+      rtems_termios_enqueue_raw_characters(cd->termios_data, buf, i);
 
-        /* dequeue transmitted chars */
+    /* dequeue transmitted chars */
+    if (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_THEB) {
+      rv = rtems_termios_dequeue_characters(
+         cd->termios_data, chars_to_dequeue);
+      if ( !rv ) {
         cd->pDeviceContext = 0;
-        if (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_THEB) {
-          rv = rtems_termios_dequeue_characters(
-             cd->termios_data, chars_to_dequeue);
-          if ( !rv ) {
-            cd->bActive = false;
-            ERC32_Clear_interrupt (ERC32_INTERRUPT_UART_B_RX_TX);
-          }
-        }
-    } while (ERC32_Is_interrupt_pending (ERC32_INTERRUPT_UART_B_RX_TX));
+        cd->bActive = false;
+      }
+      ERC32_Clear_interrupt (ERC32_INTERRUPT_UART_B_RX_TX);
+    }
+  } while (ERC32_Is_interrupt_pending (ERC32_INTERRUPT_UART_B_RX_TX));
 }
 #else
 
@@ -292,23 +292,23 @@
     int minor
 )
 {
-    console_data *cd = &Console_Port_Data [minor];
+  console_data *cd = &Console_Port_Data [minor];
 
-    cd->bActive = false;
-    cd->pDeviceContext = 0;
+  cd->bActive = false;
+  cd->pDeviceContext = 0;
 
-   /*
-    * Initialize the Termios infrastructure.  If Termios has already
-    * been initialized by another device driver, then this call will
-    * have no effect.
-    */
-    rtems_termios_initialize();
-
-   /*
-    *  Initialize Hardware
-    */
-#if (CONSOLE_USE_INTERRUPTS)
+ /*
+  * Initialize the Termios infrastructure.  If Termios has already
+  * been initialized by another device driver, then this call will
+  * have no effect.
+  */
+  rtems_termios_initialize();
+
+ /*
+  *  Initialize Hardware
+  */
+  #if (CONSOLE_USE_INTERRUPTS)
     set_vector(erc32_console_isr_a, CONSOLE_UART_A_TRAP, 1);
     set_vector(erc32_console_isr_b, CONSOLE_UART_B_TRAP, 1);
-#endif
+  #endif
 }


 *joel* (on branch rtems-4-10-branch):
2011-03-03	Joel Sherrill <joel.sherrilL at OARcorp.com>

	PR 1750/bsps
	* console/erc32_console.c: The new console driver did not support
	polled mode. It also had a bug in which it could lose a transmitter
	interrupt.

M 1.152.2.2  c/src/lib/libbsp/sparc/erc32/ChangeLog
M 1.1.2.1  c/src/lib/libbsp/sparc/erc32/console/erc32_console.c

diff -u rtems/c/src/lib/libbsp/sparc/erc32/ChangeLog:1.152.2.1 rtems/c/src/lib/libbsp/sparc/erc32/ChangeLog:1.152.2.2
--- rtems/c/src/lib/libbsp/sparc/erc32/ChangeLog:1.152.2.1	Wed Feb  2 09:17:14 2011
+++ rtems/c/src/lib/libbsp/sparc/erc32/ChangeLog	Thu Mar  3 08:03:48 2011
@@ -1,3 +1,10 @@
+2011-03-03	Joel Sherrill <joel.sherrilL at OARcorp.com>
+
+	PR 1750/bsps
+	* console/erc32_console.c: The new console driver did not support
+	polled mode. It also had a bug in which it could lose a transmitter
+	interrupt.
+
 2011-02-02	Ralf Corsépius <ralf.corsepius at rtems.org>
 
 	* configure.ac: Require autoconf-2.68, automake-1.11.1.

diff -u rtems/c/src/lib/libbsp/sparc/erc32/console/erc32_console.c:1.1 rtems/c/src/lib/libbsp/sparc/erc32/console/erc32_console.c:1.1.2.1
--- rtems/c/src/lib/libbsp/sparc/erc32/console/erc32_console.c:1.1	Fri May  7 07:13:23 2010
+++ rtems/c/src/lib/libbsp/sparc/erc32/console/erc32_console.c	Thu Mar  3 08:03:48 2011
@@ -27,6 +27,7 @@
 #include <libchip/sersupp.h>
 
 #include <bsp.h>
+#include <bspopts.h>
 
 #define CONSOLE_BUF_SIZE (16)
 
@@ -35,23 +36,32 @@
 
 static uint8_t erc32_console_get_register(uint32_t addr, uint8_t i)
 {
-    volatile uint32_t *reg = (volatile uint32_t *)addr;
-    return (uint8_t) reg [i];
+  volatile uint32_t *reg = (volatile uint32_t *)addr;
+  return (uint8_t) reg [i];
 }
 
 static void erc32_console_set_register(uint32_t addr, uint8_t i, uint8_t val)
 {
-    volatile uint32_t *reg = (volatile uint32_t *)addr;
-    reg [i] = val;
+  volatile uint32_t *reg = (volatile uint32_t *)addr;
+  reg [i] = val;
 }
 
 static int erc32_console_first_open(int major, int minor, void *arg);
-static ssize_t erc32_console_write_support_int(int minor, const char *buf, size_t len);
+
+#if (CONSOLE_USE_INTERRUPTS)
+  static ssize_t erc32_console_write_support_int(
+    int minor, const char *buf, size_t len);
+#else
+  int console_inbyte_nonblocking( int port );
+  static ssize_t erc32_console_write_support_polled(
+      int minor, const char *buf, size_t len);
+#endif
 static void erc32_console_initialize(int minor);
 
 rtems_device_minor_number Console_Port_Minor = 0;
 
-console_fns erc32_fns = {
+#if (CONSOLE_USE_INTERRUPTS)
+  console_fns erc32_fns = {
     libchip_serial_default_probe,           /* deviceProbe */
     erc32_console_first_open,               /* deviceFirstOpen */
     NULL,                                   /* deviceLastClose */
@@ -60,48 +70,61 @@
     erc32_console_initialize,               /* deviceInitialize */
     NULL,                                   /* deviceWritePolled */
     NULL,                                   /* deviceSetAttributes */
-    true                                    /* deviceOutputUsesInterrupts */
-};
+    TERMIOS_IRQ_DRIVEN                      /* deviceOutputUsesInterrupts */
+  };
+#else
+  console_fns erc32_fns = {
+    libchip_serial_default_probe,           /* deviceProbe */
+    erc32_console_first_open,               /* deviceFirstOpen */
+    NULL,                                   /* deviceLastClose */
+    console_inbyte_nonblocking,             /* deviceRead */
+    erc32_console_write_support_polled,     /* deviceWrite */
+    erc32_console_initialize,               /* deviceInitialize */
+    NULL,                                   /* deviceWritePolled */
+    NULL,                                   /* deviceSetAttributes */
+    TERMIOS_POLLED                          /* deviceOutputUsesInterrupts */
+  };
+#endif
 
 console_tbl Console_Port_Tbl [] = {
-    {
-      .sDeviceName = "/dev/console",
-      .deviceType = SERIAL_CUSTOM,
-      .pDeviceFns = &erc32_fns,
-      .deviceProbe = NULL,
-      .pDeviceFlow = NULL,
-      .ulMargin = 16,
-      .ulHysteresis = 8,
-      .pDeviceParams = (void *) 1,
-      .ulCtrlPort1 = 0,
-      .ulCtrlPort2 = 0,
-      .ulDataPort = 0,
-      .getRegister = erc32_console_get_register,
-      .setRegister = erc32_console_set_register,
-      .getData = NULL,
-      .setData = NULL,
-      .ulClock = 16,
-      .ulIntVector = ERC32_INTERRUPT_UART_A_RX_TX
-    },
-    {
-      .sDeviceName = "/dev/console_b",
-      .deviceType = SERIAL_CUSTOM,
-      .pDeviceFns = &erc32_fns,
-      .deviceProbe = NULL,
-      .pDeviceFlow = NULL,
-      .ulMargin = 16,
-      .ulHysteresis = 8,
-      .pDeviceParams = (void *) 1,
-      .ulCtrlPort1 = 0,
-      .ulCtrlPort2 = 0,
-      .ulDataPort = 0,
-      .getRegister = erc32_console_get_register,
-      .setRegister = erc32_console_set_register,
-      .getData = NULL,
-      .setData = NULL,
-      .ulClock = 16,
-      .ulIntVector = ERC32_INTERRUPT_UART_B_RX_TX
-    },
+  {
+    .sDeviceName = "/dev/console_a",
+    .deviceType = SERIAL_CUSTOM,
+    .pDeviceFns = &erc32_fns,
+    .deviceProbe = NULL,
+    .pDeviceFlow = NULL,
+    .ulMargin = 16,
+    .ulHysteresis = 8,
+    .pDeviceParams = (void *) -1,  /* could be baud rate */
+    .ulCtrlPort1 = 0,
+    .ulCtrlPort2 = 0,
+    .ulDataPort = 0,
+    .getRegister = erc32_console_get_register,
+    .setRegister = erc32_console_set_register,
+    .getData = NULL,
+    .setData = NULL,
+    .ulClock = 16,
+    .ulIntVector = ERC32_INTERRUPT_UART_A_RX_TX
+  },
+  {
+    .sDeviceName = "/dev/console_b",
+    .deviceType = SERIAL_CUSTOM,
+    .pDeviceFns = &erc32_fns,
+    .deviceProbe = NULL,
+    .pDeviceFlow = NULL,
+    .ulMargin = 16,
+    .ulHysteresis = 8,
+    .pDeviceParams = (void *) -1,  /* could be baud rate */
+    .ulCtrlPort1 = 0,
+    .ulCtrlPort2 = 0,
+    .ulDataPort = 0,
+    .getRegister = erc32_console_get_register,
+    .setRegister = erc32_console_set_register,
+    .getData = NULL,
+    .setData = NULL,
+    .ulClock = 16,
+    .ulIntVector = ERC32_INTERRUPT_UART_B_RX_TX
+  },
 };
 
 /* always exactly two uarts for erc32 */
@@ -113,125 +136,152 @@
 
 static int erc32_console_first_open(int major, int minor, void *arg)
 {
-    /* Check minor number */
-    if (minor < 0 || minor > 1) {
-        return -1;
-    }
-    
-    rtems_libio_open_close_args_t *oca = arg;
-    struct rtems_termios_tty *tty = oca->iop->data1;
-    console_tbl *ct = &Console_Port_Tbl [minor];
-    console_data *cd = &Console_Port_Data [minor];
-    
-    cd->termios_data = tty;
-    rtems_termios_set_initial_baud(tty, (int32_t)ct->pDeviceParams);
-    
-    return 0;
+  /* Check minor number */
+  if (minor < 0 || minor > 1) {
+    return -1;
+  }
+  
+  rtems_libio_open_close_args_t *oca = arg;
+  struct rtems_termios_tty *tty = oca->iop->data1;
+  console_tbl *ct = &Console_Port_Tbl [minor];
+  console_data *cd = &Console_Port_Data [minor];
+  
+  cd->termios_data = tty;
+  rtems_termios_set_initial_baud(tty, (int32_t)ct->pDeviceParams);
+  
+  return 0;
 }
 
+#if (CONSOLE_USE_INTERRUPTS)
 static ssize_t erc32_console_write_support_int(int minor, const char *buf, size_t len)
 {
-    console_data *cd = &Console_Port_Data[minor];
-    int k = 0;
+  console_data *cd = &Console_Port_Data[minor];
+  int k = 0;
 
-    if (minor == 0) { /* uart a */
-        for (k = 0; k < len && (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_THEA); k ++) {
-            ERC32_MEC.UART_Channel_A = (unsigned char)buf[k];
-        }
-        ERC32_Force_interrupt(ERC32_INTERRUPT_UART_A_RX_TX);
-    } else { /* uart b */
-        for (k = 0; k < len && (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_THEB); k ++) {
-            ERC32_MEC.UART_Channel_B = (unsigned char)buf[k];
-        }
-        ERC32_Force_interrupt(ERC32_INTERRUPT_UART_B_RX_TX);
-    }
-    
-    if (len > 0) {
-        cd->pDeviceContext = (void *)k;
-        cd->bActive = true;
+  if (minor == 0) { /* uart a */
+    for (k = 0;
+         k < len && (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_THEA); k ++) {
+      ERC32_MEC.UART_Channel_A = (unsigned char)buf[k];
+    }
+    ERC32_Force_interrupt(ERC32_INTERRUPT_UART_A_RX_TX);
+  } else { /* uart b */
+    for (k = 0;
+         k < len && (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_THEB); k ++) {
+      ERC32_MEC.UART_Channel_B = (unsigned char)buf[k];
     }
-    
-    return 0;
+    ERC32_Force_interrupt(ERC32_INTERRUPT_UART_B_RX_TX);
+  }
+  
+  if (len > 0) {
+    cd->pDeviceContext = (void *)k;
+    cd->bActive = true;
+  }
+  
+  return 0;
 }
 
 static void erc32_console_isr_a(
-    rtems_vector_number vector
+  rtems_vector_number vector
 )
 {
-    console_data *cd = &Console_Port_Data[0];
+  console_data *cd = &Console_Port_Data[0];
 
-    /* check for error */
-    if (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_ERRA) {
-        ERC32_MEC.UART_Status = ERC32_MEC_UART_STATUS_CLRA;
-        ERC32_MEC.Control = ERC32_MEC.Control;
-    }
-
-    do {
-        int chars_to_dequeue = (int)cd->pDeviceContext;
-        int rv = 0;
-        int i = 0;
-        char buf[CONSOLE_BUF_SIZE];
+  /* check for error */
+  if (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_ERRA) {
+    ERC32_MEC.UART_Status = ERC32_MEC_UART_STATUS_CLRA;
+    ERC32_MEC.Control = ERC32_MEC.Control;
+  }
+
+  do {
+    int chars_to_dequeue = (int)cd->pDeviceContext;
+    int rv = 0;
+    int i = 0;
+    char buf[CONSOLE_BUF_SIZE];
         
-        /* enqueue received chars */
-        while (i < CONSOLE_BUF_SIZE) {
-            if (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_DRA) {
-                buf[i] = ERC32_MEC.UART_Channel_A;
-                ++i;
-            } else {
-                break;
-            }
-        }
-        rtems_termios_enqueue_raw_characters(cd->termios_data, buf, i);
+    /* enqueue received chars */
+    while (i < CONSOLE_BUF_SIZE) {
+      if (!(ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_DRA))
+        break;
+      buf[i] = ERC32_MEC.UART_Channel_A;
+      ++i;
+    }
+    if ( i ) 
+      rtems_termios_enqueue_raw_characters(cd->termios_data, buf, i);
 
-        /* dequeue transmitted chars */
+    /* dequeue transmitted chars */
+    if (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_THEA) {
+      rv = rtems_termios_dequeue_characters(
+         cd->termios_data, chars_to_dequeue);
+      if ( !rv ) {
         cd->pDeviceContext = 0;
-        rv = rtems_termios_dequeue_characters(cd->termios_data, chars_to_dequeue);
-        if (rv == 0 && !(ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_DRA)) {
-            cd->bActive = false;
-            ERC32_Clear_interrupt (ERC32_INTERRUPT_UART_A_RX_TX);
-        }
-    } while (ERC32_Is_interrupt_pending (ERC32_INTERRUPT_UART_A_RX_TX));
+        cd->bActive = false;
+      }
+      ERC32_Clear_interrupt (ERC32_INTERRUPT_UART_A_RX_TX);
+    }
+  } while (ERC32_Is_interrupt_pending (ERC32_INTERRUPT_UART_A_RX_TX));
 }
 
 static void erc32_console_isr_b(
-    rtems_vector_number vector
+  rtems_vector_number vector
 )
 {
-    console_data *cd = &Console_Port_Data[1];
-
-    /* check for error */
-    if (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_ERRB) {
-        ERC32_MEC.UART_Status = ERC32_MEC_UART_STATUS_CLRB;
-        ERC32_MEC.Control = ERC32_MEC.Control;
-    }
+  console_data *cd = &Console_Port_Data[1];
 
-    do {
-        int chars_to_dequeue = (int)cd->pDeviceContext;
-        int rv = 0;
-        int i = 0;
-        char buf[CONSOLE_BUF_SIZE];
+  /* check for error */
+  if (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_ERRB) {
+      ERC32_MEC.UART_Status = ERC32_MEC_UART_STATUS_CLRB;
+      ERC32_MEC.Control = ERC32_MEC.Control;
+  }
+
+  do {
+    int chars_to_dequeue = (int)cd->pDeviceContext;
+    int rv = 0;
+    int i = 0;
+    char buf[CONSOLE_BUF_SIZE];
         
-        /* enqueue received chars */
-        while (i < CONSOLE_BUF_SIZE) {
-            if (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_DRB) {
-                buf[i] = ERC32_MEC.UART_Channel_B;
-                ++i;
-            } else {
-                break;
-            }
-        }
-        rtems_termios_enqueue_raw_characters(cd->termios_data, buf, i);
+    /* enqueue received chars */
+    while (i < CONSOLE_BUF_SIZE) {
+      if (!(ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_DRB))
+        break;
+      buf[i] = ERC32_MEC.UART_Channel_B;
+      ++i;
+    }
+    if ( i ) 
+      rtems_termios_enqueue_raw_characters(cd->termios_data, buf, i);
 
-        /* dequeue transmitted chars */
+    /* dequeue transmitted chars */
+    if (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_THEB) {
+      rv = rtems_termios_dequeue_characters(
+         cd->termios_data, chars_to_dequeue);
+      if ( !rv ) {
         cd->pDeviceContext = 0;
-        rv = rtems_termios_dequeue_characters(cd->termios_data, chars_to_dequeue);
-        if (rv == 0 && !(ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_DRB)) {
-            cd->bActive = false;
-            ERC32_Clear_interrupt (ERC32_INTERRUPT_UART_B_RX_TX);
-        }
-    } while (ERC32_Is_interrupt_pending (ERC32_INTERRUPT_UART_B_RX_TX));
+        cd->bActive = false;
+      }
+      ERC32_Clear_interrupt (ERC32_INTERRUPT_UART_B_RX_TX);
+    }
+  } while (ERC32_Is_interrupt_pending (ERC32_INTERRUPT_UART_B_RX_TX));
+}
+#else
+
+extern void console_outbyte_polled( int  port, unsigned char ch );
+
+static ssize_t erc32_console_write_support_polled(
+  int         minor,
+  const char *buf,
+  size_t      len
+)
+{
+  int nwrite = 0;
+
+  while (nwrite < len) {
+    console_outbyte_polled( minor, *buf++ );
+    nwrite++;
+  }
+  return nwrite;
 }
 
+#endif
+
 
 /*
  *  Console Device Driver Entry Points
@@ -242,21 +292,23 @@
     int minor
 )
 {
-    console_data *cd = &Console_Port_Data [minor];
+  console_data *cd = &Console_Port_Data [minor];
 
-    cd->bActive = false;
-    cd->pDeviceContext = 0;
+  cd->bActive = false;
+  cd->pDeviceContext = 0;
 
-   /*
-    * Initialize the Termios infrastructure.  If Termios has already
-    * been initialized by another device driver, then this call will
-    * have no effect.
-    */
-    rtems_termios_initialize();
-
-   /*
-    *  Initialize Hardware
-    */
+ /*
+  * Initialize the Termios infrastructure.  If Termios has already
+  * been initialized by another device driver, then this call will
+  * have no effect.
+  */
+  rtems_termios_initialize();
+
+ /*
+  *  Initialize Hardware
+  */
+  #if (CONSOLE_USE_INTERRUPTS)
     set_vector(erc32_console_isr_a, CONSOLE_UART_A_TRAP, 1);
     set_vector(erc32_console_isr_b, CONSOLE_UART_B_TRAP, 1);
+  #endif
 }



--

Generated by Deluxe Loginfo [http://www.codewiz.org/projects/index.html#loginfo] 2.122 by Bernardo Innocenti <bernie at develer.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/vc/attachments/20110303/fab7d59a/attachment-0001.html>


More information about the vc mailing list