0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef PCAN_USB_PRO_H
0010 #define PCAN_USB_PRO_H
0011
0012
0013
0014
0015 #define PCAN_USBPRO_REQ_INFO 0
0016 #define PCAN_USBPRO_REQ_FCT 2
0017
0018
0019 #define PCAN_USBPRO_INFO_BL 0
0020 #define PCAN_USBPRO_INFO_FW 1
0021
0022
0023 #define PCAN_USBPRO_EP_CMDOUT 1
0024 #define PCAN_USBPRO_EP_CMDIN (PCAN_USBPRO_EP_CMDOUT | USB_DIR_IN)
0025 #define PCAN_USBPRO_EP_MSGOUT_0 2
0026 #define PCAN_USBPRO_EP_MSGIN (PCAN_USBPRO_EP_MSGOUT_0 | USB_DIR_IN)
0027 #define PCAN_USBPRO_EP_MSGOUT_1 3
0028 #define PCAN_USBPRO_EP_UNUSED (PCAN_USBPRO_EP_MSGOUT_1 | USB_DIR_IN)
0029
0030
0031 #define PCAN_USBPRO_FCT_DRVLD 5
0032 #define PCAN_USBPRO_FCT_DRVLD_REQ_LEN 16
0033
0034
0035 struct __packed pcan_usb_pro_blinfo {
0036 __le32 ctrl_type;
0037 u8 version[4];
0038 u8 day;
0039 u8 month;
0040 u8 year;
0041 u8 dummy;
0042 __le32 serial_num_hi;
0043 __le32 serial_num_lo;
0044 __le32 hw_type;
0045 __le32 hw_rev;
0046 };
0047
0048
0049 struct __packed pcan_usb_pro_fwinfo {
0050 __le32 ctrl_type;
0051 u8 version[4];
0052 u8 day;
0053 u8 month;
0054 u8 year;
0055 u8 dummy;
0056 __le32 fw_type;
0057 };
0058
0059
0060
0061
0062 #define PCAN_USBPRO_SETBTR 0x02
0063 #define PCAN_USBPRO_SETBUSACT 0x04
0064 #define PCAN_USBPRO_SETSILENT 0x05
0065 #define PCAN_USBPRO_SETFILTR 0x0a
0066 #define PCAN_USBPRO_SETTS 0x10
0067 #define PCAN_USBPRO_GETDEVID 0x12
0068 #define PCAN_USBPRO_SETLED 0x1C
0069 #define PCAN_USBPRO_RXMSG8 0x80
0070 #define PCAN_USBPRO_RXMSG4 0x81
0071 #define PCAN_USBPRO_RXMSG0 0x82
0072 #define PCAN_USBPRO_RXRTR 0x83
0073 #define PCAN_USBPRO_RXSTATUS 0x84
0074 #define PCAN_USBPRO_RXTS 0x85
0075 #define PCAN_USBPRO_TXMSG8 0x41
0076 #define PCAN_USBPRO_TXMSG4 0x42
0077 #define PCAN_USBPRO_TXMSG0 0x43
0078
0079
0080 struct __packed pcan_usb_pro_btr {
0081 u8 data_type;
0082 u8 channel;
0083 __le16 dummy;
0084 __le32 CCBT;
0085 };
0086
0087 struct __packed pcan_usb_pro_busact {
0088 u8 data_type;
0089 u8 channel;
0090 __le16 onoff;
0091 };
0092
0093 struct __packed pcan_usb_pro_silent {
0094 u8 data_type;
0095 u8 channel;
0096 __le16 onoff;
0097 };
0098
0099 struct __packed pcan_usb_pro_filter {
0100 u8 data_type;
0101 u8 dummy;
0102 __le16 filter_mode;
0103 };
0104
0105 struct __packed pcan_usb_pro_setts {
0106 u8 data_type;
0107 u8 dummy;
0108 __le16 mode;
0109 };
0110
0111 struct __packed pcan_usb_pro_devid {
0112 u8 data_type;
0113 u8 channel;
0114 __le16 dummy;
0115 __le32 dev_num;
0116 };
0117
0118 #define PCAN_USBPRO_LED_DEVICE 0x00
0119 #define PCAN_USBPRO_LED_BLINK_FAST 0x01
0120 #define PCAN_USBPRO_LED_BLINK_SLOW 0x02
0121 #define PCAN_USBPRO_LED_ON 0x03
0122 #define PCAN_USBPRO_LED_OFF 0x04
0123
0124 struct __packed pcan_usb_pro_setled {
0125 u8 data_type;
0126 u8 channel;
0127 __le16 mode;
0128 __le32 timeout;
0129 };
0130
0131 struct __packed pcan_usb_pro_rxmsg {
0132 u8 data_type;
0133 u8 client;
0134 u8 flags;
0135 u8 len;
0136 __le32 ts32;
0137 __le32 id;
0138
0139 u8 data[8];
0140 };
0141
0142 #define PCAN_USBPRO_STATUS_ERROR 0x0001
0143 #define PCAN_USBPRO_STATUS_BUS 0x0002
0144 #define PCAN_USBPRO_STATUS_OVERRUN 0x0004
0145 #define PCAN_USBPRO_STATUS_QOVERRUN 0x0008
0146
0147 struct __packed pcan_usb_pro_rxstatus {
0148 u8 data_type;
0149 u8 channel;
0150 __le16 status;
0151 __le32 ts32;
0152 __le32 err_frm;
0153 };
0154
0155 struct __packed pcan_usb_pro_rxts {
0156 u8 data_type;
0157 u8 dummy[3];
0158 __le32 ts64[2];
0159 };
0160
0161 struct __packed pcan_usb_pro_txmsg {
0162 u8 data_type;
0163 u8 client;
0164 u8 flags;
0165 u8 len;
0166 __le32 id;
0167 u8 data[8];
0168 };
0169
0170 union pcan_usb_pro_rec {
0171 u8 data_type;
0172 struct pcan_usb_pro_btr btr;
0173 struct pcan_usb_pro_busact bus_act;
0174 struct pcan_usb_pro_silent silent_mode;
0175 struct pcan_usb_pro_filter filter_mode;
0176 struct pcan_usb_pro_setts ts;
0177 struct pcan_usb_pro_devid dev_id;
0178 struct pcan_usb_pro_setled set_led;
0179 struct pcan_usb_pro_rxmsg rx_msg;
0180 struct pcan_usb_pro_rxstatus rx_status;
0181 struct pcan_usb_pro_rxts rx_ts;
0182 struct pcan_usb_pro_txmsg tx_msg;
0183 };
0184
0185 int pcan_usb_pro_probe(struct usb_interface *intf);
0186 int pcan_usb_pro_send_req(struct peak_usb_device *dev, int req_id,
0187 int req_value, void *req_addr, int req_size);
0188 void pcan_usb_pro_restart_complete(struct urb *urb);
0189
0190 #endif