MEM_define
2-220
C Interface
Syntax
segid = MEM_define(base, length, attrs);
Parameters
Ptr
base;
/* base address of new segment */
MEM_sizep length;
/* length (in MADUs) of new segment */
MEM_Attrs
*attrs;
/* segment attributes */
Return Value
Int
segid;
/* ID of new segment */
Reentrant
yes
Description
MEM_define defines a new memory segment for use by the DSP/BIOS
MEM Module.
The new segment contains length MADUs starting at base. A new table
entry is allocated to define the segment, and the entry’s index into this
table is returned as the segid.
The new block should be aligned on a MEM_HEADERSIZE boundary,
and the length should be a multiple of MEM_HEADERSIZE.
If attrs is NULL, the new segment is assigned a default set of attributes.
Otherwise, the segment’s attributes are specified through a structure of
type MEM_Attrs.
Note:
No attributes are supported for segments, and the type MEM_Attrs is
defined as a dummy structure.
If there are undefined slots available in the internal table of memory
segment identifiers, one of those slots is (re)used for the new segment.
If there are no undefined slots available in the internal table, the table size
is increased via MEM_alloc. See MEM_increaseTableSize to manage
performance in this situation.
Constraints and
Calling Context
❏
At least one segment must exist at the time MEM_define is called.
❏
MEM_define internally locks the memory by calling LCK_pend and
LCK_post. If another task already holds a lock to the memory, there
is a context switch. For this reason, MEM_define cannot be called
from the context of a SWI or HWI. It can be called from main() or a
TSK. The duration that the API holds the memory lock is variable.
MEM_define
Define a new memory segment