- case HOST_ENUMERATION:
- /* Check for enumeration status */
- if ( USBH_HandleEnum(pdev , phost) == USBH_OK)
- {
- /* The function shall return USBH_OK when full enumeration is complete */
-
- /* user callback for end of device basic enumeration */
- phost->usr_cb->EnumerationDone();
-
- phost->gState = HOST_USR_INPUT;
- }
- break;
- case ENUM_IDLE:
- /* Get Device Desc for only 1st 8 bytes : To get EP0 MaxPacketSize */
- if ( USBH_Get_DevDesc(pdev , phost, 8) == USBH_OK)
- {
- phost->Control.ep0size = phost->device_prop.Dev_Desc.bMaxPacketSize;
-
- /* Issue Reset */
- HCD_ResetPort(pdev);
- phost->EnumState = ENUM_GET_FULL_DEV_DESC;
-
- /* modify control channels configuration for MaxPacket size */
- USBH_Modify_Channel (pdev,
- phost->Control.hc_num_out,
- 0,
- 0,
- 0,
- phost->Control.ep0size);
-
- USBH_Modify_Channel (pdev,
- phost->Control.hc_num_in,
- 0,
- 0,
- 0,
- phost->Control.ep0size);
- }
- break;
- USBH_Status USBH_Get_DevDesc(USB_OTG_CORE_HANDLE *pdev,
- USBH_HOST *phost,
- uint8_t length)
- {
-
- USBH_Status status;
-
- if((status = USBH_GetDescriptor(pdev,
- phost,
- USB_REQ_RECIPIENT_DEVICE | USB_REQ_TYPE_STANDARD,
- USB_DESC_DEVICE,
- pdev->host.Rx_Buffer,
- length)) == USBH_OK)
- {
- /* Commands successfully sent and Response Received */
- USBH_ParseDevDesc(&phost->device_prop.Dev_Desc, pdev->host.Rx_Buffer, length);
- }
- return status;
- }
- typedef enum {
- USBH_OK = 0,
- USBH_BUSY,
- USBH_FAIL,
- USBH_NOT_SUPPORTED,
- USBH_UNRECOVERED_ERROR,
- USBH_ERROR_SPEED_UNKNOWN,
- USBH_APPLY_DEINIT
- }USBH_Status;
在USBH_Process函数中发现主要是枚举的这个if条件满足不了,一步步仿真切入分析,发现主要是这个if进不了,
status为1,即始终是USBH_BUSY。
请问谁知道这是怎么回事?