Fix parity_table_Entry type.

Correct parity_table initialization.
Add PRIdrtems_termios_baud_t.
Use PRIdrtems_termios_baud_t to print rtems_termios_baud_t's.
This commit is contained in:
Ralf Corsepius
2009-10-27 11:43:29 +00:00
parent 72cbbad1ce
commit 14664255e8

View File

@@ -16,6 +16,9 @@
#include <fcntl.h> #include <fcntl.h>
#include <sys/errno.h> #include <sys/errno.h>
/* rtems_termios_baud_t is a typedefs to int32_t */
#define PRIdrtems_termios_baud_t PRId32
/* /*
* Termios Test Driver * Termios Test Driver
*/ */
@@ -82,7 +85,7 @@ termios_character_size_test_r char_size_table[] = {
*/ */
typedef struct { typedef struct {
int constant; int constant;
const char parity[5]; const char *parity;
} termios_parity_test_r; } termios_parity_test_r;
/* /*
@@ -92,7 +95,7 @@ termios_parity_test_r parity_table[] = {
{ 0, "none" }, { 0, "none" },
{ PARENB, "even" }, { PARENB, "even" },
{ PARENB | PARODD, "odd" }, { PARENB | PARODD, "odd" },
{ -1, -1 } { -1, NULL }
}; };
/* /*
@@ -134,7 +137,7 @@ void test_termios_baud2index(void)
if ( i != -1 ) if ( i != -1 )
for (i=0 ; baud_table[i].constant != -1 ; i++ ) { for (i=0 ; baud_table[i].constant != -1 ; i++ ) {
printf( "termios_baud_to_index(B%d) - OK\n", baud_table[i].baud ); printf( "termios_baud_to_index(B%" PRIdrtems_termios_baud_t ") - OK\n", baud_table[i].baud );
index = rtems_termios_baud_to_index( baud_table[i].constant ); index = rtems_termios_baud_to_index( baud_table[i].constant );
if ( index != i ) { if ( index != i ) {
printf( "ERROR - returned %d should be %d\n", index, i ); printf( "ERROR - returned %d should be %d\n", index, i );
@@ -164,11 +167,11 @@ void test_termios_baud2number(void)
assert ( i == -1 ); assert ( i == -1 );
for (i=0 ; baud_table[i].constant != -1 ; i++ ) { for (i=0 ; baud_table[i].constant != -1 ; i++ ) {
printf( "termios_baud_to_number(B%d) - OK\n", baud_table[i].baud ); printf( "termios_baud_to_number(B%" PRIdrtems_termios_baud_t ") - OK\n", baud_table[i].baud );
number = rtems_termios_baud_to_number( baud_table[i].constant ); number = rtems_termios_baud_to_number( baud_table[i].constant );
if ( number != baud_table[i].baud ) { if ( number != baud_table[i].baud ) {
printf( printf(
"ERROR - returned %d should be %d\n", "ERROR - returned %d should be %" PRIdrtems_termios_baud_t "\n",
number, number,
baud_table[i].baud baud_table[i].baud
); );
@@ -198,7 +201,7 @@ void test_termios_number_to_baud(void)
assert ( i == -1 ); assert ( i == -1 );
for (i=0 ; baud_table[i].constant != -1 ; i++ ) { for (i=0 ; baud_table[i].constant != -1 ; i++ ) {
printf( "termios_number_to_baud(B%d) - OK\n", baud_table[i].baud ); printf( "termios_number_to_baud(B%" PRIdrtems_termios_baud_t ") - OK\n", baud_table[i].baud );
termios_baud = rtems_termios_number_to_baud( baud_table[i].baud ); termios_baud = rtems_termios_number_to_baud( baud_table[i].baud );
if ( termios_baud != baud_table[i].constant ) { if ( termios_baud != baud_table[i].constant ) {
printf( printf(
@@ -233,14 +236,14 @@ void test_termios_set_baud(
attr.c_cflag &= ~CBAUD; attr.c_cflag &= ~CBAUD;
attr.c_cflag |= baud_table[i].constant; attr.c_cflag |= baud_table[i].constant;
printf( "tcsetattr(TCSANOW, B%d) - OK\n", baud_table[i].baud ); printf( "tcsetattr(TCSANOW, B%" PRIdrtems_termios_baud_t ") - OK\n", baud_table[i].baud );
sc = tcsetattr( test, TCSANOW, &attr ); sc = tcsetattr( test, TCSANOW, &attr );
if ( sc != 0 ) { if ( sc != 0 ) {
printf( "ERROR - return %d\n", sc ); printf( "ERROR - return %d\n", sc );
rtems_test_exit(0); rtems_test_exit(0);
} }
printf( "tcsetattr(TCSADRAIN, B%d) - OK\n", baud_table[i].baud ); printf( "tcsetattr(TCSADRAIN, B%" PRIdrtems_termios_baud_t ") - OK\n", baud_table[i].baud );
sc = tcsetattr( test, TCSANOW, &attr ); sc = tcsetattr( test, TCSANOW, &attr );
if ( sc != 0 ) { if ( sc != 0 ) {
printf( "ERROR - return %d\n", sc ); printf( "ERROR - return %d\n", sc );