[usb] Reorganize USB hardware header files to be compatible with banjo
Banjo prefers usb/foo.h to usb-foo.h.
Move Banjo overlay for usb_hub_descriptor_t to a separate library.
Leave redirect headers for usb-cdc.h and usb-video.h until garnet drivers
no longer use them.
TEST: garnet builds, USB works on NUC.
Change-Id: Iea910971049bc01563816c65f2bf0b6c8842f4e8
diff --git a/system/banjo/ddk-protocol-usb-bus/rules.mk b/system/banjo/ddk-protocol-usb-bus/rules.mk
index b695d75..392fe9a 100644
--- a/system/banjo/ddk-protocol-usb-bus/rules.mk
+++ b/system/banjo/ddk-protocol-usb-bus/rules.mk
@@ -20,6 +20,7 @@
system/banjo/ddk-driver \
system/banjo/ddk-protocol-usb-hub \
system/banjo/zircon-hw-usb \
+ system/banjo/zircon-hw-usb-hub \
include make/module.mk
diff --git a/system/banjo/ddk-protocol-usb-bus/usb-bus.banjo b/system/banjo/ddk-protocol-usb-bus/usb-bus.banjo
index ebf4e45..c52d8ea 100644
--- a/system/banjo/ddk-protocol-usb-bus/usb-bus.banjo
+++ b/system/banjo/ddk-protocol-usb-bus/usb-bus.banjo
@@ -8,6 +8,7 @@
using ddk.driver;
using ddk.protocol.usb.hub;
using zircon.hw.usb;
+using zircon.hw.usb.hub;
enum UsbSpeed : uint32 {
};
@@ -16,7 +17,7 @@
interface UsbBus {
/// Configures a new hub based on its USB hub descriptor.
ConfigureHub(ddk.driver.ZxDevice? hub_device, UsbSpeed speed,
- zircon.hw.usb.UsbHubDescriptor desc) -> (zx.status s);
+ zircon.hw.usb.hub.UsbHubDescriptor desc) -> (zx.status s);
/// Informs the USB bus that a new device has been added.
DeviceAdded(ddk.driver.ZxDevice? hub_device, uint32 port, UsbSpeed speed) -> (zx.status s);
/// Informs the USB bus that a device has been removed.
diff --git a/system/banjo/ddk-protocol-usb-hci/rules.mk b/system/banjo/ddk-protocol-usb-hci/rules.mk
index f79f19f..99bb693 100644
--- a/system/banjo/ddk-protocol-usb-hci/rules.mk
+++ b/system/banjo/ddk-protocol-usb-hci/rules.mk
@@ -17,6 +17,7 @@
MODULE_BANJO_DEPS := \
system/banjo/ddk-driver \
system/banjo/zircon-hw-usb \
+ system/banjo/zircon-hw-usb-hub \
system/banjo/ddk-protocol-usb-request \
system/banjo/ddk-protocol-usb-hub \
system/banjo/ddk-protocol-usb-bus \
diff --git a/system/banjo/ddk-protocol-usb-hci/usb-hci.banjo b/system/banjo/ddk-protocol-usb-hci/usb-hci.banjo
index 51765ea..10867e9 100644
--- a/system/banjo/ddk-protocol-usb-hci/usb-hci.banjo
+++ b/system/banjo/ddk-protocol-usb-hci/usb-hci.banjo
@@ -4,10 +4,11 @@
library ddk.protocol.usb.hci;
+using zx;
using ddk.protocol.usb.bus;
using ddk.protocol.usb.request;
using zircon.hw.usb;
-using zx;
+using zircon.hw.usb.hub;
[Layout="ddk-protocol"]
interface UsbHci {
@@ -25,7 +26,7 @@
GetCurrentFrame() -> (uint64 frame);
/// Used by the USB hub driver to configure a newly enumerated USB hub.
ConfigureHub(uint32 device_id, zircon.hw.usb.UsbSpeed speed,
- zircon.hw.usb.UsbHubDescriptor descriptor) -> (zx.status s);
+ zircon.hw.usb.hub.UsbHubDescriptor desc) -> (zx.status s);
/// Used by the USB hub driver to notify the HCI driver when a new device is attached.
HubDeviceAdded(uint32 device_id, uint32 port, zircon.hw.usb.UsbSpeed speed) -> (zx.status s);
/// Used by the USB hub driver to notify the HCI driver when a device has been removed.
diff --git a/system/banjo/zircon-hw-usb-hub/rules.mk b/system/banjo/zircon-hw-usb-hub/rules.mk
new file mode 100644
index 0000000..bc8e288
--- /dev/null
+++ b/system/banjo/zircon-hw-usb-hub/rules.mk
@@ -0,0 +1,20 @@
+# Copyright 2018 The Fuchsia Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+LOCAL_DIR := $(GET_LOCAL_DIR)
+
+MODULE := $(LOCAL_DIR)
+
+MODULE_TYPE := banjo
+
+MODULE_PACKAGE := banjo
+
+MODULE_BANJO_LIBRARY := zircon.hw.usb.hub
+
+MODULE_BANJO_NAME := usb/hub
+
+MODULE_SRCS += $(LOCAL_DIR)/usb-hub.banjo
+
+include make/module.mk
+
diff --git a/system/banjo/zircon-hw-usb-hub/usb-hub.banjo b/system/banjo/zircon-hw-usb-hub/usb-hub.banjo
new file mode 100644
index 0000000..37e971d
--- /dev/null
+++ b/system/banjo/zircon-hw-usb-hub/usb-hub.banjo
@@ -0,0 +1,18 @@
+// Copyright 2018 The Fuchsia Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+library zircon.hw.usb.hub;
+
+using zx;
+
+[Packed, repr="C"]
+struct UsbHubDescriptor {
+ uint8 bDescLength;
+ uint8 bDescriptorType;
+ uint8 bNbrPorts;
+ uint16 wHubCharacteristics;
+ uint8 bPowerOn2PwrGood;
+ uint8 bHubContrCurrent;
+ // Variable length union below, which we are ignoring here for now.
+};
diff --git a/system/banjo/zircon-hw-usb/usb.banjo b/system/banjo/zircon-hw-usb/usb.banjo
index abc154c..a2f8118 100644
--- a/system/banjo/zircon-hw-usb/usb.banjo
+++ b/system/banjo/zircon-hw-usb/usb.banjo
@@ -79,14 +79,3 @@
uint8 bmAttributes;
uint16 wBytesPerInterval;
};
-
-[Packed, repr="C"]
-struct UsbHubDescriptor {
- uint8 bDescLength;
- uint8 bDescriptorType;
- uint8 bNbrPorts;
- uint16 wHubCharacteristics;
- uint8 bPowerOn2PwrGood;
- uint8 bHubContrCurrent;
- // Variable length union below, which we are ignoring here for now.
-};
diff --git a/system/dev/audio/usb-audio/binding.c b/system/dev/audio/usb-audio/binding.c
index e2ad739..417fb90 100644
--- a/system/dev/audio/usb-audio/binding.c
+++ b/system/dev/audio/usb-audio/binding.c
@@ -6,7 +6,7 @@
#include <ddk/driver.h>
#include <ddk/binding.h>
#include <zircon/hw/usb.h>
-#include <zircon/hw/usb-audio.h>
+#include <zircon/hw/usb/audio.h>
extern zx_status_t usb_audio_device_bind(void*, zx_device_t*);
extern void usb_audio_driver_release(void*);
diff --git a/system/dev/audio/usb-audio/usb-audio-control-interface.h b/system/dev/audio/usb-audio/usb-audio-control-interface.h
index a8fadca..8cc1d6a 100644
--- a/system/dev/audio/usb-audio/usb-audio-control-interface.h
+++ b/system/dev/audio/usb-audio/usb-audio-control-interface.h
@@ -7,7 +7,7 @@
#include <fbl/intrusive_double_list.h>
#include <fbl/intrusive_wavl_tree.h>
#include <fbl/unique_ptr.h>
-#include <zircon/hw/usb-audio.h>
+#include <zircon/hw/usb/audio.h>
#include "usb-audio-descriptors.h"
#include "usb-audio-path.h"
diff --git a/system/dev/audio/usb-audio/usb-audio-stream-interface.h b/system/dev/audio/usb-audio/usb-audio-stream-interface.h
index 85855e6..9c2a52d 100644
--- a/system/dev/audio/usb-audio/usb-audio-stream-interface.h
+++ b/system/dev/audio/usb-audio/usb-audio-stream-interface.h
@@ -7,7 +7,7 @@
#include <fbl/intrusive_double_list.h>
#include <fbl/vector.h>
#include <zircon/device/audio.h>
-#include <zircon/hw/usb-audio.h>
+#include <zircon/hw/usb/audio.h>
#include <utility>
diff --git a/system/dev/audio/usb-audio/usb-audio-stream.cpp b/system/dev/audio/usb-audio/usb-audio-stream.cpp
index 1f6cfb6..effd9f1 100644
--- a/system/dev/audio/usb-audio/usb-audio-stream.cpp
+++ b/system/dev/audio/usb-audio/usb-audio-stream.cpp
@@ -13,7 +13,7 @@
#include <string.h>
#include <usb/usb-request.h>
#include <utility>
-#include <zircon/hw/usb-audio.h>
+#include <zircon/hw/usb/audio.h>
#include <zircon/process.h>
#include <zircon/time.h>
#include <zircon/types.h>
diff --git a/system/dev/audio/usb-audio/usb-audio-units.h b/system/dev/audio/usb-audio/usb-audio-units.h
index d050e0f..0c1effa 100644
--- a/system/dev/audio/usb-audio/usb-audio-units.h
+++ b/system/dev/audio/usb-audio/usb-audio-units.h
@@ -9,7 +9,7 @@
#include <fbl/macros.h>
#include <fbl/ref_counted.h>
#include <fbl/ref_ptr.h>
-#include <zircon/hw/usb-audio.h>
+#include <zircon/hw/usb/audio.h>
#include <utility>
diff --git a/system/dev/audio/usb-audio/usb-audio.h b/system/dev/audio/usb-audio/usb-audio.h
index 89e8394..1075948 100644
--- a/system/dev/audio/usb-audio/usb-audio.h
+++ b/system/dev/audio/usb-audio/usb-audio.h
@@ -8,7 +8,7 @@
#include <ddk/usb/usb.h>
#include <zircon/compiler.h>
#include <zircon/hw/usb.h>
-#include <zircon/hw/usb-audio.h>
+#include <zircon/hw/usb/audio.h>
#if __cplusplus
#include <fbl/array.h>
diff --git a/system/dev/block/ums-function/ums-function.c b/system/dev/block/ums-function/ums-function.c
index 7aec6e1..f0a348b 100644
--- a/system/dev/block/ums-function/ums-function.c
+++ b/system/dev/block/ums-function/ums-function.c
@@ -18,7 +18,7 @@
#include <zircon/process.h>
#include <zircon/syscalls.h>
#include <zircon/device/usb-peripheral.h>
-#include <zircon/hw/usb-mass-storage.h>
+#include <zircon/hw/usb/ums.h>
#define BLOCK_SIZE 512
#define STORAGE_SIZE (10 * 1024 * 1024)
diff --git a/system/dev/block/usb-mass-storage/usb-mass-storage.c b/system/dev/block/usb-mass-storage/usb-mass-storage.c
index c8b0822..6acaa9a 100644
--- a/system/dev/block/usb-mass-storage/usb-mass-storage.c
+++ b/system/dev/block/usb-mass-storage/usb-mass-storage.c
@@ -9,7 +9,7 @@
#include <usb/usb-request.h>
#include <zircon/assert.h>
#include <zircon/hw/usb.h>
-#include <zircon/hw/usb-mass-storage.h>
+#include <zircon/hw/usb/ums.h>
#include <endian.h>
#include <stdio.h>
diff --git a/system/dev/ethernet/rndis/rndishost.c b/system/dev/ethernet/rndis/rndishost.c
index b9db6ec..d551b92 100644
--- a/system/dev/ethernet/rndis/rndishost.c
+++ b/system/dev/ethernet/rndis/rndishost.c
@@ -12,7 +12,7 @@
#include <ddk/protocol/usb-old.h>
#include <ddk/usb/usb.h>
#include <usb/usb-request.h>
-#include <zircon/hw/usb-cdc.h>
+#include <zircon/hw/usb/cdc.h>
#include <zircon/hw/usb.h>
#include <zircon/listnode.h>
diff --git a/system/dev/ethernet/usb-cdc-ecm/usb-cdc-ecm.c b/system/dev/ethernet/usb-cdc-ecm/usb-cdc-ecm.c
index 8a9a734..a3afa24 100644
--- a/system/dev/ethernet/usb-cdc-ecm/usb-cdc-ecm.c
+++ b/system/dev/ethernet/usb-cdc-ecm/usb-cdc-ecm.c
@@ -11,7 +11,7 @@
#include <ddk/protocol/usb/composite.h>
#include <ddk/usb/usb.h>
#include <usb/usb-request.h>
-#include <zircon/hw/usb-cdc.h>
+#include <zircon/hw/usb/cdc.h>
#include <lib/sync/completion.h>
#include <inttypes.h>
diff --git a/system/dev/ethernet/usb-cdc-function/cdc-eth-function.cpp b/system/dev/ethernet/usb-cdc-function/cdc-eth-function.cpp
index 6483cfe..5cb1a6c 100644
--- a/system/dev/ethernet/usb-cdc-function/cdc-eth-function.cpp
+++ b/system/dev/ethernet/usb-cdc-function/cdc-eth-function.cpp
@@ -24,7 +24,7 @@
#include <zircon/process.h>
#include <zircon/syscalls.h>
#include <zircon/device/usb-peripheral.h>
-#include <zircon/hw/usb-cdc.h>
+#include <zircon/hw/usb/cdc.h>
namespace usb_cdc_function {
diff --git a/system/dev/input/usb-hid/usb-hid.c b/system/dev/input/usb-hid/usb-hid.c
index 2a04f18..f0647fc 100644
--- a/system/dev/input/usb-hid/usb-hid.c
+++ b/system/dev/input/usb-hid/usb-hid.c
@@ -10,7 +10,7 @@
#include <ddk/protocol/usb-old.h>
#include <ddk/usb/usb.h>
#include <usb/usb-request.h>
-#include <zircon/hw/usb-hid.h>
+#include <zircon/hw/usb/hid.h>
#include <zircon/status.h>
#include <zircon/types.h>
diff --git a/system/dev/usb/usb-composite/usb-composite.c b/system/dev/usb/usb-composite/usb-composite.c
index dac892f..dba21f5 100644
--- a/system/dev/usb/usb-composite/usb-composite.c
+++ b/system/dev/usb/usb-composite/usb-composite.c
@@ -5,7 +5,7 @@
#include <ddk/debug.h>
#include <ddk/usb/usb.h>
#include <ddk/metadata.h>
-#include <zircon/hw/usb-audio.h>
+#include <zircon/hw/usb/audio.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
diff --git a/system/dev/usb/usb-dfu/usb-dfu.cpp b/system/dev/usb/usb-dfu/usb-dfu.cpp
index 87bda67..bcb5cac 100644
--- a/system/dev/usb/usb-dfu/usb-dfu.cpp
+++ b/system/dev/usb/usb-dfu/usb-dfu.cpp
@@ -12,7 +12,7 @@
#include <fbl/unique_ptr.h>
#include <fuchsia/mem/c/fidl.h>
#include <lib/zx/vmo.h>
-#include <zircon/hw/usb-dfu.h>
+#include <zircon/hw/usb/dfu.h>
#include <zircon/usb/test/fwloader/c/fidl.h>
namespace {
diff --git a/system/dev/usb/usb-dfu/usb-dfu.h b/system/dev/usb/usb-dfu/usb-dfu.h
index b241084..65e4282 100644
--- a/system/dev/usb/usb-dfu/usb-dfu.h
+++ b/system/dev/usb/usb-dfu/usb-dfu.h
@@ -8,7 +8,7 @@
#include <ddktl/device.h>
#include <ddktl/protocol/empty-protocol.h>
#include <lib/zx/vmo.h>
-#include <zircon/hw/usb-dfu.h>
+#include <zircon/hw/usb/dfu.h>
namespace usb {
diff --git a/system/dev/usb/usb-hub/usb-hub.c b/system/dev/usb/usb-hub/usb-hub.c
index 439ea30..3825745 100644
--- a/system/dev/usb/usb-hub/usb-hub.c
+++ b/system/dev/usb/usb-hub/usb-hub.c
@@ -11,7 +11,7 @@
#include <ddk/protocol/usb/hub.h>
#include <ddk/usb/usb.h>
#include <usb/usb-request.h>
-#include <zircon/hw/usb-hub.h>
+#include <zircon/hw/usb/hub.h>
#include <lib/sync/completion.h>
#include <inttypes.h>
#include <stdio.h>
diff --git a/system/dev/usb/usb-peripheral/usb-peripheral.c b/system/dev/usb/usb-peripheral/usb-peripheral.c
index 67b4b7d..a26ca82 100644
--- a/system/dev/usb/usb-peripheral/usb-peripheral.c
+++ b/system/dev/usb/usb-peripheral/usb-peripheral.c
@@ -22,7 +22,7 @@
#include <zircon/listnode.h>
#include <zircon/device/usb-peripheral.h>
#include <zircon/usb/peripheral/c/fidl.h>
-#include <zircon/hw/usb-cdc.h>
+#include <zircon/hw/usb/cdc.h>
#include <zircon/hw/usb.h>
/*
diff --git a/system/dev/usb/xhci/usb-xhci.cpp b/system/dev/usb/xhci/usb-xhci.cpp
index 981496c..165b284 100644
--- a/system/dev/usb/xhci/usb-xhci.cpp
+++ b/system/dev/usb/xhci/usb-xhci.cpp
@@ -7,8 +7,6 @@
#include <ddk/driver.h>
#include <ddk/phys-iter.h>
#include <ddk/platform-defs.h>
-// TODO: Reorder. This needs to be included first until USB headers move to banjo.
-#include <zircon/hw/usb-hub.h>
#include <ddk/protocol/usb/hci.h>
#include <hw/arch_ops.h>
diff --git a/system/dev/usb/xhci/xhci-device-manager.cpp b/system/dev/usb/xhci/xhci-device-manager.cpp
index 24566d5..5c856b1 100644
--- a/system/dev/usb/xhci/xhci-device-manager.cpp
+++ b/system/dev/usb/xhci/xhci-device-manager.cpp
@@ -4,7 +4,6 @@
#include <ddk/debug.h>
#include <zircon/hw/usb.h>
-#include <zircon/hw/usb-hub.h>
#include <endian.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/system/dev/usb/xhci/xhci-device-manager.h b/system/dev/usb/xhci/xhci-device-manager.h
index 6a81960..89cde70 100644
--- a/system/dev/usb/xhci/xhci-device-manager.h
+++ b/system/dev/usb/xhci/xhci-device-manager.h
@@ -4,7 +4,7 @@
#pragma once
-#include <zircon/hw/usb-hub.h>
+#include <zircon/hw/usb/hub.h>
#include <zircon/types.h>
#include <stdbool.h>
diff --git a/system/dev/usb/xhci/xhci-transfer.cpp b/system/dev/usb/xhci/xhci-transfer.cpp
index d59f84e..ea9ae4d 100644
--- a/system/dev/usb/xhci/xhci-transfer.cpp
+++ b/system/dev/usb/xhci/xhci-transfer.cpp
@@ -4,7 +4,6 @@
#include <ddk/debug.h>
#include <ddk/phys-iter.h>
-#include <zircon/hw/usb-hub.h>
#include <ddk/protocol/usb/hci.h>
#include <zircon/assert.h>
#include <zircon/hw/usb.h>
diff --git a/system/dev/usb/xhci/xhci.h b/system/dev/usb/xhci/xhci.h
index ef0195b..0f7c872 100644
--- a/system/dev/usb/xhci/xhci.h
+++ b/system/dev/usb/xhci/xhci.h
@@ -8,7 +8,6 @@
#include <lib/sync/completion.h>
#include <limits.h>
#include <threads.h>
-#include <zircon/hw/usb-hub.h>
#include <zircon/hw/usb.h>
#include <zircon/listnode.h>
#include <zircon/types.h>
diff --git a/system/public/zircon/hw/usb-cdc.h b/system/public/zircon/hw/usb-cdc.h
index f64a422..9795718 100644
--- a/system/public/zircon/hw/usb-cdc.h
+++ b/system/public/zircon/hw/usb-cdc.h
@@ -1,138 +1,7 @@
-// Copyright 2017 The Fuchsia Authors. All rights reserved.
+// Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#pragma once
-// clang-format off
-
-#include <zircon/compiler.h>
-
-/* CDC Subclasses for the Communications Interface Class */
-#define USB_CDC_SUBCLASS_DIRECT_LINE 0x01
-#define USB_CDC_SUBCLASS_ABSTRACT 0x02
-#define USB_CDC_SUBCLASS_TELEPHONE 0x03
-#define USB_CDC_SUBCLASS_MULTI_CHANNEL 0x04
-#define USB_CDC_SUBCLASS_CAPI 0x05
-#define USB_CDC_SUBCLASS_ETHERNET 0x06
-#define USB_CDC_SUBCLASS_ATM 0x07
-#define USB_CDC_SUBCLASS_WIRELESS_HANDSET 0x08
-#define USB_CDC_SUBCLASS_DEVICE_MGMT 0x09
-#define USB_CDC_SUBCLASS_MOBILE_DIRECT 0x0A
-#define USB_CDC_SUBCLASS_OBEX 0x0B
-#define USB_CDC_SUBCLASS_ETHERNET_EMU 0x0C
-#define USB_CDC_SUBCLASS_NETWORK_CTRL 0x0D
-
-/* CDC Descriptor SubTypes */
-#define USB_CDC_DST_HEADER 0x00
-#define USB_CDC_DST_CALL_MGMT 0x01
-#define USB_CDC_DST_ABSTRACT_CTRL_MGMT 0x02
-#define USB_CDC_DST_DIRECT_LINE_MGMT 0x03
-#define USB_CDC_DST_TELEPHONE_RINGER 0x04
-#define USB_CDC_DST_TELEPHONE_CALL_REPORTING 0x05
-#define USB_CDC_DST_UNION 0x06
-#define USB_CDC_DST_COUNTRY_SELECTION 0x07
-#define USB_CDC_DST_TELEPHONE_OP_MODES 0x08
-#define USB_CDC_DST_USB_TERMINAL 0x09
-#define USB_CDC_DST_NETWORK_CHANNEL 0x0A
-#define USB_CDC_DST_PROTOCOL_UNIT 0x0B
-#define USB_CDC_DST_EXTENSION_UNIT 0x0C
-#define USB_CDC_DST_MULTI_CHANNEL_MGMT 0x0D
-#define USB_CDC_DST_CAPI_CTRL_MGMT 0x0E
-#define USB_CDC_DST_ETHERNET 0x0F
-#define USB_CDC_DST_ATM_NETWORKING 0x10
-#define USB_CDC_DST_WIRELESS_HANDSET_CTRL 0x11
-#define USB_CDC_DST_MOBILE_DIRECT_LINE 0x12
-#define USB_CDC_DST_MDLM_DETAIL 0x13
-#define USB_CDC_DST_DEVICE_MGMT 0x14
-#define USB_CDC_DST_OBEX 0x15
-#define USB_CDC_DST_COMMAND_SET 0x16
-#define USB_CDC_DST_COMMAND_SET_DETAIL 0x17
-#define USB_CDC_DST_TELEPHONE_CTRL 0x18
-#define USB_CDC_DST_OBEX_SERVICE_ID 0x19
-#define USB_CDC_DST_NCM 0x1A
-
-/* CDC Class-Specific Notification Codes */
-#define USB_CDC_NC_NETWORK_CONNECTION 0x00
-#define USB_CDC_NC_RESPONSE_AVAILABLE 0x01
-#define USB_CDC_NC_SERIAL_STATE 0x20
-#define USB_CDC_NC_CONNECTION_SPEED_CHANGE 0x2A
-
-/* CDC Ethernet Class-Specific Request Codes */
-#define USB_CDC_SET_ETHERNET_MULTICAST_FILTERS 0x40
-#define USB_CDC_SET_ETHERNET_PM_PATTERN_FILTER 0x41
-#define USB_CDC_GET_ETHERNET_PM_PATTERN_FILTER 0x42
-#define USB_CDC_SET_ETHERNET_PACKET_FILTER 0x43
-#define USB_CDC_GET_ETHERNET_STATISTIC 0x44
-
-/* CDC Class-Specific Requests */
-#define USB_CDC_SEND_ENCAPSULATED_COMMAND 0x00
-#define USB_CDC_GET_ENCAPSULATED_RESPONSE 0x01
-
-__BEGIN_CDECLS;
-
-typedef struct {
- uint8_t bLength;
- uint8_t bDescriptorType; // USB_DT_CS_INTERFACE
- uint8_t bDescriptorSubType; // USB_CDC_DST_HEADER
- uint16_t bcdCDC;
-} __attribute__ ((packed)) usb_cs_header_interface_descriptor_t;
-
-typedef struct {
- uint8_t bLength;
- uint8_t bDescriptorType; // USB_DT_CS_INTERFACE
- uint8_t bDescriptorSubType; // USB_CDC_DST_CALL_MGMT
- uint8_t bmCapabilities;
- uint8_t bDataInterface;
-} __attribute__ ((packed)) usb_cs_call_mgmt_interface_descriptor_t;
-
-typedef struct {
- uint8_t bLength;
- uint8_t bDescriptorType; // USB_DT_CS_INTERFACE
- uint8_t bDescriptorSubType; // USB_CDC_DST_ABSTRACT_CTRL_MGMT
- uint8_t bmCapabilities;
-} __attribute__ ((packed)) usb_cs_abstract_ctrl_mgmt_interface_descriptor_t;
-
-typedef struct {
- uint8_t bLength;
- uint8_t bDescriptorType; // USB_DT_CS_INTERFACE
- uint8_t bDescriptorSubType; // USB_CDC_DST_UNION
- uint8_t bControlInterface;
- uint8_t bSubordinateInterface[];
-} __attribute__ ((packed)) usb_cs_union_interface_descriptor_t;
-
-// fixed size version of usb_cs_union_interface_descriptor_t
-typedef struct {
- uint8_t bLength;
- uint8_t bDescriptorType; // USB_DT_CS_INTERFACE
- uint8_t bDescriptorSubType; // USB_CDC_DST_UNION
- uint8_t bControlInterface;
- uint8_t bSubordinateInterface;
-} __attribute__ ((packed)) usb_cs_union_interface_descriptor_1_t;
-
-typedef struct {
- uint8_t bLength;
- uint8_t bDescriptorType; // USB_DT_CS_INTERFACE
- uint8_t bDescriptorSubType; // USB_CDC_DST_ETHERNET
- uint8_t iMACAddress;
- uint32_t bmEthernetStatistics;
- uint16_t wMaxSegmentSize;
- uint16_t wNumberMCFilters;
- uint8_t bNumberPowerFilters;
-} __attribute__ ((packed)) usb_cs_ethernet_interface_descriptor_t;
-
-typedef struct {
- uint8_t bmRequestType;
- uint8_t bNotification;
- uint16_t wValue;
- uint16_t wIndex;
- uint16_t wLength;
-} __attribute__ ((packed)) usb_cdc_notification_t;
-
-typedef struct {
- usb_cdc_notification_t notification;
- uint32_t downlink_br;
- uint32_t uplink_br;
- } __attribute__ ((packed)) usb_cdc_speed_change_notification_t;
-
-__END_CDECLS;
+#include <zircon/hw/usb/cdc.h>
diff --git a/system/public/zircon/hw/usb-video.h b/system/public/zircon/hw/usb-video.h
index 1ff6e22..518e19a 100644
--- a/system/public/zircon/hw/usb-video.h
+++ b/system/public/zircon/hw/usb-video.h
@@ -1,304 +1,7 @@
-// Copyright 2017 The Fuchsia Authors. All rights reserved.
+// Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#pragma once
-// clang-format off
-
-#include <zircon/compiler.h>
-
-__BEGIN_CDECLS;
-
-// video interface subclasses
-#define USB_SUBCLASS_VIDEO_CONTROL 0x01
-#define USB_SUBCLASS_VIDEO_STREAMING 0x02
-#define USB_SUBCLASS_VIDEO_INTERFACE_COLLECTION 0x03
-
-// video class specific descriptor types
-#define USB_VIDEO_CS_DEVICE 0x21
-#define USB_VIDEO_CS_CONFIGURATION 0x22
-#define USB_VIDEO_CS_STRING 0x23
-#define USB_VIDEO_CS_INTERFACE 0x24
-#define USB_VIDEO_CS_ENDPOINT 0x25
-
-// video class specific VC interface descriptor subtypes
-#define USB_VIDEO_VC_HEADER 0x01
-#define USB_VIDEO_VC_INPUT_TERMINAL 0x02
-#define USB_VIDEO_VC_OUTPUT_TERMINAL 0x03
-#define USB_VIDEO_VC_SELECTOR_UNIT 0x04
-#define USB_VIDEO_VC_PROCESSING_UNIT 0x05
-#define USB_VIDEO_VC_EXTENSION_UNIT 0x06
-#define USB_VIDEO_VC_ENCODING_UNIT 0x07
-
-// video class specific VS interface descriptor subtypes
-#define USB_VIDEO_VS_INPUT_HEADER 0x01
-#define USB_VIDEO_VS_OUTPUT_HEADER 0x02
-#define USB_VIDEO_VS_STILL_IMAGE_FRAME 0x03
-#define USB_VIDEO_VS_FORMAT_UNCOMPRESSED 0x04
-#define USB_VIDEO_VS_FRAME_UNCOMPRESSED 0x05
-#define USB_VIDEO_VS_FORMAT_MJPEG 0x06
-#define USB_VIDEO_VS_FRAME_MJPEG 0x07
-#define USB_VIDEO_VS_FORMAT_MPEG2TS 0x0A
-#define USB_VIDEO_VS_FORMAT_DV 0x0C
-#define USB_VIDEO_VS_COLORFORMAT 0x0D
-#define USB_VIDEO_VS_FORMAT_FRAME_BASED 0x10
-#define USB_VIDEO_VS_FRAME_FRAME_BASED 0x11
-#define USB_VIDEO_VS_FORMAT_STREAM_BASED 0x12
-#define USB_VIDEO_VS_FORMAT_H264 0x13
-#define USB_VIDEO_VS_FRAME_H264 0x14
-#define USB_VIDEO_VS_FORMAT_H264_SIMULCAST 0x15
-#define USB_VIDEO_VS_FORMAT_VP8 0x16
-#define USB_VIDEO_VS_FRAME_VP8 0x17
-#define USB_VIDEO_VS_FORMAT_VP8_SIMULCAST 0x18
-
-// video class specific endpoint descriptor subtypes
-#define USB_VIDEO_EP_GENERAL 0x01
-#define USB_VIDEO_EP_ENDPOINT 0x02
-#define USB_VIDEO_EP_INTERRUPT 0x03
-
-// video class specific request codes
-#define USB_VIDEO_SET_CUR 0x01
-#define USB_VIDEO_SET_CUR_ALL 0x11
-#define USB_VIDEO_GET_CUR 0x81
-#define USB_VIDEO_GET_MIN 0x82
-#define USB_VIDEO_GET_MAX 0x83
-#define USB_VIDEO_GET_RES 0x84
-#define USB_VIDEO_GET_LEN 0x85
-#define USB_VIDEO_GET_INFO 0x86
-#define USB_VIDEO_GET_DEF 0x87
-#define USB_VIDEO_GET_CUR_ALL 0x91
-#define USB_VIDEO_GET_MIN_ALL 0x92
-#define USB_VIDEO_GET_MAX_ALL 0x93
-#define USB_VIDEO_GET_RES_ALL 0x94
-#define USB_VIDEO_GET_DEF_ALL 0x97
-
-// video streaming interface control selectors
-#define USB_VIDEO_VS_PROBE_CONTROL 0x01
-#define USB_VIDEO_VS_COMMIT_CONTROL 0x02
-#define USB_VIDEO_VS_STILL_PROBE_CONTROL 0x03
-#define USB_VIDEO_VS_STILL_COMMIT_CONTROL 0x04
-#define USB_VIDEO_VS_STILL_IMAGE_TRIGGER_CONTROL 0x05
-#define USB_VIDEO_VS_STREAM_ERROR_CODE_CONTROL 0x06
-#define USB_VIDEO_VS_GENERATE_KEY_FRAME_CONTROL 0x07
-#define USB_VIDEO_VS_UPDATE_FRAME_SEGMENT_CONTROL 0x08
-#define USB_VIDEO_VS_SYNCH_DELAY_CONTROL 0x09
-
-// header for usb_video_vc_* below
-typedef struct {
- uint8_t bLength;
- uint8_t bDescriptorType; // USB_VIDEO_CS_INTERFACE
- uint8_t bDescriptorSubtype;
-} __PACKED usb_video_vc_desc_header;
-
-typedef struct {
- uint8_t bLength;
- uint8_t bDescriptorType; // USB_VIDEO_CS_INTERFACE
- uint8_t bDescriptorSubtype; // USB_VIDEO_VC_HEADER
- uint16_t bcdUVC;
- uint16_t wTotalLength;
- uint32_t dwClockFrequency;
- uint8_t bInCollection;
- uint8_t baInterfaceNr[];
-} __PACKED usb_video_vc_header_desc;
-
-typedef struct {
- uint8_t bLength;
- uint8_t bDescriptorType; // USB_VIDEO_CS_INTERFACE
- uint8_t bDescriptorSubtype; // USB_VIDEO_VC_INPUT_TERMINAL
- uint8_t bTerminalID;
- uint16_t wTerminalType;
- uint8_t bAssocTerminal;
- uint8_t iTerminal;
-} __PACKED usb_video_vc_input_terminal_desc;
-
-typedef struct {
- uint8_t bLength;
- uint8_t bDescriptorType; // USB_VIDEO_CS_INTERFACE
- uint8_t bDescriptorSubtype; // USB_VIDEO_VC_OUTPUT_TERMINAL
- uint8_t bTerminalID;
- uint16_t wTerminalType;
- uint8_t bAssocTerminal;
- uint8_t bSourceID;
- uint8_t iTerminal;
-} __PACKED usb_video_vc_output_terminal_desc;
-
-// class specific VC interrupt endpoint descriptor
-typedef struct {
- uint8_t bLength;
- uint8_t bDescriptorType; // USB_VIDEO_CS_ENDPOINT
- uint8_t bDescriptorSubtype; // USB_ENDPOINT_INTERRUPT
- uint16_t wMaxTransferSize;
-} __PACKED usb_video_vc_interrupt_endpoint_desc;
-
-typedef struct {
- uint8_t bLength;
- uint8_t bDescriptorType; // USB_VIDEO_CS_INTERFACE
- uint8_t bDescriptorSubtype; // USB_VIDEO_VS_HEADER
- uint8_t bNumFormats;
- uint16_t wTotalLength;
- uint8_t bEndpointAddress;
- uint8_t bmInfo;
- uint8_t bTerminalLink;
- uint8_t bStillCaptureMethod;
- uint8_t bTriggerSupport;
- uint8_t bTriggerUsage;
- uint8_t bControlSize;
- uint8_t bmaControls[];
-} __PACKED usb_video_vs_input_header_desc;
-
-#define GUID_LENGTH 16
-
-// A GUID consists of a:
-// - four-byte integer
-// - two-byte integer
-// - two-byte integer
-// - eight-byte array
-//
-// The string representation uses big endian format, so to convert it
-// to a byte array we need to reverse the byte order of the three integers.
-//
-// See USB Video Class revision 1.5, FAQ section 2.9
-// for GUID Data Structure Layout.
-
-#define USB_VIDEO_GUID_YUY2_STRING "32595559-0000-0010-8000-00AA00389B71"
-#define USB_VIDEO_GUID_YUY2_VALUE { \
- 0x59, 0x55, 0x59, 0x32, \
- 0x00, 0x00, \
- 0x10, 0x00, \
- 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 \
-}
-
-#define USB_VIDEO_GUID_NV12_STRING "3231564E-0000-0010-8000-00AA00389B71"
-#define USB_VIDEO_GUID_NV12_VALUE { \
- 0x4e, 0x56, 0x31, 0x32, \
- 0x00, 0x00, \
- 0x10, 0x00, \
- 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 \
-}
-
-#define USB_VIDEO_GUID_M420_STRING "3032344D-0000-0010-8000-00AA00389B71"
-#define USB_VIDEO_GUID_M420_VALUE { \
- 0x4d, 0x34, 0x32, 0x30, \
- 0x00, 0x00, \
- 0x10, 0x00, \
- 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 \
-}
-
-#define USB_VIDEO_GUID_I420_STRING "30323449-0000-0010-8000-00AA00389B71"
-#define USB_VIDEO_GUID_I420_VALUE { \
- 0x49, 0x34, 0x32, 0x30, \
- 0x00, 0x00, \
- 0x10, 0x00, \
- 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 \
-}
-
-// USB Video Payload Uncompressed
-typedef struct {
- uint8_t bLength;
- uint8_t bDescriptorType; // USB_VIDEO_CS_INTERFACE
- uint8_t bDescriptorSubType; // USB_VIDEO_VS_FORMAT_UNCOMPRESSED
- uint8_t bFormatIndex;
- uint8_t bNumFrameDescriptors;
- uint8_t guidFormat[GUID_LENGTH];
- uint8_t bBitsPerPixel;
- uint8_t bDefaultFrameIndex;
- uint8_t bAspectRatioX;
- uint8_t bAspectRatioY;
- uint8_t bmInterfaceFlags;
- uint8_t bCopyProtect;
-} __PACKED usb_video_vs_uncompressed_format_desc;
-
-// USB Video Payload MJPEG
-typedef struct {
- uint8_t bLength;
- uint8_t bDescriptorType; // USB_VIDEO_CS_INTERFACE
- uint8_t bDescriptorSubType; // USB_VIDEO_VS_FORMAT_MJPEG
- uint8_t bFormatIndex;
- uint8_t bNumFrameDescriptors;
- uint8_t bmFlags;
- uint8_t bDefaultFrameIndex;
- uint8_t bAspectRatioX;
- uint8_t bAspectRatioY;
- uint8_t bmInterfaceFlags;
- uint8_t bCopyProtect;
-} __PACKED usb_video_vs_mjpeg_format_desc;
-
-// Uncompressed and MJPEG formats have the same frame descriptor structure.
-typedef struct {
- uint8_t bLength;
- uint8_t bDescriptorType; // USB_VIDEO_CS_INTERFACE
- uint8_t bDescriptorSubType; // USB_VIDEO_VS_FRAME_UNCOMPRESSED / USB_VIDEO_VS_FRAME_MJPEG
- uint8_t bFrameIndex;
- uint8_t bmCapabilities;
- uint16_t wWidth;
- uint16_t wHeight;
- uint32_t dwMinBitRate;
- uint32_t dwMaxBitRate;
- uint32_t dwMaxVideoFrameBufferSize;
- uint32_t dwDefaultFrameInterval;
- uint8_t bFrameIntervalType;
- uint32_t dwFrameInterval[];
-} __PACKED usb_video_vs_frame_desc;
-
-// Stream negotiation
-#define USB_VIDEO_BM_HINT_FRAME_INTERVAL (1 << 0)
-#define USB_VIDEO_BM_HINT_KEY_FRAME_RATE (1 << 1)
-#define USB_VIDEO_BM_HINT_P_FRAME_RATE (1 << 2)
-#define USB_VIDEO_BM_HINT_COMP_QUALITY (1 << 3)
-#define USB_VIDEO_BM_HINT_COMP_WINDOW_SIZE (1 << 4)
-
-typedef struct {
- uint16_t bmHint;
- uint8_t bFormatIndex;
- uint8_t bFrameIndex;
- uint32_t dwFrameInterval;
- uint16_t wKeyFrameRate;
- uint16_t wPFrameRate;
- uint16_t wCompQuality;
- uint16_t wCompWindowSize;
- uint16_t wDelay;
- uint32_t dwMaxVideoFrameSize;
- uint32_t dwMaxPayloadTransferSize;
- // The following fields are optional.
- uint32_t dwClockFrequency;
- uint8_t bmFramingInfo;
- uint8_t bPreferedVersion;
- uint8_t bMinVersion;
- uint8_t bMaxVersion;
- uint8_t bUsage;
- uint8_t bBitDepthLuma;
- uint8_t bmSettings;
- uint8_t bMaxNumberOfRefFramesPlus1;
- uint16_t bmRateControlModes;
- uint32_t bmLayoutPerStream;
-} __PACKED usb_video_vc_probe_and_commit_controls;
-
-// For accessing payload bmHeaderInfo bitmap
-#define USB_VIDEO_VS_PAYLOAD_HEADER_FID (1 << 0)
-#define USB_VIDEO_VS_PAYLOAD_HEADER_EOF (1 << 1)
-#define USB_VIDEO_VS_PAYLOAD_HEADER_PTS (1 << 2)
-#define USB_VIDEO_VS_PAYLOAD_HEADER_SCR (1 << 3)
-#define USB_VIDEO_VS_PAYLOAD_HEADER_RES (1 << 4)
-#define USB_VIDEO_VS_PAYLOAD_HEADER_STI (1 << 5)
-#define USB_VIDEO_VS_PAYLOAD_HEADER_ERR (1 << 6)
-#define USB_VIDEO_VS_PAYLOAD_HEADER_EOH (1 << 7)
-
-// Common header for all payloads.
-typedef struct {
- uint8_t bHeaderLength;
- uint8_t bmHeaderInfo;
-
-} __PACKED usb_video_vs_payload_header;
-
-typedef struct {
- uint8_t bHeaderLength;
- uint8_t bmHeaderInfo;
- uint32_t dwPresentationTime;
- uint32_t scrSourceTimeClock;
- // Frame number when the source clock was sampled.
- uint16_t scrSourceClockSOFCounter;
-} __PACKED usb_video_vs_uncompressed_payload_header;
-
-__END_CDECLS;
-
+#include <zircon/hw/usb/video.h>
diff --git a/system/public/zircon/hw/usb-audio.h b/system/public/zircon/hw/usb/audio.h
similarity index 100%
rename from system/public/zircon/hw/usb-audio.h
rename to system/public/zircon/hw/usb/audio.h
diff --git a/system/public/zircon/hw/usb/cdc.h b/system/public/zircon/hw/usb/cdc.h
new file mode 100644
index 0000000..f64a422
--- /dev/null
+++ b/system/public/zircon/hw/usb/cdc.h
@@ -0,0 +1,138 @@
+// Copyright 2017 The Fuchsia Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#pragma once
+
+// clang-format off
+
+#include <zircon/compiler.h>
+
+/* CDC Subclasses for the Communications Interface Class */
+#define USB_CDC_SUBCLASS_DIRECT_LINE 0x01
+#define USB_CDC_SUBCLASS_ABSTRACT 0x02
+#define USB_CDC_SUBCLASS_TELEPHONE 0x03
+#define USB_CDC_SUBCLASS_MULTI_CHANNEL 0x04
+#define USB_CDC_SUBCLASS_CAPI 0x05
+#define USB_CDC_SUBCLASS_ETHERNET 0x06
+#define USB_CDC_SUBCLASS_ATM 0x07
+#define USB_CDC_SUBCLASS_WIRELESS_HANDSET 0x08
+#define USB_CDC_SUBCLASS_DEVICE_MGMT 0x09
+#define USB_CDC_SUBCLASS_MOBILE_DIRECT 0x0A
+#define USB_CDC_SUBCLASS_OBEX 0x0B
+#define USB_CDC_SUBCLASS_ETHERNET_EMU 0x0C
+#define USB_CDC_SUBCLASS_NETWORK_CTRL 0x0D
+
+/* CDC Descriptor SubTypes */
+#define USB_CDC_DST_HEADER 0x00
+#define USB_CDC_DST_CALL_MGMT 0x01
+#define USB_CDC_DST_ABSTRACT_CTRL_MGMT 0x02
+#define USB_CDC_DST_DIRECT_LINE_MGMT 0x03
+#define USB_CDC_DST_TELEPHONE_RINGER 0x04
+#define USB_CDC_DST_TELEPHONE_CALL_REPORTING 0x05
+#define USB_CDC_DST_UNION 0x06
+#define USB_CDC_DST_COUNTRY_SELECTION 0x07
+#define USB_CDC_DST_TELEPHONE_OP_MODES 0x08
+#define USB_CDC_DST_USB_TERMINAL 0x09
+#define USB_CDC_DST_NETWORK_CHANNEL 0x0A
+#define USB_CDC_DST_PROTOCOL_UNIT 0x0B
+#define USB_CDC_DST_EXTENSION_UNIT 0x0C
+#define USB_CDC_DST_MULTI_CHANNEL_MGMT 0x0D
+#define USB_CDC_DST_CAPI_CTRL_MGMT 0x0E
+#define USB_CDC_DST_ETHERNET 0x0F
+#define USB_CDC_DST_ATM_NETWORKING 0x10
+#define USB_CDC_DST_WIRELESS_HANDSET_CTRL 0x11
+#define USB_CDC_DST_MOBILE_DIRECT_LINE 0x12
+#define USB_CDC_DST_MDLM_DETAIL 0x13
+#define USB_CDC_DST_DEVICE_MGMT 0x14
+#define USB_CDC_DST_OBEX 0x15
+#define USB_CDC_DST_COMMAND_SET 0x16
+#define USB_CDC_DST_COMMAND_SET_DETAIL 0x17
+#define USB_CDC_DST_TELEPHONE_CTRL 0x18
+#define USB_CDC_DST_OBEX_SERVICE_ID 0x19
+#define USB_CDC_DST_NCM 0x1A
+
+/* CDC Class-Specific Notification Codes */
+#define USB_CDC_NC_NETWORK_CONNECTION 0x00
+#define USB_CDC_NC_RESPONSE_AVAILABLE 0x01
+#define USB_CDC_NC_SERIAL_STATE 0x20
+#define USB_CDC_NC_CONNECTION_SPEED_CHANGE 0x2A
+
+/* CDC Ethernet Class-Specific Request Codes */
+#define USB_CDC_SET_ETHERNET_MULTICAST_FILTERS 0x40
+#define USB_CDC_SET_ETHERNET_PM_PATTERN_FILTER 0x41
+#define USB_CDC_GET_ETHERNET_PM_PATTERN_FILTER 0x42
+#define USB_CDC_SET_ETHERNET_PACKET_FILTER 0x43
+#define USB_CDC_GET_ETHERNET_STATISTIC 0x44
+
+/* CDC Class-Specific Requests */
+#define USB_CDC_SEND_ENCAPSULATED_COMMAND 0x00
+#define USB_CDC_GET_ENCAPSULATED_RESPONSE 0x01
+
+__BEGIN_CDECLS;
+
+typedef struct {
+ uint8_t bLength;
+ uint8_t bDescriptorType; // USB_DT_CS_INTERFACE
+ uint8_t bDescriptorSubType; // USB_CDC_DST_HEADER
+ uint16_t bcdCDC;
+} __attribute__ ((packed)) usb_cs_header_interface_descriptor_t;
+
+typedef struct {
+ uint8_t bLength;
+ uint8_t bDescriptorType; // USB_DT_CS_INTERFACE
+ uint8_t bDescriptorSubType; // USB_CDC_DST_CALL_MGMT
+ uint8_t bmCapabilities;
+ uint8_t bDataInterface;
+} __attribute__ ((packed)) usb_cs_call_mgmt_interface_descriptor_t;
+
+typedef struct {
+ uint8_t bLength;
+ uint8_t bDescriptorType; // USB_DT_CS_INTERFACE
+ uint8_t bDescriptorSubType; // USB_CDC_DST_ABSTRACT_CTRL_MGMT
+ uint8_t bmCapabilities;
+} __attribute__ ((packed)) usb_cs_abstract_ctrl_mgmt_interface_descriptor_t;
+
+typedef struct {
+ uint8_t bLength;
+ uint8_t bDescriptorType; // USB_DT_CS_INTERFACE
+ uint8_t bDescriptorSubType; // USB_CDC_DST_UNION
+ uint8_t bControlInterface;
+ uint8_t bSubordinateInterface[];
+} __attribute__ ((packed)) usb_cs_union_interface_descriptor_t;
+
+// fixed size version of usb_cs_union_interface_descriptor_t
+typedef struct {
+ uint8_t bLength;
+ uint8_t bDescriptorType; // USB_DT_CS_INTERFACE
+ uint8_t bDescriptorSubType; // USB_CDC_DST_UNION
+ uint8_t bControlInterface;
+ uint8_t bSubordinateInterface;
+} __attribute__ ((packed)) usb_cs_union_interface_descriptor_1_t;
+
+typedef struct {
+ uint8_t bLength;
+ uint8_t bDescriptorType; // USB_DT_CS_INTERFACE
+ uint8_t bDescriptorSubType; // USB_CDC_DST_ETHERNET
+ uint8_t iMACAddress;
+ uint32_t bmEthernetStatistics;
+ uint16_t wMaxSegmentSize;
+ uint16_t wNumberMCFilters;
+ uint8_t bNumberPowerFilters;
+} __attribute__ ((packed)) usb_cs_ethernet_interface_descriptor_t;
+
+typedef struct {
+ uint8_t bmRequestType;
+ uint8_t bNotification;
+ uint16_t wValue;
+ uint16_t wIndex;
+ uint16_t wLength;
+} __attribute__ ((packed)) usb_cdc_notification_t;
+
+typedef struct {
+ usb_cdc_notification_t notification;
+ uint32_t downlink_br;
+ uint32_t uplink_br;
+ } __attribute__ ((packed)) usb_cdc_speed_change_notification_t;
+
+__END_CDECLS;
diff --git a/system/public/zircon/hw/usb-dfu.h b/system/public/zircon/hw/usb/dfu.h
similarity index 100%
rename from system/public/zircon/hw/usb-dfu.h
rename to system/public/zircon/hw/usb/dfu.h
diff --git a/system/public/zircon/hw/usb-hid.h b/system/public/zircon/hw/usb/hid.h
similarity index 100%
rename from system/public/zircon/hw/usb-hid.h
rename to system/public/zircon/hw/usb/hid.h
diff --git a/system/public/zircon/hw/usb-hub.h b/system/public/zircon/hw/usb/hub.h
similarity index 100%
rename from system/public/zircon/hw/usb-hub.h
rename to system/public/zircon/hw/usb/hub.h
diff --git a/system/public/zircon/hw/usb-mass-storage.h b/system/public/zircon/hw/usb/ums.h
similarity index 100%
rename from system/public/zircon/hw/usb-mass-storage.h
rename to system/public/zircon/hw/usb/ums.h
diff --git a/system/public/zircon/hw/usb/video.h b/system/public/zircon/hw/usb/video.h
new file mode 100644
index 0000000..1ff6e22
--- /dev/null
+++ b/system/public/zircon/hw/usb/video.h
@@ -0,0 +1,304 @@
+// Copyright 2017 The Fuchsia Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#pragma once
+
+// clang-format off
+
+#include <zircon/compiler.h>
+
+__BEGIN_CDECLS;
+
+// video interface subclasses
+#define USB_SUBCLASS_VIDEO_CONTROL 0x01
+#define USB_SUBCLASS_VIDEO_STREAMING 0x02
+#define USB_SUBCLASS_VIDEO_INTERFACE_COLLECTION 0x03
+
+// video class specific descriptor types
+#define USB_VIDEO_CS_DEVICE 0x21
+#define USB_VIDEO_CS_CONFIGURATION 0x22
+#define USB_VIDEO_CS_STRING 0x23
+#define USB_VIDEO_CS_INTERFACE 0x24
+#define USB_VIDEO_CS_ENDPOINT 0x25
+
+// video class specific VC interface descriptor subtypes
+#define USB_VIDEO_VC_HEADER 0x01
+#define USB_VIDEO_VC_INPUT_TERMINAL 0x02
+#define USB_VIDEO_VC_OUTPUT_TERMINAL 0x03
+#define USB_VIDEO_VC_SELECTOR_UNIT 0x04
+#define USB_VIDEO_VC_PROCESSING_UNIT 0x05
+#define USB_VIDEO_VC_EXTENSION_UNIT 0x06
+#define USB_VIDEO_VC_ENCODING_UNIT 0x07
+
+// video class specific VS interface descriptor subtypes
+#define USB_VIDEO_VS_INPUT_HEADER 0x01
+#define USB_VIDEO_VS_OUTPUT_HEADER 0x02
+#define USB_VIDEO_VS_STILL_IMAGE_FRAME 0x03
+#define USB_VIDEO_VS_FORMAT_UNCOMPRESSED 0x04
+#define USB_VIDEO_VS_FRAME_UNCOMPRESSED 0x05
+#define USB_VIDEO_VS_FORMAT_MJPEG 0x06
+#define USB_VIDEO_VS_FRAME_MJPEG 0x07
+#define USB_VIDEO_VS_FORMAT_MPEG2TS 0x0A
+#define USB_VIDEO_VS_FORMAT_DV 0x0C
+#define USB_VIDEO_VS_COLORFORMAT 0x0D
+#define USB_VIDEO_VS_FORMAT_FRAME_BASED 0x10
+#define USB_VIDEO_VS_FRAME_FRAME_BASED 0x11
+#define USB_VIDEO_VS_FORMAT_STREAM_BASED 0x12
+#define USB_VIDEO_VS_FORMAT_H264 0x13
+#define USB_VIDEO_VS_FRAME_H264 0x14
+#define USB_VIDEO_VS_FORMAT_H264_SIMULCAST 0x15
+#define USB_VIDEO_VS_FORMAT_VP8 0x16
+#define USB_VIDEO_VS_FRAME_VP8 0x17
+#define USB_VIDEO_VS_FORMAT_VP8_SIMULCAST 0x18
+
+// video class specific endpoint descriptor subtypes
+#define USB_VIDEO_EP_GENERAL 0x01
+#define USB_VIDEO_EP_ENDPOINT 0x02
+#define USB_VIDEO_EP_INTERRUPT 0x03
+
+// video class specific request codes
+#define USB_VIDEO_SET_CUR 0x01
+#define USB_VIDEO_SET_CUR_ALL 0x11
+#define USB_VIDEO_GET_CUR 0x81
+#define USB_VIDEO_GET_MIN 0x82
+#define USB_VIDEO_GET_MAX 0x83
+#define USB_VIDEO_GET_RES 0x84
+#define USB_VIDEO_GET_LEN 0x85
+#define USB_VIDEO_GET_INFO 0x86
+#define USB_VIDEO_GET_DEF 0x87
+#define USB_VIDEO_GET_CUR_ALL 0x91
+#define USB_VIDEO_GET_MIN_ALL 0x92
+#define USB_VIDEO_GET_MAX_ALL 0x93
+#define USB_VIDEO_GET_RES_ALL 0x94
+#define USB_VIDEO_GET_DEF_ALL 0x97
+
+// video streaming interface control selectors
+#define USB_VIDEO_VS_PROBE_CONTROL 0x01
+#define USB_VIDEO_VS_COMMIT_CONTROL 0x02
+#define USB_VIDEO_VS_STILL_PROBE_CONTROL 0x03
+#define USB_VIDEO_VS_STILL_COMMIT_CONTROL 0x04
+#define USB_VIDEO_VS_STILL_IMAGE_TRIGGER_CONTROL 0x05
+#define USB_VIDEO_VS_STREAM_ERROR_CODE_CONTROL 0x06
+#define USB_VIDEO_VS_GENERATE_KEY_FRAME_CONTROL 0x07
+#define USB_VIDEO_VS_UPDATE_FRAME_SEGMENT_CONTROL 0x08
+#define USB_VIDEO_VS_SYNCH_DELAY_CONTROL 0x09
+
+// header for usb_video_vc_* below
+typedef struct {
+ uint8_t bLength;
+ uint8_t bDescriptorType; // USB_VIDEO_CS_INTERFACE
+ uint8_t bDescriptorSubtype;
+} __PACKED usb_video_vc_desc_header;
+
+typedef struct {
+ uint8_t bLength;
+ uint8_t bDescriptorType; // USB_VIDEO_CS_INTERFACE
+ uint8_t bDescriptorSubtype; // USB_VIDEO_VC_HEADER
+ uint16_t bcdUVC;
+ uint16_t wTotalLength;
+ uint32_t dwClockFrequency;
+ uint8_t bInCollection;
+ uint8_t baInterfaceNr[];
+} __PACKED usb_video_vc_header_desc;
+
+typedef struct {
+ uint8_t bLength;
+ uint8_t bDescriptorType; // USB_VIDEO_CS_INTERFACE
+ uint8_t bDescriptorSubtype; // USB_VIDEO_VC_INPUT_TERMINAL
+ uint8_t bTerminalID;
+ uint16_t wTerminalType;
+ uint8_t bAssocTerminal;
+ uint8_t iTerminal;
+} __PACKED usb_video_vc_input_terminal_desc;
+
+typedef struct {
+ uint8_t bLength;
+ uint8_t bDescriptorType; // USB_VIDEO_CS_INTERFACE
+ uint8_t bDescriptorSubtype; // USB_VIDEO_VC_OUTPUT_TERMINAL
+ uint8_t bTerminalID;
+ uint16_t wTerminalType;
+ uint8_t bAssocTerminal;
+ uint8_t bSourceID;
+ uint8_t iTerminal;
+} __PACKED usb_video_vc_output_terminal_desc;
+
+// class specific VC interrupt endpoint descriptor
+typedef struct {
+ uint8_t bLength;
+ uint8_t bDescriptorType; // USB_VIDEO_CS_ENDPOINT
+ uint8_t bDescriptorSubtype; // USB_ENDPOINT_INTERRUPT
+ uint16_t wMaxTransferSize;
+} __PACKED usb_video_vc_interrupt_endpoint_desc;
+
+typedef struct {
+ uint8_t bLength;
+ uint8_t bDescriptorType; // USB_VIDEO_CS_INTERFACE
+ uint8_t bDescriptorSubtype; // USB_VIDEO_VS_HEADER
+ uint8_t bNumFormats;
+ uint16_t wTotalLength;
+ uint8_t bEndpointAddress;
+ uint8_t bmInfo;
+ uint8_t bTerminalLink;
+ uint8_t bStillCaptureMethod;
+ uint8_t bTriggerSupport;
+ uint8_t bTriggerUsage;
+ uint8_t bControlSize;
+ uint8_t bmaControls[];
+} __PACKED usb_video_vs_input_header_desc;
+
+#define GUID_LENGTH 16
+
+// A GUID consists of a:
+// - four-byte integer
+// - two-byte integer
+// - two-byte integer
+// - eight-byte array
+//
+// The string representation uses big endian format, so to convert it
+// to a byte array we need to reverse the byte order of the three integers.
+//
+// See USB Video Class revision 1.5, FAQ section 2.9
+// for GUID Data Structure Layout.
+
+#define USB_VIDEO_GUID_YUY2_STRING "32595559-0000-0010-8000-00AA00389B71"
+#define USB_VIDEO_GUID_YUY2_VALUE { \
+ 0x59, 0x55, 0x59, 0x32, \
+ 0x00, 0x00, \
+ 0x10, 0x00, \
+ 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 \
+}
+
+#define USB_VIDEO_GUID_NV12_STRING "3231564E-0000-0010-8000-00AA00389B71"
+#define USB_VIDEO_GUID_NV12_VALUE { \
+ 0x4e, 0x56, 0x31, 0x32, \
+ 0x00, 0x00, \
+ 0x10, 0x00, \
+ 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 \
+}
+
+#define USB_VIDEO_GUID_M420_STRING "3032344D-0000-0010-8000-00AA00389B71"
+#define USB_VIDEO_GUID_M420_VALUE { \
+ 0x4d, 0x34, 0x32, 0x30, \
+ 0x00, 0x00, \
+ 0x10, 0x00, \
+ 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 \
+}
+
+#define USB_VIDEO_GUID_I420_STRING "30323449-0000-0010-8000-00AA00389B71"
+#define USB_VIDEO_GUID_I420_VALUE { \
+ 0x49, 0x34, 0x32, 0x30, \
+ 0x00, 0x00, \
+ 0x10, 0x00, \
+ 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 \
+}
+
+// USB Video Payload Uncompressed
+typedef struct {
+ uint8_t bLength;
+ uint8_t bDescriptorType; // USB_VIDEO_CS_INTERFACE
+ uint8_t bDescriptorSubType; // USB_VIDEO_VS_FORMAT_UNCOMPRESSED
+ uint8_t bFormatIndex;
+ uint8_t bNumFrameDescriptors;
+ uint8_t guidFormat[GUID_LENGTH];
+ uint8_t bBitsPerPixel;
+ uint8_t bDefaultFrameIndex;
+ uint8_t bAspectRatioX;
+ uint8_t bAspectRatioY;
+ uint8_t bmInterfaceFlags;
+ uint8_t bCopyProtect;
+} __PACKED usb_video_vs_uncompressed_format_desc;
+
+// USB Video Payload MJPEG
+typedef struct {
+ uint8_t bLength;
+ uint8_t bDescriptorType; // USB_VIDEO_CS_INTERFACE
+ uint8_t bDescriptorSubType; // USB_VIDEO_VS_FORMAT_MJPEG
+ uint8_t bFormatIndex;
+ uint8_t bNumFrameDescriptors;
+ uint8_t bmFlags;
+ uint8_t bDefaultFrameIndex;
+ uint8_t bAspectRatioX;
+ uint8_t bAspectRatioY;
+ uint8_t bmInterfaceFlags;
+ uint8_t bCopyProtect;
+} __PACKED usb_video_vs_mjpeg_format_desc;
+
+// Uncompressed and MJPEG formats have the same frame descriptor structure.
+typedef struct {
+ uint8_t bLength;
+ uint8_t bDescriptorType; // USB_VIDEO_CS_INTERFACE
+ uint8_t bDescriptorSubType; // USB_VIDEO_VS_FRAME_UNCOMPRESSED / USB_VIDEO_VS_FRAME_MJPEG
+ uint8_t bFrameIndex;
+ uint8_t bmCapabilities;
+ uint16_t wWidth;
+ uint16_t wHeight;
+ uint32_t dwMinBitRate;
+ uint32_t dwMaxBitRate;
+ uint32_t dwMaxVideoFrameBufferSize;
+ uint32_t dwDefaultFrameInterval;
+ uint8_t bFrameIntervalType;
+ uint32_t dwFrameInterval[];
+} __PACKED usb_video_vs_frame_desc;
+
+// Stream negotiation
+#define USB_VIDEO_BM_HINT_FRAME_INTERVAL (1 << 0)
+#define USB_VIDEO_BM_HINT_KEY_FRAME_RATE (1 << 1)
+#define USB_VIDEO_BM_HINT_P_FRAME_RATE (1 << 2)
+#define USB_VIDEO_BM_HINT_COMP_QUALITY (1 << 3)
+#define USB_VIDEO_BM_HINT_COMP_WINDOW_SIZE (1 << 4)
+
+typedef struct {
+ uint16_t bmHint;
+ uint8_t bFormatIndex;
+ uint8_t bFrameIndex;
+ uint32_t dwFrameInterval;
+ uint16_t wKeyFrameRate;
+ uint16_t wPFrameRate;
+ uint16_t wCompQuality;
+ uint16_t wCompWindowSize;
+ uint16_t wDelay;
+ uint32_t dwMaxVideoFrameSize;
+ uint32_t dwMaxPayloadTransferSize;
+ // The following fields are optional.
+ uint32_t dwClockFrequency;
+ uint8_t bmFramingInfo;
+ uint8_t bPreferedVersion;
+ uint8_t bMinVersion;
+ uint8_t bMaxVersion;
+ uint8_t bUsage;
+ uint8_t bBitDepthLuma;
+ uint8_t bmSettings;
+ uint8_t bMaxNumberOfRefFramesPlus1;
+ uint16_t bmRateControlModes;
+ uint32_t bmLayoutPerStream;
+} __PACKED usb_video_vc_probe_and_commit_controls;
+
+// For accessing payload bmHeaderInfo bitmap
+#define USB_VIDEO_VS_PAYLOAD_HEADER_FID (1 << 0)
+#define USB_VIDEO_VS_PAYLOAD_HEADER_EOF (1 << 1)
+#define USB_VIDEO_VS_PAYLOAD_HEADER_PTS (1 << 2)
+#define USB_VIDEO_VS_PAYLOAD_HEADER_SCR (1 << 3)
+#define USB_VIDEO_VS_PAYLOAD_HEADER_RES (1 << 4)
+#define USB_VIDEO_VS_PAYLOAD_HEADER_STI (1 << 5)
+#define USB_VIDEO_VS_PAYLOAD_HEADER_ERR (1 << 6)
+#define USB_VIDEO_VS_PAYLOAD_HEADER_EOH (1 << 7)
+
+// Common header for all payloads.
+typedef struct {
+ uint8_t bHeaderLength;
+ uint8_t bmHeaderInfo;
+
+} __PACKED usb_video_vs_payload_header;
+
+typedef struct {
+ uint8_t bHeaderLength;
+ uint8_t bmHeaderInfo;
+ uint32_t dwPresentationTime;
+ uint32_t scrSourceTimeClock;
+ // Frame number when the source clock was sampled.
+ uint16_t scrSourceClockSOFCounter;
+} __PACKED usb_video_vs_uncompressed_payload_header;
+
+__END_CDECLS;
+
diff --git a/system/uapp/lsusb/lsusb.c b/system/uapp/lsusb/lsusb.c
index 2496713..db7a708 100644
--- a/system/uapp/lsusb/lsusb.c
+++ b/system/uapp/lsusb/lsusb.c
@@ -18,7 +18,7 @@
#include <zircon/assert.h>
#include <zircon/syscalls.h>
#include <zircon/hw/usb.h>
-#include <zircon/hw/usb-hid.h>
+#include <zircon/hw/usb/hid.h>
#include <zircon/usb/device/c/fidl.h>
#include <pretty/hexdump.h>
diff --git a/system/uapp/usbctl/usbctl.c b/system/uapp/usbctl/usbctl.c
index ea01ecd..622805e 100644
--- a/system/uapp/usbctl/usbctl.c
+++ b/system/uapp/usbctl/usbctl.c
@@ -12,7 +12,7 @@
#include <ddk/protocol/usb/modeswitch.h>
#include <zircon/device/usb-peripheral.h>
#include <zircon/hw/usb.h>
-#include <zircon/hw/usb-cdc.h>
+#include <zircon/hw/usb/cdc.h>
#include <zircon/usb/peripheral/c/fidl.h>
#include <zircon/syscalls.h>
#include <zircon/types.h>
diff --git a/system/ulib/ddk/include/ddk/protocol/usb-old.h b/system/ulib/ddk/include/ddk/protocol/usb-old.h
index c971973..3db93e1 100644
--- a/system/ulib/ddk/include/ddk/protocol/usb-old.h
+++ b/system/ulib/ddk/include/ddk/protocol/usb-old.h
@@ -10,8 +10,6 @@
#include <zircon/compiler.h>
#include <zircon/types.h>
#include <zircon/hw/usb.h>
-#include <zircon/hw/usb-hub.h>
-#include <zircon/listnode.h>
__BEGIN_CDECLS;