Repository navigation
fix(lpc): use vendor SYSCON_SYSAHBCLKCTRL0_*_MASK — closes #3517 Phase B.3 SYSCON audit - #3533
Merged
Merged
Conversation
…e B.3 SYSCON audit
Two matched call sites — SPI+DMA driver (`spi_arm_lpc_dma.h`) and SCT+DMA
runtime (`drivers/sct_dma/lpc_sct_dma_runtime.cpp.hpp`) — both power up
DMA0 via `SYSCON->SYSAHBCLKCTRL0 |= (1UL << 29)` with `TODO(3453)` /
`TODO(2842)` markers asking for the bit position to be verified against
UM11029 §4.6.13.
Verified against NXP mcux-sdk `devices/LPC845/LPC845.h`:
#define SYSCON_SYSAHBCLKCTRL0_DMA_MASK (0x20000000U)
#define SYSCON_SYSAHBCLKCTRL0_DMA_SHIFT (29U)
#define SYSCON_SYSAHBCLKCTRL0_SCT_MASK (0x100U)
#define SYSCON_SYSAHBCLKCTRL0_SCT_SHIFT (8U)
Both match the legacy driver's bit assignments (bit 29 = DMA clock,
bit 8 = SCT clock). Migrating to the vendor macros:
- Kills the raw `(1UL << 29)` / `(1UL << 8)` magic numbers at the call
sites.
- Removes the "TODO verify" markers — the vendor CMSIS PAL is the source
of truth per `agents/docs/register-maps.md`.
- Adds an authoritative citation (UM11029 §4.6.13 Table 41 + vendor
macro name) on every touched line, per `agents/docs/register-maps.md`
reviewer checklist bullet 3.
Contributes toward #3517 Phase B.3 acceptance (\"verify
SYSCON->SYSAHBCLKCTRL0 bit 29 is DMA per UM11029 §4.6.13 and cite the
section\").
## Verification
- `bash test --cpp` — 345/345 pass (unchanged)
- Grep confirms no other `(1UL << 29)` sites remain in the LPC tree
that need the same migration
- No behavioral change — the mask value is identical to the prior
literal, just now expressed via the vendor CMSIS macro
Refs: #3517 Phase B.3, `agents/docs/register-maps.md`.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughTwo LPC845 driver files were updated to replace hard-coded bit-shift expressions for enabling SCT and DMA clocks with named SYSCON_SYSAHBCLKCTRL0 mask constants. Comments were revised to reference these constants. No functional behavior or public API changes occurred. ChangesSYSCON Clock Mask Usage
Estimated code review effort: 1 (Trivial) | ~3 minutes ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This was referenced Jul 1, 2026
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.
Phase B.3 of #3517 partial delivery — migrate the two
SYSCON->SYSAHBCLKCTRL0 |= (1UL << 29)sites to vendor CMSIS macros with UM section citations.Verified against NXP mcux-sdk
Both match the existing raw literals. UM11029 §4.6.13 Table 41 is the datasheet source.
Sites touched
src/platforms/arm/lpc/spi_arm_lpc_dma.h— replaces(1UL << 29)withSYSCON_SYSAHBCLKCTRL0_DMA_MASK, dropsTODO(3453): verify SYSCON->SYSAHBCLKCTRL0 bit 29src/platforms/arm/lpc/drivers/sct_dma/lpc_sct_dma_runtime.cpp.hpp— replaces(1UL << 8) | (1UL << 29)withSYSCON_SYSAHBCLKCTRL0_SCT_MASK | SYSCON_SYSAHBCLKCTRL0_DMA_MASK, dropsTODO(2842)No behavioral change — the mask values are identical.
Verification
bash test --cpp— 345/345 passRefs: #3517 Phase B.3,
agents/docs/register-maps.md.Co-Authored-By: Claude Opus 4.7 (1M context) [email protected]
Summary by CodeRabbit