b_util_fifo

数据结构

typedef struct
{
    uint8_t *         pbuf;
    uint16_t          size;
    volatile uint16_t r_index;
    volatile uint16_t w_index;
} bFIFO_Info_t;
typedef bFIFO_Info_t bFIFO_Instance_t;

接口介绍

//创建fifo实例
#define bFIFO_INSTANCE(name, _fifo_size)     \
    static uint8_t   fifo##name[_fifo_size]; \
    bFIFO_Instance_t name = {.pbuf = fifo##name, .size = _fifo_size, .r_index = 0, .w_index = 0};
///< pinstance \ref bFIFO_INSTANCE
int bFIFO_Write(bFIFO_Instance_t *pinstance, uint8_t *pbuf, uint16_t size);
int bFIFO_Read(bFIFO_Instance_t *pinstance, uint8_t *pbuf, uint16_t size);
int bFIFO_Length(bFIFO_Instance_t *pinstance, uint16_t *plen);
int bFIFO_Flush(bFIFO_Instance_t *pinstance);
int bFIFO_DynCreate(bFIFO_Instance_t *pinstance, uint16_t size);
int bFIFO_DynDelete(bFIFO_Instance_t *pinstance);