source: rtems/testsuites/mptests/mp13/init.c @ 4b374f36

4.104.114.84.95
Last change on this file since 4b374f36 was 4b374f36, checked in by Joel Sherrill <joel.sherrill@…>, on Aug 17, 1995 at 7:36:43 PM

maximum number of messages removed and include statement cleanup

  • Property mode set to 100644
File size: 3.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, 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 *  init.c,v 1.2 1995/05/31 17:04:29 joel Exp
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      16,
55      RTEMS_GLOBAL,
56      &Queue_id[ 1 ]
57    );
58    directive_failed( status, "rtems_message_queue_create" );
59
60    puts( "Creating Semaphore (Global)" );
61    status = rtems_semaphore_create(
62      Semaphore_name[ 1 ],
63      1,
64      RTEMS_GLOBAL | RTEMS_PRIORITY,
65      &Semaphore_id[ 1 ]
66    );
67    directive_failed( status, "rtems_semaphore_create" );
68
69    status = rtems_semaphore_obtain(
70      Semaphore_id[ 1 ],
71      RTEMS_DEFAULT_OPTIONS,
72      RTEMS_NO_TIMEOUT
73    );
74    directive_failed( status, "rtems_semaphore_obtain" );
75  }
76
77  puts( "Creating Test_task 1 (local)" );
78  status = rtems_task_create(
79    Task_name[ 1 ],
80    1,
81    1024,
82    RTEMS_TIMESLICE,
83    RTEMS_DEFAULT_ATTRIBUTES,
84    &Task_id[ 1 ]
85  );
86  directive_failed( status, "rtems_task_create" );
87
88  puts( "Starting Test_task 1 (local)" );
89  status = rtems_task_start( Task_id[ 1 ], Test_task1, 0 );
90  directive_failed( status, "rtems_task_start" );
91
92  puts( "Creating Test_task 2 (local)" );
93  status = rtems_task_create(
94    Task_name[ 2 ],
95    1,
96    1024,
97    RTEMS_TIMESLICE,
98    RTEMS_DEFAULT_ATTRIBUTES,
99    &Task_id[ 2 ]
100  );
101  directive_failed( status, "rtems_task_create" );
102
103  puts( "Starting Test_task 2 (local)" );
104  status = rtems_task_start( Task_id[ 2 ], Test_task2, 0 );
105  directive_failed( status, "rtems_task_start" );
106
107  if ( Multiprocessing_configuration.node == 1 ) {
108    status = rtems_task_wake_after( 5 * TICKS_PER_SECOND );
109    directive_failed( status, "rtems_task_wake_after" );
110
111    puts( "*** END OF TEST 13 ***" );
112    exit( 0 );
113  }
114  puts( "Deleting initialization task" );
115  status = rtems_task_delete( RTEMS_SELF );
116  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
117}
Note: See TracBrowser for help on using the repository browser.