1 | /* Screen14 |
---|
2 | * |
---|
3 | * This routine generates error screen 14 for test 9. |
---|
4 | * |
---|
5 | * Input parameters: NONE |
---|
6 | * |
---|
7 | * Output parameters: NONE |
---|
8 | * |
---|
9 | * COPYRIGHT (c) 1989-2009. |
---|
10 | * On-Line Applications Research Corporation (OAR). |
---|
11 | * |
---|
12 | * The license and distribution terms for this file may be |
---|
13 | * found in the file LICENSE in this distribution or at |
---|
14 | * http://www.rtems.com/license/LICENSE. |
---|
15 | */ |
---|
16 | |
---|
17 | #ifdef HAVE_CONFIG_H |
---|
18 | #include "config.h" |
---|
19 | #endif |
---|
20 | |
---|
21 | #include "system.h" |
---|
22 | |
---|
23 | void Screen14() |
---|
24 | { |
---|
25 | rtems_status_code status; |
---|
26 | rtems_time_of_day time; |
---|
27 | rtems_timer_information timer_info; |
---|
28 | bool skipUnsatisfied; |
---|
29 | |
---|
30 | /* NULL Id */ |
---|
31 | status = rtems_timer_create( Timer_name[ 1 ], NULL ); |
---|
32 | fatal_directive_status( |
---|
33 | status, |
---|
34 | RTEMS_INVALID_ADDRESS, |
---|
35 | "rtems_timer_create NULL param" |
---|
36 | ); |
---|
37 | puts( "TA1 - rtems_timer_create - RTEMS_INVALID_ADDRESS" ); |
---|
38 | |
---|
39 | /* bad name */ |
---|
40 | status = rtems_timer_create( 0, &Junk_id ); |
---|
41 | fatal_directive_status( |
---|
42 | status, |
---|
43 | RTEMS_INVALID_NAME, |
---|
44 | "rtems_timer_create with illegal name" |
---|
45 | ); |
---|
46 | puts( "TA1 - rtems_timer_create - RTEMS_INVALID_NAME" ); |
---|
47 | |
---|
48 | /* OK */ |
---|
49 | status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] ); |
---|
50 | directive_failed( status, "rtems_timer_create" ); |
---|
51 | puts( "TA1 - rtems_timer_create - 1 - RTEMS_SUCCESSFUL" ); |
---|
52 | |
---|
53 | status = rtems_timer_create( 2, &Junk_id ); |
---|
54 | fatal_directive_status( |
---|
55 | status, |
---|
56 | RTEMS_TOO_MANY, |
---|
57 | "rtems_timer_create for too many" |
---|
58 | ); |
---|
59 | puts( "TA1 - rtems_timer_create - 2 - RTEMS_TOO_MANY" ); |
---|
60 | |
---|
61 | status = rtems_timer_delete( 100 ); |
---|
62 | fatal_directive_status( |
---|
63 | status, |
---|
64 | RTEMS_INVALID_ID, |
---|
65 | "rtems_timer_delete with illegal id" |
---|
66 | ); |
---|
67 | puts( "TA1 - rtems_timer_delete - local RTEMS_INVALID_ID" ); |
---|
68 | |
---|
69 | status = rtems_timer_delete( rtems_build_id( 1, 1, 1, 256 ) ); |
---|
70 | fatal_directive_status( |
---|
71 | status, |
---|
72 | RTEMS_INVALID_ID, |
---|
73 | "rtems_timer_delete with illegal id" |
---|
74 | ); |
---|
75 | puts( "TA1 - rtems_timer_delete - global RTEMS_INVALID_ID" ); |
---|
76 | |
---|
77 | status = rtems_timer_ident( 0, &Junk_id ); |
---|
78 | fatal_directive_status( |
---|
79 | status, |
---|
80 | RTEMS_INVALID_NAME, |
---|
81 | "rtems_timer_ident with illegal name" |
---|
82 | ); |
---|
83 | puts( "TA1 - rtems_timer_ident - RTEMS_INVALID_NAME" ); |
---|
84 | |
---|
85 | status = rtems_timer_cancel( rtems_build_id( 1, 1, 1, 256 ) ); |
---|
86 | fatal_directive_status( |
---|
87 | status, |
---|
88 | RTEMS_INVALID_ID, |
---|
89 | "rtems_timer_cancel with illegal id" |
---|
90 | ); |
---|
91 | puts( "TA1 - rtems_timer_cancel - RTEMS_INVALID_ID" ); |
---|
92 | |
---|
93 | status = rtems_timer_reset( rtems_build_id( 1, 1, 1, 256 ) ); |
---|
94 | fatal_directive_status( |
---|
95 | status, |
---|
96 | RTEMS_INVALID_ID, |
---|
97 | "rtems_timer_reset with illegal id" |
---|
98 | ); |
---|
99 | puts( "TA1 - rtems_timer_reset - RTEMS_INVALID_ID" ); |
---|
100 | |
---|
101 | status = rtems_timer_reset( Timer_id[ 1 ] ); |
---|
102 | fatal_directive_status( |
---|
103 | status, |
---|
104 | RTEMS_NOT_DEFINED, |
---|
105 | "rtems_timer_reset before initiated" |
---|
106 | ); |
---|
107 | puts( "TA1 - rtems_timer_reset - RTEMS_NOT_DEFINED" ); |
---|
108 | |
---|
109 | /* bad id */ |
---|
110 | status = rtems_timer_fire_after( |
---|
111 | rtems_build_id( 1, 1, 1, 256 ), |
---|
112 | 5 * rtems_clock_get_ticks_per_second(), |
---|
113 | Delayed_routine, |
---|
114 | NULL |
---|
115 | ); |
---|
116 | fatal_directive_status( |
---|
117 | status, |
---|
118 | RTEMS_INVALID_ID, |
---|
119 | "rtems_timer_fire_after illegal id" |
---|
120 | ); |
---|
121 | puts( "TA1 - rtems_timer_fire_after - RTEMS_INVALID_ID" ); |
---|
122 | |
---|
123 | /* bad id */ |
---|
124 | build_time( &time, 12, 31, 1994, 9, 0, 0, 0 ); |
---|
125 | status = rtems_timer_fire_when( |
---|
126 | rtems_build_id( 1, 1, 1, 256 ), |
---|
127 | &time, |
---|
128 | Delayed_routine, |
---|
129 | NULL |
---|
130 | ); |
---|
131 | fatal_directive_status( |
---|
132 | status, |
---|
133 | RTEMS_INVALID_ID, |
---|
134 | "rtems_timer_fire_when with illegal id" |
---|
135 | ); |
---|
136 | puts( "TA1 - rtems_timer_fire_when - RTEMS_INVALID_ID" ); |
---|
137 | |
---|
138 | /* NULL routine */ |
---|
139 | status = rtems_timer_fire_after( Timer_id[ 1 ], 1, NULL, NULL ); |
---|
140 | fatal_directive_status( |
---|
141 | status, |
---|
142 | RTEMS_INVALID_ADDRESS, |
---|
143 | "rtems_timer_fire_after with NULL handler" |
---|
144 | ); |
---|
145 | puts( "TA1 - rtems_timer_fire_after - RTEMS_INVALID_ADDRESS" ); |
---|
146 | |
---|
147 | /* 0 ticks */ |
---|
148 | status = rtems_timer_fire_after( Timer_id[ 1 ], 0, Delayed_routine, NULL ); |
---|
149 | fatal_directive_status( |
---|
150 | status, |
---|
151 | RTEMS_INVALID_NUMBER, |
---|
152 | "rtems_timer_fire_after with 0 ticks" |
---|
153 | ); |
---|
154 | puts( "TA1 - rtems_timer_fire_after - RTEMS_INVALID_NUMBER" ); |
---|
155 | |
---|
156 | /* NULL routine */ |
---|
157 | status = rtems_timer_fire_when( Timer_id[ 1 ], &time, NULL, NULL ); |
---|
158 | fatal_directive_status( |
---|
159 | status, |
---|
160 | RTEMS_INVALID_ADDRESS, |
---|
161 | "rtems_timer_fire_when with NULL handler" |
---|
162 | ); |
---|
163 | puts( "TA1 - rtems_timer_fire_when - RTEMS_INVALID_ADDRESS" ); |
---|
164 | |
---|
165 | /* invalid time -- before RTEMS epoch */ |
---|
166 | build_time( &time, 2, 5, 1987, 8, 30, 45, 0 ); |
---|
167 | status = rtems_timer_fire_when( Timer_id[ 1 ], &time, Delayed_routine, NULL ); |
---|
168 | fatal_directive_status( |
---|
169 | status, |
---|
170 | RTEMS_INVALID_CLOCK, |
---|
171 | "rtems_timer_fire_when with illegal time" |
---|
172 | ); |
---|
173 | print_time( |
---|
174 | "TA1 - rtems_timer_fire_when - ", |
---|
175 | &time, |
---|
176 | " - RTEMS_INVALID_CLOCK\n" |
---|
177 | ); |
---|
178 | |
---|
179 | status = rtems_clock_get_tod( &time ); |
---|
180 | directive_failed( status, "rtems_clock_get_tod" ); |
---|
181 | print_time( "TA1 - rtems_clock_get_tod - ", &time, "\n" ); |
---|
182 | |
---|
183 | build_time( &time, 2, 5, 1990, 8, 30, 45, 0 ); |
---|
184 | status = rtems_timer_fire_when( Timer_id[ 1 ], &time, Delayed_routine, NULL ); |
---|
185 | fatal_directive_status( |
---|
186 | status, |
---|
187 | RTEMS_INVALID_CLOCK, |
---|
188 | "rtems_timer_fire_when before current time" |
---|
189 | ); |
---|
190 | print_time( |
---|
191 | "TA1 - rtems_timer_fire_when - ", |
---|
192 | &time, |
---|
193 | " - before RTEMS_INVALID_CLOCK\n" |
---|
194 | ); |
---|
195 | |
---|
196 | /* null param */ |
---|
197 | status = rtems_timer_get_information( Timer_id[ 1 ], NULL ); |
---|
198 | fatal_directive_status( |
---|
199 | status, |
---|
200 | RTEMS_INVALID_ADDRESS, |
---|
201 | "rtems_timer_get_information with NULL param" |
---|
202 | ); |
---|
203 | puts( "TA1 - rtems_timer_get_information - RTEMS_INVALID_ADDRESS" ); |
---|
204 | |
---|
205 | /* invalid id */ |
---|
206 | status = rtems_timer_get_information( 100, &timer_info ); |
---|
207 | fatal_directive_status( |
---|
208 | status, |
---|
209 | RTEMS_INVALID_ID, |
---|
210 | "rtems_timer_get_information with illegal id" |
---|
211 | ); |
---|
212 | puts( "TA1 - rtems_timer_get_information - RTEMS_INVALID_ID" ); |
---|
213 | |
---|
214 | /* timer server interface routines */ |
---|
215 | |
---|
216 | /* incorrect state */ |
---|
217 | status = rtems_timer_server_fire_after( 0, 5, NULL, NULL ); |
---|
218 | fatal_directive_status( |
---|
219 | status, |
---|
220 | RTEMS_INCORRECT_STATE, |
---|
221 | "rtems_timer_server_fire_after incorrect state" |
---|
222 | ); |
---|
223 | puts( "TA1 - rtems_timer_server_fire_after - RTEMS_INCORRECT_STATE" ); |
---|
224 | |
---|
225 | /* incorrect state */ |
---|
226 | status = rtems_timer_server_fire_when( 0, &time, NULL, NULL ); |
---|
227 | fatal_directive_status( |
---|
228 | status, |
---|
229 | RTEMS_INCORRECT_STATE, |
---|
230 | "rtems_timer_server_fire_when incorrect state" |
---|
231 | ); |
---|
232 | puts( "TA1 - rtems_timer_server_fire_when - RTEMS_INCORRECT_STATE" ); |
---|
233 | |
---|
234 | /* invalid priority */ |
---|
235 | status = rtems_timer_initiate_server( 0, 0, 0 ); |
---|
236 | fatal_directive_status( |
---|
237 | status, |
---|
238 | RTEMS_INVALID_PRIORITY, |
---|
239 | "rtems_timer_initiate_server invalid priority" |
---|
240 | ); |
---|
241 | puts( "TA1 - rtems_timer_initiate_server - RTEMS_INVALID_PRIORITY" ); |
---|
242 | |
---|
243 | skipUnsatisfied = false; |
---|
244 | #if defined(__m32c__) |
---|
245 | skipUnsatisfied = true; |
---|
246 | #endif |
---|
247 | if (skipUnsatisfied) { |
---|
248 | puts( "TA1 - rtems_timer_initiate_server - RTEMS_UNSATISFIED -- SKIPPED" ); |
---|
249 | } else { |
---|
250 | status = rtems_timer_initiate_server( |
---|
251 | RTEMS_TIMER_SERVER_DEFAULT_PRIORITY, |
---|
252 | 0x10000000, |
---|
253 | 0 |
---|
254 | ); |
---|
255 | fatal_directive_status( |
---|
256 | status, |
---|
257 | RTEMS_UNSATISFIED, |
---|
258 | "rtems_timer_initiate_server too much stack " |
---|
259 | ); |
---|
260 | puts( "TA1 - rtems_timer_initiate_server - RTEMS_UNSATISFIED" ); |
---|
261 | } |
---|
262 | |
---|
263 | status = |
---|
264 | rtems_timer_initiate_server( RTEMS_TIMER_SERVER_DEFAULT_PRIORITY, 0, 0 ); |
---|
265 | directive_failed( status, "rtems_timer_initiate_server" ); |
---|
266 | puts( "TA1 - rtems_timer_initiate_server - SUCCESSFUL" ); |
---|
267 | |
---|
268 | /* NULL routine */ |
---|
269 | status = rtems_timer_server_fire_after( Timer_id[ 1 ], 1, NULL, NULL ); |
---|
270 | fatal_directive_status( |
---|
271 | status, |
---|
272 | RTEMS_INVALID_ADDRESS, |
---|
273 | "rtems_timer_server_fire_after NULL routine" |
---|
274 | ); |
---|
275 | puts( "TA1 - rtems_timer_server_fire_after - RTEMS_INVALID_ADDRESS" ); |
---|
276 | |
---|
277 | /* bad Id */ |
---|
278 | status = rtems_timer_server_fire_after( |
---|
279 | rtems_build_id( 1, 1, 1, 256 ), |
---|
280 | 5 * rtems_clock_get_ticks_per_second(), |
---|
281 | Delayed_routine, |
---|
282 | NULL |
---|
283 | ); |
---|
284 | fatal_directive_status( |
---|
285 | status, |
---|
286 | RTEMS_INVALID_ID, |
---|
287 | "rtems_timer_server_fire_after illegal id" |
---|
288 | ); |
---|
289 | puts( "TA1 - rtems_timer_server_fire_after - RTEMS_INVALID_ID" ); |
---|
290 | |
---|
291 | /* bad id */ |
---|
292 | build_time( &time, 12, 31, 1994, 9, 0, 0, 0 ); |
---|
293 | status = rtems_timer_server_fire_when( |
---|
294 | rtems_build_id( 1, 1, 1, 256 ), |
---|
295 | &time, |
---|
296 | Delayed_routine, |
---|
297 | NULL |
---|
298 | ); |
---|
299 | fatal_directive_status( |
---|
300 | status, |
---|
301 | RTEMS_INVALID_ID, |
---|
302 | "rtems_timer_server_fire_when with illegal id" |
---|
303 | ); |
---|
304 | puts( "TA1 - rtems_timer_server_fire_when - RTEMS_INVALID_ID" ); |
---|
305 | |
---|
306 | /* NULL routine */ |
---|
307 | status = rtems_timer_server_fire_after( Timer_id[ 1 ], 1, NULL, NULL ); |
---|
308 | fatal_directive_status( |
---|
309 | status, |
---|
310 | RTEMS_INVALID_ADDRESS, |
---|
311 | "rtems_timer_server_fire_after NULL routine" |
---|
312 | ); |
---|
313 | puts( "TA1 - rtems_timer_server_fire_after - RTEMS_INVALID_ADDRESS" ); |
---|
314 | |
---|
315 | /* 0 ticks */ |
---|
316 | status = rtems_timer_server_fire_after( |
---|
317 | Timer_id[ 1 ], 0, Delayed_routine, NULL ); |
---|
318 | fatal_directive_status( |
---|
319 | status, |
---|
320 | RTEMS_INVALID_NUMBER, |
---|
321 | "rtems_timer_server_fire_after with 0 ticks" |
---|
322 | ); |
---|
323 | puts( "TA1 - rtems_timer_server_fire_after - RTEMS_INVALID_NUMBER" ); |
---|
324 | |
---|
325 | /* illegal time */ |
---|
326 | build_time( &time, 2, 5, 1987, 8, 30, 45, 0 ); |
---|
327 | status = rtems_timer_server_fire_when( |
---|
328 | Timer_id[ 1 ], &time, Delayed_routine, NULL ); |
---|
329 | fatal_directive_status( |
---|
330 | status, |
---|
331 | RTEMS_INVALID_CLOCK, |
---|
332 | "rtems_timer_server_fire_when with illegal time" |
---|
333 | ); |
---|
334 | print_time( |
---|
335 | "TA1 - rtems_timer_server_fire_when - ", |
---|
336 | &time, |
---|
337 | " - RTEMS_INVALID_CLOCK\n" |
---|
338 | ); |
---|
339 | |
---|
340 | status = rtems_clock_get_tod( &time ); |
---|
341 | directive_failed( status, "rtems_clock_get_tod" ); |
---|
342 | print_time( "TA1 - rtems_clock_get_tod - ", &time, "\n" ); |
---|
343 | |
---|
344 | /* when NULL routine */ |
---|
345 | status = rtems_timer_server_fire_when( Timer_id[ 1 ], &time, NULL, NULL ); |
---|
346 | fatal_directive_status( |
---|
347 | status, |
---|
348 | RTEMS_INVALID_ADDRESS, |
---|
349 | "rtems_timer_server_fire_when NULL routine" |
---|
350 | ); |
---|
351 | puts( "TA1 - rtems_timer_server_fire_when - RTEMS_INVALID_ADDRESS" ); |
---|
352 | |
---|
353 | /* before current time */ |
---|
354 | build_time( &time, 2, 5, 1990, 8, 30, 45, 0 ); |
---|
355 | status = rtems_timer_server_fire_when( |
---|
356 | Timer_id[ 1 ], &time, Delayed_routine, NULL ); |
---|
357 | fatal_directive_status( |
---|
358 | status, |
---|
359 | RTEMS_INVALID_CLOCK, |
---|
360 | "rtems_timer_server_fire_when before current time" |
---|
361 | ); |
---|
362 | print_time( |
---|
363 | "TA1 - rtems_timer_server_fire_when - ", |
---|
364 | &time, |
---|
365 | " - before RTEMS_INVALID_CLOCK\n" |
---|
366 | ); |
---|
367 | |
---|
368 | } |
---|