source: rtems/c/src/tests/sptests/sp09/screen12.c @ 8c3c1763

4.104.114.84.95
Last change on this file since 8c3c1763 was 8c3c1763, checked in by Joel Sherrill <joel.sherrill@…>, on Jul 26, 2000 at 8:44:11 PM

Added ifdef on C4x to avoid invalid address alignment checks since there
is no such thing on the C4x.

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