Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ozeltbuf.h
Go to the documentation of this file.
1 /* -----------------------------------------------------------------------------
2  * Copyright (c) 2011 Ozmo Inc
3  * Released under the GNU General Public License Version 2 (GPLv2).
4  * -----------------------------------------------------------------------------
5  */
6 #ifndef _OZELTBUF_H
7 #define _OZELTBUF_H
8 
9 #include "ozprotocol.h"
10 
11 /*-----------------------------------------------------------------------------
12  */
13 struct oz_pd;
14 typedef void (*oz_elt_callback_t)(struct oz_pd *pd, long context);
15 
16 struct oz_elt_stream {
17  struct list_head link;
20  unsigned buf_count;
21  unsigned max_buf_count;
23  u8 id;
24 };
25 
26 #define OZ_MAX_ELT_PAYLOAD 255
27 struct oz_elt_info {
28  struct list_head link;
33  long context;
35  u8 data[sizeof(struct oz_elt) + OZ_MAX_ELT_PAYLOAD];
36  int length;
37  unsigned magic;
38 };
39 /* Flags values */
40 #define OZ_EI_F_MARKED 0x1
41 
42 struct oz_elt_buf {
48  int free_elts;
51 };
52 
53 int oz_elt_buf_init(struct oz_elt_buf *buf);
54 void oz_elt_buf_term(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);
67 void oz_trim_elt_pool(struct oz_elt_buf *buf);
68 
69 #endif /* _OZELTBUF_H */
70