解决以下问题:

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相关函数无法直接得到端口号
This commit is contained in:
liruncong
2018-10-23 20:03:18 +08:00
parent bf537189a7
commit d3764db892
8 changed files with 71 additions and 43 deletions

View File

@@ -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) | \

View File

@@ -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