1 | /* SPDX-License-Identifier: BSD-2-Clause */ |
---|
2 | |
---|
3 | /* Init |
---|
4 | * |
---|
5 | * This routine is the initialization task for this test program. |
---|
6 | * It is a user initialization task and has the responsibility for creating |
---|
7 | * and starting the tasks that make up the test. If the time of day |
---|
8 | * clock is required for the test, it should also be set to a known |
---|
9 | * value by this function. |
---|
10 | * |
---|
11 | * Input parameters: |
---|
12 | * argument - task argument |
---|
13 | * |
---|
14 | * Output parameters: NONE |
---|
15 | * |
---|
16 | * COPYRIGHT (c) 1989-1999. |
---|
17 | * On-Line Applications Research Corporation (OAR). |
---|
18 | * |
---|
19 | * Redistribution and use in source and binary forms, with or without |
---|
20 | * modification, are permitted provided that the following conditions |
---|
21 | * are met: |
---|
22 | * 1. Redistributions of source code must retain the above copyright |
---|
23 | * notice, this list of conditions and the following disclaimer. |
---|
24 | * 2. Redistributions in binary form must reproduce the above copyright |
---|
25 | * notice, this list of conditions and the following disclaimer in the |
---|
26 | * documentation and/or other materials provided with the distribution. |
---|
27 | * |
---|
28 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
29 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
30 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
31 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
---|
32 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
33 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
34 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
35 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
36 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
37 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
---|
38 | * POSSIBILITY OF SUCH DAMAGE. |
---|
39 | */ |
---|
40 | |
---|
41 | #ifdef HAVE_CONFIG_H |
---|
42 | #include "config.h" |
---|
43 | #endif |
---|
44 | |
---|
45 | #define CONFIGURE_INIT |
---|
46 | #include "system.h" |
---|
47 | |
---|
48 | const char rtems_test_name[] = "SP 19"; |
---|
49 | |
---|
50 | void thread_switch_extension( Thread_Control *executing, Thread_Control *heir ) |
---|
51 | { |
---|
52 | if ( heir->is_fp ) { |
---|
53 | rtems_print_printer_fprintf_putc( &rtems_test_printer ); |
---|
54 | } else { |
---|
55 | rtems_print_printer_printk( &rtems_test_printer ); |
---|
56 | } |
---|
57 | } |
---|
58 | |
---|
59 | rtems_task Init( |
---|
60 | rtems_task_argument argument |
---|
61 | ) |
---|
62 | { |
---|
63 | rtems_status_code status; |
---|
64 | |
---|
65 | TEST_BEGIN(); |
---|
66 | |
---|
67 | Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); |
---|
68 | Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); |
---|
69 | Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); |
---|
70 | Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' ); |
---|
71 | Task_name[ 5 ] = rtems_build_name( 'T', 'A', '5', ' ' ); |
---|
72 | Task_name[ 6 ] = rtems_build_name( 'F', 'P', '1', ' ' ); |
---|
73 | |
---|
74 | status = rtems_task_create( |
---|
75 | Task_name[ 1 ], |
---|
76 | 2, |
---|
77 | RTEMS_MINIMUM_STACK_SIZE * 4, |
---|
78 | RTEMS_DEFAULT_MODES, |
---|
79 | RTEMS_FLOATING_POINT, |
---|
80 | &Task_id[ 1 ] |
---|
81 | ); |
---|
82 | directive_failed( status, "rtems_task_create of TA1" ); |
---|
83 | |
---|
84 | status = rtems_task_create( |
---|
85 | Task_name[ 2 ], |
---|
86 | 2, |
---|
87 | RTEMS_MINIMUM_STACK_SIZE * 4, |
---|
88 | RTEMS_DEFAULT_MODES, |
---|
89 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
90 | &Task_id[ 2 ] |
---|
91 | ); |
---|
92 | directive_failed( status, "rtems_task_create of TA2" ); |
---|
93 | |
---|
94 | status = rtems_task_create( |
---|
95 | Task_name[ 3 ], |
---|
96 | 2, |
---|
97 | RTEMS_MINIMUM_STACK_SIZE * 4, |
---|
98 | RTEMS_DEFAULT_MODES, |
---|
99 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
100 | &Task_id[ 3 ] |
---|
101 | ); |
---|
102 | directive_failed( status, "rtems_task_create of TA3" ); |
---|
103 | |
---|
104 | status = rtems_task_create( |
---|
105 | Task_name[ 4 ], |
---|
106 | 2, |
---|
107 | RTEMS_MINIMUM_STACK_SIZE * 4, |
---|
108 | RTEMS_DEFAULT_MODES, |
---|
109 | RTEMS_FLOATING_POINT, |
---|
110 | &Task_id[ 4 ] |
---|
111 | ); |
---|
112 | directive_failed( status, "rtems_task_create of TA4" ); |
---|
113 | |
---|
114 | status = rtems_task_create( |
---|
115 | Task_name[ 5 ], |
---|
116 | 2, |
---|
117 | RTEMS_MINIMUM_STACK_SIZE * 4, |
---|
118 | RTEMS_DEFAULT_MODES, |
---|
119 | RTEMS_FLOATING_POINT, |
---|
120 | &Task_id[ 5 ] |
---|
121 | ); |
---|
122 | directive_failed( status, "rtems_task_create of TA5" ); |
---|
123 | |
---|
124 | status = rtems_task_create( |
---|
125 | Task_name[ 6 ], |
---|
126 | 1, |
---|
127 | RTEMS_MINIMUM_STACK_SIZE * 4, |
---|
128 | RTEMS_DEFAULT_MODES, |
---|
129 | RTEMS_FLOATING_POINT, |
---|
130 | &Task_id[ 6 ] |
---|
131 | ); |
---|
132 | directive_failed( status, "rtems_task_create of FP1" ); |
---|
133 | |
---|
134 | status = rtems_task_start( Task_id[ 6 ], First_FP_task, 0 ); |
---|
135 | directive_failed( status, "rtems_task_start of FP1" ); |
---|
136 | |
---|
137 | status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); |
---|
138 | directive_failed( status, "rtems_task_start of TA1" ); |
---|
139 | |
---|
140 | status = rtems_task_start( Task_id[ 2 ], Task_1, 0 ); |
---|
141 | directive_failed( status, "rtems_task_start of TA2" ); |
---|
142 | |
---|
143 | status = rtems_task_start( Task_id[ 3 ], Task_1, 0 ); |
---|
144 | directive_failed( status, "rtems_task_start of TA3" ); |
---|
145 | |
---|
146 | status = rtems_task_start( Task_id[ 4 ], FP_task, 0 ); |
---|
147 | directive_failed( status, "rtems_task_start of TA4" ); |
---|
148 | |
---|
149 | status = rtems_task_start( Task_id[ 5 ], FP_task, 0 ); |
---|
150 | directive_failed( status, "rtems_task_create of TA5" ); |
---|
151 | |
---|
152 | /* |
---|
153 | * Load "task dependent factors" in the context areas |
---|
154 | */ |
---|
155 | |
---|
156 | |
---|
157 | FP_factors[0] = 0.0; |
---|
158 | FP_factors[1] = 1000.1; |
---|
159 | FP_factors[2] = 2000.2; |
---|
160 | FP_factors[3] = 3000.3; |
---|
161 | FP_factors[4] = 4000.4; |
---|
162 | FP_factors[5] = 5000.5; |
---|
163 | FP_factors[6] = 6000.6; |
---|
164 | FP_factors[7] = 7000.7; |
---|
165 | FP_factors[8] = 8000.8; |
---|
166 | FP_factors[9] = 9000.9; |
---|
167 | |
---|
168 | INTEGER_factors[0] = 0x0000; |
---|
169 | INTEGER_factors[1] = 0x1000; |
---|
170 | INTEGER_factors[2] = 0x2000; |
---|
171 | INTEGER_factors[3] = 0x3000; |
---|
172 | INTEGER_factors[4] = 0x4000; |
---|
173 | INTEGER_factors[5] = 0x5000; |
---|
174 | INTEGER_factors[6] = 0x6000; |
---|
175 | INTEGER_factors[7] = 0x7000; |
---|
176 | INTEGER_factors[8] = 0x8000; |
---|
177 | INTEGER_factors[9] = 0x9000; |
---|
178 | |
---|
179 | rtems_task_exit(); |
---|
180 | } |
---|