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.OARcorp.com/rtems/license.html. |
---|
19 | * |
---|
20 | * $Id$ |
---|
21 | */ |
---|
22 | |
---|
23 | #define TEST_INIT |
---|
24 | #include "system.h" |
---|
25 | #include <stdio.h> |
---|
26 | |
---|
27 | void ITRON_Init( void ) |
---|
28 | { |
---|
29 | ER status; |
---|
30 | T_CTSK pk_ctsk; |
---|
31 | |
---|
32 | puts( "\n\n*** ITRON TASK TEST 4 ***" ); |
---|
33 | |
---|
34 | status = chg_pri( 0, 20 ); |
---|
35 | directive_failed( status, "chg_pri to 20" ); |
---|
36 | |
---|
37 | pk_ctsk.exinf = NULL; |
---|
38 | pk_ctsk.tskatr = TA_HLNG; |
---|
39 | pk_ctsk.stksz = RTEMS_MINIMUM_STACK_SIZE; |
---|
40 | pk_ctsk.itskpri = 2; |
---|
41 | |
---|
42 | pk_ctsk.task = Task_1; |
---|
43 | status = cre_tsk( TA1_ID, &pk_ctsk ); |
---|
44 | directive_failed( status, "cre_tsk of TA1" ); |
---|
45 | |
---|
46 | pk_ctsk.task = Task_2; |
---|
47 | status = cre_tsk( TA2_ID, &pk_ctsk ); |
---|
48 | directive_failed( status, "cre_tsk of TA2" ); |
---|
49 | |
---|
50 | pk_ctsk.itskpri = 1; |
---|
51 | pk_ctsk.task = Task_3; |
---|
52 | status = cre_tsk( TA3_ID, &pk_ctsk ); |
---|
53 | directive_failed( status, "cre_tsk of TA3" ); |
---|
54 | |
---|
55 | puts("INIT - dis_dsp while starting tasks"); |
---|
56 | status = dis_dsp( ); |
---|
57 | |
---|
58 | /* dispatching disabled */ |
---|
59 | |
---|
60 | directive_failed_with_level( status, "dis_dsp from ITRON_Init", 1 ); |
---|
61 | status = sta_tsk( TA1_ID, 0 ); |
---|
62 | directive_failed_with_level( status, "sta_tsk of TA1", 1 ); |
---|
63 | status = sta_tsk( TA2_ID, 0 ); |
---|
64 | directive_failed_with_level( status, "sta_tsk of TA2", 1 ); |
---|
65 | status = sta_tsk( TA3_ID, 0 ); |
---|
66 | directive_failed_with_level( status, "sta_tsk of TA3", 1 ); |
---|
67 | |
---|
68 | puts( "INIT - suspending TA2 3 times" ); |
---|
69 | status = sus_tsk( TA2_ID ); |
---|
70 | directive_failed_with_level( status, "sus_tsk of TA2", 1 ); |
---|
71 | status = sus_tsk( TA2_ID ); |
---|
72 | directive_failed_with_level( status, "sus_tsk of TA2", 1 ); |
---|
73 | status = sus_tsk( TA2_ID ); |
---|
74 | directive_failed_with_level( status, "sus_tsk of TA2", 1 ); |
---|
75 | |
---|
76 | puts("INIT - ena_dsp while starting tasks"); |
---|
77 | status = ena_dsp( ); |
---|
78 | |
---|
79 | /* dispatching enabled again */ |
---|
80 | |
---|
81 | puts( "INIT - suspending TA1 3 times" ); |
---|
82 | status = sus_tsk( TA1_ID ); |
---|
83 | directive_failed( status, "sus_tsk of TA2" ); |
---|
84 | status = sus_tsk( TA1_ID ); |
---|
85 | directive_failed( status, "sus_tsk of TA2" ); |
---|
86 | status = sus_tsk( TA1_ID ); |
---|
87 | directive_failed( status, "sus_tsk of TA2" ); |
---|
88 | |
---|
89 | puts("INIT - exd_tsk"); |
---|
90 | exd_tsk(); |
---|
91 | directive_failed( 0, "exd_tsk" ); |
---|
92 | } |
---|
93 | |
---|