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.org/license/LICENSE. |
---|
20 | */ |
---|
21 | |
---|
22 | #ifdef HAVE_CONFIG_H |
---|
23 | #include "config.h" |
---|
24 | #endif |
---|
25 | |
---|
26 | #define CONFIGURE_INIT |
---|
27 | #include "system.h" |
---|
28 | |
---|
29 | rtems_task Init( |
---|
30 | rtems_task_argument argument |
---|
31 | ) |
---|
32 | { |
---|
33 | rtems_status_code status; |
---|
34 | |
---|
35 | printf( |
---|
36 | "\n\n*** TEST 13 -- NODE %" PRId32 " ***\n", |
---|
37 | Multiprocessing_configuration.node |
---|
38 | ); |
---|
39 | |
---|
40 | Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' ); |
---|
41 | Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' ); |
---|
42 | |
---|
43 | Queue_name[ 1 ] = rtems_build_name( 'M', 'S', 'G', ' ' ); |
---|
44 | |
---|
45 | Semaphore_name[ 1 ] = rtems_build_name( 'S', 'E', 'M', ' ' ); |
---|
46 | |
---|
47 | if ( Multiprocessing_configuration.node == 1 ) { |
---|
48 | puts( "Creating Message Queue (Global)" ); |
---|
49 | status = rtems_message_queue_create( |
---|
50 | Queue_name[ 1 ], |
---|
51 | 3, |
---|
52 | 16, |
---|
53 | RTEMS_GLOBAL, |
---|
54 | &Queue_id[ 1 ] |
---|
55 | ); |
---|
56 | directive_failed( status, "rtems_message_queue_create" ); |
---|
57 | |
---|
58 | puts( "Creating Semaphore (Global)" ); |
---|
59 | status = rtems_semaphore_create( |
---|
60 | Semaphore_name[ 1 ], |
---|
61 | 1, |
---|
62 | RTEMS_GLOBAL | RTEMS_PRIORITY, |
---|
63 | RTEMS_NO_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 | RTEMS_MINIMUM_STACK_SIZE, |
---|
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 | RTEMS_MINIMUM_STACK_SIZE, |
---|
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 * rtems_clock_get_ticks_per_second() ); |
---|
108 | directive_failed( status, "rtems_task_wake_after" ); |
---|
109 | |
---|
110 | puts( "*** END OF TEST 13 ***" ); |
---|
111 | rtems_test_exit( 0 ); |
---|
112 | } |
---|
113 | puts( "Deleting initialization task" ); |
---|
114 | rtems_task_exit(); |
---|
115 | } |
---|