1 /* -----------------------------------------------------------------------------
2 * Copyright (c) 2011 Ozmo Inc
3 * Released under the GNU General Public License Version 2 (GPLv2).
4 * -----------------------------------------------------------------------------
9 #include <asm/byteorder.h>
13 #define OZ_ALLOCATED_SPACE(__x) (LL_RESERVED_SPACE(__x)+(__x)->needed_tailroom)
15 /* Converts millisecs to jiffies.
17 #define oz_ms_to_jiffies(__x) msecs_to_jiffies(__x)
19 /* Quantum milliseconds.
21 #define OZ_QUANTUM_MS 8
24 #define OZ_QUANTUM_J (oz_ms_to_jiffies(OZ_QUANTUM_MS))
27 #define OZ_CONNECTION_TOUT_J (2*HZ)
28 #define OZ_PRESLEEP_TOUT_J (11*HZ)
30 /* Maximun sizes of tx frames. */
31 #define OZ_MAX_TX_SIZE 1514
33 /* Maximum number of uncompleted isoc frames that can be pending in network. */
34 #define OZ_MAX_SUBMITTED_ISOC 16
36 /* Maximum number of uncompleted isoc frames that can be pending in Tx Queue. */
37 #define OZ_MAX_TX_QUEUE_ISOC 32
39 /* Application handler functions.
41 typedef int (*oz_app_init_fn_t
)(void);
42 typedef void (*oz_app_term_fn_t
)(void);
43 typedef int (*oz_app_start_fn_t
)(struct oz_pd
*pd
, int resume
);
44 typedef void (*oz_app_stop_fn_t
)(struct oz_pd
*pd
, int pause
);
45 typedef void (*oz_app_rx_fn_t
)(struct oz_pd
*pd
, struct oz_elt
*elt
);
46 typedef int (*oz_app_hearbeat_fn_t
)(struct oz_pd
*pd
);
47 typedef void (*oz_app_farewell_fn_t
)(struct oz_pd
*pd
, u8 ep_num
,
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
;
56 oz_app_hearbeat_fn_t heartbeat
;
57 oz_app_farewell_fn_t farewell
;
61 int oz_protocol_init(char *devs
);
62 void oz_protocol_term(void);
63 int oz_get_pd_list(struct oz_mac_addr
*addr
, int max_count
);
64 void oz_app_enable(int app_id
, int enable
);
65 struct oz_pd
*oz_pd_find(const u8
*mac_addr
);
66 void oz_binding_add(char *net_dev
);
67 void oz_binding_remove(char *net_dev
);
68 void oz_timer_add(struct oz_pd
*pd
, int type
, unsigned long due_time
,
70 void oz_timer_delete(struct oz_pd
*pd
, int type
);
71 void oz_pd_request_heartbeat(struct oz_pd
*pd
);
72 void oz_polling_lock_bh(void);
73 void oz_polling_unlock_bh(void);
75 #endif /* _OZPROTO_H */