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::DelayNson 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) andembedded_hal_async::spi::SpiBus(RX-ready completion viarivet::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” splitRivetDelayresolves forDelayNs, just for a peripheral whose async completion is a genuine ISR instead of a timer. - serial
embedded-hal-nb::serial::{Read, Write}overrivet::console(plan.md Phase 15).- stellaris_
i2c - Stellaris/LM3S6965 I2C Master driver:
embedded_hal::i2c::I2c(polling) andembedded_hal_async::i2c::I2c(completion via a real interrupt throughrivet::sync::Signal) on the same struct — onlytransaction()is a required method on either trait,read/write/write_readcome 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 Signaland a namedfn()ISR bound to it, for one physical PL022 instance’s completion interrupt. SeePl022::newfor why this can’t just be a generic function with an inline static. - stellaris_
i2c_ instance - Declares a
static Signaland a namedfn()ISR bound to it, for one physical Stellaris I2C instance’s completion interrupt. SeeStellarisI2c::newfor why this can’t just be a generic function with an inline static.