1 | /* wkspace.inl |
---|
2 | * |
---|
3 | * This file contains the macro implementation of the inlined routines |
---|
4 | * from the RTEMS RAM Workspace Handler. |
---|
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 | #include <rtems/heap.h> |
---|
21 | #include <rtems/fatal.h> |
---|
22 | #include <rtems/status.h> |
---|
23 | |
---|
24 | /*PAGE |
---|
25 | * |
---|
26 | * _Workspace_Handler_initialization |
---|
27 | * |
---|
28 | */ |
---|
29 | |
---|
30 | #define _Workspace_Handler_initialization( _starting_address, _size ) \ |
---|
31 | { \ |
---|
32 | unsigned32 *zero_out_array; \ |
---|
33 | unsigned32 index; \ |
---|
34 | unsigned32 memory_available; \ |
---|
35 | \ |
---|
36 | if ( ((_starting_address) == NULL) || \ |
---|
37 | !_Addresses_Is_aligned( (_starting_address) ) ) \ |
---|
38 | rtems_fatal_error_occurred( RTEMS_INVALID_ADDRESS ); \ |
---|
39 | \ |
---|
40 | if ( _CPU_Table.do_zero_of_workspace ) { \ |
---|
41 | for( zero_out_array = (unsigned32 *) (_starting_address), index = 0 ; \ |
---|
42 | index < (_size) / 4 ; \ |
---|
43 | index++ ) \ |
---|
44 | zero_out_array[ index ] = 0; \ |
---|
45 | } \ |
---|
46 | \ |
---|
47 | memory_available = _Heap_Initialize( \ |
---|
48 | &_Workspace_Area, \ |
---|
49 | (_starting_address), \ |
---|
50 | (_size), \ |
---|
51 | CPU_ALIGNMENT \ |
---|
52 | ); \ |
---|
53 | \ |
---|
54 | if ( memory_available == 0 ) \ |
---|
55 | rtems_fatal_error_occurred( RTEMS_UNSATISFIED ); \ |
---|
56 | } |
---|
57 | |
---|
58 | /*PAGE |
---|
59 | * |
---|
60 | * _Workspace_Allocate |
---|
61 | * |
---|
62 | */ |
---|
63 | |
---|
64 | #define _Workspace_Allocate( _size ) \ |
---|
65 | _Heap_Allocate( &_Workspace_Area, (_size) ) |
---|
66 | |
---|
67 | /*PAGE |
---|
68 | * |
---|
69 | * _Workspace_Free |
---|
70 | * |
---|
71 | */ |
---|
72 | |
---|
73 | #define _Workspace_Free( _block ) \ |
---|
74 | _Heap_Free( &_Workspace_Area, (_block) ) |
---|
75 | |
---|
76 | #endif |
---|
77 | /* end of include file */ |
---|