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-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 | * $Id$ |
---|
17 | */ |
---|
18 | |
---|
19 | #include "system.h" |
---|
20 | |
---|
21 | void Screen2() |
---|
22 | { |
---|
23 | rtems_time_of_day time; |
---|
24 | rtems_interval interval; |
---|
25 | struct timeval tv; |
---|
26 | rtems_status_code status; |
---|
27 | |
---|
28 | /* errors before clock is set */ |
---|
29 | |
---|
30 | status = rtems_clock_get_tod( &time ); |
---|
31 | if ( status == RTEMS_SUCCESSFUL ) { |
---|
32 | puts( |
---|
33 | "TA1 - rtems_clock_get_tod - RTEMS_NOT_DEFINED -- " |
---|
34 | "DID BSP SET THE TIME OF DAY?" |
---|
35 | ); |
---|
36 | } else { |
---|
37 | fatal_directive_status( |
---|
38 | status, |
---|
39 | RTEMS_NOT_DEFINED, |
---|
40 | "rtems_clock_get_tod before clock is set #1" |
---|
41 | ); |
---|
42 | puts( "TA1 - rtems_clock_get_tod - RTEMS_NOT_DEFINED" ); |
---|
43 | } |
---|
44 | |
---|
45 | status = rtems_clock_get_seconds_since_epoch( &interval ); |
---|
46 | if ( status == RTEMS_SUCCESSFUL ) { |
---|
47 | puts( |
---|
48 | "TA1 - rtems_clock_get_seconds_since_epoch - RTEMS_NOT_DEFINED -- " |
---|
49 | "DID BSP SET THE TIME OF DAY?" |
---|
50 | ); |
---|
51 | } else { |
---|
52 | fatal_directive_status( |
---|
53 | status, |
---|
54 | RTEMS_NOT_DEFINED, |
---|
55 | "rtems_clock_get_seconds_before_epoch" |
---|
56 | ); |
---|
57 | puts( "TA1 - rtems_clock_get_seconds_since_epoch - RTEMS_NOT_DEFINED" ); |
---|
58 | } |
---|
59 | |
---|
60 | status = rtems_clock_get_tod_timeval( &tv ); |
---|
61 | if ( status == RTEMS_SUCCESSFUL ) { |
---|
62 | puts( |
---|
63 | "TA1 - rtems_clock_get_tod_timeval - RTEMS_NOT_DEFINED -- " |
---|
64 | "DID BSP SET THE TIME OF DAY?" |
---|
65 | ); |
---|
66 | } else { |
---|
67 | fatal_directive_status( |
---|
68 | status, |
---|
69 | RTEMS_NOT_DEFINED, |
---|
70 | "rtems_clock_get_timeval" |
---|
71 | ); |
---|
72 | puts( "TA1 - rtems_clock_get_tod_timeval - RTEMS_NOT_DEFINED" ); |
---|
73 | } |
---|
74 | |
---|
75 | /* arbitrary bad value for switch */ |
---|
76 | status = rtems_clock_get( 0x100, &tv ); |
---|
77 | fatal_directive_status( |
---|
78 | status, |
---|
79 | RTEMS_INVALID_NUMBER, |
---|
80 | "rtems_clock_get bad case" |
---|
81 | ); |
---|
82 | puts( "TA1 - rtems_clock_get - RTEMS_INVALID_NUMBER" ); |
---|
83 | |
---|
84 | status = rtems_task_wake_when( &time ); |
---|
85 | if ( status == RTEMS_SUCCESSFUL ) { |
---|
86 | puts( |
---|
87 | "TA1 - rtems_clock_get - RTEMS_NOT_DEFINED -- " |
---|
88 | "DID BSP SET THE TIME OF DAY?" |
---|
89 | ); |
---|
90 | } else { |
---|
91 | fatal_directive_status( |
---|
92 | status, |
---|
93 | RTEMS_NOT_DEFINED, |
---|
94 | "rtems_task_wake_when before clock is set" |
---|
95 | ); |
---|
96 | puts( "TA1 - rtems_task_wake_when - RTEMS_NOT_DEFINED" ); |
---|
97 | } |
---|
98 | |
---|
99 | status = rtems_timer_fire_when( 0, &time, Delayed_routine, NULL ); |
---|
100 | if ( status == RTEMS_SUCCESSFUL ) { |
---|
101 | puts( |
---|
102 | "TA1 - timer_wake_when - RTEMS_NOT_DEFINED -- DID BSP SET THE TIME OF DAY?" |
---|
103 | ); |
---|
104 | } else { |
---|
105 | fatal_directive_status( |
---|
106 | status, |
---|
107 | RTEMS_NOT_DEFINED, |
---|
108 | "task_fire_when before clock is set" |
---|
109 | ); |
---|
110 | puts( "TA1 - rtems_timer_fire_when - RTEMS_NOT_DEFINED" ); |
---|
111 | } |
---|
112 | |
---|
113 | build_time( &time, 2, 5, 1987, 8, 30, 45, 0 ); |
---|
114 | print_time( "TA1 - rtems_clock_set - ", &time, "" ); |
---|
115 | status = rtems_clock_set( &time ); |
---|
116 | fatal_directive_status( |
---|
117 | status, |
---|
118 | RTEMS_INVALID_CLOCK, |
---|
119 | "rtems_clock_set with invalid year" |
---|
120 | ); |
---|
121 | puts( " - RTEMS_INVALID_CLOCK" ); |
---|
122 | |
---|
123 | build_time( &time, 15, 5, 1988, 8, 30, 45, 0 ); |
---|
124 | print_time( "TA1 - rtems_clock_set - ", &time, "" ); |
---|
125 | status = rtems_clock_set( &time ); |
---|
126 | fatal_directive_status( |
---|
127 | status, |
---|
128 | RTEMS_INVALID_CLOCK, |
---|
129 | "rtems_clock_set with invalid month" |
---|
130 | ); |
---|
131 | puts( " - RTEMS_INVALID_CLOCK" ); |
---|
132 | |
---|
133 | build_time( &time, 2, 32, 1988, 8, 30, 45, 0 ); |
---|
134 | print_time( "TA1 - rtems_clock_set - ", &time, "" ); |
---|
135 | status = rtems_clock_set( &time ); |
---|
136 | fatal_directive_status( |
---|
137 | status, |
---|
138 | RTEMS_INVALID_CLOCK, |
---|
139 | "rtems_clock_set with invalid day" |
---|
140 | ); |
---|
141 | puts( " - RTEMS_INVALID_CLOCK" ); |
---|
142 | |
---|
143 | build_time( &time, 2, 5, 1988, 25, 30, 45, 0 ); |
---|
144 | print_time( "TA1 - rtems_clock_set - ", &time, "" ); |
---|
145 | status = rtems_clock_set( &time ); |
---|
146 | fatal_directive_status( |
---|
147 | status, |
---|
148 | RTEMS_INVALID_CLOCK, |
---|
149 | "rtems_clock_set with invalid hour" |
---|
150 | ); |
---|
151 | puts( " - RTEMS_INVALID_CLOCK" ); |
---|
152 | |
---|
153 | build_time( &time, 2, 5, 1988, 8, 61, 45, 0 ); |
---|
154 | print_time( "TA1 - rtems_clock_set - ", &time, "" ); |
---|
155 | status = rtems_clock_set( &time ); |
---|
156 | fatal_directive_status( |
---|
157 | status, |
---|
158 | RTEMS_INVALID_CLOCK, |
---|
159 | "rtems_clock_set with invalid minute" |
---|
160 | ); |
---|
161 | puts( " - RTEMS_INVALID_CLOCK" ); |
---|
162 | |
---|
163 | build_time( &time, 2, 5, 1988, 8, 30, 61, 0 ); |
---|
164 | print_time( "TA1 - rtems_clock_set - ", &time, "" ); |
---|
165 | status = rtems_clock_set( &time ); |
---|
166 | fatal_directive_status( |
---|
167 | status, |
---|
168 | RTEMS_INVALID_CLOCK, |
---|
169 | "rtems_clock_set with invalid second" |
---|
170 | ); |
---|
171 | puts( " - RTEMS_INVALID_CLOCK" ); |
---|
172 | |
---|
173 | build_time( |
---|
174 | &time, 2, 5, 1988, 8, 30, 45, |
---|
175 | rtems_clock_get_ticks_per_second() + 1 |
---|
176 | ); |
---|
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 ticks per second" |
---|
183 | ); |
---|
184 | puts( " - RTEMS_INVALID_CLOCK" ); |
---|
185 | |
---|
186 | build_time( &time, 2, 5, 1988, 8, 30, 45, 0 ); |
---|
187 | print_time( "TA1 - rtems_clock_set - ", &time, "" ); |
---|
188 | status = rtems_clock_set( &time ); |
---|
189 | directive_failed( status, "rtems_clock_set successful" ); |
---|
190 | puts( " - RTEMS_SUCCESSFUL" ); |
---|
191 | |
---|
192 | /* rtems_task_wake_when */ |
---|
193 | |
---|
194 | build_time( |
---|
195 | &time, |
---|
196 | 2, 5, 1988, 8, 30, 48, |
---|
197 | rtems_clock_get_ticks_per_second() + 1 |
---|
198 | ); |
---|
199 | time.second += 3; |
---|
200 | puts( "TA1 - rtems_task_wake_when - TICKINVALID - sleep about 3 seconds" ); |
---|
201 | |
---|
202 | status = rtems_task_wake_when( &time ); |
---|
203 | directive_failed( |
---|
204 | status, |
---|
205 | "rtems_task_wake_when with invalid ticks per second" |
---|
206 | ); |
---|
207 | puts( "TA1 - rtems_task_wake_when - TICKINVALID - woke up RTEMS_SUCCESSFUL" ); |
---|
208 | |
---|
209 | build_time( &time, 2, 5, 1961, 8, 30, 48, 0 ); |
---|
210 | print_time( "TA1 - rtems_task_wake_when - ", &time, "" ); |
---|
211 | status = rtems_task_wake_when( &time ); |
---|
212 | fatal_directive_status( |
---|
213 | status, |
---|
214 | RTEMS_INVALID_CLOCK, |
---|
215 | "rtems_task_wake_when with invalid year" |
---|
216 | ); |
---|
217 | puts( " - RTEMS_INVALID_CLOCK" ); |
---|
218 | |
---|
219 | build_time( &time, 2, 5, 1988, 25, 30, 48, 0 ); |
---|
220 | print_time( "TA1 - rtems_task_wake_when - ", &time, "" ); |
---|
221 | status = rtems_task_wake_when( &time ); |
---|
222 | fatal_directive_status( |
---|
223 | status, |
---|
224 | RTEMS_INVALID_CLOCK, |
---|
225 | "rtems_task_wake_when with invalid hour" |
---|
226 | ); |
---|
227 | puts( " - RTEMS_INVALID_CLOCK" ); |
---|
228 | |
---|
229 | rtems_clock_get_tod( &time ); |
---|
230 | print_time( "TA1 - current time - ", &time, "\n" ); |
---|
231 | |
---|
232 | time.month = 1; |
---|
233 | print_time( "TA1 - rtems_task_wake_when - ", &time, "" ); |
---|
234 | status = rtems_task_wake_when( &time ); |
---|
235 | fatal_directive_status( |
---|
236 | status, |
---|
237 | RTEMS_INVALID_CLOCK, |
---|
238 | "rtems_task_wake_when before current time" |
---|
239 | ); |
---|
240 | puts( " - RTEMS_INVALID_CLOCK" ); |
---|
241 | } |
---|