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-2011. |
---|
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.com/license/LICENSE. |
---|
15 | */ |
---|
16 | |
---|
17 | #ifdef HAVE_CONFIG_H |
---|
18 | #include "config.h" |
---|
19 | #endif |
---|
20 | |
---|
21 | #include "system.h" |
---|
22 | |
---|
23 | void Screen12() |
---|
24 | { |
---|
25 | void *segment_address_1; |
---|
26 | void *segment_address_2; |
---|
27 | void *segment_address_3; |
---|
28 | uintptr_t segment_size; |
---|
29 | rtems_status_code status; |
---|
30 | Heap_Information_block the_info; |
---|
31 | |
---|
32 | /* Check invalid name error case */ |
---|
33 | status = rtems_region_create( |
---|
34 | 0, |
---|
35 | Region_good_area, |
---|
36 | 0x40, |
---|
37 | 32, |
---|
38 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
39 | &Junk_id |
---|
40 | ); |
---|
41 | fatal_directive_status( |
---|
42 | status, |
---|
43 | RTEMS_INVALID_NAME, |
---|
44 | "rtems_region_create with illegal name" |
---|
45 | ); |
---|
46 | puts( "TA1 - rtems_region_create - RTEMS_INVALID_NAME" ); |
---|
47 | |
---|
48 | /* Check NULL starting address error case */ |
---|
49 | status = rtems_region_create( |
---|
50 | Region_name[ 1 ], |
---|
51 | NULL, |
---|
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 NULL address" |
---|
61 | ); |
---|
62 | puts( "TA1 - rtems_region_create - RTEMS_INVALID_ADDRESS" ); |
---|
63 | |
---|
64 | /* Invalid size */ |
---|
65 | status = rtems_region_create( |
---|
66 | Region_name[ 1 ], |
---|
67 | Region_good_area, |
---|
68 | 0, |
---|
69 | 0, |
---|
70 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
71 | &Junk_id |
---|
72 | ); |
---|
73 | fatal_directive_status( |
---|
74 | status, |
---|
75 | RTEMS_INVALID_SIZE, |
---|
76 | "rtems_region_create with illegal size" |
---|
77 | ); |
---|
78 | puts( "TA1 - rtems_region_create - RTEMS_INVALID_SIZE" ); |
---|
79 | |
---|
80 | /* Check NULL id error case */ |
---|
81 | status = rtems_region_create( |
---|
82 | Region_name[ 1 ], |
---|
83 | Region_good_area, |
---|
84 | REGION_LENGTH, |
---|
85 | 0x40, |
---|
86 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
87 | NULL |
---|
88 | ); |
---|
89 | fatal_directive_status( |
---|
90 | status, |
---|
91 | RTEMS_INVALID_ADDRESS, |
---|
92 | "rtems_region_create with NULL id" |
---|
93 | ); |
---|
94 | puts( "TA1 - rtems_region_create - RTEMS_INVALID_ADDRESS" ); |
---|
95 | |
---|
96 | status = rtems_region_create( |
---|
97 | Region_name[ 1 ], |
---|
98 | &Region_good_area[ REGION_START_OFFSET ], |
---|
99 | REGION_LENGTH, |
---|
100 | 0x40, |
---|
101 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
102 | &Region_id[ 1 ] |
---|
103 | ); |
---|
104 | directive_failed( status, "rtems_region_create" ); |
---|
105 | puts( "TA1 - rtems_region_create - RTEMS_SUCCESSFUL" ); |
---|
106 | |
---|
107 | /* extend NULL address */ |
---|
108 | status = rtems_region_extend( |
---|
109 | Region_id[ 1 ], |
---|
110 | NULL, |
---|
111 | REGION_LENGTH - 1 |
---|
112 | ); |
---|
113 | fatal_directive_status( |
---|
114 | status, |
---|
115 | RTEMS_INVALID_ADDRESS, |
---|
116 | "rtems_region_extend with NULL" |
---|
117 | ); |
---|
118 | puts( "TA1 - rtems_region_extend - NULL address - RTEMS_INVALID_ADDRESS" ); |
---|
119 | |
---|
120 | /* extend within heap */ |
---|
121 | status = rtems_region_extend( |
---|
122 | Region_id[ 1 ], |
---|
123 | &Region_good_area[ REGION_START_OFFSET ], |
---|
124 | REGION_LENGTH - 1 |
---|
125 | ); |
---|
126 | fatal_directive_status( |
---|
127 | status, |
---|
128 | RTEMS_INVALID_ADDRESS, |
---|
129 | "rtems_region_extend with address in heap" |
---|
130 | ); |
---|
131 | puts( "TA1 - rtems_region_extend - address within - RTEMS_INVALID_ADDRESS" ); |
---|
132 | |
---|
133 | status = rtems_region_create( |
---|
134 | Region_name[ 1 ], |
---|
135 | Region_good_area, |
---|
136 | REGION_LENGTH, |
---|
137 | 0x40, |
---|
138 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
139 | &Junk_id |
---|
140 | ); |
---|
141 | fatal_directive_status( |
---|
142 | status, |
---|
143 | RTEMS_TOO_MANY, |
---|
144 | "rtems_region_create of too many" |
---|
145 | ); |
---|
146 | puts( "TA1 - rtems_region_create - RTEMS_TOO_MANY" ); |
---|
147 | |
---|
148 | status = rtems_region_delete( 100 ); |
---|
149 | fatal_directive_status( |
---|
150 | status, |
---|
151 | RTEMS_INVALID_ID, |
---|
152 | "rtems_region_delete with illegal id" |
---|
153 | ); |
---|
154 | puts( "TA1 - rtems_region_delete - unknown RTEMS_INVALID_ID" ); |
---|
155 | |
---|
156 | status = rtems_region_delete( rtems_build_id( 1, 1, 1, 256 ) ); |
---|
157 | fatal_directive_status( |
---|
158 | status, |
---|
159 | RTEMS_INVALID_ID, |
---|
160 | "rtems_region_delete with illegal id" |
---|
161 | ); |
---|
162 | puts( "TA1 - rtems_region_delete - local RTEMS_INVALID_ID" ); |
---|
163 | |
---|
164 | status = rtems_region_ident( 0, &Junk_id ); |
---|
165 | fatal_directive_status( |
---|
166 | status, |
---|
167 | RTEMS_INVALID_NAME, |
---|
168 | "rtems_region_ident with illegal name" |
---|
169 | ); |
---|
170 | puts( "TA1 - rtems_region_ident - RTEMS_INVALID_NAME" ); |
---|
171 | |
---|
172 | /* Check get_information errors */ |
---|
173 | status = rtems_region_get_information( Region_id[ 1 ], NULL ); |
---|
174 | fatal_directive_status( |
---|
175 | status, |
---|
176 | RTEMS_INVALID_ADDRESS, |
---|
177 | "rtems_region_get_information with NULL information" |
---|
178 | ); |
---|
179 | puts( "TA1 - rtems_region_get_information - RTEMS_INVALID_ADDRESS" ); |
---|
180 | |
---|
181 | status = rtems_region_get_information( 100, &the_info ); |
---|
182 | fatal_directive_status( |
---|
183 | status, |
---|
184 | RTEMS_INVALID_ID, |
---|
185 | "rtems_region_get_information with illegal id" |
---|
186 | ); |
---|
187 | puts( "TA1 - rtems_region_get_information - unknown RTEMS_INVALID_ID" ); |
---|
188 | |
---|
189 | /* Check get_free_information errors */ |
---|
190 | status = rtems_region_get_free_information( Region_id[ 1 ], NULL ); |
---|
191 | fatal_directive_status( |
---|
192 | status, |
---|
193 | RTEMS_INVALID_ADDRESS, |
---|
194 | "rtems_region_get_free_information with NULL information" |
---|
195 | ); |
---|
196 | puts( "TA1 - rtems_region_get_free_information - RTEMS_INVALID_ADDRESS" ); |
---|
197 | |
---|
198 | status = rtems_region_get_free_information( 100, &the_info ); |
---|
199 | fatal_directive_status( |
---|
200 | status, |
---|
201 | RTEMS_INVALID_ID, |
---|
202 | "rtems_region_get_free_information with illegal id" |
---|
203 | ); |
---|
204 | puts( "TA1 - rtems_region_get_free_information - unknown RTEMS_INVALID_ID" ); |
---|
205 | |
---|
206 | /* get segment illegal id */ |
---|
207 | status = rtems_region_get_segment( |
---|
208 | 100, |
---|
209 | 0x40, |
---|
210 | RTEMS_DEFAULT_OPTIONS, |
---|
211 | RTEMS_NO_TIMEOUT, |
---|
212 | &segment_address_1 |
---|
213 | ); |
---|
214 | fatal_directive_status( |
---|
215 | status, |
---|
216 | RTEMS_INVALID_ID, |
---|
217 | "rtems_region_get_segment with illegal id" |
---|
218 | ); |
---|
219 | puts( "TA1 - rtems_region_get_segment - RTEMS_INVALID_ID" ); |
---|
220 | |
---|
221 | /* get_segment with NULL param */ |
---|
222 | status = rtems_region_get_segment( |
---|
223 | Region_id[ 1 ], |
---|
224 | 2, |
---|
225 | RTEMS_DEFAULT_OPTIONS, |
---|
226 | RTEMS_NO_TIMEOUT, |
---|
227 | NULL |
---|
228 | ); |
---|
229 | fatal_directive_status( |
---|
230 | status, |
---|
231 | RTEMS_INVALID_ADDRESS, |
---|
232 | "rtems_region_get_segment with NULL param" |
---|
233 | ); |
---|
234 | puts( "TA1 - rtems_region_get_segment - RTEMS_INVALID_ADDRESS" ); |
---|
235 | |
---|
236 | /* get_segment with illegal 0 size */ |
---|
237 | status = rtems_region_get_segment( |
---|
238 | Region_id[ 1 ], |
---|
239 | 0, |
---|
240 | RTEMS_DEFAULT_OPTIONS, |
---|
241 | RTEMS_NO_TIMEOUT, |
---|
242 | &segment_address_1 |
---|
243 | ); |
---|
244 | fatal_directive_status( |
---|
245 | status, |
---|
246 | RTEMS_INVALID_SIZE, |
---|
247 | "rtems_region_get_segment with 0 size" |
---|
248 | ); |
---|
249 | puts( "TA1 - rtems_region_get_segment - 0 size - RTEMS_INVALID_SIZE" ); |
---|
250 | |
---|
251 | /* get_segment with illegal big size */ |
---|
252 | status = rtems_region_get_segment( |
---|
253 | Region_id[ 1 ], |
---|
254 | sizeof( Region_good_area ) * 2, |
---|
255 | RTEMS_DEFAULT_OPTIONS, |
---|
256 | RTEMS_NO_TIMEOUT, |
---|
257 | &segment_address_1 |
---|
258 | ); |
---|
259 | fatal_directive_status( |
---|
260 | status, |
---|
261 | RTEMS_INVALID_SIZE, |
---|
262 | "rtems_region_get_segment with big size" |
---|
263 | ); |
---|
264 | puts( "TA1 - rtems_region_get_segment - too big - RTEMS_INVALID_SIZE" ); |
---|
265 | |
---|
266 | status = rtems_region_get_segment( |
---|
267 | Region_id[ 1 ], |
---|
268 | REGION_LENGTH / 2, |
---|
269 | RTEMS_DEFAULT_OPTIONS, |
---|
270 | RTEMS_NO_TIMEOUT, |
---|
271 | &segment_address_1 |
---|
272 | ); |
---|
273 | directive_failed( status, "rtems_region_get_segment" ); |
---|
274 | puts( "TA1 - rtems_region_get_segment - RTEMS_SUCCESSFUL" ); |
---|
275 | |
---|
276 | status = rtems_region_get_segment( |
---|
277 | Region_id[ 1 ], |
---|
278 | REGION_LENGTH / 2, |
---|
279 | RTEMS_NO_WAIT, |
---|
280 | RTEMS_NO_TIMEOUT, |
---|
281 | &segment_address_2 |
---|
282 | ); |
---|
283 | fatal_directive_status( |
---|
284 | status, |
---|
285 | RTEMS_UNSATISFIED, |
---|
286 | "rtems_region_get_segment unsatisfied" |
---|
287 | ); |
---|
288 | puts( "TA1 - rtems_region_get_segment - RTEMS_UNSATISFIED" ); |
---|
289 | |
---|
290 | puts( "TA1 - rtems_region_get_segment - timeout in 3 seconds" ); |
---|
291 | status = rtems_region_get_segment( |
---|
292 | Region_id[ 1 ], |
---|
293 | REGION_LENGTH / 2, |
---|
294 | RTEMS_DEFAULT_OPTIONS, |
---|
295 | 3 * rtems_clock_get_ticks_per_second(), |
---|
296 | &segment_address_3 |
---|
297 | ); |
---|
298 | fatal_directive_status( |
---|
299 | status, |
---|
300 | RTEMS_TIMEOUT, |
---|
301 | "rtems_region_get_segment timeout" |
---|
302 | ); |
---|
303 | puts( "TA1 - rtems_region_get_segment - woke up with RTEMS_TIMEOUT" ); |
---|
304 | |
---|
305 | /* Check get_segment_size errors */ |
---|
306 | status = rtems_region_get_segment_size( Region_id[ 1 ], NULL, &segment_size ); |
---|
307 | fatal_directive_status( |
---|
308 | status, |
---|
309 | RTEMS_INVALID_ADDRESS, |
---|
310 | "rtems_region_get_segment_size with NULL segment" |
---|
311 | ); |
---|
312 | puts( "TA1 - rtems_region_get_segment_size - RTEMS_INVALID_ADDRESS" ); |
---|
313 | |
---|
314 | status = rtems_region_get_segment_size( |
---|
315 | Region_id[ 1 ], segment_address_1, NULL |
---|
316 | ); |
---|
317 | fatal_directive_status( |
---|
318 | status, |
---|
319 | RTEMS_INVALID_ADDRESS, |
---|
320 | "rtems_region_get_segment_size with NULL size" |
---|
321 | ); |
---|
322 | puts( "TA1 - rtems_region_get_segment_size - RTEMS_INVALID_ADDRESS" ); |
---|
323 | |
---|
324 | status = rtems_region_get_segment_size( |
---|
325 | 100, segment_address_1, &segment_size |
---|
326 | ); |
---|
327 | fatal_directive_status( |
---|
328 | status, |
---|
329 | RTEMS_INVALID_ID, |
---|
330 | "rtems_region_get_segment_size with illegal id" |
---|
331 | ); |
---|
332 | puts( "TA1 - rtems_region_get_segment_size - unknown RTEMS_INVALID_ID" ); |
---|
333 | |
---|
334 | status = rtems_region_delete( Region_id[ 1 ] ); |
---|
335 | fatal_directive_status( |
---|
336 | status, |
---|
337 | RTEMS_RESOURCE_IN_USE, |
---|
338 | "rtems_region_delete with buffers in use" |
---|
339 | ); |
---|
340 | puts( "TA1 - rtems_region_delete - RTEMS_RESOURCE_IN_USE" ); |
---|
341 | |
---|
342 | /* Check resize_segment errors */ |
---|
343 | status = rtems_region_resize_segment( |
---|
344 | Region_id[ 1 ], segment_address_3, 256, NULL |
---|
345 | ); |
---|
346 | fatal_directive_status( |
---|
347 | status, |
---|
348 | RTEMS_INVALID_ADDRESS, |
---|
349 | "rtems_region_resize_segment with NULL old size" |
---|
350 | ); |
---|
351 | puts( "TA1 - rtems_region_resize_segment - RTEMS_INVALID_ADDRESS" ); |
---|
352 | |
---|
353 | status = rtems_region_resize_segment( |
---|
354 | Region_id[ 1 ], NULL, 256, &segment_size |
---|
355 | ); |
---|
356 | fatal_directive_status( |
---|
357 | status, |
---|
358 | RTEMS_INVALID_ADDRESS, |
---|
359 | "rtems_region_resize_segment with NULL segment" |
---|
360 | ); |
---|
361 | puts( "TA1 - rtems_region_resize_segment - RTEMS_INVALID_ADDRESS" ); |
---|
362 | |
---|
363 | status = rtems_region_resize_segment( |
---|
364 | 100, segment_address_3, 256, &segment_size |
---|
365 | ); |
---|
366 | fatal_directive_status( |
---|
367 | status, |
---|
368 | RTEMS_INVALID_ID, |
---|
369 | "rtems_region_resize_segment with illegal id" |
---|
370 | ); |
---|
371 | puts( "TA1 - rtems_region_resize_segment - RTEMS_INVALID_ID" ); |
---|
372 | |
---|
373 | /* Check return_segment errors */ |
---|
374 | status = rtems_region_return_segment( 100, segment_address_1 ); |
---|
375 | fatal_directive_status( |
---|
376 | status, |
---|
377 | RTEMS_INVALID_ID, |
---|
378 | "rtems_region_return_segment with illegal id" |
---|
379 | ); |
---|
380 | puts( "TA1 - rtems_region_return_segment - RTEMS_INVALID_ID" ); |
---|
381 | |
---|
382 | status = rtems_region_return_segment( Region_id[ 1 ], Region_good_area ); |
---|
383 | fatal_directive_status( |
---|
384 | status, |
---|
385 | RTEMS_INVALID_ADDRESS, |
---|
386 | "rtems_region_return_segment with illegal segment" |
---|
387 | ); |
---|
388 | puts( "TA1 - rtems_region_return_segment - RTEMS_INVALID_ADDRESS" ); |
---|
389 | |
---|
390 | /* |
---|
391 | * The following generate internal heap errors. Thus this code |
---|
392 | * is subject to change if the heap code changes. |
---|
393 | */ |
---|
394 | |
---|
395 | puts( "TA1 - rtems_debug_disable - RTEMS_DEBUG_REGION" ); |
---|
396 | rtems_debug_disable( RTEMS_DEBUG_REGION ); |
---|
397 | |
---|
398 | puts( "TA1 - rtems_debug_enable - RTEMS_DEBUG_REGION" ); |
---|
399 | rtems_debug_enable( RTEMS_DEBUG_REGION ); |
---|
400 | |
---|
401 | status = rtems_region_extend( |
---|
402 | 100, |
---|
403 | Region_good_area, |
---|
404 | 128 |
---|
405 | ); |
---|
406 | fatal_directive_status( |
---|
407 | status, |
---|
408 | RTEMS_INVALID_ID, |
---|
409 | "rtems_region_extend with illegal id" |
---|
410 | ); |
---|
411 | puts( "TA1 - rtems_region_extend - RTEMS_INVALID_ID" ); |
---|
412 | |
---|
413 | status = rtems_region_extend( |
---|
414 | Region_id[ 1 ], |
---|
415 | &Region_good_area[ REGION_START_OFFSET + 16 ], |
---|
416 | 128 |
---|
417 | ); |
---|
418 | fatal_directive_status( |
---|
419 | status, |
---|
420 | RTEMS_INVALID_ADDRESS, |
---|
421 | "rtems_region_extend with illegal starting address" |
---|
422 | ); |
---|
423 | puts( "TA1 - rtems_region_extend - within heap - RTEMS_INVALID_ADDRESS" ); |
---|
424 | } |
---|