3 /* Author: Domen Puncer Kugler <domen@cba.si>. License: WTFPL, see file LICENSE */
10 volatile unsigned head
; /* points to first free byte */
11 volatile unsigned tail
; /* points to first used byte */
12 volatile unsigned tailwrap
;
13 /* extreme case tail == head: all free;
14 * tail == head+1: all full (last byte can't be used)
15 * ____tailxxxxxxxxhead_____
16 * xxxxhead________tailxxxxx
20 void bip_buf_init(struct bip_buf
*cb
, void *buf
, unsigned size
);
22 void* bip_buf_alloc(struct bip_buf
*cb
, unsigned len
);
23 /* len here must be exactly the same as for _alloc() */
24 void bip_buf_alloc_commit(struct bip_buf
*cb
, unsigned len
);
26 void* bip_buf_getdata(struct bip_buf
*cb
);
27 void bip_buf_free(struct bip_buf
*cb
, unsigned len
);