1
2
3
4
5
6
7
8 #ifndef PEAK_CANFD_USER_H
9 #define PEAK_CANFD_USER_H
10
11 #include <linux/can/dev/peak_canfd.h>
12
13 #define PCANFD_ECHO_SKB_DEF -1
14
15
16 struct peak_canfd_priv {
17 struct can_priv can;
18 struct net_device *ndev;
19 int index;
20
21 struct can_berr_counter bec;
22
23 int echo_idx;
24 spinlock_t echo_lock;
25
26 int cmd_len;
27 void *cmd_buffer;
28 int cmd_maxlen;
29
30 int (*pre_cmd)(struct peak_canfd_priv *priv);
31 int (*write_cmd)(struct peak_canfd_priv *priv);
32 int (*post_cmd)(struct peak_canfd_priv *priv);
33
34 int (*enable_tx_path)(struct peak_canfd_priv *priv);
35 void *(*alloc_tx_msg)(struct peak_canfd_priv *priv, u16 msg_size,
36 int *room_left);
37 int (*write_tx_msg)(struct peak_canfd_priv *priv,
38 struct pucan_tx_msg *msg);
39 };
40
41 struct net_device *alloc_peak_canfd_dev(int sizeof_priv, int index,
42 int echo_skb_max);
43 int peak_canfd_handle_msg(struct peak_canfd_priv *priv,
44 struct pucan_rx_msg *msg);
45 int peak_canfd_handle_msgs_list(struct peak_canfd_priv *priv,
46 struct pucan_rx_msg *rx_msg, int rx_count);
47 #endif