43#ifndef PTXBUFFERPOOL_H
44#define PTXBUFFERPOOL_H
94 ptxBufferPool_ItemState_IDLE,
95 ptxBufferPool_ItemState_ACTIVE,
96 ptxBufferPool_ItemState_IN_USE,
97 ptxBufferPool_ItemState_MAX_COUNT
ptxStatus_t ptxBufferPool_ReleaseItem(ptxBufferPool_Item_t *poolItem)
Release an item and allow it to be garbage-collected.
ptxStatus_t ptxBufferPool_DeInit(ptxBufferPool_t *bufPool)
De-initialize the component, release all resources.
ptxStatus_t ptxBufferPool_ProvideItem(ptxBufferPool_t *bufPool, ptxBufferPool_Item_t **poolItem, size_t sizeReq)
Provide a buffer that is currently not in use. Wait for a buffer to become free if there is currently...
ptxStatus_t ptxBufferPool_ReleaseUnusedItem(ptxBufferPool_Item_t *poolItem)
Mark an unused buffer disposable.
ptxStatus_t ptxBufferPool_ClaimItem(ptxBufferPool_Item_t *poolItem)
Claim an item to prevent it from being garbage-collected.
size_t * ptxBufferPool_PointToLength(ptxBufferPool_Item_t *poolItem)
Get the current buffer length pointer.
size_t ptxBufferPool_GetLength(ptxBufferPool_Item_t *poolItem)
Get the buffer length.
ptxStatus_t ptxBufferPool_Init(ptxBufferPool_t *bufPool, struct ptxOsal *osAl, ptxLog_t *logCtx, size_t maxNumBuffers, size_t memSize, uint8_t logDetails)
Initialize the buffer pool. Allocate a number of buffers.
ptxStatus_t ptxBufferPool_ProvideAndClaimItem(ptxBufferPool_t *bufPool, ptxBufferPool_Item_t **poolItem, size_t sizeReq)
Combines the two functions Provide() and Claim().
uint8_t * ptxBufferPool_GetBuffer(ptxBufferPool_Item_t *poolItem)
Get the buffer.
struct ptxBufferPool_Item ptxBufferPool_Item_t
Buffer Pool Item structure.
struct ptxBufferPool ptxBufferPool_t
Buffer Pool structure.
enum ptxBufferPool_ItemState ptxBufferPool_ItemState_t
ptxBufferPool_ItemState
Definition ptxBufferPool.h:93
uint16_t ptxStatus_t
Status Type.
Definition ptx_Status.h:82
struct ptxMutex * ptxMutex_t
Mutex Wrapper Structure - Forward Declaration.
Definition ptxOsal.h:95
struct ptxSemaphore * ptxSemaphore_t
Semaphore Wrapper Structure - Forward Declaration.
Definition ptxOsal.h:100
Buffer Pool Item structure.
Definition ptxBufferPool.h:114
uint8_t Number
Definition ptxBufferPool.h:116
size_t StartingIndex
Definition ptxBufferPool.h:119
struct ptxBufferPool_Item * NextBufferItem
Definition ptxBufferPool.h:121
ptxMutex_t * Mx
Definition ptxBufferPool.h:117
ptxBufferPool_ItemState_t State
Definition ptxBufferPool.h:115
struct ptxBufferPool * BufferPool
Definition ptxBufferPool.h:118
struct ptxBufferPool_Item * PrevBufferItem
Definition ptxBufferPool.h:122
size_t Length
Definition ptxBufferPool.h:120
Buffer Pool structure.
Definition ptxBufferPool.h:133
ptxMutex_t Mx
Definition ptxBufferPool.h:135
ptxSemaphore_t Sem
Definition ptxBufferPool.h:136
ptxLog_t * LOG
Definition ptxBufferPool.h:139
size_t NumItems
Definition ptxBufferPool.h:143
size_t MemSize
Definition ptxBufferPool.h:147
uint8_t LogDetails
Definition ptxBufferPool.h:137
ptxBufferPool_Item_t * Items
Definition ptxBufferPool.h:142
ptxBufferPool_Item_t * ListItems
Definition ptxBufferPool.h:148
uint8_t * MemSpace
Definition ptxBufferPool.h:146
struct ptxOsal * OS
Definition ptxBufferPool.h:138
Logger Component Structure.
Definition ptxLog.h:208