Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
ems_usb.c File Reference
#include <linux/init.h>
#include <linux/signal.h>
#include <linux/slab.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>

Go to the source code of this file.

Data Structures

struct  cpc_can_msg
 
struct  cpc_sja1000_params
 
struct  cpc_can_params
 
struct  cpc_confirm
 
struct  cpc_overrun
 
struct  cpc_sja1000_can_error
 
struct  cpc_can_error
 
struct  cpc_can_err_counter
 
struct  ems_cpc_msg
 
struct  ems_tx_urb_context
 
struct  ems_usb
 

Macros

#define CONTR_CAN_MESSAGE   0x04
 
#define CONTR_CAN_STATE   0x0C
 
#define CONTR_BUS_ERROR   0x1C
 
#define CONTR_CONT_OFF   0
 
#define CONTR_CONT_ON   1
 
#define CONTR_ONCE   2
 
#define CPC_MSG_TYPE_CAN_FRAME   1 /* CAN data frame */
 
#define CPC_MSG_TYPE_RTR_FRAME   8 /* CAN remote frame */
 
#define CPC_MSG_TYPE_CAN_PARAMS   12 /* Actual CAN parameters */
 
#define CPC_MSG_TYPE_CAN_STATE   14 /* CAN state message */
 
#define CPC_MSG_TYPE_EXT_CAN_FRAME   16 /* Extended CAN data frame */
 
#define CPC_MSG_TYPE_EXT_RTR_FRAME   17 /* Extended remote frame */
 
#define CPC_MSG_TYPE_CONTROL   19 /* change interface behavior */
 
#define CPC_MSG_TYPE_CONFIRM   20 /* command processed confirmation */
 
#define CPC_MSG_TYPE_OVERRUN   21 /* overrun events */
 
#define CPC_MSG_TYPE_CAN_FRAME_ERROR   23 /* detected bus errors */
 
#define CPC_MSG_TYPE_ERR_COUNTER   25 /* RX/TX error counter */
 
#define CPC_CMD_TYPE_CAN_FRAME   1 /* CAN data frame */
 
#define CPC_CMD_TYPE_CONTROL   3 /* control of interface behavior */
 
#define CPC_CMD_TYPE_CAN_PARAMS   6 /* set CAN parameters */
 
#define CPC_CMD_TYPE_RTR_FRAME   13 /* CAN remote frame */
 
#define CPC_CMD_TYPE_CAN_STATE   14 /* CAN state message */
 
#define CPC_CMD_TYPE_EXT_CAN_FRAME   15 /* Extended CAN data frame */
 
#define CPC_CMD_TYPE_EXT_RTR_FRAME   16 /* Extended CAN remote frame */
 
#define CPC_CMD_TYPE_CAN_EXIT   200 /* exit the CAN */
 
#define CPC_CMD_TYPE_INQ_ERR_COUNTER   25 /* request the CAN error counters */
 
#define CPC_CMD_TYPE_CLEAR_MSG_QUEUE   8 /* clear CPC_MSG queue */
 
#define CPC_CMD_TYPE_CLEAR_CMD_QUEUE   28 /* clear CPC_CMD queue */
 
#define CPC_CC_TYPE_SJA1000   2 /* Philips basic CAN controller */
 
#define CPC_CAN_ECODE_ERRFRAME   0x01 /* Ecode type */
 
#define CPC_OVR_EVENT_CAN   0x01
 
#define CPC_OVR_EVENT_CANSTATE   0x02
 
#define CPC_OVR_EVENT_BUSERROR   0x04
 
#define CPC_OVR_HW   0x80
 
#define CPC_MSG_HEADER_LEN   11
 
#define CPC_CAN_MSG_MIN_SIZE   5
 
#define USB_CPCUSB_VENDOR_ID   0x12D6
 
#define USB_CPCUSB_ARM7_PRODUCT_ID   0x0444
 
#define SJA1000_MOD_NORMAL   0x00
 
#define SJA1000_MOD_RM   0x01
 
#define SJA1000_ECC_SEG   0x1F
 
#define SJA1000_ECC_DIR   0x20
 
#define SJA1000_ECC_ERR   0x06
 
