GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> PBS / V2-12-1 > pbs / rhel6-32


Interface   Data Structures   File List   Data Fields   Globals  

MBA.c.xx-xxx-xxx File Reference

Implements the low level memory block allocation routines for a generic platform. More...

#include <stdlib.h>

Functions

int MBA_initialize (MBA_create_cb create, void *prm)
 One time initialization of the MBA facility.
void * MBA_align (unsigned int alignment, unsigned int nBytes)
 Allocates nBytes of aligned memory.
void * MBA_alloc (unsigned int nBytes)
 Allocates nBytes of at least word aligned memory.
int MBA_free (void *pBlock)
 Frees a piece of memory allocated with either MBA_align() or MBA_alloc().
int MBA_statsGet (MBA_stats *stats)
 Gets the memory stats for the MBA partition.


Detailed Description

Implements the low level memory block allocation routines for a generic platform.

Author:
JJRussell - russell@slac.stanford.edu

    CVS $Id: MBA.c.xx-xxx-xxx,v 1.5 2005/05/12 19:42:58 russell Exp $

Function Documentation

void * MBA_align ( unsigned int  alignment,
unsigned int  nBytes 
)

Allocates nBytes of aligned memory.

Parameters:
alignment The alignment factor. This must be a power of 2
nBytes The number of bytes to allocate
Returns:
If successful, a pointer to the allocated memory, Else NULL
Warning:
Note that the calling sequence to this routine follows the convention of memalign(), not that of the VxWorks routine memPartAlign().

void * MBA_alloc ( unsigned int  nBytes  ) 

Allocates nBytes of at least word aligned memory.

Parameters:
nBytes The number of bytes to allocate
Returns:
If successful, a pointer to the allocated memory, Else NULL

Referenced by MTX__create(), SEM__create(), TASK_cvt(), and WUT_sys_init().

int MBA_free ( void *  pBlock  ) 

Frees a piece of memory allocated with either MBA_align() or MBA_alloc().

Parameters:
pBlock Pointer to the block of memory to be freed.
Return values:
0,if successful
-1,if error
The return error codes are only supported on VxWorks platforms. On generic platforms, success is always returned. This is because free() does not give any indication of success or failure, whereas the VxWorks memPart routines do.

Referenced by MTX__create(), MTX__destroy(), SEM__create(), SEM__destroy(), TASK_cvt(), TASK_rvt(), and WUT_sys_shutdown().

int MBA_initialize ( MBA_create_cb  create,
void *  prm 
)

One time initialization of the MBA facility.

Returns:
Status
Parameters:
create User callback partition creation meant to usurp the default creation routine in an extreme emergency
prm Arbitrary user parameter passed to partition creation routine. If the partition creation routine is specified as NULL, then, if this parameter is treated as a pointer to a list of bad blocks, MBA_badBlock.
This is not meant to be a user callable routine.

Referenced by PBS_initialize2().

int MBA_statsGet ( MBA_stats stats  ) 

Gets the memory stats for the MBA partition.

Parameters:
stats Pointer to the statistics block to fill
Return values:
0,if successful
-1,if error
On generic host platforms, this call is provided only for portability reasons. Such statistics either do not exist or exist, but there is no user level access to them.

Warning:
Because these statistics do not exist, the caller should not depend on the contents of the filled in statistics block. Anything beyond just displaying or reporting the contents is sure to get the caller in trouble. If one is depending on these results, then it is up to the caller to make his code portable across both a VXWORS and a generic platform.

References _MBA_stats::maxBlockSizeFree, _MBA_stats::numBlocksAlloc, _MBA_stats::numBlocksFree, _MBA_stats::numBytesAlloc, and _MBA_stats::numBytesFree.


Generated on Mon Aug 1 14:54:42 2011 by  doxygen 1.5.8