forked from Imagelibrary/rtems
2011-09-16 Sebastian Huber <Sebastian.Huber@embedded-brains.de>
* monitor/monitor.scn, termios/termios.scn: New files. * monitor/init.c, termios01/init.c: Use rtems_shell_wait_for_input().
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
2011-09-16 Sebastian Huber <Sebastian.Huber@embedded-brains.de>
|
||||
|
||||
* monitor/monitor.scn, termios/termios.scn: New files.
|
||||
* monitor/init.c, termios01/init.c: Use rtems_shell_wait_for_input().
|
||||
|
||||
2011-09-02 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
||||
|
||||
* stackchk/init.c, stackchk/system.h, stackchk/stackchk.scn: Print end
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "system.h"
|
||||
|
||||
#include <rtems/monitor.h>
|
||||
#include <rtems/shell.h>
|
||||
|
||||
rtems_task_priority Priorities[6] = { 0, 1, 1, 3, 4, 5 };
|
||||
|
||||
@@ -36,7 +37,13 @@ rtems_task Task_1_through_5(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void notification(int fd, int seconds_remaining, void *arg)
|
||||
{
|
||||
printf(
|
||||
"Press any key to enter monitor (%is remaining)\n",
|
||||
seconds_remaining
|
||||
);
|
||||
}
|
||||
|
||||
rtems_task Init(
|
||||
rtems_task_argument argument
|
||||
@@ -45,7 +52,7 @@ rtems_task Init(
|
||||
uint32_t index;
|
||||
rtems_status_code status;
|
||||
|
||||
puts( "\n\n*** MONITOR TASK TEST ***" );
|
||||
puts( "\n\n*** TEST MONITOR ***" );
|
||||
|
||||
Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
|
||||
Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
|
||||
@@ -70,8 +77,20 @@ rtems_task Init(
|
||||
directive_failed( status, "rtems_task_start loop" );
|
||||
}
|
||||
|
||||
rtems_monitor_init( 0 );
|
||||
status = rtems_shell_wait_for_input(
|
||||
STDIN_FILENO,
|
||||
20,
|
||||
notification,
|
||||
NULL
|
||||
);
|
||||
if (status == RTEMS_SUCCESSFUL) {
|
||||
rtems_monitor_init( 0 );
|
||||
|
||||
status = rtems_task_delete( RTEMS_SELF );
|
||||
directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
|
||||
status = rtems_task_delete( RTEMS_SELF );
|
||||
directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
|
||||
} else {
|
||||
puts( "*** END OF TEST MONITOR ***" );
|
||||
|
||||
rtems_test_exit( 0 );
|
||||
}
|
||||
}
|
||||
|
||||
22
testsuites/libtests/monitor/monitor.scn
Normal file
22
testsuites/libtests/monitor/monitor.scn
Normal file
@@ -0,0 +1,22 @@
|
||||
*** TEST MONITOR ***
|
||||
Press any key to enter monitor (20s remaining)
|
||||
Press any key to enter monitor (19s remaining)
|
||||
Press any key to enter monitor (18s remaining)
|
||||
Press any key to enter monitor (17s remaining)
|
||||
Press any key to enter monitor (16s remaining)
|
||||
Press any key to enter monitor (15s remaining)
|
||||
Press any key to enter monitor (14s remaining)
|
||||
Press any key to enter monitor (13s remaining)
|
||||
Press any key to enter monitor (12s remaining)
|
||||
Press any key to enter monitor (11s remaining)
|
||||
Press any key to enter monitor (10s remaining)
|
||||
Press any key to enter monitor (9s remaining)
|
||||
Press any key to enter monitor (8s remaining)
|
||||
Press any key to enter monitor (7s remaining)
|
||||
Press any key to enter monitor (6s remaining)
|
||||
Press any key to enter monitor (5s remaining)
|
||||
Press any key to enter monitor (4s remaining)
|
||||
Press any key to enter monitor (3s remaining)
|
||||
Press any key to enter monitor (2s remaining)
|
||||
Press any key to enter monitor (1s remaining)
|
||||
*** END OF TEST MONITOR ***
|
||||
@@ -43,6 +43,7 @@
|
||||
rtems_task Init (rtems_task_argument argument);
|
||||
|
||||
#include <rtems/confdefs.h>
|
||||
#include <rtems/shell.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
@@ -711,6 +712,13 @@ void usage( void )
|
||||
printf( "Enter your choice (1 to 5 or 9, followed by a carriage return): " );
|
||||
}
|
||||
|
||||
static void notification( int fd, int seconds_remaining, void *arg )
|
||||
{
|
||||
printf(
|
||||
"Press any key to check the termios input capabilities (%is remaining)\n",
|
||||
seconds_remaining
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
* RTEMS Startup Task
|
||||
@@ -718,61 +726,74 @@ void usage( void )
|
||||
rtems_task
|
||||
Init (rtems_task_argument ignored)
|
||||
{
|
||||
rtems_status_code status;
|
||||
char c ;
|
||||
struct termios orig_termios, test_termios;
|
||||
|
||||
printf( "\n\n*** TEST OF TERMIOS INPUT CAPABILITIES ***\n" );
|
||||
puts( "\n\n*** TEST TERMIOS INPUT CAPABILITIES ***" );
|
||||
|
||||
status = rtems_shell_wait_for_input(
|
||||
STDIN_FILENO,
|
||||
20,
|
||||
notification,
|
||||
NULL
|
||||
);
|
||||
if (status == RTEMS_SUCCESSFUL) {
|
||||
if( tcgetattr( fileno( stdin ), &orig_termios ) < 0 ) {
|
||||
perror( "tcgetattr() failed" );
|
||||
rtems_test_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" );
|
||||
rtems_test_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':
|
||||
rtems_test_exit( 1 );
|
||||
|
||||
case '\n':
|
||||
break;
|
||||
|
||||
default:
|
||||
printf( "\n%c is not a valid choice. Try again\n\n", c );
|
||||
usage();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
puts( "*** END OF TEST TERMIOS INPUT CAPABILITIES ***" );
|
||||
|
||||
if( tcgetattr( fileno( stdin ), &orig_termios ) < 0 ) {
|
||||
perror( "tcgetattr() failed" );
|
||||
rtems_test_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" );
|
||||
rtems_test_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':
|
||||
rtems_test_exit( 1 );
|
||||
|
||||
case '\n':
|
||||
break;
|
||||
|
||||
default:
|
||||
printf( "\n%c is not a valid choice. Try again\n\n", c );
|
||||
usage();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
22
testsuites/libtests/termios/termios.scn
Normal file
22
testsuites/libtests/termios/termios.scn
Normal file
@@ -0,0 +1,22 @@
|
||||
*** TEST TERMIOS INPUT CAPABILITIES ***
|
||||
Press any key to check the termios input capabilities (20s remaining)
|
||||
Press any key to check the termios input capabilities (19s remaining)
|
||||
Press any key to check the termios input capabilities (18s remaining)
|
||||
Press any key to check the termios input capabilities (17s remaining)
|
||||
Press any key to check the termios input capabilities (16s remaining)
|
||||
Press any key to check the termios input capabilities (15s remaining)
|
||||
Press any key to check the termios input capabilities (14s remaining)
|
||||
Press any key to check the termios input capabilities (13s remaining)
|
||||
Press any key to check the termios input capabilities (12s remaining)
|
||||
Press any key to check the termios input capabilities (11s remaining)
|
||||
Press any key to check the termios input capabilities (10s remaining)
|
||||
Press any key to check the termios input capabilities (9s remaining)
|
||||
Press any key to check the termios input capabilities (8s remaining)
|
||||
Press any key to check the termios input capabilities (7s remaining)
|
||||
Press any key to check the termios input capabilities (6s remaining)
|
||||
Press any key to check the termios input capabilities (5s remaining)
|
||||
Press any key to check the termios input capabilities (4s remaining)
|
||||
Press any key to check the termios input capabilities (3s remaining)
|
||||
Press any key to check the termios input capabilities (2s remaining)
|
||||
Press any key to check the termios input capabilities (1s remaining)
|
||||
*** END OF TEST TERMIOS INPUT CAPABILITIES ***
|
||||
Reference in New Issue
Block a user