EZ-USB FX3 Technical Reference Manual, Document Number: 001-76074 Rev. *F 115
Universal Serial Bus (USB)
else
{
/* Do nothing. */
}
/* Save the current OTG configuration. */
glOtgInfo = *cfg;
glIsOtgEnable = CyTrue;
return CY_U3P_SUCCESS;
}
CyU3PReturnStatus_t
CyU3POtgStop (void)
{
if (!glIsOtgEnable)
{
return CY_U3P_ERROR_NOT_STARTED;
}
/* Do not disable the block if any of the modes are running. */
if ((CyU3PUsbIsStarted ()) || (CyU3PUsbHostIsStarted ()))
{
return CY_U3P_ERROR_INVALID_SEQUENCE;
}
/* Disable all interrupts. */
UIB->intr_mask = 0;
CyU3PVicDisableInt (CY_U3P_VIC_UIB_CORE_VECTOR);
CyU3PVicDisableInt (CY_U3P_VIC_UIB_DMA_VECTOR);
/* Reset all state machine variables to default. */
glOtgInfo.otgMode = CY_U3P_OTG_MODE_DEVICE_ONLY;
glOtgInfo.chargerMode = CY_U3P_OTG_CHARGER_DETECT_ACA_MODE;
glOtgInfo.cb = NULL;
glPeripheralType = CY_U3P_OTG_TYPE_DISABLED;
glIsHnpEnable = CyFalse;
UIB->chgdet_ctrl = CY_U3P_UIB_CHGDET_CTRL_DEFAULT;
UIB->otg_ctrl = CY_U3P_UIB_OTG_CTRL_DEFAULT;
/* Disable the UIB block. */
UIB->power &= ~CY_U3P_UIB_RESETN;
CyU3PBusyWait (10);
/* Disable the UIB clock. */
GCTL->uib_core_clk &= ~CY_U3P_GCTL_UIBCLK_CLK_EN;
GCTLAON->control &= ~CY_U3P_GCTL_USB_POWER_EN;
/* Update the state variable. */
glIsOtgEnable = CyFalse;
return CY_U3P_SUCCESS;
}