Skip to content

Commit bf1857d

Browse files
committed
fix(cli): flag unmapped DMA identifiers, shrink dmaopt claim strings
dmaGetIdentifier() returning DMA_NONE means a reqmap table entry points at a stream missing from dmaDescriptors[]. It read identically to the benign OWNER_FREE case. Adds a distinct DMA MAP ERROR line for it. Collapses the two CLAIMED BY message branches into one shared format string, cutting duplicate string literals from flash. Closes #1388.
1 parent dd9d2b8 commit bf1857d

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

src/main/interface/cli.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4056,6 +4056,11 @@ static dmaoptValue_t *dmaoptAddr(const dmaoptEntry_t *entry, int index) {
40564056
// Surfaces serialUART()'s otherwise-silent IRQ-driven fallback via dmaAllocate()'s live ownership state.
40574057
static void printDmaoptClaimStatus(const dmaoptEntry_t *entry, int index, const dmaChannelSpec_t *dmaChannelSpec) {
40584058
const dmaIdentifier_e identifier = dmaGetIdentifier((DMA_Stream_TypeDef *)dmaChannelSpec->ref);
4059+
if (identifier == DMA_NONE) {
4060+
// reqmap table points at a stream absent from dmaDescriptors[] -- a map bug, not a live contention case.
4061+
cliPrintLinef("# %s %d: DMA MAP ERROR", entry->device, index + 1);
4062+
return;
4063+
}
40594064
const resourceOwner_e expectedOwner = (entry->peripheral == DMA_PERIPH_UART_TX) ? OWNER_SERIAL_TX : OWNER_SERIAL_RX;
40604065
const resourceOwner_e actualOwner = dmaGetOwner(identifier);
40614066
const uint8_t actualIndex = dmaGetResourceIndex(identifier);
@@ -4066,13 +4071,11 @@ static void printDmaoptClaimStatus(const dmaoptEntry_t *entry, int index, const
40664071
if (actualOwner == OWNER_FREE) {
40674072
return;
40684073
}
4074+
char idxSuffix[DMA_OPT_STRING_BUFSIZE] = "";
40694075
if (actualIndex > 0) {
4070-
cliPrintLinef("# %s %d: WARNING stream held by %s %d, not this UART -- expect IRQ-driven fallback",
4071-
entry->device, index + 1, ownerNames[actualOwner], actualIndex);
4072-
} else {
4073-
cliPrintLinef("# %s %d: WARNING stream held by %s, not this UART -- expect IRQ-driven fallback",
4074-
entry->device, index + 1, ownerNames[actualOwner]);
4076+
tfp_sprintf(idxSuffix, " %d", actualIndex);
40754077
}
4078+
cliPrintLinef("# %s %d: CLAIMED BY %s%s", entry->device, index + 1, ownerNames[actualOwner], idxSuffix);
40764079
}
40774080

40784081
static void printDmaoptEntry(const dmaoptEntry_t *entry, int index) {

0 commit comments

Comments
 (0)