summaryrefslogtreecommitdiff
path: root/include/usb.h
diff options
context:
space:
mode:
authorTodd Broch <tbroch@chromium.org>2014-10-03 17:22:42 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-10-11 02:22:23 +0000
commit44e4f7cfe7953198091cfd5e39bf339a770138dc (patch)
treebce95eac678d68d40be59276b4aaf94a488cea25 /include/usb.h
parent4d81320ed8b5f8231759d1608183a0daf233ea45 (diff)
downloadchrome-ec-44e4f7cfe7953198091cfd5e39bf339a770138dc.tar.gz
usb: Groundwork for USB BOS & Billboard class descriptors.
The BOS (Binary Device Object Store) descriptor was added to the USB specification (3.0) to allow a richer set of device capability specific descriptors. The Billboard class is meant to expose (read-only) the status of USB devices capable of alternate mode functions. It's required to use the BOS descriptor type and at a high level looks like: - BOS Device Descriptor (5bytes) - Container ID Device Capability Descriptor (20bytes) - Billboard Device Capability Descriptor (44byte + 4 * numSVIDs) This CL adds: 1. Ability for Get Descriptor on BOS descriptors. Note hidden behind CONFIG_USB_BOS as these descriptors change USB device requirements to: - bcdUSB >= 0201 - no interface descriptors 2. structures for all BOS, Container & Billboard descriptor elements complete w/ CamelCase. BRANCH=none BUG=chrome-os-partner:32652 TEST=compiles with CONFIG_USB & CONFIG_USB_BOS enabled. Change-Id: I1b24bc728f2ebba7d91840801d2ebe576e240e7c Signed-off-by: Todd Broch <tbroch@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/221570
Diffstat (limited to 'include/usb.h')
-rw-r--r--include/usb.h46
1 files changed, 45 insertions, 1 deletions
diff --git a/include/usb.h b/include/usb.h
index d43450d7cd..3d63efa60e 100644
--- a/include/usb.h
+++ b/include/usb.h
@@ -24,6 +24,8 @@
#define USB_DT_OTHER_SPEED_CONFIG 0x07
#define USB_DT_INTERFACE_POWER 0x08
#define USB_DT_DEBUG 0x0a
+#define USB_DT_BOS 0x0f
+#define USB_DT_DEVICE_CAPABILITY 0x10
/* USB Device Descriptor */
struct usb_device_descriptor {
@@ -44,6 +46,46 @@ struct usb_device_descriptor {
} __packed;
#define USB_DT_DEVICE_SIZE 18
+/* BOS Descriptor ( USB3.1 rev1 Section 9.6.2 ) */
+struct bos_context {
+ void *descp;
+ int size;
+};
+
+struct usb_bos_hdr_descriptor {
+ uint8_t bLength;
+ uint8_t bDescriptorType; /* USB_DT_BOS */
+ uint16_t wTotalLength; /* Total length of of hdr + all dev caps */
+ uint8_t bNumDeviceCaps; /* Container ID Descriptor + others */
+} __packed;
+#define USB_DT_BOS_SIZE 5
+
+/* Container ID Descriptor */
+struct usb_contid_caps_descriptor {
+ uint8_t bLength;
+ uint8_t bDescriptorType; /* USB_DT_DEVICE_CAPABILITY */
+ uint8_t bDevCapabilityType; /* USB_DC_DTYPE_xxx */
+ uint8_t bReserved; /* SBZ */
+ uint8_t ContainerID[16]; /* UUID */
+} __packed;
+#define USB_DT_CONTID_SIZE 20
+
+/* Device Cap Type Codes ( offset 2 of Device Capability Descriptor */
+#define USB_DC_DTYPE_WIRELESS 0x01
+#define USB_DC_DTYPE_USB20EXT 0x02
+#define USB_DC_DTYPE_USBSS 0x03
+#define USB_DC_DTYPE_CONTID 0x04
+#define USB_DC_DTYPE_PLATFORM 0x05
+#define USB_DC_DTYPE_PD 0x06
+#define USB_DC_DTYPE_BATTINFO 0x07
+#define USB_DC_DTYPE_CONSUMER 0x08
+#define USB_DC_DTYPE_PRODUCER 0x09
+#define USB_DC_DTYPE_USBSSP 0x0a
+#define USB_DC_DTYPE_PCSTIME 0x0b
+#define USB_DC_DTYPE_WUSBEXT 0x0c
+#define USB_DC_DTYPE_BILLBOARD 0x0d
+/* RESERVED 0x00, 0xOe - 0xff */
+
/* Configuration Descriptor */
struct usb_config_descriptor {
uint8_t bLength;
@@ -103,6 +145,7 @@ struct usb_endpoint_descriptor {
#define USB_CLASS_CSCID 0x0b
#define USB_CLASS_CONTENT_SEC 0x0d
#define USB_CLASS_VIDEO 0x0e
+#define USB_CLASS_BILLBOARD 0x11
#define USB_CLASS_WIRELESS_CONTROLLER 0xe0
#define USB_CLASS_MISC 0xef
#define USB_CLASS_APP_SPEC 0xfe
@@ -211,9 +254,10 @@ static inline void memcpy_usbram(usb_uint *ebuf, const uint8_t *src, int size)
(((uint32_t)(x) - (uint32_t)__usb_ram_start) \
/ (sizeof(usb_uint)/sizeof(uint16_t)))
-/* String descriptors are defined in the board code */
+/* These descriptors defined in board code */
extern const void * const usb_strings[];
extern const uint8_t usb_string_desc[];
+extern struct bos_context bos_ctx;
/* Helpers for endpoint declaration */