Mistake on this page?
Report an issue in GitHub or email us
Data Structures | Macros | Typedefs | Functions
WSF_BUF_API

Data Structures

struct  wsfBufPoolDesc_t
 Buffer pool descriptor structure. More...
 
struct  WsfBufPoolStat_t
 Pool statistics. More...
 
struct  wsfBufDiagAllocFail_t
 WSF buffer diagnostics - buffer allocation failure. More...
 
struct  WsfBufDiag_t
 WSF buffer diagnostics message. More...
 

Macros

#define WSF_BUF_FREE_CHECK_ASSERT   TRUE
 Check if trying to free a buffer that is already free. More...
 
#define WSF_BUF_ALLOC_BEST_FIT_FAIL_ASSERT   FALSE
 Assert on best-fit buffer allocation failure. More...
 
#define WSF_BUF_ALLOC_FAIL_ASSERT   TRUE
 Assert on buffer allocation failure. More...
 
#define WSF_BUF_STATS_HIST   FALSE
 Buffer histogram stats. More...
 
#define WSF_BUF_STATS_MAX_LEN   128
 Length of the buffer statistics array. More...
 
#define WSF_BUF_STATS_MAX_POOL   32
 Max number of pools can allocate. More...
 
#define WSF_BUF_ALLOC_FAILED   1
 Failure Codes. More...
 
#define WSF_BUF_STATS   FALSE
 Enable buffer allocation statistics. More...
 

Typedefs

typedef void(* WsfBufDiagCback_t) (WsfBufDiag_t *pInfo)
 Callback providing WSF buffer diagnostic messages. More...
 

Functions

uint32_t WsfBufCalcSize (uint8_t numPools, wsfBufPoolDesc_t *pDesc)
 Calculate size required by the buffer pool. More...
 
uint32_t WsfBufInit (uint8_t numPools, wsfBufPoolDesc_t *pDesc)
 Initialize the buffer pool service. This function should only be called once upon system initialization. More...
 
void * WsfBufAlloc (uint16_t len)
 Allocate a buffer. More...
 
void WsfBufFree (void *pBuf)
 Free a buffer. More...
 
uint8_t * WsfBufGetAllocStats (void)
 Diagnostic function to get the buffer allocation statistics. More...
 
uint8_t * WsfBufGetPoolOverFlowStats (void)
 Diagnostic function to get the number of overflow times for each pool. More...
 
uint8_t WsfBufGetNumPool (void)
 Get number of pools. More...
 
void WsfBufGetPoolStats (WsfBufPoolStat_t *pStat, uint8_t numPool)
 Get statistics for each pool. More...
 
void WsfBufDiagRegister (WsfBufDiagCback_t callback)
 Called to register the buffer diagnostics callback function. More...
 

Detailed Description

Macro Definition Documentation

#define WSF_BUF_ALLOC_BEST_FIT_FAIL_ASSERT   FALSE

Assert on best-fit buffer allocation failure.

Definition at line 45 of file wsf_buf.h.

#define WSF_BUF_ALLOC_FAIL_ASSERT   TRUE

Assert on buffer allocation failure.

Definition at line 50 of file wsf_buf.h.

#define WSF_BUF_ALLOC_FAILED   1

Failure Codes.

Definition at line 69 of file wsf_buf.h.

#define WSF_BUF_FREE_CHECK_ASSERT   TRUE

Check if trying to free a buffer that is already free.

Definition at line 40 of file wsf_buf.h.

#define WSF_BUF_STATS   FALSE

Enable buffer allocation statistics.

Definition at line 73 of file wsf_buf.h.

#define WSF_BUF_STATS_HIST   FALSE

Buffer histogram stats.

Definition at line 55 of file wsf_buf.h.

#define WSF_BUF_STATS_MAX_LEN   128

Length of the buffer statistics array.

Definition at line 63 of file wsf_buf.h.

#define WSF_BUF_STATS_MAX_POOL   32

Max number of pools can allocate.

Definition at line 66 of file wsf_buf.h.

Typedef Documentation

typedef void(* WsfBufDiagCback_t) (WsfBufDiag_t *pInfo)

Callback providing WSF buffer diagnostic messages.

Parameters
pInfoDiagnostics message.

Definition at line 126 of file wsf_buf.h.

Function Documentation

void* WsfBufAlloc ( uint16_t  len)

Allocate a buffer.

Parameters
lenLength of buffer to allocate.
Returns
Pointer to allocated buffer or NULL if allocation fails.
uint32_t WsfBufCalcSize ( uint8_t  numPools,
wsfBufPoolDesc_t pDesc 
)

Calculate size required by the buffer pool.

Parameters
numPoolsNumber of buffer pools.
pDescArray of buffer pool descriptors, one for each pool.
Returns
Amount of pBufMem used.
void WsfBufDiagRegister ( WsfBufDiagCback_t  callback)

Called to register the buffer diagnostics callback function.

Parameters
callbackPointer to the callback function.
void WsfBufFree ( void *  pBuf)

Free a buffer.

Parameters
pBufBuffer to free.
uint8_t* WsfBufGetAllocStats ( void  )

Diagnostic function to get the buffer allocation statistics.

Returns
Buffer allocation statistics array.
uint8_t WsfBufGetNumPool ( void  )

Get number of pools.

Returns
Number of pools.
uint8_t* WsfBufGetPoolOverFlowStats ( void  )

Diagnostic function to get the number of overflow times for each pool.

Returns
Overflow times statistics array
void WsfBufGetPoolStats ( WsfBufPoolStat_t pStat,
uint8_t  numPool 
)

Get statistics for each pool.

Parameters
pStatBuffer to store the statistics.
numPoolNumber of pool elements.
Returns
Pool statistics.
uint32_t WsfBufInit ( uint8_t  numPools,
wsfBufPoolDesc_t pDesc 
)

Initialize the buffer pool service. This function should only be called once upon system initialization.

Parameters
numPoolsNumber of buffer pools.
pDescArray of buffer pool descriptors, one for each pool.
Returns
Amount of pBufMem used or 0 for failures.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.