1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* CAN driver for PEAK System micro-CAN based adapters
4 * Copyright (C) 2003-2011 PEAK System-Technik GmbH
5 * Copyright (C) 2011-2013 Stephane Grosjean <s.grosjean@peak-system.com>
7 #ifndef PEAK_CANFD_USER_H
8 #define PEAK_CANFD_USER_H
10 #include <linux/can/dev/peak_canfd.h>
12 #define PCANFD_ECHO_SKB_DEF -1
14 /* data structure private to each uCAN interface */
15 struct peak_canfd_priv
{
16 struct can_priv can
; /* socket-can private data */
17 struct net_device
*ndev
; /* network device */
18 int index
; /* channel index */
20 struct can_berr_counter bec
; /* rx/tx err counters */
22 int echo_idx
; /* echo skb free slot index */
29 int (*pre_cmd
)(struct peak_canfd_priv
*priv
);
30 int (*write_cmd
)(struct peak_canfd_priv
*priv
);
31 int (*post_cmd
)(struct peak_canfd_priv
*priv
);
33 int (*enable_tx_path
)(struct peak_canfd_priv
*priv
);
34 void *(*alloc_tx_msg
)(struct peak_canfd_priv
*priv
, u16 msg_size
,
36 int (*write_tx_msg
)(struct peak_canfd_priv
*priv
,
37 struct pucan_tx_msg
*msg
);
40 struct net_device
*alloc_peak_canfd_dev(int sizeof_priv
, int index
,
42 int peak_canfd_handle_msg(struct peak_canfd_priv
*priv
,
43 struct pucan_rx_msg
*msg
);
44 int peak_canfd_handle_msgs_list(struct peak_canfd_priv
*priv
,
45 struct pucan_rx_msg
*rx_msg
, int rx_count
);