1 | /* Screen2 |
---|
2 | * |
---|
3 | * This routine generates error screen 2 for test 9. |
---|
4 | * |
---|
5 | * Input parameters: NONE |
---|
6 | * |
---|
7 | * Output parameters: NONE |
---|
8 | * |
---|
9 | * COPYRIGHT (c) 1989-2011. |
---|
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 Screen2() |
---|
24 | { |
---|
25 | rtems_time_of_day time; |
---|
26 | rtems_interval interval; |
---|
27 | struct timeval tv; |
---|
28 | rtems_status_code status; |
---|
29 | |
---|
30 | puts( "TA1 - rtems_clock_get_tod - RTEMS_INVALID_ADDRESS" ); |
---|
31 | status = rtems_clock_get_tod( NULL ); |
---|
32 | fatal_directive_status( |
---|
33 | status, |
---|
34 | RTEMS_INVALID_ADDRESS, |
---|
35 | "rtems_clock_get_tod NULL param" |
---|
36 | ); |
---|
37 | |
---|
38 | /* errors before clock is set */ |
---|
39 | |
---|
40 | status = rtems_clock_get_tod( &time ); |
---|
41 | if ( status == RTEMS_SUCCESSFUL ) { |
---|
42 | puts( |
---|
43 | "TA1 - rtems_clock_get_tod - RTEMS_NOT_DEFINED -- " |
---|
44 | "DID BSP SET THE TIME OF DAY?" |
---|
45 | ); |
---|
46 | } else { |
---|
47 | fatal_directive_status( |
---|
48 | status, |
---|
49 | RTEMS_NOT_DEFINED, |
---|
50 | "rtems_clock_get_tod before clock is set #1" |
---|
51 | ); |
---|
52 | puts( "TA1 - rtems_clock_get_tod - RTEMS_NOT_DEFINED" ); |
---|
53 | } |
---|
54 | |
---|
55 | puts( "TA1 - rtems_clock_get_seconds_since_epoch - RTEMS_INVALID_ADDRESS" ); |
---|
56 | status = rtems_clock_get_seconds_since_epoch( NULL ); |
---|
57 | fatal_directive_status( |
---|
58 | status, |
---|
59 | RTEMS_INVALID_ADDRESS, |
---|
60 | "rtems_clock_get_seconds_since_epoch NULL param" |
---|
61 | ); |
---|
62 | |
---|
63 | status = rtems_clock_get_seconds_since_epoch( &interval ); |
---|
64 | if ( status == RTEMS_SUCCESSFUL ) { |
---|
65 | puts( |
---|
66 | "TA1 - rtems_clock_get_seconds_since_epoch - RTEMS_NOT_DEFINED -- " |
---|
67 | "DID BSP SET THE TIME OF DAY?" |
---|
68 | ); |
---|
69 | } else { |
---|
70 | fatal_directive_status( |
---|
71 | status, |
---|
72 | RTEMS_NOT_DEFINED, |
---|
73 | "rtems_clock_get_seconds_before_epoch" |
---|
74 | ); |
---|
75 | puts( "TA1 - rtems_clock_get_seconds_since_epoch - RTEMS_NOT_DEFINED" ); |
---|
76 | } |
---|
77 | |
---|
78 | puts( "TA1 - rtems_clock_get_uptime - RTEMS_INVALID_ADDRESS" ); |
---|
79 | status = rtems_clock_get_uptime( NULL ); |
---|
80 | fatal_directive_status( |
---|
81 | status, |
---|
82 | RTEMS_INVALID_ADDRESS, |
---|
83 | "rtems_clock_get_uptime NULL param" |
---|
84 | ); |
---|
85 | |
---|
86 | puts( "TA1 - rtems_clock_get_tod_timeval - RTEMS_INVALID_ADDRESS" ); |
---|
87 | status = rtems_clock_get_tod_timeval( NULL ); |
---|
88 | fatal_directive_status( |
---|
89 | status, |
---|
90 | RTEMS_INVALID_ADDRESS, |
---|
91 | "rtems_clock_get_tod_timeval NULL param" |
---|
92 | ); |
---|
93 | |
---|
94 | status = rtems_clock_get_tod_timeval( &tv ); |
---|
95 | if ( status == RTEMS_SUCCESSFUL ) { |
---|
96 | puts( |
---|
97 | "TA1 - rtems_clock_get_tod_timeval - RTEMS_NOT_DEFINED -- " |
---|
98 | "DID BSP SET THE TIME OF DAY?" |
---|
99 | ); |
---|
100 | } else { |
---|
101 | fatal_directive_status( |
---|
102 | status, |
---|
103 | RTEMS_NOT_DEFINED, |
---|
104 | "rtems_clock_get_timeval" |
---|
105 | ); |
---|
106 | puts( "TA1 - rtems_clock_get_tod_timeval - RTEMS_NOT_DEFINED" ); |
---|
107 | } |
---|
108 | |
---|
109 | puts( "TA1 - rtems_clock_set_nanoseconds_extension - RTEMS_INVALID_ADDRESS" ); |
---|
110 | status = rtems_clock_set_nanoseconds_extension( NULL ); |
---|
111 | fatal_directive_status( |
---|
112 | status, |
---|
113 | RTEMS_INVALID_ADDRESS, |
---|
114 | "rtems_clock_set_nanoseconds_extension NULL param" |
---|
115 | ); |
---|
116 | |
---|
117 | /* NULL parameter */ |
---|
118 | status = rtems_clock_set( NULL ); |
---|
119 | fatal_directive_status( |
---|
120 | status, |
---|
121 | RTEMS_INVALID_ADDRESS, |
---|
122 | "rtems_clock_set sull pointer" |
---|
123 | ); |
---|
124 | puts( "TA1 - rtems_clock_set - RTEMS_INVALID_ADDRESS" ); |
---|
125 | |
---|
126 | /* wake when NULL param */ |
---|
127 | status = rtems_task_wake_when( NULL ); |
---|
128 | fatal_directive_status( |
---|
129 | status, |
---|
130 | RTEMS_NOT_DEFINED, |
---|
131 | "rtems_task_wake_when NULL param" |
---|
132 | ); |
---|
133 | puts( "TA1 - rtems_task_wake_when - RTEMS_INVALID_ADDRESS" ); |
---|
134 | |
---|
135 | /* wake when before set */ |
---|
136 | status = rtems_task_wake_when( &time ); |
---|
137 | if ( status == RTEMS_SUCCESSFUL ) { |
---|
138 | puts( |
---|
139 | "TA1 - rtems_task_wake_when - RTEMS_NOT_DEFINED -- " |
---|
140 | "DID BSP SET THE TIME OF DAY?" |
---|
141 | ); |
---|
142 | } else { |
---|
143 | fatal_directive_status( |
---|
144 | status, |
---|
145 | RTEMS_NOT_DEFINED, |
---|
146 | "rtems_task_wake_when before clock is set" |
---|
147 | ); |
---|
148 | puts( "TA1 - rtems_task_wake_when - RTEMS_NOT_DEFINED" ); |
---|
149 | } |
---|
150 | |
---|
151 | /* before time set */ |
---|
152 | status = rtems_timer_fire_when( 0, &time, Delayed_routine, NULL ); |
---|
153 | if ( status == RTEMS_SUCCESSFUL ) { |
---|
154 | puts( |
---|
155 | "TA1 - timer_wake_when - RTEMS_NOT_DEFINED -- DID BSP SET THE TIME OF DAY?" |
---|
156 | ); |
---|
157 | } else { |
---|
158 | fatal_directive_status( |
---|
159 | status, |
---|
160 | RTEMS_NOT_DEFINED, |
---|
161 | "task_fire_when before clock is set" |
---|
162 | ); |
---|
163 | puts( "TA1 - rtems_timer_fire_when - RTEMS_NOT_DEFINED" ); |
---|
164 | } |
---|
165 | |
---|
166 | build_time( &time, 2, 5, 1987, 8, 30, 45, 0 ); |
---|
167 | print_time( "TA1 - rtems_clock_set - ", &time, "" ); |
---|
168 | status = rtems_clock_set( &time ); |
---|
169 | fatal_directive_status( |
---|
170 | status, |
---|
171 | RTEMS_INVALID_CLOCK, |
---|
172 | "rtems_clock_set with invalid year" |
---|
173 | ); |
---|
174 | puts( " - RTEMS_INVALID_CLOCK" ); |
---|
175 | |
---|
176 | build_time( &time, 15, 5, 1988, 8, 30, 45, 0 ); |
---|
177 | print_time( "TA1 - rtems_clock_set - ", &time, "" ); |
---|
178 | status = rtems_clock_set( &time ); |
---|
179 | fatal_directive_status( |
---|
180 | status, |
---|
181 | RTEMS_INVALID_CLOCK, |
---|
182 | "rtems_clock_set with invalid month" |
---|
183 | ); |
---|
184 | puts( " - RTEMS_INVALID_CLOCK" ); |
---|
185 | |
---|
186 | build_time( &time, 2, 32, 1988, 8, 30, 45, 0 ); |
---|
187 | print_time( "TA1 - rtems_clock_set - ", &time, "" ); |
---|
188 | status = rtems_clock_set( &time ); |
---|
189 | fatal_directive_status( |
---|
190 | status, |
---|
191 | RTEMS_INVALID_CLOCK, |
---|
192 | "rtems_clock_set with invalid day" |
---|
193 | ); |
---|
194 | puts( " - RTEMS_INVALID_CLOCK" ); |
---|
195 | |
---|
196 | build_time( &time, 2, 5, 1988, 25, 30, 45, 0 ); |
---|
197 | print_time( "TA1 - rtems_clock_set - ", &time, "" ); |
---|
198 | status = rtems_clock_set( &time ); |
---|
199 | fatal_directive_status( |
---|
200 | status, |
---|
201 | RTEMS_INVALID_CLOCK, |
---|
202 | "rtems_clock_set with invalid hour" |
---|
203 | ); |
---|
204 | puts( " - RTEMS_INVALID_CLOCK" ); |
---|
205 | |
---|
206 | build_time( &time, 2, 5, 1988, 8, 61, 45, 0 ); |
---|
207 | print_time( "TA1 - rtems_clock_set - ", &time, "" ); |
---|
208 | status = rtems_clock_set( &time ); |
---|
209 | fatal_directive_status( |
---|
210 | status, |
---|
211 | RTEMS_INVALID_CLOCK, |
---|
212 | "rtems_clock_set with invalid minute" |
---|
213 | ); |
---|
214 | puts( " - RTEMS_INVALID_CLOCK" ); |
---|
215 | |
---|
216 | build_time( &time, 2, 5, 1988, 8, 30, 61, 0 ); |
---|
217 | print_time( "TA1 - rtems_clock_set - ", &time, "" ); |
---|
218 | status = rtems_clock_set( &time ); |
---|
219 | fatal_directive_status( |
---|
220 | status, |
---|
221 | RTEMS_INVALID_CLOCK, |
---|
222 | "rtems_clock_set with invalid second" |
---|
223 | ); |
---|
224 | puts( " - RTEMS_INVALID_CLOCK" ); |
---|
225 | |
---|
226 | build_time( |
---|
227 | &time, 2, 5, 1988, 8, 30, 45, |
---|
228 | rtems_clock_get_ticks_per_second() + 1 |
---|
229 | ); |
---|
230 | print_time( "TA1 - rtems_clock_set - ", &time, "" ); |
---|
231 | status = rtems_clock_set( &time ); |
---|
232 | fatal_directive_status( |
---|
233 | status, |
---|
234 | RTEMS_INVALID_CLOCK, |
---|
235 | "rtems_clock_set with invalid ticks per second" |
---|
236 | ); |
---|
237 | puts( " - RTEMS_INVALID_CLOCK" ); |
---|
238 | |
---|
239 | build_time( &time, 2, 5, 1988, 8, 30, 45, 0 ); |
---|
240 | print_time( "TA1 - rtems_clock_set - ", &time, "" ); |
---|
241 | status = rtems_clock_set( &time ); |
---|
242 | directive_failed( status, "rtems_clock_set successful" ); |
---|
243 | puts( " - RTEMS_SUCCESSFUL" ); |
---|
244 | |
---|
245 | /* rtems_task_wake_when */ |
---|
246 | |
---|
247 | build_time( |
---|
248 | &time, |
---|
249 | 2, 5, 1988, 8, 30, 48, |
---|
250 | rtems_clock_get_ticks_per_second() + 1 |
---|
251 | ); |
---|
252 | time.second += 3; |
---|
253 | puts( "TA1 - rtems_task_wake_when - TICKINVALID - sleep about 3 seconds" ); |
---|
254 | |
---|
255 | /* NULL time */ |
---|
256 | status = rtems_task_wake_when( NULL ); |
---|
257 | fatal_directive_status( |
---|
258 | status, |
---|
259 | RTEMS_INVALID_ADDRESS, |
---|
260 | "rtems_task_wake_when with NULL" |
---|
261 | ); |
---|
262 | puts( "TA1 - rtems_task_wake_when - RTEMS_INVALID_ADDRESS" ); |
---|
263 | |
---|
264 | /* invalid ticks */ |
---|
265 | status = rtems_task_wake_when( &time ); |
---|
266 | directive_failed( |
---|
267 | status, |
---|
268 | "rtems_task_wake_when with invalid ticks per second" |
---|
269 | ); |
---|
270 | puts( "TA1 - rtems_task_wake_when - TICKINVALID - woke up RTEMS_SUCCESSFUL" ); |
---|
271 | |
---|
272 | build_time( &time, 2, 5, 1961, 8, 30, 48, 0 ); |
---|
273 | print_time( "TA1 - rtems_task_wake_when - ", &time, "" ); |
---|
274 | status = rtems_task_wake_when( &time ); |
---|
275 | fatal_directive_status( |
---|
276 | status, |
---|
277 | RTEMS_INVALID_CLOCK, |
---|
278 | "rtems_task_wake_when with invalid year" |
---|
279 | ); |
---|
280 | puts( " - RTEMS_INVALID_CLOCK" ); |
---|
281 | |
---|
282 | build_time( &time, 2, 5, 1988, 25, 30, 48, 0 ); |
---|
283 | print_time( "TA1 - rtems_task_wake_when - ", &time, "" ); |
---|
284 | status = rtems_task_wake_when( &time ); |
---|
285 | fatal_directive_status( |
---|
286 | status, |
---|
287 | RTEMS_INVALID_CLOCK, |
---|
288 | "rtems_task_wake_when with invalid hour" |
---|
289 | ); |
---|
290 | puts( " - RTEMS_INVALID_CLOCK" ); |
---|
291 | |
---|
292 | rtems_clock_get_tod( &time ); |
---|
293 | print_time( "TA1 - current time - ", &time, "\n" ); |
---|
294 | |
---|
295 | time.month = 1; |
---|
296 | print_time( "TA1 - rtems_task_wake_when - ", &time, "" ); |
---|
297 | status = rtems_task_wake_when( &time ); |
---|
298 | fatal_directive_status( |
---|
299 | status, |
---|
300 | RTEMS_INVALID_CLOCK, |
---|
301 | "rtems_task_wake_when before current time" |
---|
302 | ); |
---|
303 | puts( " - RTEMS_INVALID_CLOCK" ); |
---|
304 | } |
---|