Specifications
15
6263A–ATARM–10-Oct-06
Application Note
Endpoints can be configured to have a specific number of FIFO banks (depending on the USB
controller peripheral), each endpoint must be specified as either single- or dual-bank (see Sec-
tion 3.2.3 on page 3).
In the present case, endpoint 0 can only be a single-bank endpoint according to the UDP con-
troller specification:
// Endpoints
static S_usb_endpoint pEndpoints[] = {
// Control endpoint 0
USB_ENDPOINT_SINGLEBANK,
};
5.2.1.2 Callbacks
A S_usb_callbacks (see Section 3.2.4 on page 3) global variable must be declared with pointers
to the used callbacks (or null values).
In this example, all callbacks except Reset and StartOfFrame will be used, so the variable will be
declared as follows:
// Callbacks
static const S_usb_callbacks sCallbacks = {
CBK_Init,
0,
CBK_Suspend,
CBK_Resume,
CBK_NewRequest,
0
};
Details about the actual implementation of the callbacks can be found in Section 5.4.
5.2.1.3 Driver
Depending on the chip used, there may or may not be a need to declare a low-level driver
variable.
Since a chip may have more than one USB controller, it is necessary to specify which one will be
used by the USB API (hence the need for the S_usb_driver structure). However, most chips only
have one controller; a default driver is provided for those chips.
This default driver global variable is simply called sDefaultDriver, and will be sufficient for this
example.
5.2.1.4 Setup Request
The last received SETUP packet is stored in the S_usb instance. However, since S_usb can be
a constant object (to save memory), only a pointer to a S_usb_request instance is stored. The
actual object must thus be defined manually:
static S_usb_request sSetup;
5.2.1.5 USB
Finally, a S_usb instance holding pointers to all the previous declared variables must be defined: