linux/drivers/net/can/usb/peak_usb/pcan_usb_pro.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * CAN driver for PEAK System PCAN-USB Pro adapter
 * Derived from the PCAN project file driver/src/pcan_usbpro.c
 *
 * Copyright (C) 2003-2011 PEAK System-Technik GmbH
 * Copyright (C) 2011-2012 Stephane Grosjean <[email protected]>
 */
#include <linux/ethtool.h>
#include <linux/module.h>
#include <linux/netdevice.h>
#include <linux/usb.h>

#include <linux/can.h>
#include <linux/can/dev.h>
#include <linux/can/error.h>

#include "pcan_usb_core.h"
#include "pcan_usb_pro.h"

#define PCAN_USBPRO_CHANNEL_COUNT

/* PCAN-USB Pro adapter internal clock (MHz) */
#define PCAN_USBPRO_CRYSTAL_HZ

/* PCAN-USB Pro command timeout (ms.) */
#define PCAN_USBPRO_COMMAND_TIMEOUT

/* PCAN-USB Pro rx/tx buffers size */
#define PCAN_USBPRO_RX_BUFFER_SIZE
#define PCAN_USBPRO_TX_BUFFER_SIZE

#define PCAN_USBPRO_MSG_HEADER_LEN

/* some commands responses need to be re-submitted */
#define PCAN_USBPRO_RSP_SUBMIT_MAX

#define PCAN_USBPRO_RTR
#define PCAN_USBPRO_EXT
#define PCAN_USBPRO_SS

#define PCAN_USBPRO_CMD_BUFFER_SIZE

/* handle device specific info used by the netdevices */
struct pcan_usb_pro_interface {};

/* device information */
struct pcan_usb_pro_device {};

/* internal structure used to handle messages sent to bulk urb */
struct pcan_usb_pro_msg {};

/* records sizes table indexed on message id. (8-bits value) */
static u16 pcan_usb_pro_sizeof_rec[256] =;

/*
 * initialize PCAN-USB Pro message data structure
 */
static u8 *pcan_msg_init(struct pcan_usb_pro_msg *pm, void *buffer_addr,
			 int buffer_size)
{}

static u8 *pcan_msg_init_empty(struct pcan_usb_pro_msg *pm,
			       void *buffer_addr, int buffer_size)
{}

/*
 * add one record to a message being built
 */
static int pcan_msg_add_rec(struct pcan_usb_pro_msg *pm, int id, ...)
{}

/*
 * send PCAN-USB Pro command synchronously
 */
static int pcan_usb_pro_send_cmd(struct peak_usb_device *dev,
				 struct pcan_usb_pro_msg *pum)
{}

/*
 * wait for PCAN-USB Pro command response
 */
static int pcan_usb_pro_wait_rsp(struct peak_usb_device *dev,
				 struct pcan_usb_pro_msg *pum)
{}

int pcan_usb_pro_send_req(struct peak_usb_device *dev, int req_id,
			  int req_value, void *req_addr, int req_size)
{}

static int pcan_usb_pro_set_ts(struct peak_usb_device *dev, u16 onoff)
{}

static int pcan_usb_pro_set_bitrate(struct peak_usb_device *dev, u32 ccbt)
{}

static int pcan_usb_pro_set_bus(struct peak_usb_device *dev, u8 onoff)
{}

static int pcan_usb_pro_set_silent(struct peak_usb_device *dev, u8 onoff)
{}

static int pcan_usb_pro_set_filter(struct peak_usb_device *dev, u16 filter_mode)
{}

static int pcan_usb_pro_set_led(struct peak_usb_device *dev, u8 mode,
				u32 timeout)
{}

static int pcan_usb_pro_get_can_channel_id(struct peak_usb_device *dev,
					   u32 *can_ch_id)
{}

static int pcan_usb_pro_set_can_channel_id(struct peak_usb_device *dev,
					   u32 can_ch_id)
{}

static int pcan_usb_pro_set_bittiming(struct peak_usb_device *dev,
				      struct can_bittiming *bt)
{}

void pcan_usb_pro_restart_complete(struct urb *urb)
{}

/*
 * handle restart but in asynchronously way
 */
static int pcan_usb_pro_restart_async(struct peak_usb_device *dev,
				      struct urb *urb, u8 *buf)
{}

static int pcan_usb_pro_drv_loaded(struct peak_usb_device *dev, int loaded)
{}

static inline
struct pcan_usb_pro_interface *pcan_usb_pro_dev_if(struct peak_usb_device *dev)
{}

static int pcan_usb_pro_handle_canmsg(struct pcan_usb_pro_interface *usb_if,
				      struct pcan_usb_pro_rxmsg *rx)
{}

static int pcan_usb_pro_handle_error(struct pcan_usb_pro_interface *usb_if,
				     struct pcan_usb_pro_rxstatus *er)
{}

static void pcan_usb_pro_handle_ts(struct pcan_usb_pro_interface *usb_if,
				   struct pcan_usb_pro_rxts *ts)
{}

/*
 * callback for bulk IN urb
 */
static int pcan_usb_pro_decode_buf(struct peak_usb_device *dev, struct urb *urb)
{}

static int pcan_usb_pro_encode_msg(struct peak_usb_device *dev,
				   struct sk_buff *skb, u8 *obuf, size_t *size)
{}

static int pcan_usb_pro_start(struct peak_usb_device *dev)
{}

/*
 * stop interface
 * (last chance before set bus off)
 */
static int pcan_usb_pro_stop(struct peak_usb_device *dev)
{}

/*
 * called when probing to initialize a device object.
 */
static int pcan_usb_pro_init(struct peak_usb_device *dev)
{}

static void pcan_usb_pro_exit(struct peak_usb_device *dev)
{}

/*
 * called when PCAN-USB Pro adapter is unplugged
 */
static void pcan_usb_pro_free(struct peak_usb_device *dev)
{}

/*
 * probe function for new PCAN-USB Pro usb interface
 */
int pcan_usb_pro_probe(struct usb_interface *intf)
{}

static int pcan_usb_pro_set_phys_id(struct net_device *netdev,
				    enum ethtool_phys_id_state state)
{}

static const struct ethtool_ops pcan_usb_pro_ethtool_ops =;

/*
 * describe the PCAN-USB Pro adapter
 */
static const struct can_bittiming_const pcan_usb_pro_const =;

const struct peak_usb_adapter pcan_usb_pro =;