2008-05-23 Joel Sherrill <joel.sherrill@OARcorp.com>

* console/console.c: Eliminate copies of switches to convert termios
	Bxxx constants to xxx as an integer. Use the shared
	termios_baud_to_number() routine to do the same conversion.
This commit is contained in:
Joel Sherrill
2008-05-23 15:48:38 +00:00
parent 24f1347a44
commit 6825d0657a
14 changed files with 59 additions and 306 deletions

View File

@@ -1,3 +1,9 @@
2008-05-23 Joel Sherrill <joel.sherrill@OARcorp.com>
* console/console.c: Eliminate copies of switches to convert termios
Bxxx constants to xxx as an integer. Use the shared
termios_baud_to_number() routine to do the same conversion.
2008-05-15 Joel Sherrill <joel.sherrill@oarcorp.com> 2008-05-15 Joel Sherrill <joel.sherrill@oarcorp.com>
* network/network.c: Eliminate patterns that look like CVS conflict * network/network.c: Eliminate patterns that look like CVS conflict

View File

@@ -278,64 +278,9 @@ conSetAttr(int minor, const struct termios *t)
{ {
int baud; int baud;
switch (t->c_cflag & CBAUD) baud = termios_baud_to_number(t->c_cflag & CBAUD);
{ if ( baud > 115200 )
case B50: rtems_fatal_error_occurred (RTEMS_INTERNAL_ERROR);
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;
default:
baud = 0;
rtems_fatal_error_occurred (RTEMS_INTERNAL_ERROR);
return 0;
}
BSP_uart_set_baud(BSPConsolePort, baud); BSP_uart_set_baud(BSPConsolePort, baud);

View File

@@ -1,3 +1,9 @@
2008-05-23 Joel Sherrill <joel.sherrill@OARcorp.com>
* console/console.c: Eliminate copies of switches to convert termios
Bxxx constants to xxx as an integer. Use the shared
termios_baud_to_number() routine to do the same conversion.
2008-05-15 Joel Sherrill <joel.sherrill@OARcorp.com> 2008-05-15 Joel Sherrill <joel.sherrill@OARcorp.com>
* startup/bspstart.c: Add capability for bootcard.c BSP Initialization * startup/bspstart.c: Add capability for bootcard.c BSP Initialization

View File

@@ -277,64 +277,9 @@ conSetAttr(int minor, const struct termios *t)
{ {
int baud; int baud;
switch (t->c_cflag & CBAUD) baud = termios_baud_to_number(t->c_cflag & CBAUD);
{ if ( baud > 115200 )
case B50: rtems_fatal_error_occurred (RTEMS_INTERNAL_ERROR);
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;
default:
baud = 0;
rtems_fatal_error_occurred (RTEMS_INTERNAL_ERROR);
return 0;
}
BSP_uart_set_baud(BSPConsolePort, baud); BSP_uart_set_baud(BSPConsolePort, baud);

View File

@@ -1,3 +1,9 @@
2008-05-23 Joel Sherrill <joel.sherrill@OARcorp.com>
* console/console.c: Eliminate copies of switches to convert termios
Bxxx constants to xxx as an integer. Use the shared
termios_baud_to_number() routine to do the same conversion.
2008-05-14 Joel Sherrill <joel.sherrill@OARcorp.com> 2008-05-14 Joel Sherrill <joel.sherrill@OARcorp.com>
* Makefile.am: Rework to avoid .rel files. * Makefile.am: Rework to avoid .rel files.

View File

@@ -62,45 +62,6 @@ struct IntUartInfoStruct
struct IntUartInfoStruct IntUartInfo[MAX_UART_INFO]; struct IntUartInfoStruct IntUartInfo[MAX_UART_INFO];
static int GetBaud( int baudHandle )
{
int baud = 9600;
switch ( baudHandle )
{
case B0:
baud = (int)0;
break;
case B1200:
baud = (int)1200;
break;
case B2400:
baud = (int)2400;
break;
case B4800:
baud = (int)4800;
break;
case B9600:
baud = (int)9600;
break;
case B19200:
baud = (int)19200;
break;
case B38400:
baud = (int)38400;
break;
case B57600:
baud = (int)57600;
break;
case B115200:
baud = (int)115200;
break;
/* case B576000:
baud = (int)576000; */
break;
}
return ( baud );
}
/*************************************************************************** /***************************************************************************
Function : IntUartSet Function : IntUartSet
@@ -212,7 +173,7 @@ IntUartSetAttributes(int minor, const struct termios *t)
if ( t != (const struct termios *)0 ) if ( t != (const struct termios *)0 )
{ {
/* determine baud rate index */ /* determine baud rate index */
baud = GetBaud( t->c_cflag & CBAUD ); baud = termios_baud_to_number(t->c_cflag & CBAUD);
/* determine data bits */ /* determine data bits */
switch ( t->c_cflag & CSIZE ) switch ( t->c_cflag & CSIZE )

View File

@@ -1,3 +1,9 @@
2008-05-23 Joel Sherrill <joel.sherrill@OARcorp.com>
* console/console.c: Eliminate copies of switches to convert termios
Bxxx constants to xxx as an integer. Use the shared
termios_baud_to_number() routine to do the same conversion.
2008-05-14 Joel Sherrill <joel.sherrill@OARcorp.com> 2008-05-14 Joel Sherrill <joel.sherrill@OARcorp.com>
* Makefile.am: Rework to avoid .rel files. * Makefile.am: Rework to avoid .rel files.

View File

@@ -83,33 +83,12 @@ smc1BRGC (int baud)
static int static int
smc1SetAttributes (int minor, const struct termios *t) smc1SetAttributes (int minor, const struct termios *t)
{ {
int baud; int baud;
switch (t->c_cflag & CBAUD) { baud = termios_baud_to_number(t->c_cflag & CBAUD);
default: baud = -1; break; if (baud > 0)
case B50: baud = 50; break; m360.brgc1 = smc1BRGC (baud);
case B75: baud = 75; break; return 0;
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;
}
if (baud > 0)
m360.brgc1 = smc1BRGC (baud);
return 0;
} }
/* /*

View File

@@ -1,3 +1,9 @@
2008-05-23 Joel Sherrill <joel.sherrill@OARcorp.com>
* console/console.c: Eliminate copies of switches to convert termios
Bxxx constants to xxx as an integer. Use the shared
termios_baud_to_number() routine to do the same conversion.
2008-05-14 Joel Sherrill <joel.sherrill@OARcorp.com> 2008-05-14 Joel Sherrill <joel.sherrill@OARcorp.com>
* Makefile.am: Rework to avoid .rel files. * Makefile.am: Rework to avoid .rel files.

View File

@@ -62,42 +62,6 @@ struct IntUartInfoStruct
struct IntUartInfoStruct IntUartInfo[MAX_UART_INFO]; struct IntUartInfoStruct IntUartInfo[MAX_UART_INFO];
static int GetBaud( int baudHandle )
{
int baud = 9600;
switch ( baudHandle )
{
case B0:
baud = (int)0;
break;
case B1200:
baud = (int)1200;
break;
case B2400:
baud = (int)2400;
break;
case B4800:
baud = (int)4800;
break;
case B9600:
baud = (int)9600;
break;
case B19200:
baud = (int)19200;
break;
case B38400:
baud = (int)38400;
break;
case B57600:
baud = (int)57600;
break;
case B115200:
baud = (int)115200;
break;
}
return ( baud );
}
/*************************************************************************** /***************************************************************************
Function : IntUartSet Function : IntUartSet
@@ -209,7 +173,7 @@ IntUartSetAttributes(int minor, const struct termios *t)
if ( t != (const struct termios *)0 ) if ( t != (const struct termios *)0 )
{ {
/* determine baud rate index */ /* determine baud rate index */
baud = GetBaud( t->c_cflag & CBAUD ); baud = termios_baud_to_number(t->c_cflag & CBAUD);
/* determine data bits */ /* determine data bits */
switch ( t->c_cflag & CSIZE ) switch ( t->c_cflag & CSIZE )

View File

@@ -1,3 +1,9 @@
2008-05-23 Joel Sherrill <joel.sherrill@OARcorp.com>
* console/console.c: Eliminate copies of switches to convert termios
Bxxx constants to xxx as an integer. Use the shared
termios_baud_to_number() routine to do the same conversion.
2008-05-14 Joel Sherrill <joel.sherrill@OARcorp.com> 2008-05-14 Joel Sherrill <joel.sherrill@OARcorp.com>
* Makefile.am: Rework to avoid .rel files. * Makefile.am: Rework to avoid .rel files.

View File

@@ -815,53 +815,9 @@ int cd2401_setAttributes(
/* Determine what the line parameters should be */ /* Determine what the line parameters should be */
/* Output baud rate */ /* baud rates */
switch ( cfgetospeed (t) ) { out_baud = termios_baud_to_number(t->c_cflag & CBAUD);
default: out_baud = 9600; break; in_baud = termios_baud_to_number(t->c_cflag & CBAUD);
case B50: out_baud = 50; break;
case B75: out_baud = 75; break;
case B110: out_baud = 110; break;
case B134: out_baud = 134; break;
case B150: out_baud = 150; break;
case B200: out_baud = 200; break;
case B300: out_baud = 300; break;
case B600: out_baud = 600; break;
case B1200: out_baud = 1200; break;
case B1800: out_baud = 1800; break;
case B2400: out_baud = 2400; break;
case B4800: out_baud = 4800; break;
case B9600: out_baud = 9600; break;
case B19200: out_baud = 19200; break;
case B38400: out_baud = 38400; break;
case B57600: out_baud = 57600; break;
case B115200: out_baud = 115200; break;
case B230400: out_baud = 230400; break;
case B460800: out_baud = 460800; break;
}
/* Input baud rate */
switch ( cfgetispeed (t) ) {
default: in_baud = out_baud; break;
case B50: in_baud = 50; break;
case B75: in_baud = 75; break;
case B110: in_baud = 110; break;
case B134: in_baud = 134; break;
case B150: in_baud = 150; break;
case B200: in_baud = 200; break;
case B300: in_baud = 300; break;
case B600: in_baud = 600; break;
case B1200: in_baud = 1200; break;
case B1800: in_baud = 1800; break;
case B2400: in_baud = 2400; break;
case B4800: in_baud = 4800; break;
case B9600: in_baud = 9600; break;
case B19200: in_baud = 19200; break;
case B38400: in_baud = 38400; break;
case B57600: in_baud = 57600; break;
case B115200: in_baud = 115200; break;
case B230400: in_baud = 230400; break;
case B460800: in_baud = 460800; break;
}
/* Number of bits per char */ /* Number of bits per char */
csize = 0x07; /* to avoid a warning */ csize = 0x07; /* to avoid a warning */

View File

@@ -1,3 +1,9 @@
2008-05-23 Joel Sherrill <joel.sherrill@OARcorp.com>
* console/console.c: Eliminate copies of switches to convert termios
Bxxx constants to xxx as an integer. Use the shared
termios_baud_to_number() routine to do the same conversion.
2008-05-19 Eric Norum <norume@aps.anl.gov> 2008-05-19 Eric Norum <norume@aps.anl.gov>
* Makefile.am, configure.ac, startup/bspstart.c, startup/linkcmds: Back * Makefile.am, configure.ac, startup/bspstart.c, startup/linkcmds: Back

View File

@@ -76,45 +76,6 @@ struct IntUartInfoStruct
struct IntUartInfoStruct IntUartInfo[MAX_UART_INFO]; struct IntUartInfoStruct IntUartInfo[MAX_UART_INFO];
static int GetBaud( int baudHandle )
{
int baud = 9600;
switch ( baudHandle )
{
case B0:
baud = (int)0;
break;
case B1200:
baud = (int)1200;
break;
case B2400:
baud = (int)2400;
break;
case B4800:
baud = (int)4800;
break;
case B9600:
baud = (int)9600;
break;
case B19200:
baud = (int)19200;
break;
case B38400:
baud = (int)38400;
break;
case B57600:
baud = (int)57600;
break;
case B115200:
baud = (int)115200;
break;
/* case B576000:
baud = (int)576000; */
break;
}
return ( baud );
}
/*************************************************************************** /***************************************************************************
Function : IntUartSet Function : IntUartSet
@@ -226,7 +187,7 @@ IntUartSetAttributes(int minor, const struct termios *t)
if ( t != (const struct termios *)0 ) if ( t != (const struct termios *)0 )
{ {
/* determine baud rate index */ /* determine baud rate index */
baud = GetBaud( t->c_cflag & CBAUD ); baud = termios_baud_to_number(t->c_cflag & CBAUD);
/* determine data bits */ /* determine data bits */
switch ( t->c_cflag & CSIZE ) switch ( t->c_cflag & CSIZE )