4 * Copyright (c) 2008 James McKenzie <james@fishsoup.dhs.org>,
15 * Revision 1.2 2008/02/12 22:36:46 james
16 * *** empty log message ***
18 * Revision 1.1 2008/02/08 15:06:42 james
19 * *** empty log message ***
34 #define RING_NEXT(r,a) (((a)+1) % ((r)->size))
35 #define RING_NEXT_R(r) RING_NEXT(r,r->rptr)
36 #define RING_NEXT_W(r) RING_NEXT(r,r->wptr)
38 #define RING_EMPTY(r) (((r)->wptr) == ((r)->rptr))
39 #define RING_FULL(r) (RING_NEXT_W(r) == ((r)->rptr))
42 ring_write_one (Ring * r, uint8_t * c)
47 r->ring[r->wptr++] = *c;
49 if (r->wptr == r->size)
56 ring_read_one (Ring * r, uint8_t * c)
61 *c = r->ring[r->rptr++];
63 if (r->rptr == r->size)
71 #endif /* __RING_H__ */