Lines Matching full:can
2 * CAN driver for EMS Dr. Thomas Wuensche CPC-USB/ARM7
6 * This program is free software; you can redistribute it and/or modify it
26 #include <linux/can.h>
27 #include <linux/can/dev.h>
28 #include <linux/can/error.h>
31 MODULE_DESCRIPTION("CAN driver for EMS Dr. Thomas Wuensche CAN/USB interfaces");
45 #define CPC_MSG_TYPE_CAN_FRAME 1 /* CAN data frame */
46 #define CPC_MSG_TYPE_RTR_FRAME 8 /* CAN remote frame */
47 #define CPC_MSG_TYPE_CAN_PARAMS 12 /* Actual CAN parameters */
48 #define CPC_MSG_TYPE_CAN_STATE 14 /* CAN state message */
49 #define CPC_MSG_TYPE_EXT_CAN_FRAME 16 /* Extended CAN data frame */
58 #define CPC_CMD_TYPE_CAN_FRAME 1 /* CAN data frame */
60 #define CPC_CMD_TYPE_CAN_PARAMS 6 /* set CAN parameters */
61 #define CPC_CMD_TYPE_RTR_FRAME 13 /* CAN remote frame */
62 #define CPC_CMD_TYPE_CAN_STATE 14 /* CAN state message */
63 #define CPC_CMD_TYPE_EXT_CAN_FRAME 15 /* Extended CAN data frame */
64 #define CPC_CMD_TYPE_EXT_RTR_FRAME 16 /* Extended CAN remote frame */
65 #define CPC_CMD_TYPE_CAN_EXIT 200 /* exit the CAN */
67 #define CPC_CMD_TYPE_INQ_ERR_COUNTER 25 /* request the CAN error counters */
71 #define CPC_CC_TYPE_SJA1000 2 /* Philips basic CAN controller */
81 * If the CAN controller lost a message we indicate it with the highest bit
95 /* Mode register NXP LPC2119/SJA1000 CAN Controller */
99 /* ECC register NXP LPC2119/SJA1000 CAN Controller */
115 * The device actually uses a 16MHz clock to generate the CAN clock
122 * CAN-Message representation in a CPC_MSG. Message object type is
132 /* Representation of the CAN parameters for the SJA1000 controller */
148 /* CAN params message representation */
152 /* Will support M16C CAN controller in the future */
169 /* SJA1000 CAN errors (compatible to NXP LPC2119) */
176 /* structure for CAN error conditions */
192 * the values of the CAN controllers TX and RX error counter.
247 struct can_priv can; /* must be the first member */ member
351 dev->can.state = CAN_STATE_BUS_OFF; in ems_usb_rx_err()
356 dev->can.state = CAN_STATE_ERROR_WARNING; in ems_usb_rx_err()
357 dev->can.can_stats.error_warning++; in ems_usb_rx_err()
359 dev->can.state = CAN_STATE_ERROR_ACTIVE; in ems_usb_rx_err()
360 dev->can.can_stats.error_passive++; in ems_usb_rx_err()
368 dev->can.can_stats.bus_error++; in ems_usb_rx_err()
393 if (dev->can.state == CAN_STATE_ERROR_WARNING || in ems_usb_rx_err()
394 dev->can.state == CAN_STATE_ERROR_PASSIVE) { in ems_usb_rx_err()
454 /* Process CAN state changes */ in ems_usb_read_bulk_callback()
563 * Change CAN controllers' mode register
573 * Send a CPC_Control command to change behaviour when interface receives a CAN
574 * message, bus error or CAN state changed notifications.
670 /* CPC-USB will transfer CAN state changes to host */ in ems_usb_start()
684 dev->can.state = CAN_STATE_ERROR_ACTIVE; in ems_usb_start()
881 /* Set CAN controller to reset mode */ in ems_usb_close()
936 struct can_bittiming *bt = &dev->can.bittiming; in ems_usb_set_bittiming()
942 if (dev->can.ctrlmode & CAN_CTRLMODE_3_SAMPLES) in ems_usb_set_bittiming()
1005 dev->can.state = CAN_STATE_STOPPED; in ems_usb_probe()
1006 dev->can.clock.freq = EMS_USB_ARM7_CLOCK; in ems_usb_probe()
1007 dev->can.bittiming_const = &ems_usb_bittiming_const; in ems_usb_probe()
1008 dev->can.do_set_bittiming = ems_usb_set_bittiming; in ems_usb_probe()
1009 dev->can.do_set_mode = ems_usb_set_mode; in ems_usb_probe()
1010 dev->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES; in ems_usb_probe()
1059 "couldn't register CAN device: %d\n", err); in ems_usb_probe()