source: rtems/c/src/tests/sptests/sp09/screen02.c @ 0895bdb

4.104.114.84.95
Last change on this file since 0895bdb was 60b791ad, checked in by Joel Sherrill <joel.sherrill@…>, on 02/17/98 at 23:46:28

updated copyright to 1998

  • Property mode set to 100644
File size: 5.3 KB
Line 
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-1998.
10 *  On-Line Applications Research Corporation (OAR).
11 *  Copyright assigned to U.S. Government, 1994.
12 *
13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
15 *  http://www.OARcorp.com/rtems/license.html.
16 *
17 *  $Id$
18 */
19
20#include "system.h"
21
22void Screen2()
23{
24  rtems_time_of_day time;
25  rtems_status_code status;
26
27/* errors before clock is set */
28
29  status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
30  if ( status == RTEMS_SUCCESSFUL ) {
31    puts(
32     "TA1 - rtems_clock_get - RTEMS_NOT_DEFINED -- DID BSP SET THE TIME OF DAY?"
33    );
34  } else {
35    fatal_directive_status(
36      status,
37      RTEMS_NOT_DEFINED,
38      "rtems_clock_get before clock is set"
39    );
40    puts( "TA1 - rtems_clock_get - RTEMS_NOT_DEFINED" );
41  }
42
43  status = rtems_task_wake_when( &time );
44  if ( status == RTEMS_SUCCESSFUL ) {
45    puts(
46"TA1 - rtems_task_wake_when - RTEMS_NOT_DEFINED -- DID BSP SET THE TIME OF DAY?"
47    );
48  } else {
49    fatal_directive_status(
50      status,
51      RTEMS_NOT_DEFINED,
52      "rtems_task_wake_when before clock is set"
53    );
54    puts( "TA1 - rtems_task_wake_when - RTEMS_NOT_DEFINED" );
55  }
56
57  status = rtems_timer_fire_when( 0, &time, Delayed_routine, NULL );
58  if ( status == RTEMS_SUCCESSFUL ) {
59    puts(
60    "TA1 - timer_wake_when - RTEMS_NOT_DEFINED -- DID BSP SET THE TIME OF DAY?"
61    );
62  } else {
63    fatal_directive_status(
64      status,
65      RTEMS_NOT_DEFINED,
66      "task_fire_when before clock is set"
67    );
68    puts( "TA1 - rtems_timer_fire_when - RTEMS_NOT_DEFINED" );
69  }
70
71  build_time( &time, 2, 5, 1987, 8, 30, 45, 0 );
72  print_time( "TA1 - rtems_clock_set - ", &time, "" );
73  status = rtems_clock_set( &time );
74  fatal_directive_status(
75    status,
76    RTEMS_INVALID_CLOCK,
77    "rtems_clock_set with invalid year"
78  );
79  puts( " - RTEMS_INVALID_CLOCK" );
80
81  build_time( &time, 15, 5, 1988, 8, 30, 45, 0 );
82  print_time( "TA1 - rtems_clock_set - ", &time, "" );
83  status = rtems_clock_set( &time );
84  fatal_directive_status(
85    status,
86    RTEMS_INVALID_CLOCK,
87    "rtems_clock_set with invalid month"
88  );
89  puts( " - RTEMS_INVALID_CLOCK" );
90
91  build_time( &time, 2, 32, 1988, 8, 30, 45, 0 );
92  print_time( "TA1 - rtems_clock_set - ", &time, "" );
93  status = rtems_clock_set( &time );
94  fatal_directive_status(
95    status,
96    RTEMS_INVALID_CLOCK,
97    "rtems_clock_set with invalid day"
98  );
99  puts( " - RTEMS_INVALID_CLOCK" );
100
101  build_time( &time, 2, 5, 1988, 25, 30, 45, 0 );
102  print_time( "TA1 - rtems_clock_set - ", &time, "" );
103  status = rtems_clock_set( &time );
104  fatal_directive_status(
105    status,
106    RTEMS_INVALID_CLOCK,
107    "rtems_clock_set with invalid hour"
108  );
109  puts( " - RTEMS_INVALID_CLOCK" );
110
111  build_time( &time, 2, 5, 1988, 8, 61, 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 minute"
118  );
119  puts( " - RTEMS_INVALID_CLOCK" );
120
121  build_time( &time, 2, 5, 1988, 8, 30, 61, 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 second"
128  );
129  puts( " - RTEMS_INVALID_CLOCK" );
130
131  build_time( &time, 2, 5, 1988, 8, 30, 45, TICKS_PER_SECOND + 1 );
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 ticks per second"
138  );
139  puts( " - RTEMS_INVALID_CLOCK" );
140
141  build_time( &time, 2, 5, 1988, 8, 30, 45, 0 );
142  print_time( "TA1 - rtems_clock_set - ", &time, "" );
143  status = rtems_clock_set( &time );
144  directive_failed( status, "rtems_clock_set successful" );
145  puts( " - RTEMS_SUCCESSFUL" );
146
147/* rtems_task_wake_when */
148
149  build_time( &time, 2, 5, 1988, 8, 30, 48, TICKS_PER_SECOND + 1 );
150  time.second += 3;
151  puts( "TA1 - rtems_task_wake_when - TICKINVALID - sleep about 3 seconds" );
152
153  status = rtems_task_wake_when( &time );
154  directive_failed(
155    status,
156    "rtems_task_wake_when with invalid ticks per second"
157  );
158  puts( "TA1 - rtems_task_wake_when - TICKINVALID - woke up RTEMS_SUCCESSFUL" );
159
160  build_time( &time, 2, 5, 1961, 8, 30, 48, 0 );
161  print_time( "TA1 - rtems_task_wake_when - ", &time, "" );
162  status = rtems_task_wake_when( &time );
163  fatal_directive_status(
164    status,
165    RTEMS_INVALID_CLOCK,
166    "rtems_task_wake_when with invalid year"
167  );
168  puts( " - RTEMS_INVALID_CLOCK" );
169
170  build_time( &time, 2, 5, 1988, 25, 30, 48, 0 );
171  print_time( "TA1 - rtems_task_wake_when - ", &time, "" );
172  status = rtems_task_wake_when( &time );
173  fatal_directive_status(
174    status,
175    RTEMS_INVALID_CLOCK,
176    "rtems_task_wake_when with invalid hour"
177  );
178  puts( " - RTEMS_INVALID_CLOCK" );
179
180  rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
181  print_time( "TA1 - current time - ", &time, "\n" );
182
183  time.month = 1;
184  print_time( "TA1 - rtems_task_wake_when - ", &time, "" );
185  status = rtems_task_wake_when( &time );
186  fatal_directive_status(
187    status,
188    RTEMS_INVALID_CLOCK,
189    "rtems_task_wake_when before current time"
190  );
191  puts( " - RTEMS_INVALID_CLOCK" );
192}
Note: See TracBrowser for help on using the repository browser.