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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*  Screen12
2
 *
3
 *  This routine generates error screen 12 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: screen12.c,v 1.2 2001-09-27 12:02:31 chris Exp $
17
 */
18
 
19
#include "system.h"
20
 
21
void Screen12()
22
{
23
  void              *segment_address_1;
24
  void              *segment_address_2;
25
  void              *segment_address_3;
26
  rtems_unsigned32   offset;
27
  rtems_unsigned32   good_front_flag;
28
  rtems_unsigned32   good_back_flag;
29
  rtems_status_code  status;
30
 
31
  status = rtems_region_create(
32
    0,
33
    Region_good_area,
34
    0x40,
35
    32,
36
    RTEMS_DEFAULT_ATTRIBUTES,
37
    &Junk_id
38
  );
39
  fatal_directive_status(
40
    status,
41
    RTEMS_INVALID_NAME,
42
    "rtems_region_create with illegal name"
43
  );
44
  puts( "TA1 - rtems_region_create - RTEMS_INVALID_NAME" );
45
 
46
  status = rtems_region_create(
47
    Region_name[ 1 ],
48
    Region_bad_area,
49
    0x40,
50
    32,
51
    RTEMS_DEFAULT_ATTRIBUTES,
52
    &Junk_id
53
  );
54
  fatal_directive_status(
55
    status,
56
    RTEMS_INVALID_ADDRESS,
57
    "rtems_region_create with illegal address"
58
  );
59
  puts( "TA1 - rtems_region_create - RTEMS_INVALID_ADDRESS" );
60
 
61
  status = rtems_region_create(
62
    Region_name[ 1 ],
63
    Region_good_area,
64
    0x40,
65
    34,
66
    RTEMS_DEFAULT_ATTRIBUTES,
67
    &Junk_id
68
  );
69
  fatal_directive_status(
70
    status,
71
    RTEMS_INVALID_SIZE,
72
    "rtems_region_create with illegal size"
73
  );
74
  puts( "TA1 - rtems_region_create - RTEMS_INVALID_SIZE" );
75
 
76
  status = rtems_region_create(
77
    Region_name[ 1 ],
78
    &Region_good_area[ REGION_START_OFFSET ],
79
    REGION_LENGTH,
80
    0x40,
81
    RTEMS_DEFAULT_ATTRIBUTES,
82
    &Region_id[ 1 ]
83
  );
84
  directive_failed( status, "rtems_region_create" );
85
  puts( "TA1 - rtems_region_create - RTEMS_SUCCESSFUL" );
86
 
87
  status = rtems_region_create(
88
    Region_name[ 1 ],
89
    Region_good_area,
90
    REGION_LENGTH,
91
    0x40,
92
    RTEMS_DEFAULT_ATTRIBUTES,
93
    &Junk_id
94
  );
95
  fatal_directive_status(
96
    status,
97
    RTEMS_TOO_MANY,
98
    "rtems_region_create of too many"
99
  );
100
  puts( "TA1 - rtems_region_create - RTEMS_TOO_MANY" );
101
 
102
  status = rtems_region_delete( 100 );
103
  fatal_directive_status(
104
    status,
105
    RTEMS_INVALID_ID,
106
    "rtems_region_delete with illegal id"
107
  );
108
  puts( "TA1 - rtems_region_delete - unknown RTEMS_INVALID_ID" );
109
 
110
  status = rtems_region_delete( 0x10100 );
111
  fatal_directive_status(
112
    status,
113
    RTEMS_INVALID_ID,
114
    "rtems_region_delete with illegal id"
115
  );
116
  puts( "TA1 - rtems_region_delete - local RTEMS_INVALID_ID" );
117
 
118
  status = rtems_region_ident( 0, &Junk_id );
119
  fatal_directive_status(
120
    status,
121
    RTEMS_INVALID_NAME,
122
    "rtems_region_ident with illegal name"
123
  );
124
  puts( "TA1 - rtems_region_ident - RTEMS_INVALID_NAME" );
125
 
126
  status = rtems_region_get_segment(
127
    100,
128
    0x40,
129
    RTEMS_DEFAULT_OPTIONS,
130
    RTEMS_NO_TIMEOUT,
131
    &segment_address_1
132
  );
133
  fatal_directive_status(
134
    status,
135
    RTEMS_INVALID_ID,
136
    "rtems_region_get_segment with illegal id"
137
  );
138
  puts( "TA1 - rtems_region_get_segment - RTEMS_INVALID_ID" );
139
 
140
  status = rtems_region_get_segment(
141
     Region_id[ 1 ],
142
     sizeof( Region_good_area ) * 2,
143
     RTEMS_DEFAULT_OPTIONS,
144
     RTEMS_NO_TIMEOUT,
145
     &segment_address_1
146
  );
147
  fatal_directive_status(
148
    status,
149
    RTEMS_INVALID_SIZE,
150
    "rtems_region_get_segment with illegal size"
151
  );
152
  puts( "TA1 - rtems_region_get_segment - RTEMS_INVALID_SIZE" );
153
 
154
  status = rtems_region_get_segment(
155
     Region_id[ 1 ],
156
     384,
157
     RTEMS_DEFAULT_OPTIONS,
158
     RTEMS_NO_TIMEOUT,
159
     &segment_address_1
160
  );
161
  directive_failed( status, "rtems_region_get_segment" );
162
  puts( "TA1 - rtems_region_get_segment - RTEMS_SUCCESSFUL" );
163
 
164
  status = rtems_region_get_segment(
165
     Region_id[ 1 ],
166
     REGION_LENGTH / 2,
167
     RTEMS_NO_WAIT,
168
     RTEMS_NO_TIMEOUT,
169
     &segment_address_2
170
  );
171
  fatal_directive_status(
172
    status,
173
    RTEMS_UNSATISFIED,
174
    "rtems_region_get_segment unsatisfied"
175
  );
176
  puts( "TA1 - rtems_region_get_segment - RTEMS_UNSATISFIED" );
177
 
178
  puts( "TA1 - rtems_region_get_segment - timeout in 3 seconds" );
179
  status = rtems_region_get_segment(
180
    Region_id[ 1 ],
181
    128,
182
    RTEMS_DEFAULT_OPTIONS,
183
    3 * TICKS_PER_SECOND,
184
    &segment_address_3
185
  );
186
  fatal_directive_status(
187
    status,
188
    RTEMS_TIMEOUT,
189
    "rtems_region_get_segment timeout"
190
  );
191
  puts( "TA1 - rtems_region_get_segment - woke up with RTEMS_TIMEOUT" );
192
 
193
  status = rtems_region_delete( Region_id[ 1 ] );
194
  fatal_directive_status(
195
    status,
196
    RTEMS_RESOURCE_IN_USE,
197
    "rtems_region_delete with buffers in use"
198
  );
199
  puts( "TA1 - rtems_region_delete - RTEMS_RESOURCE_IN_USE" );
200
 
201
  status = rtems_region_return_segment( 100, segment_address_1 );
202
  fatal_directive_status(
203
    status,
204
    RTEMS_INVALID_ID,
205
    "rtems_region_return_segment with illegal id"
206
  );
207
  puts( "TA1 - rtems_region_return_segment - RTEMS_INVALID_ID" );
208
 
209
  status = rtems_region_return_segment( Region_id[ 1 ], Region_good_area );
210
  fatal_directive_status(
211
    status,
212
    RTEMS_INVALID_ADDRESS,
213
    "rtems_region_return_segment with illegal segment"
214
  );
215
  puts( "TA1 - rtems_region_return_segment - RTEMS_INVALID_ADDRESS" );
216
 
217
/*
218
 *  The following generate internal heap errors.  Thus this code
219
 *  is subject to change if the heap code changes.
220
 */
221
 
222
  puts( "TA1 - rtems_debug_disable - RTEMS_DEBUG_REGION" );
223
  rtems_debug_disable( RTEMS_DEBUG_REGION );
224
 
225
#if 0
226
 
227
  offset = (segment_address_1 - (void *)Region_good_area) / 4;
228
 
229
/* bad FRONT_FLAG error */
230
 
231
  good_front_flag = Region_good_area[ offset - 1 ];
232
  Region_good_area[ offset - 1 ] = good_front_flag + 2;
233
 
234
  status = rtems_region_return_segment( Region_id[ 1 ], segment_address_1 );
235
  fatal_directive_status(
236
    status,
237
    RTEMS_INVALID_ADDRESS,
238
    "rtems_region_return_segment with back_flag != front_flag"
239
  );
240
  puts( "TA1 - rtems_region_return_segment - RTEMS_INVALID_ADDRESS" );
241
 
242
  Region_good_area[ offset - 1 ] = good_front_flag;
243
 
244
/* bad FRONT_FLAG error */
245
 
246
  good_back_flag = Region_good_area[ offset - 2 ];
247
  Region_good_area[ offset - 2 ] = 1024;
248
 
249
  status = rtems_region_return_segment( Region_id[ 1 ], segment_address_1 );
250
  fatal_directive_status(
251
    status,
252
    RTEMS_INVALID_ADDRESS,
253
    "rtems_region_return_segment with back_flag != front_flag"
254
  );
255
  puts( "TA1 - rtems_region_return_segment - RTEMS_INVALID_ADDRESS" );
256
 
257
  Region_good_area[ offset - 2 ] = good_back_flag;
258
 
259
#else
260
  offset = 0;
261
  good_front_flag = 0;
262
  good_back_flag = 0;
263
  puts( "TA1 - rtems_region_return_segment - RTEMS_INVALID_ADDRESS - SKIPPED" );
264
  puts( "TA1 - rtems_region_return_segment - RTEMS_INVALID_ADDRESS - SKIPPED" );
265
#endif
266
 
267
  puts( "TA1 - rtems_debug_enable - RTEMS_DEBUG_REGION" );
268
  rtems_debug_enable( RTEMS_DEBUG_REGION );
269
 
270
  status = rtems_region_extend(
271
    100,
272
    Region_good_area,
273
    128
274
  );
275
  fatal_directive_status(
276
    status,
277
    RTEMS_INVALID_ID,
278
    "rtems_region_extend with illegal id"
279
  );
280
  puts( "TA1 - rtems_region_extend - RTEMS_INVALID_ID" );
281
 
282
  status = rtems_region_extend(
283
    Region_id[ 1 ],
284
    &Region_good_area[ REGION_START_OFFSET + 16 ],
285
    128
286
  );
287
  fatal_directive_status(
288
    status,
289
    RTEMS_INVALID_ADDRESS,
290
    "rtems_region_extend with illegal starting address"
291
  );
292
  puts( "TA1 - rtems_region_extend - within heap - RTEMS_INVALID_ADDRESS" );
293
 
294
  status = rtems_region_extend(
295
    Region_id[ 1 ],
296
    Region_bad_area,
297
    128
298
  );
299
  fatal_directive_status(
300
    status,
301
    RTEMS_NOT_IMPLEMENTED,
302
    "rtems_region_extend with unsupported starting address"
303
  );
304
  puts(
305
    "TA1 - rtems_region_extend - non-contiguous lower - RTEMS_NOT_IMPLEMENTED"
306
  );
307
 
308
  status = rtems_region_extend(
309
    Region_id[ 1 ],
310
    &Region_good_area[ REGION_START_OFFSET - REGION_LENGTH ],
311
    128
312
  );
313
  fatal_directive_status(
314
    status,
315
    RTEMS_NOT_IMPLEMENTED,
316
    "rtems_region_extend with unsupported starting address"
317
  );
318
  puts(
319
    "TA1 - rtems_region_extend - contiguous lower - RTEMS_NOT_IMPLEMENTED"
320
  );
321
 
322
  status = rtems_region_extend(
323
    Region_id[ 1 ],
324
    &Region_good_area[ REGION_START_OFFSET + REGION_LENGTH + 16 ],
325
    128
326
  );
327
  fatal_directive_status(
328
    status,
329
    RTEMS_NOT_IMPLEMENTED,
330
    "rtems_region_extend with unsupported starting address"
331
  );
332
  puts(
333
    "TA1 - rtems_region_extend - non-contiguous higher - RTEMS_NOT_IMPLEMENTED"
334
  );
335
 
336
}

powered by: WebSVN 2.1.0

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