1 | /** |
---|
2 | * @file rtems/score/wkspace.h |
---|
3 | * |
---|
4 | * This include file contains information related to the |
---|
5 | * RAM Workspace. This Handler provides mechanisms which can be used to |
---|
6 | * define, initialize and manipulate the workspace. |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * COPYRIGHT (c) 1989-2008. |
---|
11 | * On-Line Applications Research Corporation (OAR). |
---|
12 | * |
---|
13 | * The license and distribution terms for this file may be |
---|
14 | * found in the file LICENSE in this distribution or at |
---|
15 | * http://www.rtems.com/license/LICENSE. |
---|
16 | * |
---|
17 | * $Id$ |
---|
18 | */ |
---|
19 | |
---|
20 | #ifndef _RTEMS_SCORE_WKSPACE_H |
---|
21 | #define _RTEMS_SCORE_WKSPACE_H |
---|
22 | |
---|
23 | /** |
---|
24 | * @defgroup ScoreWorkspace Workspace Handler |
---|
25 | * |
---|
26 | * This handler encapsulates functionality related to the management of |
---|
27 | * the RTEMS Executive Workspace. |
---|
28 | */ |
---|
29 | /**@{*/ |
---|
30 | |
---|
31 | #ifdef __cplusplus |
---|
32 | extern "C" { |
---|
33 | #endif |
---|
34 | |
---|
35 | #include <rtems/score/heap.h> |
---|
36 | #include <rtems/score/interr.h> |
---|
37 | |
---|
38 | /** @brief Executive Workspace Control |
---|
39 | * |
---|
40 | * The is the heap control structure that used to manage the |
---|
41 | * RTEMS Executive Workspace. |
---|
42 | */ |
---|
43 | SCORE_EXTERN Heap_Control _Workspace_Area; /* executive heap header */ |
---|
44 | |
---|
45 | /** @brief Workspace Handler Initialization |
---|
46 | * |
---|
47 | * This routine performs the initialization necessary for this handler. |
---|
48 | */ |
---|
49 | void _Workspace_Handler_initialization(void); |
---|
50 | |
---|
51 | /** @brief Allocate Memory from Workspace |
---|
52 | * |
---|
53 | * This routine returns the address of a block of memory of size |
---|
54 | * bytes. If a block of the appropriate size cannot be allocated |
---|
55 | * from the workspace, then NULL is returned. |
---|
56 | * |
---|
57 | * @param size is the requested size |
---|
58 | * |
---|
59 | * @return a pointer to the requested memory or NULL. |
---|
60 | */ |
---|
61 | void *_Workspace_Allocate( |
---|
62 | size_t size |
---|
63 | ); |
---|
64 | |
---|
65 | /** @brief Free Memory to the Workspace |
---|
66 | * |
---|
67 | * This function frees the specified block of memory. If the block |
---|
68 | * belongs to the Workspace and can be successfully freed, then |
---|
69 | * true is returned. Otherwise false is returned. |
---|
70 | * |
---|
71 | * @param block is the memory to free |
---|
72 | * |
---|
73 | * @note If @a block is equal to NULL, then the request is ignored. |
---|
74 | * This allows the caller to not worry about whether or not |
---|
75 | * a pointer is NULL. |
---|
76 | */ |
---|
77 | |
---|
78 | void _Workspace_Free( |
---|
79 | void *block |
---|
80 | ); |
---|
81 | |
---|
82 | /** @brief Workspace Allocate or Fail with Fatal Error |
---|
83 | * |
---|
84 | * This routine returns the address of a block of memory of @a size |
---|
85 | * bytes. If a block of the appropriate size cannot be allocated |
---|
86 | * from the workspace, then the internal error handler is invoked. |
---|
87 | * |
---|
88 | * @param[in] size is the desired number of bytes to allocate |
---|
89 | * @return If successful, the starting address of the allocated memory |
---|
90 | */ |
---|
91 | void *_Workspace_Allocate_or_fatal_error( |
---|
92 | size_t size |
---|
93 | ); |
---|
94 | |
---|
95 | #ifndef __RTEMS_APPLICATION__ |
---|
96 | #include <rtems/score/wkspace.inl> |
---|
97 | #endif |
---|
98 | |
---|
99 | #ifdef __cplusplus |
---|
100 | } |
---|
101 | #endif |
---|
102 | |
---|
103 | /**@}*/ |
---|
104 | |
---|
105 | #endif |
---|
106 | /* end of include file */ |
---|