Cypress EZ-USB® FX3™ SDK Quick Start Guide, Version 1.3.1 42
e. The CyU3PConnectState API is used to enable USB device
connection to a host. This API only enables the device to connect to
the host, and does not necessarily result in turning the USB PHY
blocks on. The USB driver will start monitoring the Vbus signal once
this API is called, and will enable the PHY when Vbus becomes valid.
The SuperSpeed enable parameter is set to true, so that FX3 can
connect as a SuperSpeed, Hi-Speed or Full speed device based on
the host‟s capabilities.
9. After the above initialization steps, the CyFxAppThread_Entry function waits
for the USB device configuration to be completed. The actual GPIF-II and
USB endpoint configuration is not performed during start-up of the
application. This is only performed when the USB host sends down a
SET_CONFIGURATION request to the FX3 device. This is done through the
CyFxApplnStart function, once the CY_U3P_USB_EVENT_SETCONF event
has been received in the USB event callback.
10. The CyFxApplnStart function completes the GPIF-II configuration and the
USB endpoint configuration; and then sets up the data path for steering data
from the GPIF-II interface to the USB endpoint.
a. The CyU3PUsbGetSpeed() API is used to identify the USB
connection speed. The packet size of the USB endpoint is determined
based on this connection speed.
b. The CyU3PSetEpConfig API is used to configure EP 1-IN as a BULK-
IN endpoint with the desired maximum packet size. If FX3 is
connected as a SuperSpeed device, the endpoint is configured to
support CY_FX_EP_BURST_LENGTH packets in a single burst.
c. Any stale data in the endpoint buffers is flushed using the
CyU3PUsbFlushEp API.
d. The CyU3PDmaChannelCreate API is used to create an Automatic
(no firmware intervention) DMA data path from the GPIF-II socket to
the USB endpoint. The DMA channel is configured to use
CY_FX_DMA_BUF_COUNT buffers of CY_FX_DMA_BUF_SIZE
bytes each. Even though CY_FX_DMA_BUF_SIZE is greater than
the endpoint‟s maximum packet size, the data in the buffer will be
automatically broken into appropriately sized packets by the FX3
hardware.
e. The CyU3PDmaChannelSetXfer API is used to enable the data path
for data transfers. A data count of zero is specified, so that the data
transfer can continue without any limits.
f. The CyU3PGpifLoad API is used to load the GPIF-II state machine
configuration onto the device registers. The configuration data is
taken from the cyfxgpif2config.h header file.