Subversion Repositories Code-Repo

Rev

Rev 114 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

#ifndef __circular_buffer_h
#define __circular_buffer_h

#define BUFFER_OK       0
#define BUFFER_ERROR    -1
#define BUFFER_SIZE     512

typedef struct __BUFFER_DATA {
    unsigned int index_read;
    unsigned int index_write;
    unsigned int stored_length;
    unsigned char *buffer;
} BUFFER_DATA; // 7 bytes overhead

void buffer_init(BUFFER_DATA *);
char buffer_insert_one(unsigned char);
char buffer_insert(unsigned char length, unsigned char *msg);
char buffer_read(unsigned char length, unsigned char *dest);
unsigned int buffer_free_space(void);

#endif