Skip to main content

Crate rivet_bsp_support

Crate rivet_bsp_support 

Source
Expand description

Shared helpers for rivet-bsp-* crates.

Small, board-shape-agnostic pieces that would otherwise be reimplemented per board: a software watchdog fallback for boards without real watchdog hardware, and an NS16550-compatible UART driver (the most common “some UART is mapped somewhere” case on RV32 platforms). Nothing here is wired to the port contract directly — each BSP’s own #[no_mangle] functions call into these.

Modules§

delay
embedded-hal-async::delay::DelayNs on top of the preemptive tier’s blocking sleep (plan.md Phase 15).
ns16550
Minimal NS16550-compatible UART driver: blind byte writes to the transmit-holding register, no THRE (transmit-ready) check. This matches the original QEMU-virt port’s behavior exactly (QEMU’s model never actually backpressures), but is a known simplification — a real NS16550 can drop bytes under load without checking LSR.THRE first. Tracked as future BSP driver work, not fixed here.
pl022
PL022 SSP/SPI driver, this workspace’s reference async peripheral driver: embedded_hal::spi::SpiBus (polling, safe from a preemptive task) and embedded_hal_async::spi::SpiBus (RX-ready completion via rivet::sync::Signal, driven by a real hardware interrupt) on the same struct — same “sync trait for the preemptive tier, async trait for the cooperative tier” split RivetDelay resolves for DelayNs, just for a peripheral whose async completion is a genuine ISR instead of a timer.
serial
embedded-hal-nb::serial::{Read, Write} over rivet::console (plan.md Phase 15).
stellaris_i2c
Stellaris/LM3S6965 I2C Master driver: embedded_hal::i2c::I2c (polling) and embedded_hal_async::i2c::I2c (completion via a real interrupt through rivet::sync::Signal) on the same struct — only transaction() is a required method on either trait, read/write/write_read come free as default methods that call it.
sw_watchdog
Software watchdog fallback: for boards with no real watchdog hardware, arm a deadline and check it on every tick. Not independent of the CPU: unlike a real hardware watchdog, this cannot catch a hang that stops the tick itself (e.g. a spin loop with interrupts disabled) — document that limitation prominently in any BSP that uses this.

Macros§

pl022_instance
Declares a static Signal and a named fn() ISR bound to it, for one physical PL022 instance’s completion interrupt. See Pl022::new for why this can’t just be a generic function with an inline static.
stellaris_i2c_instance
Declares a static Signal and a named fn() ISR bound to it, for one physical Stellaris I2C instance’s completion interrupt. See StellarisI2c::new for why this can’t just be a generic function with an inline static.