source: rtems/testsuites/mptests/mp13/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 Aug 28, 1995 at 3:30:29 PM

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: 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      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      RTEMS_NO_PRIORITY,
66      &Semaphore_id[ 1 ]
67    );
68    directive_failed( status, "rtems_semaphore_create" );
69
70    status = rtems_semaphore_obtain(
71      Semaphore_id[ 1 ],
72      RTEMS_DEFAULT_OPTIONS,
73      RTEMS_NO_TIMEOUT
74    );
75    directive_failed( status, "rtems_semaphore_obtain" );
76  }
77
78  puts( "Creating Test_task 1 (local)" );
79  status = rtems_task_create(
80    Task_name[ 1 ],
81    1,
82    1024,
83    RTEMS_TIMESLICE,
84    RTEMS_DEFAULT_ATTRIBUTES,
85    &Task_id[ 1 ]
86  );
87  directive_failed( status, "rtems_task_create" );
88
89  puts( "Starting Test_task 1 (local)" );
90  status = rtems_task_start( Task_id[ 1 ], Test_task1, 0 );
91  directive_failed( status, "rtems_task_start" );
92
93  puts( "Creating Test_task 2 (local)" );
94  status = rtems_task_create(
95    Task_name[ 2 ],
96    1,
97    1024,
98    RTEMS_TIMESLICE,
99    RTEMS_DEFAULT_ATTRIBUTES,
100    &Task_id[ 2 ]
101  );
102  directive_failed( status, "rtems_task_create" );
103
104  puts( "Starting Test_task 2 (local)" );
105  status = rtems_task_start( Task_id[ 2 ], Test_task2, 0 );
106  directive_failed( status, "rtems_task_start" );
107
108  if ( Multiprocessing_configuration.node == 1 ) {
109    status = rtems_task_wake_after( 5 * TICKS_PER_SECOND );
110    directive_failed( status, "rtems_task_wake_after" );
111
112    puts( "*** END OF TEST 13 ***" );
113    exit( 0 );
114  }
115  puts( "Deleting initialization task" );
116  status = rtems_task_delete( RTEMS_SELF );
117  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
118}
Note: See TracBrowser for help on using the repository browser.