From df49c60c9671e4a28e636964d744c1f59fb6cb68 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 12 Jun 2000 15:00:15 +0000 Subject: Merged from 4.5.0-beta3a --- c/src/tests/libtests/cpuuse/Makefile.am | 7 +- c/src/tests/libtests/cpuuse/cpuuse.scn | 34 +- c/src/tests/libtests/cpuuse/system.h | 21 +- c/src/tests/libtests/cpuuse/task2.c | 21 +- c/src/tests/libtests/cpuuse/tswitch.c | 22 +- c/src/tests/libtests/malloctest/Makefile.am | 9 +- c/src/tests/libtests/malloctest/malloctest.scn | 468 ++++++++++++++ c/src/tests/libtests/malloctest/system.h | 9 +- c/src/tests/libtests/monitor/Makefile.am | 7 +- c/src/tests/libtests/monitor/system.h | 14 +- c/src/tests/libtests/putenvtest/Makefile.am | 7 +- c/src/tests/libtests/putenvtest/init.c | 8 +- c/src/tests/libtests/rtems++/Makefile.am | 7 +- c/src/tests/libtests/rtems++/System.h | 7 +- c/src/tests/libtests/rtmonuse/Makefile.am | 7 +- c/src/tests/libtests/rtmonuse/system.h | 8 +- c/src/tests/libtests/stackchk/Makefile.am | 7 +- c/src/tests/libtests/stackchk/system.h | 11 +- c/src/tests/libtests/termios/Makefile.am | 7 +- c/src/tests/libtests/termios/README | 70 ++- c/src/tests/libtests/termios/init.c | 819 ++++++++++++++++++++++--- 21 files changed, 1386 insertions(+), 184 deletions(-) (limited to 'c/src/tests/libtests') diff --git a/c/src/tests/libtests/cpuuse/Makefile.am b/c/src/tests/libtests/cpuuse/Makefile.am index e630c15cb1..3ab0a2ff2c 100644 --- a/c/src/tests/libtests/cpuuse/Makefile.am +++ b/c/src/tests/libtests/cpuuse/Makefile.am @@ -1,8 +1,9 @@ -## +## ## $Id$ -## +## AUTOMAKE_OPTIONS = foreign 1.4 + TEST = cpuuse MANAGERS = io rate_monotonic @@ -11,7 +12,7 @@ C_FILES = init.c task1.c task2.c task3.c tswitch.c C_O_FILES = $(C_FILES:%.c=${ARCH}/%.o) H_FILES = system.h -noinst_HEADERS =$(H_FILES) +noinst_HEADERS = $(H_FILES) DOCTYPES = scn DOCS = $(DOCTYPES:%=$(TEST).%) diff --git a/c/src/tests/libtests/cpuuse/cpuuse.scn b/c/src/tests/libtests/cpuuse/cpuuse.scn index f104c0c482..b45cf91136 100644 --- a/c/src/tests/libtests/cpuuse/cpuuse.scn +++ b/c/src/tests/libtests/cpuuse/cpuuse.scn @@ -1,24 +1,34 @@ -*** TEST 4 *** -TA1 - 09:15:00 12/31/1988 +*** CPU USAGE LIBRARY TEST *** TA1 - rtems_task_suspend - on Task 2 TA1 - rtems_task_suspend - on Task 3 TA1 - killing time TA1 - rtems_task_resume - on Task 2 TA1 - rtems_task_resume - on Task 3 -TA2 - 09:15:03 12/31/1988 -TA3 - 09:15:04 12/31/1988 -TA1 - 09:15:05 12/31/1988 -TA2 - 09:15:06 12/31/1988 -TA3 - 09:15:07 12/31/1988 -TA1 - 09:15:08 12/31/1988 TA1 - rtems_task_mode - change mode to NO RTEMS_PREEMPT -TA1 - 09:15:09 12/31/1988 TA1 - 09:15:10 12/31/1988 TA1 - 09:15:11 12/31/1988 TA1 - 09:15:12 12/31/1988 TA1 - 09:15:13 12/31/1988 TA1 - 09:15:14 12/31/1988 +TA1 - 09:15:15 12/31/1988 TA1 - rtems_task_mode - change mode to RTEMS_PREEMPT -TA2 - 09:15:15 12/31/1988 -TA3 - 09:15:16 12/31/1988 -*** END OF TEST 4 *** +TA1 - 09:15:00 12/31/1988 +TA2 - 09:15:04 12/31/1988 +TA3 - 09:15:05 12/31/1988 +TA1 - 09:15:06 12/31/1988 +TA2 - 09:15:07 12/31/1988 +TA3 - 09:15:08 12/31/1988 +TA1 - 09:15:09 12/31/1988 +TA2 - 09:15:16 12/31/1988 +CPU Usage by thread + ID NAME TICKS PERCENT +0x04010001 IDLE 0 0.000 +0x08010002 TA1 1203 0.748 +0x08010003 TA2 204 0.127 +0x08010004 TA3 202 0.126 + +Ticks since last reset = 1601 + +Total Units = 1609 +*** END OF CPU USAGE LIBRARY TEST *** +NOTE: Actual time per task will vary but there should be no IDLE time. diff --git a/c/src/tests/libtests/cpuuse/system.h b/c/src/tests/libtests/cpuuse/system.h index 83aa39f121..f99c6eb647 100644 --- a/c/src/tests/libtests/cpuuse/system.h +++ b/c/src/tests/libtests/cpuuse/system.h @@ -40,12 +40,11 @@ void Task_switch( /* configuration information */ -#define CONFIGURE_SPTEST - -#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER -#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER #define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1 +#define CONFIGURE_MAXIMUM_TASKS 4 #define CONFIGURE_TICKS_PER_TIMESLICE 100 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE @@ -64,5 +63,19 @@ TEST_EXTERN rtems_name Extension_name[ 4 ]; /* array of task names */ /* array of task run counts */ TEST_EXTERN volatile rtems_unsigned32 Run_count[ 4 ]; + +/* + * Keep track of task switches + */ + +struct taskSwitchLog { + int taskIndex; + rtems_time_of_day when; +}; + +extern struct taskSwitchLog taskSwitchLog[]; +extern int taskSwitchLogIndex; +volatile extern int testsFinished; + /* end of include file */ diff --git a/c/src/tests/libtests/cpuuse/task2.c b/c/src/tests/libtests/cpuuse/task2.c index 5dbdda331d..8a9880d0ba 100644 --- a/c/src/tests/libtests/cpuuse/task2.c +++ b/c/src/tests/libtests/cpuuse/task2.c @@ -20,9 +20,28 @@ #include "system.h" +#include + +static void +showTaskSwitches (void) +{ + int i; + int switches = taskSwitchLogIndex; + + for (i = 0 ; i < switches ; i++) { + put_name( Task_name[taskSwitchLog[i].taskIndex], FALSE ); + print_time( "- ", &taskSwitchLog[i].when, "\n" ); + } +} + rtems_task Task_2( rtems_task_argument argument ) { - while( FOREVER ); + while ( !testsFinished ); + + showTaskSwitches (); + CPU_usage_Dump(); + puts( "*** END OF CPU USAGE LIBRARY TEST ***" ); + exit( 0 ); } diff --git a/c/src/tests/libtests/cpuuse/tswitch.c b/c/src/tests/libtests/cpuuse/tswitch.c index f083709497..56a53770a7 100644 --- a/c/src/tests/libtests/cpuuse/tswitch.c +++ b/c/src/tests/libtests/cpuuse/tswitch.c @@ -22,7 +22,9 @@ #include "system.h" -#include +struct taskSwitchLog taskSwitchLog[1000]; +int taskSwitchLogIndex; +volatile int testsFinished;; rtems_extension Task_switch( rtems_tcb *unused, @@ -42,16 +44,18 @@ rtems_extension Task_switch( Run_count[ index ] += 1; status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); - directive_failed( status, "rtems_clock_get" ); + fatal_directive_status_with_level( status, RTEMS_SUCCESSFUL, + "rtems_clock_get", 1 ); - put_name( Task_name[ index ], FALSE ); - print_time( "- ", &time, "\n" ); - - if ( time.second >= 16 ) { - CPU_usage_Dump(); - puts( "*** END OF CPU USAGE LIBRARY TEST ***" ); - exit( 0 ); + if (taskSwitchLogIndex < + (sizeof taskSwitchLog / sizeof taskSwitchLog[0])) { + taskSwitchLog[taskSwitchLogIndex].taskIndex = index; + taskSwitchLog[taskSwitchLogIndex].when = time; + taskSwitchLogIndex++; } + if ( time.second >= 16 ) + testsFinished = 1; + break; case 0: diff --git a/c/src/tests/libtests/malloctest/Makefile.am b/c/src/tests/libtests/malloctest/Makefile.am index 70ca6e7add..7cad5cfe92 100644 --- a/c/src/tests/libtests/malloctest/Makefile.am +++ b/c/src/tests/libtests/malloctest/Makefile.am @@ -1,8 +1,9 @@ -## +## ## $Id$ -## +## AUTOMAKE_OPTIONS = foreign 1.4 + TEST = malloctest MANAGERS = io @@ -11,9 +12,9 @@ C_FILES = init.c task1.c C_O_FILES = $(C_FILES:%.c=${ARCH}/%.o) H_FILES = system.h -noinst_HEADERS =$(H_FILES) +noinst_HEADERS = $(H_FILES) -DOCTYPES = +DOCTYPES = scn DOCS = $(DOCTYPES:%=$(TEST).%) SRCS = $(DOCS) $(C_FILES) $(CC_FILES) $(H_FILES) $(S_FILES) diff --git a/c/src/tests/libtests/malloctest/malloctest.scn b/c/src/tests/libtests/malloctest/malloctest.scn index e69de29bb2..1e75d9a8f7 100644 --- a/c/src/tests/libtests/malloctest/malloctest.scn +++ b/c/src/tests/libtests/malloctest/malloctest.scn @@ -0,0 +1,468 @@ +*** MALLOC TEST *** +TA1 - rtems_clock_get - 09:00:00 12/31/1988 +mallocing 513 bytes +TA2 - rtems_clock_get - 09:00:00 12/31/1988 +mallocing 513 bytes +TA3 - rtems_clock_get - 09:00:00 12/31/1988 +mallocing 513 bytes +TA4 - rtems_clock_get - 09:00:00 12/31/1988 +mallocing 513 bytes +TA5 - rtems_clock_get - 09:00:00 12/31/1988 +mallocing 513 bytes +TA1 - rtems_clock_get - 09:00:00 12/31/1988 +mallocing 175 bytes +TA2 - rtems_clock_get - 09:00:00 12/31/1988 +mallocing 175 bytes +TA1 - rtems_clock_get - 09:00:00 12/31/1988 +mallocing 308 bytes +TA3 - rtems_clock_get - 09:00:00 12/31/1988 +mallocing 175 bytes +TA1 - rtems_clock_get - 09:00:00 12/31/1988 +mallocing 534 bytes +TA2 - rtems_clock_get - 09:00:01 12/31/1988 +mallocing 308 bytes +TA4 - rtems_clock_get - 09:00:01 12/31/1988 +mallocing 175 bytes +TA1 - rtems_clock_get - 09:00:01 12/31/1988 +mallocing 947 bytes +TA5 - rtems_clock_get - 09:00:01 12/31/1988 +mallocing 175 bytes +TA1 - rtems_clock_get - 09:00:01 12/31/1988 +mallocing 171 bytes +TA2 - rtems_clock_get - 09:00:01 12/31/1988 +mallocing 534 bytes +TA3 - rtems_clock_get - 09:00:01 12/31/1988 +mallocing 308 bytes +TA1 - rtems_clock_get - 09:00:01 12/31/1988 +mallocing 702 bytes +TA1 - rtems_clock_get - 09:00:01 12/31/1988 +mallocing 226 bytes +TA2 - rtems_clock_get - 09:00:02 12/31/1988 +mallocing 947 bytes +TA4 - rtems_clock_get - 09:00:02 12/31/1988 +mallocing 308 bytes +TA1 - rtems_clock_get - 09:00:02 12/31/1988 +mallocing 494 bytes +TA3 - rtems_clock_get - 09:00:02 12/31/1988 +mallocing 534 bytes +TA1 - rtems_clock_get - 09:00:02 12/31/1988 +mallocing 124 bytes +TA2 - rtems_clock_get - 09:00:02 12/31/1988 +mallocing 171 bytes +TA5 - rtems_clock_get - 09:00:02 12/31/1988 +mallocing 308 bytes +TA1 - rtems_clock_get - 09:00:02 12/31/1988 +mallocing 83 bytes +TA1 - rtems_clock_get - 09:00:02 12/31/1988 +mallocing 389 bytes +TA2 - rtems_clock_get - 09:00:03 12/31/1988 +mallocing 702 bytes +TA4 - rtems_clock_get - 09:00:03 12/31/1988 +mallocing 534 bytes +TA3 - rtems_clock_get - 09:00:03 12/31/1988 +mallocing 947 bytes +TA1 - rtems_clock_get - 09:00:03 12/31/1988 +mallocing 277 bytes +TA1 - rtems_clock_get - 09:00:03 12/31/1988 +mallocing 368 bytes +TA2 - rtems_clock_get - 09:00:03 12/31/1988 +mallocing 226 bytes +TA1 - rtems_clock_get - 09:00:03 12/31/1988 +mallocing 983 bytes +TA5 - rtems_clock_get - 09:00:03 12/31/1988 +mallocing 534 bytes +TA3 - rtems_clock_get - 09:00:03 12/31/1988 +mallocing 171 bytes +TA1 - rtems_clock_get - 09:00:03 12/31/1988 +mallocing 535 bytes +TA2 - rtems_clock_get - 09:00:04 12/31/1988 +mallocing 494 bytes +TA4 - rtems_clock_get - 09:00:04 12/31/1988 +mallocing 947 bytes +TA1 - rtems_clock_get - 09:00:04 12/31/1988 +mallocing 765 bytes +TA1 - rtems_clock_get - 09:00:04 12/31/1988 +mallocing 646 bytes +TA2 - rtems_clock_get - 09:00:04 12/31/1988 +mallocing 124 bytes +TA3 - rtems_clock_get - 09:00:04 12/31/1988 +mallocing 702 bytes +TA1 - rtems_clock_get - 09:00:04 12/31/1988 +mallocing 767 bytes +TA1 - rtems_clock_get - 09:00:04 12/31/1988 +mallocing 780 bytes +TA2 - rtems_clock_get - 09:00:05 12/31/1988 +mallocing 83 bytes +TA4 - rtems_clock_get - 09:00:05 12/31/1988 +mallocing 171 bytes +TA5 - rtems_clock_get - 09:00:05 12/31/1988 +mallocing 947 bytes +TA1 - rtems_clock_get - 09:00:05 12/31/1988 +mallocing 822 bytes +TA3 - rtems_clock_get - 09:00:05 12/31/1988 +mallocing 226 bytes +TA1 - rtems_clock_get - 09:00:05 12/31/1988 +mallocing 151 bytes +TA2 - rtems_clock_get - 09:00:05 12/31/1988 +mallocing 389 bytes +TA1 - rtems_clock_get - 09:00:05 12/31/1988 +mallocing 625 bytes +TA1 - rtems_clock_get - 09:00:05 12/31/1988 +mallocing 314 bytes +TA2 - rtems_clock_get - 09:00:06 12/31/1988 +mallocing 277 bytes +TA4 - rtems_clock_get - 09:00:06 12/31/1988 +mallocing 702 bytes +TA3 - rtems_clock_get - 09:00:06 12/31/1988 +mallocing 494 bytes +TA1 - rtems_clock_get - 09:00:06 12/31/1988 +mallocing 346 bytes +TA5 - rtems_clock_get - 09:00:06 12/31/1988 +mallocing 171 bytes +TA1 - rtems_clock_get - 09:00:06 12/31/1988 +mallocing 917 bytes +TA2 - rtems_clock_get - 09:00:06 12/31/1988 +mallocing 368 bytes +TA1 - rtems_clock_get - 09:00:06 12/31/1988 +mallocing 519 bytes +TA3 - rtems_clock_get - 09:00:06 12/31/1988 +mallocing 124 bytes +TA1 - rtems_clock_get - 09:00:06 12/31/1988 +mallocing 401 bytes +TA2 - rtems_clock_get - 09:00:07 12/31/1988 +mallocing 983 bytes +TA4 - rtems_clock_get - 09:00:07 12/31/1988 +mallocing 226 bytes +TA1 - rtems_clock_get - 09:00:07 12/31/1988 +mallocing 606 bytes +TA1 - rtems_clock_get - 09:00:07 12/31/1988 +mallocing 785 bytes +TA2 - rtems_clock_get - 09:00:07 12/31/1988 +mallocing 535 bytes +TA5 - rtems_clock_get - 09:00:07 12/31/1988 +mallocing 702 bytes +TA3 - rtems_clock_get - 09:00:07 12/31/1988 +mallocing 83 bytes +TA1 - rtems_clock_get - 09:00:07 12/31/1988 +mallocing 931 bytes +TA1 - rtems_clock_get - 09:00:07 12/31/1988 +mallocing 869 bytes +TA2 - rtems_clock_get - 09:00:08 12/31/1988 +mallocing 765 bytes +TA4 - rtems_clock_get - 09:00:08 12/31/1988 +mallocing 494 bytes +TA1 - rtems_clock_get - 09:00:08 12/31/1988 +mallocing 866 bytes +TA3 - rtems_clock_get - 09:00:08 12/31/1988 +mallocing 389 bytes +TA1 - rtems_clock_get - 09:00:08 12/31/1988 +mallocing 674 bytes +TA2 - rtems_clock_get - 09:00:08 12/31/1988 +mallocing 646 bytes +TA1 - rtems_clock_get - 09:00:08 12/31/1988 +mallocing 758 bytes +TA5 - rtems_clock_get - 09:00:08 12/31/1988 +mallocing 226 bytes +TA1 - rtems_clock_get - 09:00:08 12/31/1988 +mallocing 581 bytes +TA2 - rtems_clock_get - 09:00:09 12/31/1988 +mallocing 767 bytes +TA4 - rtems_clock_get - 09:00:09 12/31/1988 +mallocing 124 bytes +TA3 - rtems_clock_get - 09:00:09 12/31/1988 +mallocing 277 bytes +TA1 - rtems_clock_get - 09:00:09 12/31/1988 +mallocing 389 bytes +TA1 - rtems_clock_get - 09:00:09 12/31/1988 +mallocing 355 bytes +TA2 - rtems_clock_get - 09:00:09 12/31/1988 +mallocing 780 bytes +TA1 - rtems_clock_get - 09:00:09 12/31/1988 +mallocing 200 bytes +TA3 - rtems_clock_get - 09:00:09 12/31/1988 +mallocing 368 bytes +TA1 - rtems_clock_get - 09:00:09 12/31/1988 +mallocing 826 bytes +TA2 - rtems_clock_get - 09:00:10 12/31/1988 +mallocing 822 bytes +TA4 - rtems_clock_get - 09:00:10 12/31/1988 +mallocing 83 bytes +TA5 - rtems_clock_get - 09:00:10 12/31/1988 +mallocing 494 bytes +TA1 - rtems_clock_get - 09:00:10 12/31/1988 +mallocing 415 bytes +TA1 - rtems_clock_get - 09:00:10 12/31/1988 +mallocing 463 bytes +TA2 - rtems_clock_get - 09:00:10 12/31/1988 +mallocing 151 bytes +TA3 - rtems_clock_get - 09:00:10 12/31/1988 +mallocing 983 bytes +TA1 - rtems_clock_get - 09:00:10 12/31/1988 +mallocing 979 bytes +TA1 - rtems_clock_get - 09:00:10 12/31/1988 +mallocing 126 bytes +TA2 - rtems_clock_get - 09:00:11 12/31/1988 +mallocing 625 bytes +TA4 - rtems_clock_get - 09:00:11 12/31/1988 +mallocing 389 bytes +TA1 - rtems_clock_get - 09:00:11 12/31/1988 +mallocing 212 bytes +TA5 - rtems_clock_get - 09:00:11 12/31/1988 +mallocing 124 bytes +TA3 - rtems_clock_get - 09:00:11 12/31/1988 +mallocing 535 bytes +TA1 - rtems_clock_get - 09:00:11 12/31/1988 +mallocing 958 bytes +TA2 - rtems_clock_get - 09:00:11 12/31/1988 +mallocing 314 bytes +TA1 - rtems_clock_get - 09:00:11 12/31/1988 +mallocing 737 bytes +TA1 - rtems_clock_get - 09:00:11 12/31/1988 +mallocing 409 bytes +TA2 - rtems_clock_get - 09:00:12 12/31/1988 +mallocing 346 bytes +TA4 - rtems_clock_get - 09:00:12 12/31/1988 +mallocing 277 bytes +TA3 - rtems_clock_get - 09:00:12 12/31/1988 +mallocing 765 bytes +TA1 - rtems_clock_get - 09:00:12 12/31/1988 +mallocing 780 bytes +TA1 - rtems_clock_get - 09:00:12 12/31/1988 +mallocing 757 bytes +TA2 - rtems_clock_get - 09:00:12 12/31/1988 +mallocing 917 bytes +TA5 - rtems_clock_get - 09:00:12 12/31/1988 +mallocing 83 bytes +TA1 - rtems_clock_get - 09:00:12 12/31/1988 +mallocing 956 bytes +TA3 - rtems_clock_get - 09:00:12 12/31/1988 +mallocing 646 bytes +TA1 - rtems_clock_get - 09:00:12 12/31/1988 +mallocing 28 bytes +TA2 - rtems_clock_get - 09:00:13 12/31/1988 +mallocing 519 bytes +TA4 - rtems_clock_get - 09:00:13 12/31/1988 +mallocing 368 bytes +TA1 - rtems_clock_get - 09:00:13 12/31/1988 +mallocing 318 bytes +TA1 - rtems_clock_get - 09:00:13 12/31/1988 +mallocing 756 bytes +TA2 - rtems_clock_get - 09:00:13 12/31/1988 +mallocing 401 bytes +TA3 - rtems_clock_get - 09:00:13 12/31/1988 +mallocing 767 bytes +TA1 - rtems_clock_get - 09:00:13 12/31/1988 +mallocing 242 bytes +TA5 - rtems_clock_get - 09:00:13 12/31/1988 +mallocing 389 bytes +TA1 - rtems_clock_get - 09:00:13 12/31/1988 +mallocing 589 bytes +TA2 - rtems_clock_get - 09:00:14 12/31/1988 +mallocing 606 bytes +TA4 - rtems_clock_get - 09:00:14 12/31/1988 +mallocing 983 bytes +TA1 - rtems_clock_get - 09:00:14 12/31/1988 +mallocing 43 bytes +TA3 - rtems_clock_get - 09:00:14 12/31/1988 +mallocing 780 bytes +TA1 - rtems_clock_get - 09:00:14 12/31/1988 +mallocing 956 bytes +TA2 - rtems_clock_get - 09:00:14 12/31/1988 +mallocing 785 bytes +TA1 - rtems_clock_get - 09:00:14 12/31/1988 +mallocing 319 bytes +TA1 - rtems_clock_get - 09:00:14 12/31/1988 +mallocing 59 bytes +TA2 - rtems_clock_get - 09:00:15 12/31/1988 +mallocing 931 bytes +TA4 - rtems_clock_get - 09:00:15 12/31/1988 +mallocing 535 bytes +TA5 - rtems_clock_get - 09:00:15 12/31/1988 +mallocing 277 bytes +TA3 - rtems_clock_get - 09:00:15 12/31/1988 +mallocing 822 bytes +TA1 - rtems_clock_get - 09:00:15 12/31/1988 +mallocing 441 bytes +TA1 - rtems_clock_get - 09:00:15 12/31/1988 +mallocing 915 bytes +TA2 - rtems_clock_get - 09:00:15 12/31/1988 +mallocing 869 bytes +TA1 - rtems_clock_get - 09:00:15 12/31/1988 +mallocing 572 bytes +TA3 - rtems_clock_get - 09:00:15 12/31/1988 +mallocing 151 bytes +TA1 - rtems_clock_get - 09:00:15 12/31/1988 +mallocing 118 bytes +TA2 - rtems_clock_get - 09:00:16 12/31/1988 +mallocing 866 bytes +TA4 - rtems_clock_get - 09:00:16 12/31/1988 +mallocing 765 bytes +TA1 - rtems_clock_get - 09:00:16 12/31/1988 +mallocing 569 bytes +TA5 - rtems_clock_get - 09:00:16 12/31/1988 +mallocing 368 bytes +TA1 - rtems_clock_get - 09:00:16 12/31/1988 +mallocing 252 bytes +TA2 - rtems_clock_get - 09:00:16 12/31/1988 +mallocing 674 bytes +TA3 - rtems_clock_get - 09:00:16 12/31/1988 +mallocing 625 bytes +TA1 - rtems_clock_get - 09:00:16 12/31/1988 +mallocing 495 bytes +TA1 - rtems_clock_get - 09:00:16 12/31/1988 +mallocing 236 bytes +TA2 - rtems_clock_get - 09:00:17 12/31/1988 +mallocing 758 bytes +TA4 - rtems_clock_get - 09:00:17 12/31/1988 +mallocing 646 bytes +TA1 - rtems_clock_get - 09:00:17 12/31/1988 +mallocing 476 bytes +TA3 - rtems_clock_get - 09:00:17 12/31/1988 +mallocing 314 bytes +TA1 - rtems_clock_get - 09:00:17 12/31/1988 +mallocing 406 bytes +TA2 - rtems_clock_get - 09:00:17 12/31/1988 +mallocing 581 bytes +TA5 - rtems_clock_get - 09:00:17 12/31/1988 +mallocing 983 bytes +TA1 - rtems_clock_get - 09:00:17 12/31/1988 +mallocing 872 bytes +TA1 - rtems_clock_get - 09:00:17 12/31/1988 +mallocing 426 bytes +TA2 - rtems_clock_get - 09:00:18 12/31/1988 +mallocing 389 bytes +TA4 - rtems_clock_get - 09:00:18 12/31/1988 +mallocing 767 bytes +TA3 - rtems_clock_get - 09:00:18 12/31/1988 +mallocing 346 bytes +TA1 - rtems_clock_get - 09:00:18 12/31/1988 +mallocing 358 bytes +TA1 - rtems_clock_get - 09:00:18 12/31/1988 +mallocing 381 bytes +TA2 - rtems_clock_get - 09:00:18 12/31/1988 +mallocing 355 bytes +TA1 - rtems_clock_get - 09:00:18 12/31/1988 +mallocing 43 bytes +TA5 - rtems_clock_get - 09:00:18 12/31/1988 +mallocing 535 bytes +TA3 - rtems_clock_get - 09:00:18 12/31/1988 +mallocing 917 bytes +TA1 - rtems_clock_get - 09:00:18 12/31/1988 +mallocing 160 bytes +TA2 - rtems_clock_get - 09:00:19 12/31/1988 +mallocing 200 bytes +TA4 - rtems_clock_get - 09:00:19 12/31/1988 +mallocing 780 bytes +TA1 - rtems_clock_get - 09:00:19 12/31/1988 +mallocing 522 bytes +TA1 - rtems_clock_get - 09:00:19 12/31/1988 +mallocing 696 bytes +TA2 - rtems_clock_get - 09:00:19 12/31/1988 +mallocing 826 bytes +TA3 - rtems_clock_get - 09:00:19 12/31/1988 +mallocing 519 bytes +TA1 - rtems_clock_get - 09:00:19 12/31/1988 +mallocing 97 bytes +TA1 - rtems_clock_get - 09:00:19 12/31/1988 +mallocing 400 bytes +TA2 - rtems_clock_get - 09:00:20 12/31/1988 +mallocing 415 bytes +TA4 - rtems_clock_get - 09:00:20 12/31/1988 +mallocing 822 bytes +TA5 - rtems_clock_get - 09:00:20 12/31/1988 +mallocing 765 bytes +TA1 - rtems_clock_get - 09:00:20 12/31/1988 +mallocing 773 bytes +TA3 - rtems_clock_get - 09:00:20 12/31/1988 +mallocing 401 bytes +TA1 - rtems_clock_get - 09:00:20 12/31/1988 +mallocing 244 bytes +TA2 - rtems_clock_get - 09:00:20 12/31/1988 +mallocing 463 bytes +TA1 - rtems_clock_get - 09:00:20 12/31/1988 +mallocing 342 bytes +TA1 - rtems_clock_get - 09:00:20 12/31/1988 +mallocing 229 bytes +TA2 - rtems_clock_get - 09:00:21 12/31/1988 +mallocing 979 bytes +TA4 - rtems_clock_get - 09:00:21 12/31/1988 +mallocing 151 bytes +TA3 - rtems_clock_get - 09:00:21 12/31/1988 +mallocing 606 bytes +TA1 - rtems_clock_get - 09:00:21 12/31/1988 +mallocing 297 bytes +TA5 - rtems_clock_get - 09:00:21 12/31/1988 +mallocing 646 bytes +TA1 - rtems_clock_get - 09:00:21 12/31/1988 +mallocing 304 bytes +TA2 - rtems_clock_get - 09:00:21 12/31/1988 +mallocing 126 bytes +TA1 - rtems_clock_get - 09:00:21 12/31/1988 +mallocing 887 bytes +TA3 - rtems_clock_get - 09:00:21 12/31/1988 +mallocing 785 bytes +TA1 - rtems_clock_get - 09:00:21 12/31/1988 +mallocing 36 bytes +TA2 - rtems_clock_get - 09:00:22 12/31/1988 +mallocing 212 bytes +TA4 - rtems_clock_get - 09:00:22 12/31/1988 +mallocing 625 bytes +TA1 - rtems_clock_get - 09:00:22 12/31/1988 +mallocing 651 bytes +TA1 - rtems_clock_get - 09:00:22 12/31/1988 +mallocing 398 bytes +TA2 - rtems_clock_get - 09:00:22 12/31/1988 +mallocing 958 bytes +TA5 - rtems_clock_get - 09:00:22 12/31/1988 +mallocing 767 bytes +TA3 - rtems_clock_get - 09:00:22 12/31/1988 +mallocing 931 bytes +TA1 - rtems_clock_get - 09:00:22 12/31/1988 +mallocing 676 bytes +TA1 - rtems_clock_get - 09:00:22 12/31/1988 +mallocing 732 bytes +TA2 - rtems_clock_get - 09:00:23 12/31/1988 +mallocing 737 bytes +TA4 - rtems_clock_get - 09:00:23 12/31/1988 +mallocing 314 bytes +TA1 - rtems_clock_get - 09:00:23 12/31/1988 +mallocing 937 bytes +TA3 - rtems_clock_get - 09:00:23 12/31/1988 +mallocing 869 bytes +TA1 - rtems_clock_get - 09:00:23 12/31/1988 +mallocing 233 bytes +TA2 - rtems_clock_get - 09:00:23 12/31/1988 +mallocing 409 bytes +TA1 - rtems_clock_get - 09:00:23 12/31/1988 +mallocing 838 bytes +TA5 - rtems_clock_get - 09:00:23 12/31/1988 +mallocing 780 bytes +TA1 - rtems_clock_get - 09:00:23 12/31/1988 +mallocing 967 bytes +TA2 - rtems_clock_get - 09:00:24 12/31/1988 +mallocing 780 bytes +TA4 - rtems_clock_get - 09:00:24 12/31/1988 +mallocing 346 bytes +TA3 - rtems_clock_get - 09:00:24 12/31/1988 +mallocing 866 bytes +TA1 - rtems_clock_get - 09:00:24 12/31/1988 +mallocing 778 bytes +TA1 - rtems_clock_get - 09:00:24 12/31/1988 +mallocing 431 bytes +TA2 - rtems_clock_get - 09:00:24 12/31/1988 +mallocing 757 bytes +TA1 - rtems_clock_get - 09:00:24 12/31/1988 +mallocing 674 bytes +TA3 - rtems_clock_get - 09:00:24 12/31/1988 +mallocing 674 bytes +TA1 - rtems_clock_get - 09:00:24 12/31/1988 +mallocing 809 bytes +TA2 - rtems_clock_get - 09:00:25 12/31/1988 +mallocing 956 bytes +TA4 - rtems_clock_get - 09:00:25 12/31/1988 +mallocing 917 bytes +TA5 - rtems_clock_get - 09:00:25 12/31/1988 +mallocing 822 bytes +TA1 - rtems_clock_get - 09:00:25 12/31/1988 +mallocing 158 bytes +*** END OF MALLOC TEST *** diff --git a/c/src/tests/libtests/malloctest/system.h b/c/src/tests/libtests/malloctest/system.h index 3f03aa5873..c275d9ce7d 100644 --- a/c/src/tests/libtests/malloctest/system.h +++ b/c/src/tests/libtests/malloctest/system.h @@ -31,13 +31,14 @@ void blow_stack( void ); /* configuration information */ -#define CONFIGURE_SPTEST - -#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER -#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER #define TASK_STACK_SIZE (RTEMS_MINIMUM_STACK_SIZE*3) +#define CONFIGURE_EXTRA_TASK_STACKS ((RTEMS_MINIMUM_STACK_SIZE*2)*5) +#define CONFIGURE_MAXIMUM_TASKS 6 + #define CONFIGURE_RTEMS_INIT_TASKS_TABLE #include diff --git a/c/src/tests/libtests/monitor/Makefile.am b/c/src/tests/libtests/monitor/Makefile.am index d73ca64e0f..2d70524319 100644 --- a/c/src/tests/libtests/monitor/Makefile.am +++ b/c/src/tests/libtests/monitor/Makefile.am @@ -1,8 +1,9 @@ -## +## ## $Id$ -## +## AUTOMAKE_OPTIONS = foreign 1.4 + TEST = monitor MANAGERS = dpmem event io msg mp part region sem signal timer rate_monotonic \ @@ -12,7 +13,7 @@ C_FILES = init.c C_O_FILES = $(C_FILES:%.c=${ARCH}/%.o) H_FILES = system.h -noinst_HEADERS =$(H_FILES) +noinst_HEADERS = $(H_FILES) DOCTYPES = scn DOCS = #$(DOCTYPES:%=$(TEST).%) diff --git a/c/src/tests/libtests/monitor/system.h b/c/src/tests/libtests/monitor/system.h index 52280bb9a3..a3a538f584 100644 --- a/c/src/tests/libtests/monitor/system.h +++ b/c/src/tests/libtests/monitor/system.h @@ -35,17 +35,19 @@ void Get_all_counters( void ); /* configuration information */ -#define CONFIGURE_SPTEST +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER -#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER +#define CONFIGURE_MAXIMUM_TASKS 7 +#define CONFIGURE_MAXIMUM_PERIODS 10 #define CONFIGURE_INIT_TASK_PRIORITY 10 #define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_DEFAULT_MODES -#define CONFIGURE_MAXIMUM_PERIODS 10 - #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE) + +#define CONFIGURE_EXTRA_TASK_STACKS \ + (6 * (3 * RTEMS_MINIMUM_STACK_SIZE)) /* our tasks */ + \ + (1 * RTEMS_MINIMUM_STACK_SIZE) /* monitor tasks */ #include diff --git a/c/src/tests/libtests/putenvtest/Makefile.am b/c/src/tests/libtests/putenvtest/Makefile.am index 901cee10d0..a2c5d64616 100644 --- a/c/src/tests/libtests/putenvtest/Makefile.am +++ b/c/src/tests/libtests/putenvtest/Makefile.am @@ -1,8 +1,9 @@ -## +## ## $Id$ -## +## AUTOMAKE_OPTIONS = foreign 1.4 + TEST = putenvtest MANAGERS = io @@ -11,7 +12,7 @@ C_FILES = init.c C_O_FILES = $(C_FILES:%.c=${ARCH}/%.o) H_FILES = -noinst_HEADERS =$(H_FILES) +noinst_HEADERS = $(H_FILES) DOCTYPES = DOCS = $(DOCTYPES:%=$(TEST).%) diff --git a/c/src/tests/libtests/putenvtest/init.c b/c/src/tests/libtests/putenvtest/init.c index eb19d4af80..53530db941 100644 --- a/c/src/tests/libtests/putenvtest/init.c +++ b/c/src/tests/libtests/putenvtest/init.c @@ -35,13 +35,13 @@ rtems_task Init( /* configuration information */ -#define CONFIGURE_SPTEST - -#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER -#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER #define TASK_STACK_SIZE (RTEMS_MINIMUM_STACK_SIZE*3) +#define CONFIGURE_MAXIMUM_TASKS 1 + #define CONFIGURE_RTEMS_INIT_TASKS_TABLE #include diff --git a/c/src/tests/libtests/rtems++/Makefile.am b/c/src/tests/libtests/rtems++/Makefile.am index 58f6d25a40..488b04eccf 100644 --- a/c/src/tests/libtests/rtems++/Makefile.am +++ b/c/src/tests/libtests/rtems++/Makefile.am @@ -1,8 +1,9 @@ -## +## ## $Id$ -## +## AUTOMAKE_OPTIONS = foreign 1.4 + TEST = rtems++ MANAGERS = event io msg sem signal timer rate_monotonic @@ -11,7 +12,7 @@ CC_FILES = Init.cc Task1.cc Task2.cc Task3.cc CC_O_FILES = $(CC_FILES:%.cc=${ARCH}/%.o) H_FILES = System.h -noinst_HEADERS =$(H_FILES) +noinst_HEADERS = $(H_FILES) DOCTYPES = scn doc DOCS = $(DOCTYPES:%=$(TEST).%) diff --git a/c/src/tests/libtests/rtems++/System.h b/c/src/tests/libtests/rtems++/System.h index f849e53503..50d6ee13df 100644 --- a/c/src/tests/libtests/rtems++/System.h +++ b/c/src/tests/libtests/rtems++/System.h @@ -112,11 +112,10 @@ class Io_during_interrupt /* configuration information */ -#define CONFIGURE_SPTEST - -#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER -#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER +#define CONFIGURE_MAXIMUM_TASKS 8 #define CONFIGURE_MAXIMUM_TIMERS 1 #define CONFIGURE_MAXIMUM_SEMAPHORES 2 #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 diff --git a/c/src/tests/libtests/rtmonuse/Makefile.am b/c/src/tests/libtests/rtmonuse/Makefile.am index 38ef675e57..7a07738196 100644 --- a/c/src/tests/libtests/rtmonuse/Makefile.am +++ b/c/src/tests/libtests/rtmonuse/Makefile.am @@ -1,8 +1,9 @@ -## +## ## $Id$ -## +## AUTOMAKE_OPTIONS = foreign 1.4 + TEST = rtmonuse MANAGERS = io rate_monotonic @@ -11,7 +12,7 @@ C_FILES = init.c getall.c task1.c C_O_FILES = $(C_FILES:%.c=${ARCH}/%.o) H_FILES = system.h -noinst_HEADERS =$(H_FILES) +noinst_HEADERS = $(H_FILES) DOCTYPES = scn DOCS = $(DOCTYPES:%=$(TEST).%) diff --git a/c/src/tests/libtests/rtmonuse/system.h b/c/src/tests/libtests/rtmonuse/system.h index 9d92d23d14..e9d1a559de 100644 --- a/c/src/tests/libtests/rtmonuse/system.h +++ b/c/src/tests/libtests/rtmonuse/system.h @@ -35,14 +35,14 @@ void Get_all_counters( void ); /* configuration information */ -#define CONFIGURE_SPTEST +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER -#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER +#define CONFIGURE_MAXIMUM_TASKS 6 +#define CONFIGURE_MAXIMUM_PERIODS 10 #define CONFIGURE_INIT_TASK_PRIORITY 10 #define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_DEFAULT_MODES -#define CONFIGURE_MAXIMUM_PERIODS 10 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE diff --git a/c/src/tests/libtests/stackchk/Makefile.am b/c/src/tests/libtests/stackchk/Makefile.am index de59857ea3..80ef6963bb 100644 --- a/c/src/tests/libtests/stackchk/Makefile.am +++ b/c/src/tests/libtests/stackchk/Makefile.am @@ -1,8 +1,9 @@ -## +## ## $Id$ -## +## AUTOMAKE_OPTIONS = foreign 1.4 + TEST = stackchk MANAGERS = io @@ -11,7 +12,7 @@ C_FILES = blow.c init.c task1.c C_O_FILES = $(C_FILES:%.c=${ARCH}/%.o) H_FILES = system.h -noinst_HEADERS =$(H_FILES) +noinst_HEADERS = $(H_FILES) DOCTYPES = scn DOCS = $(DOCTYPES:%=$(TEST).%) diff --git a/c/src/tests/libtests/stackchk/system.h b/c/src/tests/libtests/stackchk/system.h index 4c43388163..42f0166a3e 100644 --- a/c/src/tests/libtests/stackchk/system.h +++ b/c/src/tests/libtests/stackchk/system.h @@ -17,8 +17,6 @@ /* macros */ -#define TASK_STACK_SIZE (RTEMS_MINIMUM_STACK_SIZE*3) - /* functions */ rtems_task Init( @@ -33,10 +31,13 @@ void blow_stack( void ); /* configuration information */ -#define CONFIGURE_SPTEST +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER + +#define TASK_STACK_SIZE (RTEMS_MINIMUM_STACK_SIZE*3) -#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER -#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER +#define CONFIGURE_MAXIMUM_TASKS 4 +#define CONFIGURE_EXTRA_TASK_STACKS (3 * (RTEMS_MINIMUM_STACK_SIZE * 2)) #define CONFIGURE_RTEMS_INIT_TASKS_TABLE diff --git a/c/src/tests/libtests/termios/Makefile.am b/c/src/tests/libtests/termios/Makefile.am index 455730ee90..01f333be06 100644 --- a/c/src/tests/libtests/termios/Makefile.am +++ b/c/src/tests/libtests/termios/Makefile.am @@ -1,8 +1,9 @@ -## +## ## $Id$ -## +## AUTOMAKE_OPTIONS = foreign 1.4 + TEST = termios MANAGERS = io @@ -11,7 +12,7 @@ C_FILES = init.c C_O_FILES = $(C_FILES:%.c=${ARCH}/%.o) H_FILES = -noinst_HEADERS =$(H_FILES) +noinst_HEADERS = $(H_FILES) DOCTYPES = DOCS = $(DOCTYPES:%=$(TEST).%) diff --git a/c/src/tests/libtests/termios/README b/c/src/tests/libtests/termios/README index 6991d80309..2515b2994f 100644 --- a/c/src/tests/libtests/termios/README +++ b/c/src/tests/libtests/termios/README @@ -4,6 +4,53 @@ These tests are brought to you by the letter `q'. +When you start the test, you should see: + + You have the following choices: + 1 - Reset the struct termios + 2 - Look at the current termios setting + 3 - Change the line characteristics + 4 - Test canonical input + 5 - Test raw input + 9 - Exit + Enter your choice (1 to 5 or 9, followed by a carriage return): + +The individual tests are briefly described below: + + +1. Reset the struct termios. + +Included just in case you get into trouble. More than likely, if you are in +trouble, neither input nor output are likely to work and this won't help. But +hey, it should give you some warm fuzzy feeling that its there... + + +2. Look at the current termios setting + +Dumps the current state of the termios settings in hex and with symbolic flag +names. + + +3. Change the line characteristics + +Allows you to change the line speed, parity, number of data bits and number of +stop bits. You must supply a delay before the change takes effect. This gives +you time to switch your terminal settings to continue with the test. + +WARNING: Minicom under Linux gets extremely unhappy (as does the /dev/ttyS? +underlying devices) if you change the line characteristics and do not make the +corresponding change in the terminal emulator. + + +4. Test canonical input + +Simple test of canonical or cooked input mode. Try typing some tabs and/or control characters and make sure that you can backspace over them properly. + + +5. Test raw input + +The line is placed into raw mode and four separate test are done: + VMIN=0, VTIME=0 Each letter you type should produce a line of output. The `count' should be quite large, since (as you correctly @@ -23,18 +70,19 @@ VMIN=5, VTIME=0 the test. VMIN=5, VTIME=20 Type a character. Two seconds later a line should be printed. - Count should be 1. Type a character, and another within 2 -seconds. - Two seconds after last character (or right after the 5th -character) + Count should be 1. Type a character, and another within 2 seconds. + Two seconds after last character (or right after the 5th character) a line should be printed. Type a `q' as the first character of a group to finish the test. - + + +9. Exit + +Gets you out of the test. + + Clear??? -Also, when testing the cooked mode input, try typing some tabs -and/or control characters and make sure that you can backspace over -them properly. --- Eric Norum @@ -43,3 +91,9 @@ Saskatchewan Accelerator Laboratory University of Saskatchewan Saskatoon, Canada. +Charles-Antoine Gauthier +Software Engineering Group +Institute for Information Technology +National Research Council of Canada +charles.gauthier@nrc.ca + diff --git a/c/src/tests/libtests/termios/init.c b/c/src/tests/libtests/termios/init.c index 067b82ac07..bc4097a8cc 100644 --- a/c/src/tests/libtests/termios/init.c +++ b/c/src/tests/libtests/termios/init.c @@ -3,34 +3,38 @@ * * This program may be distributed and used for any purpose. * I ask only that you: - * 1. Leave this author information intact. - * 2. Document any changes you make. + * 1. Leave this author information intact. + * 2. Document any changes you make. * * W. Eric Norum * Saskatchewan Accelerator Laboratory * University of Saskatchewan * Saskatoon, Saskatchewan, CANADA * eric@skatter.usask.ca + * + * Additions: + * Charles-Antoine Gauthier + * Software Engineering Group + * Institute for Information Technology + * National Research Council of Canada + * charles.gauthier@nrc.ca * * $Id$ */ #include -#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER -#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER -#define CONFIGURE_RTEMS_INIT_TASKS_TABLE +#define CONFIGURE_MAXIMUM_TASKS 1 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_MAXIMUM_SEMAPHORES 20 -#define CONFIGURE_MAXIMUM_TIMERS 5 -#define CONFIGURE_MAXIMUM_PERIODS 1 - -#define CONFIGURE_MICROSECONDS_PER_TICK 1000 +#define CONFIGURE_MICROSECONDS_PER_TICK 1000 #define CONFIGURE_INIT + rtems_task Init (rtems_task_argument argument); #include @@ -41,105 +45,724 @@ rtems_task Init (rtems_task_argument argument); #include #include +#if !defined(fileno) int fileno( FILE *stream); /* beyond ANSI */ +#endif + +/* Some of the termios dumping code depends on bit positions! */ + +void print_32bits( unsigned long bits, unsigned char size, char * names[] ) +{ + unsigned char i; + + for( i = 0; i < size; i++ ) { + if( (bits >> i) & 0x1 ) + printf( "%s ", names[i] ); + } +} + + +void print_c_iflag( struct termios * tp ) +{ + char * c_iflag_bits [] = { + "IGNBRK", /* 0000001 */ + "BRKINT", /* 0000002 */ + "IGNPAR", /* 0000004 */ + "PARMRK", /* 0000010 */ + "INPCK", /* 0000020 */ + "ISTRIP", /* 0000040 */ + "INLCR", /* 0000100 */ + "IGNCR", /* 0000200 */ + "ICRNL", /* 0000400 */ + "IUCLC", /* 0001000 */ + "IXON", /* 0002000 */ + "IXANY", /* 0004000 */ + "IXOFF", /* 0010000 */ + "IMAXBEL", /* 0020000 */ + "unknown", /* 0040000 */ + "unknown", /* 0100000 */ + "unknown", /* 0200000 */ + "unknown", /* 0400000 */ + "unknown", /* 1000000 */ + "unknown", /* 2000000 */ + "unknown" /* 4000000 */ + }; + + printf( "c_iflag = 0x%08x\n\t", tp->c_iflag ); + print_32bits( tp->c_iflag, sizeof( c_iflag_bits )/sizeof( char * ), c_iflag_bits ); + printf( "\n" ); +} + + +void print_c_oflag( struct termios * tp ) +{ + printf( "c_oflag = 0x%08x\n\t", tp->c_oflag ); + + if( tp->c_oflag & OPOST ) + printf( "OPOST " ); + + if( tp->c_oflag & OLCUC ) + printf( "OLCUC " ); + + if( tp->c_oflag & ONLCR ) + printf( "ONLCR " ); + + if( tp->c_oflag & OCRNL ) + printf( "OCRNL " ); + + if( tp->c_oflag & ONOCR ) + printf( "ONOCR " ); + + if( tp->c_oflag & ONLRET ) + printf( "ONLRET " ); + + if( tp->c_oflag & OFILL ) + printf( "OFILL " ); + + if( tp->c_oflag & OFDEL ) + printf( "OFDEL " ); + + switch( tp->c_oflag & NLDLY ) { + case NL0: + printf( "NL0 " ); + break; + + case NL1: + printf( "NL1 " ); + break; + } + + switch( tp->c_oflag & CRDLY ) { + case CR0: + printf( "CR0 " ); + break; + + case CR1: + printf( "CR1 " ); + break; + + case CR2: + printf( "CR2 " ); + break; + + case CR3: + printf( "CR3 " ); + break; + } + + switch( tp->c_oflag & TABDLY ) { + case TAB0: + printf( "TAB0 " ); + break; + + case TAB1: + printf( "TAB1 " ); + break; + + case TAB2: + printf( "TAB2 " ); + break; + + case TAB3: + printf( "TAB3 " ); + break; + } + + switch( tp->c_oflag & BSDLY ) { + case BS0: + printf( "BS0 " ); + break; + + case BS1: + printf( "BS1 " ); + break; + } + + switch( tp->c_oflag & VTDLY ) { + case VT0: + printf( "VT0 " ); + break; + + case VT1: + printf( "VT1 " ); + break; + } + + switch( tp->c_oflag & FFDLY ) { + case FF0: + printf( "FF0" ); + break; + + case FF1: + printf( "FF1" ); + break; + } + printf( "\n" ); +} + + +void print_c_lflag( struct termios * tp ) +{ + char * c_lflag_bits [] = { + "ISIG", /* 0000001 */ + "ICANON", /* 0000002 */ + "XCASE", /* 0000004 */ + "ECHO", /* 0000010 */ + "ECHOE", /* 0000020 */ + "ECHOK", /* 0000040 */ + "ECHONL", /* 0000100 */ + "NOFLSH", /* 0000200 */ + "TOSTOP", /* 0000400 */ + "ECHOCTL", /* 0001000 */ + "ECHOPRT", /* 0002000 */ + "ECHOKE", /* 0004000 */ + "FLUSHO", /* 0010000 */ + "unknown", /* 0020000 */ + "PENDIN", /* 0040000 */ + "IEXTEN", /* 0100000 */ + "unknown", /* 0200000 */ + "unknown", /* 0400000 */ + "unknown", /* 1000000 */ + "unknown", /* 2000000 */ + "unknown", /* 4000000 */ + }; + + printf( "c_lflag = 0x%08x\n\t", tp->c_lflag ); + print_32bits( tp->c_lflag, sizeof( c_lflag_bits )/sizeof( char * ), c_lflag_bits ); + printf( "\n" ); +} + + +void print_c_cflag( struct termios * tp ) +{ + int baud; + + printf( "c_cflag = 0x%08x\n", tp->c_cflag ); + + switch( baud = (tp->c_cflag & CBAUD) ) { + case B0: + printf( "\tCBAUD =\tB0\n" ); + break; + + case B50: + printf( "\tCBAUD =\tB50\n" ); + break; + + case B75: + printf( "\tCBAUD =\tB75\n" ); + break; + + case B110: + printf( "\tCBAUD =\tB110\n" ); + break; + + case B134: + printf( "\tCBAUD =\tB134\n" ); + break; + + case B150: + printf( "\tCBAUD =\tB150\n" ); + break; + + case B200: + printf( "\tCBAUD =\tB200\n" ); + break; + + case B300: + printf( "\tCBAUD =\tB300\n" ); + break; + + case B600: + printf( "\tCBAUD =\tB600\n" ); + break; + + case B1200: + printf( "\tCBAUD =\tB1200\n" ); + break; + + case B1800: + printf( "\tCBAUD =\tB1800\n" ); + break; + + case B2400: + printf( "\tCBAUD =\tB2400\n" ); + break; + + case B4800: + printf( "\tCBAUD =\tB4800\n" ); + break; + + case B9600: + printf( "\tCBAUD =\tB9600\n" ); + break; + + case B19200: + printf( "\tCBAUD =\tB19200\n" ); + break; + + case B38400: + printf( "\tCBAUD =\tB38400\n" ); + break; + + case B57600: + printf( "\tCBAUD =\tB57600\n" ); + break; + + case B115200: + printf( "\tCBAUD =\tB115200\n" ); + break; + + case B230400: + printf( "\tCBAUD =\tB230400\n" ); + break; + + case B460800: + printf( "\tCBAUD =\tB460800\n" ); + break; + + default: + printf( "\tCBAUD =\tunknown (0x%08x)\n", baud ); + break; + } + + switch( tp->c_cflag & CSIZE ) { + case CS5: + printf( "\tCSIZE =\tCS5\n" ); + break; + + case CS6: + printf( "\tCSIZE =\tCS6\n" ); + break; + + case CS7: + printf( "\tCSIZE =\tCS7\n" ); + break; + + case CS8: + printf( "\tCSIZE =\tCS8\n" ); + break; + } + + if( tp->c_cflag & CSTOPB ) + printf( "\tCSTOPB set: send 2 stop bits\n" ); + else + printf( "\tCSTOPB clear: send 1 stop bit\n" ); + + if( tp->c_cflag & PARENB ) + printf( "\tPARENB set: parity enabled\n" ); + else + printf( "\tPARENB clear: parity disabled\n" ); + + if( tp->c_cflag & PARODD ) + printf( "\tPARODD set: parity odd\n" ); + else + printf( "\tPARODD clear: parity even\n" ); + + if( tp->c_cflag & CREAD ) + printf( "\tCREAD set: receiver enabled\n" ); + else + printf( "\tCREAD clear: treceiver disabled\n" ); + + if( tp->c_cflag & HUPCL ) + printf( "\tHUPCL set: enabled\n" ); + else + printf( "\tHUPCL clear: disabled\n" ); + + if( tp->c_cflag & CLOCAL ) + printf( "\tCLOCAL set: ignore modem lines\n" ); + else + printf( "\tCLOCAL clear: don't ignore modem lines\n" ); + +#if defined(CBAUDEX) + if( tp->c_cflag & CBAUDEX ) + printf( "\tCBAUDEX set: What does this do?\n" ); + else + printf( "\tCBAUDEX clear: What does this do?\n" ); +#endif + + if( tp->c_cflag & CRTSCTS ) + printf( "\tCRTSCTS: harware flow control enabled?\n" ); + else + printf( "\tCRTSCTS: hardware flow control disabled?\n" ); +} + + +void print_c_cc( struct termios * tp ) +{ + int i; + char * cc_index_names [NCCS] = { + "[VINTR] ", /* 0 */ + "[VQUIT] ", /* 1 */ + "[VERASE] ", /* 2 */ + "[VKILL] ", /* 3 */ + "[VEOF] ", /* 4 */ + "[VTIME] ", /* 5 */ + "[VMIN] ", /* 6 */ + "[VSWTC ", /* 7 */ + "[VSTART] ", /* 8 */ + "[VSTOP] ", /* 9 */ + "[VSUSP] ", /* 10 */ + "[VEOL] ", /* 11 */ + "[VREPRINT]", /* 12 */ + "[VDISCARD]", /* 13 */ + "[VWERASE] ", /* 14 */ + "[VLNEXT ", /* 15 */ + "[VEOL2] ", /* 16 */ + "unknown ", /* 17 */ + "unknown ", /* 18 */ + }; + + for( i = 0; i < NCCS; i++ ) { + printf( "c_cc%s = 0x%08x\n", cc_index_names[i], tp->c_cc[i] ); + } +} + + +void print_termios( struct termios *tp ) +{ + printf( "\nLooking at the current termios settings:\n\n" ); + print_c_iflag( tp ); + print_c_oflag( tp ); + print_c_cflag( tp ); + print_c_lflag( tp ); + print_c_cc( tp ); + printf( "\n" ); +} + + +unsigned long get_baud_rate( void ) +{ + unsigned long baud_rate; + + while( TRUE ) { + printf( "Enter the numerical value for the new baud rate.\n" ); + printf( "Choices are: 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800\n" ); + printf( "2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800\n" ); + printf( "\nYour choice: " ); + scanf( "%lu", &baud_rate ); + printf( "\n" ); + switch( baud_rate ) { + case 50: return B50; + case 75: return B75; + case 110: return B110; + case 134: return B134; + case 150: return B150; + case 200: return B200; + case 300: return B300; + case 600: return B600; + case 1200: return B1200; + case 1800: return B1800; + case 2400: return B2400; + case 4800: return B4800; + case 9600: return B9600; + case 19200: return B19200; + case 38400: return B38400; + case 57600: return B57600; + case 115200: return B115200; + case 230400: return B230400; + case 460800: return B460800; + + default: + printf( "%lu is not a valid choice. Try again.\n\n", baud_rate ); + break; + } + } +} + + +unsigned long get_parity() +{ + int parity; + + while( TRUE ) { + printf( "Enter the numerical value for the new parity\n" ); + printf( "Choices are: 0 for no parity, 1 for even parity, 2 for odd parity\n" ); + printf( "\nYour choice: " ); + scanf( "%d", &parity ); + printf( "\n" ); + switch( parity ) { + case 0: + return 0; + + case 1: + return PARENB; + + case 2: + return PARENB | PARODD; + + default: + printf( "%d is not a valid choice. Try again.\n\n", parity ); + break; + } + } +} + + +unsigned long get_stop_bits() +{ + int stop_bits; + + while( TRUE ) { + printf( "Enter the numerical value for the new number of stop bits\n" ); + printf( "Choices are: 1 or 2\n" ); + printf( "\nYour choice: " ); + scanf( "%d", &stop_bits ); + printf( "\n" ); + switch( stop_bits ) { + case 1: + return 0; + + case 2: + return CSTOPB; + + default: + printf( "%d is not a valid choice. Try again.\n\n", stop_bits ); + break; + } + } +} + + +unsigned long get_data_bits() +{ + int data_bits; + + while( TRUE ) { + printf( "Enter the numerical value for the new number of data bits\n" ); + printf( "Choices are: 5, 6, 7 or 8\n" ); + printf( "\nYour choice: " ); + scanf( "%d", &data_bits ); + printf( "\n" ); + switch( data_bits ) { + case 5: + return CS5; + + case 6: + return CS6; + + case 7: + return CS7; + + case 8: + return CS8; + + default: + printf( "%d is not a valid choice. Try again.\n\n", data_bits ); + break; + } + } +} + + +void change_line_settings( struct termios *tp ) +{ + unsigned long baud_rate, parity, stop_bits, data_bits, sleep_time; + + printf( "\nSetting line characteristics\n\n" ); + + baud_rate = get_baud_rate(); + parity = get_parity(); + stop_bits = get_stop_bits(); + data_bits = get_data_bits(); + + printf( "NOTE: You will not see output until you switch your terminal settings!\n" ); + printf( "WARNING: If you do not switch your terminal settings, your terminal may hang.\n" ); + printf( "Enter the number of seconds the test will wait for you to switch your terminal\n" ); + printf( "settings before it continues\n" ); + printf( "Sleep time (in seconds): " ); + scanf( "%lu", &sleep_time ); + printf( "\n" ); + printf( "Setting line to new termios settings in %lu seconds.\n", sleep_time ); + + sleep( sleep_time ); + + tp->c_cflag = CLOCAL | CREAD | parity | stop_bits | data_bits | baud_rate; + if( tcsetattr( fileno( stdin ), TCSADRAIN, tp ) < 0 ) { + perror( "change_line_settings(): tcsetattr() failed" ); + exit( 1 ); + } + printf( "Line settings set.\n" ); +} + + +void canonical_input( struct termios *tp ) +{ + char c, first_time = TRUE; + + printf( "\nTesting canonical input\n\n" ); + + printf( "Setting line to canonical input mode.\n" ); + tp->c_lflag = ISIG | ICANON | ECHO | ECHONL | ECHOK | ECHOE | ECHOPRT | ECHOCTL | IEXTEN; + tp->c_iflag = BRKINT | ICRNL | IXON | IMAXBEL; + if( tcsetattr( fileno( stdin ), TCSADRAIN, tp ) < 0 ) { + perror( "canonical_input(): tcsetattr() failed" ); + exit( 1 ); + } + + while ( ( c = getchar () ) != '\n'); + printf( "Testing getchar(). Type some text followed by carriage return\n" ); + printf( "Each character you entered will be echoed back to you\n\n" ); + while ( ( c = getchar () ) != '\n') { + if( first_time ) { + printf( "\nYou typed:\n"); + first_time = FALSE; + } + printf( "%c", c ); + } + printf( "\n\nCanonical input test done.\n" ); +} /* * Test raw (ICANON=0) input */ -static void -testRawInput (int vmin, int vtime) -{ - int i; - struct termios old, new; - rtems_interval ticksPerSecond, then, now; - unsigned int msec; - unsigned long count; - int nread; - unsigned char cbuf[100]; - - printf ("*** Raw input VMIN=%d VTIME=%d ***\n", vmin, vtime); - rtems_clock_get (RTEMS_CLOCK_GET_TICKS_PER_SECOND, &ticksPerSecond); - i = tcgetattr (fileno (stdin), &old); - if (i < 0) { - printf ("tcgetattr failed: %s\n", strerror (errno)); - return; - } - new = old; - new.c_lflag &= ~(ICANON|ECHO|ECHONL|ECHOK|ECHOE|ECHOPRT|ECHOCTL); - new.c_cc[VMIN] = vmin; - new.c_cc[VTIME] = vtime; - i = tcsetattr (fileno (stdin), TCSANOW, &new); - if (i < 0) { - printf ("tcsetattr failed: %s\n", strerror (errno)); - return; - } - do { - rtems_clock_get (RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &then); - count = 0; - for (;;) { - nread = read (fileno (stdin), cbuf, sizeof cbuf); - if (nread < 0) { - printf ("Read error: %s\n", strerror (errno)); - goto out; - } - count++; - if (nread != 0) - break; - } - rtems_clock_get (RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &now); - msec = (now - then) * 1000 / ticksPerSecond; - printf ("Count:%-10lu Interval:%3u.%3.3d Char:", - count, msec / 1000, msec % 1000); - for (i = 0 ; i < nread ; i++) - printf (" %2.2x", cbuf[i]); - printf ("\n"); - } while (cbuf[0] != 'q'); - out: - i = tcsetattr (fileno (stdin), TCSANOW, &old); - if (i < 0) - printf ("tcsetattr failed: %s\n", strerror (errno)); - printf ("*** End of Raw input VMIN=%d VTIME=%d ***\n", vmin, vtime); +void do_raw_input( int vmin, int vtime ) +{ + int i; + struct termios old, new; + rtems_interval ticksPerSecond, then, now; + unsigned int msec; + unsigned long count; + int nread; + unsigned char cbuf[100]; + + printf( "Raw input test with VMIN=%d VTIME=%d\n", vmin, vtime ); + + rtems_clock_get( RTEMS_CLOCK_GET_TICKS_PER_SECOND, &ticksPerSecond ); + if ( tcgetattr( fileno ( stdin ), &old ) < 0 ) { + perror( "do_raw_input(): tcgetattr() failed" ); + return; + } + + new = old; + new.c_lflag &= ~( ICANON | ECHO | ECHONL | ECHOK | ECHOE | ECHOPRT | ECHOCTL ); + new.c_cc[VMIN] = vmin; + new.c_cc[VTIME] = vtime; + if( tcsetattr( fileno( stdin ), TCSADRAIN, &new ) < 0 ) { + perror ("do_raw_input(): tcsetattr() failed" ); + return; + } + + do { + rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &then ); + count = 0; + for(;;) { + nread = read( fileno( stdin ), cbuf, sizeof cbuf ); + if( nread < 0 ) { + perror( "do_raw_input(): read() failed" ); + goto out; + } + count++; + if( nread != 0 ) + break; + } + rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &now ); + msec = (now - then) * 1000 / ticksPerSecond; + printf( "Count:%-10lu Interval:%3u.%3.3d Char:", + count, msec / 1000, msec % 1000 ); + + for( i = 0 ; i < nread ; i++ ) + printf (" 0x%2.2x", cbuf[i]); + printf ("\n"); + + } while( cbuf[0] != 'q' ); + +out: + if( tcsetattr( fileno( stdin ), TCSADRAIN, &old) < 0 ) + perror("do_raw_input(): tcsetattr() failed: %s\n" ); + + printf ("*** End of Raw input VMIN=%d VTIME=%d ***\n", vmin, vtime); +} + + +void raw_input( struct termios *tp ) +{ + printf( "\nTesting raw input input\n\n" ); + printf( "Hit 'q' to terminate the test\n" ); + + do_raw_input( 0, 0 ); + do_raw_input( 0, 20 ); + do_raw_input( 5, 0 ); + do_raw_input( 5, 20 ); + + printf( "\nRaw input test done.\n" ); +} + + +void usage( void ) +{ + printf( "\nYou have the following choices:\n" ); + printf( " 1 - Reset the struct termios\n" ); + printf( " 2 - Look at the current termios setting\n" ); + printf( " 3 - Change the line characteristics\n" ); + printf( " 4 - Test canonical input\n" ); + printf( " 5 - Test raw input\n" ); + printf( " 9 - Exit\n" ); + printf( "Enter your choice (1 to 5 or 9, followed by a carriage return): " ); } + /* * RTEMS Startup Task */ rtems_task Init (rtems_task_argument ignored) { - int i, j; - - printf( "\n\n*** HELLO WORLD TEST ***\n" ); - printf( "Hello World\n" ); - printf( "*** END OF HELLO WORLD TEST ***\n" ); - - printf( "\n\ntype 'q' to exit raw input tests\n\n" ); - - for (;;) { - /* - * Test blocking, line-oriented input - */ - do { - printf (">>> "); - fflush (stdout); - i = scanf (" %d", &j); - printf ("Return: %d Value: %d\n", i, j); - } while (i != 0); - - /* - * Consume what scanf rejected - */ - while ((i = getchar ()) != '\n') - if (i == EOF) - break; - - /* - * Test character-oriented input - */ - testRawInput (0, 0); - testRawInput (0, 20); - testRawInput (5, 0); - testRawInput (5, 20); - } - exit (1); + char c; + struct termios orig_termios, test_termios; + + printf( "\n\n*** TEST OF TERMIOS INPUT CAPABILITIES ***\n" ); + + if( tcgetattr( fileno( stdin ), &orig_termios ) < 0 ) { + perror( "tcgetattr() failed" ); + exit( 0 ); + } + + test_termios = orig_termios; + + usage(); + for(;;) { + switch( c = getchar() ) { + case '1': + printf( "\nResetting the line to the original termios setting\n\n" ); + test_termios = orig_termios; + if( tcsetattr( fileno( stdin ), TCSADRAIN, &test_termios ) < 0 ) { + perror( "tcsetattr() failed" ); + exit( 1 ); + } + usage(); + break; + + case '2': + print_termios( &test_termios ); + usage(); + break; + + case '3': + change_line_settings( &test_termios ); + usage(); + break; + + case '4': + canonical_input( &test_termios ); + usage(); + break; + + case '5': + raw_input( &test_termios ); + usage(); + break; + + case '9': + exit( 1 ); + + case '\n': + break; + + default: + printf( "\n%c is not a valid choice. Try again\n\n", c ); + usage(); + break; + } + } } + -- cgit v1.2.3