source: rtems/testsuites/sptests/sp02/init.c @ d2b93bfd

4.104.114.84.95
Last change on this file since d2b93bfd was d2b93bfd, checked in by Joel Sherrill <joel.sherrill@…>, on 09/04/03 at 18:53:48

2003-09-04 Joel Sherrill <joel@…>

  • sp01/init.c, sp01/sp01.doc, sp01/system.h, sp01/task1.c, sp02/init.c, sp02/preempt.c, sp02/sp02.doc, sp02/system.h, sp02/task1.c, sp02/task2.c, sp02/task3.c, sp03/init.c, sp03/sp03.doc, sp03/system.h, sp03/task1.c, sp03/task2.c, sp04/init.c, sp04/sp04.doc, sp04/system.h, sp04/task1.c, sp04/task2.c, sp04/task3.c, sp04/tswitch.c, sp05/init.c, sp05/sp05.doc, sp05/system.h, sp05/task1.c, sp05/task2.c, sp05/task3.c, sp06/init.c, sp06/sp06.doc, sp06/system.h, sp06/task1.c, sp06/task2.c, sp06/task3.c, sp07/init.c, sp07/sp07.doc, sp07/system.h, sp07/task1.c, sp07/task2.c, sp07/task3.c, sp07/task4.c, sp07/taskexit.c, sp07/tcreate.c, sp07/tdelete.c, sp07/trestart.c, sp07/tstart.c, sp08/init.c, sp08/sp08.doc, sp08/system.h, sp08/task1.c, sp09/delay.c, sp09/init.c, sp09/isr.c, sp09/screen01.c, sp09/screen02.c, sp09/screen03.c, sp09/screen04.c, sp09/screen05.c, sp09/screen06.c, sp09/screen07.c, sp09/screen08.c, sp09/screen09.c, sp09/screen10.c, sp09/screen11.c, sp09/screen12.c, sp09/screen13.c, sp09/screen14.c, sp09/sp09.doc, sp09/system.h, sp09/task1.c, sp09/task2.c, sp09/task3.c, sp09/task4.c, sp11/init.c, sp11/sp11.doc, sp11/system.h, sp11/task1.c, sp11/task2.c, sp11/timer.c, sp12/init.c, sp12/pridrv.c, sp12/pritask.c, sp12/sp12.doc, sp12/system.h, sp12/task1.c, sp12/task2.c, sp12/task3.c, sp12/task4.c, sp12/task5.c, sp13/fillbuff.c, sp13/init.c, sp13/putbuff.c, sp13/sp13.doc, sp13/system.h, sp13/task1.c, sp13/task2.c, sp13/task3.c, sp14/asr.c, sp14/init.c, sp14/sp14.doc, sp14/system.h, sp14/task1.c, sp14/task2.c, sp15/init.c, sp15/sp15.doc, sp15/system.h, sp15/task1.c, sp16/init.c, sp16/sp16.doc, sp16/system.h, sp16/task1.c, sp16/task2.c, sp16/task3.c, sp16/task4.c, sp16/task5.c, sp17/asr.c, sp17/init.c, sp17/sp17.doc, sp17/system.h, sp17/task1.c, sp17/task2.c, sp19/first.c, sp19/fptask.c, sp19/fptest.h, sp19/init.c, sp19/inttest.h, sp19/sp19.doc, sp19/system.h, sp19/task1.c, sp20/getall.c, sp20/init.c, sp20/sp20.doc, sp20/system.h, sp20/task1.c, sp21/init.c, sp21/sp21.doc, sp21/system.h, sp21/task1.c, sp22/delay.c, sp22/init.c, sp22/prtime.c, sp22/sp22.doc, sp22/system.h, sp22/task1.c, sp23/init.c, sp23/sp23.doc, sp23/system.h, sp23/task1.c, sp24/init.c, sp24/resume.c, sp24/sp24.doc, sp24/system.h, sp24/task1.c, sp25/init.c, sp25/sp25.doc, sp25/system.h, sp25/task1.c, sp26/init.c, sp26/sp26.doc, sp26/system.h, sp26/task1.c, sp30/init.c, sp30/resume.c, sp30/sp30.doc, sp30/system.h, sp30/task1.c, sp31/delay.c, sp31/init.c, sp31/prtime.c, sp31/sp31.doc, sp31/system.h, sp31/task1.c, sp32/init.c, spfatal/fatal.c, spfatal/init.c, spfatal/puterr.c, spfatal/spfatal.doc, spfatal/system.h, spfatal/task1.c, spsize/getint.c, spsize/init.c, spsize/size.c, spsize/system.h: URL for license changed.
  • 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 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-1999.
