blob: 4ac7e6a4d99ba473b3d2513ff2a99e4eee21d9f6 [file] [log] [blame]
// 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")
closed protocol UsbDci {
/// Queues a USB request with the DCI driver.
strict 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.
strict SetInterface(resource struct {
interface client_end:UsbDciInterface;
}) -> (struct {
s zx.Status;
});
/// Configures an endpoint based on provided descriptors.
strict 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.
strict DisableEp(struct {
ep_address uint8;
}) -> (struct {
s zx.Status;
});
/// Stalls the specified endpoint.
strict EpSetStall(struct {
ep_address uint8;
}) -> (struct {
s zx.Status;
});
/// Clears a stall condition for the specified endpoint.
strict 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.
strict GetRequestSize() -> (struct {
size uint64;
});
/// Cancels all transactions currently queued on the specified endpoint.
strict 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")
closed protocol UsbDciInterface {
/// Callback for handling ep0 control requests.
strict 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.
strict SetConnected(struct {
connected bool;
}) -> ();
/// Notifies current USB speed..
strict SetSpeed(struct {
speed fuchsia.hardware.usb.descriptor.UsbSpeed;
}) -> ();
};