Repository navigation
rewrite(phase3): port iseled/i2c from c-RCP; fix ROADMAP.md's Phase 17 missing i2c entry - #135
Merged
Merged
Conversation
…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>
10 tasks
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.
Part of the v3.0.0 ground-up rewrite (#129, ROADMAP.md Phase 17). First of Phase 3's Wave 1 batches, alongside
can/linandadc/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(decodingAcfMessageInfo::hs) and a localcompound_wait_matches_bitshelper were both invented and wrong. c-RCP'si2c_modeis a persistent 5-way preset stored in a Table 49 register block, never carried onhs; I2C has no endpoint-specific compound-wait logic in c-RCP at all —acf.hpp's genericcompound_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'sep_iseled.c(which genuinely#includesfragment.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'sdispatch_iseled()/set_iseled_response()+ 3test_mock.cppcases depended on the removed ISELED types — updated to match the new signature (mirroringdispatch_i2c's existing pattern).i2c.hppneeded nomock.hppchanges.Verified
Full tree rebuilds clean (223/223 targets), 56/56 ctest suites pass (100%) — independently re-verified from a fresh build.
Tracked at #129.