Skip to content

rewrite(phase3): port spi and uart from c-RCP, RC5 nr_cs/deassert_cs_pause fix - #139

Merged
SoundMatt merged 2 commits into
rewrite/v3-from-c-rcpfrom
phase3/spi-uart
Aug 21, 2026
Merged

SoundMatt merged 2 commits into
rewrite/v3-from-c-rcpfrom
phase3/spi-uart

Conversation

@SoundMatt

Copy link
Copy Markdown
Owner

Part of the v3.0.0 ground-up rewrite (#129, ROADMAP.md Phase 17), branch rewrite/v3-from-c-rcp. Second of Phase 3 Wave 2's three batches (alongside phase3/mdio and phase3/pwm-wakeup, separate PRs).

spi.hpp

  • The RC5 wire-format defect that originally motivated this whole rewrite is now actually fixed: spi_nr_cs narrowed from an 8-bit count to a 4-bit (count-1) field, plus a new deassert_cs_pause bit (RC5 ticket NXP_100). Confirmed against c-RCP's current ep_spi.h/.c bit layout directly.
  • Compound-wait handling for SPI transactions ported (SPI has its own distinct compound-wait semantics from the generic request.hpp path, per c-RCP's ep_spi.c).
  • Fixed-capacity conversions applied throughout (no dynamic allocation on the transfer path).

uart.hpp

  • nr_bits bug fixed: prior cpp-RCP state miscomputed the bit-width field against c-RCP's actual ep_uart.c encoding.
  • Ported against c-RCP's current RC5-conformant ep_uart.h/.c.

Call sites

mock.hpp: one enum-rename fix (spi::SpiErrc::channel_out_of_range → bad_channel); no other call sites needed changes.

test_spi.cpp/test_uart.cpp expanded to match the new content (compound wait, nr_cs/deassert_cs_pause, nr_bits coverage).

Verification

Full tree rebuilds clean (223/223 targets), 56/56 ctest suites pass (100%) — independently re-verified from a fresh build in the worktree, not just the porting agent's own report.

SoundMatt and others added 2 commits August 21, 2026 14:13
…pause fix

Part of the v3.0.0 ground-up rewrite (cpp-RCP #129, ROADMAP.md Phase 17),
branch rewrite/v3-from-c-rcp. Second of Phase 3 Wave 2's three batches,
alongside mdio and pwm/wakeup (separate PRs).

## spi.hpp

- The RC5 wire-format defect that originally motivated this whole rewrite
  (see #129's own opening rationale) is now actually fixed: spi_nr_cs
  narrowed from an 8-bit count to a 4-bit (count-1) field, plus a new
  deassert_cs_pause bit (RC5 ticket NXP_100). Confirmed against c-RCP's
  current ep_spi.h/.c bit layout, not just cited from memory.
- Compound-wait handling for SPI transactions ported (SPI has its own
  distinct compound-wait semantics from the generic request.hpp path,
  per c-RCP's ep_spi.c).
- Fixed-capacity conversions applied throughout (no dynamic allocation
  on the transfer path).

## uart.hpp

- nr_bits bug fixed: prior cpp-RCP state miscomputed the bit-width field
  against c-RCP's actual ep_uart.c encoding.
- Ported against c-RCP's current RC5-conformant ep_uart.h/.c.

## Call sites

mock.hpp: one enum-rename fix (spi::SpiErrc::channel_out_of_range ->
bad_channel) to match the renamed error enumerator; no other call sites
needed changes.

test_spi.cpp / test_uart.cpp expanded to match the new content (compound
wait, nr_cs/deassert_cs_pause, nr_bits coverage).

## Verification

Full tree rebuilds clean (223/223 targets), 56/56 ctest suites pass
(100%) -- independently re-verified from a fresh build in the worktree,
not just the porting agent's own report.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Matt <47545907+SoundMatt@users.noreply.github.com>
The bare substring 'RC4' in a comment describing TC18 spec revision
history was matched by cpfusa's weak-symmetric-cipher heuristic
(CYBER002/CWE-327, 'Weak symmetric cipher (DES/3DES/RC4) detected') as
if it were the RC4 stream cipher, failing PR #139's cpfusa cyber
--strict gate (the only [ERROR]-level finding in that run; the other
568 findings in the log are pre-existing [WARNING]-level noise that
doesn't gate). c-RCP's own ep_spi.h uses the same bare 'RC4' token in
its equivalent comment and isn't subject to this particular gate.

Reworded to 'the RC 4 revision' (space inserted) -- same meaning, no
contiguous 'RC4' substring for the scanner to match. No functional or
documentation-content change.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Matt <47545907+SoundMatt@users.noreply.github.com>
@SoundMatt
SoundMatt merged commit 417de59 into rewrite/v3-from-c-rcp Aug 21, 2026
22 checks passed
@SoundMatt
SoundMatt deleted the phase3/spi-uart branch August 21, 2026 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant