source: rtems/testsuites/sptests/sp12/init.c @ 3a4ae6c

4.104.114.84.9
Last change on this file since 3a4ae6c was 3a4ae6c, checked in by Joel Sherrill <joel.sherrill@…>, on Sep 11, 1995 at 7:35:39 PM

The word "RTEMS" almost completely removed from the core.

Configuration Table Template file added and all tests
modified to use this. All gvar.h and conftbl.h files
removed from test directories.

Configuration parameter maximum_devices added.

Core semaphore and mutex handlers added and RTEMS API Semaphore
Manager updated to reflect this.

Initialization sequence changed to invoke API specific initialization
routines. Initialization tasks table now owned by RTEMS Tasks Manager.

Added user extension for post-switch.

Utilized user extensions to implement API specific functionality
like signal dispatching.

Added extensions to the System Initialization Thread so that an
API can register a function to be invoked while the system
is being initialized. These are largely equivalent to the
pre-driver and post-driver hooks.

Added the Modules file oar-go32_p5, modified oar-go32, and modified
the file make/custom/go32.cfg to look at an environment varable which
determines what CPU model is being used.

All BSPs updated to reflect named devices and clock driver's IOCTL
used by the Shared Memory Driver. Also merged clock isr into
main file and removed ckisr.c where possible.

Updated spsize to reflect new and moved variables.

Makefiles for the executive source and include files updated to show
break down of files into Core, RTEMS API, and Neither.

Header and inline files installed into subdirectory based on whether
logically in the Core or a part of the RTEMS API.

  • Property mode set to 100644
