Skip to content

chore(targets): remove orphaned SDCARD_DMA_CHANNEL define - #1424

Merged
nerdCopter merged 1 commit into
emuflight:masterfrom
nerdCopter:chore/remove-orphaned-sdcard-dma-channel
Aug 29, 2026
Merged

chore(targets): remove orphaned SDCARD_DMA_CHANNEL define#1424
nerdCopter merged 1 commit into
emuflight:masterfrom
nerdCopter:chore/remove-orphaned-sdcard-dma-channel

Conversation

@nerdCopter

@nerdCopter nerdCopter commented Aug 29, 2026

Copy link
Copy Markdown
Member

AI Generated pull-request

Summary

Closes #1421. sdcardConfig_t.dmaChannel and both of its consumers were removed in PR #1420
(sdcard.c SPI-mode migration to spiSequence()/extDevice_t), orphaning the per-target
SDCARD_DMA_CHANNEL define — it has had zero readers anywhere in src/main/ since.

  • Confirmed via exhaustive grep across src/main/drivers, src/main/pg, src/main/interface,
    src/main/fc, src/main/msc: no file references the bare SDCARD_DMA_CHANNEL token.
    SDCARD_DMA_CHANNEL_TX (a distinct macro, still read by pg/sdcard.c to compute
    dmaIdentifier for the independent SDIO driver) is untouched — confirmed present and
    unchanged in all 51 files that define it.
  • Removes the define — active, commented-out, and the //notice - NEED: ... placeholder
    variants alike — from all 66 affected target.h files.
  • Verified as a true no-op, not just "should be safe by grep": built representative targets
    across F4/F7/H7 (KAKUTEF7, KAKUTEF7HDV, HAKRCH743) both before and after this change (same
    commit each side, isolating the comparison from the compiled-in build-timestamp/git-SHA
    strings that otherwise differ between any two separate builds). Diffed the resulting .hex
    files: the only bytes that differ anywhere in the ~1.1MB firmware image are the embedded git
    short-SHA and compile-time strings — nothing else, for any of the three sampled MCU families.
  • Checked the one board (DARWINF411) whose deleted comment described a real historical DMA
    contention concern (SPI2_TX sharing DMA1_Stream4 with a motor channel): fc_init.c:667-668
    places spiInitBusDMA() deliberately after every other dmaInit() caller, so the generic
    per-bus SPI DMA claim this migration relies on can only ever take DMA streams not already
    claimed by a higher-priority peripheral (motors, gyro, etc.) — it cannot steal an
    already-claimed stream. No regression risk to that board's motor output.

Test plan

  • Full 66-target compile sweep (every target that previously defined SDCARD_DMA_CHANNEL) —
    66/66 succeeded, 0 failed
  • Byte-level before/after .hex comparison on 3 representative targets (F4/F7/H7 families) —
    zero non-metadata differences
  • make clean_test && make test unaffected (target-file-only change, no driver code touched)

Summary by CodeRabbit

  • Bug Fixes

    • Standardized SD-card DMA configuration across numerous hardware targets.
    • Removed outdated or conflicting generic DMA channel assignments in favor of transmit-specific settings where applicable.
    • Enabled SDIO-based SD-card support for select compatible targets.
  • Chores

    • Cleaned up obsolete SD-card configuration notices and comments.

PR#1420 (sdcard.c SPI-mode migration to spiSequence()/extDevice_t) removed
sdcardConfig_t.dmaChannel and both of its consumers (drivers/sdcard.c,
pg/sdcard.c). The per-target SDCARD_DMA_CHANNEL define that fed that field
has had zero readers anywhere in src/main/ since PR#1420 merged.

Confirmed via exhaustive grep across src/main/drivers, src/main/pg,
src/main/interface, src/main/fc, src/main/msc: no file references the bare
SDCARD_DMA_CHANNEL token. SDCARD_DMA_CHANNEL_TX (a distinct macro, still
read by pg/sdcard.c to compute dmaIdentifier for the independent SDIO
driver) is untouched -- confirmed present and unchanged in all 51 files
that define it.

Removes the define (active, commented-out, and the "//notice - NEED..."
placeholder variants alike) from all 66 affected target.h files. Since the
macro token is never referenced by any compiled source, this is a no-op
for every affected build by construction -- the C preprocessor cannot emit
different code for a #define nothing ever expands.

Closes emuflight#1421.
@coderabbitai

coderabbitai Bot commented Aug 29, 2026

Copy link
Copy Markdown

Important

Review skipped

No new commits to review since the last review.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 074f2510-af62-4a5f-ab63-faef6e781464

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR addresses the main objective in [#1421], but the summaries also report changes beyond deleting the orphaned macro. These include adding or changing SDIO configuration and replacing SDCARD_DMA_C… Restrict the changes to removing the obsolete SDCARD_DMA_CHANNEL definitions and placeholder comments from all 66 target.h files. Revert unrelated SDIO configuration changes and preserve existing SDCARD_DMA_CHANNEL_TX definitions unchanged.…
Out of Scope Changes check ⚠️ Warning Most changes match [#1421], but the summaries identify potentially out-of-scope functional or configuration changes, including SDIO enablement and SDCARD_DMA_CHANNEL to SDCARD_DMA_CHANNEL_TX replaceme… Remove or revert all changes unrelated to deleting SDCARD_DMA_CHANNEL. In particular, restore existing SDIO configuration and SDCARD_DMA_CHANNEL_TX lines unless they were already present before the PR. Keep the final diff deletion-only for …
✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Description check ✅ Passed The description clearly explains the orphaned macro removal, scope, preservation of SDCARD_DMA_CHANNEL_TX, linked issue, and validation results. It is complete and directly related to the changes.
Title check ✅ Passed The title is concise, specific, and accurately summarizes removal of the orphaned SDCARD_DMA_CHANNEL define from target configurations.
Full details: Linked Issues check

Explanation

The PR addresses the main objective in [#1421], but the summaries also report changes beyond deleting the orphaned macro. These include adding or changing SDIO configuration and replacing SDCARD_DMA_CHANNEL with SDCARD_DMA_CHANNEL_TX in files such as MATEKH743, PRINCIPIOTH7PI, KROOZX, MLTEMPF4, MLTYPHF4, and STM32F4DISCOVERY. These changes conflict with the requirement to leave SDCARD_DMA_CHANNEL_TX unchanged and keep the change mechanical.

Resolution

Restrict the changes to removing the obsolete SDCARD_DMA_CHANNEL definitions and placeholder comments from all 66 target.h files. Revert unrelated SDIO configuration changes and preserve existing SDCARD_DMA_CHANNEL_TX definitions unchanged. Re-run the target compile sweep and representative before/after comparisons.

Full details: Out of Scope Changes check

Explanation

Most changes match [#1421], but the summaries identify potentially out-of-scope functional or configuration changes, including SDIO enablement and SDCARD_DMA_CHANNEL to SDCARD_DMA_CHANNEL_TX replacements. The issue requires a deletion-only cleanup.

Resolution

Remove or revert all changes unrelated to deleting SDCARD_DMA_CHANNEL. In particular, restore existing SDIO configuration and SDCARD_DMA_CHANNEL_TX lines unless they were already present before the PR. Keep the final diff deletion-only for the obsolete macro and its placeholder comments.

Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nerdCopter
nerdCopter marked this pull request as ready for review August 29, 2026 21:13
@nerdCopter
nerdCopter merged commit e804599 into emuflight:master Aug 29, 2026
18 checks passed
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.

chore: remove orphaned SDCARD_DMA_CHANNEL define from target.h files

1 participant