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 | #define TEST_INIT |
---|
26 | #include "system.h" |
---|
27 | |
---|
28 | rtems_task Init( |
---|
29 | rtems_task_argument argument |
---|
30 | ) |
---|
31 | { |
---|
32 | rtems_status_code status; |
---|
33 | rtems_time_of_day time; |
---|
34 | char c; |
---|
35 | |
---|
36 | printf( |
---|
37 | "\n\n*** TEST 1 -- NODE %d ***\n", |
---|
38 | Multiprocessing_configuration.node |
---|
39 | ); |
---|
40 | |
---|
41 | if ( Multiprocessing_configuration.node != 1 ) c = 'S'; |
---|
42 | else c = 'M'; |
---|
43 | |
---|
44 | Task_name[ 1 ] = rtems_build_name( c, 'A', '1', ' ' ); |
---|
45 | Task_name[ 2 ] = rtems_build_name( c, 'A', '2', ' ' ); |
---|
46 | Task_name[ 3 ] = rtems_build_name( c, 'A', '3', ' ' ); |
---|
47 | |
---|
48 | build_time( &time, 12, 31, 1988, 9, 0, 0, 0 ); |
---|
49 | status = rtems_clock_set( &time ); |
---|
50 | directive_failed( status, "rtems_clock_set" ); |
---|
51 | |
---|
52 | puts( "Creating task 1 (Global)" ); |
---|
53 | status = rtems_task_create( |
---|
54 | Task_name[ 1 ], |
---|
55 | 1, |
---|
56 | RTEMS_MINIMUM_STACK_SIZE, |
---|
57 | RTEMS_DEFAULT_MODES, |
---|
58 | RTEMS_GLOBAL, |
---|
59 | &Task_id[ 1 ] |
---|
60 | ); |
---|
61 | directive_failed( status, "rtems_task_create of Task 1" ); |
---|
62 | |
---|
63 | puts( "Creating task 2 (Global)" ); |
---|
64 | status = rtems_task_create( |
---|
65 | Task_name[ 2 ], |
---|
66 | 1, |
---|
67 | RTEMS_MINIMUM_STACK_SIZE, |
---|
68 | RTEMS_TIMESLICE, |
---|
69 | RTEMS_GLOBAL, |
---|
70 | &Task_id[ 2 ] |
---|
71 | ); |
---|
72 | directive_failed( status, "rtems_task_create of Task 2" ); |
---|
73 | |
---|
74 | puts( "Creating task 3 (Local)" ); |
---|
75 | status = rtems_task_create( |
---|
76 | Task_name[ 3 ], |
---|
77 | 1, |
---|
78 | RTEMS_MINIMUM_STACK_SIZE, |
---|
79 | RTEMS_DEFAULT_MODES, |
---|
80 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
81 | &Task_id[ 3 ] |
---|
82 | ); |
---|
83 | directive_failed( status, "rtems_task_create of Task 3" ); |
---|
84 | |
---|
85 | status = rtems_task_start( Task_id[ 1 ], Test_task, 0 ); |
---|
86 | directive_failed( status, "rtems_task_start of Task 1" ); |
---|
87 | |
---|
88 | status = rtems_task_start( Task_id[ 2 ], Test_task, 0 ); |
---|
89 | directive_failed( status, "rtems_task_start of Task 2" ); |
---|
90 | |
---|
91 | status = rtems_task_start( Task_id[ 3 ], Test_task, 0 ); |
---|
92 | directive_failed( status, "rtems_task_start of Task 3" ); |
---|
93 | |
---|
94 | status = rtems_task_delete( RTEMS_SELF ); |
---|
95 | directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); |
---|
96 | } |
---|