1 | /* wkspace.inl |
---|
2 | * |
---|
3 | * This include file contains the bodies of the routines which contains |
---|
4 | * information related to the RTEMS RAM Workspace. |
---|
5 | * |
---|
6 | * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. |
---|
7 | * On-Line Applications Research Corporation (OAR). |
---|
8 | * All rights assigned to U.S. Government, 1994. |
---|
9 | * |
---|
10 | * This material may be reproduced by or for the U.S. Government pursuant |
---|
11 | * to the copyright license under the clause at DFARS 252.227-7013. This |
---|
12 | * notice must appear in all copies of this file and its derivatives. |
---|
13 | * |
---|
14 | * $Id$ |
---|
15 | */ |
---|
16 | |
---|
17 | #ifndef __WORKSPACE_inl |
---|
18 | #define __WORKSPACE_inl |
---|
19 | |
---|
20 | /*PAGE |
---|
21 | * |
---|
22 | * _Workspace_Handler_initialization |
---|
23 | * |
---|
24 | */ |
---|
25 | |
---|
26 | STATIC INLINE void _Workspace_Handler_initialization( |
---|
27 | void *starting_address, |
---|
28 | unsigned32 size |
---|
29 | ) |
---|
30 | { |
---|
31 | unsigned32 *zero_out_array; |
---|
32 | unsigned32 index; |
---|
33 | unsigned32 memory_available; |
---|
34 | |
---|
35 | if ( (starting_address == NULL) || |
---|
36 | !_Addresses_Is_aligned( starting_address ) ) |
---|
37 | rtems_fatal_error_occurred( RTEMS_INVALID_ADDRESS ); |
---|
38 | |
---|
39 | if ( _CPU_Table.do_zero_of_workspace ) { |
---|
40 | for( zero_out_array = (unsigned32 *) starting_address, index = 0 ; |
---|
41 | index < size / 4 ; |
---|
42 | index++ ) |
---|
43 | zero_out_array[ index ] = 0; |
---|
44 | } |
---|
45 | |
---|
46 | memory_available = _Heap_Initialize( |
---|
47 | &_Workspace_Area, |
---|
48 | starting_address, |
---|
49 | size, |
---|
50 | CPU_HEAP_ALIGNMENT |
---|
51 | ); |
---|
52 | |
---|
53 | if ( memory_available == 0 ) |
---|
54 | rtems_fatal_error_occurred( RTEMS_UNSATISFIED ); |
---|
55 | } |
---|
56 | |
---|
57 | /*PAGE |
---|
58 | * |
---|
59 | * _Workspace_Allocate |
---|
60 | * |
---|
61 | */ |
---|
62 | |
---|
63 | STATIC INLINE void *_Workspace_Allocate( |
---|
64 | unsigned32 size |
---|
65 | ) |
---|
66 | { |
---|
67 | return _Heap_Allocate( &_Workspace_Area, size ); |
---|
68 | } |
---|
69 | |
---|
70 | /*PAGE |
---|
71 | * |
---|
72 | * _Workspace_Free |
---|
73 | * |
---|
74 | */ |
---|
75 | |
---|
76 | STATIC INLINE boolean _Workspace_Free( |
---|
77 | void *block |
---|
78 | ) |
---|
79 | { |
---|
80 | return _Heap_Free( &_Workspace_Area, block ); |
---|
81 | } |
---|
82 | |
---|
83 | #endif |
---|
84 | /* end of include file */ |
---|