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