[e099180] | 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 | |
---|
[ec0b5ce] | 84 | puts( "\n\n*** ITRON TASK TEST 2 ***\n" ); |
---|
[e099180] | 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 | |
---|
[0f88857] | 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 ); |
---|
[3fb7b70b] | 97 | fatal_directive_status( status, E_OK, "chg_pri of TSK_SELF"); |
---|
[0f88857] | 98 | status = ref_tsk( &pk_rtsk, TSK_SELF ); |
---|
[3fb7b70b] | 99 | fatal_directive_status( status, E_OK, "ref_tsk of TSK_SELF"); |
---|
| 100 | fatal_directive_status( pk_rtsk.tskpri, 8, "task priority of SELF"); |
---|
[0f88857] | 101 | |
---|
| 102 | /* |
---|
| 103 | * Create and verify a DORMANT task. |
---|
| 104 | */ |
---|
| 105 | |
---|
[e099180] | 106 | pk_ctsk.exinf = NULL; |
---|
| 107 | pk_ctsk.tskatr = TA_HLNG; |
---|
[afb11f8] | 108 | pk_ctsk.itskpri = 1; |
---|
[0f88857] | 109 | pk_ctsk.task = Dormant_task; |
---|
[e099180] | 110 | pk_ctsk.stksz = RTEMS_MINIMUM_STACK_SIZE; |
---|
| 111 | |
---|
[0f88857] | 112 | puts( "Init - cre_tsk - Dormant Task" ); |
---|
| 113 | status = cre_tsk( DORMANT_TASK_ID, &pk_ctsk ); |
---|
[3fb7b70b] | 114 | fatal_directive_status( status, E_OK, "cre_tsk of DORMANT"); |
---|
[0f88857] | 115 | status = ref_tsk( &pk_rtsk, DORMANT_TASK_ID ); |
---|
[3fb7b70b] | 116 | fatal_directive_status( status, E_OK, "ref_tsk of DORMANT"); |
---|
| 117 | fatal_directive_status( pk_rtsk.tskstat, TTS_DMT, "task state of DORMANT"); |
---|
[e099180] | 118 | |
---|
[0f88857] | 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 ); |
---|
[3fb7b70b] | 126 | fatal_directive_status( status, E_OK, "cre_tsk of NON_DORMANT"); |
---|
[0f88857] | 127 | status = sta_tsk( NON_DORMANT_TASK_ID, 1 ); |
---|
| 128 | status = ref_tsk( &pk_rtsk, NON_DORMANT_TASK_ID ); |
---|
[3fb7b70b] | 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"); |
---|
[0f88857] | 131 | |
---|
| 132 | |
---|
[e099180] | 133 | /* |
---|
| 134 | * Bad ID errors |
---|
| 135 | */ |
---|
| 136 | |
---|
[0f88857] | 137 | puts( "\n*** Create Task Errors ***" ); |
---|
| 138 | |
---|
[e099180] | 139 | puts( "Init - cre_tsk - access violation ( id less than -4) - E_OACV" ); |
---|
| 140 | status = cre_tsk( -5, &pk_ctsk ); |
---|
[3fb7b70b] | 141 | fatal_directive_status( status, E_OACV, "cre_tsk of -5"); |
---|
[e099180] | 142 | |
---|
| 143 | puts( "Init - cre_tsk - bad id (between 0 and -4) - E_ID" ); |
---|
| 144 | status = cre_tsk( -2, &pk_ctsk ); |
---|
[3fb7b70b] | 145 | fatal_directive_status( status, E_ID, "cre_tsk of -2"); |
---|
[e099180] | 146 | |
---|
[afb11f8] | 147 | puts( "Init - cre_tsk - cannot create TSK_SELF - E_ID" ); |
---|
| 148 | status = cre_tsk( TSK_SELF, &pk_ctsk ); |
---|
[3fb7b70b] | 149 | fatal_directive_status( status, E_ID, "cre_tsk of TSK_SELF"); |
---|
[e099180] | 150 | |
---|
| 151 | puts( "Init - cre_tsk - invalid id; id already exists - E_OBJ" ); |
---|
| 152 | status = cre_tsk( 1, &pk_ctsk ); |
---|
[3fb7b70b] | 153 | fatal_directive_status( status, E_OBJ, "cre_tsk of 1"); |
---|
[e099180] | 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 ); |
---|
[3fb7b70b] | 162 | fatal_directive_status( status, E_RSATR, "cre_tsk with tskatr of -1"); |
---|
[e099180] | 163 | |
---|
| 164 | puts( "Init - cre_tsk - pk_ctsk is invalid - E_PAR" ); |
---|
| 165 | status = cre_tsk( 5, NULL ); |
---|
[3fb7b70b] | 166 | fatal_directive_status( status, E_PAR, "cre_tsk with NULL discription"); |
---|
[e099180] | 167 | |
---|
| 168 | pk_ctsk.tskatr = TA_HLNG; |
---|
| 169 | pk_ctsk.itskpri = 0; |
---|
[ec0b5ce] | 170 | puts( "Init - cre_tsk - itskpri is 0 - E_PAR" ); |
---|
| 171 | status = cre_tsk( 5, &pk_ctsk ); |
---|
[3fb7b70b] | 172 | fatal_directive_status( status, E_PAR, "cre_tsk with priority of 0"); |
---|
[ec0b5ce] | 173 | pk_ctsk.itskpri = 257; /* XXX Design parameter not requirement. */ |
---|
| 174 | puts( "Init - cre_tsk - itskpri is 257 - E_PAR" ); |
---|
[e099180] | 175 | status = cre_tsk( 5, &pk_ctsk ); |
---|
[3fb7b70b] | 176 | fatal_directive_status( status, E_PAR, "cre_tsk with priority of 257"); |
---|
[e099180] | 177 | |
---|
| 178 | pk_ctsk.stksz = -1; |
---|
| 179 | puts( "Init - cre_tsk - stksz is invalid - E_PAR" ); |
---|
| 180 | status = cre_tsk( 5, &pk_ctsk ); |
---|
[3fb7b70b] | 181 | fatal_directive_status( status, E_PAR, "cre_tsk with size of -1"); |
---|
[e099180] | 182 | |
---|
| 183 | pk_ctsk.task = NULL; |
---|
| 184 | puts( "Init - cre_tsk - task is invalid - E_PAR" ); |
---|
| 185 | status = cre_tsk( 5, &pk_ctsk ); |
---|
[3fb7b70b] | 186 | fatal_directive_status( status, E_PAR, "cre_tsk with null task identifier"); |
---|
[e099180] | 187 | |
---|
| 188 | |
---|
| 189 | #if (0) |
---|
| 190 | /* these errors can not be generated for cre_tsk at this time */ |
---|
[3fb7b70b] | 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, ""); |
---|
[e099180] | 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; |
---|
[0f88857] | 206 | pk_ctsk.task = Dormant_task; |
---|
[e099180] | 207 | pk_ctsk.stksz = RTEMS_MINIMUM_STACK_SIZE; |
---|
| 208 | |
---|
| 209 | |
---|
[afb11f8] | 210 | puts( "Init - del_tsk - cannot delete TSK_SELF - E_OBJ" ); |
---|
| 211 | status = del_tsk( TSK_SELF ); |
---|
[3fb7b70b] | 212 | fatal_directive_status( status, E_OBJ, "del_tsk with SELF"); |
---|
[e099180] | 213 | |
---|
| 214 | puts( "Init - del_tsk - task is not DORMANT - E_OBJ" ); |
---|
[0f88857] | 215 | status = del_tsk( NON_DORMANT_TASK_ID ); |
---|
[3fb7b70b] | 216 | fatal_directive_status( status, E_OBJ, "del_tsk NON_DORMANT"); |
---|
[e099180] | 217 | |
---|
| 218 | puts( "Init - del_tsk - task does not exist - E_NOEXS" ); |
---|
| 219 | status = del_tsk( 5 ); |
---|
[3fb7b70b] | 220 | fatal_directive_status( status, E_NOEXS, "del_tsk 5"); |
---|
[e099180] | 221 | |
---|
| 222 | puts( "Init - del_tsk - access violation ( id less than -4) - E_OACV" ); |
---|
| 223 | status = del_tsk( -5 ); |
---|
[3fb7b70b] | 224 | fatal_directive_status( status, E_OACV, "del_tsk -5"); |
---|
[e099180] | 225 | |
---|
[afb11f8] | 226 | puts( "Init - del_tsk - cannot delete TSK_SELF - E_OBJ" ); |
---|
| 227 | status = del_tsk( TSK_SELF ); |
---|
[3fb7b70b] | 228 | fatal_directive_status( status, E_OBJ, "del_tsk self"); |
---|
[e099180] | 229 | |
---|
| 230 | puts( "Init - del_tsk - bad id (between 0 and -4) - E_ID" ); |
---|
| 231 | status = del_tsk( -3 ); |
---|
[3fb7b70b] | 232 | fatal_directive_status( status, E_ID, "del_tsk -3"); |
---|
[e099180] | 233 | |
---|
| 234 | #if (0) |
---|
| 235 | /* these errors can not be generated for del_tsk at this time */ |
---|
[3fb7b70b] | 236 | fatal_directive_status( status, EN_OBJNO, "del_tsk "); |
---|
| 237 | fatal_directive_status( status, EN_CTXID, "del_tsk "); |
---|
[e099180] | 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 ); |
---|
[3fb7b70b] | 245 | fatal_directive_status( status, E_OACV, "sta_tsk of -5"); |
---|
[e099180] | 246 | |
---|
| 247 | puts( "Init - sta_tsk - bad id (between 0 and -4) - E_ID" ); |
---|
| 248 | status = sta_tsk( -2, 1 ); |
---|
[3fb7b70b] | 249 | fatal_directive_status( status, E_ID, "sta_tsk of -2"); |
---|
[e099180] | 250 | |
---|
[afb11f8] | 251 | puts( "Init - sta_tsk - cannot start TSK_SELF - E_OBJ" ); |
---|
| 252 | status = sta_tsk( TSK_SELF, 1 ); |
---|
[3fb7b70b] | 253 | fatal_directive_status( status, E_OBJ, "sta_tsk of self"); |
---|
[e099180] | 254 | |
---|
| 255 | puts( "Init - sta_tsk - task is not DORMANT - E_OBJ" ); |
---|
[0f88857] | 256 | status = sta_tsk( NON_DORMANT_TASK_ID, 1 ); |
---|
[3fb7b70b] | 257 | fatal_directive_status( status, E_OBJ, "sta_tsk NON_DORMANT"); |
---|
[e099180] | 258 | |
---|
| 259 | puts( "Init - sta_tsk - task does not exist - E_NOEXS" ); |
---|
| 260 | status = sta_tsk( 5, 1 ); |
---|
[3fb7b70b] | 261 | fatal_directive_status( status, E_NOEXS, "5"); |
---|
[e099180] | 262 | |
---|
| 263 | #if (0) |
---|
| 264 | /* these errors can not be generated for sta_tsk at this time */ |
---|
[3fb7b70b] | 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"); |
---|
[e099180] | 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( ); |
---|
[3fb7b70b] | 276 | fatal_directive_status( status, E_CTX, "ext_tsk "); |
---|
[e099180] | 277 | |
---|
| 278 | puts( "\n\n*** Exit and Delete Task Errors ***" ); |
---|
| 279 | puts( "Init - exd_tsk - context error - E_CTX" ); |
---|
| 280 | status = exd_tsk( ); |
---|
[3fb7b70b] | 281 | fatal_directive_status( status, E_CTX, "exd_tsk"); |
---|
[e099180] | 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 ); |
---|
[3fb7b70b] | 289 | fatal_directive_status( status, E_ID, "ter_tsk of -2"); |
---|
[e099180] | 290 | |
---|
[afb11f8] | 291 | puts( "Init - ter_tsk - cannot terminate TSK_SELF (0) - E_OBJ" ); |
---|
| 292 | status = ter_tsk( TSK_SELF ); |
---|
[3fb7b70b] | 293 | fatal_directive_status( status, E_OBJ, "ter_tsk of self"); |
---|
[e099180] | 294 | |
---|
| 295 | puts( "Init - ter_tsk - task is not DORMANT - E_OBJ" ); |
---|
[0f88857] | 296 | status = ter_tsk( DORMANT_TASK_ID ); |
---|
[3fb7b70b] | 297 | fatal_directive_status( status, E_OBJ, "ter_tsk DORMANT"); |
---|
[e099180] | 298 | |
---|
| 299 | puts( "Init - ter_tsk - task does not exist - E_NOEXS" ); |
---|
| 300 | status = ter_tsk( 5 ); |
---|
[3fb7b70b] | 301 | fatal_directive_status( status, E_NOEXS, "ter_tsk of 5"); |
---|
[e099180] | 302 | |
---|
| 303 | puts( "Init - ter_tsk - access violation ( id less than -4) - E_OACV" ); |
---|
| 304 | status = ter_tsk( -5 ); |
---|
[3fb7b70b] | 305 | fatal_directive_status( status, E_OACV, "ter_tsk of -5"); |
---|
[e099180] | 306 | |
---|
| 307 | #if (0) |
---|
| 308 | /* these errors can not be generated for ter_tsk at this time */ |
---|
[3fb7b70b] | 309 | fatal_directive_status( status, EN_OBJNO, "ter_tsk"); |
---|
| 310 | fatal_directive_status( status, EN_CTXID, "ter_tsk"); |
---|
[e099180] | 311 | #endif |
---|
| 312 | |
---|
| 313 | |
---|
| 314 | #if (0) |
---|
| 315 | status = dis_dsp( ); |
---|
[3fb7b70b] | 316 | fatal_directive_status( status, E_CTX, "dis_dsp"); |
---|
[e099180] | 317 | |
---|
| 318 | status = ena_dsp( ); |
---|
[3fb7b70b] | 319 | fatal_directive_status( status, E_CTX, "ena_dsp"); |
---|
[e099180] | 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 ); |
---|
[3fb7b70b] | 326 | fatal_directive_status( status, E_ID, "chg_pri of -2"); |
---|
[e099180] | 327 | |
---|
| 328 | /* Call from task independent portion to cause E_OBJ |
---|
[afb11f8] | 329 | puts( "Init - chg_pri - change priority of TSK_SELF - E_OBJ" ); |
---|
[3fb7b70b] | 330 | status = chg_pri( XXX - INTERRUPT, 1 ); |
---|
[e099180] | 331 | assert( status == E_OBJ ); |
---|
| 332 | */ |
---|
| 333 | |
---|
[3fb7b70b] | 334 | puts( "Init - chg_pri - task is DORMANT - E_OBJ" ); |
---|
[0f88857] | 335 | status = chg_pri( DORMANT_TASK_ID, 1 ); |
---|
[3fb7b70b] | 336 | fatal_directive_status( status, E_OBJ, "chg_pri of DORMANT"); |
---|
[e099180] | 337 | |
---|
| 338 | puts( "Init - chg_pri - task does not exist - E_NOEXS" ); |
---|
| 339 | status = chg_pri( 5, 1 ); |
---|
[3fb7b70b] | 340 | fatal_directive_status( status, E_NOEXS, "chg_pri of 5"); |
---|
[e099180] | 341 | |
---|
| 342 | puts( "Init - chg_pri - access violation ( id less than -4) - E_OACV" ); |
---|
| 343 | status = chg_pri( -5, 1 ); |
---|
[3fb7b70b] | 344 | fatal_directive_status( status, E_OACV, "chg_pri of -5"); |
---|
[e099180] | 345 | |
---|
| 346 | puts( "Init - chg_pri - invalid priority - E_PAR" ); |
---|
| 347 | status = chg_pri( 1, -1 ); |
---|
[3fb7b70b] | 348 | fatal_directive_status( status, E_PAR, "chg_pri with priority of -1"); |
---|
[e099180] | 349 | |
---|
| 350 | #if (0) |
---|
| 351 | /* these errors can not be generated for chg_pri at this time */ |
---|
[3fb7b70b] | 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"); |
---|
[e099180] | 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 ***" ); |
---|
[e8c902c] | 364 | puts( "Init - rot_rdq - priority -1 - E_PAR" ); |
---|
[e099180] | 365 | status = rot_rdq( -1 ); |
---|
[3fb7b70b] | 366 | fatal_directive_status( status, E_PAR, "rot_rdq -1"); |
---|
[e8c902c] | 367 | puts( "Init - rot_rdq - priority 257 - E_PAR" ); |
---|
| 368 | status = rot_rdq( 257 ); |
---|
[3fb7b70b] | 369 | fatal_directive_status( status, E_PAR, "rot_rdq 256"); |
---|
[e099180] | 370 | |
---|
[3fb7b70b] | 371 | /* XXX - This routine is not coded */ |
---|
[e099180] | 372 | |
---|
[3fb7b70b] | 373 | puts( "Init - rel_rdq - XXX Add when rel_wai coded - E_OK" ); |
---|
| 374 | status = rel_wai( ID ); |
---|
| 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"); |
---|
[e099180] | 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 ); |
---|
[3fb7b70b] | 405 | fatal_directive_status( status, E_ID, "ref_tsk -2"); |
---|
[e099180] | 406 | |
---|
[3fb7b70b] | 407 | /* XXX Call from task independent portion to cause E_ID |
---|
| 408 | puts( "Init - ref_tsk - reference INTERRUPT - E_ID" ); |
---|
[afb11f8] | 409 | status = ref_tsk( &pk_rtsk, TSK_SELF ); |
---|
[e099180] | 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 ); |
---|
[3fb7b70b] | 415 | fatal_directive_status( status, E_NOEXS, "ref_tsk 5"); |
---|
[e099180] | 416 | |
---|
| 417 | puts( "Init - ref_tsk - access violation ( id less than -4) - E_OACV" ); |
---|
| 418 | status = ref_tsk( &pk_rtsk, -5 ); |
---|
[3fb7b70b] | 419 | fatal_directive_status( status, E_OACV, "ref_tsk -5"); |
---|
[e099180] | 420 | |
---|
| 421 | puts( "Init - ref_tsk - packet address is bad - E_PAR" ); |
---|
| 422 | status = ref_tsk( NULL, 1 ); |
---|
[3fb7b70b] | 423 | fatal_directive_status( status, E_PAR, "ref_tsk SELF with NULL descriptor"); |
---|
[e099180] | 424 | |
---|
| 425 | #if (0) |
---|
| 426 | /* these errors can not be generated for ref_tsk at this time */ |
---|
[3fb7b70b] | 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"); |
---|
[e099180] | 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 ); |
---|
[3fb7b70b] | 436 | fatal_directive_status( status, E_OACV, "sus_tsk of -5"); |
---|
[e099180] | 437 | |
---|
| 438 | puts( "Init - sus_tsk - bad id (between 0 and -4) - E_ID" ); |
---|
| 439 | status = sus_tsk( -2 ); |
---|
[3fb7b70b] | 440 | fatal_directive_status( status, E_ID, "sus_tsk of -2"); |
---|
[e099180] | 441 | |
---|
| 442 | puts( "Init - sus_tsk - cannot suspend SELF - E_OBJ" ); |
---|
[afb11f8] | 443 | status = sus_tsk( TSK_SELF ); |
---|
[3fb7b70b] | 444 | fatal_directive_status( status, E_OBJ, "sus_tsk of self"); |
---|
[e099180] | 445 | |
---|
| 446 | puts( "Init - sus_tsk - task does not exist - E_NOEXS" ); |
---|
| 447 | status = sus_tsk( 5 ); |
---|
[3fb7b70b] | 448 | fatal_directive_status( status, E_NOEXS, "sus_tsk of 5"); |
---|
| 449 | |
---|
| 450 | /* XXX - We support nested suspends and will never return this error. |
---|
[e099180] | 451 | puts( "Init - sus_tsk - no support for nested SUSPENDS - E_QOVR" ); |
---|
| 452 | status = sus_tsk( 1 ); |
---|
[3fb7b70b] | 453 | fatal_directive_status( status, E_QOVR, "sus_tsk"); |
---|
| 454 | */ |
---|
[e099180] | 455 | |
---|
[3fb7b70b] | 456 | /* XXX - Can not test this. |
---|
[e099180] | 457 | puts( "Init - sus_tsk - exceeded limit for nested SUSPENDS - E_QOVR" ); |
---|
| 458 | status = sus_tsk( 1 ); |
---|
[3fb7b70b] | 459 | fatal_directive_status( status, E_QOVR, "sus_tsk"); |
---|
| 460 | */ |
---|
[e099180] | 461 | |
---|
| 462 | #if (0) |
---|
| 463 | /* these errors can not be generated for sus_tsk at this time */ |
---|
[3fb7b70b] | 464 | fatal_directive_status( status, EN_OBJNO, "sus_tsk"); |
---|
| 465 | fatal_directive_status( status, EN_CTXID, "sus_tsk"); |
---|
[e099180] | 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 ); |
---|
[3fb7b70b] | 473 | fatal_directive_status( status, E_OACV, "rsm_tsk -5"); |
---|
[e099180] | 474 | |
---|
| 475 | puts( "Init - rsm_tsk - bad id (between 0 and -4) - E_ID" ); |
---|
| 476 | status = rsm_tsk( -2 ); |
---|
[3fb7b70b] | 477 | fatal_directive_status( status, E_ID, "rsm_tsk -2"); |
---|
[e099180] | 478 | |
---|
| 479 | puts( "Init - rsm_tsk - cannot resume SELF - E_OBJ" ); |
---|
[afb11f8] | 480 | status = rsm_tsk( TSK_SELF ); |
---|
[3fb7b70b] | 481 | fatal_directive_status( status, E_OBJ, "rsm_tsk self"); |
---|
[e099180] | 482 | |
---|
| 483 | puts( "Init - rsm_tsk - task is DORMANT - E_OBJ" ); |
---|
[0f88857] | 484 | status = rsm_tsk( DORMANT_TASK_ID ); |
---|
[3fb7b70b] | 485 | fatal_directive_status( status, E_OBJ, "rsm_tsk DORMANT"); |
---|
[e099180] | 486 | |
---|
| 487 | puts( "Init - rsm_tsk - task does not exist - E_NOEXS" ); |
---|
| 488 | status = rsm_tsk( 5 ); |
---|
[3fb7b70b] | 489 | fatal_directive_status( status, E_NOEXS, "rms_tsk 5"); |
---|
[e099180] | 490 | |
---|
| 491 | #if (0) |
---|
| 492 | /* these errors can not be generated for rsm_tsk at this time */ |
---|
[3fb7b70b] | 493 | fatal_directive_status( status, EN_OBJNO, "rsm_tsk"); |
---|
| 494 | fatal_directive_status( status, EN_CTXID, "rsm_tsk"); |
---|
[e099180] | 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 ); |
---|
[3fb7b70b] | 502 | fatal_directive_status( status, E_OACV, "frsm_tsk -5"); |
---|
[e099180] | 503 | |
---|
| 504 | puts( "Init - frsm_tsk - bad id (between 0 and -4) - E_ID" ); |
---|
| 505 | status = frsm_tsk( -2 ); |
---|
[3fb7b70b] | 506 | fatal_directive_status( status, E_ID, "frsm_tsk -2"); |
---|
[e099180] | 507 | |
---|
| 508 | puts( "Init - frsm_tsk - cannot forcibly resume SELF - E_OBJ" ); |
---|
[afb11f8] | 509 | status = frsm_tsk( TSK_SELF ); |
---|
[3fb7b70b] | 510 | fatal_directive_status( status, E_OBJ, "frsm_tsk self"); |
---|
[e099180] | 511 | |
---|
| 512 | puts( "Init - frsm_tsk - task is DORMANT - E_OBJ" ); |
---|
[0f88857] | 513 | status = frsm_tsk( DORMANT_TASK_ID ); |
---|
[3fb7b70b] | 514 | fatal_directive_status( status, E_OBJ, "frsm_tsk DORMANT"); |
---|
[e099180] | 515 | |
---|
| 516 | puts( "Init - frsm_tsk - task does not exist - E_NOEXS" ); |
---|
| 517 | status = frsm_tsk( 5 ); |
---|
[3fb7b70b] | 518 | fatal_directive_status( status, E_NOEXS, "frsm_tsk 5"); |
---|
[e099180] | 519 | |
---|
| 520 | #if (0) |
---|
| 521 | /* these errors can not be generated for frsm_tsk at this time */ |
---|
[3fb7b70b] | 522 | fatal_directive_status( status, EN_OBJNO, "frsm_tsk"); |
---|
| 523 | fatal_directive_status( status, EN_CTXID, "frsm_tsk"); |
---|
[e099180] | 524 | #endif |
---|
| 525 | |
---|
| 526 | |
---|
| 527 | #if (0) |
---|
[3fb7b70b] | 528 | XXXXX - FIX ME |
---|
[e099180] | 529 | /* these directives are not coded */ |
---|
| 530 | slp_tsk( ); |
---|
[3fb7b70b] | 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, ""); |
---|
[e099180] | 536 | |
---|
| 537 | |
---|
| 538 | tslp_tsk( TMO ); |
---|
[3fb7b70b] | 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, ""); |
---|
[e099180] | 544 | |
---|
| 545 | wup_tsk( ID ); |
---|
[3fb7b70b] | 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, ""); |
---|
[e099180] | 554 | |
---|
| 555 | |
---|
| 556 | can_tsk( INT, ID ); |
---|
[3fb7b70b] | 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, ""); |
---|
[e099180] | 565 | #endif |
---|
| 566 | |
---|
[ec0b5ce] | 567 | puts( "*** ITRON TASK TEST 2 ***" ); |
---|
[e099180] | 568 | exit( 0 ); |
---|
| 569 | } |
---|