f1d30c467e802a8106a682e473fa29052bd9b1cf
[pandora-kernel.git] / drivers / staging / ozwpan / ozproto.h
1 /* -----------------------------------------------------------------------------
2  * Copyright (c) 2011 Ozmo Inc
3  * Released under the GNU General Public License Version 2 (GPLv2).
4  * -----------------------------------------------------------------------------
5  */
6 #ifndef _OZPROTO_H
7 #define _OZPROTO_H
8
9 #include <asm/byteorder.h>
10 #include "ozdbg.h"
11 #include "ozappif.h"
12
13 #define OZ_ALLOCATED_SPACE(__x) (LL_RESERVED_SPACE(__x)+(__x)->needed_tailroom)
14
15 /* Quantum in MS */
16 #define OZ_QUANTUM              8
17 /* Default timeouts.
18  */
19 #define OZ_PRESLEEP_TOUT        11
20
21 /* Maximun sizes of tx frames. */
22 #define OZ_MAX_TX_SIZE          760
23
24 /* Maximum number of uncompleted isoc frames that can be pending in network. */
25 #define OZ_MAX_SUBMITTED_ISOC   16
26
27 /* Maximum number of uncompleted isoc frames that can be pending in Tx Queue. */
28 #define OZ_MAX_TX_QUEUE_ISOC    32
29
30 /* Application handler functions.
31  */
32 typedef int (*oz_app_init_fn_t)(void);
33 typedef void (*oz_app_term_fn_t)(void);
34 typedef int (*oz_app_start_fn_t)(struct oz_pd *pd, int resume);
35 typedef void (*oz_app_stop_fn_t)(struct oz_pd *pd, int pause);
36 typedef void (*oz_app_rx_fn_t)(struct oz_pd *pd, struct oz_elt *elt);
37 typedef int (*oz_app_heartbeat_fn_t)(struct oz_pd *pd);
38 typedef void (*oz_app_farewell_fn_t)(struct oz_pd *pd, u8 ep_num,
39                         u8 *data, u8 len);
40
41 struct oz_app_if {
42         oz_app_init_fn_t        init;
43         oz_app_term_fn_t        term;
44         oz_app_start_fn_t       start;
45         oz_app_stop_fn_t        stop;
46         oz_app_rx_fn_t          rx;
47         oz_app_heartbeat_fn_t   heartbeat;
48         oz_app_farewell_fn_t    farewell;
49 };
50
51 int oz_protocol_init(char *devs);
52 void oz_protocol_term(void);
53 int oz_get_pd_list(struct oz_mac_addr *addr, int max_count);
54 void oz_app_enable(int app_id, int enable);
55 struct oz_pd *oz_pd_find(const u8 *mac_addr);
56 void oz_binding_add(const char *net_dev);
57 void oz_binding_remove(const char *net_dev);
58 void oz_timer_add(struct oz_pd *pd, int type, unsigned long due_time);
59 void oz_timer_delete(struct oz_pd *pd, int type);
60 void oz_pd_request_heartbeat(struct oz_pd *pd);
61 void oz_pd_heartbeat_handler(unsigned long data);
62 void oz_pd_timeout_handler(unsigned long data);
63 enum hrtimer_restart oz_pd_heartbeat_event(struct hrtimer *timer);
64 enum hrtimer_restart oz_pd_timeout_event(struct hrtimer *timer);
65 int oz_get_pd_status_list(char *pd_list, int max_count);
66 int oz_get_binding_list(char *buf, int max_if);
67
68 #endif /* _OZPROTO_H */