OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [tests/] [itrontests/] [itrontask03/] [init.c] - Blame information for rev 389

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.