FX3 Programmers Manual, Doc. # 001-64707 Rev. *C 89
FX3 Application Structure
8.1.1.4 Application Definition
The function CyFxApplicationDefine() is called by the FX3 library after the OS is invoked. In this
function application specific threads are created.
In the Slave FIFO example, only one thread is created in the application define function. This is
shown below:
/* Allocate the memory for the thread */
ptr = CyU3PMemAlloc (CY_FX_SLFIFO_THREAD_STACK);
/* Create the thread for the application */
retThrdCreate = CyU3PThreadCreate (&slFifoAppThread,
/* Slave FIFO app thread structure */
"21:Slave_FIFO_sync",
/* Thread ID and thread name */
SlFifoAppThread_Entry,
/* Slave FIFO app thread entry function */
0,
/* No input parameter to thread */
ptr,
/* Pointer to the allocated thread stack */
CY_FX_SLFIFO_THREAD_STACK,
/* App Thread stack size */
CY_FX_SLFIFO_THREAD_PRIORITY,
/* App Thread priority */
CY_FX_SLFIFO_THREAD_PRIORITY,
/* App Thread pre-emption threshold */
CYU3P_NO_TIME_SLICE,
/* No time slice for the application thread */
CYU3P_AUTO_START
/* Start the thread immediately */
);
Note that more threads (as required by the user application) can be created in the application define
function. All other FX3 specific programming must be done only in the user threads.
8.1.2 Application Code
In the Slave FIFO example, 2 Manual DMA channels are set up:
■ A U to P DMA channel connects the USB Producer (OUT) endpoint to the Consumer P-port
socket.
■ A P to U DMA channel connects the Producer P-port socket to the USB Consumer (IN) Endpoint.
8.1.2.1 Application Thread
The Application entry point for the Slave FIFO example is the SlFifoAppThread_Entry () function.
void
SlFifoAppThread_Entry (
uint32_t input)
{
/* Initialize the debug module */
CyFxSlFifoApplnDebugInit();