4 * Definitions for the CAN network device driver interface
8 * Copyright (C) 2006 Andrey Volkov <avolkov@varma-el.com>
11 * Copyright (C) 2008 Wolfgang Grandegger <wg@grandegger.com>
13 * Send feedback to <socketcan-users@lists.berlios.de>
19 #include <linux/version.h>
20 #include <socketcan/can/netlink.h>
21 #include <socketcan/can/error.h>
33 * CAN common private data
35 #define CAN_ECHO_SKB_MAX 4
38 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
39 struct net_device_stats net_stats;
41 struct can_device_stats can_stats;
43 struct can_bittiming bittiming;
44 struct can_bittiming_const *bittiming_const;
45 struct can_clock clock;
51 struct timer_list restart_timer;
53 struct sk_buff *echo_skb[CAN_ECHO_SKB_MAX];
55 int (*do_set_bittiming)(struct net_device *dev);
56 int (*do_set_mode)(struct net_device *dev, enum can_mode mode);
57 int (*do_get_state)(const struct net_device *dev,
58 enum can_state *state);
61 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)
62 #define ND2D(_ndev) (_ndev->class_dev.dev)
64 #define ND2D(_ndev) (_ndev->dev.parent)
67 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)
68 #define IFF_ECHO IFF_LOOPBACK
71 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
72 struct net_device_stats *can_get_stats(struct net_device *dev);
75 struct net_device *alloc_candev(int sizeof_priv);
76 void free_candev(struct net_device *dev);
78 int open_candev(struct net_device *dev);
79 void close_candev(struct net_device *dev);
81 int register_candev(struct net_device *dev);
82 void unregister_candev(struct net_device *dev);
84 int can_restart_now(struct net_device *dev);
85 void can_bus_off(struct net_device *dev);
87 void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, int idx);
88 void can_get_echo_skb(struct net_device *dev, int idx);
89 void can_free_echo_skb(struct net_device *dev, int idx);
91 #endif /* CAN_DEV_H */