Add the rt linux 4.1.3-rt3 as base
[kvmfornfv.git] / kernel / drivers / staging / ozwpan / ozeltbuf.h
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;
18         struct list_head elt_list;
19         atomic_t ref_count;
20         unsigned buf_count;
21         unsigned max_buf_count;
22         u8 frame_number;
23         u8 id;
24 };
25
26 #define OZ_MAX_ELT_PAYLOAD      255
27 struct oz_elt_info {
28         struct list_head link;
29         struct list_head link_order;
30         u8 flags;
31         u8 app_id;
32         oz_elt_callback_t callback;
33         long context;
34         struct oz_elt_stream *stream;
35         u8 data[sizeof(struct oz_elt) + OZ_MAX_ELT_PAYLOAD];
36         int length;
37 };
38 /* Flags values */
39 #define OZ_EI_F_MARKED          0x1
40
41 struct oz_elt_buf {
42         spinlock_t lock;
43         struct list_head stream_list;
44         struct list_head order_list;
45         struct list_head isoc_list;
46         u8 tx_seq_num[OZ_NB_APPS];
47 };
48
49 void oz_elt_buf_init(struct oz_elt_buf *buf);
50 void oz_elt_buf_term(struct oz_elt_buf *buf);
51 struct oz_elt_info *oz_elt_info_alloc(struct oz_elt_buf *buf);
52 void oz_elt_info_free(struct oz_elt_buf *buf, struct oz_elt_info *ei);
53 void oz_elt_info_free_chain(struct oz_elt_buf *buf, struct list_head *list);
54 int oz_elt_stream_create(struct oz_elt_buf *buf, u8 id, int max_buf_count);
55 int oz_elt_stream_delete(struct oz_elt_buf *buf, u8 id);
56 void oz_elt_stream_get(struct oz_elt_stream *st);
57 void oz_elt_stream_put(struct oz_elt_stream *st);
58 int oz_queue_elt_info(struct oz_elt_buf *buf, u8 isoc, u8 id,
59                 struct oz_elt_info *ei);
60 int oz_select_elts_for_tx(struct oz_elt_buf *buf, u8 isoc, unsigned *len,
61                 unsigned max_len, struct list_head *list);
62 int oz_are_elts_available(struct oz_elt_buf *buf);
63
64 #endif /* _OZELTBUF_H */
65