source: rtems/c/src/exec/score/inline/wkspace.inl @ 4ca27cf

4.104.114.84.95
Last change on this file since 4ca27cf 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.0 KB
Line 
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
26STATIC 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
63STATIC INLINE void *_Workspace_Allocate(
64  unsigned32 size
65)
66{
67   return _Heap_Allocate( &_Workspace_Area, size );
68}
69
70/*PAGE
71 *
72 *  _Workspace_Allocate_or_fatal_error
73 *
74 */
75
76STATIC INLINE void *_Workspace_Allocate_or_fatal_error(
77  unsigned32   size
78)
79{
80  void        *memory;
81
82  memory = _Workspace_Allocate( size );
83
84  if ( memory == NULL )
85    rtems_fatal_error_occurred( RTEMS_UNSATISFIED );
86
87  return memory;
88}
89
90/*PAGE
91 *
92 *  _Workspace_Free
93 *
94 */
95
96STATIC INLINE boolean _Workspace_Free(
97  void *block
98)
99{
100   return _Heap_Free( &_Workspace_Area, block );
101}
102
103#endif
104/* end of include file */
Note: See TracBrowser for help on using the repository browser.