avrinput/ringbuffer.h

26 lines
460 B
C

#ifndef _RINGBUFFER_H_
#define _RINGBUFFER_H_
#include <stdlib.h>
typedef struct ringbuffer_s
{
size_t length;
size_t head, tail;
unsigned char * buffer;
char ovf;
} * ringbuffer_t;
ringbuffer_t
ringbuffer_new(size_t size);
int
ringbuffer_nonempty(ringbuffer_t buffer);
unsigned char
ringbuffer_get_char(ringbuffer_t buffer);
int
ringbuffer_put_char(ringbuffer_t buffer
, unsigned char c);
size_t ringbuffer_empty_bytes(ringbuffer_t buffer);
#endif