EasyManua.ls Logo

Cypress EX-USB FX3 - Page 90

Cypress EX-USB FX3
192 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
90 FX3 Programmers Manual, Doc. # 001-64707 Rev. *C
FX3 Application Structure
/* Initialize the slave FIFO application */
CyFxSlFifoApplnInit();
for (;;)
{
CyU3PThreadSleep (1000);
if (glIsApplnActive)
{
/* Print the number of buffers received so far from the USB
host. */
CyU3PDebugPrint (6, "Data tracker: buffers received: %d, buf-
fers sent: %d.\n",
glDMARxCount, glDMATxCount);
}
}
}
The main actions performed in this thread are:
1. Initializing the debug mechanism
2. Initializing the main slave FIFO application
Each of these steps is explained below
8.1.2.2 Debug Initialization
The debug module uses the UART to output the debug messages. The UART has to be first
configured before the debug mechanism is initialized. This is done by invoking the UART init
function.
/* Initialize the UART for printing debug messages */
apiRetStatus = CyU3PUartInit();
The next step is to configure the UART. The UART data structure is first filled in and this is
passed to the UART SetConfig function.
/* Set UART Configuration */
uartConfig.baudRate = CY_U3P_UART_BAUDRATE_115200;
uartConfig.stopBit = CY_U3P_UART_ONE_STOP_BIT;
uartConfig.parity = CY_U3P_UART_NO_PARITY;
uartConfig.txEnable = CyTrue;
uartConfig.rxEnable = CyFalse;
uartConfig.flowCtrl = CyFalse;
uartConfig.isDma = CyTrue;
apiRetStatus = CyU3PUartSetConfig (&uartConfig, NULL);
The UART transfer size is set next. This is configured to be infinite in size, so that the total debug
prints are not limited to any size.
/* Set the UART transfer */
apiRetStatus = CyU3PUartTxSetBlockXfer (0xFFFFFFFF);
Finally the Debug module is initialized. The two main parameters are:
The destination for the debug prints, which is the UART socket

Table of Contents