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-1997. |
---|
15 | * On-Line Applications Research Corporation (OAR). |
---|
16 | * Copyright assigned to U.S. Government, 1994. |
---|
17 | * |
---|
18 | * The license and distribution terms for this file may in |
---|
19 | * the file LICENSE in this distribution or at |
---|
20 | * http://www.OARcorp.com/rtems/license.html. |
---|
21 | * |
---|
22 | * $Id$ |
---|
23 | */ |
---|
24 | |
---|
25 | #define TEST_INIT |
---|
26 | #include "system.h" |
---|
27 | |
---|
28 | rtems_unsigned8 my_partition[0x30000] CPU_STRUCTURE_ALIGNMENT; |
---|
29 | |
---|
30 | rtems_timer_service_routine Stop_Test_TSR( |
---|
31 | rtems_id ignored_id, |
---|
32 | void *ignored_address |
---|
33 | ) |
---|
34 | { |
---|
35 | Stop_Test = TRUE; |
---|
36 | } |
---|
37 | |
---|
38 | rtems_task Init( |
---|
39 | rtems_task_argument argument |
---|
40 | ) |
---|
41 | { |
---|
42 | rtems_status_code status; |
---|
43 | rtems_task_priority previous_priority; |
---|
44 | |
---|
45 | printf( |
---|
46 | "\n\n*** TEST 14 -- NODE %d ***\n", |
---|
47 | Multiprocessing_configuration.node |
---|
48 | ); |
---|
49 | |
---|
50 | Stop_Test = FALSE; |
---|
51 | |
---|
52 | status = rtems_timer_create( |
---|
53 | rtems_build_name('S', 'T', 'O', 'P'), |
---|
54 | &timer_id |
---|
55 | ); |
---|
56 | directive_failed( status, "rtems_timer_create" ); |
---|
57 | |
---|
58 | status = rtems_timer_fire_after( |
---|
59 | timer_id, |
---|
60 | MAX_LONG_TEST_DURATION * TICKS_PER_SECOND, |
---|
61 | Stop_Test_TSR, |
---|
62 | NULL |
---|
63 | ); |
---|
64 | directive_failed( status, "rtems_timer_fire_after" ); |
---|
65 | |
---|
66 | Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' ); |
---|
67 | Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' ); |
---|
68 | |
---|
69 | Queue_task_name[ 1 ] = rtems_build_name( 'M', 'T', '1', ' ' ); |
---|
70 | Queue_task_name[ 2 ] = rtems_build_name( 'M', 'T', '2', ' ' ); |
---|
71 | |
---|
72 | Partition_task_name[ 1 ] = rtems_build_name( 'P', 'T', '1', ' ' ); |
---|
73 | Partition_task_name[ 2 ] = rtems_build_name( 'P', 'T', '2', ' ' ); |
---|
74 | |
---|
75 | Semaphore_task_name[ 1 ] = rtems_build_name( 'S', 'M', '1', ' ' ); |
---|
76 | Semaphore_task_name[ 2 ] = rtems_build_name( 'S', 'M', '2', ' ' ); |
---|
77 | |
---|
78 | Semaphore_name[ 1 ] = rtems_build_name( 'S', 'E', 'M', ' ' ); |
---|
79 | |
---|
80 | Queue_name[ 1 ] = rtems_build_name( 'M', 'S', 'G', ' ' ); |
---|
81 | |
---|
82 | Partition_name[ 1 ] = rtems_build_name( 'P', 'A', 'R', ' ' ); |
---|
83 | |
---|
84 | Timer_name[ 1 ] = rtems_build_name( 'T', 'M', 'R', ' ' ); |
---|
85 | |
---|
86 | if ( Multiprocessing_configuration.node == 1 ) { |
---|
87 | puts( "Creating Semaphore (Global)" ); |
---|
88 | status = rtems_semaphore_create( |
---|
89 | Semaphore_name[ 1 ], |
---|
90 | 1, |
---|
91 | RTEMS_GLOBAL, |
---|
92 | RTEMS_NO_PRIORITY, |
---|
93 | &Semaphore_id[ 1 ] |
---|
94 | ); |
---|
95 | directive_failed( status, "rtems_semaphore_create" ); |
---|
96 | |
---|
97 | puts( "Creating Message Queue (Global)" ); |
---|
98 | status = rtems_message_queue_create( |
---|
99 | Queue_name[ 1 ], |
---|
100 | 1, |
---|
101 | 16, |
---|
102 | RTEMS_GLOBAL, |
---|
103 | &Queue_id[ 1 ] |
---|
104 | ); |
---|
105 | directive_failed( status, "rtems_message_queue_create" ); |
---|
106 | |
---|
107 | puts( "Creating Partition (Global)" ); |
---|
108 | status = rtems_partition_create( |
---|
109 | Partition_name[ 1 ], |
---|
110 | (void *)my_partition, |
---|
111 | 0x8000, |
---|
112 | 0x3800, |
---|
113 | RTEMS_GLOBAL, |
---|
114 | &Partition_id[ 1 ] |
---|
115 | ); |
---|
116 | directive_failed( status, "rtems_partition_create" ); |
---|
117 | } |
---|
118 | |
---|
119 | puts( "Creating Event task (Global)" ); |
---|
120 | status = rtems_task_create( |
---|
121 | Task_name[ Multiprocessing_configuration.node ], |
---|
122 | 2, |
---|
123 | RTEMS_MINIMUM_STACK_SIZE, |
---|
124 | RTEMS_TIMESLICE, |
---|
125 | RTEMS_GLOBAL, |
---|
126 | &Event_task_id[ 1 ] |
---|
127 | ); |
---|
128 | directive_failed( status, "rtems_task_create" ); |
---|
129 | |
---|
130 | puts( "Starting Event task (Global)" ); |
---|
131 | status = rtems_task_start( Event_task_id[ 1 ], Test_task, 0 ); |
---|
132 | directive_failed( status, "rtems_task_start" ); |
---|
133 | |
---|
134 | puts( "Creating Semaphore task (Global)" ); |
---|
135 | status = rtems_task_create( |
---|
136 | Semaphore_task_name[ Multiprocessing_configuration.node ], |
---|
137 | 2, |
---|
138 | RTEMS_MINIMUM_STACK_SIZE, |
---|
139 | RTEMS_TIMESLICE, |
---|
140 | RTEMS_GLOBAL, |
---|
141 | &Semaphore_task_id[ 1 ] |
---|
142 | ); |
---|
143 | directive_failed( status, "rtems_task_create" ); |
---|
144 | |
---|
145 | puts( "Starting Semaphore task (Global)" ); |
---|
146 | status = rtems_task_start( Semaphore_task_id[ 1 ], Semaphore_task, 0 ); |
---|
147 | directive_failed( status, "rtems_task_start" ); |
---|
148 | |
---|
149 | puts( "Creating Message Queue task (Global)" ); |
---|
150 | status = rtems_task_create( |
---|
151 | Queue_task_name[ Multiprocessing_configuration.node ], |
---|
152 | 2, |
---|
153 | RTEMS_MINIMUM_STACK_SIZE, |
---|
154 | RTEMS_TIMESLICE, |
---|
155 | RTEMS_GLOBAL, |
---|
156 | &Queue_task_id[ 1 ] |
---|
157 | ); |
---|
158 | directive_failed( status, "rtems_task_create" ); |
---|
159 | |
---|
160 | /* argument is index into Buffers */ |
---|
161 | puts( "Starting Message Queue task (Global)" ); |
---|
162 | status = rtems_task_start( Queue_task_id[ 1 ], Message_queue_task, 1 ); |
---|
163 | directive_failed( status, "rtems_task_start" ); |
---|
164 | |
---|
165 | puts( "Creating Partition task (Global)" ); |
---|
166 | status = rtems_task_create( |
---|
167 | Partition_task_name[ Multiprocessing_configuration.node ], |
---|
168 | 2, |
---|
169 | RTEMS_MINIMUM_STACK_SIZE * 2, |
---|
170 | RTEMS_TIMESLICE, |
---|
171 | RTEMS_GLOBAL, |
---|
172 | &Partition_task_id[ 1 ] |
---|
173 | ); |
---|
174 | directive_failed( status, "rtems_task_create" ); |
---|
175 | |
---|
176 | puts( "Starting Partition task (Global)" ); |
---|
177 | status = rtems_task_start( Partition_task_id[ 1 ], Partition_task, 0 ); |
---|
178 | directive_failed( status, "rtems_task_start" ); |
---|
179 | |
---|
180 | status = rtems_task_set_priority( RTEMS_SELF, 2, &previous_priority ); |
---|
181 | directive_failed( status, "rtems_task_set_priority" ); |
---|
182 | |
---|
183 | status = rtems_task_ident( |
---|
184 | RTEMS_SELF, |
---|
185 | RTEMS_SEARCH_ALL_NODES, |
---|
186 | &Task_id[ 1 ] |
---|
187 | ); |
---|
188 | directive_failed( status, "rtems_task_ident" ); |
---|
189 | |
---|
190 | Delayed_events_task( 1 ); |
---|
191 | } |
---|