k-chow/k/utils/ring_buffer.h
Julien CLEMENT cf020eae84 feat(keyboard): implement generic ring buffer and add getkey
Signed-off-by: Julien CLEMENT <julien.clement@epita.fr>
2021-07-26 10:41:51 +02:00

22 lines
426 B
C

#ifndef RING_BUFFER_H
#define RING_BUFFER_H
#define RING_BUFFER_SIZE 256
#include "k/types.h"
struct ring_buffer
{
char buffer[RING_BUFFER_SIZE];
u32 start;
u32 end;
u32 element_size;
u32 size;
};
void ring_buffer_init(struct ring_buffer *buffer, u32 el_size);
void ring_buffer_push(struct ring_buffer *buffer, void *el);
void *ring_buffer_pop(struct ring_buffer *buffer);
#endif /* !RING_BUFFER_H */