This module has a common header that can be found in the
ti.ipc
package. Application code should include the common header file (not the
RTSC-generated one):
#include <ti/ipc/HeapMultiBufMP.h>
The RTSC module must be used in the application's RTSC configuration file
(.cfg) if runtime APIs will be used in the application:
HeapMultiBufMP = xdc.useModule('ti.sdo.ipc.heaps.HeapMultiBufMP');
Documentation for all runtime APIs, instance configuration parameters,
error codes macros and type definitions available to the application
integrator can be found in the
Doxygen documenation
for the IPC product. However, the documentation presented on this page
should be referred to for information specific to the RTSC module, such as
module configuration, Errors, and Asserts.
struct HeapMultiBufMP_Bucket |
|
Structure for bucket configuration
typedef struct HeapMultiBufMP_Bucket {
SizeT blockSize;
UInt numBlocks;
SizeT align;
} HeapMultiBufMP_Bucket;
FIELDS
blockSize
Size of each block (in MADUs)
numBlocks
Number of blocks
align
Alignment of each block (in MADUs)
DETAILS
An array of buckets is a required parameter to create any
HeapMultiBufMP instance. The fields of each bucket correspond
to the attributes of each buffer in the HeapMultiBufMP. The actual
block sizes and alignments may be adjusted per the process described
at
bucketEntries.
struct HeapMultiBufMP_ExtendedStats |
|
Stats structure for the getExtendedStats API
typedef struct HeapMultiBufMP_ExtendedStats {
UInt numBuckets;
UInt numBlocks[8];
UInt blockSize[8];
UInt align[8];
UInt maxAllocatedBlocks[8];
UInt numAllocatedBlocks[8];
} HeapMultiBufMP_ExtendedStats;
FIELDS
numBuckets
Number of buckets
numBlocks
Number of blocks in each buffer
blockSize
Block size of each buffer
align
Alignment of each buffer
maxAllocatedBlocks
The maximum number of blocks allocated from
this heap at any single point in time during
the lifetime of this HeapMultiBufMP instance
numAllocatedBlocks
The total number of blocks currently
allocated in this HeapMultiBufMP instance
config HeapMultiBufMP_A_addrNotFound // module-wide |
|
Assert raised when an invalid block address was passed to free()
extern const Assert_Id HeapMultiBufMP_A_addrNotFound;
config HeapMultiBufMP_A_invalidAlign // module-wide |
|
Assert raised when the align parameter is not a power of 2
extern const Assert_Id HeapMultiBufMP_A_invalidAlign;
config HeapMultiBufMP_A_sizeNotFound // module-wide |
|
Assert raised when an invalid buffer size was passed to free()
extern const Assert_Id HeapMultiBufMP_A_sizeNotFound;
config HeapMultiBufMP_E_exactFail // module-wide |
|
Error raised when exact matching failed
extern const Error_Id HeapMultiBufMP_E_exactFail;
config HeapMultiBufMP_E_noBlocksLeft // module-wide |
|
Error raised when there are no blocks left in the buffer corresponding to the requested size/alignment
extern const Error_Id HeapMultiBufMP_E_noBlocksLeft;
config HeapMultiBufMP_E_size // module-wide |
|
Error raised when requested size exceeds all blockSizes
extern const Error_Id HeapMultiBufMP_E_size;
config HeapMultiBufMP_maxNameLen // module-wide |
|
Maximum length for heap names
extern const UInt HeapMultiBufMP_maxNameLen;
config HeapMultiBufMP_trackMaxAllocs // module-wide |
|
Track the maximum number of allocated blocks
extern const Bool HeapMultiBufMP_trackMaxAllocs;
DETAILS
This will enable/disable the tracking of the maximum number of
allocations for a HeapMultiBufMP instance. This maximum refers to the
"all time" maximum number of allocations for the history of a
HeapMultiBufMP instance, not the current number of allocations.
Tracking the maximum might adversely affect performance when allocating
and/or freeing. If this feature is not needed, setting this to false
avoids the performance penalty.
Module-Wide Built-Ins |
|
// Get this module's unique id
Bool HeapMultiBufMP_Module_startupDone();
// Test if this module has completed startup
// The heap from which this module allocates memory
Bool HeapMultiBufMP_Module_hasMask();
// Test whether this module has a diagnostics mask
Bits16 HeapMultiBufMP_Module_getMask();
// Returns the diagnostics mask for this module
Void HeapMultiBufMP_Module_setMask(Bits16 mask);
// Set the diagnostics mask for this module
Instance Object Types |
|
typedef struct HeapMultiBufMP_Object HeapMultiBufMP_Object;
// Opaque internal representation of an instance object
// Client reference to an instance object
typedef struct HeapMultiBufMP_Struct HeapMultiBufMP_Struct;
// Opaque client structure large enough to hold an instance object
// Convert this instance structure pointer into an instance handle
// Convert this instance handle into an instance structure pointer
Instance Config Parameters |
|
typedef struct HeapMultiBufMP_Params {
// Instance config-params structure
// Common per-instance configs
// Bucket Entries
Bool exact;
// Use exact matching
// GateMP used for critical region management of the shared memory
String name;
// Name of this instance
Int numBuckets;
UInt16 regionId;
// Shared region ID
} HeapMultiBufMP_Params;
// Initialize this config-params structure with supplier-specified defaults before instance creation
config HeapMultiBufMP_Params.bucketEntries // instance |
|
Bucket Entries
DETAILS
The bucket entries are an array of
Buckets whose values
correspond to the desired alignment, block size and length for each
buffer. It is important to note that the alignments and sizes for each
buffer may be adjusted due to cache and alignment related constraints.
Buffer sizes are rounded up by their corresponding alignments. Buffer
alignments themselves will assume the value of region cache alignment
size when the cache size is greater than the requested buffer alignment.
For example, specifying a bucket with {blockSize: 192, align: 256} will
result in a buffer of blockSize = 256 and alignment = 256. If cache
alignment is required, then a bucket of {blockSize: 96, align: 64} will
result in a buffer of blockSize = 128 and alignment = 128 (assuming
cacheSize = 128).
config HeapMultiBufMP_Params.exact // instance |
|
Use exact matching
DETAILS
Setting this flag will allow allocation only if the requested size
is equal to (rather than less than or equal to) a buffer's block size.
config HeapMultiBufMP_Params.gate // instance |
|
GateMP used for critical region management of the shared memory
DETAILS
Using the default value of NULL will result in use of the GateMP
system gate for context protection.
config HeapMultiBufMP_Params.name // instance |
|
Name of this instance
DETAILS
The name (if not NULL) must be unique among all HeapMultiBufMP
instances in the entire system. When creating a new
heap, it is necessary to supply an instance name.
config HeapMultiBufMP_Params.numBuckets // instance |
|
Number of buckets in bucketEntries
DETAILS
This parameter is required to create any instance.
config HeapMultiBufMP_Params.regionId // instance |
|
Shared region ID
DETAILS
The index corresponding to the shared region from which shared memory
will be allocated.
Runtime Instance Creation |
|
// Allocate and initialize a new instance object and return its handle
// Initialize a new instance object inside the provided structure
ARGUMENTS
params
per-instance config params, or NULL to select default values (target-domain only)
eb
active error-handling block, or NULL to select default policy (target-domain only)
DETAILS
See specific IHeap implementation for parameters used.
Instance Deletion |
|
// Finalize and free this previously allocated instance object, setting the referenced handle to NULL
// Finalize the instance object inside the provided structure
HeapMultiBufMP_alloc() // instance |
|
Allocates a block of memory from the heap
ARGUMENTS
handle
handle of a previously-created HeapMultiBufMP instance object
size
size (in MADUs) of the block
align
alignment (in MADUs) of the block
eb
pointer to error block
DETAILS
This method returns a block of memory from the heap.
It is called by the
xdc.runtime.Memory.alloc() function.
RETURNS
Returns the address of the allocated memory.
HeapMultiBufMP_free() // instance |
|
Free a block of memory back to the heap
ARGUMENTS
handle
handle of a previously-created HeapMultiBufMP instance object
block
non-NULL address of allocated block to free
size
size (in MADUs) of the block of memory to free
DETAILS
This method gives back a block of memory to a heap.
It is called by the
xdc.runtime.Memory.free() function.
HeapMultiBufMP_getStats() // instance |
|
Retrieve the statistics from the heap
ARGUMENTS
handle
handle of a previously-created HeapMultiBufMP instance object
stats
non-NULL pointer to an output buffer
DETAILS
The caller passes in a pointer to a
xdc.runtime.Memory.Stats
structure and
getStats fills in this structure.
This function is called by the
xdc.runtime.Memory.getStats()
function.
HeapMultiBufMP_isBlocking() // instance |
|
Returns whether the heap may block during an alloc() or
free()
ARGUMENTS
handle
handle of a previously-created HeapMultiBufMP instance object
RETURNS
If the heap might block, TRUE is returned.
If the heap does not block, FALSE is returned.
Instance Convertors |
|
// unconditionally move one level up the inheritance hierarchy
// conditionally move one level down the inheritance hierarchy; NULL upon failure
Instance Built-Ins |
|
Int HeapMultiBufMP_Object_count();
// The number of statically-created instance objects
// The handle of the i-th statically-created instance object (array == NULL)
// The handle of the first dynamically-created instance object, or NULL
// The handle of the next dynamically-created instance object, or NULL
// The heap used to allocate dynamically-created instance objects
// The label associated with this instance object
// The name of this instance object
struct HeapMultiBufMP.Bucket |
|
Structure for bucket configuration
var obj = new HeapMultiBufMP.Bucket;
obj.blockSize = SizeT ...
obj.numBlocks = UInt ...
obj.align = SizeT ...
FIELDS
blockSize
Size of each block (in MADUs)
numBlocks
Number of blocks
align
Alignment of each block (in MADUs)
DETAILS
An array of buckets is a required parameter to create any
HeapMultiBufMP instance. The fields of each bucket correspond
to the attributes of each buffer in the HeapMultiBufMP. The actual
block sizes and alignments may be adjusted per the process described
at
bucketEntries.
C SYNOPSIS
struct HeapMultiBufMP.ExtendedStats |
|
Stats structure for the getExtendedStats API
var obj = new HeapMultiBufMP.ExtendedStats;
obj.numBuckets = UInt ...
obj.numBlocks = UInt[8] ...
obj.blockSize = UInt[8] ...
obj.align = UInt[8] ...
obj.maxAllocatedBlocks = UInt[8] ...
obj.numAllocatedBlocks = UInt[8] ...
FIELDS
numBuckets
Number of buckets
numBlocks
Number of blocks in each buffer
blockSize
Block size of each buffer
align
Alignment of each buffer
maxAllocatedBlocks
The maximum number of blocks allocated from
this heap at any single point in time during
the lifetime of this HeapMultiBufMP instance
numAllocatedBlocks
The total number of blocks currently
allocated in this HeapMultiBufMP instance
C SYNOPSIS
config HeapMultiBufMP.A_addrNotFound // module-wide |
|
Assert raised when an invalid block address was passed to free()
msg: "an invalid buffer address was passed to free"
};
C SYNOPSIS
config HeapMultiBufMP.A_invalidAlign // module-wide |
|
Assert raised when the align parameter is not a power of 2
msg: "align parameter must be a power of 2"
};
C SYNOPSIS
config HeapMultiBufMP.A_sizeNotFound // module-wide |
|
Assert raised when an invalid buffer size was passed to free()
msg: "an invalid buffer size was passed to free"
};
C SYNOPSIS
config HeapMultiBufMP.E_exactFail // module-wide |
|
Error raised when exact matching failed
msg: "E_exactFail: Exact allocation failed (requested size = %u and buffer size = %u)"
};
C SYNOPSIS
config HeapMultiBufMP.E_noBlocksLeft // module-wide |
|
Error raised when there are no blocks left in the buffer corresponding to the requested size/alignment
msg: "E_noBlocksLeft: No more blocks left in buffer (buffer size = %u and buffer align = %u)"
};
C SYNOPSIS
config HeapMultiBufMP.E_size // module-wide |
|
Error raised when requested size exceeds all blockSizes
msg: "E_size: requested size/alignment is too big (requested size = %u and requested align = %u)"
};
C SYNOPSIS
config HeapMultiBufMP.maxNameLen // module-wide |
|
Maximum length for heap names
HeapMultiBufMP.maxNameLen = UInt 32;
C SYNOPSIS
config HeapMultiBufMP.trackMaxAllocs // module-wide |
|
Track the maximum number of allocated blocks
HeapMultiBufMP.trackMaxAllocs = Bool false;
DETAILS
This will enable/disable the tracking of the maximum number of
allocations for a HeapMultiBufMP instance. This maximum refers to the
"all time" maximum number of allocations for the history of a
HeapMultiBufMP instance, not the current number of allocations.
Tracking the maximum might adversely affect performance when allocating
and/or freeing. If this feature is not needed, setting this to false
avoids the performance penalty.
C SYNOPSIS
metaonly config HeapMultiBufMP.common$ // module-wide |
|
Common module configuration parameters
DETAILS
All modules have this configuration parameter. Its name
contains the '$' character to ensure it does not conflict with
configuration parameters declared by the module. This allows
new configuration parameters to be added in the future without
any chance of breaking existing modules.
metaonly config HeapMultiBufMP.maxRuntimeEntries // module-wide |
|
Maximum runtime entries
DETAILS
Maximum number of HeapMultiBufMP's that can be dynamically created and
added to the NameServer.
To minimize the amount of runtime allocation, this parameter allows
the pre-allocation of memory for the HeapMultiBufMP's NameServer table.
The default is to allow growth (i.e. memory allocation when
creating a new instance).
metaonly config HeapMultiBufMP.tableSection // module-wide |
|
Section name is used to place the names table
HeapMultiBufMP.tableSection = String null;
DETAILS
The default value of NULL implies that no explicit placement is
performed.
Instance Config Parameters |
|
var params = new HeapMultiBufMP.Params;
// Instance config-params object
// Bucket Entries
params.exact = Bool false;
// Use exact matching
// GateMP used for critical region management of the shared memory
params.name = String null;
// Name of this instance
params.numBuckets = Int 0;
params.regionId = UInt16 0;
// Shared region ID
config HeapMultiBufMP.Params.bucketEntries // instance |
|
Bucket Entries
var params = new HeapMultiBufMP.Params;
...
DETAILS
The bucket entries are an array of
Buckets whose values
correspond to the desired alignment, block size and length for each
buffer. It is important to note that the alignments and sizes for each
buffer may be adjusted due to cache and alignment related constraints.
Buffer sizes are rounded up by their corresponding alignments. Buffer
alignments themselves will assume the value of region cache alignment
size when the cache size is greater than the requested buffer alignment.
For example, specifying a bucket with {blockSize: 192, align: 256} will
result in a buffer of blockSize = 256 and alignment = 256. If cache
alignment is required, then a bucket of {blockSize: 96, align: 64} will
result in a buffer of blockSize = 128 and alignment = 128 (assuming
cacheSize = 128).
C SYNOPSIS
config HeapMultiBufMP.Params.exact // instance |
|
Use exact matching
var params = new HeapMultiBufMP.Params;
...
params.exact = Bool false;
DETAILS
Setting this flag will allow allocation only if the requested size
is equal to (rather than less than or equal to) a buffer's block size.
C SYNOPSIS
config HeapMultiBufMP.Params.gate // instance |
|
GateMP used for critical region management of the shared memory
var params = new HeapMultiBufMP.Params;
...
DETAILS
Using the default value of NULL will result in use of the GateMP
system gate for context protection.
C SYNOPSIS
config HeapMultiBufMP.Params.name // instance |
|
Name of this instance
var params = new HeapMultiBufMP.Params;
...
params.name = String null;
DETAILS
The name (if not NULL) must be unique among all HeapMultiBufMP
instances in the entire system. When creating a new
heap, it is necessary to supply an instance name.
C SYNOPSIS
config HeapMultiBufMP.Params.numBuckets // instance |
|
Number of buckets in bucketEntries
var params = new HeapMultiBufMP.Params;
...
params.numBuckets = Int 0;
DETAILS
This parameter is required to create any instance.
C SYNOPSIS
config HeapMultiBufMP.Params.regionId // instance |
|
Shared region ID
var params = new HeapMultiBufMP.Params;
...
params.regionId = UInt16 0;
DETAILS
The index corresponding to the shared region from which shared memory
will be allocated.
C SYNOPSIS
Static Instance Creation |
|
var params =
new HeapMultiBufMP.
Params;
// Allocate instance config-params
params.config = ...
// Assign individual configs
var inst = HeapMultiBufMP.create(params);
// Create an instance-object
ARGUMENTS
params
per-instance config params, or NULL to select default values (target-domain only)
eb
active error-handling block, or NULL to select default policy (target-domain only)
DETAILS
See specific IHeap implementation for parameters used.