k-chow/k/utils/ring_buffer.h

22 lines
426 B
C
Raw Permalink Normal View History

#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 */