| // 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.dci; |
| |
| using fuchsia.hardware.usb.request; |
| using zx; |
| |
| [Transport = "Banjo", BanjoLayout = "ddk-protocol"] |
| protocol UsbDci { |
| /// Queues a USB request with the DCI driver. |
| RequestQueue([InOut] fuchsia.hardware.usb.request.UsbRequest usb_request, |
| [InOut] fuchsia.hardware.usb.request.UsbRequestComplete complete_cb) -> (); |
| /// Registers callback interface with the DCI driver. |
| SetInterface(UsbDciInterface @interface) -> (zx.status s); |
| /// Configures an endpoint based on provided descriptors. |
| ConfigEp(fuchsia.hardware.usb.descriptor.UsbEndpointDescriptor ep_desc, |
| fuchsia.hardware.usb.descriptor.UsbSsEpCompDescriptor ss_comp_desc) -> (zx.status s); |
| /// Disables the specified endpoint. |
| DisableEp(uint8 ep_address) -> (zx.status s); |
| /// Stalls the specified endpoint. |
| EpSetStall(uint8 ep_address) -> (zx.status s); |
| /// Clears a stall condition for the specified endpoint. |
| EpClearStall(uint8 ep_address) -> (zx.status s); |
| /// Returns the size needed for a |usb_request_t|, including private storage needed by the |
| /// HCI driver. |
| GetRequestSize() -> (uint64 size); |
| /// Cancels all transactions currently queued on the specified endpoint. |
| CancelAll(uint8 ep_address) -> (zx.status s); |
| }; |
| |
| /// Interface for use by the DCI controller to call into the USB peripheral driver. |
| [Transport = "Banjo", BanjoLayout = "ddk-interface"] |
| protocol UsbDciInterface { |
| /// Callback for handling ep0 control requests. |
| Control(fuchsia.hardware.usb.descriptor.UsbSetup setup, [Buffer] vector<uint8> write) -> (zx.status status, |
| [Buffer] vector<uint8> read); |
| /// Notifies change in USB connected state. |
| SetConnected(bool connected) -> (); |
| /// Notifies current USB speed.. |
| SetSpeed(fuchsia.hardware.usb.descriptor.UsbSpeed speed) -> (); |
| }; |