You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(rp2040): phase 0 — resource contracts and mock peripherals #3653
Implementation Phase 0 of #3648. This is the prerequisite for every RP2040 RX/TX driver phase.
Scope
Build one shared RP2040 resource owner for PIO instruction memory, PIO state machines, DMA channels, and claimed pins. Add injectable PIO/UART/SPI peripheral interfaces with singleton mocks, configuration/transaction history, deterministic completion, and failure injection. Use Pico SDK APIs and headers; do not add handwritten register maps.
Acceptance criteria
Host tests cover every resource/DREQ mapping used by later phases.
Success, partial initialization, exhaustion, timeout, abort, destruction, and retry leave no outstanding claims.
IRQ/shared state is safe on dual-core RP2040.
Mocks prove READY/BUSY/DRAINING/ERROR and cleanup behavior before hardware implementation.
Exit gate
Host-only evidence is sufficient for this phase. No attached-board driver claim is allowed.
Add one generic PIO/UART/SPI virtual peripheral interface now.
Centralize only the RP resource ownership boundary and leave each protocol phase to add its own focused mock.
Leave the current direct SDK claims in place and add tests around them later.
We are taking (2). A common transaction interface would encode behavior that PIO RX, UART, and SPI do not actually share, before their drivers exist; it would make later driver tests less truthful. Phase 0 instead supplies a host-testable ownership ledger (PIO SMs, DMA channels, and pins), a Pico-SDK adapter guarded by an RP hardware spinlock, and transactional rollback in the current PIO/DMA users. Each driver phase will add an injectable peripheral mock at its real driver boundary, where configuration and transaction history have concrete semantics.
This keeps the phase sequence intact while making the existing drivers safe to compose now.
Activity
zackees commentedon Jul 15, 2026
Implementation decision for Phase 0:
I compared three approaches:
We are taking (2). A common transaction interface would encode behavior that PIO RX, UART, and SPI do not actually share, before their drivers exist; it would make later driver tests less truthful. Phase 0 instead supplies a host-testable ownership ledger (PIO SMs, DMA channels, and pins), a Pico-SDK adapter guarded by an RP hardware spinlock, and transactional rollback in the current PIO/DMA users. Each driver phase will add an injectable peripheral mock at its real driver boundary, where configuration and transaction history have concrete semantics.
This keeps the phase sequence intact while making the existing drivers safe to compose now.
feat(rp): centralize PIO and DMA resource ownership (FastLED#3662)