/** * @brief USBH_HandleControl * Handles the USB control transfer state machine * @param pdev: Selected device * @retval Status */ USBH_Status USBH_HandleControl(USB_OTG_CORE_HANDLE *pdev, USBH_HOST *phost) { switch (phost->Control.state)
case CTRL_DATA_IN_WAIT: URB_Status = HCD_GetURB_State( pdev, phost->Control.hc_num_in ); /* check is DATA packet transfered successfully */ if (URB_Status == URB_DONE) { phost->Control.state = CTRL_STATUS_OUT; } /* manage error cases*/ else // add -- only when if (URB_Status != URB_DONE)
if (URB_Status == URB_STALL)
{ /* In stall case, return to previous machine state*/ phost->gState = phost->gStateBkp; phost->Control.state = CTRL_STALLED; // add
// SETUP DATA ACK : IN : STALL
} }