WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
RingBuffer
RingBuffer 的协作图:

结构体

struct  Ringbuf
 

枚举

enum  RingbufStatus { RBUF_UNINIT , RBUF_INITED }
 
enum  RingbufFlag { RBUF_NORMAL , RBUF_OVERWRITE }
 

函数

UINT32 LOS_RingbufInit (Ringbuf *ringbuf, CHAR *fifo, UINT32 size, RingbufFlag flag)
 Init a ringbuf.
 
void LOS_RingbufReset (Ringbuf *ringbuf)
 Reset a ringbuf.
 
UINT32 LOS_RingbufWrite (Ringbuf *ringbuf, const CHAR *buf, UINT32 size)
 Write data to ringbuf.
 
UINT32 LOS_RingbufRead (Ringbuf *ringbuf, CHAR *buf, UINT32 size)
 Read data from ringbuf.
 
UINT32 LOS_RingbufPeek (Ringbuf *ringbuf, CHAR *buf, UINT32 size)
 Read data from ringbuf but does not consume the data.
 
UINT32 LOS_RingbufUsedSize (Ringbuf *ringbuf)
 Get a ringbuf's used size.
 

详细描述

枚举类型说明

◆ RingbufFlag

Ringbuf Flag.

枚举值
RBUF_NORMAL 

Ringbuf is normal.

RBUF_OVERWRITE 

Ringbuf can be overwritten.

◆ RingbufStatus

Ringbuf Status.

枚举值
RBUF_UNINIT 

Ringbuf is not inited.

RBUF_INITED 

Ringbuf is inited.

函数说明

◆ LOS_RingbufInit()

UINT32 LOS_RingbufInit ( Ringbuf ringbuf,
CHAR fifo,
UINT32  size,
RingbufFlag  flag 
)
extern

Init a ringbuf.

Description:
This API is used to init a ringbuf.
注意
The size must not be bigger than the fifo's actual size.
参数
ringbuf[OUT] Ringbuf control block.
fifo[IN] Data buf address.
size[IN] Data buf size.
flag[IN] Data buf flag.
返回值
LOS_NOKInit failed, check the legality of function parameters.
LOS_OKInit success.
Dependency:
  • los_ringbuf.h: the header file that contains the API declaration.
参见
LOS_RingbufInit
自从
Huawei LiteOS V200R005C10

◆ LOS_RingbufPeek()

UINT32 LOS_RingbufPeek ( Ringbuf ringbuf,
CHAR buf,
UINT32  size 
)
extern

Read data from ringbuf but does not consume the data.

Description:
This API is used to get data from ringbuf but does not consume the data.
注意
The specific ringbuf must be inited first.
参数
ringbuf[IN] The ringbuf read data from.
buf[OUT] The dest buf address.
size[IN] The dest buf size.
返回值
UINT32The actual read size.
Dependency:
  • los_ring.h: the header file that contains the API declaration.
参见
LOS_RingbufPeek
自从
Huawei LiteOS V200R006C20

◆ LOS_RingbufRead()

UINT32 LOS_RingbufRead ( Ringbuf ringbuf,
CHAR buf,
UINT32  size 
)
extern

Read data from ringbuf.

Description:
This API is used to get data from ringbuf.
注意
The specific ringbuf must be inited first.
参数
ringbuf[IN] The ringbuf read data from.
buf[OUT] The dest buf address.
size[IN] The dest buf size.
返回值
UINT32The actual read size.
Dependency:
  • los_ring.h: the header file that contains the API declaration.
参见
LOS_RingbufRead
自从
Huawei LiteOS V200R005C10

◆ LOS_RingbufReset()

void LOS_RingbufReset ( Ringbuf ringbuf)
extern

Reset a ringbuf.

Description:
This API is used to reset a ringbuf to the init status.
注意
The specific ringbuf must be inited first.
参数
ringbuf[IN] Ringbuf created by LOS_RingbufInit.
返回值
None.
Dependency:
  • los_ringbuf.h: the header file that contains the API declaration.
参见
LOS_RingbufReset
自从
Huawei LiteOS V200R005C10

◆ LOS_RingbufUsedSize()

UINT32 LOS_RingbufUsedSize ( Ringbuf ringbuf)
extern

Get a ringbuf's used size.

Description:
This API is used to get a ringbuf's used size.
注意
The specific ringbuf must be inited first.
参数
ringbuf[IN] The ringbuf address
返回值
UINT32The used size of ringbuf.
Dependency:
  • los_ringbuf.h: the header file that contains the API declaration.
参见
LOS_RingbufUsedSize
自从
Huawei LiteOS V200R005C10

◆ LOS_RingbufWrite()

UINT32 LOS_RingbufWrite ( Ringbuf ringbuf,
const CHAR buf,
UINT32  size 
)
extern

Write data to ringbuf.

Description:
This API is used to write data to ringbuf.
注意
The specific ringbuf must be inited first.
参数
ringbuf[IN] The ringbuf write data to.
buf[IN] The source buf address.
size[IN] The source buf size.
返回值
UINT32The actual written size.
Dependency:
  • los_ringbuf.h: the header file that contains the API declaration.
参见
LOS_RingbufWrite
自从
Huawei LiteOS V200R005C10