1 | /* Task5 |
---|
2 | * |
---|
3 | * This routine serves as a test task. It competes with the other tasks |
---|
4 | * for region resources. |
---|
5 | * |
---|
6 | * Input parameters: |
---|
7 | * argument - task argument |
---|
8 | * |
---|
9 | * Output parameters: NONE |
---|
10 | * |
---|
11 | * COPYRIGHT (c) 1989-2009. |
---|
12 | * On-Line Applications Research Corporation (OAR). |
---|
13 | * |
---|
14 | * The license and distribution terms for this file may be |
---|
15 | * found in the file LICENSE in this distribution or at |
---|
16 | * http://www.rtems.com/license/LICENSE. |
---|
17 | * |
---|
18 | * $Id$ |
---|
19 | */ |
---|
20 | |
---|
21 | #include "system.h" |
---|
22 | |
---|
23 | rtems_task Task5( |
---|
24 | rtems_task_argument argument |
---|
25 | ) |
---|
26 | { |
---|
27 | void *segment_address_1; |
---|
28 | void *segment_address_2; |
---|
29 | rtems_status_code status; |
---|
30 | |
---|
31 | puts( "TA5 - rtems_region_get_segment - wait on 1.5K segment from region 1" ); |
---|
32 | status = rtems_region_get_segment( |
---|
33 | Region_id[ 1 ], |
---|
34 | 1536, |
---|
35 | RTEMS_DEFAULT_OPTIONS, |
---|
36 | RTEMS_NO_TIMEOUT, |
---|
37 | &segment_address_1 |
---|
38 | ); |
---|
39 | directive_failed( status, "rtems_region_get_segment" ); |
---|
40 | |
---|
41 | status = rtems_region_return_segment( Region_id[ 1 ], segment_address_1 ); |
---|
42 | directive_failed( status, "rtems_region_return_segment" ); |
---|
43 | puts_nocr( "TA5 - got and returned " ); |
---|
44 | Put_address_from_area_1( segment_address_1 ); |
---|
45 | new_line; |
---|
46 | |
---|
47 | /* |
---|
48 | * Use TOD_MICROSECONDS_TO_TICKS not RTEMS_MICROSECONDS_TO_TICKS to |
---|
49 | * test C implementation in SuperCore -- not macro version used |
---|
50 | * everywhere else. |
---|
51 | */ |
---|
52 | status = rtems_task_wake_after( TOD_MICROSECONDS_TO_TICKS( 1000000 ) ); |
---|
53 | directive_failed( status, "rtems_task_wake_after" ); |
---|
54 | |
---|
55 | puts( "TA5 - rtems_region_get_segment - wait on 3K segment from region 1" ); |
---|
56 | status = rtems_region_get_segment( |
---|
57 | Region_id[ 1 ], |
---|
58 | 3072, |
---|
59 | RTEMS_DEFAULT_OPTIONS, |
---|
60 | RTEMS_NO_TIMEOUT, |
---|
61 | &segment_address_2 |
---|
62 | ); |
---|
63 | puts_nocr( "TA5 - got segment from region 1 - " ); |
---|
64 | Put_address_from_area_1( segment_address_2 ); |
---|
65 | new_line; |
---|
66 | |
---|
67 | status = rtems_region_return_segment( Region_id[ 1 ], segment_address_2 ); |
---|
68 | puts_nocr( |
---|
69 | "TA5 - rtems_region_return_segment - return segment to region 1 - " |
---|
70 | ); |
---|
71 | Put_address_from_area_1( segment_address_2 ); |
---|
72 | new_line; |
---|
73 | |
---|
74 | puts( "TA5 - rtems_task_delete - delete self" ); |
---|
75 | status = rtems_task_delete( RTEMS_SELF ); |
---|
76 | directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); |
---|
77 | } |
---|