1 | /* Init |
---|
2 | * |
---|
3 | * This routine is the initialization task for this test program. |
---|
4 | * It is a user initialization task 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: |
---|
10 | * argument - task argument |
---|
11 | * |
---|
12 | * Output parameters: NONE |
---|
13 | * |
---|
14 | * COPYRIGHT (c) 1989-1999. |
---|
15 | * On-Line Applications Research Corporation (OAR). |
---|
16 | * |
---|
17 | * The license and distribution terms for this file may be |
---|
18 | * found in the file LICENSE in this distribution or at |
---|
19 | * http://www.OARcorp.com/rtems/license.html. |
---|
20 | * |
---|
21 | * $Id$ |
---|
22 | */ |
---|
23 | |
---|
24 | #define TEST_INIT |
---|
25 | #include "system.h" |
---|
26 | |
---|
27 | rtems_task Init( |
---|
28 | rtems_task_argument argument |
---|
29 | ) |
---|
30 | { |
---|
31 | rtems_status_code status; |
---|
32 | |
---|
33 | puts( "\n\n*** TEST 2 ***" ); |
---|
34 | |
---|
35 | Preempt_task_name = rtems_build_name( 'P', 'R', 'M', 'T' ); |
---|
36 | |
---|
37 | status = rtems_task_create( |
---|
38 | Preempt_task_name, |
---|
39 | 1, |
---|
40 | RTEMS_MINIMUM_STACK_SIZE, |
---|
41 | RTEMS_DEFAULT_MODES, |
---|
42 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
43 | &Preempt_task_id |
---|
44 | ); |
---|
45 | directive_failed( status, "rtems_task_create of RTEMS_PREEMPT" ); |
---|
46 | |
---|
47 | status = rtems_task_start( Preempt_task_id, Preempt_task, 0 ); |
---|
48 | directive_failed( status, "rtems_task_start of RTEMS_PREEMPT" ); |
---|
49 | |
---|
50 | puts( "INIT - rtems_task_wake_after - yielding processor" ); |
---|
51 | status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); |
---|
52 | directive_failed( status, "rtems_task_wake_after" ); |
---|
53 | |
---|
54 | Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); |
---|
55 | Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); |
---|
56 | Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); |
---|
57 | |
---|
58 | status = rtems_task_create( |
---|
59 | Task_name[ 1 ], |
---|
60 | 3, |
---|
61 | RTEMS_MINIMUM_STACK_SIZE, |
---|
62 | RTEMS_DEFAULT_MODES, |
---|
63 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
64 | &Task_id[ 1 ] |
---|
65 | ); |
---|
66 | directive_failed( status, "rtems_task_create of TA1" ); |
---|
67 | |
---|
68 | status = rtems_task_create( |
---|
69 | Task_name[ 2 ], |
---|
70 | 3, |
---|
71 | RTEMS_MINIMUM_STACK_SIZE, |
---|
72 | RTEMS_DEFAULT_MODES, |
---|
73 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
74 | &Task_id[ 2 ] |
---|
75 | ); |
---|
76 | directive_failed( status, "rtems_task_create of TA2" ); |
---|
77 | |
---|
78 | status = rtems_task_create( |
---|
79 | Task_name[ 3 ], |
---|
80 | 3, |
---|
81 | RTEMS_MINIMUM_STACK_SIZE, |
---|
82 | RTEMS_DEFAULT_MODES, |
---|
83 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
84 | &Task_id[ 3 ] |
---|
85 | ); |
---|
86 | directive_failed( status, "rtems_task_create of TA3" ); |
---|
87 | |
---|
88 | status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); |
---|
89 | directive_failed( status, "rtems_task_start of TA1" ); |
---|
90 | |
---|
91 | status = rtems_task_start( Task_id[ 2 ], Task_2, 0 ); |
---|
92 | directive_failed( status, "rtems_task_start of TA2" ); |
---|
93 | |
---|
94 | status = rtems_task_start( Task_id[ 3 ], Task_3, 0 ); |
---|
95 | directive_failed( status, "rtems_task_start of TA3" ); |
---|
96 | |
---|
97 | puts( "INIT - suspending TA2 while middle task on a ready chain" ); |
---|
98 | status = rtems_task_suspend( Task_id[ 2 ] ); |
---|
99 | directive_failed( status, "rtems_task_suspend of TA2" ); |
---|
100 | |
---|
101 | status = rtems_task_delete( Task_id[ 1 ] ); |
---|
102 | directive_failed( status, "rtems_task_delete of TA1" ); |
---|
103 | |
---|
104 | status = rtems_task_delete( Task_id[ 2 ] ); |
---|
105 | directive_failed( status, "rtems_task_delete of TA2" ); |
---|
106 | |
---|
107 | status = rtems_task_delete( Task_id[ 3 ] ); |
---|
108 | directive_failed( status, "rtems_task_delete of TA3" ); |
---|
109 | |
---|
110 | status = rtems_task_create( |
---|
111 | Task_name[ 1 ], |
---|
112 | 1, |
---|
113 | RTEMS_MINIMUM_STACK_SIZE, |
---|
114 | RTEMS_DEFAULT_MODES, |
---|
115 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
116 | &Task_id[ 1 ] |
---|
117 | ); |
---|
118 | directive_failed( status, "rtems_task_create of TA1" ); |
---|
119 | |
---|
120 | status = rtems_task_create( |
---|
121 | Task_name[ 2 ], |
---|
122 | 3, |
---|
123 | RTEMS_MINIMUM_STACK_SIZE, |
---|
124 | RTEMS_DEFAULT_MODES, |
---|
125 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
126 | &Task_id[ 2 ] |
---|
127 | ); |
---|
128 | directive_failed( status, "rtems_task_create of TA2" ); |
---|
129 | |
---|
130 | status = rtems_task_create( |
---|
131 | Task_name[ 3 ], |
---|
132 | 3, |
---|
133 | RTEMS_MINIMUM_STACK_SIZE, |
---|
134 | RTEMS_DEFAULT_MODES, |
---|
135 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
136 | &Task_id[ 3 ] |
---|
137 | ); |
---|
138 | directive_failed( status, "rtems_task_create of TA3" ); |
---|
139 | |
---|
140 | status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); |
---|
141 | directive_failed( status, "rtems_task_start of TA1" ); |
---|
142 | |
---|
143 | status = rtems_task_start( Task_id[ 2 ], Task_2, 0 ); |
---|
144 | directive_failed( status, "rtems_task_start of TA2" ); |
---|
145 | |
---|
146 | status = rtems_task_start( Task_id[ 3 ], Task_3, 0 ); |
---|
147 | directive_failed( status, "rtems_task_start of TA3" ); |
---|
148 | |
---|
149 | status = rtems_task_delete( RTEMS_SELF ); |
---|
150 | directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); |
---|
151 | } |
---|