feat(pio): implement TX/RX FIFO join (FJOIN_TX / FJOIN_RX)#152
Open
begeistert wants to merge 1 commit into
Open
feat(pio): implement TX/RX FIFO join (FJOIN_TX / FJOIN_RX)#152begeistert wants to merge 1 commit into
begeistert wants to merge 1 commit into
Conversation
The PIO state machines always exposed two fixed 4-deep FIFOs and ignored the FJOIN_TX / FJOIN_RX bits in SHIFTCTRL, so programs that merge the two halves into a single 8-deep FIFO (a common idiom for deeper TX buffering or RX capture) observed the wrong depth, FLEVEL and FSTAT full/empty flags. - FIFO gains an adjustable usable depth (setCapacity) on top of its allocated buffer; full/size now honour it. - StateMachine allocates 8-deep FIFOs and applies the join configuration via updateFifoJoin() on construction and on every SHIFTCTRL write. The joined direction becomes 8 deep, the donated direction is disabled (depth 0, reads back as both empty and full), and reconfiguring the join empties both FIFOs, matching the RP2040 datasheet (§3.5.4). Adds tests covering the 8-deep TX and RX joins, overflow/TXOVER behaviour, the disabled opposite direction, and FIFO clearing on reconfiguration.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The PIO state machines always expose two fixed 4-deep FIFOs and ignore the
FJOIN_TX/FJOIN_RXbits inSHIFTCTRL. Programs that merge the two halves into a single 8-deep FIFO — a common idiom for deeper TX buffering or RX capture — observe the wrong depth,FLEVEL, andFSTATfull/empty flags.Change
FIFOgains an adjustable usable depth (setCapacity) on top of its allocated buffer;full/sizenow honour it.StateMachineallocates 8-deep FIFOs and applies the join configuration viaupdateFifoJoin()on construction and on everySHIFTCTRLwrite. The joined direction becomes 8 deep, the donated direction is disabled (depth 0, reads back as both empty and full), and reconfiguring the join empties both FIFOs — matching the RP2040 datasheet (§3.5.4).Tests
Adds tests covering the 8-deep TX and RX joins, overflow /
TXOVERbehaviour, the disabled opposite direction, and FIFO clearing on reconfiguration.For context: this came out of RP2040Sharp, a C# port of rp2040js, while differential-testing the PIO against real RP2040 silicon — the FIFO-join semantics here were validated against hardware. Contributing it back upstream.