Christina Quast | 4db82e0 | 2015-04-11 18:14:41 +0200 | [diff] [blame^] | 1 | #ifndef SIMTRACE_RINGBUF_H |
| 2 | #define SIMTRACE_RINGBUF_H |
| 3 | |
| 4 | #include <stdint.h> |
| 5 | #include <stdbool.h> |
| 6 | #include <sys/types.h> |
| 7 | |
| 8 | #define RING_BUFLEN 64 |
| 9 | |
| 10 | typedef struct ringbuf { |
| 11 | uint8_t buf[RING_BUFLEN]; |
| 12 | size_t ird; |
| 13 | size_t iwr; |
| 14 | } ringbuf; |
| 15 | |
| 16 | void rbuf_reset(volatile ringbuf *rb); |
| 17 | uint8_t rbuf_read(volatile ringbuf *rb); |
| 18 | void rbuf_write(volatile ringbuf *rb, uint8_t item); |
| 19 | bool rbuf_is_empty(volatile ringbuf *rb); |
| 20 | bool rbuf_is_full(volatile ringbuf *rb); |
| 21 | |
| 22 | #endif /* end of include guard: SIMTRACE_RINGBUF_H */ |