Renesas PTX1xxR IoT-Reader API Version 7.3.1
Renesas Software Stack for IoT-Reader Applications
Functions

Functions that manage buffer pool. More...

Collaboration diagram for Buffer Pool Handler Functions:

Functions

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_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 none.
 
ptxStatus_t ptxBufferPool_ClaimItem (ptxBufferPool_Item_t *poolItem)
 Claim an item to prevent it from being garbage-collected.
 
ptxStatus_t ptxBufferPool_ReleaseItem (ptxBufferPool_Item_t *poolItem)
 Release an item and allow it to be garbage-collected.
 
ptxStatus_t ptxBufferPool_ReleaseUnusedItem (ptxBufferPool_Item_t *poolItem)
 Mark an unused buffer disposable.
 
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.
 
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.
 

Detailed Description

Functions that manage buffer pool.

Function Documentation

◆ ptxBufferPool_ClaimItem()

ptxStatus_t ptxBufferPool_ClaimItem ( ptxBufferPool_Item_t * poolItem)

Claim an item to prevent it from being garbage-collected.

Parameters
[in]poolItemPool Item, provided by ptxBufferPool_ProvideItem or ptxBufferPool_ProvideAndClaimItem.
Returns
Status of the operation. See definition of ptxStatus_t.

◆ ptxBufferPool_DeInit()

ptxStatus_t ptxBufferPool_DeInit ( ptxBufferPool_t * bufPool)

De-initialize the component, release all resources.

Parameters
[in,out]bufPoolInitialized (ptxBufferPool_Init) instance of buffer pool.
Returns
Status of the operation. See definition of ptxStatus_t.

◆ ptxBufferPool_GetBuffer()

uint8_t * ptxBufferPool_GetBuffer ( ptxBufferPool_Item_t * poolItem)

Get the buffer.

Parameters
[in]poolItemPool Item, provided by ptxBufferPool_ProvideItem or ptxBufferPool_ProvideAndClaimItem.
Returns
Pointer to the first element of the plain buffer

◆ ptxBufferPool_GetLength()

size_t ptxBufferPool_GetLength ( ptxBufferPool_Item_t * poolItem)

Get the buffer length.

Parameters
[in]poolItemPool Item, provided by ptxBufferPool_ProvideItem or ptxBufferPool_ProvideAndClaimItem.
Returns
Current length of the buffer, in bytes.

◆ ptxBufferPool_Init()

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.

Parameters
[in,out]bufPoolUninitialized instance of buffer pool.
[in]osAlPointer to an initialized OSAL component.
[in]logCtxPointer to an initialized LOG component.
[in]maxNumBuffersNumber of buffers to allocate.
[in]memSizeSize of the buffers to allocate.
[in]logDetailsSet to 1 to log details; with 0 no details are logged.
Returns
Status of the operation. See definition of ptxStatus_t.

◆ ptxBufferPool_PointToLength()

size_t * ptxBufferPool_PointToLength ( ptxBufferPool_Item_t * poolItem)

Get the current buffer length pointer.

Parameters
[in]poolItemPool Item, provided by ptxBufferPool_ProvideItem or ptxBufferPool_ProvideAndClaimItem.
Returns
Address (pointer to) the variable that stores the current length.

◆ ptxBufferPool_ProvideAndClaimItem()

ptxStatus_t ptxBufferPool_ProvideAndClaimItem ( ptxBufferPool_t * bufPool,
ptxBufferPool_Item_t ** poolItem,
size_t sizeReq )

Combines the two functions Provide() and Claim().

See description and guidelines for each functions individually.

Parameters
[in]bufPoolInitialized instance of buffer pool.
[in,out]poolItemPointer to Pool Item.
[in]sizeReqSize of the buffer requested.
Returns
Status of the operation. See definition of ptxStatus_t.

◆ ptxBufferPool_ProvideItem()

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 none.

Parameters
[in]bufPoolInitialized instance of buffer pool.
[in,out]poolItemPointer to a location that will receive the address of a free buffer (or NULL if none is free).
[in]sizeReqSize of the buffer requested.
Returns
Status of the operation. See definition of ptxStatus_t.

◆ ptxBufferPool_ReleaseItem()

ptxStatus_t ptxBufferPool_ReleaseItem ( ptxBufferPool_Item_t * poolItem)

Release an item and allow it to be garbage-collected.

Parameters
[in]poolItemPool Item, provided by ptxBufferPool_ProvideItem or ptxBufferPool_ProvideAndClaimItem.
Returns
Status of the operation. See definition of ptxStatus_t.

◆ ptxBufferPool_ReleaseUnusedItem()

ptxStatus_t ptxBufferPool_ReleaseUnusedItem ( ptxBufferPool_Item_t * poolItem)

Mark an unused buffer disposable.

Only if not used, a buffer is set to disposable state. This function has no effect on items in other states than Active ("provided", see ptxBufferPool_ProvideItem or ptxBufferPool_ProvideAndClaimItem) state.

Parameters
[in]poolItemPool Item, provided by ptxBufferPool_ProvideItem or ptxBufferPool_ProvideAndClaimItem.
Returns
Status of the operation. See definition of ptxStatus_t.