diff options
| author | Michal Idziorek <m.i@gmx.at> | 2015-05-18 09:20:01 +0200 |
|---|---|---|
| committer | Michal Idziorek <m.i@gmx.at> | 2015-05-18 09:20:01 +0200 |
| commit | a6184be79e3918764d5e683796afbd8e8ccba018 (patch) | |
| tree | 870a5506efad410c89524bbeb740fb44974bf1da /kernel/ringbuffer.h | |
| parent | fe79552d9fcfd60d8c2bb828c6b93cf471ef7b75 (diff) | |
fifo through ringbuffer(stdin) and vt52(stdout) finally working!
Diffstat (limited to 'kernel/ringbuffer.h')
| -rw-r--r-- | kernel/ringbuffer.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/kernel/ringbuffer.h b/kernel/ringbuffer.h new file mode 100644 index 0000000..c79fdcf --- /dev/null +++ b/kernel/ringbuffer.h @@ -0,0 +1,27 @@ +#ifndef RINGBUFFER_H +#define RINGBUFFER_H + +#include <stdint.h> +#include <stdbool.h> + +// Simple FIRST IN FIRST OUT +// requires kballoc - block allocation +typedef volatile struct ringbuffer_struct +{ + uint32_t size; + uint32_t front; + uint32_t back; + + uint8_t *data; + +}ringbuffer; + +// create new fifo of given size (in blocks) +ringbuffer ringbuffer_init(uint32_t blocks); + +// true on success +bool ringbuffer_put(ringbuffer*,uint8_t); +uint8_t ringbuffer_get(ringbuffer*); // non-blocking please check first +bool ringbuffer_has(ringbuffer*); // check if somehting waiting? + +#endif |
