![]() |
EVE 1.0
|
![]() |
Data Structures | |
struct | rbuf_t |
Structure that holds the state of a ring buffer. More... | |
Functions | |
void | rbuf_init (struct rbuf_t *r, uint8_t *a, uint32_t size) |
Initialize a ring buffer. More... | |
uint32_t | rbuf_size (struct rbuf_t *r) |
Get the size of a ring buffer. More... | |
uint32_t | rbuf_used (struct rbuf_t *r) |
Get the number of bytes currently used in the ring buffer. More... | |
uint32_t | rbuf_contused (struct rbuf_t *r, uint8_t **ptr) |
Get the length of a continuous used part of the buffer and a pointer to its beginning. More... | |
void | rbuf_commitread (struct rbuf_t *r, uint32_t l) |
Advance the read pointer of the buffer after direct read. Note that length cannot be larger than the value returned by rbuf_contused() More... | |
uint32_t | rbuf_free (struct rbuf_t *r) |
Get the number of free bytes currently in the ring buffer. More... | |
uint32_t | rbuf_contfree (struct rbuf_t *r, uint8_t **ptr) |
Get the length of a continuous free part of the buffer and a pointer to its beginning. More... | |
void | rbuf_commitwrite (struct rbuf_t *r, uint32_t l) |
Advance the write pointer of the buffer after direct write. Note that length cannot be larger than the value returned by rbuf_contfree() More... | |
bool | rbuf_push (struct rbuf_t *r, const uint8_t *a, uint32_t l) |
Put an array of bytes to the ring buffer. More... | |
bool | rbuf_pull (struct rbuf_t *r, uint8_t *a, uint32_t l) |
Get an array of bytes from the ring buffer. More... | |
void rbuf_init | ( | struct rbuf_t * | r, |
uint8_t * | a, | ||
uint32_t | size | ||
) |
Initialize a ring buffer.
r | A pointer to a struct rbuf_t to hold the state of the ring buffer |
a | A pointer to an array to hold the data in the buffer |
size | The size of the ring buffer This function initiates a ring buffer. The data in the buffer is stored in an external array, to which a pointer must be supplied. |
uint32_t rbuf_size | ( | struct rbuf_t * | r | ) |
Get the size of a ring buffer.
r | A pointer to a struct rbuf_t to hold the state of the ring buffer |
uint32_t rbuf_used | ( | struct rbuf_t * | r | ) |
Get the number of bytes currently used in the ring buffer.
r | A pointer to a struct rbuf_t to hold the state of the ring buffer |
uint32_t rbuf_contused | ( | struct rbuf_t * | r, |
uint8_t ** | ptr | ||
) |
Get the length of a continuous used part of the buffer and a pointer to its beginning.
r | A pointer to a struct rbuf_t to hold the state of the ring buffer | |
[out] | ptr | Pointer to the pointer to the beginning of a continuous used part |
void rbuf_commitread | ( | struct rbuf_t * | r, |
uint32_t | l | ||
) |
Advance the read pointer of the buffer after direct read. Note that length cannot be larger than the value returned by rbuf_contused()
r | A pointer to a struct rbuf_t to hold the state of the ring buffer |
l | Number of bytes read |
uint32_t rbuf_free | ( | struct rbuf_t * | r | ) |
Get the number of free bytes currently in the ring buffer.
r | A pointer to a struct rbuf_t to hold the state of the ring buffer |
uint32_t rbuf_contfree | ( | struct rbuf_t * | r, |
uint8_t ** | ptr | ||
) |
Get the length of a continuous free part of the buffer and a pointer to its beginning.
r | A pointer to a struct rbuf_t to hold the state of the ring buffer | |
[out] | ptr | Pointer to the pointer to the beginning of a continuous free part |
void rbuf_commitwrite | ( | struct rbuf_t * | r, |
uint32_t | l | ||
) |
Advance the write pointer of the buffer after direct write. Note that length cannot be larger than the value returned by rbuf_contfree()
r | A pointer to a struct rbuf_t to hold the state of the ring buffer |
l | Number of bytes written |
bool rbuf_push | ( | struct rbuf_t * | r, |
const uint8_t * | a, | ||
uint32_t | l | ||
) |
Put an array of bytes to the ring buffer.
r | A pointer to a struct rbuf_t to hold the state of the ring buffer |
a | A pointer to an array to copy data from |
l | Number of bytes to put |
bool rbuf_pull | ( | struct rbuf_t * | r, |
uint8_t * | a, | ||
uint32_t | l | ||
) |
Get an array of bytes from the ring buffer.
r | A pointer to a struct rbuf_t to hold the state of the ring buffer |
a | A pointer to an array to copy data to |
l | Number of bytes to get |