[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 | * |
---|
[9d9a3dd] | 13 | * COPYRIGHT (c) 1989-1999. |
---|
| 14 | * On-Line Applications Research Corporation (OAR). |
---|
| 15 | * |
---|
[e099180] | 16 | * The license and distribution terms for this file may be |
---|
| 17 | * found in the file LICENSE in this distribution or at |
---|
[2f564fee] | 18 | * http://www.rtems.com/license/LICENSE. |
---|
[e099180] | 19 | * |
---|
| 20 | * $Id$ |
---|
| 21 | */ |
---|
| 22 | |
---|
[016e1e2] | 23 | #define CONFIGURE_INIT |
---|
[e099180] | 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 | * |
---|
[1b4f2b30] | 35 | * E_OK - Normal Completion |
---|
[e099180] | 36 | * |
---|
| 37 | * E_NOMEM - Insufficient memory (Memory for control block and/or user |
---|
[1b4f2b30] | 38 | * stack cannot be allocated) |
---|
[e099180] | 39 | * |
---|
[1b4f2b30] | 40 | * E_ID - Invalid ID Number (tskid was invalid or could not be used) |
---|
[e099180] | 41 | * |
---|
[1b4f2b30] | 42 | * E_RSATR - Reserved attribute (tskatr was invalid or could not be used) |
---|
[e099180] | 43 | * |
---|
[1b4f2b30] | 44 | * E_OBJ - Invalid object state (a task of the same ID already exists) |
---|
[e099180] | 45 | * |
---|
[1b4f2b30] | 46 | * E_OACV - Object access violation (A tskid less than -4 was specified |
---|
| 47 | * from a user task. This is implementation dependent.) |
---|
[e099180] | 48 | * |
---|
[1b4f2b30] | 49 | * E_PAR - Parameter error (pk_ctsk, task, itskpri and/or stksz is invalid) |
---|
[e099180] | 50 | * |
---|
| 51 | * E_NOEXS - Object does not exist (the task specified by tskid does not |
---|
[1b4f2b30] | 52 | * exist) |
---|
[e099180] | 53 | * |
---|
[1b4f2b30] | 54 | * E_CTX - Context error (issued from task-independent portions or a task |
---|
| 55 | * in dispatch disabled state) |
---|
[e099180] | 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 |
---|
[1b4f2b30] | 62 | * node is specified. |
---|
[e099180] | 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 |
---|
[1b4f2b30] | 66 | * a task-independent portion |
---|
[e099180] | 67 | * |
---|
[1b4f2b30] | 68 | * EN_PAR - A value outside the range supported by the target node and/or |
---|
[e099180] | 69 | * transmission packet format was specified as a parameter |
---|
| 70 | * (a value outside supported range was specified for exinf, |
---|
[1b4f2b30] | 71 | * tskatr, task, itskpri and/or stksz) |
---|
[e099180] | 72 | * |
---|
[1b4f2b30] | 73 | * EN_RPAR - A value outside the range supported by the requesting node |
---|
| 74 | * and/or transmission packet format was returned as a return |
---|
[e099180] | 75 | * parameter (a value outside supported range was returned for |
---|
[1b4f2b30] | 76 | * exinf, tskpri and/or tskstat) |
---|
[e099180] | 77 | * |
---|
| 78 | */ |
---|
| 79 | |
---|
| 80 | |
---|
| 81 | rtems_time_of_day time; |
---|
| 82 | ER status; |
---|
| 83 | T_CTSK pk_ctsk; |
---|
[1b4f2b30] | 84 | T_RTSK pk_rtsk; /* Reference Task Packet */ |
---|
[e099180] | 85 | |
---|
| 86 | |
---|
[ec0b5ce] | 87 | puts( "\n\n*** ITRON TASK TEST 2 ***\n" ); |
---|
[e099180] | 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 | |
---|
[0f88857] | 93 | |
---|
| 94 | /* |
---|
| 95 | * Set My priority to 8 so that dummy tasks will be |
---|
| 96 | * forced to run when started. |
---|
| 97 | */ |
---|
[1b4f2b30] | 98 | |
---|
[0f88857] | 99 | status = chg_pri( TSK_SELF, 8 ); |
---|
[3fb7b70b] | 100 | fatal_directive_status( status, E_OK, "chg_pri of TSK_SELF"); |
---|
[0f88857] | 101 | status = ref_tsk( &pk_rtsk, TSK_SELF ); |
---|
[3fb7b70b] | 102 | fatal_directive_status( status, E_OK, "ref_tsk of TSK_SELF"); |
---|
| 103 | fatal_directive_status( pk_rtsk.tskpri, 8, "task priority of SELF"); |
---|
[1b4f2b30] | 104 | |
---|
[0f88857] | 105 | /* |
---|
| 106 | * Create and verify a DORMANT task. |
---|
| 107 | */ |
---|
| 108 | |
---|
[e099180] | 109 | pk_ctsk.exinf = NULL; |
---|
| 110 | pk_ctsk.tskatr = TA_HLNG; |
---|
[afb11f8] | 111 | pk_ctsk.itskpri = 1; |
---|
[0f88857] | 112 | pk_ctsk.task = Dormant_task; |
---|
[1b4f2b30] | 113 | pk_ctsk.stksz = RTEMS_MINIMUM_STACK_SIZE; |
---|
[e099180] | 114 | |
---|
[0f88857] | 115 | puts( "Init - cre_tsk - Dormant Task" ); |
---|
| 116 | status = cre_tsk( DORMANT_TASK_ID, &pk_ctsk ); |
---|
[3fb7b70b] | 117 | fatal_directive_status( status, E_OK, "cre_tsk of DORMANT"); |
---|
[0f88857] | 118 | status = ref_tsk( &pk_rtsk, DORMANT_TASK_ID ); |
---|
[3fb7b70b] | 119 | fatal_directive_status( status, E_OK, "ref_tsk of DORMANT"); |
---|
| 120 | fatal_directive_status( pk_rtsk.tskstat, TTS_DMT, "task state of DORMANT"); |
---|
[e099180] | 121 | |
---|
[0f88857] | 122 | /* |
---|
| 123 | * Create, Start and verify a not DORMANT task. |
---|
| 124 | */ |
---|
[1b4f2b30] | 125 | |
---|
[0f88857] | 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 ); |
---|
[3fb7b70b] | 129 | fatal_directive_status( status, E_OK, "cre_tsk of NON_DORMANT"); |
---|
[0f88857] | 130 | status = sta_tsk( NON_DORMANT_TASK_ID, 1 ); |
---|
| 131 | status = ref_tsk( &pk_rtsk, NON_DORMANT_TASK_ID ); |
---|
[3fb7b70b] | 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"); |
---|
[1b4f2b30] | 134 | |
---|
| 135 | |
---|
[e099180] | 136 | /* |
---|
| 137 | * Bad ID errors |
---|
| 138 | */ |
---|
| 139 | |
---|
[0f88857] | 140 | puts( "\n*** Create Task Errors ***" ); |
---|
| 141 | |
---|
[e099180] | 142 | puts( "Init - cre_tsk - access violation ( id less than -4) - E_OACV" ); |
---|
| 143 | status = cre_tsk( -5, &pk_ctsk ); |
---|
[3fb7b70b] | 144 | fatal_directive_status( status, E_OACV, "cre_tsk of -5"); |
---|
[e099180] | 145 | |
---|
| 146 | puts( "Init - cre_tsk - bad id (between 0 and -4) - E_ID" ); |
---|
| 147 | status = cre_tsk( -2, &pk_ctsk ); |
---|
[3fb7b70b] | 148 | fatal_directive_status( status, E_ID, "cre_tsk of -2"); |
---|
[e099180] | 149 | |
---|
[afb11f8] | 150 | puts( "Init - cre_tsk - cannot create TSK_SELF - E_ID" ); |
---|
| 151 | status = cre_tsk( TSK_SELF, &pk_ctsk ); |
---|
[3fb7b70b] | 152 | fatal_directive_status( status, E_ID, "cre_tsk of TSK_SELF"); |
---|
[e099180] | 153 | |
---|
| 154 | puts( "Init - cre_tsk - invalid id; id already exists - E_OBJ" ); |
---|
| 155 | status = cre_tsk( 1, &pk_ctsk ); |
---|
[3fb7b70b] | 156 | fatal_directive_status( status, E_OBJ, "cre_tsk of 1"); |
---|
[e099180] | 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 ); |
---|
[3fb7b70b] | 165 | fatal_directive_status( status, E_RSATR, "cre_tsk with tskatr of -1"); |
---|
[e099180] | 166 | |
---|
| 167 | puts( "Init - cre_tsk - pk_ctsk is invalid - E_PAR" ); |
---|
| 168 | status = cre_tsk( 5, NULL ); |
---|
[3fb7b70b] | 169 | fatal_directive_status( status, E_PAR, "cre_tsk with NULL discription"); |
---|
[e099180] | 170 | |
---|
| 171 | pk_ctsk.tskatr = TA_HLNG; |
---|
| 172 | pk_ctsk.itskpri = 0; |
---|
[ec0b5ce] | 173 | puts( "Init - cre_tsk - itskpri is 0 - E_PAR" ); |
---|
| 174 | status = cre_tsk( 5, &pk_ctsk ); |
---|
[3fb7b70b] | 175 | fatal_directive_status( status, E_PAR, "cre_tsk with priority of 0"); |
---|
[ec0b5ce] | 176 | pk_ctsk.itskpri = 257; /* XXX Design parameter not requirement. */ |
---|
| 177 | puts( "Init - cre_tsk - itskpri is 257 - E_PAR" ); |
---|
[e099180] | 178 | status = cre_tsk( 5, &pk_ctsk ); |
---|
[3fb7b70b] | 179 | fatal_directive_status( status, E_PAR, "cre_tsk with priority of 257"); |
---|
[e099180] | 180 | |
---|
| 181 | pk_ctsk.stksz = -1; |
---|
| 182 | puts( "Init - cre_tsk - stksz is invalid - E_PAR" ); |
---|
| 183 | status = cre_tsk( 5, &pk_ctsk ); |
---|
[3fb7b70b] | 184 | fatal_directive_status( status, E_PAR, "cre_tsk with size of -1"); |
---|
[e099180] | 185 | |
---|
| 186 | pk_ctsk.task = NULL; |
---|
| 187 | puts( "Init - cre_tsk - task is invalid - E_PAR" ); |
---|
| 188 | status = cre_tsk( 5, &pk_ctsk ); |
---|
[3fb7b70b] | 189 | fatal_directive_status( status, E_PAR, "cre_tsk with null task identifier"); |
---|
[e099180] | 190 | |
---|
| 191 | |
---|
| 192 | #if (0) |
---|
| 193 | /* these errors can not be generated for cre_tsk at this time */ |
---|
[3fb7b70b] | 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, ""); |
---|
[e099180] | 198 | #endif |
---|
| 199 | |
---|
| 200 | puts( "\n\n*** Delete Task Errors ***" ); |
---|
| 201 | |
---|
[1b4f2b30] | 202 | /* |
---|
[e099180] | 203 | * Reset structure |
---|
| 204 | */ |
---|
| 205 | |
---|
| 206 | pk_ctsk.exinf = NULL; |
---|
| 207 | pk_ctsk.tskatr = TA_HLNG; |
---|
[1b4f2b30] | 208 | pk_ctsk.itskpri = 1; |
---|
[0f88857] | 209 | pk_ctsk.task = Dormant_task; |
---|
[1b4f2b30] | 210 | pk_ctsk.stksz = RTEMS_MINIMUM_STACK_SIZE; |
---|
[e099180] | 211 | |
---|
| 212 | |
---|
[afb11f8] | 213 | puts( "Init - del_tsk - cannot delete TSK_SELF - E_OBJ" ); |
---|
| 214 | status = del_tsk( TSK_SELF ); |
---|
[3fb7b70b] | 215 | fatal_directive_status( status, E_OBJ, "del_tsk with SELF"); |
---|
[e099180] | 216 | |
---|
| 217 | puts( "Init - del_tsk - task is not DORMANT - E_OBJ" ); |
---|
[0f88857] | 218 | status = del_tsk( NON_DORMANT_TASK_ID ); |
---|
[3fb7b70b] | 219 | fatal_directive_status( status, E_OBJ, "del_tsk NON_DORMANT"); |
---|
[e099180] | 220 | |
---|
| 221 | puts( "Init - del_tsk - task does not exist - E_NOEXS" ); |
---|
| 222 | status = del_tsk( 5 ); |
---|
[3fb7b70b] | 223 | fatal_directive_status( status, E_NOEXS, "del_tsk 5"); |
---|
[e099180] | 224 | |
---|
| 225 | puts( "Init - del_tsk - access violation ( id less than -4) - E_OACV" ); |
---|
| 226 | status = del_tsk( -5 ); |
---|
[3fb7b70b] | 227 | fatal_directive_status( status, E_OACV, "del_tsk -5"); |
---|
[e099180] | 228 | |
---|
[afb11f8] | 229 | puts( "Init - del_tsk - cannot delete TSK_SELF - E_OBJ" ); |
---|
| 230 | status = del_tsk( TSK_SELF ); |
---|
[3fb7b70b] | 231 | fatal_directive_status( status, E_OBJ, "del_tsk self"); |
---|
[e099180] | 232 | |
---|
| 233 | puts( "Init - del_tsk - bad id (between 0 and -4) - E_ID" ); |
---|
| 234 | status = del_tsk( -3 ); |
---|
[3fb7b70b] | 235 | fatal_directive_status( status, E_ID, "del_tsk -3"); |
---|
[e099180] | 236 | |
---|
| 237 | #if (0) |
---|
| 238 | /* these errors can not be generated for del_tsk at this time */ |
---|
[3fb7b70b] | 239 | fatal_directive_status( status, EN_OBJNO, "del_tsk "); |
---|
| 240 | fatal_directive_status( status, EN_CTXID, "del_tsk "); |
---|
[e099180] | 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 ); |
---|
[3fb7b70b] | 248 | fatal_directive_status( status, E_OACV, "sta_tsk of -5"); |
---|
[e099180] | 249 | |
---|
| 250 | puts( "Init - sta_tsk - bad id (between 0 and -4) - E_ID" ); |
---|
| 251 | status = sta_tsk( -2, 1 ); |
---|
[3fb7b70b] | 252 | fatal_directive_status( status, E_ID, "sta_tsk of -2"); |
---|
[e099180] | 253 | |
---|
[afb11f8] | 254 | puts( "Init - sta_tsk - cannot start TSK_SELF - E_OBJ" ); |
---|
| 255 | status = sta_tsk( TSK_SELF, 1 ); |
---|
[3fb7b70b] | 256 | fatal_directive_status( status, E_OBJ, "sta_tsk of self"); |
---|
[e099180] | 257 | |
---|
| 258 | puts( "Init - sta_tsk - task is not DORMANT - E_OBJ" ); |
---|
[0f88857] | 259 | status = sta_tsk( NON_DORMANT_TASK_ID, 1 ); |
---|
[3fb7b70b] | 260 | fatal_directive_status( status, E_OBJ, "sta_tsk NON_DORMANT"); |
---|
[e099180] | 261 | |
---|
| 262 | puts( "Init - sta_tsk - task does not exist - E_NOEXS" ); |
---|
| 263 | status = sta_tsk( 5, 1 ); |
---|
[3fb7b70b] | 264 | fatal_directive_status( status, E_NOEXS, "5"); |
---|
[e099180] | 265 | |
---|
| 266 | #if (0) |
---|
| 267 | /* these errors can not be generated for sta_tsk at this time */ |
---|
[3fb7b70b] | 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"); |
---|
[e099180] | 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( ); |
---|
[3fb7b70b] | 279 | fatal_directive_status( status, E_CTX, "ext_tsk "); |
---|
[e099180] | 280 | |
---|
| 281 | puts( "\n\n*** Exit and Delete Task Errors ***" ); |
---|
| 282 | puts( "Init - exd_tsk - context error - E_CTX" ); |
---|
| 283 | status = exd_tsk( ); |
---|
[3fb7b70b] | 284 | fatal_directive_status( status, E_CTX, "exd_tsk"); |
---|
[e099180] | 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 ); |
---|
[3fb7b70b] | 292 | fatal_directive_status( status, E_ID, "ter_tsk of -2"); |
---|
[e099180] | 293 | |
---|
[afb11f8] | 294 | puts( "Init - ter_tsk - cannot terminate TSK_SELF (0) - E_OBJ" ); |
---|
| 295 | status = ter_tsk( TSK_SELF ); |
---|
[3fb7b70b] | 296 | fatal_directive_status( status, E_OBJ, "ter_tsk of self"); |
---|
[e099180] | 297 | |
---|
| 298 | puts( "Init - ter_tsk - task is not DORMANT - E_OBJ" ); |
---|
[0f88857] | 299 | status = ter_tsk( DORMANT_TASK_ID ); |
---|
[3fb7b70b] | 300 | fatal_directive_status( status, E_OBJ, "ter_tsk DORMANT"); |
---|
[e099180] | 301 | |
---|
| 302 | puts( "Init - ter_tsk - task does not exist - E_NOEXS" ); |
---|
| 303 | status = ter_tsk( 5 ); |
---|
[3fb7b70b] | 304 | fatal_directive_status( status, E_NOEXS, "ter_tsk of 5"); |
---|
[e099180] | 305 | |
---|
| 306 | puts( "Init - ter_tsk - access violation ( id less than -4) - E_OACV" ); |
---|
| 307 | status = ter_tsk( -5 ); |
---|
[3fb7b70b] | 308 | fatal_directive_status( status, E_OACV, "ter_tsk of -5"); |
---|
[e099180] | 309 | |
---|
| 310 | #if (0) |
---|
| 311 | /* these errors can not be generated for ter_tsk at this time */ |
---|
[3fb7b70b] | 312 | fatal_directive_status( status, EN_OBJNO, "ter_tsk"); |
---|
| 313 | fatal_directive_status( status, EN_CTXID, "ter_tsk"); |
---|
[e099180] | 314 | #endif |
---|
| 315 | |
---|
| 316 | |
---|
| 317 | #if (0) |
---|
| 318 | status = dis_dsp( ); |
---|
[3fb7b70b] | 319 | fatal_directive_status( status, E_CTX, "dis_dsp"); |
---|
[e099180] | 320 | |
---|
| 321 | status = ena_dsp( ); |
---|
[3fb7b70b] | 322 | fatal_directive_status( status, E_CTX, "ena_dsp"); |
---|
[e099180] | 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 ); |
---|
[3fb7b70b] | 329 | fatal_directive_status( status, E_ID, "chg_pri of -2"); |
---|
[e099180] | 330 | |
---|
| 331 | /* Call from task independent portion to cause E_OBJ |
---|
[afb11f8] | 332 | puts( "Init - chg_pri - change priority of TSK_SELF - E_OBJ" ); |
---|
[3fb7b70b] | 333 | status = chg_pri( XXX - INTERRUPT, 1 ); |
---|
[e099180] | 334 | assert( status == E_OBJ ); |
---|
| 335 | */ |
---|
| 336 | |
---|
[3fb7b70b] | 337 | puts( "Init - chg_pri - task is DORMANT - E_OBJ" ); |
---|
[0f88857] | 338 | status = chg_pri( DORMANT_TASK_ID, 1 ); |
---|
[3fb7b70b] | 339 | fatal_directive_status( status, E_OBJ, "chg_pri of DORMANT"); |
---|
[e099180] | 340 | |
---|
| 341 | puts( "Init - chg_pri - task does not exist - E_NOEXS" ); |
---|
| 342 | status = chg_pri( 5, 1 ); |
---|
[3fb7b70b] | 343 | fatal_directive_status( status, E_NOEXS, "chg_pri of 5"); |
---|
[e099180] | 344 | |
---|
| 345 | puts( "Init - chg_pri - access violation ( id less than -4) - E_OACV" ); |
---|
| 346 | status = chg_pri( -5, 1 ); |
---|
[3fb7b70b] | 347 | fatal_directive_status( status, E_OACV, "chg_pri of -5"); |
---|
[e099180] | 348 | |
---|
| 349 | puts( "Init - chg_pri - invalid priority - E_PAR" ); |
---|
| 350 | status = chg_pri( 1, -1 ); |
---|
[3fb7b70b] | 351 | fatal_directive_status( status, E_PAR, "chg_pri with priority of -1"); |
---|
[e099180] | 352 | |
---|
| 353 | #if (0) |
---|
| 354 | /* these errors can not be generated for chg_pri at this time */ |
---|
[3fb7b70b] | 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"); |
---|
[e099180] | 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 | */ |
---|
[1b4f2b30] | 365 | |
---|
[e099180] | 366 | puts( "\n\n*** Rotate Ready Queue Errors ***" ); |
---|
[e8c902c] | 367 | puts( "Init - rot_rdq - priority -1 - E_PAR" ); |
---|
[e099180] | 368 | status = rot_rdq( -1 ); |
---|
[3fb7b70b] | 369 | fatal_directive_status( status, E_PAR, "rot_rdq -1"); |
---|
[e8c902c] | 370 | puts( "Init - rot_rdq - priority 257 - E_PAR" ); |
---|
| 371 | status = rot_rdq( 257 ); |
---|
[3fb7b70b] | 372 | fatal_directive_status( status, E_PAR, "rot_rdq 256"); |
---|
[e099180] | 373 | |
---|
[3fb7b70b] | 374 | /* XXX - This routine is not coded */ |
---|
[e099180] | 375 | |
---|
[3fb7b70b] | 376 | puts( "Init - rel_rdq - XXX Add when rel_wai coded - E_OK" ); |
---|
[47619951] | 377 | status = rel_wai( 1 ); |
---|
[3fb7b70b] | 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"); |
---|
[e099180] | 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 ); |
---|
[3fb7b70b] | 408 | fatal_directive_status( status, E_ID, "ref_tsk -2"); |
---|
[e099180] | 409 | |
---|
[1b4f2b30] | 410 | /* XXX Call from task independent portion to cause E_ID |
---|
[3fb7b70b] | 411 | puts( "Init - ref_tsk - reference INTERRUPT - E_ID" ); |
---|
[afb11f8] | 412 | status = ref_tsk( &pk_rtsk, TSK_SELF ); |
---|
[e099180] | 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 ); |
---|
[3fb7b70b] | 418 | fatal_directive_status( status, E_NOEXS, "ref_tsk 5"); |
---|
[e099180] | 419 | |
---|
| 420 | puts( "Init - ref_tsk - access violation ( id less than -4) - E_OACV" ); |
---|
| 421 | status = ref_tsk( &pk_rtsk, -5 ); |
---|
[3fb7b70b] | 422 | fatal_directive_status( status, E_OACV, "ref_tsk -5"); |
---|
[e099180] | 423 | |
---|
| 424 | puts( "Init - ref_tsk - packet address is bad - E_PAR" ); |
---|
| 425 | status = ref_tsk( NULL, 1 ); |
---|
[3fb7b70b] | 426 | fatal_directive_status( status, E_PAR, "ref_tsk SELF with NULL descriptor"); |
---|
[e099180] | 427 | |
---|
| 428 | #if (0) |
---|
| 429 | /* these errors can not be generated for ref_tsk at this time */ |
---|
[3fb7b70b] | 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"); |
---|
[e099180] | 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 ); |
---|
[3fb7b70b] | 439 | fatal_directive_status( status, E_OACV, "sus_tsk of -5"); |
---|
[e099180] | 440 | |
---|
| 441 | puts( "Init - sus_tsk - bad id (between 0 and -4) - E_ID" ); |
---|
| 442 | status = sus_tsk( -2 ); |
---|
[3fb7b70b] | 443 | fatal_directive_status( status, E_ID, "sus_tsk of -2"); |
---|
[e099180] | 444 | |
---|
| 445 | puts( "Init - sus_tsk - cannot suspend SELF - E_OBJ" ); |
---|
[afb11f8] | 446 | status = sus_tsk( TSK_SELF ); |
---|
[3fb7b70b] | 447 | fatal_directive_status( status, E_OBJ, "sus_tsk of self"); |
---|
[e099180] | 448 | |
---|
| 449 | puts( "Init - sus_tsk - task does not exist - E_NOEXS" ); |
---|
| 450 | status = sus_tsk( 5 ); |
---|
[3fb7b70b] | 451 | fatal_directive_status( status, E_NOEXS, "sus_tsk of 5"); |
---|
| 452 | |
---|
| 453 | /* XXX - We support nested suspends and will never return this error. |
---|
[e099180] | 454 | puts( "Init - sus_tsk - no support for nested SUSPENDS - E_QOVR" ); |
---|
| 455 | status = sus_tsk( 1 ); |
---|
[3fb7b70b] | 456 | fatal_directive_status( status, E_QOVR, "sus_tsk"); |
---|
| 457 | */ |
---|
[e099180] | 458 | |
---|
[3fb7b70b] | 459 | /* XXX - Can not test this. |
---|
[e099180] | 460 | puts( "Init - sus_tsk - exceeded limit for nested SUSPENDS - E_QOVR" ); |
---|
| 461 | status = sus_tsk( 1 ); |
---|
[3fb7b70b] | 462 | fatal_directive_status( status, E_QOVR, "sus_tsk"); |
---|
| 463 | */ |
---|
[e099180] | 464 | |
---|
| 465 | #if (0) |
---|
| 466 | /* these errors can not be generated for sus_tsk at this time */ |
---|
[3fb7b70b] | 467 | fatal_directive_status( status, EN_OBJNO, "sus_tsk"); |
---|
| 468 | fatal_directive_status( status, EN_CTXID, "sus_tsk"); |
---|
[e099180] | 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 ); |
---|
[3fb7b70b] | 476 | fatal_directive_status( status, E_OACV, "rsm_tsk -5"); |
---|
[e099180] | 477 | |
---|
| 478 | puts( "Init - rsm_tsk - bad id (between 0 and -4) - E_ID" ); |
---|
| 479 | status = rsm_tsk( -2 ); |
---|
[3fb7b70b] | 480 | fatal_directive_status( status, E_ID, "rsm_tsk -2"); |
---|
[e099180] | 481 | |
---|
| 482 | puts( "Init - rsm_tsk - cannot resume SELF - E_OBJ" ); |
---|
[afb11f8] | 483 | status = rsm_tsk( TSK_SELF ); |
---|
[3fb7b70b] | 484 | fatal_directive_status( status, E_OBJ, "rsm_tsk self"); |
---|
[e099180] | 485 | |
---|
| 486 | puts( "Init - rsm_tsk - task is DORMANT - E_OBJ" ); |
---|
[0f88857] | 487 | status = rsm_tsk( DORMANT_TASK_ID ); |
---|
[3fb7b70b] | 488 | fatal_directive_status( status, E_OBJ, "rsm_tsk DORMANT"); |
---|
[e099180] | 489 | |
---|
[36072c8a] | 490 | puts( "Init - rsm_tsk - task is NON_DORMANT not suspended - E_OK" ); |
---|
| 491 | status = rsm_tsk( NON_DORMANT_TASK_ID ); |
---|
[8247be66] | 492 | fatal_directive_status( status, E_OBJ, "rsm_tsk NON_DORMANT"); |
---|
[36072c8a] | 493 | |
---|
[e099180] | 494 | puts( "Init - rsm_tsk - task does not exist - E_NOEXS" ); |
---|
| 495 | status = rsm_tsk( 5 ); |
---|
[3fb7b70b] | 496 | fatal_directive_status( status, E_NOEXS, "rms_tsk 5"); |
---|
[e099180] | 497 | |
---|
| 498 | #if (0) |
---|
| 499 | /* these errors can not be generated for rsm_tsk at this time */ |
---|
[3fb7b70b] | 500 | fatal_directive_status( status, EN_OBJNO, "rsm_tsk"); |
---|
| 501 | fatal_directive_status( status, EN_CTXID, "rsm_tsk"); |
---|
[e099180] | 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 ); |
---|
[3fb7b70b] | 509 | fatal_directive_status( status, E_OACV, "frsm_tsk -5"); |
---|
[e099180] | 510 | |
---|
| 511 | puts( "Init - frsm_tsk - bad id (between 0 and -4) - E_ID" ); |
---|
| 512 | status = frsm_tsk( -2 ); |
---|
[3fb7b70b] | 513 | fatal_directive_status( status, E_ID, "frsm_tsk -2"); |
---|
[e099180] | 514 | |
---|
| 515 | puts( "Init - frsm_tsk - cannot forcibly resume SELF - E_OBJ" ); |
---|
[afb11f8] | 516 | status = frsm_tsk( TSK_SELF ); |
---|
[3fb7b70b] | 517 | fatal_directive_status( status, E_OBJ, "frsm_tsk self"); |
---|
[e099180] | 518 | |
---|
| 519 | puts( "Init - frsm_tsk - task is DORMANT - E_OBJ" ); |
---|
[0f88857] | 520 | status = frsm_tsk( DORMANT_TASK_ID ); |
---|
[3fb7b70b] | 521 | fatal_directive_status( status, E_OBJ, "frsm_tsk DORMANT"); |
---|
[e099180] | 522 | |
---|
| 523 | puts( "Init - frsm_tsk - task does not exist - E_NOEXS" ); |
---|
| 524 | status = frsm_tsk( 5 ); |
---|
[3fb7b70b] | 525 | fatal_directive_status( status, E_NOEXS, "frsm_tsk 5"); |
---|
[e099180] | 526 | |
---|
[36072c8a] | 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 | |
---|
[e099180] | 531 | #if (0) |
---|
| 532 | /* these errors can not be generated for frsm_tsk at this time */ |
---|
[3fb7b70b] | 533 | fatal_directive_status( status, EN_OBJNO, "frsm_tsk"); |
---|
| 534 | fatal_directive_status( status, EN_CTXID, "frsm_tsk"); |
---|
[e099180] | 535 | #endif |
---|
| 536 | |
---|
| 537 | |
---|
| 538 | #if (0) |
---|
[3fb7b70b] | 539 | XXXXX - FIX ME |
---|
[e099180] | 540 | /* these directives are not coded */ |
---|
| 541 | slp_tsk( ); |
---|
[3fb7b70b] | 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, ""); |
---|
[e099180] | 547 | |
---|
| 548 | |
---|
| 549 | tslp_tsk( TMO ); |
---|
[3fb7b70b] | 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, ""); |
---|
[e099180] | 555 | |
---|
| 556 | wup_tsk( 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, E_QOVR, ""); |
---|
| 563 | fatal_directive_status( status, EN_OBJNO, ""); |
---|
| 564 | fatal_directive_status( status, EN_CTXID, ""); |
---|
[e099180] | 565 | |
---|
| 566 | |
---|
| 567 | can_tsk( INT, ID ); |
---|
[3fb7b70b] | 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, ""); |
---|
[e099180] | 576 | #endif |
---|
| 577 | |
---|
[36072c8a] | 578 | puts( "*** END OF ITRON TASK TEST 2 ***" ); |
---|
[6b9d16f] | 579 | rtems_test_exit( 0 ); |
---|
[e099180] | 580 | } |
---|