module ti.sdo.ipc.heaps.HeapMultiBufMP

Multi-processor fixed-size buffer heap implementation

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. [ more ... ]
C synopsis target-domain sourced in ti/sdo/ipc/heaps/HeapMultiBufMP.xdc
#include <ti/sdo/ipc/heaps/HeapMultiBufMP.h>
Functions
Void
Void
Void
Void
Functions common to all IHeap modules
Ptr 
Void 
Void 
Bool 
Functions common to all target instances
Functions common to all target modules
Typedefs
typedef struct
typedef struct
typedef struct
typedef struct
typedef struct
Constants
extern const Assert_Id 
extern const Assert_Id 
extern const Assert_Id 
extern const Error_Id 
extern const Error_Id 
extern const Error_Id 
extern const UInt 
extern const Bool 
 
DETAILS
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.
It is important to note that max allocation tracking is disabled by default in trackMaxAllocs. Disabling allocation tracking improves alloc/ free performance especially when cache calls are required in shared memory.
 
struct HeapMultiBufMP_Bucket

Structure for bucket configuration

C synopsis target-domain
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

C synopsis target-domain
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()

C synopsis target-domain
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

C synopsis target-domain
extern const Assert_Id HeapMultiBufMP_A_invalidAlign;
 
 
config HeapMultiBufMP_A_sizeNotFound  // module-wide

Assert raised when an invalid buffer size was passed to free()

C synopsis target-domain
extern const Assert_Id HeapMultiBufMP_A_sizeNotFound;
 
 
config HeapMultiBufMP_E_exactFail  // module-wide

Error raised when exact matching failed

C synopsis target-domain
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

C synopsis target-domain
extern const Error_Id HeapMultiBufMP_E_noBlocksLeft;
 
 
config HeapMultiBufMP_E_size  // module-wide

Error raised when requested size exceeds all blockSizes

C synopsis target-domain
extern const Error_Id HeapMultiBufMP_E_size;
 
 
config HeapMultiBufMP_maxNameLen  // module-wide

Maximum length for heap names

C synopsis target-domain
extern const UInt HeapMultiBufMP_maxNameLen;
 
 
config HeapMultiBufMP_trackMaxAllocs  // module-wide

Track the maximum number of allocated blocks

C synopsis target-domain
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

C synopsis target-domain
Types_ModuleId HeapMultiBufMP_Module_id();
// Get this module's unique id
 
Bool HeapMultiBufMP_Module_startupDone();
// Test if this module has completed startup
 
IHeap_Handle HeapMultiBufMP_Module_heap();
// 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

C synopsis target-domain
typedef struct HeapMultiBufMP_Object HeapMultiBufMP_Object;
// Opaque internal representation of an instance object
 
typedef HeapMultiBufMP_Object *HeapMultiBufMP_Handle;
// Client reference to an instance object
 
typedef struct HeapMultiBufMP_Struct HeapMultiBufMP_Struct;
// Opaque client structure large enough to hold an instance object
 
HeapMultiBufMP_Handle HeapMultiBufMP_handle(HeapMultiBufMP_Struct *structP);
// Convert this instance structure pointer into an instance handle
 
HeapMultiBufMP_Struct *HeapMultiBufMP_struct(HeapMultiBufMP_Handle handle);
// Convert this instance handle into an instance structure pointer
Instance Config Parameters

C synopsis target-domain
typedef struct HeapMultiBufMP_Params {
// Instance config-params structure
    IInstance_Params *instance;
    // Common per-instance configs
    HeapMultiBufMP_Bucket bucketEntries[];
    // Bucket Entries
    Bool exact;
    // Use exact matching
    GateMP_Handle gate;
    // GateMP used for critical region management of the shared memory
    String name;
    // Name of this instance
    Int numBuckets;
    // Number of buckets in bucketEntries
    UInt16 regionId;
    // Shared region ID
} HeapMultiBufMP_Params;
 
Void HeapMultiBufMP_Params_init(HeapMultiBufMP_Params *params);
// Initialize this config-params structure with supplier-specified defaults before instance creation
 
config HeapMultiBufMP_bucketEntries  // instance

Bucket Entries

C synopsis target-domain
      ...
    HeapMultiBufMP_Bucket bucketEntries[];
 
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_exact  // instance

Use exact matching

C synopsis target-domain
      ...
    Bool exact;
 
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_gate  // instance

