Fix dmaopt peripheral numbering for TIMUP

This commit is contained in:
jflyper 2020-10-04 00:01:53 +09:00
parent 5db852a2f4
commit 24b4ffa912
1 changed files with 16 additions and 3 deletions

View File

@ -5342,10 +5342,23 @@ static void optToString(int optval, char *buf)
static void printPeripheralDmaoptDetails(dmaoptEntry_t *entry, int index, const dmaoptValue_t dmaopt, const bool equalsDefault, const dumpFlags_t dumpMask, printFn *printValue)
{
// We compute number to display for different peripherals in advance.
// This is done to deal with TIMUP which numbered non-contiguously.
// Note that using timerGetNumberByIndex is not a generic solution,
// but we are lucky that TIMUP is the only peripheral with non-contiguous numbering.
int uiIndex;
if (entry->presenceMask) {
uiIndex = timerGetNumberByIndex(index);
} else {
uiIndex = DMA_OPT_UI_INDEX(index);
}
if (dmaopt != DMA_OPT_UNUSED) {
printValue(dumpMask, equalsDefault,
"dma %s %d %d",
entry->device, DMA_OPT_UI_INDEX(index), dmaopt);
entry->device, uiIndex, dmaopt);
const dmaChannelSpec_t *dmaChannelSpec = dmaGetChannelSpecByPeripheral(entry->peripheral, index, dmaopt);
dmaCode_t dmaCode = 0;
@ -5354,11 +5367,11 @@ static void printPeripheralDmaoptDetails(dmaoptEntry_t *entry, int index, const
}
printValue(dumpMask, equalsDefault,
"# %s %d: " DMASPEC_FORMAT_STRING,
entry->device, DMA_OPT_UI_INDEX(index), DMA_CODE_CONTROLLER(dmaCode), DMA_CODE_STREAM(dmaCode), DMA_CODE_CHANNEL(dmaCode));
entry->device, uiIndex, DMA_CODE_CONTROLLER(dmaCode), DMA_CODE_STREAM(dmaCode), DMA_CODE_CHANNEL(dmaCode));
} else if (!(dumpMask & HIDE_UNUSED)) {
printValue(dumpMask, equalsDefault,
"dma %s %d NONE",
entry->device, DMA_OPT_UI_INDEX(index));
entry->device, uiIndex);
}
}