source: rtems/cpukit/rtems/src/workspace.c @ 4423e62a

4.104.115
Last change on this file since 4423e62a was 4423e62a, checked in by Joel Sherrill <joel.sherrill@…>, on 05/13/09 at 16:48:08

2009-05-13 Joel Sherrill <joel.sherrill@…>

PR 1411/cpukit

  • rtems/src/workspace.c, score/include/rtems/score/protectedheap.h, score/src/pheapgetfreeinfo.c, score/src/pheapgetinfo.c: Improve workspace wrapper methods.
  • Property mode set to 100644
File size: 1.2 KB
Line 
1/*
2 *  Workspace Handler
3 *
4 *  COPYRIGHT (c) 1989-2009.
5 *  On-Line Applications Research Corporation (OAR).
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.rtems.com/license/LICENSE.
10 *
11 *  $Id$
12 */
13
14#if HAVE_CONFIG_H
15#include "config.h"
16#endif
17
18#include <rtems/system.h>
19#include <rtems/score/wkspace.h>
20#include <rtems/score/protectedheap.h>
21#include <rtems/score/interr.h>
22#include <rtems/config.h>
23
24#include <string.h>  /* for memset */
25
26bool rtems_workspace_get_information(
27  Heap_Information_block  *the_info
28)
29{
30  if ( !the_info )
31    return false;
32
33  return _Protected_heap_Get_information( &_Workspace_Area, the_info );
34}
35
36/*
37 *  _Workspace_Allocate
38 */
39bool rtems_workspace_allocate(
40  uintptr_t   bytes,
41  void      **pointer
42)
43{
44  void *ptr;
45
46  /*
47   * check the arguments
48   */
49  if ( !pointer )
50    return false;
51
52  if ( !bytes )
53    return false;
54
55  /*
56   * Allocate the memory
57   */
58  ptr =  _Protected_heap_Allocate( &_Workspace_Area, (intptr_t) bytes );
59  if (!ptr)
60    return false;
61
62  *pointer = ptr;
63  return true;
64}
65
66/*
67 *  _Workspace_Allocate
68 */
69bool rtems_workspace_free(
70  void *pointer
71)
72{
73   return _Protected_heap_Free( &_Workspace_Area, pointer );
74}
75
Note: See TracBrowser for help on using the repository browser.