IAR PowerPac RTOS User Guide

IAR PowerPac RTOS User Guide IAR PowerPac RTOS User Guide

ie.ksu.edu.tw
from ie.ksu.edu.tw More from this publisher
11.07.2015 Views

90IAR PowerPac RTOSfor ARM CoresPPRTOS-2

Fixed block size memory poolsIntroductionFixed block size memory pools contain a specific number of fixed-size blocks of memory. The location in memory ofthe pool, the size of each block, and the number of blocks are set at runtime by the application via a call to theOS_MEMF_CREATE() function. The advantage of fixed memory pools is that a block of memory can be allocated fromwithin any task in a very short, determined period of time.Memory pools API reference overviewAll API functions for fixed block size memory pools are prefixed OS_MEMF_.API routineOS_MEMF_CreateOS_MEMF_DeleteOS_MEMF_AllocOS_MEMF_AllocTimedOS_MEMF_RequestOS_MEMF_ReleaseOS_MEMF_FreeBlockOS_MEMF_GetNumFreeBlocksOS_MEMF_IsInPoolOS_MEMF_GetMaxUsedOS_MEMF_GetNumBlocksOS_MEMF_GetBlockSizeTable 99: Memory pools API overviewDescriptionCreate / DeleteCreates fixed block memory pool.Deletes fixed block memory pool.AllocationAllocates memory block from a given memory pool. Wait indefinitely if no blockis available.Allocates memory block from a given memory pool. Wait no longer than giventimelimit if no block is available.Allocates block from a given memory pool, if available. Non-blocking.ReleaseReleases memory block from a given memory pool.Releases memory block from any pool.InfoReturns the number of available blocks in a pool.Returns !=0 if block is in memory pool.Returns the maximum number of blocks in a pool which have been used at a time.Returns the number of blocks in a pool.Returns the size of one block of a given pool.OS_MEMF_Create()DescriptionCreates and initializes a fixed block size memory pool.Prototypevoid OS_MEMF_Create (OS_MEMF* pMEMF,void* pPool,OS_U16 NumBlocks,OS_U16 BlockSize);ParameterDescriptionpMEMFPointer to the control data structure of memory pool.pPool Pointer to memory to be used for the memory pool. Required size is: NumBlocks *(BlockSize + OS_MEMF_SIZEOF_BLOCKCONTROL).Table 100: OS_MEMF_Create() parameter listPPRTOS-2 91

90<strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong>for ARM CoresPP<strong>RTOS</strong>-2

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!