summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorheyuanjie87 <[email protected]>2013-01-09 12:04:01 +0800
committerheyuanjie87 <[email protected]>2013-01-09 12:04:01 +0800
commit22786f8817fb9cc3f558a721029d99d20149a152 (patch)
tree0f0e49ef825f7d0b9ed319f0c34c01a2e3e32648 /components
parent47d8dc67c0451a39a1fb0ff4ec556a4080cae6f1 (diff)
allows the user to custom PID and VID;
add a dcd operation to send status in control transfer
Diffstat (limited to 'components')
-rw-r--r--components/drivers/include/drivers/usb_device.h23
1 files changed, 20 insertions, 3 deletions
diff --git a/components/drivers/include/drivers/usb_device.h b/components/drivers/include/drivers/usb_device.h
index b969eb6864..e4b623ab00 100644
--- a/components/drivers/include/drivers/usb_device.h
+++ b/components/drivers/include/drivers/usb_device.h
@@ -19,10 +19,19 @@
#include <rtthread.h>
#include "usb_common.h"
-#define CONTROL_SEND_STATUS 0x00
-#define CONTROL_RECEIVE_STATUS 0x01
+/* Vendor ID */
+#ifdef USB_VENDOR_ID
+#define USB_VENDOR_ID _VENDOR_ID
+#else
+#define _VENDOR_ID 0x0EFF
+#endif
+/* Product ID */
+#ifdef USB_PRODUCT_ID
+#define USB_PRODUCT_ID _PRODUCT_ID
+#else
+#define _PRODUCT_ID 0x0001
+#endif
-#define USB_VENDOR_ID 0x0483 /* Vendor ID */
#define USB_BCD_DEVICE 0x0200 /* USB Specification Release Number in Binary-Coded Decimal */
#define USB_BCD_VERSION 0x0200 /* USB 2.0 */
@@ -42,6 +51,7 @@ struct udcd_ops
rt_err_t (*ep_stop)(struct uendpoint* ep);
rt_err_t (*ep_read)(struct uendpoint* ep, void *buffer, rt_size_t size);
rt_size_t (*ep_write)(struct uendpoint* ep, void *buffer, rt_size_t size);
+ rt_err_t (*send_status)(void);
};
struct udcd
@@ -264,4 +274,11 @@ rt_inline rt_size_t dcd_ep_write(udcd_t dcd, uep_t ep, void *buffer,
return dcd->ops->ep_write(ep, buffer, size);
}
+rt_inline rt_err_t dcd_send_status(udcd_t dcd)
+{
+ RT_ASSERT(dcd != RT_NULL);
+
+ return dcd->ops->send_status();
+}
+
#endif