1 /* -----------------------------------------------------------------------------
2 * Copyright (c) 2011 Ozmo Inc
3 * Released under the GNU General Public License Version 2 (GPLv2).
4 * -----------------------------------------------------------------------------
9 #include "ozprotocol.h"
11 /*-----------------------------------------------------------------------------
14 typedef void (*oz_elt_callback_t
)(struct oz_pd
*pd
, long context
);
16 struct oz_elt_stream
{
17 struct list_head link
;
18 struct list_head elt_list
;
21 unsigned max_buf_count
;
26 #define OZ_MAX_ELT_PAYLOAD 255
28 struct list_head link
;
29 struct list_head link_order
;
32 oz_elt_callback_t callback
;
34 struct oz_elt_stream
*stream
;
35 u8 data
[sizeof(struct oz_elt
) + OZ_MAX_ELT_PAYLOAD
];
40 #define OZ_EI_F_MARKED 0x1
44 struct list_head stream_list
;
45 struct list_head order_list
;
46 struct list_head isoc_list
;
47 struct list_head
*elt_pool
;
50 u8 tx_seq_num
[OZ_NB_APPS
];
53 int oz_elt_buf_init(struct oz_elt_buf
*buf
);
54 void oz_elt_buf_term(struct oz_elt_buf
*buf
);
55 struct oz_elt_info
*oz_elt_info_alloc(struct oz_elt_buf
*buf
);
56 void oz_elt_info_free(struct oz_elt_buf
*buf
, struct oz_elt_info
*ei
);
57 void oz_elt_info_free_chain(struct oz_elt_buf
*buf
, struct list_head
*list
);
58 int oz_elt_stream_create(struct oz_elt_buf
*buf
, u8 id
, int max_buf_count
);
59 int oz_elt_stream_delete(struct oz_elt_buf
*buf
, u8 id
);
60 void oz_elt_stream_get(struct oz_elt_stream
*st
);
61 void oz_elt_stream_put(struct oz_elt_stream
*st
);
62 int oz_queue_elt_info(struct oz_elt_buf
*buf
, u8 isoc
, u8 id
,
63 struct oz_elt_info
*ei
);
64 int oz_select_elts_for_tx(struct oz_elt_buf
*buf
, u8 isoc
, unsigned *len
,
65 unsigned max_len
, struct list_head
*list
);
66 int oz_are_elts_available(struct oz_elt_buf
*buf
);
67 void oz_trim_elt_pool(struct oz_elt_buf
*buf
);
69 #endif /* _OZELTBUF_H */