15 *  On-Line Applications Research Corporation (OAR).
16 *
17 *  The license and distribution terms for this file may be
18 *  found in the file LICENSE in this distribution or at
19 *  http://www.rtems.com/license/LICENSE.
20 *
21 *  $Id$
22 */
23
24#define TEST_INIT
25#include "system.h"
26
27rtems_task Init(
28  rtems_task_argument argument
29)
30{
31  rtems_status_code status;
32
33  puts( "\n\n*** TEST 2 ***" );
34
35  Preempt_task_name =  rtems_build_name( 'P', 'R', 'M', 'T' );
36
37  status = rtems_task_create(
38     Preempt_task_name,
39     1,
40     RTEMS_MINIMUM_STACK_SIZE,
41     RTEMS_DEFAULT_MODES,
42     RTEMS_DEFAULT_ATTRIBUTES,
43     &Preempt_task_id
44  );
45  directive_failed( status, "rtems_task_create of RTEMS_PREEMPT" );
46
47  status = rtems_task_start( Preempt_task_id, Preempt_task, 0 );
48  directive_failed( status, "rtems_task_start of RTEMS_PREEMPT" );
49
50  puts( "INIT - rtems_task_wake_after - yielding processor" );
51  status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
52  directive_failed( status, "rtems_task_wake_after" );
53
54  Task_name[ 1 ] =  rtems_build_name( 'T', 'A', '1', ' ' );
55  Task_name[ 2 ] =  rtems_build_name( 'T', 'A', '2', ' ' );
56  Task_name[ 3 ] =  rtems_build_name( 'T', 'A', '3', ' ' );
57
58  status = rtems_task_create(
59     Task_name[ 1 ],
60     3,
61     RTEMS_MINIMUM_STACK_SIZE,
62     RTEMS_DEFAULT_MODES,
63     RTEMS_DEFAULT_ATTRIBUTES,
64     &Task_id[ 1 ]
65  );
66  directive_failed( status, "rtems_task_create of TA1" );
67
68  status = rtems_task_create(
69     Task_name[ 2 ],
70     3,
71     RTEMS_MINIMUM_STACK_SIZE,
72     RTEMS_DEFAULT_MODES,
73     RTEMS_DEFAULT_ATTRIBUTES,
74     &Task_id[ 2 ]
75  );
76  directive_failed( status, "rtems_task_create of TA2" );
77
78  status = rtems_task_create(
79     Task_name[ 3 ],
80     3,
81     RTEMS_MINIMUM_STACK_SIZE,
82     RTEMS_DEFAULT_MODES,
83     RTEMS_DEFAULT_ATTRIBUTES,
84     &Task_id[ 3 ]
85  );
86  directive_failed( status, "rtems_task_create of TA3" );
87
88  status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
89  directive_failed( status, "rtems_task_start of TA1" );
90
91  status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
92  directive_failed( status, "rtems_task_start of TA2" );
93
94  status = rtems_task_start( Task_id[ 3 ], Task_3, 0 );
95  directive_failed( status, "rtems_task_start of TA3" );
96
97  puts( "INIT - suspending TA2 while middle task on a ready chain" );
98  status = rtems_task_suspend( Task_id[ 2 ] );
99  directive_failed( status, "rtems_task_suspend of TA2" );
100
101  status = rtems_task_delete( Task_id[ 1 ] );
102  directive_failed( status, "rtems_task_delete of TA1" );
103
104  status = rtems_task_delete( Task_id[ 2 ] );
105  directive_failed( status, "rtems_task_delete of TA2" );
106
107  status = rtems_task_delete( Task_id[ 3 ] );
108  directive_failed( status, "rtems_task_delete of TA3" );
109
110  status = rtems_task_create(
111     Task_name[ 1 ],
112     1,
113     RTEMS_MINIMUM_STACK_SIZE,
114     RTEMS_DEFAULT_MODES,
115     RTEMS_DEFAULT_ATTRIBUTES,
116     &Task_id[ 1 ]
117  );
118  directive_failed( status, "rtems_task_create of TA1" );
119
120  status = rtems_task_create(
121     Task_name[ 2 ],
122     3,
123     RTEMS_MINIMUM_STACK_SIZE,
124     RTEMS_DEFAULT_MODES,
125     RTEMS_DEFAULT_ATTRIBUTES,
126     &Task_id[ 2 ]
127  );
128  directive_failed( status, "rtems_task_create of TA2" );
129
130  status = rtems_task_create(
131     Task_name[ 3 ],
132     3,
133     RTEMS_MINIMUM_STACK_SIZE,
134     RTEMS_DEFAULT_MODES,
135     RTEMS_DEFAULT_ATTRIBUTES,
136     &Task_id[ 3 ]
137  );
138  directive_failed( status, "rtems_task_create of TA3" );
139
140  status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
141  directive_failed( status, "rtems_task_start of TA1" );
142
143  status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
144  directive_failed( status, "rtems_task_start of TA2" );
145
146  status = rtems_task_start( Task_id[ 3 ], Task_3, 0 );
147  directive_failed( status, "rtems_task_start of TA3" );
148
149  status = rtems_task_delete( RTEMS_SELF );
150  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
151}
Note: See TracBrowser for help on using the repository browser.