GateMP used for critical region management of the shared memory

C synopsis target-domain
      ...
    GateMP_Handle gate;
 
DETAILS
Using the default value of NULL will result in use of the GateMP system gate for context protection.
 
config HeapMultiBufMP_name  // instance

Name of this instance

C synopsis target-domain
      ...
    String name;
 
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_numBuckets  // instance

Number of buckets in bucketEntries

C synopsis target-domain
      ...
    Int numBuckets;
 
DETAILS
This parameter is required to create any instance.
 
config HeapMultiBufMP_regionId  // instance

Shared region ID

C synopsis target-domain
      ...
    UInt16 regionId;
 
DETAILS
The index corresponding to the shared region from which shared memory will be allocated.
Instance Creation

C synopsis target-domain
HeapMultiBufMP_Handle HeapMultiBufMP_create(const HeapMultiBufMP_Params *params, Error_Block *eb);
// Allocate and initialize a new instance object and return its handle
 
Void HeapMultiBufMP_construct(HeapMultiBufMP_Struct *structP, const HeapMultiBufMP_Params *params, Error_Block *eb);
// 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

C synopsis target-domain
Void HeapMultiBufMP_delete(HeapMultiBufMP_Handle *handleP);
// Finalize and free this previously allocated instance object, setting the referenced handle to NULL
 
Void HeapMultiBufMP_destruct(HeapMultiBufMP_Struct *structP);
// Finalize the instance object inside the provided structure
 
HeapMultiBufMP_alloc()  // instance

Allocates a block of memory from the heap

C synopsis target-domain
Ptr HeapMultiBufMP_alloc(HeapMultiBufMP_Handle handle, SizeT size, SizeT align, Error_Block *eb);
 
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

C synopsis target-domain
Void HeapMultiBufMP_free(HeapMultiBufMP_Handle handle, Ptr block, SizeT size);
 
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

C synopsis target-domain
Void HeapMultiBufMP_getStats(HeapMultiBufMP_Handle handle, Memory_Stats *stats);
 
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()

C synopsis target-domain
Bool HeapMultiBufMP_isBlocking(HeapMultiBufMP_Handle handle);
 
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

C synopsis target-domain
IHeap_Handle HeapMultiBufMP_Handle_upCast(HeapMultiBufMP_Handle handle);
// unconditionally move one level up the inheritance hierarchy
 
HeapMultiBufMP_Handle HeapMultiBufMP_Handle_downCast(IHeap_Handle handle);
// conditionally move one level down the inheritance hierarchy; NULL upon failure
Instance Built-Ins

C synopsis target-domain
Int HeapMultiBufMP_Object_count();
// The number of statically-created instance objects
 
HeapMultiBufMP_Handle HeapMultiBufMP_Object_get(HeapMultiBufMP_Object *array, Int i);
// The handle of the i-th statically-created instance object (array == NULL)
 
HeapMultiBufMP_Handle HeapMultiBufMP_Object_first();
// The handle of the first dynamically-created instance object, or NULL
 
HeapMultiBufMP_Handle HeapMultiBufMP_Object_next(HeapMultiBufMP_Handle handle);
// The handle of the next dynamically-created instance object, or NULL
 
IHeap_Handle HeapMultiBufMP_Object_heap();
// The heap used to allocate dynamically-created instance objects
 
Types_Label *HeapMultiBufMP_Handle_label(HeapMultiBufMP_Handle handle, Types_Label *buf);
// The label associated with this instance object
 
String HeapMultiBufMP_Handle_name(HeapMultiBufMP_Handle handle);
// The name of this instance object
 
XDCscript usage meta-domain sourced in ti/sdo/ipc/heaps/HeapMultiBufMP.xdc
var HeapMultiBufMP = xdc.useModule('ti.sdo.ipc.heaps.HeapMultiBufMP');
module-wide constants & types
        obj.blockSize = SizeT  ...
        obj.numBlocks = UInt  ...
        obj.align = SizeT  ...
 
        obj.numBuckets = UInt  ...
        obj.numBlocks = UInt[8]  ...
        obj.blockSize = UInt[8]  ...
        obj.align = UInt[8]  ...
        obj.maxAllocatedBlocks = UInt[8]  ...
        obj.numAllocatedBlocks = UInt[8]  ...
