#include <linux/completion.h>
#include <linux/device.h>
#include <linux/gfp.h>
#include <linux/jiffies.h>
#include <linux/kernel.h>
#include <linux/netdevice.h>
#include <linux/spinlock.h>
#include <linux/string.h>
#include <linux/types.h>
#include <linux/units.h>
#include <linux/usb.h>
#include <linux/workqueue.h>
#include <linux/can.h>
#include <linux/can/dev.h>
#include <linux/can/error.h>
#include <linux/can/netlink.h>
#include "kvaser_usb.h"
#define MAX_USBCAN_NET_DEVICES …
#define CMD_HEADER_LEN …
#define MSG_FLAG_ERROR_FRAME …
#define MSG_FLAG_OVERRUN …
#define MSG_FLAG_NERR …
#define MSG_FLAG_WAKEUP …
#define MSG_FLAG_REMOTE_FRAME …
#define MSG_FLAG_RESERVED …
#define MSG_FLAG_TX_ACK …
#define MSG_FLAG_TX_REQUEST …
#define M16C_STATE_BUS_RESET …
#define M16C_STATE_BUS_ERROR …
#define M16C_STATE_BUS_PASSIVE …
#define M16C_STATE_BUS_OFF …
#define CMD_RX_STD_MESSAGE …
#define CMD_TX_STD_MESSAGE …
#define CMD_RX_EXT_MESSAGE …
#define CMD_TX_EXT_MESSAGE …
#define CMD_SET_BUS_PARAMS …
#define CMD_GET_BUS_PARAMS …
#define CMD_GET_BUS_PARAMS_REPLY …
#define CMD_GET_CHIP_STATE …
#define CMD_CHIP_STATE_EVENT …
#define CMD_SET_CTRL_MODE …
#define CMD_RESET_CHIP …
#define CMD_START_CHIP …
#define CMD_START_CHIP_REPLY …
#define CMD_STOP_CHIP …
#define CMD_STOP_CHIP_REPLY …
#define CMD_USBCAN_CLOCK_OVERFLOW_EVENT …
#define CMD_GET_CARD_INFO …
#define CMD_GET_CARD_INFO_REPLY …
#define CMD_GET_SOFTWARE_INFO …
#define CMD_GET_SOFTWARE_INFO_REPLY …
#define CMD_ERROR_EVENT …
#define CMD_FLUSH_QUEUE …
#define CMD_TX_ACKNOWLEDGE …
#define CMD_CAN_ERROR_EVENT …
#define CMD_FLUSH_QUEUE_REPLY …
#define CMD_GET_CAPABILITIES_REQ …
#define CMD_GET_CAPABILITIES_RESP …
#define CMD_LEAF_LOG_MESSAGE …
#define KVASER_USB_LEAF_SWOPTION_FREQ_MASK …
#define KVASER_USB_LEAF_SWOPTION_FREQ_16_MHZ_CLK …
#define KVASER_USB_LEAF_SWOPTION_FREQ_32_MHZ_CLK …
#define KVASER_USB_LEAF_SWOPTION_FREQ_24_MHZ_CLK …
#define KVASER_USB_LEAF_SWOPTION_EXT_CAP …
#define M16C_EF_ACKE …
#define M16C_EF_CRCE …
#define M16C_EF_FORME …
#define M16C_EF_STFE …
#define M16C_EF_BITE0 …
#define M16C_EF_BITE1 …
#define M16C_EF_RCVE …
#define M16C_EF_TRE …
#define USBCAN_ERROR_STATE_NONE …
#define USBCAN_ERROR_STATE_TX_ERROR …
#define USBCAN_ERROR_STATE_RX_ERROR …
#define USBCAN_ERROR_STATE_BUSERROR …
#define KVASER_CTRL_MODE_NORMAL …
#define KVASER_CTRL_MODE_SILENT …
#define KVASER_CTRL_MODE_SELFRECEPTION …
#define KVASER_CTRL_MODE_OFF …
#define KVASER_EXTENDED_FRAME …
struct kvaser_cmd_simple { … } __packed;
struct kvaser_cmd_cardinfo { … } __packed;
struct leaf_cmd_softinfo { … } __packed;
struct usbcan_cmd_softinfo { … } __packed;
struct kvaser_cmd_busparams { … } __packed;
struct kvaser_cmd_tx_can { … } __packed;
struct kvaser_cmd_rx_can_header { … } __packed;
struct leaf_cmd_rx_can { … } __packed;
struct usbcan_cmd_rx_can { … } __packed;
struct leaf_cmd_chip_state_event { … } __packed;
struct usbcan_cmd_chip_state_event { … } __packed;
struct kvaser_cmd_tx_acknowledge_header { … } __packed;
struct leaf_cmd_can_error_event { … } __packed;
struct usbcan_cmd_can_error_event { … } __packed;
#define KVASER_USB_LEAF_ERROR_EVENT_TX_QUEUE_FULL …
#define KVASER_USB_LEAF_ERROR_EVENT_PARAM …
struct leaf_cmd_error_event { … } __packed;
struct usbcan_cmd_error_event { … } __packed;
struct kvaser_cmd_ctrl_mode { … } __packed;
struct kvaser_cmd_flush_queue { … } __packed;
struct leaf_cmd_log_message { … } __packed;
#define KVASER_USB_LEAF_CAP_CMD_LISTEN_MODE …
#define KVASER_USB_LEAF_CAP_CMD_ERR_REPORT …
struct kvaser_cmd_cap_req { … } __packed;
#define KVASER_USB_LEAF_CAP_STAT_OK …
#define KVASER_USB_LEAF_CAP_STAT_NOT_IMPL …
#define KVASER_USB_LEAF_CAP_STAT_UNAVAIL …
struct kvaser_cmd_cap_res { … } __packed;
struct kvaser_cmd { … } __packed;
#define CMD_SIZE_ANY …
#define kvaser_fsize(field) …
static const u8 kvaser_usb_leaf_cmd_sizes_leaf[] = …;
static const u8 kvaser_usb_leaf_cmd_sizes_usbcan[] = …;
struct kvaser_usb_err_summary { … };
struct kvaser_usb_net_leaf_priv { … };
static const struct can_bittiming_const kvaser_usb_leaf_m16c_bittiming_const = …;
static const struct can_bittiming_const kvaser_usb_leaf_m32c_bittiming_const = …;
static const struct kvaser_usb_dev_cfg kvaser_usb_leaf_usbcan_dev_cfg = …;
static const struct kvaser_usb_dev_cfg kvaser_usb_leaf_m32c_dev_cfg = …;
static const struct kvaser_usb_dev_cfg kvaser_usb_leaf_imx_dev_cfg_16mhz = …;
static const struct kvaser_usb_dev_cfg kvaser_usb_leaf_imx_dev_cfg_24mhz = …;
static const struct kvaser_usb_dev_cfg kvaser_usb_leaf_imx_dev_cfg_32mhz = …;
static int kvaser_usb_leaf_verify_size(const struct kvaser_usb *dev,
const struct kvaser_cmd *cmd)
{ … }
static void *
kvaser_usb_leaf_frame_to_cmd(const struct kvaser_usb_net_priv *priv,
const struct sk_buff *skb, int *cmd_len,
u16 transid)
{ … }
static int kvaser_usb_leaf_wait_cmd(const struct kvaser_usb *dev, u8 id,
struct kvaser_cmd *cmd)
{ … }
static int kvaser_usb_leaf_send_simple_cmd(const struct kvaser_usb *dev,
u8 cmd_id, int channel)
{ … }
static void kvaser_usb_leaf_get_software_info_leaf(struct kvaser_usb *dev,
const struct leaf_cmd_softinfo *softinfo)
{ … }
static int kvaser_usb_leaf_get_software_info_inner(struct kvaser_usb *dev)
{ … }
static int kvaser_usb_leaf_get_software_info(struct kvaser_usb *dev)
{ … }
static int kvaser_usb_leaf_get_card_info(struct kvaser_usb *dev)
{ … }
static int kvaser_usb_leaf_get_single_capability(struct kvaser_usb *dev,
u16 cap_cmd_req, u16 *status)
{ … }
static int kvaser_usb_leaf_get_capabilities_leaf(struct kvaser_usb *dev)
{ … }
static int kvaser_usb_leaf_get_capabilities(struct kvaser_usb *dev)
{ … }
static void kvaser_usb_leaf_tx_acknowledge(const struct kvaser_usb *dev,
const struct kvaser_cmd *cmd)
{ … }
static int kvaser_usb_leaf_simple_cmd_async(struct kvaser_usb_net_priv *priv,
u8 cmd_id)
{ … }
static void kvaser_usb_leaf_chip_state_req_work(struct work_struct *work)
{ … }
static void
kvaser_usb_leaf_rx_error_update_can_state(struct kvaser_usb_net_priv *priv,
const struct kvaser_usb_err_summary *es,
struct can_frame *cf)
{ … }
static void kvaser_usb_leaf_rx_error(const struct kvaser_usb *dev,
const struct kvaser_usb_err_summary *es)
{ … }
static void
kvaser_usb_leaf_usbcan_conditionally_rx_error(const struct kvaser_usb *dev,
struct kvaser_usb_err_summary *es)
{ … }
static void kvaser_usb_leaf_usbcan_rx_error(const struct kvaser_usb *dev,
const struct kvaser_cmd *cmd)
{ … }
static void kvaser_usb_leaf_leaf_rx_error(const struct kvaser_usb *dev,
const struct kvaser_cmd *cmd)
{ … }
static void kvaser_usb_leaf_rx_can_err(const struct kvaser_usb_net_priv *priv,
const struct kvaser_cmd *cmd)
{ … }
static void kvaser_usb_leaf_rx_can_msg(const struct kvaser_usb *dev,
const struct kvaser_cmd *cmd)
{ … }
static void kvaser_usb_leaf_error_event_parameter(const struct kvaser_usb *dev,
const struct kvaser_cmd *cmd)
{ … }
static void kvaser_usb_leaf_error_event(const struct kvaser_usb *dev,
const struct kvaser_cmd *cmd)
{ … }
static void kvaser_usb_leaf_start_chip_reply(const struct kvaser_usb *dev,
const struct kvaser_cmd *cmd)
{ … }
static void kvaser_usb_leaf_stop_chip_reply(const struct kvaser_usb *dev,
const struct kvaser_cmd *cmd)
{ … }
static void kvaser_usb_leaf_get_busparams_reply(const struct kvaser_usb *dev,
const struct kvaser_cmd *cmd)
{ … }
static void kvaser_usb_leaf_handle_command(const struct kvaser_usb *dev,
const struct kvaser_cmd *cmd)
{ … }
static void kvaser_usb_leaf_read_bulk_callback(struct kvaser_usb *dev,
void *buf, int len)
{ … }
static int kvaser_usb_leaf_set_opt_mode(const struct kvaser_usb_net_priv *priv)
{ … }
static int kvaser_usb_leaf_start_chip(struct kvaser_usb_net_priv *priv)
{ … }
static int kvaser_usb_leaf_stop_chip(struct kvaser_usb_net_priv *priv)
{ … }
static int kvaser_usb_leaf_reset_chip(struct kvaser_usb *dev, int channel)
{ … }
static int kvaser_usb_leaf_flush_queue(struct kvaser_usb_net_priv *priv)
{ … }
static int kvaser_usb_leaf_init_card(struct kvaser_usb *dev)
{ … }
static int kvaser_usb_leaf_init_channel(struct kvaser_usb_net_priv *priv)
{ … }
static void kvaser_usb_leaf_remove_channel(struct kvaser_usb_net_priv *priv)
{ … }
static int kvaser_usb_leaf_set_bittiming(const struct net_device *netdev,
const struct kvaser_usb_busparams *busparams)
{ … }
static int kvaser_usb_leaf_get_busparams(struct kvaser_usb_net_priv *priv)
{ … }
static int kvaser_usb_leaf_set_mode(struct net_device *netdev,
enum can_mode mode)
{ … }
static int kvaser_usb_leaf_get_berr_counter(const struct net_device *netdev,
struct can_berr_counter *bec)
{ … }
static int kvaser_usb_leaf_setup_endpoints(struct kvaser_usb *dev)
{ … }
const struct kvaser_usb_dev_ops kvaser_usb_leaf_dev_ops = …;