<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>change log for rtems (2010-07-24)</title>
</head>
<body text='#000000' bgcolor='#ffffff'>
<a name='cs1'></a>
<table border='0' cellspacing='0' cellpadding='5' width='100%' bgcolor='#eeeeee'>
<tr><td colspan='3' bgcolor='#dddddd'>
 <font color='#bb2222'><strong>joel</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>2010-07-24 Joel Sherrill <joel.sherrill@oarcorp.com>

        * libcsupport/Makefile.am, libcsupport/src/termios_baud2num.c,
        libcsupport/src/termios_num2baud.c: Use RTEMS associations to
        simplify code and make easier for coverage.
        * libcsupport/src/termios_baudtable.c: New file.
</pre></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/ChangeLog.diff?r1=text&tr1=1.2516&r2=text&tr2=1.2517&diff_format=h">M</a></td><td width='1%'>1.2517</td><td width='100%'>cpukit/ChangeLog</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libcsupport/Makefile.am.diff?r1=text&tr1=1.127&r2=text&tr2=1.128&diff_format=h">M</a></td><td width='1%'>1.128</td><td width='100%'>cpukit/libcsupport/Makefile.am</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libcsupport/src/termios_baud2num.c.diff?r1=text&tr1=1.4&r2=text&tr2=1.5&diff_format=h">M</a></td><td width='1%'>1.5</td><td width='100%'>cpukit/libcsupport/src/termios_baud2num.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libcsupport/src/termios_baudtable.c?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">cpukit/libcsupport/src/termios_baudtable.c</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libcsupport/src/termios_num2baud.c.diff?r1=text&tr1=1.3&r2=text&tr2=1.4&diff_format=h">M</a></td><td width='1%'>1.4</td><td width='100%'>cpukit/libcsupport/src/termios_num2baud.c</td></tr>
</table>
<pre>
<font color='#006600'>diff -u rtems/cpukit/ChangeLog:1.2516 rtems/cpukit/ChangeLog:1.2517
--- rtems/cpukit/ChangeLog:1.2516       Thu Jul 22 19:11:32 2010
+++ rtems/cpukit/ChangeLog      Sat Jul 24 11:12:48 2010
</font><font color='#997700'>@@ -1,3 +1,10 @@
</font><font color='#000088'>+2010-07-24    Joel Sherrill <joel.sherrill@oarcorp.com>
+
+       * libcsupport/Makefile.am, libcsupport/src/termios_baud2num.c,
+       libcsupport/src/termios_num2baud.c: Use RTEMS associations to
+       simplify code and make easier for coverage.
+       * libcsupport/src/termios_baudtable.c: New file.
+
</font> 2010-07-22        Joel Sherrill <joel.sherrill@oarcorp.com>
 
        PR 1627/testing

<font color='#006600'>diff -u rtems/cpukit/libcsupport/Makefile.am:1.127 rtems/cpukit/libcsupport/Makefile.am:1.128
--- rtems/cpukit/libcsupport/Makefile.am:1.127  Thu Jul 15 03:46:06 2010
+++ rtems/cpukit/libcsupport/Makefile.am        Sat Jul 24 11:12:49 2010
</font><font color='#997700'>@@ -57,7 +57,7 @@
</font>     src/tcflow.c src/tcflush.c src/tcgetpgrp.c src/tcsendbreak.c \
     src/tcsetpgrp.c src/termios.c src/termiosinitialize.c \
     src/termios_baud2index.c src/termios_baud2num.c src/termios_num2baud.c \
<font color='#880000'>-    src/termios_setinitialbaud.c
</font><font color='#000088'>+    src/termios_setinitialbaud.c src/termios_baudtable.c
</font> 
 SYSTEM_CALL_C_FILES = src/open.c src/close.c src/read.c src/write.c \
     src/write_r.c \

<font color='#006600'>diff -u rtems/cpukit/libcsupport/src/termios_baud2num.c:1.4 rtems/cpukit/libcsupport/src/termios_baud2num.c:1.5
--- rtems/cpukit/libcsupport/src/termios_baud2num.c:1.4 Sat Mar 27 00:36:47 2010
+++ rtems/cpukit/libcsupport/src/termios_baud2num.c     Sat Jul 24 11:12:49 2010
</font><font color='#997700'>@@ -15,36 +15,19 @@
</font> 
 #include <sys/termios.h>
 #include <rtems/termiostypes.h>
