source: rtems/cpukit/include/rtems/score/wkspace.h @ 4c20da4b

5
Last change on this file since 4c20da4b was 4c20da4b, checked in by Sebastian Huber <sebastian.huber@…>, on 04/04/19 at 07:18:11

doxygen: Rename Score* groups in RTEMSScore*

Update #3706

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