EZ-USB FX3 Technical Reference Manual, Document Number: 001-76074 Rev. *F 92
Universal Serial Bus (USB)
6.9 USB Function Programming Model
6.9.1 USB 3.0 Initialization
Before USB 3.0 is operational, the function controller needs to be initialized. The following code example from the FX3 SDK
implements the UIB initialization sequence for the USB 3.0 function.
static void
CyU3PUibInit (
void)
{
uint8_t ep = 0;
/* Enable the Power regulators*/
GCTLAON->wakeup_en = 0;
GCTLAON->wakeup_polarity = 0;
/* Link_phy_conf enable Rx terminations */
USB3LNK->lnk_phy_conf = 0xE0000001;
USB3LNK->lnk_error_conf = 0xFFFFFFFF;
USB3LNK->lnk_intr = 0xFFFFFFFF;
USB3LNK->lnk_intr_mask = CY_U3P_UIB_LGO_U3 | CY_U3P_UIB_LTSSM_CONNECT |
CY_U3P_UIB_LTSSM_DISCONNECT | CY_U3P_UIB_LTSSM_RESET | CY_U3P_UIB_LTSSM_STATE_CHG;
USB3PROT->prot_ep_intr_mask = 0;
USB3PROT->prot_intr = 0xFFFFFFFF;
USB3PROT->prot_intr_mask = (CY_U3P_UIB_STATUS_STAGE |
CY_U3P_UIB_SUTOK_EN | CY_U3P_UIB_EP0_STALLED_EN |
CY_U3P_UIB_TIMEOUT_PORT_CAP_EN | CY_U3P_UIB_TIMEOUT_PORT_CFG_EN |
CY_U3P_UIB_LMP_RCV_EN |
CY_U3P_UIB_LMP_PORT_CAP_EN | CY_U3P_UIB_LMP_PORT_CFG_EN);
/* Disable all EPs except EP0 */
for (ep = 1; ep < 16; ep++)
{
UIB->dev_epo_cs[ep] &= ~CY_U3P_UIB_EPO_VALID;
USB3PROT->prot_epo_cs1[ep] = 0;
UIB->dev_epi_cs[ep] &= ~CY_U3P_UIB_EPI_VALID;
USB3PROT->prot_epi_cs1[ep] = 0;
}
/* Disable all UIB interrupts at this stage. */
UIB->intr_mask &= ~(CY_U3P_UIB_DEV_CTL_INT | CY_U3P_UIB_DEV_EP_INT | CY_U3P_UIB_LNK_INT
|
CY_U3P_UIB_PROT_INT | CY_U3P_UIB_PROT_EP_INT | CY_U3P_UIB_EPM_URUN);
/* Enable the Vbus detection interrupt at this stage. */
GCTL->iopwr_intr = 0xFFFFFFFF;
GCTL->iopwr_intr_mask = CY_U3P_VBUS;
CyU3PVicEnableInt (CY_U3P_VIC_GCTL_PWR_VECTOR);
}