#define SJA1000_ECC_BIT   0x00
 
#define SJA1000_ECC_FORM   0x40
 
#define SJA1000_ECC_STUFF   0x80
 
#define SJA1000_ECC_MASK   0xc0
 
#define SJA1000_SR_BS   0x80
 
#define SJA1000_SR_ES   0x40
 
#define SJA1000_DEFAULT_OUTPUT_CONTROL   0xDA
 
#define EMS_USB_ARM7_CLOCK   8000000
 
#define RX_BUFFER_SIZE   64
 
#define CPC_HEADER_SIZE   4
 
#define INTR_IN_BUFFER_SIZE   4
 
#define MAX_RX_URBS   10
 
#define MAX_TX_URBS   10
 

Functions

 MODULE_AUTHOR ("Sebastian Haas <[email protected]>")
 
 MODULE_DESCRIPTION ("CAN driver for EMS Dr. Thomas Wuensche CAN/USB interfaces")
 
 MODULE_LICENSE ("GPL v2")
 
 MODULE_DEVICE_TABLE (usb, ems_usb_table)
 
 module_usb_driver (ems_usb_driver)
 

Macro Definition Documentation

#define CONTR_BUS_ERROR   0x1C

Definition at line 37 of file ems_usb.c.

#define CONTR_CAN_MESSAGE   0x04

Definition at line 35 of file ems_usb.c.

#define CONTR_CAN_STATE   0x0C

Definition at line 36 of file ems_usb.c.

#define CONTR_CONT_OFF   0

Definition at line 40 of file ems_usb.c.

#define CONTR_CONT_ON   1

Definition at line 41 of file ems_usb.c.

#define CONTR_ONCE   2

Definition at line 42 of file ems_usb.c.

#define CPC_CAN_ECODE_ERRFRAME   0x01 /* Ecode type */

Definition at line 73 of file ems_usb.c.

#define CPC_CAN_MSG_MIN_SIZE   5

Definition at line 88 of file ems_usb.c.

#define CPC_CC_TYPE_SJA1000   2 /* Philips basic CAN controller */

Definition at line 71 of file ems_usb.c.

#define CPC_CMD_TYPE_CAN_EXIT   200 /* exit the CAN */

Definition at line 65 of file ems_usb.c.

#define CPC_CMD_TYPE_CAN_FRAME   1 /* CAN data frame */

Definition at line 58 of file ems_usb.c.

#define CPC_CMD_TYPE_CAN_PARAMS   6 /* set CAN parameters */

Definition at line 60 of file ems_usb.c.

#define CPC_CMD_TYPE_CAN_STATE   14 /* CAN state message */

Definition at line 62 of file ems_usb.c.

#define CPC_CMD_TYPE_CLEAR_CMD_QUEUE   28 /* clear CPC_CMD queue */

Definition at line 69 of file ems_usb.c.

#define CPC_CMD_TYPE_CLEAR_MSG_QUEUE   8 /* clear CPC_MSG queue */

Definition at line 68 of file ems_usb.c.

#define CPC_CMD_TYPE_CONTROL   3 /* control of interface behavior */

Definition at line 59 of file ems_usb.c.

#define CPC_CMD_TYPE_EXT_CAN_FRAME   15 /* Extended CAN data frame */

Definition at line 63 of file ems_usb.c.

#define CPC_CMD_TYPE_EXT_RTR_FRAME   16 /* Extended CAN remote frame */

Definition at line 64 of file ems_usb.c.

#define CPC_CMD_TYPE_INQ_ERR_COUNTER   25 /* request the CAN error counters */

Definition at line 67 of file ems_usb.c.

#define CPC_CMD_TYPE_RTR_FRAME   13 /* CAN remote frame */

Definition at line 61 of file ems_usb.c.

#define CPC_HEADER_SIZE   4

Definition at line 231 of file ems_usb.c.

#define CPC_MSG_HEADER_LEN   11

Definition at line 87 of file ems_usb.c.

#define CPC_MSG_TYPE_CAN_FRAME   1 /* CAN data frame */

Definition at line 45 of file ems_usb.c.

#define CPC_MSG_TYPE_CAN_FRAME_ERROR   23 /* detected bus errors */

