source: rtems/testsuites/sptests/sp09/screen14.c @ b1274bd9

4.104.115
Last change on this file since b1274bd9 was b1274bd9, checked in by Ralf Corsepius <ralf.corsepius@…>, on 11/30/09 at 03:33:25

Whitespace removal.

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