blob: eb3418fc5b02ad1144fc3161435421b2326aa6bd [file] [log] [blame]
// Copyright 2023 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.
@available(added=HEAD)
library fuchsia.hardware.usb.hci;
using zx;
using fuchsia.hardware.usb.descriptor;
using fuchsia.hardware.usb.endpoint;
/// The UsbHci protocol is implemented by a USB Host Controller driver.
@discoverable
closed protocol UsbHci {
/// Connects to endpoint. Returns
/// * ZX_ERR_NOT_FOUND: if device id and/or endpoint address does not exist.
/// * ZX_ERR_ALREADY_BOUND: if the endpoint is already bound.
strict ConnectToEndpoint(resource struct {
device_id uint32;
ep_addr uint8;
ep server_end:fuchsia.hardware.usb.endpoint.Endpoint;
}) -> () error zx.Status;
/// Registers callbacks to the USB bus driver with the HCI driver.
strict SetInterface(resource struct {
interface client_end:UsbHciInterface;
}) -> () error zx.Status;
/// Returns the maximum number of USB devices that might be connected to the controller.
strict GetMaxDeviceCount() -> (struct {
count uint64;
});
/// Enables or disables an endpoint using parameters derived from |ep_desc|.
strict EnableEndpoint(struct {
device_id uint32;
ep_desc fuchsia.hardware.usb.descriptor.UsbEndpointDescriptor;
ss_com_desc fuchsia.hardware.usb.descriptor.UsbSsEpCompDescriptor;
enable bool;
}) -> () error zx.Status;
/// Returns the current frame (in milliseconds), used for isochronous transfers.
strict GetCurrentFrame() -> (struct {
frame uint64;
});
/// Called by the USB hub driver to configure a newly enumerated USB hub.
strict ConfigureHub(struct {
device_id uint32;
speed fuchsia.hardware.usb.descriptor.UsbSpeed;
desc fuchsia.hardware.usb.descriptor.UsbHubDescriptor;
multi_tt bool;
}) -> () error zx.Status;
/// Called by the USB hub driver when a new device is attached.
strict HubDeviceAdded(struct {
device_id uint32;
port uint32;
speed fuchsia.hardware.usb.descriptor.UsbSpeed;
}) -> () error zx.Status;
/// Called by the USB hub driver when a device has been removed.
strict HubDeviceRemoved(struct {
device_id uint32;
port uint32;
}) -> () error zx.Status;
/// Called by the USB hub driver when a device has been reset.
strict HubDeviceReset(struct {
device_id uint32;
port uint32;
}) -> () error zx.Status;
/// Resets an endpoint on the specified device.
strict ResetEndpoint(struct {
device_id uint32;
ep_address uint8;
}) -> () error zx.Status;
/// Resets the specified device.
strict ResetDevice(struct {
hub_address uint32;
device_id uint32;
}) -> () error zx.Status;
/// Returns the maximum size of a packet that can be queued on the specified endpoint.
strict GetMaxTransferSize(struct {
device_id uint32;
ep_address uint8;
}) -> (struct {
size uint64;
}) error zx.Status;
};
/// Equivalent to banjo UsbBusInterface
closed protocol UsbHciInterface {
/// Notifies the USB bus driver that a new device has been added.
strict AddDevice(struct {
device_id uint32;
hub_id uint32;
speed fuchsia.hardware.usb.descriptor.UsbSpeed;
}) -> () error zx.Status;
/// Notifies the USB bus driver that a device has been removed.
strict RemoveDevice(struct {
device_id uint32;
}) -> () error zx.Status;
/// Used by the HCI controller to reset a port on a USB hub.
strict ResetPort(struct {
hub_id uint32;
port uint32;
enumerating bool;
}) -> () error zx.Status;
/// Used by the HCI controller to reinitialize a device after it has been reset.
strict ReinitializeDevice(struct {
device_id uint32;
}) -> () error zx.Status;
};
service UsbHciService {
device client_end:UsbHci;
};