1 | /* Init |
---|
2 | * |
---|
3 | * This routine is the initialization task for this test program. |
---|
4 | * It is called from init_exec and has the responsibility for creating |
---|
5 | * and starting the tasks that make up the test. If the time of day |
---|
6 | * clock is required for the test, it should also be set to a known |
---|
7 | * value by this function. |
---|
8 | * |
---|
9 | * Input parameters: NONE |
---|
10 | * |
---|
11 | * Output parameters: NONE |
---|
12 | * |
---|
13 | * COPYRIGHT (c) 1989-2011. |
---|
14 | * On-Line Applications Research Corporation (OAR). |
---|
15 | * |
---|
16 | * The license and distribution terms for this file may be |
---|
17 | * found in the file LICENSE in this distribution or at |
---|
18 | * http://www.rtems.com/license/LICENSE. |
---|
19 | * |
---|
20 | * $Id$ |
---|
21 | */ |
---|
22 | |
---|
23 | #ifdef HAVE_CONFIG_H |
---|
24 | #include "config.h" |
---|
25 | #endif |
---|
26 | |
---|
27 | #define CONFIGURE_INIT |
---|
28 | #include "system.h" |
---|
29 | |
---|
30 | /* |
---|
31 | * Keep the names and IDs in global variables so another task can use them. |
---|
32 | */ |
---|
33 | |
---|
34 | rtems_id Task_id[ 4 ]; /* array of task ids */ |
---|
35 | rtems_name Task_name[ 4 ]; /* array of task names */ |
---|
36 | |
---|
37 | rtems_task Init( |
---|
38 | rtems_task_argument argument |
---|
39 | ) |
---|
40 | { |
---|
41 | rtems_status_code status; |
---|
42 | rtems_time_of_day time; |
---|
43 | |
---|
44 | puts( "\n\n*** CLOCK TICK TEST ***" ); |
---|
45 | |
---|
46 | time.year = 1988; |
---|
47 | time.month = 12; |
---|
48 | time.day = 31; |
---|
49 | time.hour = 9; |
---|
50 | time.minute = 0; |
---|
51 | time.second = 0; |
---|
52 | time.ticks = 0; |
---|
53 | |
---|
54 | status = rtems_clock_set( &time ); |
---|
55 | directive_failed( status, "clock get" ); |
---|
56 | |
---|
57 | Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); |
---|
58 | Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); |
---|
59 | Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); |
---|
60 | |
---|
61 | status = rtems_task_create( |
---|
62 | Task_name[ 1 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES, |
---|
63 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 1 ] |
---|
64 | ); |
---|
65 | directive_failed( status, "create 1" ); |
---|
66 | |
---|
67 | status = rtems_task_create( |
---|
68 | Task_name[ 2 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES, |
---|
69 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 2 ] |
---|
70 | ); |
---|
71 | directive_failed( status, "create 2" ); |
---|
72 | |
---|
73 | status = rtems_task_create( |
---|
74 | Task_name[ 3 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES, |
---|
75 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 3 ] |
---|
76 | ); |
---|
77 | directive_failed( status, "create 3" ); |
---|
78 | |
---|
79 | status = rtems_task_start( Task_id[ 1 ], Test_task, 1 ); |
---|
80 | directive_failed( status, "start 1" ); |
---|
81 | |
---|
82 | status = rtems_task_start( Task_id[ 2 ], Test_task, 2 ); |
---|
83 | directive_failed( status, "start 2" ); |
---|
84 | |
---|
85 | status = rtems_task_start( Task_id[ 3 ], Test_task, 3 ); |
---|
86 | directive_failed( status, "start 3" ); |
---|
87 | |
---|
88 | status = rtems_task_delete( RTEMS_SELF ); |
---|
89 | directive_failed( status, "delete" ); |
---|
90 | } |
---|