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