1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @ingroup RTEMSScoreWorkspace |
---|
5 | * |
---|
6 | * @brief Information Related to the RAM Workspace |
---|
7 | * |
---|
8 | * This include file contains information related to the |
---|
9 | * RAM Workspace. This Handler provides mechanisms which can be used to |
---|
10 | * define, initialize and manipulate the workspace. |
---|
11 | */ |
---|
12 | |
---|
13 | /* |
---|
14 | * COPYRIGHT (c) 1989-2009. |
---|
15 | * On-Line Applications Research Corporation (OAR). |
---|
16 | * |
---|
17 | * The license and distribution terms for this file may be |
---|
18 | * found in the file LICENSE in this distribution or at |
---|
19 | * http://www.rtems.org/license/LICENSE. |
---|
20 | */ |
---|
21 | |
---|
22 | #ifndef _RTEMS_SCORE_WKSPACE_H |
---|
23 | #define _RTEMS_SCORE_WKSPACE_H |
---|
24 | |
---|
25 | #include <rtems/score/heap.h> |
---|
26 | #include <rtems/score/interr.h> |
---|
27 | #include <rtems/score/memory.h> |
---|
28 | |
---|
29 | #ifdef __cplusplus |
---|
30 | extern "C" { |
---|
31 | #endif |
---|
32 | |
---|
33 | /** |
---|
34 | * @defgroup RTEMSScoreWorkspace Workspace Handler |
---|
35 | * |
---|
36 | * @ingroup RTEMSScore |
---|
37 | * |
---|
38 | * This handler encapsulates functionality related to the management of |
---|
39 | * the RTEMS Executive Workspace. |
---|
40 | * |
---|
41 | * @{ |
---|
42 | */ |
---|
43 | |
---|
44 | /** |
---|
45 | * @brief Executive workspace control. |
---|
46 | * |
---|
47 | * This is the heap control structure used to manage the RTEMS Executive |
---|
48 | * Workspace. |
---|
49 | */ |
---|
50 | extern Heap_Control _Workspace_Area; |
---|
51 | |
---|
52 | /** |
---|
53 | * @brief Initilizes the workspace handler. |
---|
54 | * |
---|
55 | * This routine performs the initialization necessary for this handler. |
---|
56 | * |
---|
57 | * @param mem The memory information |
---|
58 | * @param extend The extension handler for the new workspace. |
---|
59 | */ |
---|
60 | void _Workspace_Handler_initialization( |
---|
61 | const Memory_Information *mem, |
---|
62 | Heap_Initialization_or_extend_handler extend |
---|
63 | ); |
---|
64 | |
---|
65 | /** |
---|
66 | * @brief Allocates a memory block of the specified size from the workspace. |
---|
67 | * |
---|
68 | * @param size The size of the memory block. |
---|
69 | * |
---|
70 | * @retval pointer The pointer to the memory block. The pointer is at least |
---|
71 | * aligned by CPU_HEAP_ALIGNMENT. |
---|
72 | * @retval NULL No memory block with the requested size is available in the |
---|
73 | * workspace. |
---|
74 | */ |
---|
75 | void *_Workspace_Allocate( size_t size ); |
---|
76 | |
---|
77 | /** |
---|
78 | * @brief Allocates aligned memory from workspace. |
---|
79 | * |
---|
80 | * @param size The size of the requested memory. |
---|
81 | * @param alignment The alignment of the requested memory. |
---|
82 | * |
---|
83 | * @retval other The memory area begin. |
---|
84 | * @retval NULL Not enough resources. |
---|
85 | */ |
---|
86 | void *_Workspace_Allocate_aligned( size_t size, size_t alignment ); |
---|
87 | |
---|
88 | /** |
---|
89 | * @brief Frees memory to the workspace. |
---|
90 | * |
---|
91 | * This function frees the specified block of memory. |
---|
92 | * |
---|
93 | * @param block The memory to free. |
---|
94 | * |
---|
95 | * @note If @a block is equal to NULL, then the request is ignored. |
---|
96 | * This allows the caller to not worry about whether or not |
---|
97 | * a pointer is NULL. |
---|
98 | */ |
---|
99 | void _Workspace_Free( |
---|
100 | void *block |
---|
101 | ); |
---|
102 | |
---|
103 | /** |
---|
104 | * @brief Duplicates string with memory from the workspace. |
---|
105 | * |
---|
106 | * @param string The pointer to a zero terminated string. |
---|
107 | * @param len The length of the string (equal to strlen(string)). |
---|
108 | * |
---|
109 | * @retval other Duplicated string. |
---|
110 | * @retval NULL Not enough memory. |
---|
111 | */ |
---|
112 | char *_Workspace_String_duplicate( |
---|
113 | const char *string, |
---|
114 | size_t len |
---|
115 | ); |
---|
116 | |
---|
117 | /** @} */ |
---|
118 | |
---|
119 | #ifdef __cplusplus |
---|
120 | } |
---|
121 | #endif |
---|
122 | |
---|
123 | #endif |
---|
124 | /* end of include file */ |
---|