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