EZ-USB FX3 Technical Reference Manual, Document Number: 001-76074 Rev. *F 96
Universal Serial Bus (USB)
UIB->eepm_endpoint[0] = 0x200; /* Control EP transfer size is 512
bytes. */
UIB->iepm_endpoint[0] = 0x200; /* Control EP transfer size is 512
bytes. */
for (ep = 1; ep < 16; ep++)
{
/* Reset, flush and clear stall condition on all valid endpoints. */
if (glPcktSizeIn[ep].valid == CyTrue)
{
CyU3PUsbFlushEp (ep | 0x80);
CyU3PUsbStall (ep | 0x80, CyFalse, CyTrue);
}
if (glPcktSizeOut[ep].valid == CyTrue)
{
CyU3PUsbFlushEp (ep);
CyU3PUsbStall (ep, CyFalse, CyTrue);
}
}
}
6.9.5 USB Connect
The following code example implements the USB connect handler to handle the USB connect event. This event is detected
by the LTSSM_CONNECT bit of the LNK_INTR link layer interrupt register.
void CyU3PUsbSSConnecthandler (void)
{
uint32_t state;
uint32_t glUsb3TxTrimVal = 0x0B569011;
/* hardware specific setting for USB 3.0 Phy */
USB3LNK->lnk_phy_tx_trim = glUsb3TxTrimVal;
CyFx3UsbWritePhyReg (0x1006, 0x180);
CyFx3UsbWritePhyReg (0x1024, 0x0080);
/* If USB 2.0 PHY is enabled, switch it off and take out the USB 2.0 pullup. */
if (UIB->otg_ctrl & CY_U3P_UIB_DEV_ENABLE)
{
state = USB3LNK->lnk_ltssm_state & CY_U3P_UIB_LTSSM_STATE_MASK;
while ((UIB->otg_ctrl & CY_U3P_UIB_SSDEV_ENABLE)
&& (state == CY_U3P_UIB_LNK_STATE_POLLING_LFPS))
{
CyU3PThreadRelinquish ();
state = USB3LNK->lnk_ltssm_state & CY_U3P_UIB_LTSSM_STATE_MASK;
}
if (state == CY_U3P_UIB_LNK_STATE_COMP)
{
if (!glUibDeviceInfo.ssCmdSeen)
{
CyU3PUsbAddToEventLog (CYU3P_USB_LOG_USBSS_DISCONNECT);
CyU3PUsbSSDisConnecthandler ();
}
return;