source: rtems/testsuites/sptests/sp02/init.c @ 3652ad35

4.104.114.84.95
Last change on this file since 3652ad35 was 3652ad35, checked in by Joel Sherrill <joel.sherrill@…>, on 09/19/95 at 14:53:29

Minor bug fixes to get all targets compilable and running. The
single biggest changes were the expansion of the workspace size
macro to include other types of objects and the increase in the
minimum stack size for most CPUs.

  • Property mode set to 100644
File size: 4.4 KB
Line 
1/*  Init
2 *
3 *  This routine is the initialization task for this test program.
4 *  It is a user initialization task 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:
10 *    argument - task argument
11 *
12 *  Output parameters:  NONE
13 *
14 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
15 *  On-Line Applications Research Corporation (OAR).
16 *  All rights assigned to U.S. Government, 1994.
17 *
18 *  This material may be reproduced by or for the U.S. Government pursuant
19 *  to the copyright license under the clause at DFARS 252.227-7013.  This
20 *  notice must appear in all copies of this file and its derivatives.
21 *
22 *  init.c,v 1.2 1995/05/31 17:06:49 joel Exp
23 */
24
25#define TEST_INIT
26#include "system.h"
27
28rtems_task Init(
29  rtems_task_argument argument
30)
31{
32  rtems_status_code status;
33
34  puts( "\n\n*** TEST 2 ***" );
35
36  Preempt_task_name =  rtems_build_name( 'P', 'R', 'M', 'T' );
37
38  status = rtems_task_create(
39     Preempt_task_name,
40     1,
41     RTEMS_MINIMUM_STACK_SIZE,
42     RTEMS_DEFAULT_MODES,
43     RTEMS_DEFAULT_ATTRIBUTES,
44     &Preempt_task_id
45  );
46  directive_failed( status, "rtems_task_create of RTEMS_PREEMPT" );
47
48  status = rtems_task_start( Preempt_task_id, Preempt_task, 0 );
49  directive_failed( status, "rtems_task_start of RTEMS_PREEMPT" );
50
51  puts( "INIT - rtems_task_wake_after - yielding processor" );
52  status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
53  directive_failed( status, "rtems_task_wake_after" );
54
55  Task_name[ 1 ] =  rtems_build_name( 'T', 'A', '1', ' ' );
56  Task_name[ 2 ] =  rtems_build_name( 'T', 'A', '2', ' ' );
57  Task_name[ 3 ] =  rtems_build_name( 'T', 'A', '3', ' ' );
58
59  status = rtems_task_create(
60     Task_name[ 1 ],
61     3,
62     RTEMS_MINIMUM_STACK_SIZE,
63     RTEMS_DEFAULT_MODES,
64     RTEMS_DEFAULT_ATTRIBUTES,
65     &Task_id[ 1 ]
66  );
67  directive_failed( status, "rtems_task_create of TA1" );
68
69  status = rtems_task_create(
70     Task_name[ 2 ],
71     3,
72     RTEMS_MINIMUM_STACK_SIZE,
73     RTEMS_DEFAULT_MODES,
74     RTEMS_DEFAULT_ATTRIBUTES,
75     &Task_id[ 2 ]
76  );
77  directive_failed( status, "rtems_task_create of TA2" );
78
79  status = rtems_task_create(
80     Task_name[ 3 ],
81     3,
82     RTEMS_MINIMUM_STACK_SIZE,
83     RTEMS_DEFAULT_MODES,
84     RTEMS_DEFAULT_ATTRIBUTES,
85     &Task_id[ 3 ]
86  );
87  directive_failed( status, "rtems_task_create of TA3" );
88
89  status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
90  directive_failed( status, "rtems_task_start of TA1" );
91
92  status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
93  directive_failed( status, "rtems_task_start of TA2" );
94
95  status = rtems_task_start( Task_id[ 3 ], Task_3, 0 );
96  directive_failed( status, "rtems_task_start of TA3" );
97
98  puts( "INIT - suspending TA2 while middle task on a ready chain" );
99  status = rtems_task_suspend( Task_id[ 2 ] );
100  directive_failed( status, "rtems_task_suspend of TA2" );
101
102  status = rtems_task_delete( Task_id[ 1 ] );
103  directive_failed( status, "rtems_task_delete of TA1" );
104
105  status = rtems_task_delete( Task_id[ 2 ] );
106  directive_failed( status, "rtems_task_delete of TA2" );
107
108  status = rtems_task_delete( Task_id[ 3 ] );
109  directive_failed( status, "rtems_task_delete of TA3" );
110
111  status = rtems_task_create(
112     Task_name[ 1 ],
113     1,
114     RTEMS_MINIMUM_STACK_SIZE,
115     RTEMS_DEFAULT_MODES,
116     RTEMS_DEFAULT_ATTRIBUTES,
117     &Task_id[ 1 ]
118  );
119  directive_failed( status, "rtems_task_create of TA1" );
120
121  status = rtems_task_create(
122     Task_name[ 2 ],
123     3,
124     RTEMS_MINIMUM_STACK_SIZE,
125     RTEMS_DEFAULT_MODES,
126     RTEMS_DEFAULT_ATTRIBUTES,
127     &Task_id[ 2 ]
128  );
129  directive_failed( status, "rtems_task_create of TA2" );
130
131  status = rtems_task_create(
132     Task_name[ 3 ],
133     3,
134     RTEMS_MINIMUM_STACK_SIZE,
135     RTEMS_DEFAULT_MODES,
136     RTEMS_DEFAULT_ATTRIBUTES,
137     &Task_id[ 3 ]
138  );
139  directive_failed( status, "rtems_task_create of TA3" );
140
141  status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
142  directive_failed( status, "rtems_task_start of TA1" );
143
144  status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
145  directive_failed( status, "rtems_task_start of TA2" );
146
147  status = rtems_task_start( Task_id[ 3 ], Task_3, 0 );
148  directive_failed( status, "rtems_task_start of TA3" );
149
150  status = rtems_task_delete( RTEMS_SELF );
151  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
152}
Note: See TracBrowser for help on using the repository browser.