[go: nahoru, domu]

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 */
32struct oz_app_if {
33	int  (*init)(void);
34	void (*term)(void);
35	int  (*start)(struct oz_pd *pd, int resume);
36	void (*stop)(struct oz_pd *pd, int pause);
37	void (*rx)(struct oz_pd *pd, struct oz_elt *elt);
38	int  (*heartbeat)(struct oz_pd *pd);
39	void (*farewell)(struct oz_pd *pd, u8 ep_num, u8 *data, u8 len);
40};
41
42int oz_protocol_init(char *devs);
43void oz_protocol_term(void);
44int oz_get_pd_list(struct oz_mac_addr *addr, int max_count);
45void oz_app_enable(int app_id, int enable);
46struct oz_pd *oz_pd_find(const u8 *mac_addr);
47void oz_binding_add(const char *net_dev);
48void oz_binding_remove(const char *net_dev);
49void oz_timer_add(struct oz_pd *pd, int type, unsigned long due_time);
50void oz_timer_delete(struct oz_pd *pd, int type);
51void oz_pd_request_heartbeat(struct oz_pd *pd);
52void oz_pd_heartbeat_handler(unsigned long data);
53void oz_pd_timeout_handler(unsigned long data);
54enum hrtimer_restart oz_pd_heartbeat_event(struct hrtimer *timer);
55enum hrtimer_restart oz_pd_timeout_event(struct hrtimer *timer);
56int oz_get_pd_status_list(char *pd_list, int max_count);
57int oz_get_binding_list(char *buf, int max_if);
58
59extern struct kmem_cache *oz_elt_info_cache;
60extern struct kmem_cache *oz_tx_frame_cache;
61
62#endif /* _OZPROTO_H */
63