source: rtems/testsuites/mptests/mp14/init.c @ 7f6a24ab

4.104.114.84.95
Last change on this file since 7f6a24ab was 7f6a24ab, checked in by Joel Sherrill <joel.sherrill@…>, on 08/28/95 at 15:30:29

Added unused priority ceiling parameter to rtems_semaphore_create.

Rearranged code to created thread handler routines to initialize,
start, restart, and "close/delete" a thread.

Made internal threads their own object class. This now uses the
thread support routines for starting and initializing a thread.

Insured deleted tasks are freed to the Inactive pool associated with the
correct Information block.

Added an RTEMS API specific data area to the thread control block.

Beginnings of removing the word "rtems" from the core.

  • Property mode set to 100644
File size: 5.3 KB
RevLine 
[ac7d5ef0]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 *
[3235ad9]22 *  $Id$
[ac7d5ef0]23 */
24
25#include "system.h"
26#undef EXTERN
27#define EXTERN
28#include "conftbl.h"
29#include "gvar.h"
30
31#include "bsp.h"
32
33rtems_unsigned8 my_partition[0x30000] CPU_STRUCTURE_ALIGNMENT;
34
35rtems_timer_service_routine Stop_Test_TSR(
36  rtems_id  ignored_id,
37  void     *ignored_address
38)
39{
40  Stop_Test = TRUE;
41}
42
43rtems_task Init(
44  rtems_task_argument argument
45)
46{
47  rtems_status_code   status;
48  rtems_task_priority previous_priority;
49
50  printf(
51    "\n\n*** TEST 14 -- NODE %d ***\n",
52    Multiprocessing_configuration.node
53  );
54
55  Stop_Test = FALSE;
56
57  status = rtems_timer_create(
58    rtems_build_name('S', 'T', 'O', 'P'),
59    &timer_id
60  );
61  directive_failed( status, "rtems_timer_create" );
62
63  status = rtems_timer_fire_after(
64    timer_id,
65    MAX_LONG_TEST_DURATION * TICKS_PER_SECOND,
66    Stop_Test_TSR,
67    NULL
68  );
69  directive_failed( status, "rtems_timer_fire_after" );
70
71  Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' );
72  Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' );
73
74  Queue_task_name[ 1 ] = rtems_build_name( 'M', 'T', '1', ' ' );
75  Queue_task_name[ 2 ] = rtems_build_name( 'M', 'T', '2', ' ' );
76
77  Partition_task_name[ 1 ] = rtems_build_name( 'P', 'T', '1', ' ' );
78  Partition_task_name[ 2 ] = rtems_build_name( 'P', 'T', '2', ' ' );
79
80  Semaphore_task_name[ 1 ] = rtems_build_name( 'S', 'M', '1', ' ' );
81  Semaphore_task_name[ 2 ] = rtems_build_name( 'S', 'M', '2', ' ' );
82
83  Semaphore_name[ 1 ] =  rtems_build_name( 'S', 'E', 'M', ' ' );
84
85  Queue_name[ 1 ] = rtems_build_name( 'M', 'S', 'G', ' ' );
86
87  Partition_name[ 1 ] = rtems_build_name( 'P', 'A', 'R', ' ' );
88
89  Timer_name[ 1 ] = rtems_build_name( 'T', 'M', 'R', ' ' );
90
91  if ( Multiprocessing_configuration.node == 1 ) {
92    puts( "Creating Semaphore (Global)" );
93    status = rtems_semaphore_create(
94      Semaphore_name[ 1 ],
95      1,
96      RTEMS_GLOBAL,
[7f6a24ab]97      RTEMS_NO_PRIORITY,
[ac7d5ef0]98      &Semaphore_id[ 1 ]
99    );
100    directive_failed( status, "rtems_semaphore_create" );
101
102    puts( "Creating Message Queue (Global)" );
103    status = rtems_message_queue_create(
104      Queue_name[ 1 ],
105      1,
[4b374f36]106      16,
[ac7d5ef0]107      RTEMS_GLOBAL,
108      &Queue_id[ 1 ]
109    );
110    directive_failed( status, "rtems_message_queue_create" );
111
112    puts( "Creating Partition (Global)" );
113    status = rtems_partition_create(
114      Partition_name[ 1 ],
115      (void *)my_partition,
116      0x8000,
117      0x3800,
118      RTEMS_GLOBAL,
119      &Partition_id[ 1 ]
120    );
121    directive_failed( status, "rtems_partition_create" );
122  }
123
124  puts( "Creating Event task (Global)" );
125  status = rtems_task_create(
126    Task_name[ Multiprocessing_configuration.node ],
127    2,
128    2048,
129    RTEMS_TIMESLICE,
130    RTEMS_GLOBAL,
131    &Event_task_id[ 1 ]
132  );
133  directive_failed( status, "rtems_task_create" );
134
135  puts( "Starting Event task (Global)" );
136  status = rtems_task_start( Event_task_id[ 1 ], Test_task, 0 );
137  directive_failed( status, "rtems_task_start" );
138
139  puts( "Creating Semaphore task (Global)" );
140  status = rtems_task_create(
141    Semaphore_task_name[ Multiprocessing_configuration.node ],
142    2,
143    2048,
144    RTEMS_TIMESLICE,
145    RTEMS_GLOBAL,
146    &Semaphore_task_id[ 1 ]
147  );
148  directive_failed( status, "rtems_task_create" );
149
150  puts( "Starting Semaphore task (Global)" );
151  status = rtems_task_start( Semaphore_task_id[ 1 ], Semaphore_task, 0 );
152  directive_failed( status, "rtems_task_start" );
153
154  puts( "Creating Message Queue task (Global)" );
155  status = rtems_task_create(
156    Queue_task_name[ Multiprocessing_configuration.node ],
157    2,
158    2048,
159    RTEMS_TIMESLICE,
160    RTEMS_GLOBAL,
161    &Queue_task_id[ 1 ]
162  );
163  directive_failed( status, "rtems_task_create" );
164
165  /* argument is index into Buffers */
166  puts( "Starting Message Queue task (Global)" );
167  status = rtems_task_start( Queue_task_id[ 1 ], Message_queue_task, 1 );
168  directive_failed( status, "rtems_task_start" );
169
170  puts( "Creating Partition task (Global)" );
171  status = rtems_task_create(
172    Partition_task_name[ Multiprocessing_configuration.node ],
173    2,
174    2048,
175    RTEMS_TIMESLICE,
176    RTEMS_GLOBAL,
177    &Partition_task_id[ 1 ]
178  );
179  directive_failed( status, "rtems_task_create" );
180
181  puts( "Starting Partition task (Global)" );
182  status = rtems_task_start( Partition_task_id[ 1 ], Partition_task, 0 );
183  directive_failed( status, "rtems_task_start" );
184
185  status = rtems_task_set_priority( RTEMS_SELF, 2, &previous_priority );
186  directive_failed( status, "rtems_task_set_priority" );
187
188  status = rtems_task_ident(
189    RTEMS_SELF,
190    RTEMS_SEARCH_ALL_NODES,
191    &Task_id[ 1 ]
192  );
193  directive_failed( status, "rtems_task_ident" );
194
195  Delayed_events_task( 1 );
196}
Note: See TracBrowser for help on using the repository browser.