提交 1114be1e 编写于 作者: S Stephane Grosjean 提交者: Marc Kleine-Budde

can: peak_usb: export pcan_usb_pro functions

Add support for the following new PEAK-System technik CANFD USB adapters:

PCAN-USB FD             single CANFD channel USB adapter
PCAN-USB Pro FD         dual CANFD channels USB adapter

The communication protocol has been developed using some mechanisms that
did exist in the PCAN-USB Pro, thus, this patch also changes some
previously static functions and data into global ones.
Signed-off-by: NStephane Grosjean <s.grosjean@peak-system.com>
Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
上级 2b0861e8
...@@ -27,14 +27,6 @@ ...@@ -27,14 +27,6 @@
MODULE_SUPPORTED_DEVICE("PEAK-System PCAN-USB Pro adapter"); MODULE_SUPPORTED_DEVICE("PEAK-System PCAN-USB Pro adapter");
/* PCAN-USB Pro Endpoints */
#define PCAN_USBPRO_EP_CMDOUT 1
#define PCAN_USBPRO_EP_CMDIN (PCAN_USBPRO_EP_CMDOUT | USB_DIR_IN)
#define PCAN_USBPRO_EP_MSGOUT_0 2
#define PCAN_USBPRO_EP_MSGIN (PCAN_USBPRO_EP_MSGOUT_0 | USB_DIR_IN)
#define PCAN_USBPRO_EP_MSGOUT_1 3
#define PCAN_USBPRO_EP_UNUSED (PCAN_USBPRO_EP_MSGOUT_1 | USB_DIR_IN)
#define PCAN_USBPRO_CHANNEL_COUNT 2 #define PCAN_USBPRO_CHANNEL_COUNT 2
/* PCAN-USB Pro adapter internal clock (MHz) */ /* PCAN-USB Pro adapter internal clock (MHz) */
...@@ -322,7 +314,7 @@ static int pcan_usb_pro_wait_rsp(struct peak_usb_device *dev, ...@@ -322,7 +314,7 @@ static int pcan_usb_pro_wait_rsp(struct peak_usb_device *dev,
return (i >= PCAN_USBPRO_RSP_SUBMIT_MAX) ? -ERANGE : err; return (i >= PCAN_USBPRO_RSP_SUBMIT_MAX) ? -ERANGE : err;
} }
static int pcan_usb_pro_send_req(struct peak_usb_device *dev, int req_id, int pcan_usb_pro_send_req(struct peak_usb_device *dev, int req_id,
int req_value, void *req_addr, int req_size) int req_value, void *req_addr, int req_size)
{ {
int err; int err;
...@@ -475,7 +467,7 @@ static int pcan_usb_pro_set_bittiming(struct peak_usb_device *dev, ...@@ -475,7 +467,7 @@ static int pcan_usb_pro_set_bittiming(struct peak_usb_device *dev,
return pcan_usb_pro_set_bitrate(dev, ccbt); return pcan_usb_pro_set_bitrate(dev, ccbt);
} }
static void pcan_usb_pro_restart_complete(struct urb *urb) void pcan_usb_pro_restart_complete(struct urb *urb)
{ {
/* can delete usb resources */ /* can delete usb resources */
peak_usb_async_complete(urb); peak_usb_async_complete(urb);
...@@ -978,7 +970,7 @@ static void pcan_usb_pro_free(struct peak_usb_device *dev) ...@@ -978,7 +970,7 @@ static void pcan_usb_pro_free(struct peak_usb_device *dev)
/* /*
* probe function for new PCAN-USB Pro usb interface * probe function for new PCAN-USB Pro usb interface
*/ */
static int pcan_usb_pro_probe(struct usb_interface *intf) int pcan_usb_pro_probe(struct usb_interface *intf)
{ {
struct usb_host_interface *if_desc; struct usb_host_interface *if_desc;
int i; int i;
......
...@@ -27,6 +27,14 @@ ...@@ -27,6 +27,14 @@
#define PCAN_USBPRO_INFO_BL 0 #define PCAN_USBPRO_INFO_BL 0
#define PCAN_USBPRO_INFO_FW 1 #define PCAN_USBPRO_INFO_FW 1
/* PCAN-USB Pro (FD) Endpoints */
#define PCAN_USBPRO_EP_CMDOUT 1
#define PCAN_USBPRO_EP_CMDIN (PCAN_USBPRO_EP_CMDOUT | USB_DIR_IN)
#define PCAN_USBPRO_EP_MSGOUT_0 2
#define PCAN_USBPRO_EP_MSGIN (PCAN_USBPRO_EP_MSGOUT_0 | USB_DIR_IN)
#define PCAN_USBPRO_EP_MSGOUT_1 3
#define PCAN_USBPRO_EP_UNUSED (PCAN_USBPRO_EP_MSGOUT_1 | USB_DIR_IN)
/* Vendor Request value for XXX_FCT */ /* Vendor Request value for XXX_FCT */
#define PCAN_USBPRO_FCT_DRVLD 5 /* tell device driver is loaded */ #define PCAN_USBPRO_FCT_DRVLD 5 /* tell device driver is loaded */
#define PCAN_USBPRO_FCT_DRVLD_REQ_LEN 16 #define PCAN_USBPRO_FCT_DRVLD_REQ_LEN 16
...@@ -176,4 +184,9 @@ union pcan_usb_pro_rec { ...@@ -176,4 +184,9 @@ union pcan_usb_pro_rec {
struct pcan_usb_pro_txmsg tx_msg; struct pcan_usb_pro_txmsg tx_msg;
}; };
int pcan_usb_pro_probe(struct usb_interface *intf);
int pcan_usb_pro_send_req(struct peak_usb_device *dev, int req_id,
int req_value, void *req_addr, int req_size);
void pcan_usb_pro_restart_complete(struct urb *urb);
#endif #endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册