Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /* CAN driver for PEAK System micro-CAN based adapters
0003  *
0004  * Copyright (C) 2003-2011 PEAK System-Technik GmbH
0005  * Copyright (C) 2011-2013 Stephane Grosjean <s.grosjean@peak-system.com>
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 /* data structure private to each uCAN interface */
0015 struct peak_canfd_priv {
0016     struct can_priv can;        /* socket-can private data */
0017     struct net_device *ndev;    /* network device */
0018     int index;          /* channel index */
0019 
0020     struct can_berr_counter bec;    /* rx/tx err counters */
0021 
0022     int echo_idx;           /* echo skb free slot index */
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