diff options
| author | liruncong <[email protected]> | 2018-10-23 20:03:18 +0800 |
|---|---|---|
| committer | liruncong <[email protected]> | 2018-10-23 20:04:51 +0800 |
| commit | d3764db892e4e97b6d599bda867eaa49b0ad4786 (patch) | |
| tree | 2ad21bc40d025c80a5e1a8ec6882ed45724befc4 /components/drivers/include | |
| parent | bf537189a7840680f3f36bceb5c7c990383c9eaf (diff) | |
解决以下问题:
1) usb驱动中时间未与RT_TICK_PER_SECOND关联问题,RT_TICK_PER_SECOND变化时,这些时间将发生变化
解决: 增加USB_TIMEOUT_BASIC/USB_TIMEOUT_LONG/USB_DEBOUNCE_TIME
2) 修正rt_usbh_detach_instance函数使用device->cfg_desc前未判断是否有效. 可导致abort
3) rt_usbh_hub_port_change增加device->port初始化,否则struct uhcd_ops相关函数无法直接得到端口号
Diffstat (limited to 'components/drivers/include')
| -rw-r--r-- | components/drivers/include/drivers/usb_common.h | 13 | ||||
| -rw-r--r-- | components/drivers/include/drivers/usb_device.h | 9 |
2 files changed, 22 insertions, 0 deletions
diff --git a/components/drivers/include/drivers/usb_common.h b/components/drivers/include/drivers/usb_common.h index 7398fc3814..764dcd5612 100644 --- a/components/drivers/include/drivers/usb_common.h +++ b/components/drivers/include/drivers/usb_common.h @@ -216,6 +216,19 @@ extern "C" { #define HID_REPORT_ID_GENERAL 5 #define HID_REPORT_ID_MOUSE 6 +/* + * Time of usb timeout + */ +#ifndef USB_TIMEOUT_BASIC +#define USB_TIMEOUT_BASIC (RT_TICK_PER_SECOND) /* 1s */ +#endif +#ifndef USB_TIMEOUT_LONG +#define USB_TIMEOUT_LONG (RT_TICK_PER_SECOND * 5) /* 5s */ +#endif +#ifndf USB_DEBOUNCE_TIME +#define USB_DEBOUNCE_TIME (RT_TICK_PER_SECOND / 5) /* 0.2s */ +#endif + #define uswap_32(x) \ ((((x) & 0xff000000) >> 24) | \ (((x) & 0x00ff0000) >> 8) | \ diff --git a/components/drivers/include/drivers/usb_device.h b/components/drivers/include/drivers/usb_device.h index cb4122fdaf..26f0c4cf4a 100644 --- a/components/drivers/include/drivers/usb_device.h +++ b/components/drivers/include/drivers/usb_device.h @@ -17,6 +17,10 @@ #include <rtthread.h> #include "drivers/usb_common.h" +#ifdef __cplusplus +extern "C" { +#endif + /* Vendor ID */ #ifdef USB_VENDOR_ID #define _VENDOR_ID USB_VENDOR_ID @@ -453,4 +457,9 @@ rt_inline void usbd_os_proerty_descriptor_send(ufunction_t func, ureq_t setup, u } rt_usbd_ep0_write(func->device, data, setup->wLength); } + +#ifdef __cplusplus +} +#endif + #endif |
