source: rtems/testsuites/mptests/mp13/init.c @ a4bc4d6e

4.115
Last change on this file since a4bc4d6e was a4bc4d6e, checked in by Ralf Corsepius <ralf.corsepius@…>, on 02/22/11 at 10:00:39

Add HAVE_CONFIG_H.

  • 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-2009.
15 *  On-Line Applications Research Corporation (OAR).
16 *
17 *  The license and distribution terms for this file may be
18 *  found in the file LICENSE in this distribution or at
19 *  http://www.rtems.com/license/LICENSE.
20 *
21 *  $Id$
22 */
23
24#ifdef HAVE_CONFIG_H
25#include "config.h"
26#endif
27
28#define CONFIGURE_INIT
29#include "system.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 %" PRId32 " ***\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    RTEMS_MINIMUM_STACK_SIZE,
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    RTEMS_MINIMUM_STACK_SIZE,
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 * rtems_clock_get_ticks_per_second() );
110    directive_failed( status, "rtems_task_wake_after" );
111
112    puts( "*** END OF TEST 13 ***" );
113    rtems_test_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.