1 /* -----------------------------------------------------------------------------
2 * Copyright (c) 2013-2014 ARM Limited. All rights reserved.
4 * $Date: 2. January 2014
7 * Project: USB Driver API
8 * -------------------------------------------------------------------------- */
12 \defgroup usb_interface_gr USB Interface
13 \brief USB common definitions (%Driver_USB.h)
15 The <b>Universal Serial Bus</b> (USB) implements a serial bus for data exchange. It is a host controlled, plug-and-play interface
16 between a USB host and USB devices using a tiered star topology.
17 In microcontroller (MCU) applications, the interface is often used to connect a device to a host for data exchange or control purposes.
19 - Wikipedia offers more information about the <a href="http://en.wikipedia.org/wiki/Universal_Serial_Bus" target="_blank"><b>Universal Serial Bus</b></a>.
20 - The USB Implementers Forum provides detailed documentation under <a href="http://www.usb.org"><b>www.usb.org</b></a>.
25 Typically only one USB Device is connected to a USB Host. If several USB devices must be connected to the same USB host, then
26 the connection must be done via a USB hub.
29 \image html USB_Schematics.png "Simplified USB Schema"
35 The following header files define the Application Programming Interface (API) for the USB interface:
36 - \b %Driver_USB.h : Common definitions of the USBD and USBH interface
37 - \b %Driver_USBD.h : Driver API for USB Device Peripheral
38 - \b %Driver_USBH.h : Driver API for USB Host Peripheral
40 The driver implementation is a typical part of the Device Family Pack (DFP) that supports the
41 peripherals of the microcontroller family.
44 <b>Driver Functions</b>
46 The driver functions are published in the access struct as explained in \ref DriverFunctions
47 - \ref ARM_DRIVER_USBD : access struct for USBD driver functions
48 - \ref ARM_DRIVER_USBH : access struct for USBH driver functions
51 A typical setup sequence for the driver is shown below:
64 \addtogroup usbd_interface_gr
65 \ingroup usb_interface_gr
70 The header file \b Driver_USBD.h defines the API for the <b>USB Device Driver</b> interface used by middleware components.
71 The driver implementation itself is a typical part of the Device Family Pack, which provides entry points to the interface
72 as function pointers in the struct \ref ARM_DRIVER_USBD. This structure can be available several times in each interface to control multiple USBD interfaces.
74 Header file \b Driver_USBD.h also defines callback routines that can be categorized as
75 <b>device event callbacks</b> and <b>endpoint event callbacks</b>.
76 Callbacks are called by the driver, in interrupt context when an appropriate event occurs, to signal device related events (\ref USBD_dev_events)
77 and endpoint related events (\ref USBD_ep_events).
80 <b>USB Device Function Call Sequence</b>
82 To use the USBD driver invoke the API functions in the following order:
85 a [label="", textcolor="indigo", linecolor="indigo", arclinecolor="red"],
86 b [label="", textcolor="blue", linecolor="blue", arclinecolor="blue"];
88 a rbox a [label="Middleware", linecolor="indigo"],
89 b rbox b [label="USBD Driver", linecolor="blue"];
90 a=>b [label="ARM_USBD_Initialize", URL="\ref ARM_USBD_Initialize"];
91 a=>b [label="ARM_USBD_PowerControl (ARM_POWER_FULL)", URL="\ref ARM_USBD_Initialize"];
92 a=>b [label="ARM_USBD_DeviceConnect", URL="\ref ARM_USBD_DeviceConnect"];
93 a<=b [label="ARM_USBD_SignalDeviceEvent (ARM_USBD_EVENT_RESET)", URL="\ref ARM_USBD_SignalDeviceEvent", linecolor="orange"];
94 a=>b [label="ARM_USBD_DeviceGetState", URL="\ref ARM_USBD_DeviceGetState"];
95 a=>b [label="ARM_USBD_EndpointConfigure", URL="\ref ARM_USBD_EndpointConfigure", linecolor="green"];
96 --- [label="Repeat and use as needed"];
97 a=>b [label="ARM_USBD_EndpointTransfer", URL="\ref ARM_USBD_EndpointTransfer", linecolor="green"];
98 a<=b [label="ARM_USBD_SignalEndpointEvent", URL="\ref ARM_USBD_SignalEndpointEvent", linecolor="orange"];
99 a=>b [label="ARM_USBD_EndpointTransferGetResult", URL="\ref ARM_USBD_EndpointTransferGetResult", linecolor="green"];
100 --- [label="Repeat End"];
101 a=>b [label="ARM_USBD_DeviceDisconnect", URL="\ref ARM_USBD_DeviceDisconnect"];
102 a=>b [label="ARM_USBD_PowerControl (ARM_POWER_OFF)", URL="\ref ARM_USBD_Initialize"];
103 a=>b [label="ARM_USBD_Uninitialize", URL="\ref ARM_USBD_Uninitialize"];
109 \addtogroup usbh_interface_gr
110 \ingroup usb_interface_gr
114 The header file \b Driver_USBH.h defines the API for the <b>USB Host Driver</b> interface used by middleware components.
115 The driver implementation itself is a typical part of the Device Family Pack, which provides entry points to the interface
116 as function pointers in the struct \ref ARM_DRIVER_USBH. This structure can be available several times in each interface to control multiple USBH interfaces.
118 \b Driver_USBH.h also defines callback routines, which are categorized in
119 <b>port event callbacks</b> and <b>pipe event callbacks</b>.
120 Callbacks are called by the driver, in interrupt context when an appropriate event occurs, to signal port related events (\ref ARM_USBH_SignalPortEvent)
121 and pipe related events (\ref ARM_USBH_SignalPipeEvent).
125 <b>USB Host Function Call Sequence</b>
127 To use the USBH driver invoke the API functions in the following order:
130 a [label="", textcolor="indigo", linecolor="indigo", arclinecolor="red"],
131 b [label="", textcolor="blue", linecolor="blue", arclinecolor="blue"];
133 a rbox a [label="Middleware", linecolor="indigo"],
134 b rbox b [label="USBH Driver", linecolor="blue"];
135 a=>b [label="ARM_USBH_Initialize", URL="\ref ARM_USBD_Initialize"];
136 --- [label="Repeat and use as needed"];
137 --- [label="Repeat End"];
138 a=>b [label="ARM_USBH_Uninitialize", URL="\ref ARM_USBH_Uninitialize"];
148 \defgroup USB_speed USB Speed
149 \ingroup usb_interface_gr
150 \brief USB Speed definitions
152 The following USB speed values are defined:
154 \def ARM_USB_SPEED_LOW
155 \def ARM_USB_SPEED_FULL
156 \def ARM_USB_SPEED_HIGH
161 \defgroup USB_endpoint_type USB Endpoint Type
162 \ingroup usb_interface_gr
163 \brief USB Endpoint Type definitions
165 The following USB Endpoint Type values are defined:
167 \def ARM_USB_ENDPOINT_CONTROL
168 \def ARM_USB_ENDPOINT_ISOCHRONOUS
169 \def ARM_USB_ENDPOINT_BULK
170 \def ARM_USB_ENDPOINT_INTERRUPT