1
2
3
4
5
6#ifndef _OZPD_H_
7#define _OZPD_H_
8
9#include <linux/interrupt.h>
10#include "ozeltbuf.h"
11
12
13
14#define OZ_PD_S_IDLE 0x1
15#define OZ_PD_S_CONNECTED 0x2
16#define OZ_PD_S_SLEEP 0x4
17#define OZ_PD_S_STOPPED 0x8
18
19
20
21#define OZ_TIMER_TOUT 1
22#define OZ_TIMER_HEARTBEAT 2
23#define OZ_TIMER_STOP 3
24
25
26
27
28
29struct oz_tx_frame {
30 struct list_head link;
31 struct list_head elt_list;
32 struct oz_hdr hdr;
33 struct sk_buff *skb;
34 int total_size;
35};
36
37struct oz_isoc_stream {
38 struct list_head link;
39 u8 ep_num;
40 u8 frame_num;
41 u8 nb_units;
42 int size;
43 struct sk_buff *skb;
44 struct oz_hdr *oz_hdr;
45};
46
47struct oz_farewell {
48 struct list_head link;
49 u8 ep_num;
50 u8 index;
51 u8 len;
52 u8 report[0];
53};
54
55
56
57struct oz_pd {
58 struct list_head link;
59 atomic_t ref_count;
60 u8 mac_addr[ETH_ALEN];
61 unsigned state;
62 unsigned state_flags;
63 unsigned send_flags;
64 u16 total_apps;
65 u16 paused_apps;
66 u8 session_id;
67 u8 param_rsp_status;
68 u8 pd_info;
69 u8 isoc_sent;
70 u32 last_rx_pkt_num;
71 u32 last_tx_pkt_num;
72 struct timespec last_rx_timestamp;
73 u32 trigger_pkt_num;
74 unsigned long pulse_time;
75 unsigned long pulse_period;
76 unsigned long presleep;
77 unsigned long keep_alive;
78 struct oz_elt_buf elt_buff;
79 void *app_ctx[OZ_APPID_MAX];
80 spinlock_t app_lock[OZ_APPID_MAX];
81 int max_tx_size;
82 u8 mode;
83 u8 ms_per_isoc;
84 unsigned isoc_latency;
85 unsigned max_stream_buffering;
86 int nb_queued_frames;
87 int nb_queued_isoc_frames;
88 struct list_head *tx_pool;
89 int tx_pool_count;
90 spinlock_t tx_frame_lock;
91 struct list_head *last_sent_frame;
92 struct list_head tx_queue;
93 struct list_head farewell_list;
94 spinlock_t stream_lock;
95 struct list_head stream_list;
96 struct net_device *net_dev;
97 struct hrtimer heartbeat;
98 struct hrtimer timeout;
99 u8 timeout_type;
100 struct tasklet_struct heartbeat_tasklet;
101 struct tasklet_struct timeout_tasklet;
102 struct work_struct workitem;
103};
104
105#define OZ_MAX_QUEUED_FRAMES 4
106
107struct oz_pd *oz_pd_alloc(const u8 *mac_addr);
108void oz_pd_destroy(struct oz_pd *pd);
109void oz_pd_get(struct oz_pd *pd);
110void oz_pd_put(struct oz_pd *pd);
111void oz_pd_set_state(struct oz_pd *pd, unsigned state);
112void oz_pd_indicate_farewells(struct oz_pd *pd);
113int oz_pd_sleep(struct oz_pd *pd);
114void oz_pd_stop(struct oz_pd *pd);
115void oz_pd_heartbeat(struct oz_pd *pd, u16 apps);
116int oz_services_start(struct oz_pd *pd, u16 apps, int resume);
117void oz_services_stop(struct oz_pd *pd, u16 apps, int pause);
118int oz_prepare_frame(struct oz_pd *pd, int empty);
119void oz_send_queued_frames(struct oz_pd *pd, int backlog);
120void oz_retire_tx_frames(struct oz_pd *pd, u8 lpn);
121int oz_isoc_stream_create(struct oz_pd *pd, u8 ep_num);
122int oz_isoc_stream_delete(struct oz_pd *pd, u8 ep_num);
123int oz_send_isoc_unit(struct oz_pd *pd, u8 ep_num, const u8 *data, int len);
124void oz_handle_app_elt(struct oz_pd *pd, u8 app_id, struct oz_elt *elt);
125void oz_apps_init(void);
126void oz_apps_term(void);
127
128#endif
129