source: rtems/c/src/exec/score/macros/wkspace.inl @ ac7d5ef0

4.104.114.84.95
Last change on this file since ac7d5ef0 was ac7d5ef0, checked in by Joel Sherrill <joel.sherrill@…>, on 05/11/95 at 17:39:37

Initial revision

  • Property mode set to 100644
File size: 2.1 KB
Line 
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_Allocate_or_fatal_error
70 *
71 *  NOTE:  XXX FIX ME
72 *
73 *  When not using static inlines, this should really be a function
74 *  somewhere.
75 */
76
77static inline void _Workspace_Allocate_or_fatal_error(
78  unsigned32   size
79)
80{
81  void        *memory;
82
83  memory = _Workspace_Allocate( size );
84
85  if ( memory == NULL )
86    rtems_fatal_error_occurred( RTEMS_UNSATISFIED );
87
88  return memory;
89}
90
91/*PAGE
92 *
93 *  _Workspace_Free
94 *
95 */
96
97#define _Workspace_Free( _block ) \
98   _Heap_Free( &_Workspace_Area, (_block) )
99
100#endif
101/* end of include file */
Note: See TracBrowser for help on using the repository browser.