ozproto.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. #include <asm/byteorder.h>
  9. #include "ozdbg.h"
  10. #include "ozappif.h"
  11. #define OZ_ALLOCATED_SPACE(__x) (LL_RESERVED_SPACE(__x)+(__x)->needed_tailroom)
  12. /* Quantum in MS */
  13. #define OZ_QUANTUM 8
  14. /* Default timeouts.
  15. */
  16. #define OZ_PRESLEEP_TOUT 11
  17. /* Maximun sizes of tx frames. */
  18. #define OZ_MAX_TX_SIZE 760
  19. /* Maximum number of uncompleted isoc frames that can be pending in network. */
  20. #define OZ_MAX_SUBMITTED_ISOC 16
  21. /* Maximum number of uncompleted isoc frames that can be pending in Tx Queue. */
  22. #define OZ_MAX_TX_QUEUE_ISOC 32
  23. /* Application handler functions.
  24. */
  25. struct oz_app_if {
  26. int (*init)(void);
  27. void (*term)(void);
  28. int (*start)(struct oz_pd *pd, int resume);
  29. void (*stop)(struct oz_pd *pd, int pause);
  30. void (*rx)(struct oz_pd *pd, struct oz_elt *elt);
  31. int (*heartbeat)(struct oz_pd *pd);
  32. void (*farewell)(struct oz_pd *pd, u8 ep_num, u8 *data, u8 len);
  33. };
  34. int oz_protocol_init(char *devs);
  35. void oz_protocol_term(void);
  36. int oz_get_pd_list(struct oz_mac_addr *addr, int max_count);
  37. void oz_app_enable(int app_id, int enable);
  38. struct oz_pd *oz_pd_find(const u8 *mac_addr);
  39. void oz_binding_add(const char *net_dev);
  40. void oz_binding_remove(const char *net_dev);
  41. void oz_timer_add(struct oz_pd *pd, int type, unsigned long due_time);
  42. void oz_timer_delete(struct oz_pd *pd, int type);
  43. void oz_pd_request_heartbeat(struct oz_pd *pd);
  44. void oz_pd_heartbeat_handler(unsigned long data);
  45. void oz_pd_timeout_handler(unsigned long data);
  46. enum hrtimer_restart oz_pd_heartbeat_event(struct hrtimer *timer);
  47. enum hrtimer_restart oz_pd_timeout_event(struct hrtimer *timer);
  48. int oz_get_pd_status_list(char *pd_list, int max_count);
  49. int oz_get_binding_list(char *buf, int max_if);
  50. extern struct kmem_cache *oz_elt_info_cache;
  51. extern struct kmem_cache *oz_tx_frame_cache;
  52. #endif /* _OZPROTO_H */