English
Language : 

UM0463 Datasheet, PDF (27/30 Pages) STMicroelectronics – ST7 full-speed USB library
UM0463
The library package and its configuration
7.3
Application interface to the library
The application code has to provide some values to the library to execute the state machine.
The library uses callback functions to perform the operation and all callback functions are
implemented by direct function calls which are defined in user_usb.h. These callback
functions are listed in Table 9.
Table 9. Call back functions
Function name
USER_USB_Reset()
USER_USB_Setup()
USER_USB_CopydataIN()
USER_USB_CopydataOUT()
USER_USB_Status_In()
USER_USB_Status_Out()
USER_USB_Set_Configuration()
USER_USB_Set_Interface()
USER_USB_Get_Interface()
USER_USB_Clear_Feature_EP()
USER_USB_Set_Feature_EP()
USER_USB_SOF()
USER_USB_Suspend()
USER_USB_ESuspend()
Description
Called when a USB Reset is received by the device.
All user-interpreted requests are parsed in this function.
Used to copy data to the endpoint DMA buffer EP0_IN for
each data packet of data IN stage.
Used to copy data from the endpoint DMA buffer
EP0_OUT for each data packet of data OUT stage.
Called when a status IN stage is executed for all the
requests except Set Address.
Called when a status OUT stage is executed for all the
requests.
The user code has to configure the device as specified.
The user code has to set the alternative setting of an
interface as specified.
The user code has to return the alternative setting of an
interface as specified.
The user code is informed that the specified endpoint
STALL condition is cleared.
The user code is informed that the specified endpoint is set
as STALL.
Called every time a start of frame (SOF) token arrives on
USB given SOF interrupt is enabled.
Called when suspend request is received by the device
from the USB.
Called when the device is in suspended state and activity
on USB bus is detected
Four variables are there for the application to pass some configuration values to the library:
● USB_Num_Configuration: number of configuration
● USB_Num_Interface: number of interface
● USB_Interrupt_Mask: the value for the USB interrupt mask register
● DescTabPtr: pointer to actual descriptor table
These variables must be set in (or prior to) the "USER_USB_Reset" function.
27/30