#ifndef _GL_MEMPOOL_H_ #define _GL_MEMPOOL_H_ #include "gl_types.h" /******************************************************************************/ /*! * @brief To create a variable size memory pool which is for allocating blocks of any size. * * @param szName String identifier for the Mempool. * @param pos The memory base of Mempool * @param size The max size of Mempool * @param pMempool Mempool object identifier returned by the API (on success) * * @return @a GL_SUCCESS on success * @return @a GL_FAILURE on failure * * @note None *******************************************************************************/ GL_Status_t GL_MempoolVarCreate(char *szName, void *pos, GL_UINT32 size, GL_MEMPOOL_t *pMempool); /******************************************************************************/ /*! * @brief To delete a Mempool. Regarding tasks waiting on a deleted, the behavior depends on the underlying OS; the GSL does not guarantee a default behavior (hence, applications should avoid this scenario). Typically, an error is returned to the waiting tasks. * * @param pMempool Mempool object identifier returned by the API * * @return @a GL_SUCCESS on success * @return @a GL_FAILURE on failure * * @note None *******************************************************************************/ void GL_MempoolVarDestroy(GL_MEMPOOL_t pMempool); /******************************************************************************/ /*! * @brief To allocate a buffer in mempool and if empty, it blocks until memory allocation is successful. * * @param pMempool Mempool object identifier returned by the API * @param dSize Size of buffer to allocatedFlags: Supported flags can be ORed together. * @param sdTimeout Timeout period to wait for memory allocation. Measured in milliseconds. Set to: * @li @a GL_INFINITE_WAIT for inifinite waiting * @li @a GL_NO_WAIT (Any value between 1-2147483647 for finite wait) * * @return Data pointer on SUCCESS. @a NULL (null pointer) on failure * * @note None *******************************************************************************/ void * GL_MempoolVarAlloc(GL_MEMPOOL_t pMempool, GL_UINT32 dSize, GL_UINT32 sdTimeout); /******************************************************************************/ /*! * @brief To release a buffer which is allocated by GL_MempoolVarAlloc * * @param pMempool Mempool object identifier returned by the API * @param p Pointor to mem alloced in mempool * * @return void * * @note None *******************************************************************************/ void GL_MempoolVarFree(GL_MEMPOOL_t pMempool, void *p); #endif //_GL_MEMPOOL_H_