[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 | |
---|
| 24 | void ITRON_Init( void ) |
---|
| 25 | { |
---|
| 26 | ER status; |
---|
| 27 | T_CTSK pk_ctsk; |
---|
| 28 | |
---|
[f4771656] | 29 | puts( "\n\n*** ITRON TASK TEST 3 ***" ); |
---|
[e099180] | 30 | |
---|
| 31 | pk_ctsk.exinf = NULL; |
---|
| 32 | pk_ctsk.tskatr = TA_HLNG; |
---|
| 33 | pk_ctsk.stksz = RTEMS_MINIMUM_STACK_SIZE; |
---|
| 34 | |
---|
| 35 | pk_ctsk.itskpri = 1; |
---|
| 36 | pk_ctsk.task = Preempt_task; |
---|
| 37 | status = cre_tsk( PREEMPT_TASK_ID, &pk_ctsk ); |
---|
| 38 | directive_failed( status, "cre_tsk of RTEMS_PREEMPT" ); |
---|
| 39 | status = sta_tsk( PREEMPT_TASK_ID, 0 ); |
---|
| 40 | directive_failed( status, "sta_tsk of RTEMS_PREEMPT" ); |
---|
| 41 | |
---|
| 42 | puts( "INIT - rot_rdq - yielding processor" ); |
---|
| 43 | status = rot_rdq( 1 ); |
---|
| 44 | directive_failed( status, "rot_rdq" ); |
---|
| 45 | |
---|
| 46 | pk_ctsk.itskpri = 3; |
---|
| 47 | pk_ctsk.task = Task_1; |
---|
| 48 | status = cre_tsk( TA1_ID, &pk_ctsk ); |
---|
| 49 | directive_failed( status, "cre_tsk of TA1" ); |
---|
| 50 | |
---|
| 51 | pk_ctsk.task = Task_2; |
---|
| 52 | status = cre_tsk( TA2_ID, &pk_ctsk ); |
---|
| 53 | directive_failed( status, "cre_tsk of TA2" ); |
---|
| 54 | |
---|
| 55 | pk_ctsk.task = Task_3; |
---|
| 56 | status = cre_tsk( TA3_ID, &pk_ctsk ); |
---|
| 57 | directive_failed( status, "cre_tsk of TA3" ); |
---|
| 58 | |
---|
| 59 | status = sta_tsk( TA1_ID, 0 ); |
---|
| 60 | directive_failed( status, "sta_tsk of TA1" ); |
---|
| 61 | status = sta_tsk( TA2_ID, 0 ); |
---|
| 62 | directive_failed( status, "sta_tsk of TA2" ); |
---|
| 63 | status = sta_tsk( TA3_ID, 0 ); |
---|
| 64 | directive_failed( status, "sta_tsk of TA3" ); |
---|
| 65 | |
---|
| 66 | puts( "INIT - suspending TA2 while middle task on a ready chain" ); |
---|
| 67 | status = sus_tsk( TA2_ID ); |
---|
| 68 | directive_failed( status, "sus_tsk of TA2" ); |
---|
| 69 | |
---|
| 70 | status = ter_tsk( TA1_ID ); |
---|
| 71 | directive_failed( status, "ter_tsk of TA1" ); |
---|
| 72 | status = del_tsk( TA1_ID ); |
---|
| 73 | directive_failed( status, "del_tsk of TA1" ); |
---|
| 74 | status = ter_tsk( TA2_ID ); |
---|
| 75 | directive_failed( status, "ter_tsk of TA2" ); |
---|
| 76 | status = ter_tsk( TA3_ID ); |
---|
| 77 | directive_failed( status, "ter_tsk of TA3" ); |
---|
| 78 | |
---|
| 79 | pk_ctsk.itskpri = 1; |
---|
| 80 | pk_ctsk.task = Task_1; |
---|
| 81 | status = cre_tsk( TA1_ID, &pk_ctsk ); |
---|
| 82 | directive_failed( status, "cre_tsk of TA1 at priority 1" ); |
---|
| 83 | |
---|
| 84 | status = sta_tsk( TA1_ID, 0 ); |
---|
| 85 | directive_failed( status, "sta_tsk of TA1" ); |
---|
| 86 | status = sta_tsk( TA2_ID, 0 ); |
---|
| 87 | directive_failed( status, "sta_tsk of TA2" ); |
---|
| 88 | status = sta_tsk( TA3_ID, 0 ); |
---|
| 89 | directive_failed( status, "sta_tsk of TA3" ); |
---|
| 90 | |
---|
| 91 | exd_tsk(); |
---|
| 92 | directive_failed( 0, "exd_tsk" ); |
---|
| 93 | } |
---|
| 94 | |
---|