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-1999. |
---|
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 | #define CONFIGURE_INIT |
---|
24 | #include "system.h" |
---|
25 | #include <stdio.h> |
---|
26 | #include <assert.h> |
---|
27 | |
---|
28 | void ITRON_Init( void ) |
---|
29 | { |
---|
30 | |
---|
31 | /* |
---|
32 | * Status Codes for these errors |
---|
33 | * |
---|
34 | * |
---|
35 | * E_OK - Normal Completion |
---|
36 | * |
---|
37 | * E_NOMEM - Insufficient memory (Memory for control block and/or user |
---|
38 | * stack cannot be allocated) |
---|
39 | * |
---|
40 | * E_ID - Invalid ID Number (tskid was invalid or could not be used) |
---|
41 | * |
---|
42 | * E_RSATR - Reserved attribute (tskatr was invalid or could not be used) |
---|
43 | * |
---|
44 | * E_OBJ - Invalid object state (a task of the same ID already exists) |
---|
45 | * |
---|
46 | * E_OACV - Object access violation (A tskid less than -4 was specified |
---|
47 | * from a user task. This is implementation dependent.) |
---|
48 | * |
---|
49 | * E_PAR - Parameter error (pk_ctsk, task, itskpri and/or stksz is invalid) |
---|
50 | * |
---|
51 | * E_NOEXS - Object does not exist (the task specified by tskid does not |
---|
52 | * exist) |
---|
53 | * |
---|
54 | * E_CTX - Context error (issued from task-independent portions or a task |
---|
55 | * in dispatch disabled state) |
---|
56 | * |
---|
57 | * |
---|
58 | * |
---|
59 | * Network Specific Errors (ITRON calls these Connection Function Errors) |
---|
60 | * |
---|
61 | * EN_OBJNO - An object number which could not be accessed on the target |
---|
62 | * node is specified. |
---|
63 | * |
---|
64 | * EN_CTXID - Specified an object on another node when the system call |
---|
65 | * was issued from a task in dispatch disabled state or from |
---|
66 | * a task-independent portion |
---|
67 | * |
---|
68 | * EN_PAR - A value outside the range supported by the target node and/or |
---|
69 | * transmission packet format was specified as a parameter |
---|
70 | * (a value outside supported range was specified for exinf, |
---|
71 | * tskatr, task, itskpri and/or stksz) |
---|
72 | * |
---|
73 | * EN_RPAR - A value outside the range supported by the requesting node |
---|
74 | * and/or transmission packet format was returned as a return |
---|
75 | * parameter (a value outside supported range was returned for |
---|
76 | * exinf, tskpri and/or tskstat) |
---|
77 | * |
---|
78 | */ |
---|
79 | |
---|
80 | |
---|
81 | rtems_time_of_day time; |
---|
82 | ER status; |
---|
83 | T_CTSK pk_ctsk; |
---|
84 | T_RTSK pk_rtsk; /* Reference Task Packet */ |
---|
85 | |
---|
86 | |
---|
87 | puts( "\n\n*** ITRON TASK TEST 2 ***\n" ); |
---|
88 | |
---|
89 | build_time( &time, 12, 31, 1988, 9, 0, 0, 0 ); |
---|
90 | status = rtems_clock_set( &time ); |
---|
91 | directive_failed( status, "rtems_clock_set" ); |
---|
92 | |
---|
93 | |
---|
94 | /* |
---|
95 | * Set My priority to 8 so that dummy tasks will be |
---|
96 | * forced to run when started. |
---|
97 | */ |
---|
98 | |
---|
99 | status = chg_pri( TSK_SELF, 8 ); |
---|
100 | fatal_directive_status( status, E_OK, "chg_pri of TSK_SELF"); |
---|
101 | status = ref_tsk( &pk_rtsk, TSK_SELF ); |
---|
102 | fatal_directive_status( status, E_OK, "ref_tsk of TSK_SELF"); |
---|
103 | fatal_directive_status( pk_rtsk.tskpri, 8, "task priority of SELF"); |
---|
104 | |
---|
105 | /* |
---|
106 | * Create and verify a DORMANT task. |
---|
107 | */ |
---|
108 | |
---|
109 | pk_ctsk.exinf = NULL; |
---|
110 | pk_ctsk.tskatr = TA_HLNG; |
---|
111 | pk_ctsk.itskpri = 1; |
---|
112 | pk_ctsk.task = Dormant_task; |
---|
113 | pk_ctsk.stksz = RTEMS_MINIMUM_STACK_SIZE; |
---|
114 | |
---|
115 | puts( "Init - cre_tsk - Dormant Task" ); |
---|
116 | status = cre_tsk( DORMANT_TASK_ID, &pk_ctsk ); |
---|
117 | fatal_directive_status( status, E_OK, "cre_tsk of DORMANT"); |
---|
118 | status = ref_tsk( &pk_rtsk, DORMANT_TASK_ID ); |
---|
119 | fatal_directive_status( status, E_OK, "ref_tsk of DORMANT"); |
---|
120 | fatal_directive_status( pk_rtsk.tskstat, TTS_DMT, "task state of DORMANT"); |
---|
121 | |
---|
122 | /* |
---|
123 | * Create, Start and verify a not DORMANT task. |
---|
124 | */ |
---|
125 | |
---|
126 | pk_ctsk.task = Non_Dormant_task; |
---|
127 | puts( "Init - cre_tsk - Non-Dormant Task" ); |
---|
128 | status = cre_tsk( NON_DORMANT_TASK_ID, &pk_ctsk ); |
---|
129 | fatal_directive_status( status, E_OK, "cre_tsk of NON_DORMANT"); |
---|
130 | status = sta_tsk( NON_DORMANT_TASK_ID, 1 ); |
---|
131 | status = ref_tsk( &pk_rtsk, NON_DORMANT_TASK_ID ); |
---|
132 | fatal_directive_status( status, E_OK, "ref_tsk of NON_DORMANT"); |
---|
133 | fatal_directive_status( pk_rtsk.tskstat,TTS_WAI,"task state of NON_DORMANT"); |
---|
134 | |
---|
135 | |
---|
136 | /* |
---|
137 | * Bad ID errors |
---|
138 | */ |
---|
139 | |
---|
140 | puts( "\n*** Create Task Errors ***" ); |
---|
141 | |
---|
142 | puts( "Init - cre_tsk - access violation ( id less than -4) - E_OACV" ); |
---|
143 | status = cre_tsk( -5, &pk_ctsk ); |
---|
144 | fatal_directive_status( status, E_OACV, "cre_tsk of -5"); |
---|
145 | |
---|
146 | puts( "Init - cre_tsk - bad id (between 0 and -4) - E_ID" ); |
---|
147 | status = cre_tsk( -2, &pk_ctsk ); |
---|
148 | fatal_directive_status( status, E_ID, "cre_tsk of -2"); |
---|
149 | |
---|
150 | puts( "Init - cre_tsk - cannot create TSK_SELF - E_ID" ); |
---|
151 | status = cre_tsk( TSK_SELF, &pk_ctsk ); |
---|
152 | fatal_directive_status( status, E_ID, "cre_tsk of TSK_SELF"); |
---|
153 | |
---|
154 | puts( "Init - cre_tsk - invalid id; id already exists - E_OBJ" ); |
---|
155 | status = cre_tsk( 1, &pk_ctsk ); |
---|
156 | fatal_directive_status( status, E_OBJ, "cre_tsk of 1"); |
---|
157 | |
---|
158 | /* |
---|
159 | * Bad task attribute errors |
---|
160 | */ |
---|
161 | |
---|
162 | pk_ctsk.tskatr = -1; |
---|
163 | puts( "Init - cre_tsk - tskatr is invalid - E_RSATR" ); |
---|
164 | status = cre_tsk( 5, &pk_ctsk ); |
---|
165 | fatal_directive_status( status, E_RSATR, "cre_tsk with tskatr of -1"); |
---|
166 | |
---|
167 | puts( "Init - cre_tsk - pk_ctsk is invalid - E_PAR" ); |
---|
168 | status = cre_tsk( 5, NULL ); |
---|
169 | fatal_directive_status( status, E_PAR, "cre_tsk with NULL discription"); |
---|
170 | |
---|
171 | pk_ctsk.tskatr = TA_HLNG; |
---|
172 | pk_ctsk.itskpri = 0; |
---|
173 | puts( "Init - cre_tsk - itskpri is 0 - E_PAR" ); |
---|
174 | status = cre_tsk( 5, &pk_ctsk ); |
---|
175 | fatal_directive_status( status, E_PAR, "cre_tsk with priority of 0"); |
---|
176 | pk_ctsk.itskpri = 257; /* XXX Design parameter not requirement. */ |
---|
177 | puts( "Init - cre_tsk - itskpri is 257 - E_PAR" ); |
---|
178 | status = cre_tsk( 5, &pk_ctsk ); |
---|
179 | fatal_directive_status( status, E_PAR, "cre_tsk with priority of 257"); |
---|
180 | |
---|
181 | pk_ctsk.stksz = -1; |
---|
182 | puts( "Init - cre_tsk - stksz is invalid - E_PAR" ); |
---|
183 | status = cre_tsk( 5, &pk_ctsk ); |
---|
184 | fatal_directive_status( status, E_PAR, "cre_tsk with size of -1"); |
---|
185 | |
---|
186 | pk_ctsk.task = NULL; |
---|
187 | puts( "Init - cre_tsk - task is invalid - E_PAR" ); |
---|
188 | status = cre_tsk( 5, &pk_ctsk ); |
---|
189 | fatal_directive_status( status, E_PAR, "cre_tsk with null task identifier"); |
---|
190 | |
---|
191 | |
---|
192 | #if (0) |
---|
193 | /* these errors can not be generated for cre_tsk at this time */ |
---|
194 | fatal_directive_status( status, E_NOMEM, ""); |
---|
195 | fatal_directive_status( status, EN_OBJNO, ""); |
---|
196 | fatal_directive_status( status, EN_CTXID, ""); |
---|
197 | fatal_directive_status( status, EN_PAR, ""); |
---|
198 | #endif |
---|
199 | |
---|
200 | puts( "\n\n*** Delete Task Errors ***" ); |
---|
201 | |
---|
202 | /* |
---|
203 | * Reset structure |
---|
204 | */ |
---|
205 | |
---|
206 | pk_ctsk.exinf = NULL; |
---|
207 | pk_ctsk.tskatr = TA_HLNG; |
---|
208 | pk_ctsk.itskpri = 1; |
---|
209 | pk_ctsk.task = Dormant_task; |
---|
210 | pk_ctsk.stksz = RTEMS_MINIMUM_STACK_SIZE; |
---|
211 | |
---|
212 | |
---|
213 | puts( "Init - del_tsk - cannot delete TSK_SELF - E_OBJ" ); |
---|
214 | status = del_tsk( TSK_SELF ); |
---|
215 | fatal_directive_status( status, E_OBJ, "del_tsk with SELF"); |
---|
216 | |
---|
217 | puts( "Init - del_tsk - task is not DORMANT - E_OBJ" ); |
---|
218 | status = del_tsk( NON_DORMANT_TASK_ID ); |
---|
219 | fatal_directive_status( status, E_OBJ, "del_tsk NON_DORMANT"); |
---|
220 | |
---|
221 | puts( "Init - del_tsk - task does not exist - E_NOEXS" ); |
---|
222 | status = del_tsk( 5 ); |
---|
223 | fatal_directive_status( status, E_NOEXS, "del_tsk 5"); |
---|
224 | |
---|
225 | puts( "Init - del_tsk - access violation ( id less than -4) - E_OACV" ); |
---|
226 | status = del_tsk( -5 ); |
---|
227 | fatal_directive_status( status, E_OACV, "del_tsk -5"); |
---|
228 | |
---|
229 | puts( "Init - del_tsk - cannot delete TSK_SELF - E_OBJ" ); |
---|
230 | status = del_tsk( TSK_SELF ); |
---|
231 | fatal_directive_status( status, E_OBJ, "del_tsk self"); |
---|
232 | |
---|
233 | puts( "Init - del_tsk - bad id (between 0 and -4) - E_ID" ); |
---|
234 | status = del_tsk( -3 ); |
---|
235 | fatal_directive_status( status, E_ID, "del_tsk -3"); |
---|
236 | |
---|
237 | #if (0) |
---|
238 | /* these errors can not be generated for del_tsk at this time */ |
---|
239 | fatal_directive_status( status, EN_OBJNO, "del_tsk "); |
---|
240 | fatal_directive_status( status, EN_CTXID, "del_tsk "); |
---|
241 | #endif |
---|
242 | |
---|
243 | |
---|
244 | puts( "\n\n*** Start Task Errors ***" ); |
---|
245 | |
---|
246 | puts( "Init - sta_tsk - access violation ( id less than -4) - E_OACV" ); |
---|
247 | status = sta_tsk( -5, 1 ); |
---|
248 | fatal_directive_status( status, E_OACV, "sta_tsk of -5"); |
---|
249 | |
---|
250 | puts( "Init - sta_tsk - bad id (between 0 and -4) - E_ID" ); |
---|
251 | status = sta_tsk( -2, 1 ); |
---|
252 | fatal_directive_status( status, E_ID, "sta_tsk of -2"); |
---|
253 | |
---|
254 | puts( "Init - sta_tsk - cannot start TSK_SELF - E_OBJ" ); |
---|
255 | status = sta_tsk( TSK_SELF, 1 ); |
---|
256 | fatal_directive_status( status, E_OBJ, "sta_tsk of self"); |
---|
257 | |
---|
258 | puts( "Init - sta_tsk - task is not DORMANT - E_OBJ" ); |
---|
259 | status = sta_tsk( NON_DORMANT_TASK_ID, 1 ); |
---|
260 | fatal_directive_status( status, E_OBJ, "sta_tsk NON_DORMANT"); |
---|
261 | |
---|
262 | puts( "Init - sta_tsk - task does not exist - E_NOEXS" ); |
---|
263 | status = sta_tsk( 5, 1 ); |
---|
264 | fatal_directive_status( status, E_NOEXS, "5"); |
---|
265 | |
---|
266 | #if (0) |
---|
267 | /* these errors can not be generated for sta_tsk at this time */ |
---|
268 | fatal_directive_status( status, EN_OBJNO, "sta_tsk"); |
---|
269 | fatal_directive_status( status, EN_CTXID, "sta_tsk"); |
---|
270 | fatal_directive_status( status, EN_PAR, "sta_tsk"); |
---|
271 | #endif |
---|
272 | |
---|
273 | |
---|
274 | #if (0) |
---|
275 | /* these errors can not be tested at this time */ |
---|
276 | puts( "\n\n*** Exit Task Errors ***" ); |
---|
277 | puts( "Init - ext_tsk - context error - E_CTX" ); |
---|
278 | status = ext_tsk( ); |
---|
279 | fatal_directive_status( status, E_CTX, "ext_tsk "); |
---|
280 | |
---|
281 | puts( "\n\n*** Exit and Delete Task Errors ***" ); |
---|
282 | puts( "Init - exd_tsk - context error - E_CTX" ); |
---|
283 | status = exd_tsk( ); |
---|
284 | fatal_directive_status( status, E_CTX, "exd_tsk"); |
---|
285 | #endif |
---|
286 | |
---|
287 | |
---|
288 | puts( "\n\n*** Terminate Other Task Errors ***" ); |
---|
289 | |
---|
290 | puts( "Init - ter_tsk - bad id (between 0 and -4) - E_ID" ); |
---|
291 | status = ter_tsk( -2 ); |
---|
292 | fatal_directive_status( status, E_ID, "ter_tsk of -2"); |
---|
293 | |
---|
294 | puts( "Init - ter_tsk - cannot terminate TSK_SELF (0) - E_OBJ" ); |
---|
295 | status = ter_tsk( TSK_SELF ); |
---|
296 | fatal_directive_status( status, E_OBJ, "ter_tsk of self"); |
---|
297 | |
---|
298 | puts( "Init - ter_tsk - task is not DORMANT - E_OBJ" ); |
---|
299 | status = ter_tsk( DORMANT_TASK_ID ); |
---|
300 | fatal_directive_status( status, E_OBJ, "ter_tsk DORMANT"); |
---|
301 | |
---|
302 | puts( "Init - ter_tsk - task does not exist - E_NOEXS" ); |
---|
303 | status = ter_tsk( 5 ); |
---|
304 | fatal_directive_status( status, E_NOEXS, "ter_tsk of 5"); |
---|
305 | |
---|
306 | puts( "Init - ter_tsk - access violation ( id less than -4) - E_OACV" ); |
---|
307 | status = ter_tsk( -5 ); |
---|
308 | fatal_directive_status( status, E_OACV, "ter_tsk of -5"); |
---|
309 | |
---|
310 | #if (0) |
---|
311 | /* these errors can not be generated for ter_tsk at this time */ |
---|
312 | fatal_directive_status( status, EN_OBJNO, "ter_tsk"); |
---|
313 | fatal_directive_status( status, EN_CTXID, "ter_tsk"); |
---|
314 | #endif |
---|
315 | |
---|
316 | |
---|
317 | #if (0) |
---|
318 | status = dis_dsp( ); |
---|
319 | fatal_directive_status( status, E_CTX, "dis_dsp"); |
---|
320 | |
---|
321 | status = ena_dsp( ); |
---|
322 | fatal_directive_status( status, E_CTX, "ena_dsp"); |
---|
323 | #endif |
---|
324 | |
---|
325 | puts( "\n\n*** Change Priority Task Errors ***" ); |
---|
326 | |
---|
327 | puts( "Init - chg_pri - bad id (between 0 and -4) - E_ID" ); |
---|
328 | status = chg_pri( -2, 1 ); |
---|
329 | fatal_directive_status( status, E_ID, "chg_pri of -2"); |
---|
330 | |
---|
331 | /* Call from task independent portion to cause E_OBJ |
---|
332 | puts( "Init - chg_pri - change priority of TSK_SELF - E_OBJ" ); |
---|
333 | status = chg_pri( XXX - INTERRUPT, 1 ); |
---|
334 | assert( status == E_OBJ ); |
---|
335 | */ |
---|
336 | |
---|
337 | puts( "Init - chg_pri - task is DORMANT - E_OBJ" ); |
---|
338 | status = chg_pri( DORMANT_TASK_ID, 1 ); |
---|
339 | fatal_directive_status( status, E_OBJ, "chg_pri of DORMANT"); |
---|
340 | |
---|
341 | puts( "Init - chg_pri - task does not exist - E_NOEXS" ); |
---|
342 | status = chg_pri( 5, 1 ); |
---|
343 | fatal_directive_status( status, E_NOEXS, "chg_pri of 5"); |
---|
344 | |
---|
345 | puts( "Init - chg_pri - access violation ( id less than -4) - E_OACV" ); |
---|
346 | status = chg_pri( -5, 1 ); |
---|
347 | fatal_directive_status( status, E_OACV, "chg_pri of -5"); |
---|
348 | |
---|
349 | puts( "Init - chg_pri - invalid priority - E_PAR" ); |
---|
350 | status = chg_pri( 1, -1 ); |
---|
351 | fatal_directive_status( status, E_PAR, "chg_pri with priority of -1"); |
---|
352 | |
---|
353 | #if (0) |
---|
354 | /* these errors can not be generated for chg_pri at this time */ |
---|
355 | fatal_directive_status( status, EN_OBJNO, "chg_pri"); |
---|
356 | fatal_directive_status( status, EN_CTXID, "chg_pri"); |
---|
357 | fatal_directive_status( status, EN_PAR, "chg_pri"); |
---|
358 | #endif |
---|
359 | |
---|
360 | /* This gave me a nasty-gram |
---|
361 | * "core_find_mapping() - access to unmaped address, attach a default map |
---|
362 | * to handle this - addr=0x80002098 nr_bytes=0x4 processor=0x40134008 |
---|
363 | * cia=0xc744" |
---|
364 | */ |
---|
365 | |
---|
366 | puts( "\n\n*** Rotate Ready Queue Errors ***" ); |
---|
367 | puts( "Init - rot_rdq - priority -1 - E_PAR" ); |
---|
368 | status = rot_rdq( -1 ); |
---|
369 | fatal_directive_status( status, E_PAR, "rot_rdq -1"); |
---|
370 | puts( "Init - rot_rdq - priority 257 - E_PAR" ); |
---|
371 | status = rot_rdq( 257 ); |
---|
372 | fatal_directive_status( status, E_PAR, "rot_rdq 256"); |
---|
373 | |
---|
374 | /* XXX - This routine is not coded */ |
---|
375 | |
---|
376 | puts( "Init - rel_rdq - XXX Add when rel_wai coded - E_OK" ); |
---|
377 | status = rel_wai( 1 ); |
---|
378 | fatal_directive_status( status, E_OK, "rel_wai"); |
---|
379 | |
---|
380 | puts( "Init - rel_rdq - XXX Add when rel_wai coded - E_ID" ); |
---|
381 | status = E_ID; |
---|
382 | fatal_directive_status( status, E_ID, "rel_wai"); |
---|
383 | |
---|
384 | puts( "Init - rel_rdq - XXX Add when rel_wai coded - E_NOEXS" ); |
---|
385 | status = E_NOEXS; |
---|
386 | fatal_directive_status( status, E_NOEXS, "rel_wai"); |
---|
387 | |
---|
388 | puts( "Init - rel_rdq - XXX Add when rel_wai coded - E_OACV" ); |
---|
389 | status = E_OACV; |
---|
390 | fatal_directive_status( status, E_OACV, "rel_wai"); |
---|
391 | |
---|
392 | puts( "Init - rel_rdq - XXX Add when rel_wai coded - E_OBJ" ); |
---|
393 | status = E_OBJ; |
---|
394 | fatal_directive_status( status, E_OBJ, "rel_wai"); |
---|
395 | |
---|
396 | puts( "Init - rel_rdq - XXX Add when rel_wai coded - EN_OBJNO" ); |
---|
397 | status = EN_OBJNO; |
---|
398 | fatal_directive_status( status, EN_OBJNO, "rel_wai"); |
---|
399 | |
---|
400 | puts( "Init - rel_rdq - XXX Add when rel_wai coded - EN_CTXID" ); |
---|
401 | status = EN_CTXID; |
---|
402 | fatal_directive_status( status, EN_CTXID, "rel_wai"); |
---|
403 | |
---|
404 | |
---|
405 | puts( "\n\n*** Reference Task Status Errors ***" ); |
---|
406 | puts( "Init - ref_tsk - bad id (between 0 and -4) - E_ID" ); |
---|
407 | status = ref_tsk( &pk_rtsk, -2 ); |
---|
408 | fatal_directive_status( status, E_ID, "ref_tsk -2"); |
---|
409 | |
---|
410 | /* XXX Call from task independent portion to cause E_ID |
---|
411 | puts( "Init - ref_tsk - reference INTERRUPT - E_ID" ); |
---|
412 | status = ref_tsk( &pk_rtsk, TSK_SELF ); |
---|
413 | assert( status == E_ID ); |
---|
414 | */ |
---|
415 | |
---|
416 | puts( "Init - ref_tsk - task does not exist - E_NOEXS" ); |
---|
417 | status = ref_tsk( &pk_rtsk, 5 ); |
---|
418 | fatal_directive_status( status, E_NOEXS, "ref_tsk 5"); |
---|
419 | |
---|
420 | puts( "Init - ref_tsk - access violation ( id less than -4) - E_OACV" ); |
---|
421 | status = ref_tsk( &pk_rtsk, -5 ); |
---|
422 | fatal_directive_status( status, E_OACV, "ref_tsk -5"); |
---|
423 | |
---|
424 | puts( "Init - ref_tsk - packet address is bad - E_PAR" ); |
---|
425 | status = ref_tsk( NULL, 1 ); |
---|
426 | fatal_directive_status( status, E_PAR, "ref_tsk SELF with NULL descriptor"); |
---|
427 | |
---|
428 | #if (0) |
---|
429 | /* these errors can not be generated for ref_tsk at this time */ |
---|
430 | fatal_directive_status( status, EN_OBJNO, "ref_tsk"); |
---|
431 | fatal_directive_status( status, EN_CTXID, "ref_tsk"); |
---|
432 | fatal_directive_status( status, EN_RPAR, "ref_tsk"); |
---|
433 | #endif |
---|
434 | |
---|
435 | puts( "\n\n*** Suspend Task Errors ***" ); |
---|
436 | |
---|
437 | puts( "Init - sus_tsk - access violation ( id less than -4) - E_OACV" ); |
---|
438 | status = sus_tsk( -5 ); |
---|
439 | fatal_directive_status( status, E_OACV, "sus_tsk of -5"); |
---|
440 | |
---|
441 | puts( "Init - sus_tsk - bad id (between 0 and -4) - E_ID" ); |
---|
442 | status = sus_tsk( -2 ); |
---|
443 | fatal_directive_status( status, E_ID, "sus_tsk of -2"); |
---|
444 | |
---|
445 | puts( "Init - sus_tsk - cannot suspend SELF - E_OBJ" ); |
---|
446 | status = sus_tsk( TSK_SELF ); |
---|
447 | fatal_directive_status( status, E_OBJ, "sus_tsk of self"); |
---|
448 | |
---|
449 | puts( "Init - sus_tsk - task does not exist - E_NOEXS" ); |
---|
450 | status = sus_tsk( 5 ); |
---|
451 | fatal_directive_status( status, E_NOEXS, "sus_tsk of 5"); |
---|
452 | |
---|
453 | /* XXX - We support nested suspends and will never return this error. |
---|
454 | puts( "Init - sus_tsk - no support for nested SUSPENDS - E_QOVR" ); |
---|
455 | status = sus_tsk( 1 ); |
---|
456 | fatal_directive_status( status, E_QOVR, "sus_tsk"); |
---|
457 | */ |
---|
458 | |
---|
459 | /* XXX - Can not test this. |
---|
460 | puts( "Init - sus_tsk - exceeded limit for nested SUSPENDS - E_QOVR" ); |
---|
461 | status = sus_tsk( 1 ); |
---|
462 | fatal_directive_status( status, E_QOVR, "sus_tsk"); |
---|
463 | */ |
---|
464 | |
---|
465 | #if (0) |
---|
466 | /* these errors can not be generated for sus_tsk at this time */ |
---|
467 | fatal_directive_status( status, EN_OBJNO, "sus_tsk"); |
---|
468 | fatal_directive_status( status, EN_CTXID, "sus_tsk"); |
---|
469 | #endif |
---|
470 | |
---|
471 | |
---|
472 | puts( "\n\n*** Resume Task Errors ***" ); |
---|
473 | |
---|
474 | puts( "Init - rsm_tsk - access violation ( id less than -4) - E_OACV" ); |
---|
475 | status = rsm_tsk( -5 ); |
---|
476 | fatal_directive_status( status, E_OACV, "rsm_tsk -5"); |
---|
477 | |
---|
478 | puts( "Init - rsm_tsk - bad id (between 0 and -4) - E_ID" ); |
---|
479 | status = rsm_tsk( -2 ); |
---|
480 | fatal_directive_status( status, E_ID, "rsm_tsk -2"); |
---|
481 | |
---|
482 | puts( "Init - rsm_tsk - cannot resume SELF - E_OBJ" ); |
---|
483 | status = rsm_tsk( TSK_SELF ); |
---|
484 | fatal_directive_status( status, E_OBJ, "rsm_tsk self"); |
---|
485 | |
---|
486 | puts( "Init - rsm_tsk - task is DORMANT - E_OBJ" ); |
---|
487 | status = rsm_tsk( DORMANT_TASK_ID ); |
---|
488 | fatal_directive_status( status, E_OBJ, "rsm_tsk DORMANT"); |
---|
489 | |
---|
490 | puts( "Init - rsm_tsk - task is NON_DORMANT not suspended - E_OK" ); |
---|
491 | status = rsm_tsk( NON_DORMANT_TASK_ID ); |
---|
492 | fatal_directive_status( status, E_OBJ, "rsm_tsk NON_DORMANT"); |
---|
493 | |
---|
494 | puts( "Init - rsm_tsk - task does not exist - E_NOEXS" ); |
---|
495 | status = rsm_tsk( 5 ); |
---|
496 | fatal_directive_status( status, E_NOEXS, "rms_tsk 5"); |
---|
497 | |
---|
498 | #if (0) |
---|
499 | /* these errors can not be generated for rsm_tsk at this time */ |
---|
500 | fatal_directive_status( status, EN_OBJNO, "rsm_tsk"); |
---|
501 | fatal_directive_status( status, EN_CTXID, "rsm_tsk"); |
---|
502 | #endif |
---|
503 | |
---|
504 | |
---|
505 | puts( "\n\n*** Forcibly Resume Task Errors ***" ); |
---|
506 | |
---|
507 | puts( "Init - frsm_tsk - access violation ( id less than -4) - E_OACV" ); |
---|
508 | status = frsm_tsk( -5 ); |
---|
509 | fatal_directive_status( status, E_OACV, "frsm_tsk -5"); |
---|
510 | |
---|
511 | puts( "Init - frsm_tsk - bad id (between 0 and -4) - E_ID" ); |
---|
512 | status = frsm_tsk( -2 ); |
---|
513 | fatal_directive_status( status, E_ID, "frsm_tsk -2"); |
---|
514 | |
---|
515 | puts( "Init - frsm_tsk - cannot forcibly resume SELF - E_OBJ" ); |
---|
516 | status = frsm_tsk( TSK_SELF ); |
---|
517 | fatal_directive_status( status, E_OBJ, "frsm_tsk self"); |
---|
518 | |
---|
519 | puts( "Init - frsm_tsk - task is DORMANT - E_OBJ" ); |
---|
520 | status = frsm_tsk( DORMANT_TASK_ID ); |
---|
521 | fatal_directive_status( status, E_OBJ, "frsm_tsk DORMANT"); |
---|
522 | |
---|
523 | puts( "Init - frsm_tsk - task does not exist - E_NOEXS" ); |
---|
524 | status = frsm_tsk( 5 ); |
---|
525 | fatal_directive_status( status, E_NOEXS, "frsm_tsk 5"); |
---|
526 | |
---|
527 | puts( "Init - frsm_tsk - task is NON_DORMANT not suspended - E_OK" ); |
---|
528 | status = frsm_tsk( NON_DORMANT_TASK_ID ); |
---|
529 | fatal_directive_status( status, E_OK, "frsm_tsk NON_DORMANT"); |
---|
530 | |
---|
531 | #if (0) |
---|
532 | /* these errors can not be generated for frsm_tsk at this time */ |
---|
533 | fatal_directive_status( status, EN_OBJNO, "frsm_tsk"); |
---|
534 | fatal_directive_status( status, EN_CTXID, "frsm_tsk"); |
---|
535 | #endif |
---|
536 | |
---|
537 | |
---|
538 | #if (0) |
---|
539 | XXXXX - FIX ME |
---|
540 | /* these directives are not coded */ |
---|
541 | slp_tsk( ); |
---|
542 | fatal_directive_status( status, E_OK, ""); |
---|
543 | fatal_directive_status( status, E_PAR, ""); |
---|
544 | fatal_directive_status( status, E_RLWAI, ""); |
---|
545 | fatal_directive_status( status, E_TMOUT, ""); |
---|
546 | fatal_directive_status( status, E_CTX, ""); |
---|
547 | |
---|
548 | |
---|
549 | tslp_tsk( TMO ); |
---|
550 | fatal_directive_status( status, E_OK, ""); |
---|
551 | fatal_directive_status( status, E_PAR, ""); |
---|
552 | fatal_directive_status( status, E_RLWAI, ""); |
---|
553 | fatal_directive_status( status, E_TMOUT, ""); |
---|
554 | fatal_directive_status( status, E_CTX, ""); |
---|
555 | |
---|
556 | wup_tsk( ID ); |
---|
557 | fatal_directive_status( status, E_OK, ""); |
---|
558 | fatal_directive_status( status, E_ID, ""); |
---|
559 | fatal_directive_status( status, E_NOEXS, ""); |
---|
560 | fatal_directive_status( status, E_OACV, ""); |
---|
561 | fatal_directive_status( status, E_OBJ, ""); |
---|
562 | fatal_directive_status( status, E_QOVR, ""); |
---|
563 | fatal_directive_status( status, EN_OBJNO, ""); |
---|
564 | fatal_directive_status( status, EN_CTXID, ""); |
---|
565 | |
---|
566 | |
---|
567 | can_tsk( INT, ID ); |
---|
568 | fatal_directive_status( status, E_OK, ""); |
---|
569 | fatal_directive_status( status, E_ID, ""); |
---|
570 | fatal_directive_status( status, E_NOEXS, ""); |
---|
571 | fatal_directive_status( status, E_OACV, ""); |
---|
572 | fatal_directive_status( status, E_OBJ, ""); |
---|
573 | fatal_directive_status( status, EN_OBJNO, ""); |
---|
574 | fatal_directive_status( status, EN_CTXID, ""); |
---|
575 | fatal_directive_status( status, EN_RPAR, ""); |
---|
576 | #endif |
---|
577 | |
---|
578 | puts( "*** END OF ITRON TASK TEST 2 ***" ); |
---|
579 | rtems_test_exit( 0 ); |
---|
580 | } |
---|