Ignore:
Timestamp:
09/16/11 09:23:19 (12 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, 5, master
Children:
11b9b5d
Parents:
6c5ee7f0
Message:

2011-09-16 Sebastian Huber <Sebastian.Huber@…>

  • fileio/fileio.scn: New file.
  • capture/init.c, fileio/init.c: Use rtems_shell_wait_for_input().
File:
1 edited

Legend:

Unmodified
Added
Removed
  • testsuites/samples/capture/init.c

    r6c5ee7f0 r7c9d27e  
    3434#include <rtems/capture-cli.h>
    3535#include <rtems/monitor.h>
     36#include <rtems/shell.h>
    3637
    3738volatile int can_proceed = 1;
     39
     40static void notification(int fd, int seconds_remaining, void *arg)
     41{
     42  printf(
     43    "Press any key to start capture engine (%is remaining)\n",
     44    seconds_remaining
     45  );
     46}
    3847
    3948rtems_task Init(
     
    4453  printf("NO Capture Engine. MEMORY TOO SMALL");
    4554#else
     55  rtems_status_code   status;
    4656  rtems_task_priority old_priority;
    4757  rtems_mode          old_mode;
    4858
    49   /* lower the task priority to allow created tasks to execute */
     59  puts( "\n\n*** TEST CAPTURE ENGINE ***" );
    5060
    51   rtems_task_set_priority(RTEMS_SELF, 20, &old_priority);
    52   rtems_task_mode(RTEMS_PREEMPT,  RTEMS_PREEMPT_MASK, &old_mode);
     61  status = rtems_shell_wait_for_input(
     62    STDIN_FILENO,
     63    20,
     64    notification,
     65    NULL
     66  );
     67  if (status == RTEMS_SUCCESSFUL) {
     68    /* lower the task priority to allow created tasks to execute */
    5369
    54   printf( "\n*** CAPTURE ENGINE TEST ***\n" );
     70    rtems_task_set_priority(RTEMS_SELF, 20, &old_priority);
     71    rtems_task_mode(RTEMS_PREEMPT,  RTEMS_PREEMPT_MASK, &old_mode);
    5572
    56   while (!can_proceed)
    57   {
    58     printf ("Sleeping\n");
    59     usleep (1000000);
     73    while (!can_proceed)
     74    {
     75      printf ("Sleeping\n");
     76      usleep (1000000);
     77    }
     78
     79    rtems_monitor_init (0);
     80    rtems_capture_cli_init (0);
     81
     82    setup_tasks_to_watch ();
     83
     84    rtems_task_delete (RTEMS_SELF);
     85  } else {
     86    puts( "*** END OF TEST CAPTURE ENGINE ***" );
     87
     88    exit( 0 );
    6089  }
    61 
    62   rtems_monitor_init (0);
    63   rtems_capture_cli_init (0);
    64 
    65   setup_tasks_to_watch ();
    66 
    67   rtems_task_delete (RTEMS_SELF);
    6890#endif
    6991}
Note: See TracChangeset for help on using the changeset viewer.