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