1 | /* Task_1_through_3 |
---|
2 | * |
---|
3 | * This task is a cyclic version of test1 to asssure that the times |
---|
4 | * displayed are not skewed as in test1. "TA1" is printed once every |
---|
5 | * 5 seconds, "TA2" is printed once every 10 seconds, and "TA3" is |
---|
6 | * printed once every 15 seconds. The times displayed should be |
---|
7 | * in multiples of 5, 10, and 15 for TA1, TA2, and TA3 respectively. |
---|
8 | * If the times are skewed from these values, then the calendar time |
---|
9 | * does not correspond correctly with the number of ticks. |
---|
10 | * |
---|
11 | * COPYRIGHT (c) 1989-2009. |
---|
12 | * On-Line Applications Research Corporation (OAR). |
---|
13 | * |
---|
14 | * The license and distribution terms for this file may be |
---|
15 | * found in the file LICENSE in this distribution or at |
---|
16 | * http://www.rtems.org/license/LICENSE. |
---|
17 | */ |
---|
18 | |
---|
19 | #ifdef HAVE_CONFIG_H |
---|
20 | #include "config.h" |
---|
21 | #endif |
---|
22 | |
---|
23 | #include "system.h" |
---|
24 | |
---|
25 | rtems_task Task_1_through_3( |
---|
26 | rtems_task_argument argument |
---|
27 | ) |
---|
28 | { |
---|
29 | rtems_id tid; |
---|
30 | rtems_time_of_day time; |
---|
31 | rtems_status_code status; |
---|
32 | |
---|
33 | status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid ); |
---|
34 | directive_failed( status, "rtems_task_ident of self" ); |
---|
35 | |
---|
36 | while ( FOREVER ) { |
---|
37 | status = rtems_timer_server_fire_after( |
---|
38 | Timer_id[ argument ], |
---|
39 | (task_number( tid ) - 1) * 5 * rtems_clock_get_ticks_per_second(), |
---|
40 | Resume_task, |
---|
41 | (void *) &tid |
---|
42 | ); |
---|
43 | directive_failed( status, "rtems_timer_server_fire_after failed" ); |
---|
44 | |
---|
45 | status = rtems_clock_get_tod( &time ); |
---|
46 | directive_failed( status, "rtems_clock_get_tod failed" ); |
---|
47 | |
---|
48 | if ( time.second >= 35 ) { |
---|
49 | TEST_END(); |
---|
50 | rtems_test_exit( 0 ); |
---|
51 | } |
---|
52 | |
---|
53 | put_name( Task_name[ task_number( tid ) - 1 ], FALSE ); |
---|
54 | print_time( " - rtems_clock_get_tod - ", &time, "\n" ); |
---|
55 | |
---|
56 | status = rtems_task_suspend( RTEMS_SELF ); |
---|
57 | directive_failed( status, "rtems_task_suspend" ); |
---|
58 | } |
---|
59 | } |
---|