]> defiant.homedns.org Git - ros_wild_thumper.git/blob - avr/motor_ctrl/ringbuffer.h
Merge branch 'master' of ssh://vontaene/home/erik_alt/git/ros_wild_thumper
[ros_wild_thumper.git] / avr / motor_ctrl / ringbuffer.h
1 #ifndef RINGBUFFER_H
2 #define RINGBUFFER_H
3
4 #define RINGBUFFER_LEN 100
5 #define RINGBUFFER_MAX_NUM 1
6
7 typedef struct ringbuffer {
8         char read[RINGBUFFER_LEN];
9         char *in_read_ptr;
10         char *out_read_ptr;
11         char write[RINGBUFFER_LEN];
12         char *in_write_ptr;
13         char *out_write_ptr;
14         FILE *dev;
15         FILE *dev_in_as_out;
16         uint8_t newlines;
17         char block_read;
18 } ringbuffer_t;
19
20 ringbuffer_t *ringbuffers[RINGBUFFER_MAX_NUM];
21 uint8_t num_ringbuffers;
22
23 void ringbuffer_setup(FILE *stream, ringbuffer_t *buffer);
24 void ringbuffer_setup_in_as_out(FILE *stream, ringbuffer_t *buffer);
25 void init_ringbuffers(void);
26 void stream_setup(FILE *uart_stream);
27 void stream_setup_out_only(FILE *stream);
28 void stream_setup_in_as_out(FILE *stream, int ringbuffer_putchar_sound(char, FILE*));
29 uint8_t ringbuffer_busy(void);
30 void ringbuffer_set_read_noblock(FILE *stream);
31 void ringbuffer_set_read_block(FILE *stream, char c);
32
33 #endif
34