AN2345 Freescale Semiconductor / Motorola, AN2345 Datasheet - Page 10

no-image

AN2345

Manufacturer Part Number
AN2345
Description
Real-Time Memory Manager for StarCore DSPs
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
VSMM Basics
2.4 VSMM Global Objects
10
1
For details on the possible critical methods, refer to Section 3.6, VSMM Critical Methods, on page 14 or the VSMM
User’s Guide [4].
Global FreeList
The VSMM uses two global objects to assist in managing each heap:
The VSMMMemInit routine initializes each MCB within the VSMMMemTbl and sets the global
VSMMMemFreeList pointer to the first memory control block within this array. Each MCB
VSMMMemFreeList pointer is updated to the next free MCB within the VSMMMemTbl or to NULL if it
is the last MCB in the table. When a heap is destroyed, its associated MCB is inserted at the head of this
free list and the global VSMMMemFreeList pointer is updated. Figure 8 illustrates the global FreeList
pointer and MCB array following VSMM initialization with a maximum of three MCBs specified.
Mutual exclusion is ensured when these global variables are updated.
In addition to these two global objects, VSMM uses a global flag to enable or disable VSMM routine
parameter verification. This flag should be statically initialized and not updated at run-time because it has
no associated mutex (binary semaphore):
unsigned char gucVSMM_ARG_CHK_EN
If the global gucVSMM_ARG_CHK_EN contains a value greater than zero, each VSMM routine
requiring passed parameters validates these parameters. The final global used by the VSMM is declared
only if the critical method 2 option is specified within the header file: VSMM_cfg.h.
unsigned long int guliDSPSR
The guliDSPSR global variable is used only by critical method 2 to store the DSP’s core status register,
which contains the current state of interrupts. When a critical area is exited, the value in the guliDSPSR is
evaluated, and the interrupts are restored to their previous state.
VSMMMemFreeList
VSMMMemTbl
Pointer
t_VSMM_MEM
t_VSMM_MEM astVSMMMemTbl[VSMM_MAX_MEM_PART];
VSMM_MAX_MEM_PART = 3
Variable
Figure 8. Global FreeList Pointer and MemTbl
Freescale Semiconductor, Inc.
For More Information On This Product,
*pstVSMMMemFreeList;
MemHeapAddr
Go to: www.freescale.com
MemFreeList
MemBlkSize
MemNFree
MemNBlks
MemTbl[0]
Table 2. Global Objects for Managing Heaps
MemAddr
A pointer to the next available MCB,
Array of free MCBs.
MemHeapAddr
MemFreeList
MemBlkSize
MemNFree
MemNBlks
MemTbl[1]
MemAddr
Description
MemHeapAddr
MemFreeList
MemBlkSize
MemNFree
MemNBlks
MemTbl[2]
MemAddr
1

Related parts for AN2345