OS  v7.3.3
Documentation
Byte-Sized buffers

An interrupt-safe byte-sized ring buffer interface. More...

Collaboration diagram for Byte-Sized buffers:

Data Structures

struct  qBSBuffer_t
 A BSBuffer(Byte-sized buffer) object. More...
 

Functions

size_t qBSBuffer_Count (const qBSBuffer_t *const b)
 Query the number of elements in the Byte-sized buffer. More...
 
qBool_t qBSBuffer_IsFull (const qBSBuffer_t *const b)
 Query the full status of the Byte-sized buffer. More...
 
qBool_t qBSBuffer_Empty (const qBSBuffer_t *const b)
 Query the empty status of the Byte-sized buffer. More...
 
qUINT8_t qBSBuffer_Peek (const qBSBuffer_t *const b)
 Looks for one byte from the head of the Byte-sized buffer without removing it. More...
 
qBool_t qBSBuffer_Get (qBSBuffer_t *const b, qUINT8_t *dst)
 Gets one data-byte from the front of the Byte-sized buffer, and removes it. More...
 
qBool_t qBSBuffer_Read (qBSBuffer_t *const b, void *dst, const size_t n)
 Gets n data from the Byte-sized buffer and removes them. More...
 
qBool_t qBSBuffer_Put (qBSBuffer_t *const b, const qUINT8_t bData)
 Adds an element of data to the Byte-sized buffer. More...
 
qBool_t qBSBuffer_Setup (qBSBuffer_t *const b, volatile qUINT8_t *pBuffer, const size_t length)
 Initialize the Byte-sized buffer. More...
 

Detailed Description

An interrupt-safe byte-sized ring buffer interface.

Function Documentation

◆ qBSBuffer_Count()

size_t qBSBuffer_Count ( const qBSBuffer_t *const  b)

Query the number of elements in the Byte-sized buffer.

Parameters
[in]ba pointer to the qBSBuffer(Byte-sized Buffer) object
Returns
Number of elements in the BSBuffer(Byte-sized Buffer)

◆ qBSBuffer_Empty()

qBool_t qBSBuffer_Empty ( const qBSBuffer_t *const  b)

Query the empty status of the Byte-sized buffer.

Parameters
[in]ba pointer to the qBSBuffer(Byte-sized Buffer) object
Returns
qTrue if the BSBuffer(Byte-sized Buffer) is empty, qFalse if it is not.

◆ qBSBuffer_Get()

qBool_t qBSBuffer_Get ( qBSBuffer_t *const  b,
qUINT8_t dst 
)

Gets one data-byte from the front of the Byte-sized buffer, and removes it.

Parameters
[in]ba pointer to the qBSBuffer(Byte-sized Buffer) object
[out]dstthe location where the data-byte will be written
Returns
qTrue on success, otherwise returns qFalse

◆ qBSBuffer_IsFull()

qBool_t qBSBuffer_IsFull ( const qBSBuffer_t *const  b)

Query the full status of the Byte-sized buffer.

Parameters
[in]ba pointer to the qBSBuffer(Byte-sized Buffer) object
Returns
qTrue if the BSBuffer(Byte-sized Buffer) is full, qFalse if it is not.

◆ qBSBuffer_Peek()

qUINT8_t qBSBuffer_Peek ( const qBSBuffer_t *const  b)

Looks for one byte from the head of the Byte-sized buffer without removing it.

Parameters
[in]ba pointer to the Byte-sized buffer object
Returns
byte of data, or zero if nothing in the list

◆ qBSBuffer_Put()

qBool_t qBSBuffer_Put ( qBSBuffer_t *const  b,
const qUINT8_t  bData 
)

Adds an element of data to the Byte-sized buffer.

Parameters
[in]ba pointer to the qBSBuffer(Byte-sized Buffer) object
[in]bDataThe data to be added
Returns
qTrue on success, otherwise returns qFalse.

◆ qBSBuffer_Read()

qBool_t qBSBuffer_Read ( qBSBuffer_t *const  b,
void *  dst,
const size_t  n 
)

Gets n data from the Byte-sized buffer and removes them.

Parameters
[in]ba pointer to the qBSBuffer(Byte-sized Buffer) object
[out]dstthe location where the data-byte will be written
[in]nThe number of bytes to read
Returns
qTrue on success, otherwise returns qFalse

◆ qBSBuffer_Setup()

qBool_t qBSBuffer_Setup ( qBSBuffer_t *const  b,
volatile qUINT8_t pBuffer,
const size_t  length 
)

Initialize the Byte-sized buffer.

Parameters
[in]ba pointer to the qBSBuffer(Byte-sized Buffer) object
[in]pBufferBlock of memory or array of data
[in]lengthThe size of the buffer(Must be a power of two)
Returns
qTrue on success, otherwise returns qFalse.