USBXpress#
USBXpress interface library.
Introduction#
This module provides a firmware interface which communicates with the Silicon Labs USBXpress driver and allows firmware to interact with host programs via the USBXpress DLL.
Theory of operation:#
The USBxpress library interfaces with the Silicon Labs USBXpress drivers. The interface consists of two data transmission pipes (RX and TX) which are used to send and receive data.
Data#
Data reception and transmission is handled with USBX_blockRead() and USBX_blockWrite(). Upon completion of a sent or received transfer the user is called back with USBX_RX_COMPLETE or USBX_TX_COMPLETE. If the user calls USBX_blockRead() with a numBytes value smaller than the number of bytes received in the transfer, the user is called back with both USBX_RX_COMPLETE and USBX_RX_OVERRUN set.
Additional Resources#
This driver sits on top of the EFM32 USB Library.
Interrupts#
This library handles USB interrupts and will enable USB interrupts at its discretion. It will NOT enable global interrupts and the user is responsible for enabling global interrupts.
Modules#
Typedefs#
Define user API call-back function with:
Typedef Documentation#
USBX_apiCallback_t#
typedef void(* USBX_apiCallback_t) (void) )(void)
Define user API call-back function with:
void my_callback(void) {}
then pass it to USBX_apiCallbackEnable() with:
USBX_apiCallbackEnable(my_callback);
Warnings
The call-back routine is called by the USBXpress library from within the USB interrupt. It should run as quickly as possible.
If timing becomes an issue, consider using the call-back routine to set user-defined flags that may be serviced in the project's main loop. Additionally note that the call-back routine will be called for every call-back source, whether or not the user checks for that call-back source. All code except variable declarations and the USBX_getCallbackSource() call should check for a pertinent call-back source (see the Status Flags section for all call-back sources).