1 | /* Screen1 |
---|
2 | * |
---|
3 | * This routine generates error screen 1 for test 9. |
---|
4 | * |
---|
5 | * COPYRIGHT (c) 1989-2009. |
---|
6 | * On-Line Applications Research Corporation (OAR). |
---|
7 | * |
---|
8 | * The license and distribution terms for this file may be |
---|
9 | * found in the file LICENSE in this distribution or at |
---|
10 | * http://www.rtems.com/license/LICENSE. |
---|
11 | * |
---|
12 | * $Id$ |
---|
13 | */ |
---|
14 | |
---|
15 | #include "system.h" |
---|
16 | |
---|
17 | void Screen1() |
---|
18 | { |
---|
19 | uint32_t notepad_value; |
---|
20 | rtems_name task_name; |
---|
21 | rtems_id self_id; |
---|
22 | rtems_task_priority previous_priority; |
---|
23 | rtems_status_code status; |
---|
24 | |
---|
25 | /* bad Id */ |
---|
26 | status = rtems_task_is_suspended( 100 ); |
---|
27 | fatal_directive_status( |
---|
28 | status, |
---|
29 | RTEMS_INVALID_ID, |
---|
30 | "rtems_task_set_priority with illegal id" |
---|
31 | ); |
---|
32 | puts( "TA1 - rtems_task_is_suspended - RTEMS_INVALID_ID" ); |
---|
33 | |
---|
34 | /* bad Id */ |
---|
35 | status = rtems_task_delete( 100 ); |
---|
36 | fatal_directive_status( |
---|
37 | status, |
---|
38 | RTEMS_INVALID_ID, |
---|
39 | "rtems_task_delete with illegal id" |
---|
40 | ); |
---|
41 | puts( "TA1 - rtems_task_delete - RTEMS_INVALID_ID" ); |
---|
42 | |
---|
43 | /* NULL return */ |
---|
44 | status = rtems_task_get_note( RTEMS_SELF, RTEMS_NOTEPAD_FIRST, NULL ); |
---|
45 | fatal_directive_status( |
---|
46 | status, |
---|
47 | RTEMS_INVALID_ADDRESS, |
---|
48 | "rtems_task_get_note with NULL param" |
---|
49 | ); |
---|
50 | puts( "TA1 - rtems_task_get_note - RTEMS_INVALID_ADDRESS" ); |
---|
51 | |
---|
52 | /* note too high */ |
---|
53 | status = rtems_task_get_note( RTEMS_SELF, 100, ¬epad_value ); |
---|
54 | fatal_directive_status( |
---|
55 | status, |
---|
56 | RTEMS_INVALID_NUMBER, |
---|
57 | "rtems_task_get_note with illegal notepad" |
---|
58 | ); |
---|
59 | puts( "TA1 - rtems_task_get_note - RTEMS_INVALID_NUMBER" ); |
---|
60 | |
---|
61 | /* bad Id */ |
---|
62 | status = rtems_task_get_note( 100, RTEMS_NOTEPAD_LAST, ¬epad_value ); |
---|
63 | fatal_directive_status( |
---|
64 | status, |
---|
65 | RTEMS_INVALID_ID, |
---|
66 | "rtems_task_get_note with illegal id" |
---|
67 | ); |
---|
68 | puts( "TA1 - rtems_task_get_note - RTEMS_INVALID_ID" ); |
---|
69 | |
---|
70 | /* unused Id so invalid now */ |
---|
71 | status = rtems_task_get_note( |
---|
72 | _RTEMS_tasks_Information.maximum_id, |
---|
73 | RTEMS_NOTEPAD_LAST, |
---|
74 | ¬epad_value |
---|
75 | ); |
---|
76 | fatal_directive_status( |
---|
77 | status, |
---|
78 | RTEMS_INVALID_ID, |
---|
79 | "rtems_task_get_note with illegal id" |
---|
80 | ); |
---|
81 | puts( "TA1 - rtems_task_get_note - RTEMS_INVALID_ID" ); |
---|
82 | |
---|
83 | status = rtems_task_get_note( |
---|
84 | _RTEMS_tasks_Information.minimum_id + (3L<<OBJECTS_API_START_BIT), |
---|
85 | RTEMS_NOTEPAD_LAST, |
---|
86 | ¬epad_value |
---|
87 | ); |
---|
88 | fatal_directive_status( |
---|
89 | status, |
---|
90 | RTEMS_INVALID_ID, |
---|
91 | "rtems_task_get_note with illegal id" |
---|
92 | ); |
---|
93 | |
---|
94 | status = rtems_task_get_note( |
---|
95 | rtems_build_id( OBJECTS_CLASSIC_API, 2, 1, 1 ), |
---|
96 | RTEMS_NOTEPAD_LAST, |
---|
97 | ¬epad_value |
---|
98 | ); |
---|
99 | fatal_directive_status( |
---|
100 | status, |
---|
101 | RTEMS_INVALID_ID, |
---|
102 | "rtems_task_get_note with non-task ID" |
---|
103 | ); |
---|
104 | |
---|
105 | puts( "TA1 - rtems_task_get_note - RTEMS_INVALID_ID (no tasks in API)" ); |
---|
106 | status = rtems_task_get_note( |
---|
107 | rtems_build_id( OBJECTS_ITRON_API, OBJECTS_ITRON_TASKS, 1, 1 ), |
---|
108 | RTEMS_NOTEPAD_LAST, |
---|
109 | ¬epad_value |
---|
110 | ); |
---|
111 | fatal_directive_status( |
---|
112 | status, |
---|
113 | RTEMS_INVALID_ID, |
---|
114 | "rtems_task_get_note with no tasks in API" |
---|
115 | ); |
---|
116 | |
---|
117 | puts( "TA1 - rtems_object_get_classic_name - bad ID" ); |
---|
118 | status = rtems_object_get_classic_name( |
---|
119 | rtems_build_id( OBJECTS_ITRON_API, OBJECTS_ITRON_TASKS, 1, 1 ), |
---|
120 | &task_name |
---|
121 | ); |
---|
122 | fatal_directive_status( status, RTEMS_INVALID_ID, |
---|
123 | "rtems_object_get_classic_name with no tasks in API" |
---|
124 | ); |
---|
125 | |
---|
126 | /* NULL param */ |
---|
127 | status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, NULL ); |
---|
128 | fatal_directive_status( |
---|
129 | status, |
---|
130 | RTEMS_INVALID_ADDRESS, |
---|
131 | "rtems_task_ident NULL param" |
---|
132 | ); |
---|
133 | puts( "TA1 - rtems_task_ident - RTEMS_INVALID_ADDRESS" ); |
---|
134 | |
---|
135 | /* OK */ |
---|
136 | status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &self_id ); |
---|
137 | directive_failed( status, "rtems_task_ident of self" ); |
---|
138 | if ( self_id != Task_id[ 1 ] ) { |
---|
139 | puts( "ERROR - rtems_task_ident - incorrect ID returned!" ); |
---|
140 | } |
---|
141 | puts( "TA1 - rtems_task_ident - current task RTEMS_SUCCESSFUL" ); |
---|
142 | |
---|
143 | status = rtems_task_ident( 100, RTEMS_SEARCH_ALL_NODES, &Junk_id ); |
---|
144 | fatal_directive_status( |
---|
145 | status, |
---|
146 | RTEMS_INVALID_NAME, |
---|
147 | "rtems_task_ident with illegal name (local)" |
---|
148 | ); |
---|
149 | puts( "TA1 - rtems_task_ident - global RTEMS_INVALID_NAME" ); |
---|
150 | |
---|
151 | status = rtems_task_ident( 100, 1, &Junk_id ); |
---|
152 | fatal_directive_status( |
---|
153 | status, |
---|
154 | RTEMS_INVALID_NAME, |
---|
155 | "rtems_task_ident with illegal name (global)" |
---|
156 | ); |
---|
157 | puts( "TA1 - rtems_task_ident - local RTEMS_INVALID_NAME" ); |
---|
158 | |
---|
159 | /* |
---|
160 | * This one case is different if MP is enabled/disabled. |
---|
161 | */ |
---|
162 | |
---|
163 | status = rtems_task_ident( 100, 2, &Junk_id ); |
---|
164 | #if defined(RTEMS_MULTIPROCESSING) |
---|
165 | fatal_directive_status( |
---|
166 | status, |
---|
167 | RTEMS_INVALID_NODE, |
---|
168 | "rtems_task_ident with illegal node" |
---|
169 | ); |
---|
170 | #else |
---|
171 | fatal_directive_status( |
---|
172 | status, |
---|
173 | RTEMS_INVALID_NAME, |
---|
174 | "rtems_task_ident with illegal node" |
---|
175 | ); |
---|
176 | #endif |
---|
177 | puts( "TA1 - rtems_task_ident - RTEMS_INVALID_NODE" ); |
---|
178 | |
---|
179 | status = rtems_task_restart( 100, 0 ); |
---|
180 | fatal_directive_status( |
---|
181 | status, |
---|
182 | RTEMS_INVALID_ID, |
---|
183 | "rtems_task_restart with illegal id" |
---|
184 | ); |
---|
185 | puts( "TA1 - rtems_task_restart - RTEMS_INVALID_ID" ); |
---|
186 | |
---|
187 | status = rtems_task_resume( 100 ); |
---|
188 | fatal_directive_status( |
---|
189 | status, |
---|
190 | RTEMS_INVALID_ID, |
---|
191 | "rtems_task_resume with illegal id" |
---|
192 | ); |
---|
193 | puts( "TA1 - rtems_task_resume - RTEMS_INVALID_ID" ); |
---|
194 | |
---|
195 | status = rtems_task_resume( RTEMS_SELF ); |
---|
196 | fatal_directive_status( |
---|
197 | status, |
---|
198 | RTEMS_INCORRECT_STATE, |
---|
199 | "rtems_task_resume of ready task" |
---|
200 | ); |
---|
201 | puts( "TA1 - rtems_task_resume - RTEMS_INCORRECT_STATE" ); |
---|
202 | |
---|
203 | /* NULL param */ |
---|
204 | status = rtems_task_set_priority( RTEMS_SELF, RTEMS_CURRENT_PRIORITY, NULL ); |
---|
205 | fatal_directive_status( |
---|
206 | status, |
---|
207 | RTEMS_INVALID_ADDRESS, |
---|
208 | "rtems_task_set_priority with NULL param" |
---|
209 | ); |
---|
210 | puts( "TA1 - rtems_task_set_priority - RTEMS_INVALID_ADDRESS" ); |
---|
211 | |
---|
212 | /* bad priority */ |
---|
213 | status = rtems_task_set_priority( RTEMS_SELF, 512, &previous_priority ); |
---|
214 | fatal_directive_status( |
---|
215 | status, |
---|
216 | RTEMS_INVALID_PRIORITY, |
---|
217 | "rtems_task_set_priority with illegal priority" |
---|
218 | ); |
---|
219 | puts( "TA1 - rtems_task_set_priority - RTEMS_INVALID_PRIORITY" ); |
---|
220 | |
---|
221 | /* bad Id */ |
---|
222 | status = rtems_task_set_priority( 100, 8, &previous_priority ); |
---|
223 | fatal_directive_status( |
---|
224 | status, |
---|
225 | RTEMS_INVALID_ID, |
---|
226 | "rtems_task_set_priority with illegal id" |
---|
227 | ); |
---|
228 | puts( "TA1 - rtems_task_set_priority - RTEMS_INVALID_ID" ); |
---|
229 | |
---|
230 | status = rtems_task_set_note( |
---|
231 | RTEMS_SELF, |
---|
232 | RTEMS_NOTEPAD_LAST+10, |
---|
233 | notepad_value |
---|
234 | ); |
---|
235 | fatal_directive_status( |
---|
236 | status, |
---|
237 | RTEMS_INVALID_NUMBER, |
---|
238 | "rtems_task_set_note with illegal notepad" |
---|
239 | ); |
---|
240 | puts( "TA1 - rtems_task_set_note - RTEMS_INVALID_NUMBER" ); |
---|
241 | |
---|
242 | status = rtems_task_set_note( 100, RTEMS_NOTEPAD_LAST, notepad_value ); |
---|
243 | fatal_directive_status( |
---|
244 | status, |
---|
245 | RTEMS_INVALID_ID, |
---|
246 | "rtems_task_set_note with illegal id" |
---|
247 | ); |
---|
248 | puts( "TA1 - rtems_task_set_note - RTEMS_INVALID_ID" ); |
---|
249 | |
---|
250 | status = rtems_task_start( 100, Task_1, 0 ); |
---|
251 | fatal_directive_status( |
---|
252 | status, |
---|
253 | RTEMS_INVALID_ID, |
---|
254 | "rtems_task_start with illegal id" |
---|
255 | ); |
---|
256 | puts( "TA1 - rtems_task_start - RTEMS_INVALID_ID" ); |
---|
257 | |
---|
258 | /* already started */ |
---|
259 | status = rtems_task_start( RTEMS_SELF, Task_1, 0 ); |
---|
260 | fatal_directive_status( |
---|
261 | status, |
---|
262 | RTEMS_INCORRECT_STATE, |
---|
263 | "rtems_task_start of ready task" |
---|
264 | ); |
---|
265 | puts( "TA1 - rtems_task_start - RTEMS_INCORRECT_STATE" ); |
---|
266 | |
---|
267 | /* bad Id */ |
---|
268 | status = rtems_task_suspend( 100 ); |
---|
269 | fatal_directive_status( |
---|
270 | status, |
---|
271 | RTEMS_INVALID_ID, |
---|
272 | "rtems_task_suspend with illegal id" |
---|
273 | ); |
---|
274 | puts( "TA1 - rtems_task_suspend - RTEMS_INVALID_ID" ); |
---|
275 | |
---|
276 | /* NULL param */ |
---|
277 | status = rtems_task_mode( RTEMS_SELF, 0, NULL ); |
---|
278 | fatal_directive_status( |
---|
279 | status, |
---|
280 | RTEMS_INVALID_ADDRESS, |
---|
281 | "rtems_task_mode with NULL param" |
---|
282 | ); |
---|
283 | puts( "TA1 - rtems_task_mode - RTEMS_INVALID_ADDRESS" ); |
---|
284 | } |
---|