Skip to main content

Module bus

Module bus 

Source
Expand description

bus - a device a driver reaches through the host of the bus it is on, not through registers of its own.

A USB device has no register window and no DMA arena a driver could be granted: its host controller owns both, and talks to every device on its bus. So a USB device’s driver is the host’s CLIENT. The host binds the device (xhci, dwc2 and ehci do, for one device each that they do not drive themselves), the supervisor starts the driver the device’s VID:PID names with that host as its peer, and the driver asks the host for the device’s transfers: who it is, control transfers on its default endpoint, and its bulk endpoints. That conversation is godspeed_sdk::usbfn; this module is it in the one shape a driver should use.

A bus, not a class. Nothing here knows what the device is - a radio, a serial adapter, a sensor - any more than registers knows what a register does. It moves transfers, and the device’s meaning is its driver’s (docs/driver-library.md, “What belongs here”).

What a host answers is narrow on purpose: the one device it bound for this driver, and nothing else on the bus.

Modules§

wire
The USB FUNCTION PROTOCOL’s numbers: what a USB host service (xhci, dwc2, ehci) answers for the one device it binds for a driver of its own, and what that driver asks. A driver package speaks it through gs::driver::bus; the WiFi dongle’s driver through godspeed_wifi::usbfn, which re-exports these and says what each one means in full (sdk/wifi/src/usbfn.rs). Every request starts with its op, and every reply with [op, status].

Structs§

Bound
Who the bound device is, as its host enumerated it.
Place
Where the host says the bound device is, from a host that says (wire::INFO_WHERE_AT): for a driver’s report of its hardware, never to address it by - the host does that.
UsbDevice
The device this driver was started for, reached through its host.

Enums§

UsbError
Why a transfer did not happen.