source: rtems/c/src/tests/sptests/sp25/task1.c @ 2a0b721

4.104.114.84.95
Last change on this file since 2a0b721 was 2a0b721, checked in by Joel Sherrill <joel.sherrill@…>, on Aug 18, 1995 at 9:44:46 PM

Changed to reflect adding object class to id

Added "0x" to printf of id

  • Property mode set to 100644
File size: 6.5 KB
Line 
1/*  Task_1
2 *
3 *  This routine serves as a test task.  It tests the region manager.
4 *
5 *  Input parameters:
6 *    argument - task argument
7 *
8 *  Output parameters:  NONE
9 *
10 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
11 *  On-Line Applications Research Corporation (OAR).
12 *  All rights assigned to U.S. Government, 1994.
13 *
14 *  This material may be reproduced by or for the U.S. Government pursuant
15 *  to the copyright license under the clause at DFARS 252.227-7013.  This
16 *  notice must appear in all copies of this file and its derivatives.
17 *
18 *  $Id$
19 */
20
21#include "system.h"
22
23rtems_task Task_1(
24  rtems_task_argument argument
25)
26{
27  void              *address_1;
28  void              *address_2;
29  void              *address_3;
30  void              *address_4;
31  void              *address_5;
32  void              *address_6;
33  void              *address_7;
34  void              *address_8;
35  rtems_status_code  status;
36  rtems_id           region_id;
37
38  status = rtems_region_ident(Region_name[ 1 ], &region_id);
39  printf( "TA1 - rtems_region_ident - 0x%08x\n", region_id );
40  directive_failed(status, "rtems_region_ident of RN01");
41
42  puts(
43    "TA1 - rtems_region_get_segment - wait on 64 byte segment from region 1"
44  );
45  rtems_region_get_segment(
46    Region_id[ 1 ],
47    64,
48    RTEMS_DEFAULT_OPTIONS,
49    RTEMS_NO_TIMEOUT,
50    &address_1
51  );
52  directive_failed( status, "rtems_region_get_segment" );
53  puts_nocr( "TA1 - got segment from region 1 - " );
54  Put_address_from_area_1( address_1 );
55  new_line;
56
57  puts(
58    "TA1 - rtems_region_get_segment - wait on 128 byte segment from region 1"
59  );
60  rtems_region_get_segment(
61    Region_id[ 1 ],
62    128,
63    RTEMS_DEFAULT_OPTIONS,
64    RTEMS_NO_TIMEOUT,
65    &address_2
66  );
67  directive_failed( status, "rtems_region_get_segment" );
68  puts_nocr( "TA1 - got segment from region 1 - " );
69  Put_address_from_area_1( address_2 );
70  new_line;
71
72  puts(
73    "TA1 - rtems_region_get_segment - wait on 256 byte segment from region 1"
74  );
75  rtems_region_get_segment(
76    Region_id[ 1 ],
77    256,
78    RTEMS_DEFAULT_OPTIONS,
79    RTEMS_NO_TIMEOUT,
80    &address_3
81  );
82  directive_failed( status, "rtems_region_get_segment" );
83  puts_nocr( "TA1 - got segment from region 1 - " );
84  Put_address_from_area_1( address_3 );
85  new_line;
86
87  puts(
88    "TA1 - rtems_region_get_segment - wait on 512 byte segment from region 1"
89  );
90  rtems_region_get_segment(
91    Region_id[ 1 ],
92    512,
93    RTEMS_DEFAULT_OPTIONS,
94    RTEMS_NO_TIMEOUT,
95    &address_4
96  );
97  directive_failed( status, "rtems_region_get_segment" );
98  puts_nocr( "TA1 - got segment from region 1 - " );
99  Put_address_from_area_1( address_4 );
100  new_line;
101
102  puts(
103    "TA1 - rtems_region_get_segment - wait on 1024 byte segment from region 1"
104  );
105  rtems_region_get_segment(
106    Region_id[ 1 ],
107    1024,
108    RTEMS_DEFAULT_OPTIONS,
109    RTEMS_NO_TIMEOUT,
110    &address_5
111  );
112  directive_failed( status, "rtems_region_get_segment" );
113  puts_nocr( "TA1 - got segment from region 1 - " );
114  Put_address_from_area_1( address_5 );
115  new_line;
116
117  puts(
118    "TA1 - rtems_region_get_segment - wait on 2048 byte segment from region 1"
119  );
120  rtems_region_get_segment(
121    Region_id[ 1 ],
122    2048,
123    RTEMS_DEFAULT_OPTIONS,
124    RTEMS_NO_TIMEOUT,
125    &address_6
126  );
127  directive_failed( status, "rtems_region_get_segment" );
128  puts_nocr( "TA1 - got segment from region 1 - " );
129  Put_address_from_area_1( address_6 );
130  new_line;
131
132  puts(
133    "TA1 - rtems_region_get_segment - wait on 4096 byte segment from region 1"
134  );
135  rtems_region_get_segment(
136    Region_id[ 1 ],
137    4096,
138    RTEMS_DEFAULT_OPTIONS,
139    RTEMS_NO_TIMEOUT,
140    &address_7
141  );
142  directive_failed( status, "rtems_region_get_segment" );
143  puts_nocr( "TA1 - got segment from region 1 - " );
144  Put_address_from_area_1( address_7 );
145  new_line;
146
147  puts(
148    "TA1 - rtems_region_get_segment - wait on 8192 byte segment from region 1"
149  );
150  rtems_region_get_segment(
151    Region_id[ 1 ],
152    8192,
153    RTEMS_DEFAULT_OPTIONS,
154    RTEMS_NO_TIMEOUT,
155    &address_8
156  );
157  directive_failed( status, "rtems_region_get_segment" );
158  puts_nocr( "TA1 - got segment from region 1 - " );
159  Put_address_from_area_1( address_8 );
160  new_line;
161
162pause();
163
164  puts_nocr(
165    "TA1 - rtems_region_return_segment - return segment to region 1 - "
166  );
167  Put_address_from_area_1( address_3 );
168  status = rtems_region_return_segment( Region_id[ 1 ], address_3 );
169  directive_failed( status, "rtems_region_return_segment" );
170  new_line;
171  address_3 = 0;
172
173  puts_nocr(
174    "TA1 - rtems_region_return_segment - return segment to region 1 - "
175  );
176  Put_address_from_area_1( address_4 );
177  status = rtems_region_return_segment( Region_id[ 1 ], address_4 );
178  directive_failed( status, "rtems_region_return_segment" );
179  new_line;
180  address_4 = 0;
181
182  puts_nocr(
183    "TA1 - rtems_region_return_segment - return segment to region 1 - "
184  );
185  Put_address_from_area_1( address_1 );
186  status = rtems_region_return_segment( Region_id[ 1 ], address_1 );
187  directive_failed( status, "rtems_region_return_segment" );
188  new_line;
189  address_1 = 0;
190
191  puts_nocr(
192    "TA1 - rtems_region_return_segment - return segment to region 1 - "
193  );
194  Put_address_from_area_1( address_2 );
195  status = rtems_region_return_segment( Region_id[ 1 ], address_2 );
196  directive_failed( status, "rtems_region_return_segment" );
197  new_line;
198  address_2 = 0;
199
200  puts_nocr(
201    "TA1 - rtems_region_return_segment - return segment to region 1 - "
202  );
203  Put_address_from_area_1( address_7 );
204  status = rtems_region_return_segment( Region_id[ 1 ], address_7 );
205  directive_failed( status, "rtems_region_return_segment" );
206  new_line;
207  address_7 = 0;
208
209  puts_nocr(
210    "TA1 - rtems_region_return_segment - return segment to region 1 - "
211  );
212  Put_address_from_area_1( address_6 );
213  status = rtems_region_return_segment( Region_id[ 1 ], address_6 );
214  directive_failed( status, "rtems_region_return_segment" );
215  new_line;
216  address_6 = 0;
217
218  puts_nocr(
219    "TA1 - rtems_region_return_segment - return segment to region 1 - "
220  );
221  Put_address_from_area_1( address_8 );
222  status = rtems_region_return_segment( Region_id[ 1 ], address_8 );
223  directive_failed( status, "rtems_region_return_segment" );
224  new_line;
225  address_8 = 0;
226
227  puts_nocr(
228    "TA1 - rtems_region_return_segment - return segment to region 1 - "
229  );
230  Put_address_from_area_1( address_5 );
231  status = rtems_region_return_segment( Region_id[ 1 ], address_5 );
232  directive_failed( status, "rtems_region_return_segment" );
233  new_line;
234  address_5 = 0;
235
236  puts( "TA1 - rtems_region_delete - walks heap if debug enabled" );
237  rtems_region_delete(Region_id[ 1 ]);
238
239  puts( "*** END OF TEST 25 ***" );
240  exit( 0 );
241}
Note: See TracBrowser for help on using the repository browser.