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
36 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
37 struct net_device_stats net_stats;
39 struct can_device_stats can_stats;
41 struct can_bittiming bittiming;
42 struct can_bittiming_const *bittiming_const;
43 struct can_clock clock;
49 struct timer_list restart_timer;
51 int (*do_set_bittiming)(struct net_device *dev);
52 int (*do_set_mode)(struct net_device *dev, enum can_mode mode);
53 int (*do_get_state)(const struct net_device *dev,
54 enum can_state *state);
56 unsigned int echo_skb_max;
57 struct sk_buff **echo_skb;
60 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)
61 #define ND2D(_ndev) (_ndev->class_dev.dev)
63 #define ND2D(_ndev) (_ndev->dev.parent)
66 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)
67 #define IFF_ECHO IFF_LOOPBACK
70 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
71 struct net_device_stats *can_get_stats(struct net_device *dev);
74 struct net_device *alloc_candev(int sizeof_priv, unsigned int echo_skb_max);
75 void free_candev(struct net_device *dev);
77 int open_candev(struct net_device *dev);
78 void close_candev(struct net_device *dev);
80 int register_candev(struct net_device *dev);
81 void unregister_candev(struct net_device *dev);
83 int can_restart_now(struct net_device *dev);
84 void can_bus_off(struct net_device *dev);
86 void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev,
88 void can_get_echo_skb(struct net_device *dev, unsigned int idx);
89 void can_free_echo_skb(struct net_device *dev, unsigned int idx);
91 #endif /* CAN_DEV_H */