source: rtems/testsuites/sptests/spratemon_err01/screen10.c @ 99de42c

5
Last change on this file since 99de42c was d4edbdbc, checked in by Sebastian Huber <sebastian.huber@…>, on 03/20/15 at 13:09:26

Replace www.rtems.com with www.rtems.org

  • Property mode set to 100644
File size: 6.4 KB
Line 
1/*  Screen10
2 *
3 *  This routine generates error screen 10 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.org/license/LICENSE.
15 */
16
17#ifdef HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include "system.h"
22
23void Screen10()
24{
25  rtems_rate_monotonic_period_status period_status;
26  rtems_status_code                  status;
27
28  /*
29   * Check create error cases.
30   */
31  status = rtems_rate_monotonic_create( Period_name[ 1 ], NULL );
32  fatal_directive_status(
33    status,
34    RTEMS_INVALID_ADDRESS,
35    "rtems_rate_monotonic_create with NULL param"
36  );
37
38  puts( "TA1 - rtems_rate_monotonic_create - RTEMS_INVALID_ADDRESS" );
39
40  status = rtems_rate_monotonic_create( 0, &Junk_id );
41  fatal_directive_status(
42    status,
43    RTEMS_INVALID_NAME,
44    "rtems_rate_monotonic_create with illegal name"
45  );
46  puts( "TA1 - rtems_rate_monotonic_create - RTEMS_INVALID_NAME" );
47
48  status = rtems_rate_monotonic_create( Period_name[ 1 ], &Period_id[ 1 ] );
49  directive_failed( status, "rtems_rate_monotonic_create successful" );
50  puts( "TA1 - rtems_rate_monotonic_create - RTEMS_SUCCESSFUL" );
51
52  status = rtems_rate_monotonic_create( Period_name[ 1 ], &Junk_id );
53  fatal_directive_status(
54    status,
55    RTEMS_TOO_MANY,
56    "rtems_rate_monotonic_create of too many"
57  );
58  puts( "TA1 - rtems_rate_monotonic_create - RTEMS_TOO_MANY" );
59
60  /*
61   * Check ident error cases.
62   */
63  status = rtems_rate_monotonic_ident( 0, &Junk_id );
64  fatal_directive_status(
65    status,
66    RTEMS_INVALID_NAME,
67    "rtems_rate_monotonic_ident with illegal name"
68  );
69  puts( "TA1 - rtems_rate_monotonic_ident - RTEMS_INVALID_NAME" );
70
71  /*
72   * Check period error cases.
73   */
74  status = rtems_rate_monotonic_period( 100, 5 );
75  fatal_directive_status(
76    status,
77    RTEMS_INVALID_ID,
78    "rtems_rate_monotonic_period with illegal id"
79  );
80  puts( "TA1 - rtems_rate_monotonic_period - RTEMS_INVALID_ID" );
81
82  status = rtems_rate_monotonic_period( rtems_build_id( 1, 1, 1, 256 ), 5 );
83  fatal_directive_status(
84    status,
85    RTEMS_INVALID_ID,
86    "rtems_rate_monotonic_period with illegal id"
87  );
88  puts( "TA1 - rtems_rate_monotonic_period - local RTEMS_INVALID_ID" );
89
90  status = rtems_rate_monotonic_period( Period_id[ 1 ], RTEMS_PERIOD_STATUS );
91  fatal_directive_status(
92    status,
93    RTEMS_NOT_DEFINED,
94    "rtems_rate_monotonic_period status not defined"
95  );
96  puts(
97    "TA1 - rtems_rate_monotonic_period(RTEMS_PERIOD_STATUS) - RTEMS_NOT_DEFINED"
98  );
99
100  status = rtems_rate_monotonic_period( Period_id[ 1 ], 100 );
101  directive_failed( status, "rtems_rate_monotonic_period successful" );
102  puts( "TA1 - rtems_rate_monotonic_period - 100 ticks - RTEMS_SUCCESSFUL" );
103
104  status = rtems_rate_monotonic_period( Period_id[ 1 ], RTEMS_PERIOD_STATUS );
105  directive_failed( status, "rtems_rate_monotonic_period status" );
106  puts(
107    "TA1 - rtems_rate_monotonic_period(RTEMS_PERIOD_STATUS) - RTEMS_SUCCESSFUL"
108  );
109
110  while ( FOREVER ) {
111
112     status = rtems_rate_monotonic_period(Period_id[ 1 ], RTEMS_PERIOD_STATUS);
113
114     if ( status == RTEMS_TIMEOUT ) break;
115
116     directive_failed(
117       status,
118       "rtems_rate_monotonic_period waiting for timeout"
119     );
120
121     rtems_task_wake_after( 1 );
122  }
123  puts(
124    "TA1 - rtems_rate_monotonic_period(RTEMS_PERIOD_STATUS) - RTEMS_TIMEOUT"
125  );
126
127  /*
128   * Check get_statistics error cases.
129   */
130  status = rtems_rate_monotonic_get_statistics( Period_id[ 1 ], NULL );
131  fatal_directive_status(
132    status,
133    RTEMS_INVALID_ADDRESS,
134    "rtems_rate_monotonic_get_statistics with NULL param"
135  );
136  puts( "TA1 - rtems_rate_monotonic_get_statistics - RTEMS_INVALID_ADDRESS" );
137
138  /*
139   * Check get_status error cases.
140   */
141  status = rtems_rate_monotonic_get_status( Period_id[ 1 ], NULL );
142  fatal_directive_status(
143    status,
144    RTEMS_INVALID_ADDRESS,
145    "rtems_rate_monotonic_get_status with NULL param"
146  );
147  puts( "TA1 - rtems_rate_monotonic_get_status - RTEMS_INVALID_ADDRESS" );
148
149  status = rtems_rate_monotonic_get_status( 100, &period_status );
150  fatal_directive_status(
151    status,
152    RTEMS_INVALID_ID,
153    "rtems_rate_monotonic_get_status with illegal id"
154  );
155  puts( "TA1 - rtems_rate_monotonic_get_status - RTEMS_INVALID_ID" );
156
157  /*
158   * Check cancel error cases.
159   */
160  status = rtems_rate_monotonic_cancel( 100 );
161  fatal_directive_status(
162    status,
163    RTEMS_INVALID_ID,
164    "rtems_rate_monotonic_cancel with illegal id"
165  );
166  puts( "TA1 - rtems_rate_monotonic_cancel - RTEMS_INVALID_ID" );
167
168  status = rtems_rate_monotonic_cancel( rtems_build_id( 1, 1, 1, 256 ) );
169  fatal_directive_status(
170    status,
171    RTEMS_INVALID_ID,
172    "rtems_rate_monotonic_cancel will illegal id"
173  );
174  puts( "TA1 - rtems_rate_monotonic_cancel - local RTEMS_INVALID_ID" );
175
176  status = rtems_rate_monotonic_cancel( Period_id[ 1 ] );
177  directive_failed( status, "rtems_rate_monotonic_cancel" );
178  puts( "TA1 - rtems_rate_monotonic_cancel - RTEMS_SUCCESSFUL" );
179
180  status = rtems_rate_monotonic_period( Period_id[ 1 ], 5 );
181  directive_failed( status, "rtems_rate_monotonic_period restart" );
182
183  status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() );
184  directive_failed( status, "rtems_task_wake_after" );
185
186  status = rtems_rate_monotonic_period( Period_id[ 1 ], 5 );
187  fatal_directive_status(
188    status,
189    RTEMS_TIMEOUT,
190    "rtems_rate_monotonic_period"
191  );
192  puts( "TA1 - rtems_rate_monotonic_period - 5 ticks - RTEMS_TIMEOUT" );
193
194  status = rtems_task_start( Task_id[ 4 ], Task_4, 0 );
195  directive_failed( status, "rtems_task_start of TA4" );
196
197  puts( "TA1 - yielding to TA4" );
198  status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
199
200  /*
201   * Check delete error cases.
202   */
203  status = rtems_rate_monotonic_delete( 100 );
204  fatal_directive_status(
205    status,
206    RTEMS_INVALID_ID,
207    "rtems_rate_monotonic_delete with illegal id"
208  );
209  puts( "TA1 - rtems_rate_monotonic_delete - RTEMS_INVALID_ID" );
210
211  status = rtems_rate_monotonic_delete( rtems_build_id( 1, 1, 1, 256 ) );
212  fatal_directive_status(
213    status,
214    RTEMS_INVALID_ID,
215    "rtems_rate_monotonic_delete with illegal id"
216  );
217  puts( "TA1 - rtems_rate_monotonic_delete - local RTEMS_INVALID_ID" );
218
219  status = rtems_rate_monotonic_delete( Period_id[ 1 ] );
220  directive_failed( status, "rtems_rate_monotonic_delete" );
221  puts( "TA1 - rtems_rate_monotonic_delete - RTEMS_SUCCESSFUL" );
222}
Note: See TracBrowser for help on using the repository browser.