mirror of
https://github.com/AsahiLinux/m1n1
synced 2024-12-02 19:19:09 +00:00
ea362ea8f9
Signed-off-by: Sven Peter <sven@svenpeter.dev>
22 lines
491 B
C
22 lines
491 B
C
#ifndef RINGBUFFER_H
|
|
#define RINGBUFFER_H
|
|
|
|
#include "types.h"
|
|
|
|
typedef struct {
|
|
u8 *buffer;
|
|
size_t len;
|
|
size_t read;
|
|
size_t write;
|
|
} ringbuffer_t;
|
|
|
|
ringbuffer_t *ringbuffer_alloc(size_t len);
|
|
void ringbuffer_free(ringbuffer_t *bfr);
|
|
|
|
size_t ringbuffer_read(u8 *target, size_t len, ringbuffer_t *bfr);
|
|
size_t ringbuffer_write(const u8 *src, size_t len, ringbuffer_t *bfr);
|
|
|
|
size_t ringbuffer_get_used(ringbuffer_t *bfr);
|
|
size_t ringbuffer_get_free(ringbuffer_t *bfr);
|
|
|
|
#endif
|