File size: 5.3 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 *  $Id$
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 12 ***" );
35
36  Task_name[ 1 ]          = rtems_build_name( 'T', 'A', '1', ' ' );
37  Task_name[ 2 ]          = rtems_build_name( 'T', 'A', '2', ' ' );
38  Task_name[ 3 ]          = rtems_build_name( 'T', 'A', '3', ' ' );
39  Task_name[ 4 ]          = rtems_build_name( 'T', 'A', '4', ' ' );
40  Task_name[ 5 ]          = rtems_build_name( 'T', 'A', '5', ' ' );
41
42  Priority_task_name[ 1 ] = rtems_build_name( 'P', 'R', 'I', '1' );
43  Priority_task_name[ 2 ] = rtems_build_name( 'P', 'R', 'I', '2' );
44  Priority_task_name[ 3 ] = rtems_build_name( 'P', 'R', 'I', '3' );
45  Priority_task_name[ 4 ] = rtems_build_name( 'P', 'R', 'I', '4' );
46  Priority_task_name[ 5 ] = rtems_build_name( 'P', 'R', 'I', '5' );
47
48  Semaphore_name[ 1 ]     = rtems_build_name( 'S', 'M', '1', ' ' );
49  Semaphore_name[ 2 ]     = rtems_build_name( 'S', 'M', '2', ' ' );
50  Semaphore_name[ 3 ]     = rtems_build_name( 'S', 'M', '3', ' ' );
51
52  status = rtems_semaphore_create(
53    Semaphore_name[ 1 ],
54    1,
55    RTEMS_DEFAULT_ATTRIBUTES,
56    RTEMS_NO_PRIORITY,
57    &Semaphore_id[ 1 ]
58  );
59  directive_failed( status, "rtems_semaphore_create of SM1" );
60
61  status = rtems_semaphore_create(
62    Semaphore_name[ 2 ],
63    0,
64    RTEMS_PRIORITY,
65    RTEMS_NO_PRIORITY,
66    &Semaphore_id[ 2 ]
67  );
68  directive_failed( status, "rtems_semaphore_create of SM2" );
69
70  status = rtems_semaphore_create(
71    Semaphore_name[ 3 ],
72    1,
73    RTEMS_DEFAULT_ATTRIBUTES,
74    RTEMS_NO_PRIORITY,
75    &Semaphore_id[ 3 ]
76  );
77  directive_failed( status, "rtems_semaphore_create of SM3" );
78
79  puts( "INIT - Forward priority queue test" );
80  Priority_test_driver( 0 );
81
82  puts( "INIT - Backward priority queue test" );
83  Priority_test_driver( 32 );
84
85pause();
86
87  puts( "INIT - Binary Semaphore and Priority Inheritance Test" );
88
89  status = rtems_semaphore_delete( Semaphore_id[ 2 ] );
90  directive_failed( status, "rtems_semaphore_delete of SM2" );
91
92  puts( "INIT - rtems_semaphore_create - allocated binary semaphore" );
93  status = rtems_semaphore_create(
94    Semaphore_name[ 2 ],
95    0,
96    RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_INHERIT_PRIORITY,
97    RTEMS_NO_PRIORITY,
98    &Semaphore_id[ 2 ]
99  );
100  directive_failed( status, "rtems_semaphore_create of priority inherit SM2" );
101
102  puts( "INIT - rtems_semaphore_release - allocated binary semaphore" );
103  status = rtems_semaphore_release( Semaphore_id[ 2 ] );
104  directive_failed( status, "rtems_semaphore_release of SM2" );
105
106  puts( "INIT - rtems_semaphore_delete - allocated binary semaphore" );
107  status = rtems_semaphore_delete( Semaphore_id[ 2 ] );
108  directive_failed( status, "rtems_semaphore_delete of SM2" );
109
110  status = rtems_semaphore_create(
111    Semaphore_name[ 2 ],
112    1,
113    RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_INHERIT_PRIORITY,
114    RTEMS_NO_PRIORITY,
115    &Semaphore_id[ 2 ]
116  );
117  directive_failed( status, "rtems_semaphore_create of priority inherit SM2" );
118
119  Priority_test_driver( 64 );
120
121pause();
122
123  status = rtems_semaphore_delete( Semaphore_id[ 2 ] );
124  directive_failed( status, "rtems_semaphore_delete of SM2" );
125
126  status = rtems_semaphore_create(
127    Semaphore_name[ 2 ],
128    0,
129    RTEMS_PRIORITY,
130    RTEMS_NO_PRIORITY,
131    &Semaphore_id[ 2 ]
132  );
133  directive_failed( status, "rtems_semaphore_create of priority SM2" );
134
135  status = rtems_semaphore_release( Semaphore_id[ 2 ] );
136  directive_failed( status, "rtems_semaphore_release of SM2" );
137
138  status = rtems_task_create(
139    Task_name[ 1 ],
140    4,
141    2048,
142    RTEMS_DEFAULT_MODES,
143    RTEMS_DEFAULT_ATTRIBUTES,
144    &Task_id[ 1 ]
145  );
146  directive_failed( status, "rtems_task_create of TA1" );
147
148  status = rtems_task_create(
149    Task_name[ 2 ],
150    4,
151    2048,
152    RTEMS_DEFAULT_MODES,
153    RTEMS_DEFAULT_ATTRIBUTES,
154    &Task_id[ 2 ]
155  );
156  directive_failed( status, "rtems_task_create of TA2" );
157
158  status = rtems_task_create(
159    Task_name[ 3 ],
160    4,
161    2048,
162    RTEMS_DEFAULT_MODES,
163    RTEMS_DEFAULT_ATTRIBUTES,
164    &Task_id[ 3 ]
165  );
166  directive_failed( status, "rtems_task_create of TA3" );
167
168  status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
169  directive_failed( status, "rtems_task_start of TA1" );
170
171  status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
172  directive_failed( status, "rtems_task_start of TA2" );
173
174  status = rtems_task_start( Task_id[ 3 ], Task_3, 0 );
175  directive_failed( status, "rtems_task_start of TA3" );
176
177  status = rtems_task_delete( RTEMS_SELF );
178  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
179}
Note: See TracBrowser for help on using the repository browser.