OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [tests/] [sptests/] [sp09/] [screen02.c] - Blame information for rev 30

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*  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-1999.
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.OARcorp.com/rtems/license.html.
15
 *
16
 *  $Id: screen02.c,v 1.2 2001-09-27 12:02:31 chris Exp $
17
 */
18
 
19
#include "system.h"
20
 
21
void Screen2()
22
{
23
  rtems_time_of_day time;
24
  rtems_status_code status;
25
 
26
/* errors before clock is set */
27
 
28
  status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
29
  if ( status == RTEMS_SUCCESSFUL ) {
30
    puts(
31
     "TA1 - rtems_clock_get - RTEMS_NOT_DEFINED -- DID BSP SET THE TIME OF DAY?"
32
    );
33
  } else {
34
    fatal_directive_status(
35
      status,
36
      RTEMS_NOT_DEFINED,
37
      "rtems_clock_get before clock is set"
38
    );
39
    puts( "TA1 - rtems_clock_get - RTEMS_NOT_DEFINED" );
40
  }
41
 
42
  status = rtems_task_wake_when( &time );
43
  if ( status == RTEMS_SUCCESSFUL ) {
44
    puts(
45
"TA1 - rtems_task_wake_when - RTEMS_NOT_DEFINED -- DID BSP SET THE TIME OF DAY?"
46
    );
47
  } else {
48
    fatal_directive_status(
49
      status,
50
      RTEMS_NOT_DEFINED,
51
      "rtems_task_wake_when before clock is set"
52
    );
53
    puts( "TA1 - rtems_task_wake_when - RTEMS_NOT_DEFINED" );
54
  }
55
 
56
  status = rtems_timer_fire_when( 0, &time, Delayed_routine, NULL );
57
  if ( status == RTEMS_SUCCESSFUL ) {
58
    puts(
59
    "TA1 - timer_wake_when - RTEMS_NOT_DEFINED -- DID BSP SET THE TIME OF DAY?"
60
    );
61
  } else {
62
    fatal_directive_status(
63
      status,
64
      RTEMS_NOT_DEFINED,
65
      "task_fire_when before clock is set"
66
    );
67
    puts( "TA1 - rtems_timer_fire_when - RTEMS_NOT_DEFINED" );
68
  }
69
 
70
  build_time( &time, 2, 5, 1987, 8, 30, 45, 0 );
71
  print_time( "TA1 - rtems_clock_set - ", &time, "" );
72
  status = rtems_clock_set( &time );
73
  fatal_directive_status(
74
    status,
75
    RTEMS_INVALID_CLOCK,
76
    "rtems_clock_set with invalid year"
77
  );
78
  puts( " - RTEMS_INVALID_CLOCK" );
79
 
80
  build_time( &time, 15, 5, 1988, 8, 30, 45, 0 );
81
  print_time( "TA1 - rtems_clock_set - ", &time, "" );
82
  status = rtems_clock_set( &time );
83
  fatal_directive_status(
84
    status,
85
    RTEMS_INVALID_CLOCK,
86
    "rtems_clock_set with invalid month"
87
  );
88
  puts( " - RTEMS_INVALID_CLOCK" );
89
 
90
  build_time( &time, 2, 32, 1988, 8, 30, 45, 0 );
91
  print_time( "TA1 - rtems_clock_set - ", &time, "" );
92
  status = rtems_clock_set( &time );
93
  fatal_directive_status(
94
    status,
95
    RTEMS_INVALID_CLOCK,
96
    "rtems_clock_set with invalid day"
97
  );
98
  puts( " - RTEMS_INVALID_CLOCK" );
99
 
100
  build_time( &time, 2, 5, 1988, 25, 30, 45, 0 );
101
  print_time( "TA1 - rtems_clock_set - ", &time, "" );
102
  status = rtems_clock_set( &time );
103
  fatal_directive_status(
104
    status,
105
    RTEMS_INVALID_CLOCK,
106
    "rtems_clock_set with invalid hour"
107
  );
108
  puts( " - RTEMS_INVALID_CLOCK" );
109
 
110
  build_time( &time, 2, 5, 1988, 8, 61, 45, 0 );
111
  print_time( "TA1 - rtems_clock_set - ", &time, "" );
112
  status = rtems_clock_set( &time );
113
  fatal_directive_status(
114
    status,
115
    RTEMS_INVALID_CLOCK,
116
    "rtems_clock_set with invalid minute"
117
  );
118
  puts( " - RTEMS_INVALID_CLOCK" );
119
 
120
  build_time( &time, 2, 5, 1988, 8, 30, 61, 0 );
121
  print_time( "TA1 - rtems_clock_set - ", &time, "" );
122
  status = rtems_clock_set( &time );
123
  fatal_directive_status(
124
    status,
125
    RTEMS_INVALID_CLOCK,
126
    "rtems_clock_set with invalid second"
127
  );
128
  puts( " - RTEMS_INVALID_CLOCK" );
129
 
130
  build_time( &time, 2, 5, 1988, 8, 30, 45, TICKS_PER_SECOND + 1 );
131
  print_time( "TA1 - rtems_clock_set - ", &time, "" );
132
  status = rtems_clock_set( &time );
133
  fatal_directive_status(
134
    status,
135
    RTEMS_INVALID_CLOCK,
136
    "rtems_clock_set with invalid ticks per second"
137
  );
138
  puts( " - RTEMS_INVALID_CLOCK" );
139
 
140
  build_time( &time, 2, 5, 1988, 8, 30, 45, 0 );
141
  print_time( "TA1 - rtems_clock_set - ", &time, "" );
142
  status = rtems_clock_set( &time );
143
  directive_failed( status, "rtems_clock_set successful" );
144
  puts( " - RTEMS_SUCCESSFUL" );
145
 
146
/* rtems_task_wake_when */
147
 
148
  build_time( &time, 2, 5, 1988, 8, 30, 48, TICKS_PER_SECOND + 1 );
149
  time.second += 3;
150
  puts( "TA1 - rtems_task_wake_when - TICKINVALID - sleep about 3 seconds" );
151
 
152
  status = rtems_task_wake_when( &time );
153
  directive_failed(
154
    status,
155
    "rtems_task_wake_when with invalid ticks per second"
156
  );
157
  puts( "TA1 - rtems_task_wake_when - TICKINVALID - woke up RTEMS_SUCCESSFUL" );
158
 
159
  build_time( &time, 2, 5, 1961, 8, 30, 48, 0 );
160
  print_time( "TA1 - rtems_task_wake_when - ", &time, "" );
161
  status = rtems_task_wake_when( &time );
162
  fatal_directive_status(
163
    status,
164
    RTEMS_INVALID_CLOCK,
165
    "rtems_task_wake_when with invalid year"
166
  );
167
  puts( " - RTEMS_INVALID_CLOCK" );
168
 
169
  build_time( &time, 2, 5, 1988, 25, 30, 48, 0 );
170
  print_time( "TA1 - rtems_task_wake_when - ", &time, "" );
171
  status = rtems_task_wake_when( &time );
172
  fatal_directive_status(
173
    status,
174
    RTEMS_INVALID_CLOCK,
175
    "rtems_task_wake_when with invalid hour"
176
  );
177
  puts( " - RTEMS_INVALID_CLOCK" );
178
 
179
  rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
180
  print_time( "TA1 - current time - ", &time, "\n" );
181
 
182
  time.month = 1;
183
  print_time( "TA1 - rtems_task_wake_when - ", &time, "" );
184
  status = rtems_task_wake_when( &time );
185
  fatal_directive_status(
186
    status,
187
    RTEMS_INVALID_CLOCK,
188
    "rtems_task_wake_when before current time"
189
  );
190
  puts( " - RTEMS_INVALID_CLOCK" );
191
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.