92
FX3 Programmers Manual, Doc. # 001-64707 Rev. *C
FX3 Application Structure
■
The next step is to register for callbacks. In this example, callbacks are registered for USB Setup
requests and USB Events.
/* The fast enumeration is the easiest way to setup a USB connection,
* where all enumeration phase is handled by the library. Only the
* class / vendor requests need to be handled by the application. */
CyU3PUsbRegisterSetupCallback(CyFxSlFifoApplnUSBSetupCB, CyTrue);
/* Setup the callback to handle the USB events. */
CyU3PUsbRegisterEventCallback(CyFxSlFifoApplnUSBEventCB);
The callback functions and the call back handling are described in later sections.
■
The USB descriptors are set. This is done by invoking the USB set descriptor call for each
descriptor.
/* Set the USB Enumeration descriptors */
/* Device Descriptor */
apiRetStatus = CyU3PUsbSetDesc(CY_U3P_USB_SET_HS_DEVICE_DESCR, NULL,
(uint8_t *)CyFxUSB20DeviceDscr);
.
.
.
The code snippet above is for setting the Device Descriptor. The other descriptors set in the example
are Device Qualifier, Other Speed, Configuration, BOS (for Super Speed) and String Descriptors.
■
The USB pins are connected. The FX3 USB device is visible to the host only after this action.
Hence it is important that all setup is completed before the USB pins are connected.
/* Connect the USB Pins */
/* Enable Super Speed operation */
apiRetStatus = CyU3PConnectState(CyTrue, CyTrue);
8.1.2.4
Endpoint Setup
The endpoint is configured on recieving a SET_CONFIGURATION request. Two endpoints 1 IN and
1 OUT are configured as bulk endpoints. The endpoint maxPacketSize is updated based on the
speed.
CyU3PUSBSpeed_t usbSpeed = CyU3PUsbGetSpeed();
/* First identify the usb speed. Once that is identified,
* create a DMA channel and start the transfer on this. */
/* Based on the Bus Speed configure the endpoint packet size */
switch (usbSpeed)
{
case CY_U3P_FULL_SPEED:
size = 64;
break;
case CY_U3P_HIGH_SPEED:
size = 512;
Содержание EX-USB FX3
Страница 8: ...8 FX3 Programmers Manual Doc 001 64707 Rev C Contents...
Страница 12: ...12 FX3 Programmers Manual Doc 001 64707 Rev C Introduction...
Страница 48: ...48 FX3 Programmers Manual Doc 001 64707 Rev C FX3 Overview...
Страница 74: ...74 FX3 Programmers Manual Doc 001 64707 Rev C FX3 Firmware...
Страница 76: ...76 FX3 Programmers Manual Doc 001 64707 Rev C FX3 APIs...
Страница 84: ...84 FX3 Programmers Manual Doc 001 64707 Rev C FX3 Application Examples...
Страница 98: ...98 FX3 Programmers Manual Doc 001 64707 Rev C FX3 Application Structure...
Страница 148: ...148 FX3 Programmers Manual Doc 001 64707 Rev C FX3 P Port Register Access...
Страница 153: ...FX3 Programmers Manual Doc 001 64707 Rev C 153 FX3 Development Tools 2 Select General Existing projects into Workspace...
Страница 165: ...FX3 Programmers Manual Doc 001 64707 Rev C 165 FX3 Development Tools Click next...
Страница 178: ...178 FX3 Programmers Manual Doc 001 64707 Rev C FX3 Development Tools Click on Apply...
Страница 180: ...180 FX3 Programmers Manual Doc 001 64707 Rev C FX3 Development Tools d Start the GDB server...
Страница 185: ...FX3 Programmers Manual Doc 001 64707 Rev C 185 FX3 Development Tools...
Страница 186: ...186 FX3 Programmers Manual Doc 001 64707 Rev C FX3 Development Tools...
Страница 187: ...FX3 Programmers Manual Doc 001 64707 Rev C 187 FX3 Development Tools...
Страница 188: ...188 FX3 Programmers Manual Doc 001 64707 Rev C FX3 Development Tools...
Страница 192: ...192 FX3 Programmers Manual Doc 001 64707 Rev C GPIF II Designer...