OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [tests/] [sptests/] [sp25/] [task1.c] - Blame information for rev 509

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*  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-1999.
11
 *  On-Line Applications Research Corporation (OAR).
12
 *
13
 *  The license and distribution terms for this file may be
14
 *  found in the file LICENSE in this distribution or at
15
 *  http://www.OARcorp.com/rtems/license.html.
16
 *
17
 *  $Id: task1.c,v 1.2 2001-09-27 12:02:36 chris Exp $
18
 */
19
 
20
#include "system.h"
21
 
22
rtems_task Task_1(
23
  rtems_task_argument argument
24
)
25
{
26
  void              *address_1;
27
  void              *address_2;
28
  void              *address_3;
29
  void              *address_4;
30
  void              *address_5;
31
  void              *address_6;
32
  void              *address_7;
33
  void              *address_8;
34
  rtems_status_code  status;
35
  rtems_id           region_id;
36
 
37
  status = rtems_region_ident(Region_name[ 1 ], &region_id);
38
  printf( "TA1 - rtems_region_ident - 0x%08x\n", region_id );
39
  directive_failed(status, "rtems_region_ident of RN01");
40
 
41
  puts(
42
    "TA1 - rtems_region_get_segment - wait on 64 byte segment from region 1"
43
  );
44
  rtems_region_get_segment(
45
    Region_id[ 1 ],
46
    64,
47
    RTEMS_DEFAULT_OPTIONS,
48
    RTEMS_NO_TIMEOUT,
49
    &address_1
50
  );
51
  directive_failed( status, "rtems_region_get_segment" );
52
  puts_nocr( "TA1 - got segment from region 1 - " );
53
  Put_address_from_area_1( address_1 );
54
  new_line;
55
 
56
  puts(
57
    "TA1 - rtems_region_get_segment - wait on 128 byte segment from region 1"
58
  );
59
  rtems_region_get_segment(
60
    Region_id[ 1 ],
61
    128,
62
    RTEMS_DEFAULT_OPTIONS,
63
    RTEMS_NO_TIMEOUT,
64
    &address_2
65
  );
66
  directive_failed( status, "rtems_region_get_segment" );
67
  puts_nocr( "TA1 - got segment from region 1 - " );
68
  Put_address_from_area_1( address_2 );
69
  new_line;
70
 
71
  puts(
72
    "TA1 - rtems_region_get_segment - wait on 256 byte segment from region 1"
73
  );
74
  rtems_region_get_segment(
75
    Region_id[ 1 ],
76
    256,
77
    RTEMS_DEFAULT_OPTIONS,
78
    RTEMS_NO_TIMEOUT,
79
    &address_3
80
  );
81
  directive_failed( status, "rtems_region_get_segment" );
82
  puts_nocr( "TA1 - got segment from region 1 - " );
83
  Put_address_from_area_1( address_3 );
84
  new_line;
85
 
86
  puts(
87
    "TA1 - rtems_region_get_segment - wait on 512 byte segment from region 1"
88
  );
89
  rtems_region_get_segment(
90
    Region_id[ 1 ],
91
    512,
92
    RTEMS_DEFAULT_OPTIONS,
93
    RTEMS_NO_TIMEOUT,
94
    &address_4
95
  );
96
  directive_failed( status, "rtems_region_get_segment" );
97
  puts_nocr( "TA1 - got segment from region 1 - " );
98
  Put_address_from_area_1( address_4 );
99
  new_line;
100
 
101
  puts(
102
    "TA1 - rtems_region_get_segment - wait on 1024 byte segment from region 1"
103
  );
104
  rtems_region_get_segment(
105
    Region_id[ 1 ],
106
    1024,
107
    RTEMS_DEFAULT_OPTIONS,
108
    RTEMS_NO_TIMEOUT,
109
    &address_5
110
  );
111
  directive_failed( status, "rtems_region_get_segment" );
112
  puts_nocr( "TA1 - got segment from region 1 - " );
113
  Put_address_from_area_1( address_5 );
114
  new_line;
115
 
116
  puts(
117
    "TA1 - rtems_region_get_segment - wait on 2048 byte segment from region 1"
118
  );
119
  rtems_region_get_segment(
120
    Region_id[ 1 ],
121
    2048,
122
    RTEMS_DEFAULT_OPTIONS,
123
    RTEMS_NO_TIMEOUT,
124
    &address_6
125
  );
126
  directive_failed( status, "rtems_region_get_segment" );
127
  puts_nocr( "TA1 - got segment from region 1 - " );
128
  Put_address_from_area_1( address_6 );
129
  new_line;
130
 
131
  puts(
132
    "TA1 - rtems_region_get_segment - wait on 4096 byte segment from region 1"
133
  );
134
  rtems_region_get_segment(
135
    Region_id[ 1 ],
136
    4096,
137
    RTEMS_DEFAULT_OPTIONS,
138
    RTEMS_NO_TIMEOUT,
139
    &address_7
140
  );
141
  directive_failed( status, "rtems_region_get_segment" );
142
  puts_nocr( "TA1 - got segment from region 1 - " );
143
  Put_address_from_area_1( address_7 );
144
  new_line;
145
 
146
  puts(
147
    "TA1 - rtems_region_get_segment - wait on 8192 byte segment from region 1"
148
  );
149
  rtems_region_get_segment(
150
    Region_id[ 1 ],
151
    8192,
152
    RTEMS_DEFAULT_OPTIONS,
153
    RTEMS_NO_TIMEOUT,
154
    &address_8
155
  );
156
  directive_failed( status, "rtems_region_get_segment" );
157
  puts_nocr( "TA1 - got segment from region 1 - " );
158
  Put_address_from_area_1( address_8 );
159
  new_line;
160
 
161
rtems_test_pause();
162
 
163
  puts_nocr(
164
    "TA1 - rtems_region_return_segment - return segment to region 1 - "
165
  );
166
  Put_address_from_area_1( address_3 );
167
  status = rtems_region_return_segment( Region_id[ 1 ], address_3 );
168
  directive_failed( status, "rtems_region_return_segment" );
169
  new_line;
170
  address_3 = 0;
171
 
172
  puts_nocr(
173
    "TA1 - rtems_region_return_segment - return segment to region 1 - "
174
  );
175
  Put_address_from_area_1( address_4 );
176
  status = rtems_region_return_segment( Region_id[ 1 ], address_4 );
177
  directive_failed( status, "rtems_region_return_segment" );
178
  new_line;
179
  address_4 = 0;
180
 
181
  puts_nocr(
182
    "TA1 - rtems_region_return_segment - return segment to region 1 - "
183
  );
184
  Put_address_from_area_1( address_1 );
185
  status = rtems_region_return_segment( Region_id[ 1 ], address_1 );
186
  directive_failed( status, "rtems_region_return_segment" );
187
  new_line;
188
  address_1 = 0;
189
 
190
  puts_nocr(
191
    "TA1 - rtems_region_return_segment - return segment to region 1 - "
192
  );
193
  Put_address_from_area_1( address_2 );
194
  status = rtems_region_return_segment( Region_id[ 1 ], address_2 );
195
  directive_failed( status, "rtems_region_return_segment" );
196
  new_line;
197
  address_2 = 0;
198
 
199
  puts_nocr(
200
    "TA1 - rtems_region_return_segment - return segment to region 1 - "
201
  );
202
  Put_address_from_area_1( address_7 );
203
  status = rtems_region_return_segment( Region_id[ 1 ], address_7 );
204
  directive_failed( status, "rtems_region_return_segment" );
205
  new_line;
206
  address_7 = 0;
207
 
208
  puts_nocr(
209
    "TA1 - rtems_region_return_segment - return segment to region 1 - "
210
  );
211
  Put_address_from_area_1( address_6 );
212
  status = rtems_region_return_segment( Region_id[ 1 ], address_6 );
213
  directive_failed( status, "rtems_region_return_segment" );
214
  new_line;
215
  address_6 = 0;
216
 
217
  puts_nocr(
218
    "TA1 - rtems_region_return_segment - return segment to region 1 - "
219
  );
220
  Put_address_from_area_1( address_8 );
221
  status = rtems_region_return_segment( Region_id[ 1 ], address_8 );
222
  directive_failed( status, "rtems_region_return_segment" );
223
  new_line;
224
  address_8 = 0;
225
 
226
  puts_nocr(
227
    "TA1 - rtems_region_return_segment - return segment to region 1 - "
228
  );
229
  Put_address_from_area_1( address_5 );
230
  status = rtems_region_return_segment( Region_id[ 1 ], address_5 );
231
  directive_failed( status, "rtems_region_return_segment" );
232
  new_line;
233
  address_5 = 0;
234
 
235
  puts( "TA1 - rtems_region_delete - walks heap if debug enabled" );
236
  rtems_region_delete(Region_id[ 1 ]);
237
 
238
  puts( "*** END OF TEST 25 ***" );
239
  exit( 0 );
240
}

powered by: WebSVN 2.1.0

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