45#define ISRPIPE_INIT(buf) { .mutex = MUTEX_INIT_LOCKED, \
46 .tsrb = TSRB_INIT(buf) }
int isrpipe_write_one(isrpipe_t *isrpipe, uint8_t c)
Put one byte into the isrpipe's buffer.
static unsigned int isrpipe_get_free(isrpipe_t *isrpipe)
Get the number of bytes that can still be written to the isrpipe.
static void isrpipe_clear(isrpipe_t *isrpipe)
Clear the isrpipe's buffer.
void isrpipe_init(isrpipe_t *isrpipe, uint8_t *buf, size_t bufsize)
Initialisation function for isrpipe.
uint8_t isrpipe_read_one(isrpipe_t *isrpipe)
Read a single byte from isrpipe (blocking)
static unsigned int isrpipe_available(isrpipe_t *isrpipe)
Get the number of bytes available for reading from the isrpipe.
int isrpipe_read(isrpipe_t *isrpipe, uint8_t *buf, size_t count)
Read data from isrpipe (blocking)
int isrpipe_write(isrpipe_t *isrpipe, const uint8_t *buf, size_t n)
Put number of bytes into the isrpipe's buffer.
static unsigned int tsrb_free(const tsrb_t *rb)
Get free space in ringbuffer.
static unsigned int tsrb_avail(const tsrb_t *rb)
Get number of bytes available for reading.
struct tsrb tsrb_t
thread-safe ringbuffer struct
static void tsrb_clear(tsrb_t *rb)
Clear a tsrb.
Mutex for thread synchronization.
Context structure for isrpipe.
tsrb_t tsrb
isrpipe thread safe ringbuffer
mutex_t mutex
isrpipe mutex
Thread-safe ringbuffer interface definition.