2008-02-04 Jennifer Averett <jennifer.averett@OARcorp.com>

* rtems/Makefile.am, rtems/include/rtems/rtems/support.h: Added
	workspace manipulation routines for testing.
	* rtems/src/workspace.c: New file.
This commit is contained in:
Jennifer Averett
2008-02-04 19:37:46 +00:00
parent 348eada43b
commit 6d4940d508
4 changed files with 124 additions and 3 deletions

View File

@@ -1,3 +1,9 @@
2008-02-04 Jennifer Averett <jennifer.averett@OARcorp.com>
* rtems/Makefile.am, rtems/include/rtems/rtems/support.h: Added
workspace manipulation routines for testing.
* rtems/src/workspace.c: New file.
2008-02-04 Joel Sherrill <joel.sherrill@oarcorp.com>
* rtems/src/rtemsobjectsetname.c, score/src/objectgetinfoid.c,

View File

@@ -131,6 +131,9 @@ librtems_a_SOURCES += src/dpmem.c src/dpmemcreate.c src/dpmemdelete.c \
src/dpmemexternal2internal.c src/dpmemident.c \
src/dpmeminternal2external.c src/dpmemdata.c
## WORKSPACE_FILES
librtems_a_SOURCES += src/workspace.c
librtems_a_SOURCES += src/attr.c
if HAS_MP

View File

@@ -25,17 +25,67 @@ extern "C" {
#include <rtems/rtems/types.h>
/*
* Time related
/** @brief milliseconds to microseconds
*
* This is the public milliseconds to microseconds conversion.
*/
#define RTEMS_MILLISECONDS_TO_MICROSECONDS(_ms) \
TOD_MILLISECONDS_TO_MICROSECONDS(_ms)
/** @brief milliseconds to ticks
*
* This is the public milliseconds to ticks conversion.
*/
#define RTEMS_MILLISECONDS_TO_TICKS(_ms) \
TOD_MILLISECONDS_TO_TICKS(_ms)
/** @brief microseconds to ticks
* This is the public microseconds to tick conversion.
*/
#define RTEMS_MICROSECONDS_TO_TICKS(_ms) \
TOD_MICROSECONDS_TO_TICKS(_ms)
/** @brief get workspace information
*
* This returns information about the heap that is used as
* the RTEMS Executive Workspace.
*
* @param[in] the_info
*
* @return TRUE if successful
*/
boolean rtems_workspace_get_information(
Heap_Information_block *the_info
);
/** @brief get workspace information
*
* This returns information about the heap that is used as
* the RTEMS Executive Workspace.
*
* @param[in] bytes is the number of bytes to allocate
* @param[in] pointer is the returned pointer to allocated memory
*
* @return TRUE if successful
*/
boolean rtems_workspace_allocate(
size_t bytes,
void **pointer
);
/** @brief free workspace
*
* This frees the workspace that was allocated from
* the RTEMS Executive Workspace.
*
* @param[in] pointer is the allocated workspace
*
* @return TRUE if successful
*/
boolean rtems_workspace_free(
void *pointer
);
#ifndef __RTEMS_APPLICATION__
#include <rtems/rtems/support.inl>
#endif

View File

@@ -0,0 +1,62 @@
/*
* Workspace Handler
*
* COPYRIGHT (c) 1989-2007.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif
#include <rtems/system.h>
#include <rtems/score/wkspace.h>
#include <rtems/score/interr.h>
#include <rtems/config.h>
#include <string.h> /* for memset */
boolean rtems_workspace_get_information(
Heap_Information_block *the_info
)
{
Heap_Get_information_status status;
status = _Heap_Get_information( &_Workspace_Area, the_info );
if ( status == HEAP_GET_INFORMATION_SUCCESSFUL )
return TRUE;
else
return FALSE;
}
/*
* _Workspace_Allocate
*/
boolean rtems_workspace_allocate(
size_t bytes,
void **pointer
)
{
*pointer = _Heap_Allocate( &_Workspace_Area, bytes );
if (!pointer)
return FALSE;
else
return TRUE;
}
/*
* _Workspace_Allocate
*/
boolean rtems_workspace_free(
void *pointer
)
{
return _Heap_Free( &_Workspace_Area, pointer );
}