Merge pull request #14093 from bergzand/pr/boards_stm32f4/add_spi_dma

boards/stm32f4: Add DMA config for SPI
This commit is contained in:
Alexandre Abadie 2020-05-25 13:17:22 +02:00 committed by GitHub
commit dc6bb50021
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 547 additions and 208 deletions

View File

@ -3,6 +3,7 @@ CPU_MODEL = stm32f415rg
# Put defined MCU peripherals here (in alphabetical order)
FEATURES_PROVIDED += periph_adc
FEATURES_PROVIDED += periph_dma
FEATURES_PROVIDED += periph_dac
FEATURES_PROVIDED += periph_i2c
FEATURES_PROVIDED += periph_pwm

View File

@ -27,6 +27,24 @@
extern "C" {
#endif
/**
* @name DMA streams configuration
* @{
*/
#ifdef MODULE_PERIPH_DMA
static const dma_conf_t dma_config[] = {
{ .stream = 11 }, /* DMA2 Stream 3 - SPI1_TX */
{ .stream = 10 }, /* DMA2 Stream 2 - SPI1_RX */
};
#define DMA_0_ISR isr_dma2_stream3
#define DMA_1_ISR isr_dma2_stream2
#define DMA_NUMOF ARRAY_SIZE(dma_config)
#endif /* MODULE_PERIPH_DMA */
/** @} */
/**
* @name Timer configuration
* @{
@ -175,7 +193,13 @@ static const spi_conf_t spi_config[] = {
.sclk_af = GPIO_AF5,
.cs_af = GPIO_AF5,
.rccmask = RCC_APB2ENR_SPI1EN,
.apbbus = APB2
.apbbus = APB2,
#ifdef MODULE_PERIPH_DMA
.tx_dma = 0,
.tx_dma_chan = 3,
.rx_dma = 1,
.rx_dma_chan = 3,
#endif
}
};

View File

@ -3,6 +3,7 @@ CPU_MODEL = stm32f401re
# Put defined MCU peripherals here (in alphabetical order)
FEATURES_PROVIDED += periph_adc
FEATURES_PROVIDED += periph_dma
FEATURES_PROVIDED += periph_i2c
FEATURES_PROVIDED += periph_pwm
FEATURES_PROVIDED += periph_rtc

View File

@ -28,6 +28,32 @@
extern "C" {
#endif
/**
* @name DMA streams configuration
* @{
*/
#ifdef MODULE_PERIPH_DMA
static const dma_conf_t dma_config[] = {
{ .stream = 11 }, /* DMA2 Stream 3 - SPI1_TX */
{ .stream = 10 }, /* DMA2 Stream 2 - SPI1_RX */
{ .stream = 4 }, /* DMA1 Stream 4 - SPI2_TX */
{ .stream = 3 }, /* DMA1 Stream 3 - SPI2_RX */
{ .stream = 5 }, /* DMA1 Stream 5 - SPI3_TX */
{ .stream = 0 }, /* DMA1 Stream 0 - SPI3_RX */
};
#define DMA_0_ISR isr_dma2_stream3
#define DMA_1_ISR isr_dma2_stream2
#define DMA_2_ISR isr_dma1_stream4
#define DMA_3_ISR isr_dma1_stream3
#define DMA_4_ISR isr_dma1_stream5
#define DMA_5_ISR isr_dma1_stream0
#define DMA_NUMOF ARRAY_SIZE(dma_config)
#endif /* MODULE_PERIPH_DMA */
/** @} */
/**
* @name UART configuration
* @{
@ -173,7 +199,13 @@ static const spi_conf_t spi_config[] = {
.sclk_af = GPIO_AF5,
.cs_af = GPIO_AF5,
.rccmask = RCC_APB2ENR_SPI1EN,
.apbbus = APB2
.apbbus = APB2,
#ifdef MODULE_PERIPH_DMA
.tx_dma = 0,
.tx_dma_chan = 3,
.rx_dma = 1,
.rx_dma_chan = 3,
#endif
},
{
.dev = SPI2,
@ -186,7 +218,13 @@ static const spi_conf_t spi_config[] = {
.sclk_af = GPIO_AF5,
.cs_af = GPIO_AF5,
.rccmask = RCC_APB1ENR_SPI2EN,
.apbbus = APB1
.apbbus = APB1,
#ifdef MODULE_PERIPH_DMA
.tx_dma = 2,
.tx_dma_chan = 0,
.rx_dma = 3,
.rx_dma_chan = 0,
#endif
},
{
.dev = SPI3,
@ -199,7 +237,13 @@ static const spi_conf_t spi_config[] = {
.sclk_af = GPIO_AF6,
.cs_af = GPIO_AF6,
.rccmask = RCC_APB1ENR_SPI3EN,
.apbbus = APB1
.apbbus = APB1,
#ifdef MODULE_PERIPH_DMA
.tx_dma = 4,
.tx_dma_chan = 0,
.rx_dma = 5,
.rx_dma_chan = 0,
#endif
}
};

View File

@ -3,6 +3,7 @@ CPU_MODEL = stm32f410rb
# Put defined MCU peripherals here (in alphabetical order)
FEATURES_PROVIDED += periph_adc
FEATURES_PROVIDED += periph_dma
FEATURES_PROVIDED += periph_i2c
FEATURES_PROVIDED += periph_rtc
FEATURES_PROVIDED += periph_spi

View File

@ -28,6 +28,24 @@
extern "C" {
#endif
/**
* @name DMA streams configuration
* @{
*/
#ifdef MODULE_PERIPH_DMA
static const dma_conf_t dma_config[] = {
{ .stream = 11 }, /* DMA2 Stream 3 - SPI1_TX */
{ .stream = 10 }, /* DMA2 Stream 2 - SPI1_RX */
};
#define DMA_0_ISR isr_dma2_stream3
#define DMA_1_ISR isr_dma2_stream2
#define DMA_NUMOF ARRAY_SIZE(dma_config)
#endif /* MODULE_PERIPH_DMA */
/** @} */
/**
* @name UART configuration
* @{
@ -122,7 +140,13 @@ static const spi_conf_t spi_config[] = {
.sclk_af = GPIO_AF5,
.cs_af = GPIO_AF5,
.rccmask = RCC_APB2ENR_SPI1EN,
.apbbus = APB2
.apbbus = APB2,
#ifdef MODULE_PERIPH_DMA
.tx_dma = 0,
.tx_dma_chan = 3,
.rx_dma = 1,
.rx_dma_chan = 3,
#endif
}
};

View File

@ -3,6 +3,7 @@ CPU_MODEL = stm32f411re
# Put defined MCU peripherals here (in alphabetical order)
FEATURES_PROVIDED += periph_adc
FEATURES_PROVIDED += periph_dma
FEATURES_PROVIDED += periph_i2c
FEATURES_PROVIDED += periph_pwm
FEATURES_PROVIDED += periph_rtc

View File

@ -28,6 +28,24 @@
extern "C" {
#endif
/**
* @name DMA streams configuration
* @{
*/
#ifdef MODULE_PERIPH_DMA
static const dma_conf_t dma_config[] = {
{ .stream = 11 }, /* DMA2 Stream 3 - SPI1_TX */
{ .stream = 10 }, /* DMA2 Stream 2 - SPI1_RX */
};
#define DMA_0_ISR isr_dma2_stream3
#define DMA_1_ISR isr_dma2_stream2
#define DMA_NUMOF ARRAY_SIZE(dma_config)
#endif /* MODULE_PERIPH_DMA */
/** @} */
/**
* @name UART configuration
* @{
@ -151,7 +169,13 @@ static const spi_conf_t spi_config[] = {
.sclk_af = GPIO_AF5,
.cs_af = GPIO_AF5,
.rccmask = RCC_APB2ENR_SPI1EN,
.apbbus = APB2
.apbbus = APB2,
#ifdef MODULE_PERIPH_DMA
.tx_dma = 0,
.tx_dma_chan = 3,
.rx_dma = 1,
.rx_dma_chan = 3,
#endif
}
};

View File

@ -3,6 +3,7 @@ CPU_MODEL = stm32f412zg
# Put defined MCU peripherals here (in alphabetical order)
FEATURES_PROVIDED += periph_adc
FEATURES_PROVIDED += periph_dma
FEATURES_PROVIDED += periph_i2c
FEATURES_PROVIDED += periph_pwm
FEATURES_PROVIDED += periph_rtc

View File

@ -31,6 +31,24 @@
extern "C" {
#endif
/**
* @name DMA streams configuration
* @{
*/
#ifdef MODULE_PERIPH_DMA
static const dma_conf_t dma_config[] = {
{ .stream = 11 }, /* DMA2 Stream 3 - SPI1_TX */
{ .stream = 10 }, /* DMA2 Stream 2 - SPI1_RX */
};
#define DMA_0_ISR isr_dma2_stream3
#define DMA_1_ISR isr_dma2_stream2
#define DMA_NUMOF ARRAY_SIZE(dma_config)
#endif /* MODULE_PERIPH_DMA */
/** @} */
/**
* @name UART configuration
* @{
@ -153,7 +171,13 @@ static const spi_conf_t spi_config[] = {
.sclk_af = GPIO_AF5,
.cs_af = GPIO_AF5,
.rccmask = RCC_APB2ENR_SPI1EN,
.apbbus = APB2
.apbbus = APB2,
#ifdef MODULE_PERIPH_DMA
.tx_dma = 0,
.tx_dma_chan = 3,
.rx_dma = 1,
.rx_dma_chan = 3,
#endif
}
};

View File

@ -3,6 +3,7 @@ CPU_MODEL = stm32f413zh
# Put defined MCU peripherals here (in alphabetical order)
FEATURES_PROVIDED += periph_adc
FEATURES_PROVIDED += periph_dma
FEATURES_PROVIDED += periph_can
FEATURES_PROVIDED += periph_dma
FEATURES_PROVIDED += periph_i2c

View File

@ -38,18 +38,12 @@ extern "C" {
*/
#ifdef MODULE_PERIPH_DMA
static const dma_conf_t dma_config[] = {
{ .stream = 4 },
{ .stream = 14 },
{ .stream = 6 },
{ .stream = 10 },
{ .stream = 8 },
{ .stream = 11 }, /* DMA2 Stream 3 - SPI1_TX */
{ .stream = 10 }, /* DMA2 Stream 2 - SPI1_RX */
};
#define DMA_0_ISR isr_dma1_stream4
#define DMA_1_ISR isr_dma2_stream6
#define DMA_2_ISR isr_dma1_stream6
#define DMA_3_ISR isr_dma2_stream2
#define DMA_4_ISR isr_dma2_stream0
#define DMA_0_ISR isr_dma2_stream3
#define DMA_1_ISR isr_dma2_stream2
#define DMA_NUMOF ARRAY_SIZE(dma_config)
#endif
@ -179,9 +173,9 @@ static const spi_conf_t spi_config[] = {
.rccmask = RCC_APB2ENR_SPI1EN,
.apbbus = APB2,
#ifdef MODULE_PERIPH_DMA
.tx_dma = 3,
.tx_dma_chan = 2,
.rx_dma = 4,
.tx_dma = 0,
.tx_dma_chan = 3,
.rx_dma = 1,
.rx_dma_chan = 3,
#endif
}

View File

@ -3,6 +3,7 @@ CPU_MODEL = stm32f429zi
# Put defined MCU peripherals here (in alphabetical order)
FEATURES_PROVIDED += periph_adc
FEATURES_PROVIDED += periph_dma
FEATURES_PROVIDED += periph_i2c
FEATURES_PROVIDED += periph_pwm
FEATURES_PROVIDED += periph_rtc

View File

@ -30,6 +30,24 @@
extern "C" {
#endif
/**
* @name DMA streams configuration
* @{
*/
#ifdef MODULE_PERIPH_DMA
static const dma_conf_t dma_config[] = {
{ .stream = 11 }, /* DMA2 Stream 3 - SPI1_TX */
{ .stream = 10 }, /* DMA2 Stream 2 - SPI1_RX */
};
#define DMA_0_ISR isr_dma2_stream3
#define DMA_1_ISR isr_dma2_stream2
#define DMA_NUMOF ARRAY_SIZE(dma_config)
#endif /* MODULE_PERIPH_DMA */
/** @} */
/**
* @name UART configuration
* @{
@ -132,7 +150,13 @@ static const spi_conf_t spi_config[] = {
.sclk_af = GPIO_AF5,
.cs_af = GPIO_AF5,
.rccmask = RCC_APB2ENR_SPI1EN,
.apbbus = APB2
.apbbus = APB2,
#ifdef MODULE_PERIPH_DMA
.tx_dma = 0,
.tx_dma_chan = 3,
.rx_dma = 1,
.rx_dma_chan = 3,
#endif
}
};

View File

@ -3,6 +3,7 @@ CPU_MODEL = stm32f446re
# Put defined MCU peripherals here (in alphabetical order)
FEATURES_PROVIDED += periph_adc
FEATURES_PROVIDED += periph_dma
FEATURES_PROVIDED += periph_i2c
FEATURES_PROVIDED += periph_pwm
FEATURES_PROVIDED += periph_rtc

View File

@ -29,6 +29,32 @@
extern "C" {
#endif
/**
* @name DMA streams configuration
* @{
*/
#ifdef MODULE_PERIPH_DMA
static const dma_conf_t dma_config[] = {
{ .stream = 11 }, /* DMA2 Stream 3 - SPI1_TX */
{ .stream = 10 }, /* DMA2 Stream 2 - SPI1_RX */
{ .stream = 4 }, /* DMA1 Stream 4 - SPI2_TX */
{ .stream = 3 }, /* DMA1 Stream 3 - SPI2_RX */
{ .stream = 5 }, /* DMA1 Stream 5 - SPI3_TX */
{ .stream = 0 }, /* DMA1 Stream 0 - SPI3_RX */
};
#define DMA_0_ISR isr_dma2_stream3
#define DMA_1_ISR isr_dma2_stream2
#define DMA_2_ISR isr_dma1_stream4
#define DMA_3_ISR isr_dma1_stream3
#define DMA_4_ISR isr_dma1_stream5
#define DMA_5_ISR isr_dma1_stream0
#define DMA_NUMOF ARRAY_SIZE(dma_config)
#endif /* MODULE_PERIPH_DMA */
/** @} */
/**
* @name UART configuration
* @{
@ -167,7 +193,13 @@ static const spi_conf_t spi_config[] = {
.sclk_af = GPIO_AF5,
.cs_af = GPIO_AF5,
.rccmask = RCC_APB2ENR_SPI1EN,
.apbbus = APB2
.apbbus = APB2,
#ifdef MODULE_PERIPH_DMA
.tx_dma = 0,
.tx_dma_chan = 3,
.rx_dma = 1,
.rx_dma_chan = 3,
#endif
},
{
.dev = SPI2,
@ -180,7 +212,13 @@ static const spi_conf_t spi_config[] = {
.sclk_af = GPIO_AF5,
.cs_af = GPIO_AF5,
.rccmask = RCC_APB1ENR_SPI2EN,
.apbbus = APB1
.apbbus = APB1,
#ifdef MODULE_PERIPH_DMA
.tx_dma = 2,
.tx_dma_chan = 0,
.rx_dma = 3,
.rx_dma_chan = 0,
#endif
},
{
.dev = SPI3,
@ -193,7 +231,13 @@ static const spi_conf_t spi_config[] = {
.sclk_af = GPIO_AF6,
.cs_af = GPIO_AF6,
.rccmask = RCC_APB1ENR_SPI3EN,
.apbbus = APB1
.apbbus = APB1,
#ifdef MODULE_PERIPH_DMA
.tx_dma = 4,
.tx_dma_chan = 0,
.rx_dma = 5,
.rx_dma_chan = 0,
#endif
}
};

View File

@ -2,6 +2,7 @@ CPU = stm32
CPU_MODEL = stm32f446ze
# Put defined MCU peripherals here (in alphabetical order)
FEATURES_PROVIDED += periph_dma
FEATURES_PROVIDED += periph_i2c
FEATURES_PROVIDED += periph_pwm
FEATURES_PROVIDED += periph_rtc

View File

@ -30,6 +30,24 @@
extern "C" {
#endif
/**
* @name DMA streams configuration
* @{
*/
#ifdef MODULE_PERIPH_DMA
static const dma_conf_t dma_config[] = {
{ .stream = 11 }, /* DMA2 Stream 3 - SPI1_TX */
{ .stream = 10 }, /* DMA2 Stream 2 - SPI1_RX */
};
#define DMA_0_ISR isr_dma2_stream3
#define DMA_1_ISR isr_dma2_stream2
#define DMA_NUMOF ARRAY_SIZE(dma_config)
#endif /* MODULE_PERIPH_DMA */
/** @} */
/**
* @name UART configuration
* @{
@ -132,8 +150,14 @@ static const spi_conf_t spi_config[] = {
.sclk_af = GPIO_AF5,
.cs_af = GPIO_AF5,
.rccmask = RCC_APB2ENR_SPI1EN,
.apbbus = APB2
}
.apbbus = APB2,
#ifdef MODULE_PERIPH_DMA
.tx_dma = 0,
.tx_dma_chan = 3,
.rx_dma = 1,
.rx_dma_chan = 3,
#endif
},
};
#define SPI_NUMOF ARRAY_SIZE(spi_config)

View File

@ -2,6 +2,7 @@ CPU = stm32
CPU_MODEL = stm32f405rg
# Put defined MCU peripherals here (in alphabetical order)
FEATURES_PROVIDED += periph_dma
FEATURES_PROVIDED += periph_i2c
FEATURES_PROVIDED += periph_rtc
FEATURES_PROVIDED += periph_spi

View File

@ -59,6 +59,24 @@ extern "C" {
#define CLOCK_PLL_Q (7)
/** @} */
/**
* @name DMA streams configuration
* @{
*/
#ifdef MODULE_PERIPH_DMA
static const dma_conf_t dma_config[] = {
{ .stream = 11 }, /* DMA2 Stream 3 - SPI1_TX */
{ .stream = 10 }, /* DMA2 Stream 2 - SPI1_RX */
};
#define DMA_0_ISR isr_dma2_stream3
#define DMA_1_ISR isr_dma2_stream2
#define DMA_NUMOF ARRAY_SIZE(dma_config)
#endif /* MODULE_PERIPH_DMA */
/** @} */
/**
* @name Timer configuration
* @{
@ -142,10 +160,10 @@ static const spi_conf_t spi_config[] = {
.rccmask = RCC_APB2ENR_SPI1EN,
.apbbus = APB2,
#ifdef MODULE_PERIPH_DMA
.tx_dma = 1,
.tx_dma_chan = 1,
.rx_dma = 0,
.rx_dma_chan = 1,
.tx_dma = 0,
.tx_dma_chan = 3,
.rx_dma = 1,
.rx_dma_chan = 3,
#endif
}
};

View File

@ -2,6 +2,7 @@ CPU = stm32
CPU_MODEL = stm32f429zi
# Put defined MCU peripherals here (in alphabetical order)
FEATURES_PROVIDED += periph_dma
FEATURES_PROVIDED += periph_i2c
FEATURES_PROVIDED += periph_spi
FEATURES_PROVIDED += periph_timer

View File

@ -29,6 +29,24 @@
extern "C" {
#endif
/**
* @name DMA streams configuration
* @{
*/
#ifdef MODULE_PERIPH_DMA
static const dma_conf_t dma_config[] = {
{ .stream = 14 }, /* DMA2 Stream 6 - SPI5_TX */
{ .stream = 13 }, /* DMA2 Stream 5 - SPI5_RX */
};
#define DMA_0_ISR isr_dma2_stream6
#define DMA_1_ISR isr_dma2_stream5
#define DMA_NUMOF ARRAY_SIZE(dma_config)
#endif /* MODULE_PERIPH_DMA */
/** @} */
/**
* @name UART configuration
* @{
@ -74,7 +92,13 @@ static const spi_conf_t spi_config[] = {
.sclk_af = GPIO_AF5,
.cs_af = GPIO_AF5,
.rccmask = RCC_APB2ENR_SPI5EN,
.apbbus = APB2
.apbbus = APB2,
#ifdef MODULE_PERIPH_DMA
.tx_dma = 0,
.tx_dma_chan = 7,
.rx_dma = 1,
.rx_dma_chan = 7,
#endif
}
};

View File

@ -4,6 +4,7 @@ CPU_MODEL = stm32f407vg
# Put defined MCU peripherals here (in alphabetical order)
FEATURES_PROVIDED += periph_adc
FEATURES_PROVIDED += periph_dac
FEATURES_PROVIDED += periph_dma
FEATURES_PROVIDED += periph_i2c
FEATURES_PROVIDED += periph_pwm
FEATURES_PROVIDED += periph_rtc

View File

@ -29,6 +29,28 @@
extern "C" {
#endif
/**
* @name DMA streams configuration
* @{
*/
#ifdef MODULE_PERIPH_DMA
static const dma_conf_t dma_config[] = {
{ .stream = 11 }, /* DMA2 Stream 3 - SPI1_TX */
{ .stream = 10 }, /* DMA2 Stream 2 - SPI1_RX */
{ .stream = 4 }, /* DMA1 Stream 4 - SPI2_TX */
{ .stream = 3 }, /* DMA1 Stream 3 - SPI2_RX */
};
#define DMA_0_ISR isr_dma2_stream3
#define DMA_1_ISR isr_dma2_stream2
#define DMA_2_ISR isr_dma1_stream4
#define DMA_3_ISR isr_dma1_stream3
#define DMA_NUMOF ARRAY_SIZE(dma_config)
#endif /* MODULE_PERIPH_DMA */
/** @} */
/**
* @name Timer configuration
* @{
@ -172,7 +194,13 @@ static const spi_conf_t spi_config[] = {
.sclk_af = GPIO_AF5,
.cs_af = GPIO_AF5,
.rccmask = RCC_APB2ENR_SPI1EN,
.apbbus = APB2
.apbbus = APB2,
#ifdef MODULE_PERIPH_DMA
.tx_dma = 0,
.tx_dma_chan = 3,
.rx_dma = 1,
.rx_dma_chan = 3,
#endif
},
{
.dev = SPI2,
@ -185,8 +213,14 @@ static const spi_conf_t spi_config[] = {
.sclk_af = GPIO_AF5,
.cs_af = GPIO_AF5,
.rccmask = RCC_APB1ENR_SPI2EN,
.apbbus = APB1
}
.apbbus = APB1,
#ifdef MODULE_PERIPH_DMA
.tx_dma = 2,
.tx_dma_chan = 0,
.rx_dma = 3,
.rx_dma_chan = 0,
#endif
},
};
#define SPI_NUMOF ARRAY_SIZE(spi_config)

View File

@ -3,6 +3,7 @@ CPU_MODEL = stm32f437vg
# Put defined MCU peripherals here (in alphabetical order)
FEATURES_PROVIDED += periph_adc
FEATURES_PROVIDED += periph_dma
FEATURES_PROVIDED += periph_i2c
FEATURES_PROVIDED += periph_rtc
FEATURES_PROVIDED += periph_spi

View File

@ -57,6 +57,24 @@ extern "C" {
#define CLOCK_PLL_Q (7)
/** @} */
/**
* @name DMA streams configuration
* @{
*/
#ifdef MODULE_PERIPH_DMA
static const dma_conf_t dma_config[] = {
{ .stream = 9 }, /* DMA2 Stream 1 - SPI4_TX */
{ .stream = 8 }, /* DMA2 Stream 0 - SPI4_RX */
};
#define DMA_0_ISR isr_dma2_stream1
#define DMA_1_ISR isr_dma2_stream0
#define DMA_NUMOF ARRAY_SIZE(dma_config)
#endif /* MODULE_PERIPH_DMA */
/** @} */
/**
* @name UART configuration
* @{
@ -188,7 +206,13 @@ static const spi_conf_t spi_config[] = {
.sclk_af = GPIO_AF5,
.cs_af = GPIO_AF5,
.rccmask = RCC_APB2ENR_SPI4EN,
.apbbus = APB2
.apbbus = APB2,
#ifdef MODULE_PERIPH_DMA
.tx_dma = 0,
.tx_dma_chan = 4,
.rx_dma = 1,
.rx_dma_chan = 4,
#endif
},
};