Merge branch 'next/soc2' into HEAD
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / staging / ozwpan / ozproto.h
CommitLineData
1619cb6f
CK
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 "ozconfig.h"
11#include "ozappif.h"
12
13#define OZ_ALLOCATED_SPACE(__x) (LL_RESERVED_SPACE(__x)+(__x)->needed_tailroom)
14
15/* Converts millisecs to jiffies.
16 */
24168911 17#define oz_ms_to_jiffies(__x) msecs_to_jiffies(__x)
1619cb6f
CK
18
19/* Quantum milliseconds.
20 */
21#define OZ_QUANTUM_MS 8
22/* Quantum jiffies
23 */
24#define OZ_QUANTUM_J (oz_ms_to_jiffies(OZ_QUANTUM_MS))
25/* Default timeouts.
26 */
27#define OZ_CONNECTION_TOUT_J (2*HZ)
28#define OZ_PRESLEEP_TOUT_J (11*HZ)
29
30/* Maximun sizes of tx frames. */
31#define OZ_MAX_TX_SIZE 1514
32
86d03a0f
RG
33/* Maximum number of uncompleted isoc frames that can be pending in network. */
34#define OZ_MAX_SUBMITTED_ISOC 16
35
36/* Maximum number of uncompleted isoc frames that can be pending in Tx Queue. */
37#define OZ_MAX_TX_QUEUE_ISOC 32
38
1619cb6f
CK
39/* Application handler functions.
40 */
41typedef int (*oz_app_init_fn_t)(void);
42typedef void (*oz_app_term_fn_t)(void);
43typedef int (*oz_app_start_fn_t)(struct oz_pd *pd, int resume);
44typedef void (*oz_app_stop_fn_t)(struct oz_pd *pd, int pause);
45typedef void (*oz_app_rx_fn_t)(struct oz_pd *pd, struct oz_elt *elt);
46typedef int (*oz_app_hearbeat_fn_t)(struct oz_pd *pd);
47typedef void (*oz_app_farewell_fn_t)(struct oz_pd *pd, u8 ep_num,
48 u8 *data, u8 len);
49
50struct oz_app_if {
51 oz_app_init_fn_t init;
52 oz_app_term_fn_t term;
53 oz_app_start_fn_t start;
54 oz_app_stop_fn_t stop;
55 oz_app_rx_fn_t rx;
56 oz_app_hearbeat_fn_t heartbeat;
57 oz_app_farewell_fn_t farewell;
58 int app_id;
59};
60
61int oz_protocol_init(char *devs);
62void oz_protocol_term(void);
63int oz_get_pd_list(struct oz_mac_addr *addr, int max_count);
64void oz_app_enable(int app_id, int enable);
65struct oz_pd *oz_pd_find(u8 *mac_addr);
66void oz_binding_add(char *net_dev);
67void oz_binding_remove(char *net_dev);
68void oz_timer_add(struct oz_pd *pd, int type, unsigned long due_time,
69 int remove);
70void oz_timer_delete(struct oz_pd *pd, int type);
71void oz_pd_request_heartbeat(struct oz_pd *pd);
72void oz_polling_lock_bh(void);
73void oz_polling_unlock_bh(void);
74
75#endif /* _OZPROTO_H */