mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-17 05:12:57 +01:00
boards/nucleo-f207zg: configure and use DMA
This commit is contained in:
parent
8a9d9e70bc
commit
3a5c9cb921
@ -1 +1,3 @@
|
||||
FEATURES_REQUIRED += periph_dma
|
||||
|
||||
include $(RIOTBOARD)/common/nucleo/Makefile.dep
|
||||
|
@ -1,4 +1,5 @@
|
||||
# Put defined MCU peripherals here (in alphabetical order)
|
||||
FEATURES_PROVIDED += periph_dma
|
||||
FEATURES_PROVIDED += periph_i2c
|
||||
FEATURES_PROVIDED += periph_pwm
|
||||
FEATURES_PROVIDED += periph_rtc
|
||||
|
@ -29,6 +29,31 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @name DMA streams configuration
|
||||
* @{
|
||||
*/
|
||||
#ifdef MODULE_PERIPH_DMA
|
||||
static const dma_conf_t dma_config[] = {
|
||||
{ .stream = 10 }, /* DMA2 Stream 2 - SPI1_RX */
|
||||
{ .stream = 11 }, /* DMA2 Stream 3 - SPI1_TX */
|
||||
{ .stream = 3 }, /* DMA1 Stream 3 - SPI2_RX/USART3_TX */
|
||||
{ .stream = 4 }, /* DMA1 Stream 4 - SPI2_TX */
|
||||
{ .stream = 14 }, /* DMA2 Stream 6 - USART6_TX */
|
||||
{ .stream = 6 }, /* DMA1 Stream 6 - USART2_TX */
|
||||
};
|
||||
|
||||
#define DMA_0_ISR isr_dma2_stream2
|
||||
#define DMA_1_ISR isr_dma2_stream3
|
||||
#define DMA_2_ISR isr_dma1_stream3
|
||||
#define DMA_3_ISR isr_dma1_stream4
|
||||
#define DMA_4_ISR isr_dma2_stream6
|
||||
#define DMA_5_ISR isr_dma1_stream6
|
||||
|
||||
#define DMA_NUMOF (sizeof(dma_config) / sizeof(dma_config[0]))
|
||||
#endif
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name PWM configuration
|
||||
* @{
|
||||
@ -100,8 +125,8 @@ static const uart_conf_t uart_config[] = {
|
||||
.tx_af = GPIO_AF7,
|
||||
.bus = APB1,
|
||||
.irqn = USART3_IRQn,
|
||||
#ifdef UART_USE_DMA
|
||||
.dma_stream = 3,
|
||||
#ifdef MODULE_PERIPH_DMA
|
||||
.dma = 2,
|
||||
.dma_chan = 4
|
||||
#endif
|
||||
},
|
||||
@ -114,9 +139,9 @@ static const uart_conf_t uart_config[] = {
|
||||
.tx_af = GPIO_AF8,
|
||||
.bus = APB2,
|
||||
.irqn = USART6_IRQn,
|
||||
#ifdef UART_USE_DMA
|
||||
.dma_stream = 6,
|
||||
.dma_chan = 4
|
||||
#ifdef MODULE_PERIPH_DMA
|
||||
.dma = 4,
|
||||
.dma_chan = 5
|
||||
#endif
|
||||
},
|
||||
{
|
||||
@ -128,21 +153,16 @@ static const uart_conf_t uart_config[] = {
|
||||
.tx_af = GPIO_AF7,
|
||||
.bus = APB1,
|
||||
.irqn = USART2_IRQn,
|
||||
#ifdef UART_USE_DMA
|
||||
.dma_stream = 7,
|
||||
#ifdef MODULE_PERIPH_DMA
|
||||
.dma = 5,
|
||||
.dma_chan = 4
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
#define UART_0_ISR (isr_usart3)
|
||||
#define UART_0_DMA_ISR (isr_dma1_stream3)
|
||||
|
||||
#define UART_1_ISR (isr_usart6)
|
||||
#define UART_1_DMA_ISR (isr_dma1_stream6)
|
||||
|
||||
#define UART_2_ISR (isr_usart2)
|
||||
#define UART_2_DMA_ISR (isr_dma1_stream7)
|
||||
|
||||
#define UART_NUMOF (sizeof(uart_config) / sizeof(uart_config[0]))
|
||||
/** @} */
|
||||
@ -180,7 +200,13 @@ static const spi_conf_t spi_config[] = {
|
||||
.cs_pin = GPIO_PIN(PORT_A, 4),
|
||||
.af = GPIO_AF5,
|
||||
.rccmask = RCC_APB2ENR_SPI1EN,
|
||||
.apbbus = APB2
|
||||
.apbbus = APB2,
|
||||
#ifdef MODULE_PERIPH_DMA
|
||||
.tx_dma = 1,
|
||||
.tx_dma_chan = 3,
|
||||
.rx_dma = 0,
|
||||
.rx_dma_chan = 3,
|
||||
#endif
|
||||
},
|
||||
{
|
||||
.dev = SPI2,
|
||||
@ -190,7 +216,13 @@ static const spi_conf_t spi_config[] = {
|
||||
.cs_pin = GPIO_PIN(PORT_B, 12),
|
||||
.af = GPIO_AF5,
|
||||
.rccmask = RCC_APB1ENR_SPI2EN,
|
||||
.apbbus = APB1
|
||||
.apbbus = APB1,
|
||||
#ifdef MODULE_PERIPH_DMA
|
||||
.tx_dma = 3,
|
||||
.tx_dma_chan = 0,
|
||||
.rx_dma = 2,
|
||||
.rx_dma_chan = 0,
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user