2022-07-03 11:28:44 -05:00
|
|
|
#ifndef CIRCBUF_H
|
|
|
|
#define CIRCBUF_H
|
|
|
|
|
|
|
|
#include <stdio.h>
|
2022-07-03 19:24:53 -05:00
|
|
|
#include <stdint.h>
|
2022-07-03 11:28:44 -05:00
|
|
|
|
|
|
|
struct circbuf {
|
2022-07-03 19:24:53 -05:00
|
|
|
int16_t *data;
|
|
|
|
uint32_t read;
|
|
|
|
uint32_t write;
|
2022-07-05 15:12:48 -05:00
|
|
|
unsigned int len;
|
2022-07-03 11:28:44 -05:00
|
|
|
};
|
|
|
|
|
2022-07-05 15:12:48 -05:00
|
|
|
struct circbuf circbuf_init(size_t size, unsigned int len);
|
2022-07-03 19:24:53 -05:00
|
|
|
void cbuf_push(struct circbuf *buf, short data);
|
|
|
|
short cbuf_shift(struct circbuf *buf);
|
2022-07-03 11:28:44 -05:00
|
|
|
|
|
|
|
|
|
|
|
#endif
|