7 #ifndef UBICLIB_CIRBUF_H_
8 #define UBICLIB_CIRBUF_H_
23 #include <ubinos_config.h>
27 #define CIRBUF_OPT__NOOVERWRITE 0x0001
30 #define CIRBUF_OPT__MTPROTECTION 0x0002
59 #define cirbuf_init(cirbuf, maxsize) \
61 (cirbuf)->maxsize = maxsize; \
62 (cirbuf)->buf = (unsigned char *) ((unsigned int) cirbuf + sizeof(cirbuf_t)); \
64 (cirbuf)->head = (cirbuf)->buf; \
65 (cirbuf)->tail = (cirbuf)->buf; \
68 (cirbuf)->overflowcount = 0; \
69 (cirbuf)->mtprotection = 0; \
70 (cirbuf)->overwrite = 0; \
71 (cirbuf)->reserved = 0; \
104 unsigned int option);
136 unsigned int * written_p);
155 unsigned int * read_p);
int cirbuf_create_ext(cirbuf_pt *cirbuf_p, unsigned int maxsize, unsigned int option)
int cirbuf_create(cirbuf_pt *cirbuf_p, unsigned int maxsize)
int cirbuf_read(cirbuf_pt cirbuf, unsigned char *buf, unsigned int size, unsigned int *read_p)
int cirbuf_clear(cirbuf_pt cirbuf)
cirbuf_t * cirbuf_pt
Definition: cirbuf.h:50
int cirbuf_write(cirbuf_pt cirbuf, unsigned char *buf, unsigned int size, unsigned int *written_p)
struct _cirbuf_t cirbuf_t
int cirbuf_delete(cirbuf_pt *cirbuf_p)
unsigned int mtprotection
Definition: cirbuf.h:41
unsigned int size
Definition: cirbuf.h:37
unsigned int maxsize
Definition: cirbuf.h:45
unsigned int overwrite
Definition: cirbuf.h:42
unsigned char * head
Definition: cirbuf.h:35
unsigned int overflowcount
Definition: cirbuf.h:39
unsigned int reserved
Definition: cirbuf.h:43
unsigned char * buf
Definition: cirbuf.h:46
unsigned char * tail
Definition: cirbuf.h:36