mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-14 03:50:02 +03:00
[H7] Add pseudo peripheral TIMUP for TIMx_UP DMA management
This commit is contained in:
parent
2a6e94d030
commit
8ceaed1072
8 changed files with 155 additions and 17 deletions
|
@ -140,6 +140,7 @@ uint8_t cliMode = 0;
|
|||
#include "pg/serial_uart.h"
|
||||
#include "pg/sdio.h"
|
||||
#include "pg/timerio.h"
|
||||
#include "pg/timerup.h"
|
||||
#include "pg/usb.h"
|
||||
#include "pg/vtx_table.h"
|
||||
|
||||
|
@ -4868,6 +4869,7 @@ typedef struct dmaoptEntry_s {
|
|||
uint8_t stride;
|
||||
uint8_t offset;
|
||||
uint8_t maxIndex;
|
||||
uint32_t presenceMask;
|
||||
} dmaoptEntry_t;
|
||||
|
||||
// Handy macros for keeping the table tidy.
|
||||
|
@ -4876,21 +4878,26 @@ typedef struct dmaoptEntry_s {
|
|||
// DEFW : Wider stride case; array of structs.
|
||||
|
||||
#define DEFS(device, peripheral, pgn, type, member) \
|
||||
{ device, peripheral, pgn, 0, offsetof(type, member), 0 }
|
||||
{ device, peripheral, pgn, 0, offsetof(type, member), 0, 0 }
|
||||
|
||||
#define DEFA(device, peripheral, pgn, type, member, max) \
|
||||
{ device, peripheral, pgn, sizeof(uint8_t), offsetof(type, member), max }
|
||||
#define DEFA(device, peripheral, pgn, type, member, max, mask) \
|
||||
{ device, peripheral, pgn, sizeof(uint8_t), offsetof(type, member), max, mask }
|
||||
|
||||
#define DEFW(device, peripheral, pgn, type, member, max) \
|
||||
{ device, peripheral, pgn, sizeof(type), offsetof(type, member), max }
|
||||
#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),
|
||||
DEFW("SPI_RX", DMA_PERIPH_SPI_RX, PG_SPI_PIN_CONFIG, spiPinConfig_t, rxDmaopt, SPIDEV_COUNT),
|
||||
DEFA("ADC", DMA_PERIPH_ADC, PG_ADC_CONFIG, adcConfig_t, dmaopt, ADCDEV_COUNT),
|
||||
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),
|
||||
DEFA("ADC", DMA_PERIPH_ADC, PG_ADC_CONFIG, adcConfig_t, dmaopt, ADCDEV_COUNT, MASK_IGNORED),
|
||||
DEFS("SDIO", DMA_PERIPH_SDIO, PG_SDIO_CONFIG, sdioConfig_t, dmaopt),
|
||||
DEFW("UART_TX", DMA_PERIPH_UART_TX, PG_SERIAL_UART_CONFIG, serialUartConfig_t, txDmaopt, UARTDEV_CONFIG_MAX),
|
||||
DEFW("UART_RX", DMA_PERIPH_UART_RX, PG_SERIAL_UART_CONFIG, serialUartConfig_t, rxDmaopt, UARTDEV_CONFIG_MAX),
|
||||
DEFW("UART_TX", DMA_PERIPH_UART_TX, PG_SERIAL_UART_CONFIG, serialUartConfig_t, txDmaopt, UARTDEV_CONFIG_MAX, MASK_IGNORED),
|
||||
DEFW("UART_RX", DMA_PERIPH_UART_RX, PG_SERIAL_UART_CONFIG, serialUartConfig_t, rxDmaopt, UARTDEV_CONFIG_MAX, MASK_IGNORED),
|
||||
#ifdef STM32H7
|
||||
DEFW("TIMUP", DMA_PERIPH_TIMUP, PG_TIMER_UP_CONFIG, timerUpConfig_t, dmaopt, HARDWARE_TIMER_DEFINITION_COUNT, TIMUP_TIMERS),
|
||||
#endif
|
||||
};
|
||||
|
||||
#undef DEFS
|
||||
|
@ -5128,7 +5135,7 @@ static void cliDmaopt(char *cmdline)
|
|||
pch = strtok_r(NULL, " ", &saveptr);
|
||||
if (entry) {
|
||||
index = atoi(pch) - 1;
|
||||
if (index < 0 || index >= entry->maxIndex) {
|
||||
if (index < 0 || index >= entry->maxIndex || !((entry->presenceMask != MASK_IGNORED) && (entry->presenceMask & BIT(index + 1)))) {
|
||||
cliPrintErrorLinef("BAD INDEX: '%s'", pch ? pch : "");
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue