Specifications

8
6263A–ATARM–10-Oct-06
Application Note
This function handles double-buffering, if it is supported by the USB controller and if it has
been enabled for the endpoint. Do not forget that using double-buffering is mandatory for isoch-
ronous transactions.
3.3.4.2 USB_SendZLP0
Sending a zero-length packet (ZLP) on endpoint 0 is a common action, e.g., to acknowledge
requests when no IN data is sent. This method is a redefinition of USB_Write that provides a
simpler means of performing this kind of operation.
3.3.4.3 USB_Read
This function reads incoming data on an endpoint. The transfer stops either when the provided
buffer is full, or a short packet (size inferior to the endpoint maximum packet size) is received.
This method must only be called on an OUT or Control endpoint.
The read is performed asynchronously, i.e., the function returns immediately without waiting
for the transfer to finish. When the transfer is complete, an optional user-provided callback func-
tion is called. This makes it possible to create an OS-friendly synchronous function by locking
and unlocking a semaphore before and after each read.
This function handles double-buffering, if it is supported by the USB controller and if it has
been enabled for the endpoint. Do not forget that using double-buffering is mandatory for isoch-
ronous transactions.
3.3.5 Special Functions
3.3.5.1 USB_RemoteWakeUp
The USB_RemoteWakeUp method starts a remote wakeup procedure. This makes it possible
for a suspended device to wake a host which may itself be suspended.
3.4 Callback API
The callback API is a means of communication between the user application and the USB API.
When particular operations must be performed, the USB driver calls several external functions,
referred to as callbacks. They can also be invoked to notify the user application of pending
events.
Defining all callbacks is not mandatory. For example, if the device shall not enter low-power
mode, then it is appropriate not to provide a Suspend callback. If a callback is mandatory, this is
notified in its description.
3.4.1 Callback Invocation
The following events can trigger a callback:
USB initialization
End of bus reset
Device suspend
Device resume
SETUP request received
Start of a new USB frame