source: rtems/c/src/tests/mptests/mp01/init.c @ 5072b07

4.104.114.84.95
Last change on this file since 5072b07 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: 2.7 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  rtems_time_of_day time;
37  char              c;
38
39  printf(
40    "\n\n*** TEST 1 -- NODE %d ***\n",
41    Multiprocessing_configuration.node
42  );
43
44  if ( Multiprocessing_configuration.node != 1 ) c = 'S';
45  else                                           c = 'M';
46
47  Task_name[ 1 ] = rtems_build_name( c, 'A', '1', ' ' );
48  Task_name[ 2 ] = rtems_build_name( c, 'A', '2', ' ' );
49  Task_name[ 3 ] = rtems_build_name( c, 'A', '3', ' ' );
50
51  build_time( &time, 12, 31, 1988, 9, 0, 0, 0 );
52  status = rtems_clock_set( &time );
53  directive_failed( status, "rtems_clock_set" );
54
55  puts( "Creating task 1 (Global)" );
56  status = rtems_task_create(
57    Task_name[ 1 ],
58    1,
59    2048,
60    RTEMS_DEFAULT_MODES,
61    RTEMS_GLOBAL,
62    &Task_id[ 1 ]
63  );
64  directive_failed( status, "rtems_task_create of Task 1" );
65
66  puts( "Creating task 2 (Global)" );
67  status = rtems_task_create(
68    Task_name[ 2 ],
69    1,
70    2048,
71    RTEMS_TIMESLICE,
72    RTEMS_GLOBAL,
73    &Task_id[ 2 ]
74  );
75  directive_failed( status, "rtems_task_create of Task 2" );
76
77  puts( "Creating task 3 (Local)" );
78  status = rtems_task_create(
79    Task_name[ 3 ],
80    1,
81    2048,
82    RTEMS_DEFAULT_MODES,
83    RTEMS_DEFAULT_ATTRIBUTES,
84    &Task_id[ 3 ]
85  );
86  directive_failed( status, "rtems_task_create of Task 3" );
87
88  status = rtems_task_start( Task_id[ 1 ], Test_task, 0 );
89  directive_failed( status, "rtems_task_start of Task 1" );
90
91  status = rtems_task_start( Task_id[ 2 ], Test_task, 0 );
92  directive_failed( status, "rtems_task_start of Task 2" );
93
94  status = rtems_task_start( Task_id[ 3 ], Test_task, 0 );
95  directive_failed( status, "rtems_task_start of Task 3" );
96
97  status = rtems_task_delete( RTEMS_SELF );
98  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
99}
Note: See TracBrowser for help on using the repository browser.