GLAST/LAT >
DAQ and FSW >
FSW >
Doxygen Index >
PBS / V2-10-5
Constituent: pbs     Tag: rad750
Interface Data Structures File List Data Fields Globals
MBA.h File Reference
Random memory allocation, function prototypes.
More...
#include "PBS/impl/MBA.h.xx-xxx-xxx"
Include dependency graph for MBA.h:
This graph shows which files directly or indirectly include this file:
Detailed Description
Random memory allocation, function prototypes.
- Author:
- JJRussell - russell@slac.stanford.edu
CVS $Id: MBA.h,v 1.3 2005/05/12 19:42:56 russell Exp $
- SYNOPSIS
- This file acts as a front for malloc() and memalign() on host platforms and for memPartAlloc and memPartAlignedAlloc on VxWorks. Application level code should always use the equivalent M routines. On VxWork's platforms, malloc() and memalign(), by default, allocate out of the system partition. Because the VxWork's dynamic loader uses malloc() and because restrictions on the range of branch statements, the system partition must be limited to less than 24Mbytes.
With this in mind, FSW decided on a policy that discourages use of malloc() and memalign() in application code, effectively reserving the system partition for exclusive use by VxWorks itself.
Typedef Documentation
|
Typedef for struct _MBA_badBlock.
- A bad block is defined as a starting address and a length, in bytes. Typically one will specify a list of bad blocks. By convention, the list is terminated with a block specified with a beginning address of 0 and a length of 0.
- On embedded systems, MBA will remove bad blocks that fall within the range of its pool. This will be done at system initialization time. Unforturnately, there is no easy way to do this if the bad blocks fall within the system partition. It appears the only method here is to rebuild the kernel.
- Note:
- This should have been an easy job. One would have used the memory mapping registers to remap around the bad blocks. But, alas, the page registers do not work on the RAD750, hence this method.
|
|
Function signature for a user definition initialization routine.
- Returns:
- The partition id
- Parameters:
-
prm | Arbitrary user parameter |
- While this function will get called back on non-VxWorks targets, it has no effect and is there simply for portability.
|
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
|
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. |
|
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. |
Here is the call graph for this function:
|
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 VXWORKS platforms, this is just a cover for memInfoGet.
- Warning:
- These statistics do not exist on generic platforms. The call interface is provided only as a convenience. On generic platforms, the caller should only use the contents for logging or display purposes. It is up to the caller to make his code portable across both a VXWORS and a generic platform.
Additional advise. Even under VXWORKS, unless one can guarantee that the partition is not being used by another thread of execution at the time of call till the time one acts on a decision made as a result of examining the contents of the statistics block, then do not depend on the results of the call for anything more than logging or display purposes. Without the single-threaded constraint, the statistics can certainly change between the time one gathers the statistics and when one acts on them. Bottom line, this call should only ever be used for display or casual diagnostic reasons. |
Generated on Tue Sep 13 21:38:50 2005 by
1.3.3