4.115
Last change
on this file since e6b31b27 was
c499856,
checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47
|
Change all references of rtems.com to rtems.org.
|
-
Property mode set to
100644
|
File size:
1.3 KB
|
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief RTEMS Workspace Support |
---|
5 | * @ingroup ClassicRTEMSWorkspace |
---|
6 | */ |
---|
7 | |
---|
8 | /* |
---|
9 | * COPYRIGHT (c) 1989-2009. |
---|
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 |
---|
14 | * http://www.rtems.org/license/LICENSE. |
---|
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> |
---|
23 | #include <rtems/score/protectedheap.h> |
---|
24 | #include <rtems/score/interr.h> |
---|
25 | #include <rtems/config.h> |
---|
26 | #include <rtems/rtems/support.h> |
---|
27 | |
---|
28 | #include <string.h> /* for memset */ |
---|
29 | |
---|
30 | bool rtems_workspace_get_information( |
---|
31 | Heap_Information_block *the_info |
---|
32 | ) |
---|
33 | { |
---|
34 | if ( !the_info ) |
---|
35 | return false; |
---|
36 | |
---|
37 | return _Protected_heap_Get_information( &_Workspace_Area, the_info ); |
---|
38 | } |
---|
39 | |
---|
40 | bool rtems_workspace_allocate( |
---|
41 | size_t bytes, |
---|
42 | void **pointer |
---|
43 | ) |
---|
44 | { |
---|
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 | */ |
---|
59 | ptr = _Protected_heap_Allocate( &_Workspace_Area, bytes ); |
---|
60 | if (!ptr) |
---|
61 | return false; |
---|
62 | |
---|
63 | *pointer = ptr; |
---|
64 | return true; |
---|
65 | } |
---|
66 | |
---|
67 | bool rtems_workspace_free( |
---|
68 | void *pointer |
---|
69 | ) |
---|
70 | { |
---|
71 | return _Protected_heap_Free( &_Workspace_Area, pointer ); |
---|
72 | } |
---|
73 | |
---|
Note: See
TracBrowser
for help on using the repository browser.