2013-10-02 06:56:10 +00:00
|
|
|
#ifndef CIRCLE_BUFFER_H
|
|
|
|
#define CIRCLE_BUFFER_H
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
struct CircleBuffer {
|
|
|
|
void* data;
|
|
|
|
unsigned capacity;
|
2013-10-03 08:25:51 +00:00
|
|
|
unsigned size;
|
2013-10-02 06:56:10 +00:00
|
|
|
void* readPtr;
|
|
|
|
void* writePtr;
|
|
|
|
};
|
|
|
|
|
|
|
|
void CircleBufferInit(struct CircleBuffer* buffer, unsigned capacity);
|
|
|
|
void CircleBufferDeinit(struct CircleBuffer* buffer);
|
|
|
|
unsigned CircleBufferSize(const struct CircleBuffer* buffer);
|
2013-10-03 08:25:51 +00:00
|
|
|
int CircleBufferWrite8(struct CircleBuffer* buffer, int8_t value);
|
2013-10-02 06:56:10 +00:00
|
|
|
int CircleBufferWrite32(struct CircleBuffer* buffer, int32_t value);
|
2013-10-02 09:45:41 +00:00
|
|
|
int CircleBufferRead8(struct CircleBuffer* buffer, int8_t* value);
|
2013-10-02 06:56:10 +00:00
|
|
|
int CircleBufferRead32(struct CircleBuffer* buffer, int32_t* value);
|
|
|
|
|
|
|
|
#endif
|