source:
rtems/cpukit/rtems/src/workspace.c
@
e6b31b27
Last change on this file since e6b31b27 was c499856, checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47 | |
---|---|
|
|
File size: 1.3 KB |
Rev | Line | |
---|---|---|
[a6500136] | 1 | /** |
2 | * @file | |
[6d4940d] | 3 | * |
[a6500136] | 4 | * @brief RTEMS Workspace Support |
5 | * @ingroup ClassicRTEMSWorkspace | |
6 | */ | |
7 | ||
8 | /* | |
[4423e62a] | 9 | * COPYRIGHT (c) 1989-2009. |
[6d4940d] | 10 | * On-Line Applications Research Corporation (OAR). |
11 | * | |
12 | * The license and distribution terms for this file may be | |
13 | * found in the file LICENSE in this distribution or at | |
[c499856] | 14 | * http://www.rtems.org/license/LICENSE. |
[6d4940d] | 15 | */ |
16 | ||
17 | #if HAVE_CONFIG_H | |
18 | #include "config.h" | |
19 | #endif | |
20 | ||
21 | #include <rtems/system.h> | |
22 | #include <rtems/score/wkspace.h> | |
[4423e62a] | 23 | #include <rtems/score/protectedheap.h> |
[6d4940d] | 24 | #include <rtems/score/interr.h> |
25 | #include <rtems/config.h> | |
[adfc907] | 26 | #include <rtems/rtems/support.h> |
[6d4940d] | 27 | |
28 | #include <string.h> /* for memset */ | |
29 | ||
[484a769] | 30 | bool rtems_workspace_get_information( |
[6d4940d] | 31 | Heap_Information_block *the_info |
32 | ) | |
33 | { | |
[4423e62a] | 34 | if ( !the_info ) |
[484a769] | 35 | return false; |
[4423e62a] | 36 | |
37 | return _Protected_heap_Get_information( &_Workspace_Area, the_info ); | |
[6d4940d] | 38 | } |
39 | ||
[484a769] | 40 | bool rtems_workspace_allocate( |
[adfc907] | 41 | size_t bytes, |
[4423e62a] | 42 | void **pointer |
[6d4940d] | 43 | ) |
44 | { | |
[4423e62a] | 45 | void *ptr; |
46 | ||
47 | /* | |
48 | * check the arguments | |
49 | */ | |
50 | if ( !pointer ) | |
51 | return false; | |
52 | ||
53 | if ( !bytes ) | |
54 | return false; | |
55 | ||
56 | /* | |
57 | * Allocate the memory | |
58 | */ | |
[adfc907] | 59 | ptr = _Protected_heap_Allocate( &_Workspace_Area, bytes ); |
[4423e62a] | 60 | if (!ptr) |
61 | return false; | |
62 | ||
63 | *pointer = ptr; | |
64 | return true; | |
[6d4940d] | 65 | } |
66 | ||
[484a769] | 67 | bool rtems_workspace_free( |
[6d4940d] | 68 | void *pointer |
69 | ) | |
70 | { | |
[4423e62a] | 71 | return _Protected_heap_Free( &_Workspace_Area, pointer ); |
[6d4940d] | 72 | } |
73 |
Note: See TracBrowser
for help on using the repository browser.