4.1 External API from UDC

The external UDC API allows the application to manage common USB device behavior and receive common USB device events. These controls and events are common to any USB application.

Figure 4-2. External API from UDC
Table 4-1. External API from UDC – Input
DeclarationDescription
udc_start()Start USB device stack
udc_stop()Stop USB device stack

udc_attach()


udc_detach()

Authorize the device enumeration or not.

Enable pull-up on DM or DP.

udc_remotewakeup()Wake-up the USB device

All UDC callbacks are optional and defined by user in usb_conf.h for each application. When defined, the callbacks will be called by the UDD ISR.

Table 4-2. External API from UDC – Callback.
Define nameDescription
UDC_VBUS_EVENT(bool b_present)To notify VBUS level change (only if USB hardware includes VBUS monitoring)
UDC_SUSPEND_EVENT()Called when USB enters in Suspend mode
UDC_RESUME_EVENT()Called when USB wakes-up
UDC_SOF_EVENT()Called for each received SOF each 1ms
 Note: Available in High and Full Speed mode
UDC_REMOTEWAKEUP_ENABLE()Called when USB host requests to enable/disable remote wake-up feature when the device supports it
UDC_REMOTEWAKEUP_DISABLE()
UDC_GET_EXTRA_STRING()When an extra string descriptor must be supported (other than manufacturer, a product and serial string)
UDC_SPECIFIC_REQUEST()When a specific device setup request must be supported