Definition at line 54 of file ems_usb.c.

#define CPC_MSG_TYPE_CAN_PARAMS   12 /* Actual CAN parameters */

Definition at line 47 of file ems_usb.c.

#define CPC_MSG_TYPE_CAN_STATE   14 /* CAN state message */

Definition at line 48 of file ems_usb.c.

#define CPC_MSG_TYPE_CONFIRM   20 /* command processed confirmation */

Definition at line 52 of file ems_usb.c.

#define CPC_MSG_TYPE_CONTROL   19 /* change interface behavior */

Definition at line 51 of file ems_usb.c.

#define CPC_MSG_TYPE_ERR_COUNTER   25 /* RX/TX error counter */

Definition at line 55 of file ems_usb.c.

#define CPC_MSG_TYPE_EXT_CAN_FRAME   16 /* Extended CAN data frame */

Definition at line 49 of file ems_usb.c.

#define CPC_MSG_TYPE_EXT_RTR_FRAME   17 /* Extended remote frame */

Definition at line 50 of file ems_usb.c.

#define CPC_MSG_TYPE_OVERRUN   21 /* overrun events */

Definition at line 53 of file ems_usb.c.

#define CPC_MSG_TYPE_RTR_FRAME   8 /* CAN remote frame */

Definition at line 46 of file ems_usb.c.

#define CPC_OVR_EVENT_BUSERROR   0x04

Definition at line 78 of file ems_usb.c.

#define CPC_OVR_EVENT_CAN   0x01

Definition at line 76 of file ems_usb.c.

#define CPC_OVR_EVENT_CANSTATE   0x02

Definition at line 77 of file ems_usb.c.

#define CPC_OVR_HW   0x80

Definition at line 84 of file ems_usb.c.

#define EMS_USB_ARM7_CLOCK   8000000

Definition at line 119 of file ems_usb.c.

#define INTR_IN_BUFFER_SIZE   4

Definition at line 232 of file ems_usb.c.

#define MAX_RX_URBS   10

Definition at line 234 of file ems_usb.c.

#define MAX_TX_URBS   10

Definition at line 235 of file ems_usb.c.

#define RX_BUFFER_SIZE   64

Definition at line 230 of file ems_usb.c.

#define SJA1000_DEFAULT_OUTPUT_CONTROL   0xDA

Definition at line 112 of file ems_usb.c.

#define SJA1000_ECC_BIT   0x00

Definition at line 103 of file ems_usb.c.

#define SJA1000_ECC_DIR   0x20

Definition at line 101 of file ems_usb.c.

#define SJA1000_ECC_ERR   0x06

Definition at line 102 of file ems_usb.c.

#define SJA1000_ECC_FORM   0x40

Definition at line 104 of file ems_usb.c.

#define SJA1000_ECC_MASK   0xc0

Definition at line 106 of file ems_usb.c.

#define SJA1000_ECC_SEG   0x1F

Definition at line 100 of file ems_usb.c.

#define SJA1000_ECC_STUFF   0x80

Definition at line 105 of file ems_usb.c.

#define SJA1000_MOD_NORMAL   0x00

Definition at line 96 of file ems_usb.c.

#define SJA1000_MOD_RM   0x01

Definition at line 97 of file ems_usb.c.

#define SJA1000_SR_BS   0x80

Definition at line 109 of file ems_usb.c.

#define SJA1000_SR_ES   0x40

Definition at line 110 of file ems_usb.c.

#define USB_CPCUSB_ARM7_PRODUCT_ID   0x0444

Definition at line 93 of file ems_usb.c.

#define USB_CPCUSB_VENDOR_ID   0x12D6

Definition at line 91 of file ems_usb.c.

Function Documentation

MODULE_AUTHOR ( "Sebastian Haas <[email protected]>"  )
MODULE_DESCRIPTION ( "CAN driver for EMS Dr. Thomas Wuensche CAN/USB interfaces"  )
MODULE_DEVICE_TABLE ( usb  ,
ems_usb_table   
)
MODULE_LICENSE ( "GPL v2 )
module_usb_driver ( ems_usb_driver  )