Skip to content

rewrite(phase3): port iseled/i2c from c-RCP; fix ROADMAP.md's Phase 17 missing i2c entry - #135

Merged
SoundMatt merged 1 commit into
rewrite/v3-from-c-rcpfrom
phase3/iseled-i2c
Aug 21, 2026
Merged

SoundMatt merged 1 commit into
rewrite/v3-from-c-rcpfrom
phase3/iseled-i2c

Conversation

@SoundMatt

Copy link
Copy Markdown
Owner

Part of the v3.0.0 ground-up rewrite (#129, ROADMAP.md Phase 17). First of Phase 3's Wave 1 batches, alongside can/lin and adc/gpio (separate PRs).

ROADMAP.md fix: Phase 17's endpoint-module list omitted i2c, a real 11th endpoint type both c-RCP and cpp-RCP have. Added.

Both modules were pre-rewrite (v2.20.0-era) content — a wholesale mismatch, not incremental drift

  • i2c.hpp: the 'pilot' I2cMode/i2c_mode_of (decoding AcfMessageInfo::hs) and a local compound_wait_matches_bits helper were both invented and wrong. c-RCP's i2c_mode is a persistent 5-way preset stored in a Table 49 register block, never carried on hs; I2C has no endpoint-specific compound-wait logic in c-RCP at all — acf.hpp's generic compound_wait_match() (Phase 1) is correct. Removed both, ported the real Table 49 register block and bidirectional transfer codec (c-RCP REQ-I2C-010/018/023).
  • iseled.hpp: the old 12-bit Instruction/Address/Data ACF-payload struct modeled the wrong layer — c-RCP's ACF codec treats the payload as opaque raw bytes; the 12-bit decode belongs to ISELED's physical symbol layer. Replaced wholesale: native 4-bit/5-bit even-parity bit framing, an independent CRC-8 layer, requires_isp_n (issue #270 fix), Table 58 register block, write/read-direction request split (issue #471).

fragment.hpp (Phase 1) wired into ISELED's response fragmentation, matching c-RCP's ep_iseled.c (which genuinely #includes fragment.h). I2C has no fragmentation in c-RCP; none added.

test_i2c.cpp: 14→44 cases. test_iseled.cpp: 24→75 cases.

Call sites touched

mock.hpp's dispatch_iseled()/set_iseled_response() + 3 test_mock.cpp cases depended on the removed ISELED types — updated to match the new signature (mirroring dispatch_i2c's existing pattern). i2c.hpp needed no mock.hpp changes.

Verified

Full tree rebuilds clean (223/223 targets), 56/56 ctest suites pass (100%) — independently re-verified from a fresh build.

Tracked at #129.

…7 missing i2c entry

Part of the v3.0.0 ground-up rewrite (cpp-RCP #129, ROADMAP.md Phase 17),
branch rewrite/v3-from-c-rcp. First of Phase 3's Wave 1 batches to land,
alongside can/lin and adc/gpio (separate PRs).

ROADMAP.md fix: Phase 17's endpoint-module list omitted i2c, a real 11th
endpoint type both c-RCP and cpp-RCP have. Added.

Both target modules were pre-rewrite (v2.20.0-era) content this rewrite's
Phase 1/2 never touched -- not incremental drift, a wholesale mismatch
against c-RCP's current design, confirmed against ep_i2c.h/.c and
ep_iseled.h/.c:

- i2c.hpp: the 'pilot' I2cMode/i2c_mode_of (a 2-way decode of
  AcfMessageInfo::hs) and a local compound_wait_matches_bits helper were
  both invented and wrong. c-RCP's i2c_mode is a persistent 5-way preset
  (STANDARD..ULTRA_FAST) stored in a Table 49 register block, never
  carried on hs; I2C has no endpoint-specific compound-wait logic in
  c-RCP at all -- acf.hpp's own compound_wait_match() (ported in Phase 1)
  is the correct generic primitive. Removed both. Ported: I2cFunctionalCfg
  + lifecycle-gated setters, the Table 49 register block, I2cDir-
  parameterized bidirectional transfer request/response codec (c-RCP
  REQ-I2C-010/018/023), i2c_mode_valid.
- iseled.hpp: the old IseledRequest/IseledResponse structs (12-bit
  Instruction/Address/Data ACF-payload fields) modeled the wrong layer --
  c-RCP's ACF codec treats the payload as opaque raw bytes (same as I2C/
  LIN); the 12-bit-field decode belongs to ISELED's physical symbol
  layer, not the ACF wire codec. Replaced wholesale with c-RCP's real
  content: native 4-bit/5-bit even-parity bit framing, an independent
  CRC-8 integrity layer, requires_isp_n (issue #270 polarity fix),
  IseledFunctionalCfg + Table 58 register block, and the write-direction
  vs. read-direction request split (issue #471).

fragment.hpp usage: c-RCP's ep_iseled.c genuinely #includes rcp/fragment.h
and calls its plan_count()/plan() directly -- ported identically
(response_fragment_count()/encode_response_fragmented()). I2C has no
fragmentation in c-RCP; none added.

Fixed-capacity: EpFuncBlock in both modules is a fixed std::array (11/14
octets), matching c-RCP's fixed-size register block.

test_i2c.cpp: 14 -> 44 TEST_CASEs (203 assertions).
test_iseled.cpp: 24 -> 75 TEST_CASEs (337 assertions).

Call sites touched: mock.hpp's dispatch_iseled()/set_iseled_response()
and 3 test_mock.cpp ISELED test cases depended on the removed Iseled
Request/Response types -- updated dispatch_iseled to pass the raw ACF
payload straight to IseledEndpoint::handle_request (mirroring
dispatch_i2c's existing pattern), set_iseled_response to take
std::vector<uint8_t>, removed the stale field_out_of_range wire-error
mapping. i2c.hpp needed no mock.hpp changes (I2cEndpoint::handle_request's
signature was unchanged).

Not touched here, explicitly tracked for later phases: cpp-RCP's
.fusa-reqs.json still has only 7 stale REQ-ISELED-*/REQ-I2C-* entries
(Phase 6 scope); ISELED response fragmentation's mock-dispatch wiring
is Phase 4 scope (only ep_iseled.c-side encode was ported here).

Verified: full tree rebuilds clean (223/223 targets), 56/56 ctest
suites pass (100%) -- independently re-verified from a fresh build, 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>
@SoundMatt
SoundMatt merged commit 8821de9 into rewrite/v3-from-c-rcp Aug 21, 2026
22 checks passed
@SoundMatt
SoundMatt deleted the phase3/iseled-i2c branch August 21, 2026 20:43
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