1// Copyright 2018 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5library ddk.protocol.usb.bus;
6
7using zx;
8using ddk.driver;
9using ddk.protocol.usb.hub;
10using zircon.hw.usb;
11using zircon.hw.usb.hub;
12
13enum UsbSpeed : uint32 {
14};
15
16[Layout = "ddk-protocol"]
17interface UsbBus {
18    /// Configures a new hub based on its USB hub descriptor.
19    ConfigureHub(ddk.driver.ZxDevice? hub_device, UsbSpeed speed,
20                 zircon.hw.usb.hub.UsbHubDescriptor desc) -> (zx.status s);
21    /// Informs the USB bus that a new device has been added.
22    DeviceAdded(ddk.driver.ZxDevice? hub_device, uint32 port, UsbSpeed speed) -> (zx.status s);
23    /// Informs the USB bus that a device has been removed.
24    DeviceRemoved(ddk.driver.ZxDevice? hub_device, uint32 port) -> (zx.status s);
25    /// Used by USB hub driver to register its USB hub protocol with the USB bus driver.
26    SetHubInterface(ddk.driver.ZxDevice? usb_device, ddk.protocol.usb.hub.UsbHubInterface hub)
27-> (zx.status s);
28};
29
30/// Interface for use by the HCI controller to use to notify when devices are added and removed.
31[Layout = "ddk-interface"]
32interface UsbBusInterface {
33    /// Notifies the USB bus driver that a new device has been added.
34    AddDevice(uint32 device_id, uint32 hub_id, UsbSpeed speed) -> (zx.status s);
35    /// Notifies the USB bus driver that a device has been removed.
36    RemoveDevice(uint32 device_id) -> (zx.status s);
37    /// Used by the HCI controller to reset a port on a USB hub.
38    ResetPort(uint32 hub_id, uint32 port, bool enumerating) -> (zx.status s);
39    /// Used by the HCI controller to reinitialize a device after it has been reset.
40    ReinitializeDevice(uint32 device_id) -> (zx.status s);
41};
42