diff options
author | Kevin Kirspel <kevin-kirspel@idexx.com> | 2017-03-21 15:39:48 -0400 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-03-22 11:55:04 +0100 |
commit | 1c6926c11f2e5efcb166c668b097d64a0321d66e (patch) | |
tree | 30683dcf11979f51273413aade68a3828d00da10 /testsuites/libtests/termios01 | |
parent | bsp/atsam: Fix DMA support of some drivers (diff) | |
download | rtems-1c6926c11f2e5efcb166c668b097d64a0321d66e.tar.bz2 |
termios: Synchronize with latest FreeBSD headers
Adding modified FreeBSD headers to synchronize RTEMS termios with
FreeBSD. Modify termios to support dedicated input and output baud for
termios structure. Updated BSPs to use dedicated input and output baud
in termios structure. Updated tools to use dedicated input and output
baud in termios structure. Updated termios testsuites to use dedicated
input and output baud in termios structure.
Close #2897.
Diffstat (limited to 'testsuites/libtests/termios01')
-rw-r--r-- | testsuites/libtests/termios01/init.c | 143 | ||||
-rw-r--r-- | testsuites/libtests/termios01/termios01.scn | 270 | ||||
-rw-r--r-- | testsuites/libtests/termios01/termios_testdriver.c | 6 |
3 files changed, 328 insertions, 91 deletions
diff --git a/testsuites/libtests/termios01/init.c b/testsuites/libtests/termios01/init.c index 64c3bb286b..562b252745 100644 --- a/testsuites/libtests/termios01/init.c +++ b/testsuites/libtests/termios01/init.c @@ -12,6 +12,7 @@ #endif #include "tmacros.h" +#define TTYDEFCHARS #include <termios.h> #include <rtems/libcsupport.h> #include <rtems/malloc.h> @@ -66,10 +67,15 @@ static const termios_baud_test_r baud_table[] = { { B9600, 9600 }, { B19200, 19200 }, { B38400, 38400 }, + { B7200, 7200 }, + { B14400, 14400 }, + { B28800, 28800 }, { B57600, 57600 }, + { B76800, 76800 }, { B115200, 115200 }, { B230400, 230400 }, { B460800, 460800 }, + { B921600, 921600 }, { INVALID_CONSTANT, INVALID_BAUD } }; @@ -233,16 +239,14 @@ static void test_termios_set_baud( puts( "Test termios setting device baud rate..." ); for (i=0 ; baud_table[i].constant != INVALID_CONSTANT ; i++ ) { - tcflag_t cbaud = CBAUD; - sc = tcgetattr( test, &attr ); if ( sc != 0 ) { printf( "ERROR - return %d\n", sc ); rtems_test_exit(0); } - attr.c_cflag &= ~cbaud; - attr.c_cflag |= baud_table[i].constant; + attr.c_ispeed = baud_table[i].constant; + attr.c_ospeed = baud_table[i].constant; printf( "tcsetattr(TCSANOW, B%" PRIdrtems_termios_baud_t ") - OK\n", @@ -258,7 +262,17 @@ static void test_termios_set_baud( "tcsetattr(TCSADRAIN, B%" PRIdrtems_termios_baud_t ") - OK\n", baud_table[i].baud ); - sc = tcsetattr( test, TCSANOW, &attr ); + sc = tcsetattr( test, TCSADRAIN, &attr ); + if ( sc != 0 ) { + printf( "ERROR - return %d\n", sc ); + rtems_test_exit(0); + } + + printf( + "tcsetattr(TCSAFLUSH, B%" PRIdrtems_termios_baud_t ") - OK\n", + baud_table[i].baud + ); + sc = tcsetattr( test, TCSAFLUSH, &attr ); if ( sc != 0 ) { printf( "ERROR - return %d\n", sc ); rtems_test_exit(0); @@ -301,7 +315,21 @@ static void test_termios_set_charsize( } printf( "tcsetattr(TCSADRAIN, CS%d) - OK\n", char_size_table[i].bits ); - sc = tcsetattr( test, TCSANOW, &attr ); + sc = tcsetattr( test, TCSADRAIN, &attr ); + if ( sc != 0 ) { + printf( "ERROR - return %d\n", sc ); + rtems_test_exit(0); + } + + printf( "tcsetattr(TCSAFLUSH, CS%d) - OK\n", char_size_table[i].bits ); + sc = tcsetattr( test, TCSAFLUSH, &attr ); + if ( sc != 0 ) { + printf( "ERROR - return %d\n", sc ); + rtems_test_exit(0); + } + + printf( "tcsetattr(TCSASOFT, CS%d) - OK\n", char_size_table[i].bits ); + sc = tcsetattr( test, TCSASOFT, &attr ); if ( sc != 0 ) { printf( "ERROR - return %d\n", sc ); rtems_test_exit(0); @@ -344,7 +372,21 @@ static void test_termios_set_parity( } printf( "tcsetattr(TCSADRAIN, %s) - OK\n", parity_table[i].parity ); - sc = tcsetattr( test, TCSANOW, &attr ); + sc = tcsetattr( test, TCSADRAIN, &attr ); + if ( sc != 0 ) { + printf( "ERROR - return %d\n", sc ); + rtems_test_exit(0); + } + + printf( "tcsetattr(TCSAFLUSH, %s) - OK\n", parity_table[i].parity ); + sc = tcsetattr( test, TCSAFLUSH, &attr ); + if ( sc != 0 ) { + printf( "ERROR - return %d\n", sc ); + rtems_test_exit(0); + } + + printf( "tcsetattr(TCSASOFT, %s) - OK\n", parity_table[i].parity ); + sc = tcsetattr( test, TCSASOFT, &attr ); if ( sc != 0 ) { printf( "ERROR - return %d\n", sc ); rtems_test_exit(0); @@ -390,7 +432,21 @@ static void test_termios_set_stop_bits( } printf( "tcsetattr(TCSADRAIN, %d bits) - OK\n", stop_bits_table[i].stop ); - sc = tcsetattr( test, TCSANOW, &attr ); + sc = tcsetattr( test, TCSADRAIN, &attr ); + if ( sc != 0 ) { + printf( "ERROR - return %d\n", sc ); + rtems_test_exit(0); + } + + printf( "tcsetattr(TCSAFLUSH, %d bits) - OK\n", stop_bits_table[i].stop ); + sc = tcsetattr( test, TCSAFLUSH, &attr ); + if ( sc != 0 ) { + printf( "ERROR - return %d\n", sc ); + rtems_test_exit(0); + } + + printf( "tcsetattr(TCSASOFT, %d bits) - OK\n", stop_bits_table[i].stop ); + sc = tcsetattr( test, TCSASOFT, &attr ); if ( sc != 0 ) { printf( "ERROR - return %d\n", sc ); rtems_test_exit(0); @@ -404,9 +460,9 @@ static void test_termios_cfoutspeed(void) int sc; speed_t speed; struct termios term; - tcflag_t bad; + speed_t bad; - bad = CBAUD << 1; + bad = B921600 << 1; memset( &term, '\0', sizeof(term) ); puts( "cfsetospeed(BAD BAUD) - EINVAL" ); sc = cfsetospeed( &term, bad ); @@ -436,9 +492,9 @@ static void test_termios_cfinspeed(void) int sc; speed_t speed; struct termios term; - tcflag_t bad; + speed_t bad; - bad = CBAUD << 1; + bad = B921600 << 1; memset( &term, '\0', sizeof(term) ); puts( "cfsetispeed(BAD BAUD) - EINVAL" ); sc = cfsetispeed( &term, bad ); @@ -469,9 +525,9 @@ static void test_termios_cfsetspeed(void) int status; speed_t speed; struct termios term; - tcflag_t bad; + speed_t bad; - bad = CBAUD << 1; + bad = B921600 << 1; memset( &term, '\0', sizeof(term) ); puts( "cfsetspeed(BAD BAUD) - EINVAL" ); status = cfsetspeed( &term, bad ); @@ -508,15 +564,45 @@ static void test_termios_cfmakeraw(void) puts( "cfmakeraw - OK" ); /* Check that all of the flags were set correctly */ - rtems_test_assert( ~(term.c_iflag & (IMAXBEL|IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON)) ); + rtems_test_assert( ~(term.c_iflag & (IMAXBEL|IXOFF|INPCK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON|IGNPAR)) ); + + rtems_test_assert( term.c_iflag & (IGNBRK) ); rtems_test_assert( ~(term.c_oflag & OPOST) ); - rtems_test_assert( ~(term.c_lflag & (ECHO|ECHONL|ICANON|ISIG|IEXTEN)) ); + rtems_test_assert( ~(term.c_lflag & (ECHO|ECHOE|ECHOK|ECHONL|ICANON|ISIG|IEXTEN|NOFLSH|TOSTOP|PENDIN)) ); rtems_test_assert( ~(term.c_cflag & (CSIZE|PARENB)) ); - rtems_test_assert( term.c_cflag & CS8 ); + rtems_test_assert( term.c_cflag & (CS8|CREAD) ); + + rtems_test_assert( term.c_cc[VMIN] == 1 ); + + rtems_test_assert( term.c_cc[VTIME] == 0 ); +} + +static void test_termios_cfmakesane(void) +{ + struct termios term; + + memset( &term, '\0', sizeof(term) ); + cfmakesane( &term ); + puts( "cfmakesane - OK" ); + + /* Check that all of the flags were set correctly */ + rtems_test_assert( term.c_iflag == TTYDEF_IFLAG ); + + rtems_test_assert( term.c_oflag == TTYDEF_OFLAG ); + + rtems_test_assert( term.c_lflag == TTYDEF_LFLAG ); + + rtems_test_assert( term.c_cflag == TTYDEF_CFLAG ); + + rtems_test_assert( term.c_ispeed == TTYDEF_SPEED ); + + rtems_test_assert( term.c_ospeed == TTYDEF_SPEED ); + + rtems_test_assert( memcmp(&term.c_cc, ttydefchars, sizeof(term.c_cc)) == 0 ); } typedef struct { @@ -684,7 +770,7 @@ static void test_set_attributes_error(void) rtems_test_assert( !ctx.done ); errno = 0; - rv = ioctl( fd, RTEMS_IO_SET_ATTRIBUTES, &term ); + rv = ioctl( fd, TIOCSETA, &term ); rtems_test_assert( rv == -1 ); rtems_test_assert( errno == EIO ); rtems_test_assert( ctx.done ); @@ -702,8 +788,8 @@ static void test_set_best_baud(void) { static const struct { uint32_t baud; - tcflag_t cflag; - } baud_to_cflag_table[] = { + speed_t speed; + } baud_to_speed_table[] = { { 0, B0 }, { 25, B0 }, { 26, B50 }, @@ -731,19 +817,17 @@ static void test_set_best_baud(void) { 0xffffffff, B460800 } }; - size_t n = RTEMS_ARRAY_SIZE(baud_to_cflag_table); + size_t n = RTEMS_ARRAY_SIZE(baud_to_speed_table); size_t i; for ( i = 0; i < n; ++i ) { struct termios term; - tcflag_t cbaud_mask = CBAUD; memset( &term, 0xff, sizeof( term ) ); - rtems_termios_set_best_baud( &term, baud_to_cflag_table[ i ].baud ); + rtems_termios_set_best_baud( &term, baud_to_speed_table[ i ].baud ); - rtems_test_assert( - (term.c_cflag & cbaud_mask) == baud_to_cflag_table[ i ].cflag - ); + rtems_test_assert( term.c_ispeed == baud_to_speed_table[ i ].speed ); + rtems_test_assert( term.c_ospeed == baud_to_speed_table[ i ].speed ); } } @@ -791,13 +875,14 @@ static rtems_task Init( /* * tcsetattr - ERROR invalid operation */ - puts( "tcsetattr - invalid operation - ENOTSUP" ); + puts( "tcsetattr - invalid operation - EINVAL" ); rc = tcsetattr( test, INT_MAX, &t ); rtems_test_assert( rc == -1 ); - rtems_test_assert( errno == ENOTSUP ); + rtems_test_assert( errno == EINVAL ); test_termios_cfmakeraw(); - + test_termios_cfmakesane(); + /* * tcsetattr - TCSADRAIN */ diff --git a/testsuites/libtests/termios01/termios01.scn b/testsuites/libtests/termios01/termios01.scn index c1c54702d8..36f1b8e3a8 100644 --- a/testsuites/libtests/termios01/termios01.scn +++ b/testsuites/libtests/termios01/termios01.scn @@ -1,4 +1,4 @@ -*** TEST TERMIOS 01 *** +*** BEGIN OF TEST TERMIOS 1 *** Test termios_baud2index... termios_baud_to_index(-2) - NOT OK termios_baud_to_index(B0) - OK @@ -17,10 +17,15 @@ termios_baud_to_index(B4800) - OK termios_baud_to_index(B9600) - OK termios_baud_to_index(B19200) - OK termios_baud_to_index(B38400) - OK +termios_baud_to_index(B7200) - OK +termios_baud_to_index(B14400) - OK +termios_baud_to_index(B28800) - OK termios_baud_to_index(B57600) - OK +termios_baud_to_index(B76800) - OK termios_baud_to_index(B115200) - OK termios_baud_to_index(B230400) - OK termios_baud_to_index(B460800) - OK +termios_baud_to_index(B921600) - OK Test termios_baud2number... termios_baud_to_number(-2) - NOT OK @@ -40,10 +45,15 @@ termios_baud_to_number(B4800) - OK termios_baud_to_number(B9600) - OK termios_baud_to_number(B19200) - OK termios_baud_to_number(B38400) - OK +termios_baud_to_number(B7200) - OK +termios_baud_to_number(B14400) - OK +termios_baud_to_number(B28800) - OK termios_baud_to_number(B57600) - OK +termios_baud_to_number(B76800) - OK termios_baud_to_number(B115200) - OK termios_baud_to_number(B230400) - OK termios_baud_to_number(B460800) - OK +termios_baud_to_number(B921600) - OK Test termios_number_to_baud... termios_number_to_baud(-2) - NOT OK @@ -63,103 +73,179 @@ termios_number_to_baud(B4800) - OK termios_number_to_baud(B9600) - OK termios_number_to_baud(B19200) - OK termios_number_to_baud(B38400) - OK +termios_number_to_baud(B7200) - OK +termios_number_to_baud(B14400) - OK +termios_number_to_baud(B28800) - OK termios_number_to_baud(B57600) - OK +termios_number_to_baud(B76800) - OK termios_number_to_baud(B115200) - OK termios_number_to_baud(B230400) - OK termios_number_to_baud(B460800) - OK +termios_number_to_baud(B921600) - OK Init - rtems_io_register_driver - Termios Test Driver - OK Termios_test_driver - rtems_io_register /dev/test - OK -Init - Major slot returned = 2 +Init - Major slot returned = 3 Init - open - /dev/test - OK Termios_test_driver - rtems_set_initial_baud - bad baud - OK Termios_test_driver - rtems_set_initial_baud - 38400 - OK -tcsetattr - invalid operation - ENOTSUP +tcsetattr - invalid operation - EINVAL cfmakeraw - OK +cfmakesane - OK tcsetattr - drain - OK -set_attributes - B0 5-NONE-1 +set_attributes - B0 8-NONE-2 Test termios setting device baud rate... tcsetattr(TCSANOW, B0) - OK -set_attributes - B0 5-NONE-1 +set_attributes - B0 8-NONE-2 tcsetattr(TCSADRAIN, B0) - OK -set_attributes - B0 5-NONE-1 +set_attributes - B0 8-NONE-2 +tcsetattr(TCSAFLUSH, B0) - OK +set_attributes - B0 8-NONE-2 tcsetattr(TCSANOW, B50) - OK -set_attributes - B50 5-NONE-1 +set_attributes - B50 8-NONE-2 tcsetattr(TCSADRAIN, B50) - OK -set_attributes - B50 5-NONE-1 +set_attributes - B50 8-NONE-2 +tcsetattr(TCSAFLUSH, B50) - OK +set_attributes - B50 8-NONE-2 tcsetattr(TCSANOW, B75) - OK -set_attributes - B75 5-NONE-1 +set_attributes - B75 8-NONE-2 tcsetattr(TCSADRAIN, B75) - OK -set_attributes - B75 5-NONE-1 +set_attributes - B75 8-NONE-2 +tcsetattr(TCSAFLUSH, B75) - OK +set_attributes - B75 8-NONE-2 tcsetattr(TCSANOW, B110) - OK -set_attributes - B110 5-NONE-1 +set_attributes - B110 8-NONE-2 tcsetattr(TCSADRAIN, B110) - OK -set_attributes - B110 5-NONE-1 +set_attributes - B110 8-NONE-2 +tcsetattr(TCSAFLUSH, B110) - OK +set_attributes - B110 8-NONE-2 tcsetattr(TCSANOW, B134) - OK -set_attributes - B134 5-NONE-1 +set_attributes - B134 8-NONE-2 tcsetattr(TCSADRAIN, B134) - OK -set_attributes - B134 5-NONE-1 +set_attributes - B134 8-NONE-2 +tcsetattr(TCSAFLUSH, B134) - OK +set_attributes - B134 8-NONE-2 tcsetattr(TCSANOW, B150) - OK -set_attributes - B150 5-NONE-1 +set_attributes - B150 8-NONE-2 tcsetattr(TCSADRAIN, B150) - OK -set_attributes - B150 5-NONE-1 +set_attributes - B150 8-NONE-2 +tcsetattr(TCSAFLUSH, B150) - OK +set_attributes - B150 8-NONE-2 tcsetattr(TCSANOW, B200) - OK -set_attributes - B200 5-NONE-1 +set_attributes - B200 8-NONE-2 tcsetattr(TCSADRAIN, B200) - OK -set_attributes - B200 5-NONE-1 +set_attributes - B200 8-NONE-2 +tcsetattr(TCSAFLUSH, B200) - OK +set_attributes - B200 8-NONE-2 tcsetattr(TCSANOW, B300) - OK -set_attributes - B300 5-NONE-1 +set_attributes - B300 8-NONE-2 tcsetattr(TCSADRAIN, B300) - OK -set_attributes - B300 5-NONE-1 +set_attributes - B300 8-NONE-2 +tcsetattr(TCSAFLUSH, B300) - OK +set_attributes - B300 8-NONE-2 tcsetattr(TCSANOW, B600) - OK -set_attributes - B600 5-NONE-1 +set_attributes - B600 8-NONE-2 tcsetattr(TCSADRAIN, B600) - OK -set_attributes - B600 5-NONE-1 +set_attributes - B600 8-NONE-2 +tcsetattr(TCSAFLUSH, B600) - OK +set_attributes - B600 8-NONE-2 tcsetattr(TCSANOW, B1200) - OK -set_attributes - B1200 5-NONE-1 +set_attributes - B1200 8-NONE-2 tcsetattr(TCSADRAIN, B1200) - OK -set_attributes - B1200 5-NONE-1 +set_attributes - B1200 8-NONE-2 +tcsetattr(TCSAFLUSH, B1200) - OK +set_attributes - B1200 8-NONE-2 tcsetattr(TCSANOW, B1800) - OK -set_attributes - B1800 5-NONE-1 +set_attributes - B1800 8-NONE-2 tcsetattr(TCSADRAIN, B1800) - OK -set_attributes - B1800 5-NONE-1 +set_attributes - B1800 8-NONE-2 +tcsetattr(TCSAFLUSH, B1800) - OK +set_attributes - B1800 8-NONE-2 tcsetattr(TCSANOW, B2400) - OK -set_attributes - B2400 5-NONE-1 +set_attributes - B2400 8-NONE-2 tcsetattr(TCSADRAIN, B2400) - OK -set_attributes - B2400 5-NONE-1 +set_attributes - B2400 8-NONE-2 +tcsetattr(TCSAFLUSH, B2400) - OK +set_attributes - B2400 8-NONE-2 tcsetattr(TCSANOW, B4800) - OK -set_attributes - B4800 5-NONE-1 +set_attributes - B4800 8-NONE-2 tcsetattr(TCSADRAIN, B4800) - OK -set_attributes - B4800 5-NONE-1 +set_attributes - B4800 8-NONE-2 +tcsetattr(TCSAFLUSH, B4800) - OK +set_attributes - B4800 8-NONE-2 tcsetattr(TCSANOW, B9600) - OK -set_attributes - B9600 5-NONE-1 +set_attributes - B9600 8-NONE-2 tcsetattr(TCSADRAIN, B9600) - OK -set_attributes - B9600 5-NONE-1 +set_attributes - B9600 8-NONE-2 +tcsetattr(TCSAFLUSH, B9600) - OK +set_attributes - B9600 8-NONE-2 tcsetattr(TCSANOW, B19200) - OK -set_attributes - B19200 5-NONE-1 +set_attributes - B19200 8-NONE-2 tcsetattr(TCSADRAIN, B19200) - OK -set_attributes - B19200 5-NONE-1 +set_attributes - B19200 8-NONE-2 +tcsetattr(TCSAFLUSH, B19200) - OK +set_attributes - B19200 8-NONE-2 tcsetattr(TCSANOW, B38400) - OK -set_attributes - B38400 5-NONE-1 +set_attributes - B38400 8-NONE-2 tcsetattr(TCSADRAIN, B38400) - OK -set_attributes - B38400 5-NONE-1 +set_attributes - B38400 8-NONE-2 +tcsetattr(TCSAFLUSH, B38400) - OK +set_attributes - B38400 8-NONE-2 +tcsetattr(TCSANOW, B7200) - OK +set_attributes - B7200 8-NONE-2 +tcsetattr(TCSADRAIN, B7200) - OK +set_attributes - B7200 8-NONE-2 +tcsetattr(TCSAFLUSH, B7200) - OK +set_attributes - B7200 8-NONE-2 +tcsetattr(TCSANOW, B14400) - OK +set_attributes - B14400 8-NONE-2 +tcsetattr(TCSADRAIN, B14400) - OK +set_attributes - B14400 8-NONE-2 +tcsetattr(TCSAFLUSH, B14400) - OK +set_attributes - B14400 8-NONE-2 +tcsetattr(TCSANOW, B28800) - OK +set_attributes - B28800 8-NONE-2 +tcsetattr(TCSADRAIN, B28800) - OK +set_attributes - B28800 8-NONE-2 +tcsetattr(TCSAFLUSH, B28800) - OK +set_attributes - B28800 8-NONE-2 tcsetattr(TCSANOW, B57600) - OK -set_attributes - B57600 5-NONE-1 +set_attributes - B57600 8-NONE-2 tcsetattr(TCSADRAIN, B57600) - OK -set_attributes - B57600 5-NONE-1 +set_attributes - B57600 8-NONE-2 +tcsetattr(TCSAFLUSH, B57600) - OK +set_attributes - B57600 8-NONE-2 +tcsetattr(TCSANOW, B76800) - OK +set_attributes - B76800 8-NONE-2 +tcsetattr(TCSADRAIN, B76800) - OK +set_attributes - B76800 8-NONE-2 +tcsetattr(TCSAFLUSH, B76800) - OK +set_attributes - B76800 8-NONE-2 tcsetattr(TCSANOW, B115200) - OK -set_attributes - B115200 5-NONE-1 +set_attributes - B115200 8-NONE-2 tcsetattr(TCSADRAIN, B115200) - OK -set_attributes - B115200 5-NONE-1 +set_attributes - B115200 8-NONE-2 +tcsetattr(TCSAFLUSH, B115200) - OK +set_attributes - B115200 8-NONE-2 tcsetattr(TCSANOW, B230400) - OK -set_attributes - B230400 5-NONE-1 +set_attributes - B230400 8-NONE-2 tcsetattr(TCSADRAIN, B230400) - OK -set_attributes - B230400 5-NONE-1 +set_attributes - B230400 8-NONE-2 +tcsetattr(TCSAFLUSH, B230400) - OK +set_attributes - B230400 8-NONE-2 tcsetattr(TCSANOW, B460800) - OK -set_attributes - B460800 5-NONE-1 +set_attributes - B460800 8-NONE-2 tcsetattr(TCSADRAIN, B460800) - OK -set_attributes - B460800 5-NONE-1 +set_attributes - B460800 8-NONE-2 +tcsetattr(TCSAFLUSH, B460800) - OK +set_attributes - B460800 8-NONE-2 +tcsetattr(TCSANOW, B921600) - OK +set_attributes - B921600 8-NONE-2 +tcsetattr(TCSADRAIN, B921600) - OK +set_attributes - B921600 8-NONE-2 +tcsetattr(TCSAFLUSH, B921600) - OK +set_attributes - B921600 8-NONE-2 Init - close - /dev/test - OK Init - open - /dev/test - OK @@ -168,21 +254,37 @@ Termios_test_driver - rtems_set_initial_baud - 38400 - OK Test termios setting device character size ... tcsetattr(TCSANOW, CS5) - OK -set_attributes - B38400 5-NONE-1 +set_attributes - B38400 5-NONE-2 tcsetattr(TCSADRAIN, CS5) - OK -set_attributes - B38400 5-NONE-1 +set_attributes - B38400 5-NONE-2 +tcsetattr(TCSAFLUSH, CS5) - OK +set_attributes - B38400 5-NONE-2 +tcsetattr(TCSASOFT, CS5) - OK +set_attributes - B38400 5-NONE-2 tcsetattr(TCSANOW, CS6) - OK -set_attributes - B38400 6-NONE-1 +set_attributes - B38400 6-NONE-2 tcsetattr(TCSADRAIN, CS6) - OK -set_attributes - B38400 6-NONE-1 +set_attributes - B38400 6-NONE-2 +tcsetattr(TCSAFLUSH, CS6) - OK +set_attributes - B38400 6-NONE-2 +tcsetattr(TCSASOFT, CS6) - OK +set_attributes - B38400 6-NONE-2 tcsetattr(TCSANOW, CS7) - OK -set_attributes - B38400 7-NONE-1 +set_attributes - B38400 7-NONE-2 tcsetattr(TCSADRAIN, CS7) - OK -set_attributes - B38400 7-NONE-1 +set_attributes - B38400 7-NONE-2 +tcsetattr(TCSAFLUSH, CS7) - OK +set_attributes - B38400 7-NONE-2 +tcsetattr(TCSASOFT, CS7) - OK +set_attributes - B38400 7-NONE-2 tcsetattr(TCSANOW, CS8) - OK -set_attributes - B38400 8-NONE-1 +set_attributes - B38400 8-NONE-2 tcsetattr(TCSADRAIN, CS8) - OK -set_attributes - B38400 8-NONE-1 +set_attributes - B38400 8-NONE-2 +tcsetattr(TCSAFLUSH, CS8) - OK +set_attributes - B38400 8-NONE-2 +tcsetattr(TCSASOFT, CS8) - OK +set_attributes - B38400 8-NONE-2 Init - close - /dev/test - OK Init - open - /dev/test - OK @@ -191,17 +293,29 @@ Termios_test_driver - rtems_set_initial_baud - 38400 - OK Test termios setting device parity ... tcsetattr(TCSANOW, none) - OK -set_attributes - B38400 8-NONE-1 +set_attributes - B38400 8-NONE-2 tcsetattr(TCSADRAIN, none) - OK -set_attributes - B38400 8-NONE-1 +set_attributes - B38400 8-NONE-2 +tcsetattr(TCSAFLUSH, none) - OK +set_attributes - B38400 8-NONE-2 +tcsetattr(TCSASOFT, none) - OK +set_attributes - B38400 8-NONE-2 tcsetattr(TCSANOW, even) - OK -set_attributes - B38400 8-ODD-1 +set_attributes - B38400 8-ODD-2 tcsetattr(TCSADRAIN, even) - OK -set_attributes - B38400 8-ODD-1 +set_attributes - B38400 8-ODD-2 +tcsetattr(TCSAFLUSH, even) - OK +set_attributes - B38400 8-ODD-2 +tcsetattr(TCSASOFT, even) - OK +set_attributes - B38400 8-ODD-2 tcsetattr(TCSANOW, odd) - OK -set_attributes - B38400 8-EVEN-1 +set_attributes - B38400 8-EVEN-2 tcsetattr(TCSADRAIN, odd) - OK -set_attributes - B38400 8-EVEN-1 +set_attributes - B38400 8-EVEN-2 +tcsetattr(TCSAFLUSH, odd) - OK +set_attributes - B38400 8-EVEN-2 +tcsetattr(TCSASOFT, odd) - OK +set_attributes - B38400 8-EVEN-2 Init - close - /dev/test - OK Init - open - /dev/test - OK @@ -213,10 +327,18 @@ tcsetattr(TCSANOW, 1 bit) - OK set_attributes - B38400 8-NONE-1 tcsetattr(TCSADRAIN, 1 bits) - OK set_attributes - B38400 8-NONE-1 +tcsetattr(TCSAFLUSH, 1 bits) - OK +set_attributes - B38400 8-NONE-1 +tcsetattr(TCSASOFT, 1 bits) - OK +set_attributes - B38400 8-NONE-1 tcsetattr(TCSANOW, 2 bits) - OK set_attributes - B38400 8-NONE-2 tcsetattr(TCSADRAIN, 2 bits) - OK set_attributes - B38400 8-NONE-2 +tcsetattr(TCSAFLUSH, 2 bits) - OK +set_attributes - B38400 8-NONE-2 +tcsetattr(TCSASOFT, 2 bits) - OK +set_attributes - B38400 8-NONE-2 cfsetospeed(BAD BAUD) - EINVAL cfsetospeed(B0) - OK cfgetospeed(B0) - OK @@ -250,14 +372,24 @@ cfsetospeed(B19200) - OK cfgetospeed(B19200) - OK cfsetospeed(B38400) - OK cfgetospeed(B38400) - OK +cfsetospeed(B7200) - OK +cfgetospeed(B7200) - OK +cfsetospeed(B14400) - OK +cfgetospeed(B14400) - OK +cfsetospeed(B28800) - OK +cfgetospeed(B28800) - OK cfsetospeed(B57600) - OK cfgetospeed(B57600) - OK +cfsetospeed(B76800) - OK +cfgetospeed(B76800) - OK cfsetospeed(B115200) - OK cfgetospeed(B115200) - OK cfsetospeed(B230400) - OK cfgetospeed(B230400) - OK cfsetospeed(B460800) - OK cfgetospeed(B460800) - OK +cfsetospeed(B921600) - OK +cfgetospeed(B921600) - OK cfsetispeed(BAD BAUD) - EINVAL cfsetispeed(B0) - OK cfgetispeed(B0) - OK @@ -291,14 +423,24 @@ cfsetispeed(B19200) - OK cfgetispeed(B19200) - OK cfsetispeed(B38400) - OK cfgetispeed(B38400) - OK +cfsetispeed(B7200) - OK +cfgetispeed(B7200) - OK +cfsetispeed(B14400) - OK +cfgetispeed(B14400) - OK +cfsetispeed(B28800) - OK +cfgetispeed(B28800) - OK cfsetispeed(B57600) - OK cfgetispeed(B57600) - OK +cfsetispeed(B76800) - OK +cfgetispeed(B76800) - OK cfsetispeed(B115200) - OK cfgetispeed(B115200) - OK cfsetispeed(B230400) - OK cfgetispeed(B230400) - OK cfsetispeed(B460800) - OK cfgetispeed(B460800) - OK +cfsetispeed(B921600) - OK +cfgetispeed(B921600) - OK cfsetspeed(BAD BAUD) - EINVAL cfsetspeed(B0) - OK cfgetspeed(B0) - checking both inspeed and outspeed - OK @@ -332,14 +474,24 @@ cfsetspeed(B19200) - OK cfgetspeed(B19200) - checking both inspeed and outspeed - OK cfsetspeed(B38400) - OK cfgetspeed(B38400) - checking both inspeed and outspeed - OK +cfsetspeed(B7200) - OK +cfgetspeed(B7200) - checking both inspeed and outspeed - OK +cfsetspeed(B14400) - OK +cfgetspeed(B14400) - checking both inspeed and outspeed - OK +cfsetspeed(B28800) - OK +cfgetspeed(B28800) - checking both inspeed and outspeed - OK cfsetspeed(B57600) - OK cfgetspeed(B57600) - checking both inspeed and outspeed - OK +cfsetspeed(B76800) - OK +cfgetspeed(B76800) - checking both inspeed and outspeed - OK cfsetspeed(B115200) - OK cfgetspeed(B115200) - checking both inspeed and outspeed - OK cfsetspeed(B230400) - OK cfgetspeed(B230400) - checking both inspeed and outspeed - OK cfsetspeed(B460800) - OK cfgetspeed(B460800) - checking both inspeed and outspeed - OK +cfsetspeed(B921600) - OK +cfgetspeed(B921600) - checking both inspeed and outspeed - OK Init - close - /dev/test - OK Multiple open of the device Termios_test_driver - rtems_set_initial_baud - bad baud - OK @@ -395,4 +547,4 @@ Termios_test_driver - rtems_set_initial_baud - 38400 - OK Termios_test_driver - rtems_set_initial_baud - bad baud - OK Termios_test_driver - rtems_set_initial_baud - 38400 - OK -*** END OF TEST TERMIOS 01 *** +*** END OF TEST TERMIOS 1 *** diff --git a/testsuites/libtests/termios01/termios_testdriver.c b/testsuites/libtests/termios01/termios_testdriver.c index 43aeccd284..bd5c7a12d2 100644 --- a/testsuites/libtests/termios01/termios_testdriver.c +++ b/testsuites/libtests/termios01/termios_testdriver.c @@ -85,7 +85,7 @@ int termios_test_driver_set_attributes( const char *char_size = "5"; const char *stop = "NONE"; - baud_requested = t->c_cflag & CBAUD; + baud_requested = t->c_ispeed; number = rtems_termios_baud_to_number( baud_requested ); @@ -164,7 +164,7 @@ rtems_device_driver termios_test_driver_open( int rc; rtems_libio_open_close_args_t *args = arg; static bool firstCall = true; - + static const rtems_termios_callbacks Callbacks = { NULL, /* firstOpen */ NULL, /* lastClose */ @@ -192,7 +192,7 @@ rtems_device_driver termios_test_driver_open( size_t i; firstCall = false; - + for (i = 0; i < sizeof( allocSizes ) / sizeof( allocSizes [0] ); ++i) { void *opaque = rtems_heap_greedy_allocate( allocSizes, i ); |