* fileio/fileio.scn: New file.
	* capture/init.c, fileio/init.c: Use rtems_shell_wait_for_input().
This commit is contained in:
Sebastian Huber
2011-09-16 09:23:19 +00:00
parent 6c5ee7f009
commit 7c9d27e831
4 changed files with 98 additions and 28 deletions

View File

@@ -1,3 +1,8 @@
2011-09-16 Sebastian Huber <Sebastian.Huber@embedded-brains.de>
* fileio/fileio.scn: New file.
* capture/init.c, fileio/init.c: Use rtems_shell_wait_for_input().
2011-08-29 Joel Sherrill <joel.sherrilL@OARcorp.com> 2011-08-29 Joel Sherrill <joel.sherrilL@OARcorp.com>
* ticker/system.h: Remove unneeded include. * ticker/system.h: Remove unneeded include.

View File

@@ -33,9 +33,18 @@
#include <rtems.h> #include <rtems.h>
#include <rtems/capture-cli.h> #include <rtems/capture-cli.h>
#include <rtems/monitor.h> #include <rtems/monitor.h>
#include <rtems/shell.h>
volatile int can_proceed = 1; volatile int can_proceed = 1;
static void notification(int fd, int seconds_remaining, void *arg)
{
printf(
"Press any key to start capture engine (%is remaining)\n",
seconds_remaining
);
}
rtems_task Init( rtems_task Init(
rtems_task_argument ignored rtems_task_argument ignored
) )
@@ -43,27 +52,40 @@ rtems_task Init(
#if BSP_SMALL_MEMORY #if BSP_SMALL_MEMORY
printf("NO Capture Engine. MEMORY TOO SMALL"); printf("NO Capture Engine. MEMORY TOO SMALL");
#else #else
rtems_status_code status;
rtems_task_priority old_priority; rtems_task_priority old_priority;
rtems_mode old_mode; rtems_mode old_mode;
/* lower the task priority to allow created tasks to execute */ puts( "\n\n*** TEST CAPTURE ENGINE ***" );
rtems_task_set_priority(RTEMS_SELF, 20, &old_priority); status = rtems_shell_wait_for_input(
rtems_task_mode(RTEMS_PREEMPT, RTEMS_PREEMPT_MASK, &old_mode); STDIN_FILENO,
20,
notification,
NULL
);
if (status == RTEMS_SUCCESSFUL) {
/* lower the task priority to allow created tasks to execute */
printf( "\n*** CAPTURE ENGINE TEST ***\n" ); rtems_task_set_priority(RTEMS_SELF, 20, &old_priority);
rtems_task_mode(RTEMS_PREEMPT, RTEMS_PREEMPT_MASK, &old_mode);
while (!can_proceed) while (!can_proceed)
{ {
printf ("Sleeping\n"); printf ("Sleeping\n");
usleep (1000000); usleep (1000000);
}
rtems_monitor_init (0);
rtems_capture_cli_init (0);
setup_tasks_to_watch ();
rtems_task_delete (RTEMS_SELF);
} else {
puts( "*** END OF TEST CAPTURE ENGINE ***" );
exit( 0 );
} }
rtems_monitor_init (0);
rtems_capture_cli_init (0);
setup_tasks_to_watch ();
rtems_task_delete (RTEMS_SELF);
#endif #endif
} }

View File

@@ -0,0 +1,22 @@
*** TEST FILE I/O SAMPLE ***
Press any key to start file I/O sample (20s remaining)
Press any key to start file I/O sample (19s remaining)
Press any key to start file I/O sample (18s remaining)
Press any key to start file I/O sample (17s remaining)
Press any key to start file I/O sample (16s remaining)
Press any key to start file I/O sample (15s remaining)
Press any key to start file I/O sample (14s remaining)
Press any key to start file I/O sample (13s remaining)
Press any key to start file I/O sample (12s remaining)
Press any key to start file I/O sample (11s remaining)
Press any key to start file I/O sample (10s remaining)
Press any key to start file I/O sample (9s remaining)
Press any key to start file I/O sample (8s remaining)
Press any key to start file I/O sample (7s remaining)
Press any key to start file I/O sample (6s remaining)
Press any key to start file I/O sample (5s remaining)
Press any key to start file I/O sample (4s remaining)
Press any key to start file I/O sample (3s remaining)
Press any key to start file I/O sample (2s remaining)
Press any key to start file I/O sample (1s remaining)
*** END OF TEST FILE I/O SAMPLE ***

View File

@@ -43,6 +43,7 @@
#include <rtems/ramdisk.h> #include <rtems/ramdisk.h>
#include <rtems/nvdisk.h> #include <rtems/nvdisk.h>
#include <rtems/nvdisk-sram.h> #include <rtems/nvdisk-sram.h>
#include <rtems/shell.h>
#if FILEIO_BUILD #if FILEIO_BUILD
@@ -226,7 +227,6 @@ fstab_t fs_table[] = {
#define USE_SHELL #define USE_SHELL
#ifdef USE_SHELL #ifdef USE_SHELL
#include <rtems/shell.h>
int int
shell_nvdisk_trace (int argc, char* argv[]) shell_nvdisk_trace (int argc, char* argv[])
@@ -1213,6 +1213,15 @@ fileio_task (rtems_task_argument ignored)
fileio_menu(); fileio_menu();
} }
static void
notification (int fd, int seconds_remaining, void *arg)
{
printf(
"Press any key to start file I/O sample (%is remaining)\n",
seconds_remaining
);
}
/* /*
* RTEMS Startup Task * RTEMS Startup Task
*/ */
@@ -1223,22 +1232,34 @@ Init (rtems_task_argument ignored)
rtems_id Task_id; rtems_id Task_id;
rtems_status_code status; rtems_status_code status;
puts( "\n\n*** FILE I/O SAMPLE AND TEST ***" ); puts( "\n\n*** TEST FILE I/O SAMPLE ***" );
Task_name = rtems_build_name('F','M','N','U'); status = rtems_shell_wait_for_input(
STDIN_FILENO,
status = rtems_task_create( 20,
Task_name, 1, RTEMS_MINIMUM_STACK_SIZE * 2, notification,
RTEMS_DEFAULT_MODES , NULL
RTEMS_FLOATING_POINT | RTEMS_DEFAULT_ATTRIBUTES, &Task_id
); );
directive_failed( status, "create" ); if (status == RTEMS_SUCCESSFUL) {
Task_name = rtems_build_name('F','M','N','U');
status = rtems_task_start( Task_id, fileio_task, 1 ); status = rtems_task_create(
directive_failed( status, "start" ); Task_name, 1, RTEMS_MINIMUM_STACK_SIZE * 2,
RTEMS_DEFAULT_MODES ,
RTEMS_FLOATING_POINT | RTEMS_DEFAULT_ATTRIBUTES, &Task_id
);
directive_failed( status, "create" );
status = rtems_task_delete( RTEMS_SELF ); status = rtems_task_start( Task_id, fileio_task, 1 );
directive_failed( status, "delete" ); directive_failed( status, "start" );
status = rtems_task_delete( RTEMS_SELF );
directive_failed( status, "delete" );
} else {
puts( "*** END OF TEST FILE I/O SAMPLE ***" );
rtems_test_exit( 0 );
}
} }
#if defined(USE_SHELL) #if defined(USE_SHELL)