module-wide config parameters
        msg: "an invalid buffer address was passed to free"
    };
        msg: "align parameter must be a power of 2"
    };
        msg: "an invalid buffer size was passed to free"
    };
        msg: "E_exactFail: Exact allocation failed (requested size = %u and buffer size = %u)"
    };
        msg: "E_noBlocksLeft: No more blocks left in buffer (buffer size = %u and buffer align = %u)"
    };
        msg: "E_size: requested size/alignment is too big (requested size = %u and requested align = %u)"
    };
 
per-instance config parameters
    var params = new HeapMultiBufMP.Params// Instance config-params object;
        params.bucketEntries// Bucket Entries = HeapMultiBufMP.Bucket[] undefined;
        params.exact// Use exact matching = Bool false;
        params.name// Name of this instance = String null;
        params.numBuckets// Number of buckets in bucketEntries = Int 0;
        params.regionId// Shared region ID = UInt16 0;
per-instance creation
    var inst = HeapMultiBufMP.create// Create an instance-object(params);
 
 
struct HeapMultiBufMP.Bucket

Structure for bucket configuration

XDCscript usage meta-domain
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

XDCscript usage meta-domain
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()

XDCscript usage meta-domain
HeapMultiBufMP.A_addrNotFound = Assert.Desc {
    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

XDCscript usage meta-domain
HeapMultiBufMP.A_invalidAlign = Assert.Desc {
    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()

XDCscript usage meta-domain
HeapMultiBufMP.A_sizeNotFound = Assert.Desc {
    msg: "an invalid buffer size was passed to free"
};
 
C SYNOPSIS
 
config HeapMultiBufMP.E_exactFail  // module-wide

Error raised when exact matching failed

XDCscript usage meta-domain
HeapMultiBufMP.E_exactFail = Error.Desc {
    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

XDCscript usage meta-domain
HeapMultiBufMP.E_noBlocksLeft = Error.Desc {
    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

XDCscript usage meta-domain
HeapMultiBufMP.E_size = Error.Desc {
    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

XDCscript usage meta-domain
HeapMultiBufMP.maxNameLen = UInt 32;
 
C SYNOPSIS
 
config HeapMultiBufMP.trackMaxAllocs  // module-wide

Track the maximum number of allocated blocks

XDCscript usage meta-domain
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

XDCscript usage meta-domain
HeapMultiBufMP.common$ = Types.Common$ undefined;
 
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

XDCscript usage meta-domain
HeapMultiBufMP.maxRuntimeEntries = UInt NameServer.ALLOWGROWTH;
 
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

XDCscript usage meta-domain
HeapMultiBufMP.tableSection = String null;
 
DETAILS
The default value of NULL implies that no explicit placement is performed.
Instance Config Parameters

XDCscript usage meta-domain
var params = new HeapMultiBufMP.Params;
// Instance config-params object
    params.bucketEntries = HeapMultiBufMP.Bucket[] undefined;
    // Bucket Entries
    params.exact = Bool false;
    // Use exact matching
    params.gate = GateMP.Handle null;
    // GateMP used for critical region management of the shared memory
    params.name = String null;
    // Name of this instance
    params.numBuckets = Int 0;
    // Number of buckets in bucketEntries
    params.regionId = UInt16 0;
    // Shared region ID
 
config HeapMultiBufMP.bucketEntries  // instance

Bucket Entries

XDCscript usage meta-domain
var params = new HeapMultiBufMP.Params;
  ...
params.bucketEntries = HeapMultiBufMP.Bucket[] undefined;
 
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.exact  // instance

Use exact matching

XDCscript usage meta-domain
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.gate  // instance

GateMP used for critical region management of the shared memory

XDCscript usage meta-domain
var params = new HeapMultiBufMP.Params;
  ...
params.gate = GateMP.Handle null;
 
DETAILS
Using the default value of NULL will result in use of the GateMP system gate for context protection.
C SYNOPSIS
 
config HeapMultiBufMP.name  // instance

Name of this instance

XDCscript usage meta-domain
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.numBuckets  // instance

Number of buckets in bucketEntries

XDCscript usage meta-domain
var params = new HeapMultiBufMP.Params;
  ...
params.numBuckets = Int 0;
 
DETAILS
This parameter is required to create any instance.
C SYNOPSIS
 
config HeapMultiBufMP.regionId  // instance

Shared region ID

XDCscript usage meta-domain
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
Instance Creation

XDCscript usage meta-domain
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.
generated on Sat, 11 Feb 2012 00:38:02 GMT