EZ-USB FX3 Technical Reference Manual, Document Number: 001-76074 Rev. *F 154
General Programmable Interface II (GPIF II)
The IN_DATA action settings are shown in Figure 7-39. As long as the state machine is in the READDATA state, a new byte
is read from the data bus and sent to the DMA buffer on every clock.
Figure 7-39. IN_DATA Action Setting
The GPIF II state machine returns to the DMAWAIT state when the DMA_RDY_TH0 flag goes low. This happens when DMA
buffer switching occurs for the created DMA channel or when all the allocated DMA buffers are filled with data and waiting to
get cleared from the USB side.
When GPIF II tries to push data to the DMA buffer after it is full, then a PIB overrun error is flagged for the corresponding
thread. The bit fields of the PIB error indicator register let you know if a PIB error is flagged.
7.12 DMA Channel Creation in FX3 Firmware to Perform USB to GPIF II
Data Transfers
The code to create a DMA channel in FX3 firmware to perform USB to GPIF II data transfers follows.
dmaCfg.size = 16384;
dmaCfg.count = 4;
dmaCfg.prodSckId = CY_U3P_UIB_SOCKET_PROD_1;
dmaCfg.consSckId = CY_U3P_PIB_SOCKET_1;
dmaCfg.dmaMode = CY_U3P_DMA_MODE_BYTE;
dmaCfg.notification = 0;
dmaCfg.cb = 0;
dmaCfg.prodHeader = 0;
dmaCfg.prodFooter = 0;
dmaCfg.consHeader = 0;
dmaCfg.prodAvailCount = 0;
apiRetStatus = CyU3PDmaChannelCreate (&glDmaChHandle, CY_U3P_DMA_TYPE_AUTO, &dmaCfg);
if (apiRetStatus != CY_U3P_SUCCESS) {
CyU3PDebugPrint (4, "CyU3PDmaChannelCreate failed, Error code = %d\n", apiRetStatus);
CyFxAppErrorHandler(apiRetStatus);
}
This code creates a DMA channel between socket 1 of the PIB and socket 1 of the UIB. In this example, GPIF II is driving
data onto the data bus that is coming from the USB host. So you need to use the consumer socket of the PIB and the
producer socket of the UIB.
This project allocates four buffers for this data path, and each buffer is 16384 bytes.