Skip to content

rewrite(phase4): port regmap batch A from c-RCP — general map, EP0, generic/functional split - #142

Merged
SoundMatt merged 1 commit into
rewrite/v3-from-c-rcpfrom
phase4/regmap
Aug 21, 2026
Merged

SoundMatt merged 1 commit into
rewrite/v3-from-c-rcpfrom
phase4/regmap

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. Phase 4 batch A of a two-batch regmap port — batch B (HW pin map, named-signal index, request-stream/response-queue config, EP-ID map, optional-subsystem sections) is a separate later PR.

c-RCP's regmap.h/.c (3549+2662 = 6211 lines) is the content source of truth; cpp-RCP's prior regmap.hpp (534 lines) was a stub, matching ROADMAP.md's own flagged '~7x more complete in c-RCP' finding that originally scoped this phase.

Ported

  • EP0/root-client model, svr_implemented_options (REQ-RMAP-030, the 5 real bits + 3 legacy bits kept for request.hpp/e2e.hpp compat, documented as having no TC18 basis).
  • General register map: new GeneralMap struct (~40 fields, REQ-RMAP-023/026-039), render(), Table 20 wire codec, GeneralMapErrc.
  • Root-client/writer_ctx deriving lifecycle::WriterCtx.
  • SvrEpCfg (TC18 §13.7.1.2).
  • EndpointGenericConfig: real fields, boundary conversions (issue #311 batches 2-4), render()/apply_reconfig(), EpGenericCfgReconfigErrc.

Deliberate deferrals (batch B)

writer_ctx()'s via_valid_stream_association fail-closed (false) until batch B's EP-ID/byte_bus_id association table lands. HW pin map, request-stream/response-queue config, EP-ID map, optional-subsystem config, ep_functional_cfg_t — untouched.

Call sites

mock.hpp: 2-line rename fix (endpoint_count→general.svr_ep_count, magic→general.magic); test_mock.cpp: matching 4-line fix.

Verification

test_regmap.cpp: 558→1105 lines, 28→57 TEST_CASEs (327 assertions). Full tree rebuilds clean (0 errors/warnings), 56/56 ctest suites pass (100%) — independently re-verified from a fresh build.

…eneric/functional split

Part of the v3.0.0 ground-up rewrite (cpp-RCP #129, ROADMAP.md Phase 17),
branch rewrite/v3-from-c-rcp. Phase 4 batch A of a two-batch regmap port
(batch B — HW pin map, named-signal index, request-stream/response-queue
config, EP-ID map, optional-subsystem sections — is a separate later PR).

c-RCP's regmap.h/.c (3549+2662 = 6211 lines) is regmap's own content
source of truth; cpp-RCP's prior regmap.hpp (534 lines) was a stub with
real content gaps, matching ROADMAP.md's own flagged '~7x more complete
in c-RCP' finding that originally scoped this phase.

## Ported (c-RCP file:line -> cpp-RCP)

- EP0/root-client model (regmap.h:358-371, regmap.c:12-15) ->
  regmap::is_ep0(), kEp0.
- svr_implemented_options (REQ-RMAP-030, regmap.h:384-413): the 5 real
  bits (kOptCompoundWait/Trigger/Chained/TimeSync/EnhCancel); kept
  legacy kOptConditionalRequests/kOptSafetyRequests/kOptFragmentation
  (still referenced by request.hpp/e2e.hpp) with a comment explaining
  they have no TC18 basis per REQ-RMAP-004..008's retirement.
- General register map (regmap.h:416-1141, regmap.c:41-288): new
  GeneralMap struct (~40 fields, REQ-RMAP-023/026-039), render(),
  encode_read_response()/decode_read_response()/decode_write_request()
  (Table 20 wire codec), GeneralMapErrc.
- Root-client/writer_ctx (regmap.h:1152-1211, regmap.c:1684-1741):
  EpClient, writer_ctx() deriving lifecycle::WriterCtx.
- SvrEpCfg (TC18 Sec13.7.1.2, regmap.h:1211-1303): svr_discovery_timeout,
  svr_ep_status.
- EndpointGenericConfig (regmap.h:1310-1608): real fields
  (ep_type/ep_used/ep_delay_time/ep_req_storage_size/ep_description/
  ep_tx_buffer_size/ep_rx_buffer_size), ep_generic_cfg:: namespace with
  boundary conversions (issue #311 batches 2-4), render(),
  apply_reconfig() (per-field, matching c-RCP's documented rationale),
  EpGenericCfgReconfigErrc.

## Deliberate deferrals (marked TODO(phase4-batch-b) in-file)

- writer_ctx()'s via_valid_stream_association always returns false
  (fail-closed) until batch B's EP-ID/byte_bus_id association table
  lands (needs a request_stream_index field EpIdMappingEntry doesn't
  have yet).
- HW pin map, request-stream-cfg, response-queue-cfg, EP-ID map,
  optional-subsystem config, ep_functional_cfg_t: untouched, batch B.

## Cross-cutting note

c-RCP's ep_generic_cfg_t has no per-role CRC fields (that's
ep_functional_cfg_t's, batch B); cpp-RCP's pre-existing
EndpointGenericConfig already had three (ep_req/ack/response_crc_enable)
depended on by e2e.hpp/test_e2e.cpp -- kept, marked in-file as
pre-existing/non-c-RCP content rather than silently dropped or
relocated (relocation needs ep_functional_cfg_t, batch B's scope).

## Call sites

mock.hpp: RegisterMap::endpoint_count -> general.svr_ep_count,
magic -> general.magic (2 lines). test_mock.cpp: matching 4-line fix.
No other files touched.

## Verification

test_regmap.cpp: 558 -> 1105 lines, 28 -> 57 TEST_CASEs (327
assertions). Full tree rebuilds clean (0 errors, 0 warnings), 56/56
ctest suites pass (100%) -- independently re-verified from a fresh
build, not just the porting agent's own report. Heavy regmap
dependents (test_e2e, test_watchdog, test_request, test_discovery,
test_mock, test_gpio, test_adc) spot-checked with unchanged assertion
counts.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Matt <47545907+SoundMatt@users.noreply.github.com>
@SoundMatt
SoundMatt merged commit efbab1a into rewrite/v3-from-c-rcp Aug 21, 2026
22 checks passed
@SoundMatt
SoundMatt deleted the phase4/regmap branch August 21, 2026 22:08
SoundMatt added a commit that referenced this pull request Aug 22, 2026
…batch B

# Conflicts:
#	include/rcp/regmap.hpp
#	tests/test_regmap.cpp

Signed-off-by: Matt <47545907+SoundMatt@users.noreply.github.com>
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