dev.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * linux/can/dev.h
  3. *
  4. * Definitions for the CAN network device driver interface
  5. *
  6. * Copyright (C) 2006 Andrey Volkov <avolkov@varma-el.com>
  7. * Varma Electronics Oy
  8. *
  9. * Copyright (C) 2008 Wolfgang Grandegger <wg@grandegger.com>
  10. *
  11. * Send feedback to <socketcan-users@lists.berlios.de>
  12. */
  13. #ifndef CAN_DEV_H
  14. #define CAN_DEV_H
  15. #include <linux/can/netlink.h>
  16. #include <linux/can/error.h>
  17. /*
  18. * CAN mode
  19. */
  20. enum can_mode {
  21. CAN_MODE_STOP = 0,
  22. CAN_MODE_START,
  23. CAN_MODE_SLEEP
  24. };
  25. /*
  26. * CAN common private data
  27. */
  28. struct can_priv {
  29. struct can_device_stats can_stats;
  30. struct can_bittiming bittiming;
  31. struct can_bittiming_const *bittiming_const;
  32. struct can_clock clock;
  33. enum can_state state;
  34. u32 ctrlmode;
  35. int restart_ms;
  36. struct timer_list restart_timer;
  37. int (*do_set_bittiming)(struct net_device *dev);
  38. int (*do_set_mode)(struct net_device *dev, enum can_mode mode);
  39. int (*do_get_state)(const struct net_device *dev,
  40. enum can_state *state);
  41. unsigned int echo_skb_max;
  42. struct sk_buff **echo_skb;
  43. };
  44. struct net_device *alloc_candev(int sizeof_priv, unsigned int echo_skb_max);
  45. void free_candev(struct net_device *dev);
  46. int open_candev(struct net_device *dev);
  47. void close_candev(struct net_device *dev);
  48. int register_candev(struct net_device *dev);
  49. void unregister_candev(struct net_device *dev);
  50. int can_restart_now(struct net_device *dev);
  51. void can_bus_off(struct net_device *dev);
  52. void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev,
  53. unsigned int idx);
  54. void can_get_echo_skb(struct net_device *dev, unsigned int idx);
  55. void can_free_echo_skb(struct net_device *dev, unsigned int idx);
  56. #endif /* CAN_DEV_H */