Flesh out the xHCI host-controller driver into a full transfer engine and build the three USB class drivers on top, all verified end to end under QEMU. - xHCI engine (usb-xhci-library.zig): controller reset, command/event rings with cycle-bit bookkeeping (gated on a No-Op-command proof), device slots, Address Device, control transfers, full chapter-9 enumeration, Configure Endpoint, and interrupt/bulk transfers. Each interface is device_registered with its (class,subclass,protocol) identity, unique per (port,interface). - Bus<->class transfer protocol (usb-transfer-protocol.zig + runtime.usb): open / control / interrupt-subscribe (async report pump on a poll timer) / bulk-by- physical-address, so sector data never crosses the 256-byte IPC limit. - USB HID keyboard + mouse (usb-hid/): decode boot-protocol reports and publish to the input service. A USB usage is already the input protocol's keycode. - USB mass storage (usb-storage/): Bulk-Only Transport + transparent SCSI, serving a block device under the new .block service id (block-protocol). - device-manager matches USB interfaces to class drivers (usbDriverForIdentity). - usb-abi / usb-ids made importable modules; add HID and mass-storage class requests, packTriple, and a usb_device DeviceClass. - Fix test/qemu_test.py on macOS: the QMP unix-socket path was built from the deep worktree path and exceeded the 104-byte sun_path limit, so QEMU exited before booting. It now lives under a short temp path. Tests: usb-report, usb-hid, usb-storage pass under python3 test/qemu_test.py; host units (usb-abi, usb-ids, hid-report, bulk-only-transport, scsi) green.
57 lines
2.8 KiB
Zig
57 lines
2.8 KiB
Zig
//! danos user-space runtime library — a nascent libc. Every user binary (init,
|
|
//! and later the VFS server + device drivers) imports this as `@import("runtime")`:
|
|
//! system_call wrappers, the C-convention heap, IPC helpers, and the process start
|
|
//! shim. It is compiled into each binary (inheriting its `.large` code model and
|
|
//! freestanding target), so all user programs share one implementation.
|
|
//!
|
|
//! A user binary needs three lines:
|
|
//! const runtime = @import("runtime");
|
|
//! pub const panic = runtime.panic;
|
|
//! comptime { _ = &runtime.start._start; } // pull the entry shim in
|
|
//! and a `pub fn main() void` or `pub fn main(init: runtime.process.Init) void`
|
|
//! (arguments arrive via `init`).
|
|
|
|
pub const system = @import("system.zig");
|
|
/// Monotonic time, delays, and deadlines over the kernel clock/sleep/timer syscalls
|
|
/// — an `Instant`/`Duration` front door, no time service (docs/timers.md).
|
|
pub const time = @import("time.zig");
|
|
pub const heap = @import("heap.zig");
|
|
pub const ipc = @import("ipc.zig");
|
|
pub const start = @import("start.zig");
|
|
/// The VFS wire protocol (shared with the VFS server).
|
|
pub const vfs_protocol = @import("vfs-protocol");
|
|
|
|
/// The device-manager protocol: hello + tree reports (docs/device-manager.md).
|
|
pub const device_manager_protocol = @import("device-manager-protocol");
|
|
|
|
/// The power protocol: events (button, lid, battery) + shutdown (docs/power.md).
|
|
pub const power_protocol = @import("power-protocol");
|
|
/// Keyboard-event listening (subscribe/next) and broadcasting (publish), over the input
|
|
/// service. See library/runtime/input.zig and system/services/input/.
|
|
pub const input = @import("input.zig");
|
|
/// The input wire protocol (shared with the input service and its clients).
|
|
pub const input_protocol = @import("input-protocol");
|
|
/// POSIX-style file API: open/read/write/lseek/stat/close.
|
|
/// C stdio: fopen/fread/fwrite/fseek/ftell/fclose over unistd.
|
|
/// Device access for drivers: enumerate/claim/mmioMap.
|
|
pub const device = @import("device.zig");
|
|
/// DMA-capable memory for drivers: contiguous, pinned, uncacheable buffers.
|
|
pub const dma = @import("dma.zig");
|
|
|
|
/// USB class-driver client: open a device on the xHCI bus and drive it
|
|
/// (control / interrupt / bulk transfers). See library/runtime/usb.zig.
|
|
pub const usb = @import("usb.zig");
|
|
|
|
/// Re-exported so a user binary can `pub const panic = runtime.panic;`.
|
|
pub const panic = start.panic;
|
|
|
|
/// Process entry types: the `Init` handed to `main`, and its `Arguments`.
|
|
pub const process = @import("process.zig");
|
|
|
|
/// The service harness: one replyWait loop folding requests, signals, and
|
|
/// notifications into callbacks (docs/process-lifecycle.md).
|
|
pub const service = @import("service.zig");
|
|
|
|
/// The heap as a `std.mem.Allocator`, for Zig `std` containers in user code.
|
|
pub const allocator = heap.allocator;
|