source: rtems/testsuites/mptests/mp13/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 May 11, 1995 at 5:39:37 PM

Initial revision

  • Property mode set to 100644
File size: 3.1 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#include "system.h"
26#undef EXTERN
27#define EXTERN
28#include "conftbl.h"
29#include "gvar.h"
30
31rtems_task Init(
32  rtems_task_argument argument
33)
34{
35  rtems_status_code status;
36
37  printf(
38    "\n\n*** TEST 13 -- NODE %d ***\n",
39    Multiprocessing_configuration.node
40  );
41
42  Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' );
43  Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' );
44
45  Queue_name[ 1 ] = rtems_build_name( 'M', 'S', 'G', ' ' );
46
47  Semaphore_name[ 1 ] = rtems_build_name( 'S', 'E', 'M', ' ' );
48
49  if ( Multiprocessing_configuration.node == 1 ) {
50    puts( "Creating Message Queue (Global)" );
51    status = rtems_message_queue_create(
52      Queue_name[ 1 ],
53      3,
54      RTEMS_GLOBAL|RTEMS_LIMIT,
55      &Queue_id[ 1 ]
56    );
57    directive_failed( status, "rtems_message_queue_create" );
58
59    puts( "Creating Semaphore (Global)" );
60    status = rtems_semaphore_create(
61      Semaphore_name[ 1 ],
62      1,
63      RTEMS_GLOBAL | RTEMS_PRIORITY,
64      &Semaphore_id[ 1 ]
65    );
66    directive_failed( status, "rtems_semaphore_create" );
67
68    status = rtems_semaphore_obtain(
69      Semaphore_id[ 1 ],
70      RTEMS_DEFAULT_OPTIONS,
71      RTEMS_NO_TIMEOUT
72    );
73    directive_failed( status, "rtems_semaphore_obtain" );
74  }
75
76  puts( "Creating Test_task 1 (local)" );
77  status = rtems_task_create(
78    Task_name[ 1 ],
79    1,
80    1024,
81    RTEMS_TIMESLICE,
82    RTEMS_DEFAULT_ATTRIBUTES,
83    &Task_id[ 1 ]
84  );
85  directive_failed( status, "rtems_task_create" );
86
87  puts( "Starting Test_task 1 (local)" );
88  status = rtems_task_start( Task_id[ 1 ], Test_task1, 0 );
89  directive_failed( status, "rtems_task_start" );
90
91  puts( "Creating Test_task 2 (local)" );
92  status = rtems_task_create(
93    Task_name[ 2 ],
94    1,
95    1024,
96    RTEMS_TIMESLICE,
97    RTEMS_DEFAULT_ATTRIBUTES,
98    &Task_id[ 2 ]
99  );
100  directive_failed( status, "rtems_task_create" );
101
102  puts( "Starting Test_task 2 (local)" );
103  status = rtems_task_start( Task_id[ 2 ], Test_task2, 0 );
104  directive_failed( status, "rtems_task_start" );
105
106  if ( Multiprocessing_configuration.node == 1 ) {
107    status = rtems_task_wake_after( 5 * TICKS_PER_SECOND );
108    directive_failed( status, "rtems_task_wake_after" );
109
110    puts( "*** END OF TEST 13 ***" );
111    exit( 0 );
112  }
113  puts( "Deleting initialization task" );
114  status = rtems_task_delete( RTEMS_SELF );
115  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
116}
Note: See TracBrowser for help on using the repository browser.