PatchworkOS  3984a1d
A non-POSIX operating system.
Loading...
Searching...
No Matches
fifo.h File Reference
#include <errno.h>
#include <stdint.h>
#include <string.h>
Include dependency graph for fifo.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  fifo_t
 FIFO Buffer. More...
 

Macros

#define FIFO_CREATE(_buf, _size)   {.buffer = (uint8_t*)(_buf), .size = (_size), .head = 0, .tail = 0}
 Create a fifo buffer initializer.
 
#define FIFO_DEFINE(_name, _size)
 Define and initialize a fifo buffer.
 

Functions

void fifo_init (fifo_t *fifo, uint8_t *buffer, size_t size)
 Initialize a fifo buffer.
 
void fifo_reset (fifo_t *fifo)
 Reset a fifo buffer.
 
size_t fifo_bytes_readable (const fifo_t *fifo)
 Return the number of bytes available for reading in a fifo buffer.
 
size_t fifo_bytes_writeable (const fifo_t *fifo)
 Return the number of bytes available for writing in a fifo buffer.
 
size_t fifo_read (fifo_t *fifo, void *buffer, size_t count)
 Read data from a fifo buffer at a specific offset.
 
size_t fifo_write (fifo_t *fifo, const void *buffer, size_t count)
 Write data to the fifo buffer.
 
void fifo_advance_head (fifo_t *fifo, size_t count)
 Advance the head of the fifo buffer.
 
void fifo_advance_tail (fifo_t *fifo, size_t count)
 Advance the tail of the fifo buffer.