Linux Audio

Check our new training course

Loading...
v6.8
 1/* SPDX-License-Identifier: GPL-2.0-only */
 2/* CAN driver for PEAK System micro-CAN based adapters
 3 *
 4 * Copyright (C) 2003-2011 PEAK System-Technik GmbH
 5 * Copyright (C) 2011-2013 Stephane Grosjean <s.grosjean@peak-system.com>
 
 
 
 
 
 
 
 
 
 6 */
 7#ifndef PEAK_CANFD_USER_H
 8#define PEAK_CANFD_USER_H
 9
10#include <linux/can/dev/peak_canfd.h>
11
12#define PCANFD_ECHO_SKB_DEF		-1
13
14/* data structure private to each uCAN interface */
15struct peak_canfd_priv {
16	struct can_priv can;		/* socket-can private data */
17	struct net_device *ndev;	/* network device */
18	int index;			/* channel index */
19
20	struct can_berr_counter bec;	/* rx/tx err counters */
21
22	int echo_idx;			/* echo skb free slot index */
23	spinlock_t echo_lock;
24
25	int cmd_len;
26	void *cmd_buffer;
27	int cmd_maxlen;
28
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);
32
33	int (*enable_tx_path)(struct peak_canfd_priv *priv);
34	void *(*alloc_tx_msg)(struct peak_canfd_priv *priv, u16 msg_size,
35			      int *room_left);
36	int (*write_tx_msg)(struct peak_canfd_priv *priv,
37			    struct pucan_tx_msg *msg);
38};
39
40struct net_device *alloc_peak_canfd_dev(int sizeof_priv, int index,
41					int echo_skb_max);
42int peak_canfd_handle_msg(struct peak_canfd_priv *priv,
43			  struct pucan_rx_msg *msg);
44int peak_canfd_handle_msgs_list(struct peak_canfd_priv *priv,
45				struct pucan_rx_msg *rx_msg, int rx_count);
46#endif
v4.17
 1/*
 2 * CAN driver for PEAK System micro-CAN based adapters
 3 *
 4 * Copyright (C) 2003-2011 PEAK System-Technik GmbH
 5 * Copyright (C) 2011-2013 Stephane Grosjean <s.grosjean@peak-system.com>
 6 *
 7 * This program is free software; you can redistribute it and/or modify it
 8 * under the terms of the GNU General Public License as published
 9 * by the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 */
16#ifndef PEAK_CANFD_USER_H
17#define PEAK_CANFD_USER_H
18
19#include <linux/can/dev/peak_canfd.h>
20
21#define PCANFD_ECHO_SKB_DEF		-1
22
23/* data structure private to each uCAN interface */
24struct peak_canfd_priv {
25	struct can_priv can;		/* socket-can private data */
26	struct net_device *ndev;	/* network device */
27	int index;			/* channel index */
28
29	struct can_berr_counter bec;	/* rx/tx err counters */
30
31	int echo_idx;			/* echo skb free slot index */
32	spinlock_t echo_lock;
33
34	int cmd_len;
35	void *cmd_buffer;
36	int cmd_maxlen;
37
38	int (*pre_cmd)(struct peak_canfd_priv *priv);
39	int (*write_cmd)(struct peak_canfd_priv *priv);
40	int (*post_cmd)(struct peak_canfd_priv *priv);
41
42	int (*enable_tx_path)(struct peak_canfd_priv *priv);
43	void *(*alloc_tx_msg)(struct peak_canfd_priv *priv, u16 msg_size,
44			      int *room_left);
45	int (*write_tx_msg)(struct peak_canfd_priv *priv,
46			    struct pucan_tx_msg *msg);
47};
48
49struct net_device *alloc_peak_canfd_dev(int sizeof_priv, int index,
50					int echo_skb_max);
51int peak_canfd_handle_msg(struct peak_canfd_priv *priv,
52			  struct pucan_rx_msg *msg);
53int peak_canfd_handle_msgs_list(struct peak_canfd_priv *priv,
54				struct pucan_rx_msg *rx_msg, int rx_count);
55#endif