Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Inaky Perez-Gonzalez | 672027a | 2007-02-22 16:37:53 -0800 | [diff] [blame] | 2 | * This file holds USB constants and structures that are needed for |
| 3 | * USB device APIs. These are used by the USB device model, which is |
| 4 | * defined in chapter 9 of the USB 2.0 specification and in the |
| 5 | * Wireless USB 1.0 (spread around). Linux has several APIs in C that |
| 6 | * need these: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | * |
| 8 | * - the master/host side Linux-USB kernel driver API; |
| 9 | * - the "usbfs" user space API; and |
David Brownell | 5da0106 | 2005-05-31 10:21:11 -0700 | [diff] [blame] | 10 | * - the Linux "gadget" slave/device/peripheral side driver API. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | * |
| 12 | * USB 2.0 adds an additional "On The Go" (OTG) mode, which lets systems |
| 13 | * act either as a USB master/host or as a USB slave/device. That means |
David Brownell | 5da0106 | 2005-05-31 10:21:11 -0700 | [diff] [blame] | 14 | * the master and slave side APIs benefit from working well together. |
| 15 | * |
| 16 | * There's also "Wireless USB", using low power short range radios for |
| 17 | * peripheral interconnection but otherwise building on the USB framework. |
Inaky Perez-Gonzalez | 672027a | 2007-02-22 16:37:53 -0800 | [diff] [blame] | 18 | * |
| 19 | * Note all descriptors are declared '__attribute__((packed))' so that: |
| 20 | * |
| 21 | * [a] they never get padded, either internally (USB spec writers |
| 22 | * probably handled that) or externally; |
| 23 | * |
| 24 | * [b] so that accessing bigger-than-a-bytes fields will never |
| 25 | * generate bus errors on any platform, even when the location of |
| 26 | * its descriptor inside a bundle isn't "naturally aligned", and |
| 27 | * |
| 28 | * [c] for consistency, removing all doubt even when it appears to |
| 29 | * someone that the two other points are non-issues for that |
| 30 | * particular descriptor type. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | #ifndef __LINUX_USB_CH9_H |
| 33 | #define __LINUX_USB_CH9_H |
| 34 | |
David Howells | 5e1ddb4 | 2012-10-09 09:49:07 +0100 | [diff] [blame] | 35 | #include <uapi/linux/usb/ch9.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | |
Michal Nazarewicz | e538dfd | 2011-08-30 17:11:19 +0200 | [diff] [blame] | 37 | |
| 38 | /** |
| 39 | * usb_speed_string() - Returns human readable-name of the speed. |
| 40 | * @speed: The speed to return human-readable name for. If it's not |
| 41 | * any of the speeds defined in usb_device_speed enum, string for |
| 42 | * USB_SPEED_UNKNOWN will be returned. |
| 43 | */ |
| 44 | extern const char *usb_speed_string(enum usb_device_speed speed); |
| 45 | |
Felipe Balbi | d1e3d75 | 2013-01-24 22:29:48 +0200 | [diff] [blame] | 46 | |
| 47 | /** |
| 48 | * usb_state_string - Returns human readable name for the state. |
| 49 | * @state: The state to return a human-readable name for. If it's not |
| 50 | * any of the states devices in usb_device_state_string enum, |
| 51 | * the string UNKNOWN will be returned. |
| 52 | */ |
| 53 | extern const char *usb_state_string(enum usb_device_state state); |
| 54 | |
Robert P. J. Day | dda43a0 | 2008-03-07 13:45:32 -0500 | [diff] [blame] | 55 | #endif /* __LINUX_USB_CH9_H */ |