0001
0002
0003
0004
0005
0006
0007 #ifndef PEAK_CANFD_USER_H
0008 #define PEAK_CANFD_USER_H
0009
0010 #include <linux/can/dev/peak_canfd.h>
0011
0012 #define PCANFD_ECHO_SKB_DEF -1
0013
0014
0015 struct peak_canfd_priv {
0016 struct can_priv can;
0017 struct net_device *ndev;
0018 int index;
0019
0020 struct can_berr_counter bec;
0021
0022 int echo_idx;
0023 spinlock_t echo_lock;
0024
0025 int cmd_len;
0026 void *cmd_buffer;
0027 int cmd_maxlen;
0028
0029 int (*pre_cmd)(struct peak_canfd_priv *priv);
0030 int (*write_cmd)(struct peak_canfd_priv *priv);
0031 int (*post_cmd)(struct peak_canfd_priv *priv);
0032
0033 int (*enable_tx_path)(struct peak_canfd_priv *priv);
0034 void *(*alloc_tx_msg)(struct peak_canfd_priv *priv, u16 msg_size,
0035 int *room_left);
0036 int (*write_tx_msg)(struct peak_canfd_priv *priv,
0037 struct pucan_tx_msg *msg);
0038 };
0039
0040 struct net_device *alloc_peak_canfd_dev(int sizeof_priv, int index,
0041 int echo_skb_max);
0042 int peak_canfd_handle_msg(struct peak_canfd_priv *priv,
0043 struct pucan_rx_msg *msg);
0044 int peak_canfd_handle_msgs_list(struct peak_canfd_priv *priv,
0045 struct pucan_rx_msg *rx_msg, int rx_count);
0046 #endif