| // 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 fuchsia.hardware.usb.bus; |
| |
| using zx; |
| using fuchsia.hardware.usb.hub; |
| using fuchsia.hardware.usb.hubdescriptor; |
| using fuchsia.hardware.usb.request; |
| |
| alias UsbSpeed = uint32; |
| |
| // Note: the "uint64 foo_device" parameters should be interpreted as zx_device_t*. |
| // TODO(fxb/69023): restore types. |
| @transport("Banjo") |
| @banjo_layout("ddk-protocol") |
| protocol UsbBus { |
| /// Configures a new hub based on its USB hub descriptor. |
| ConfigureHub(struct { |
| @in_out |
| hub_device uint64; |
| speed UsbSpeed; |
| desc fuchsia.hardware.usb.hubdescriptor.UsbHubDescriptor; |
| multi_tt bool; |
| }) -> (struct { |
| s zx.status; |
| }); |
| /// Informs the USB bus that a new device has been added. |
| DeviceAdded(struct { |
| @in_out |
| hub_device uint64; |
| port uint32; |
| speed UsbSpeed; |
| }) -> (struct { |
| s zx.status; |
| }); |
| /// Informs the USB bus that a device has been removed. |
| DeviceRemoved(struct { |
| @in_out |
| hub_device uint64; |
| port uint32; |
| }) -> (struct { |
| s zx.status; |
| }); |
| /// Used by USB hub driver to register its USB hub protocol with the USB bus driver. |
| SetHubInterface(resource struct { |
| @in_out |
| usb_device uint64; |
| hub client_end:fuchsia.hardware.usb.hub.UsbHubInterface; |
| }) -> (struct { |
| s zx.status; |
| }); |
| /// Queues a USB request with the host stack. |
| RequestQueue(resource struct { |
| @in_out |
| usb_request fuchsia.hardware.usb.request.UsbRequest; |
| @in_out |
| complete_cb client_end:fuchsia.hardware.usb.request.UsbRequestCompleteCallback; |
| }) -> (); |
| }; |
| |
| /// Interface for use by the HCI controller to use to notify when devices are added and removed. |
| @transport("Banjo") |
| @banjo_layout("ddk-interface") |
| protocol UsbBusInterface { |
| /// Notifies the USB bus driver that a new device has been added. |
| AddDevice(struct { |
| device_id uint32; |
| hub_id uint32; |
| speed UsbSpeed; |
| }) -> (struct { |
| s zx.status; |
| }); |
| /// Notifies the USB bus driver that a device has been removed. |
| RemoveDevice(struct { |
| device_id uint32; |
| }) -> (struct { |
| s zx.status; |
| }); |
| /// Used by the HCI controller to reset a port on a USB hub. |
| ResetPort(struct { |
| hub_id uint32; |
| port uint32; |
| enumerating bool; |
| }) -> (struct { |
| s zx.status; |
| }); |
| /// Used by the HCI controller to reinitialize a device after it has been reset. |
| ReinitializeDevice(struct { |
| device_id uint32; |
| }) -> (struct { |
| s zx.status; |
| }); |
| }; |