<font color='#000088'>+#include <rtems/assoc.h>
+
+extern rtems_assoc_t termios_assoc_table[];
</font> 
 int32_t rtems_termios_baud_to_number(
   int termios_baud
 )
 {
<font color='#880000'>-  int32_t baud;
</font><font color='#000088'>+  int baud;
</font> 
<font color='#880000'>-  switch (termios_baud) {
-    case B0:        baud =      0;  break;
-    case B50:       baud =     50;  break;
-    case B75:       baud =     75;  break;
-    case B110:      baud =    110;  break;
-    case B134:      baud =    134;  break;
-    case B150:      baud =    150;  break;
-    case B200:      baud =    200;  break;
-    case B300:      baud =    300;  break;
-    case B600:      baud =    600;  break;
-    case B1200:     baud =   1200;  break;
-    case B1800:     baud =   1800;  break;
-    case B2400:     baud =   2400;  break;
-    case B4800:     baud =   4800;  break;
-    case B9600:     baud =   9600;  break;
-    case B19200:    baud =  19200;  break;
-    case B38400:    baud =  38400;  break;
-    case B57600:    baud =  57600;  break;
-    case B115200:   baud = 115200;  break;
-    case B230400:   baud = 230400;  break;
-    case B460800:   baud = 460800;  break;
-    default:        baud =     -1;  break;
-  }
</font><font color='#000088'>+  baud = rtems_assoc_local_by_remote( termios_assoc_table, termios_baud );
+  if ( baud == 0 && termios_baud != 0 )
+    return -1;
</font> 
   return baud;
 }

<font color='#006600'>diff -u /dev/null rtems/cpukit/libcsupport/src/termios_baudtable.c:1.1
--- /dev/null   Sat Jul 24 12:10:18 2010
+++ rtems/cpukit/libcsupport/src/termios_baudtable.c    Sat Jul 24 11:12:49 2010
</font><font color='#997700'>@@ -0,0 +1,42 @@
</font><font color='#000088'>+/*
+ *  COPYRIGHT (c) 1989-2010.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <sys/termios.h>
+#include <rtems/termiostypes.h>
+#include <rtems/assoc.h>
+
+rtems_assoc_t termios_assoc_table[] = {
+  { "B0",      0,      B0 },
+  { "B50",     50,     B50 },
+  { "B75",     75,     B75 },
+  { "B110",    110,    B110 },
+  { "B134",    134,    B134 },
+  { "B150",    150,    B150 },
+  { "B200",    200,    B200 },
+  { "B300",    300,    B300 },
+  { "B600",    600,    B600 },
+  { "B1200",   1200,   B1200 },
+  { "B1800",   1800,   B1800 },
+  { "B2400",   2400,   B2400 },
+  { "B4800",   4800,   B4800 },
+  { "B9600",   9600,   B9600 },
+  { "B19200",  19200,  B19200 },
+  { "B38400",  38400,  B38400 },
+  { "B57600",  57600,  B57600 },
+  { "B115200", 115200, B115200 },
+  { "B230400", 230400, B230400 },
+  { "B460800", 460800, B460800 },
+  { NULL,      0,      0 }
+};
</font>
<font color='#006600'>diff -u rtems/cpukit/libcsupport/src/termios_num2baud.c:1.3 rtems/cpukit/libcsupport/src/termios_num2baud.c:1.4
--- rtems/cpukit/libcsupport/src/termios_num2baud.c:1.3 Sat Mar 27 00:36:47 2010
+++ rtems/cpukit/libcsupport/src/termios_num2baud.c     Sat Jul 24 11:12:49 2010
</font><font color='#997700'>@@ -15,6 +15,9 @@
</font> 
 #include <sys/termios.h>
 #include <rtems/termiostypes.h>
<font color='#000088'>+#include <rtems/assoc.h>
+
+extern rtems_assoc_t termios_assoc_table[];
</font> 
 int rtems_termios_number_to_baud(
   int32_t baud
<font color='#997700'>@@ -22,29 +25,8 @@
</font> {
   int termios_baud;
 
<font color='#880000'>-  switch (baud) {
-    case 0:       termios_baud = B0;      break;
-    case 50:      termios_baud = B50;     break;
-    case 75:      termios_baud = B75;     break;
-    case 110:     termios_baud = B110;    break;
-    case 134:     termios_baud = B134;    break;
-    case 150:     termios_baud = B150;    break;
-    case 200:     termios_baud = B200;    break;
-    case 300:     termios_baud = B300;    break;
-    case 600:     termios_baud = B600;    break;
-    case 1200:    termios_baud = B1200;   break;
-    case 1800:    termios_baud = B1800;   break;
-    case 2400:    termios_baud = B2400;   break;
-    case 4800:    termios_baud = B4800;   break;
-    case 9600:    termios_baud = B9600;   break;
-    case 19200:   termios_baud = B19200;  break;
-    case 38400:   termios_baud = B38400;  break;
-    case 57600:   termios_baud = B57600;  break;
-    case 115200:  termios_baud = B115200; break;
-    case 230400:  termios_baud = B230400; break;
-    case 460800:  termios_baud = B460800; break;
-    default:      termios_baud = -1;      break;
-  }
-
</font><font color='#000088'>+  termios_baud = rtems_assoc_remote_by_local( termios_assoc_table, baud );
+  if ( termios_baud == 0 && baud != 0 )
+    return -1;
</font>   return termios_baud;
 }
</pre>
<p> </p>

<p>--<br />
<small>Generated by <a href="http://www.codewiz.org/projects/index.html#loginfo">Deluxe Loginfo</a> 2.122 by Bernardo Innocenti <bernie@develer.com></small></p>
</body>
</html>