Fixed CLI DMA presence mask support. (#8503)
Fixed CLI DMA presence mask support.
This commit is contained in:
commit
1631831147
|
@ -4904,13 +4904,15 @@ typedef struct dmaoptEntry_s {
|
|||
uint32_t presenceMask;
|
||||
} dmaoptEntry_t;
|
||||
|
||||
#define MASK_IGNORED (0)
|
||||
|
||||
// Handy macros for keeping the table tidy.
|
||||
// DEFS : Single entry
|
||||
// DEFA : Array of uint8_t (stride = 1)
|
||||
// DEFW : Wider stride case; array of structs.
|
||||
|
||||
#define DEFS(device, peripheral, pgn, type, member) \
|
||||
{ device, peripheral, pgn, 0, offsetof(type, member), 0, 0 }
|
||||
{ device, peripheral, pgn, 0, offsetof(type, member), 0, MASK_IGNORED }
|
||||
|
||||
#define DEFA(device, peripheral, pgn, type, member, max, mask) \
|
||||
{ device, peripheral, pgn, sizeof(uint8_t), offsetof(type, member), max, mask }
|
||||
|
@ -4918,8 +4920,6 @@ typedef struct dmaoptEntry_s {
|
|||
#define DEFW(device, peripheral, pgn, type, member, max, mask) \
|
||||
{ device, peripheral, pgn, sizeof(type), offsetof(type, member), max, mask }
|
||||
|
||||
#define MASK_IGNORED (0)
|
||||
|
||||
dmaoptEntry_t dmaoptEntryTable[] = {
|
||||
DEFW("SPI_TX", DMA_PERIPH_SPI_TX, PG_SPI_PIN_CONFIG, spiPinConfig_t, txDmaopt, SPIDEV_COUNT, MASK_IGNORED),
|
||||
DEFW("SPI_RX", DMA_PERIPH_SPI_RX, PG_SPI_PIN_CONFIG, spiPinConfig_t, rxDmaopt, SPIDEV_COUNT, MASK_IGNORED),
|
||||
|
@ -5167,7 +5167,7 @@ static void cliDmaopt(char *cmdline)
|
|||
pch = strtok_r(NULL, " ", &saveptr);
|
||||
if (entry) {
|
||||
index = atoi(pch) - 1;
|
||||
if (index < 0 || index >= entry->maxIndex || !((entry->presenceMask != MASK_IGNORED) && (entry->presenceMask & BIT(index + 1)))) {
|
||||
if (index < 0 || index >= entry->maxIndex || (entry->presenceMask != MASK_IGNORED && !(entry->presenceMask & BIT(index + 1)))) {
|
||||
cliPrintErrorLinef("BAD INDEX: '%s'", pch ? pch : "");
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue