source: rtems/testsuites/samples/ticker/tasks.c @ 9391f6d

4.115
Last change on this file since 9391f6d was 9391f6d, checked in by Sebastian Huber <sebastian.huber@…>, on Mar 10, 2014 at 3:31:43 PM

tests/samples: Use <rtems/test.h>

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/*  Test_task
2 *
3 *  This routine serves as a test task.  It verifies the basic task
4 *  switching capabilities of the executive.
5 *
6 *  Input parameters:  NONE
7 *
8 *  Output parameters:  NONE
9 *
10 *  COPYRIGHT (c) 1989-2009.
11 *  On-Line Applications Research Corporation (OAR).
12 *
13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
15 *  http://www.rtems.com/license/LICENSE.
16 */
17
18#ifdef HAVE_CONFIG_H
19#include "config.h"
20#endif
21
22#include "system.h"
23
24rtems_task Test_task(
25  rtems_task_argument unused
26)
27{
28  rtems_id          tid;
29  rtems_time_of_day time;
30  uint32_t          task_index;
31  rtems_status_code status;
32
33  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
34  directive_failed( status, "task ident" ); 
35
36  task_index = task_number( tid );
37  for ( ; ; ) {
38    status = rtems_clock_get_tod( &time );
39    if ( time.second >= 35 ) {
40      TEST_END();
41      rtems_test_exit( 0 );
42    }
43    put_name( Task_name[ task_index ], FALSE );
44    print_time( " - rtems_clock_get_tod - ", &time, "\n" );
45    status = rtems_task_wake_after(
46      task_index * 5 * rtems_clock_get_ticks_per_second()
47    );
48    directive_failed( status, "wake after" ); 
49  }
50}
Note: See TracBrowser for help on using the repository browser.