User guide
CY3687 MoBL-USB FX2LP18 Development Kit User Guide, Doc. # 001-68582 Rev. *B 39
MoBL-USB FX2LP18 Firmware Frameworks
descriptor in response to a get configuration descriptor request and must return its full-speed config-
uration descriptor in response to a get other-speed descriptor request.
5.4 EZ-USB Library
The EZ-USB library is an 8051 .LIB file that implements functions that are common to many firmware
projects. These functions need not be modified and are therefore provided in library form. However,
the kit includes the source code for the library in the event that you need to modify a function or if you
just want to know how something is done.
In addition to providing common functions, the library also creates register definitions for all EZ-USB
registers. The source code and the compiled .LIB file are located in the
<Installed_directory>\<Version>\Target\Lib\lp directory.
5.4.1 Building the Library
Only the full retail version of the Keil tools can build library files. The evaluation version will not build
this library. After starting the Windows Command Prompt, run setenv.bat (located in the
<Installed_directory>\<Version>\Bin directory) to set up the build environment. This
batch file assumes that you have installed the DVK and Keil tools in the default directories. To build
the library, run the build.bat file from the command prompt.
Build.bat also assembles the file usbjmptb.a51 to create usbjmptb.obj. This file contains the jump
table for the USB (INT2) and GPIF (INT4) autovectored interrupts. See the MoBL-USB Technical
Reference Manual (TRM) in the Kit documentation for more information on autovector interrupts.
5.4.2 Library Functions
5.4.2.1 EZUSB_Delay()
void EZUSB_Delay(WORD ms)
This function performs a busy wait for a given number of milliseconds. The parameter ms deter-
mines the length of the busy wait. Upon completion of the delay the function returns.
5.4.2.2 EZUSB_Discon()
void EZUSB_Discon(BOOL renum)
This function performs a USB disconnect/reconnect. It disconnects the device, delays for 1500ms,
clears any pending USB interrupts (INT2), reconnects, and then returns. The parameter renum
determines if the MoBL-USB FX2LP18 renumerate bit is set in the USB control register. If renum is
TRUE, the renumerate bit is set and following a return from this function the 8051 will be responsible
for handling all USB device requests on endpoint 0. If renum is FALSE, the renumerate bit is not
modified. If the renumerate bit is clear then the MoBL-USB FX2LP18 serial interface engine handles
most of the USB device requests on endpoint 0.
5.4.2.3 EZUSB_GetStringDscr()
STRINGDSCR xdata * EZUSB_GetStringDscr(BYTE StrIdx)
This function returns a pointer to instance StrIdx of a string descriptor in the descriptor table. The
instance is determined by the StrIdx parameter. If the descriptor table does not contain the given
number of instances then the function returns a NULL pointer.
5.4.2.4 EZUSB_Susp()
void EZUSB_Susp(void)