source: rtems/testsuites/itrontests/itrontask03/init.c @ d37aa444

4.104.114.84.95
Last change on this file since d37aa444 was d37aa444, checked in by Jennifer Averett <Jennifer.Averett@…>, on 11/16/99 at 15:39:08

Changed asserts to tmmacros.

  • Property mode set to 100644
File size: 4.2 KB
Line 
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
25void ITRON_Init( void )
26{
27  ER                status;
28  T_CTSK            pk_ctsk;
29  T_RTSK            pk_rtsk;
30
31  pk_ctsk.exinf    = NULL;
32  pk_ctsk.tskatr   = TA_HLNG;
33  pk_ctsk.stksz    = RTEMS_MINIMUM_STACK_SIZE;
34  pk_ctsk.itskpri  = PREEMPT_PRIORITY;
35  pk_ctsk.task     = Preempt_task;
36
37  puts( "\n\n*** ITRON TASK TEST 3 ***" );
38
39  /*
40   *  Create and start the Preempt task the first time.
41   *  Verify that it is dormant when it comes back.
42   */
43
44  puts( "INIT - Create and Start PREEMPT" );
45  status = chg_pri( TSK_SELF, (PREEMPT_PRIORITY+2) );
46  directive_failed( status, "chg_pri of SELF" );
47 
48  status = cre_tsk(  PREEMPT_TASK_ID, &pk_ctsk );
49  directive_failed( status, "cre_tsk of RTEMS_PREEMPT" );
50
51  status  = sta_tsk( PREEMPT_TASK_ID, 0 );
52  directive_failed( status, "sta_tsk of RTEMS_PREEMPT" );
53  puts( "INIT - rot_rdq - no tasks at this priority" );
54  status = rot_rdq( 1 );
55  directive_failed( status, "rot_rdq" );
56
57  puts( "INIT - ref_tsk PREEMPT - Validate DORMANT STATE" );
58  status = ref_tsk( &pk_rtsk, PREEMPT_TASK_ID );
59  directive_failed( status, "INIT - ref_tsk of RTEMS_PREEMPT");
60  fatal_directive_status(pk_rtsk.tskstat,TTS_DMT,"tskstat of PREEMPT");
61 
62  /*
63   * Restart the Preempt Task.
64   */
65
66  status  = sta_tsk( PREEMPT_TASK_ID, 0 );
67  directive_failed( status, "sta_tsk of RTEMS_PREEMPT" );
68  puts( "INIT - rot_rdq - yielding processor" );
69  status = rot_rdq( 1 );
70  directive_failed( status, "rot_rdq" );
71  puts( "INIT - ref_tsk PREEMPT - Validate no longer exists" );
72  status = ref_tsk( &pk_rtsk, PREEMPT_TASK_ID );
73  fatal_directive_status( status, E_NOEXS, "tskstat of PREEMPT");
74  status = chg_pri( TSK_SELF, PREEMPT_PRIORITY );
75  directive_failed( status, "chg_pri of SELF" );
76 
77  /*
78   * XXX
79   */
80       
81  pk_ctsk.itskpri  = 3;
82  pk_ctsk.task     = Task_1;
83  status = cre_tsk( TA1_ID, &pk_ctsk );
84  directive_failed( status, "cre_tsk of TA1" );
85
86  pk_ctsk.task     = Task_2;
87  status = cre_tsk( TA2_ID, &pk_ctsk );
88  directive_failed( status, "cre_tsk of TA2" );
89
90  pk_ctsk.task     = Task_3;
91  status = cre_tsk( TA3_ID, &pk_ctsk );
92  directive_failed( status, "cre_tsk of TA3" );
93
94  status  = sta_tsk( TA1_ID, 0 );
95  directive_failed( status, "sta_tsk of TA1" );
96  status  = sta_tsk( TA2_ID, 0 );
97  directive_failed( status, "sta_tsk of TA2" );
98  status  = sta_tsk( TA3_ID, 0 );
99  directive_failed( status, "sta_tsk of TA3" );
100
101  status = ref_tsk( &pk_rtsk, TA1_ID);
102  directive_failed( status, "INIT - ref_tsk of TA1");
103  fatal_directive_status( pk_rtsk.tskstat, TTS_RDY , "tskstat of TA1");
104
105  puts( "INIT - suspending TA2 while middle task on a ready chain" );
106  status = sus_tsk( TA2_ID  );
107  directive_failed( status, "sus_tsk of TA2" );
108  status = ref_tsk( &pk_rtsk, TA2_ID);
109  directive_failed( status, "INIT - ref_tsk of TA2");
110  fatal_directive_status( pk_rtsk.tskstat, TTS_SUS, "tskstat of TA2");
111
112  status = ter_tsk( TA1_ID );
113  directive_failed( status, "ter_tsk of TA1" );
114  status = del_tsk( TA1_ID );
115  directive_failed( status, "del_tsk of TA1" );
116  status = ter_tsk( TA2_ID );
117  directive_failed( status, "ter_tsk of TA2" );
118  status = ter_tsk( TA3_ID );
119  directive_failed( status, "ter_tsk of TA3" );
120
121  pk_ctsk.itskpri  = 1;
122  pk_ctsk.task     = Task_1;
123  status = cre_tsk( TA1_ID, &pk_ctsk );
124  directive_failed( status, "cre_tsk of TA1 at priority 1" );
125
126  status  = sta_tsk( TA1_ID, 0 );
127  directive_failed( status, "sta_tsk of TA1" );
128  status  = sta_tsk( TA2_ID, 0 );
129  directive_failed( status, "sta_tsk of TA2" );
130  status  = sta_tsk( TA3_ID, 0 );
131  directive_failed( status, "sta_tsk of TA3" );
132
133  exd_tsk();
134  assert(0);
135}
136
137
138
139
140
141
Note: See TracBrowser for help on using the repository browser.