source: rtems/testsuites/mptests/mp14/init.c @ ac7d5ef0

4.104.114.84.95
Last change on this file since ac7d5ef0 was ac7d5ef0, checked in by Joel Sherrill <joel.sherrill@…>, on 05/11/95 at 17:39:37

Initial revision

  • Property mode set to 100644
File size: 5.2 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 *
22 *  $Id$
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,
97      &Semaphore_id[ 1 ]
98    );
99    directive_failed( status, "rtems_semaphore_create" );
100
101    puts( "Creating Message Queue (Global)" );
102    status = rtems_message_queue_create(
103      Queue_name[ 1 ],
104      1,
105      RTEMS_GLOBAL,
106      &Queue_id[ 1 ]
107    );
108    directive_failed( status, "rtems_message_queue_create" );
109
110    puts( "Creating Partition (Global)" );
111    status = rtems_partition_create(
112      Partition_name[ 1 ],
113      (void *)my_partition,
114      0x8000,
115      0x3800,
116      RTEMS_GLOBAL,
117      &Partition_id[ 1 ]
118    );
119    directive_failed( status, "rtems_partition_create" );
120  }
121
122  puts( "Creating Event task (Global)" );
123  status = rtems_task_create(
124    Task_name[ Multiprocessing_configuration.node ],
125    2,
126    2048,
127    RTEMS_TIMESLICE,
128    RTEMS_GLOBAL,
129    &Event_task_id[ 1 ]
130  );
131  directive_failed( status, "rtems_task_create" );
132
133  puts( "Starting Event task (Global)" );
134  status = rtems_task_start( Event_task_id[ 1 ], Test_task, 0 );
135  directive_failed( status, "rtems_task_start" );
136
137  puts( "Creating Semaphore task (Global)" );
138  status = rtems_task_create(
139    Semaphore_task_name[ Multiprocessing_configuration.node ],
140    2,
141    2048,
142    RTEMS_TIMESLICE,
143    RTEMS_GLOBAL,
144    &Semaphore_task_id[ 1 ]
145  );
146  directive_failed( status, "rtems_task_create" );
147
148  puts( "Starting Semaphore task (Global)" );
149  status = rtems_task_start( Semaphore_task_id[ 1 ], Semaphore_task, 0 );
150  directive_failed( status, "rtems_task_start" );
151
152  puts( "Creating Message Queue task (Global)" );
153  status = rtems_task_create(
154    Queue_task_name[ Multiprocessing_configuration.node ],
155    2,
156    2048,
157    RTEMS_TIMESLICE,
158    RTEMS_GLOBAL,
159    &Queue_task_id[ 1 ]
160  );
161  directive_failed( status, "rtems_task_create" );
162
163  /* argument is index into Buffers */
164  puts( "Starting Message Queue task (Global)" );
165  status = rtems_task_start( Queue_task_id[ 1 ], Message_queue_task, 1 );
166  directive_failed( status, "rtems_task_start" );
167
168  puts( "Creating Partition task (Global)" );
169  status = rtems_task_create(
170    Partition_task_name[ Multiprocessing_configuration.node ],
171    2,
172    2048,
173    RTEMS_TIMESLICE,
174    RTEMS_GLOBAL,
175    &Partition_task_id[ 1 ]
176  );
177  directive_failed( status, "rtems_task_create" );
178
179  puts( "Starting Partition task (Global)" );
180  status = rtems_task_start( Partition_task_id[ 1 ], Partition_task, 0 );
181  directive_failed( status, "rtems_task_start" );
182
183  status = rtems_task_set_priority( RTEMS_SELF, 2, &previous_priority );
184  directive_failed( status, "rtems_task_set_priority" );
185
186  status = rtems_task_ident(
187    RTEMS_SELF,
188    RTEMS_SEARCH_ALL_NODES,
189    &Task_id[ 1 ]
190  );
191  directive_failed( status, "rtems_task_ident" );
192
193  Delayed_events_task( 1 );
194}
Note: See TracBrowser for help on using the repository browser.