blob: 771c73f60a5528f2712d8708eadd658379e184e9 [file] [log] [blame]
Christina Quast4db82e02015-04-11 18:14:41 +02001#ifndef SIMTRACE_RINGBUF_H
2#define SIMTRACE_RINGBUF_H
3
4#include <stdint.h>
5#include <stdbool.h>
6#include <sys/types.h>
7
Christina Quast2b8a18b2015-04-12 09:31:36 +02008#define RING_BUFLEN 1024
Christina Quast4db82e02015-04-11 18:14:41 +02009
10typedef struct ringbuf {
11 uint8_t buf[RING_BUFLEN];
12 size_t ird;
13 size_t iwr;
14} ringbuf;
15
16void rbuf_reset(volatile ringbuf *rb);
17uint8_t rbuf_read(volatile ringbuf *rb);
18void rbuf_write(volatile ringbuf *rb, uint8_t item);
19bool rbuf_is_empty(volatile ringbuf *rb);
20bool rbuf_is_full(volatile ringbuf *rb);
21
22#endif /* end of include guard: SIMTRACE_RINGBUF_H */