Changeset 7c9d27e in rtems for testsuites/samples/fileio/init.c


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/fileio/init.c

    r6c5ee7f0 r7c9d27e  
    4444#include <rtems/nvdisk.h>
    4545#include <rtems/nvdisk-sram.h>
     46#include <rtems/shell.h>
    4647
    4748#if FILEIO_BUILD
     
    227228
    228229#ifdef USE_SHELL
    229 #include <rtems/shell.h>
    230230
    231231int
     
    12141214}
    12151215
     1216static void
     1217notification (int fd, int seconds_remaining, void *arg)
     1218{
     1219  printf(
     1220    "Press any key to start file I/O sample (%is remaining)\n",
     1221    seconds_remaining
     1222  );
     1223}
     1224
    12161225/*
    12171226 * RTEMS Startup Task
     
    12241233  rtems_status_code status;
    12251234
    1226   puts( "\n\n*** FILE I/O SAMPLE AND TEST ***" );
    1227 
    1228   Task_name = rtems_build_name('F','M','N','U');
    1229 
    1230   status = rtems_task_create(
    1231     Task_name, 1, RTEMS_MINIMUM_STACK_SIZE * 2,
    1232     RTEMS_DEFAULT_MODES ,
    1233     RTEMS_FLOATING_POINT | RTEMS_DEFAULT_ATTRIBUTES, &Task_id
     1235  puts( "\n\n*** TEST FILE I/O SAMPLE ***" );
     1236
     1237  status = rtems_shell_wait_for_input(
     1238    STDIN_FILENO,
     1239    20,
     1240    notification,
     1241    NULL
    12341242  );
    1235   directive_failed( status, "create" );
    1236 
    1237   status = rtems_task_start( Task_id, fileio_task, 1 );
    1238   directive_failed( status, "start" );
    1239 
    1240   status = rtems_task_delete( RTEMS_SELF );
    1241   directive_failed( status, "delete" );
     1243  if (status == RTEMS_SUCCESSFUL) {
     1244    Task_name = rtems_build_name('F','M','N','U');
     1245
     1246    status = rtems_task_create(
     1247      Task_name, 1, RTEMS_MINIMUM_STACK_SIZE * 2,
     1248      RTEMS_DEFAULT_MODES ,
     1249      RTEMS_FLOATING_POINT | RTEMS_DEFAULT_ATTRIBUTES, &Task_id
     1250    );
     1251    directive_failed( status, "create" );
     1252
     1253    status = rtems_task_start( Task_id, fileio_task, 1 );
     1254    directive_failed( status, "start" );
     1255
     1256    status = rtems_task_delete( RTEMS_SELF );
     1257    directive_failed( status, "delete" );
     1258  } else {
     1259    puts( "*** END OF TEST FILE I/O SAMPLE ***" );
     1260
     1261    rtems_test_exit( 0 );
     1262  }
    12421263}
    12431264
Note: See TracChangeset for help on using the changeset viewer.