usb compatibility improvements (rodries)
[libogc.git] / lwbt / btpbuf.h
blob924b99c0cf1fdadc2b3b0d426b33080ecc30a3ce
1 #ifndef __BTPBUF_H__
2 #define __BTPBUF_H__
4 #include "bt.h"
6 /* Definitions for the pbuf flag field. These are NOT the flags that
7 * are passed to pbuf_alloc(). */
8 #define PBUF_FLAG_RAM 0x00U /* Flags that pbuf data is stored in RAM */
9 #define PBUF_FLAG_ROM 0x01U /* Flags that pbuf data is stored in ROM */
10 #define PBUF_FLAG_POOL 0x02U /* Flags that the pbuf comes from the pbuf pool */
11 #define PBUF_FLAG_REF 0x04U /* Flags thet the pbuf payload refers to RAM */
13 typedef enum {
14 PBUF_TRANSPORT,
15 PBUF_LINK,
16 PBUF_RAW
17 } pbuf_layer;
19 typedef enum {
20 PBUF_POOL,
21 PBUF_RAM,
22 PBUF_ROM,
23 PBUF_REF
24 } pbuf_flag;
26 struct pbuf {
27 struct pbuf *next;
28 void *payload;
29 u16_t tot_len;
30 u16_t len;
31 u16_t flags;
32 u16_t ref;
35 void btpbuf_init();
36 struct pbuf* btpbuf_alloc(pbuf_layer layer,u16_t len,pbuf_flag flag);
37 u8_t btpbuf_free(struct pbuf *p);
38 void btpbuf_realloc(struct pbuf *p,u16_t new_len);
39 u8_t btpbuf_header(struct pbuf *p,s16_t hdr_size_inc);
40 void btpbuf_cat(struct pbuf *h,struct pbuf *t);
41 u8_t btpbuf_clen(struct pbuf *p);
42 void btpbuf_queue(struct pbuf *p,struct pbuf *n);
43 void btpbuf_ref(struct pbuf *p);
44 void btpbuf_chain(struct pbuf *h,struct pbuf *t);
45 struct pbuf* btpbuf_dequeue(struct pbuf *p);
46 struct pbuf* btpbuf_dechain(struct pbuf *p);
47 struct pbuf* btpbuf_take(struct pbuf *p);
49 #endif