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

4.104.115
Last change on this file since d35734dd was d35734dd, checked in by Joel Sherrill <joel.sherrill@…>, on 12/08/09 at 17:52:47

2009-12-08 Joel Sherrill <joel.sherrill@…>

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