diff --git a/boards/common/iotlab/include/periph_conf_common.h b/boards/common/iotlab/include/periph_conf_common.h index 406a38a7e8..cb81ba5b6c 100644 --- a/boards/common/iotlab/include/periph_conf_common.h +++ b/boards/common/iotlab/include/periph_conf_common.h @@ -68,6 +68,27 @@ extern "C" { #define ADC_NUMOF (3) /** @} */ +/** + * @name DMA streams configuration + * @{ + */ +#ifdef MODULE_PERIPH_DMA +static const dma_conf_t dma_config[] = { + { .stream = 1 }, /* DMA1 Channel 2 - SPI1_RX */ + { .stream = 2 }, /* DMA1 Channel 3 - SPI1_TX */ + { .stream = 3 }, /* DMA1 Channel 4 - USART1_TX */ + { .stream = 5 }, /* DMA1 Channel 6 - USART2_TX */ +}; + +#define DMA_0_ISR isr_dma1_channel2 +#define DMA_1_ISR isr_dma1_channel3 +#define DMA_2_ISR isr_dma1_channel4 +#define DMA_3_ISR isr_dma1_channel6 + +#define DMA_NUMOF (sizeof(dma_config) / sizeof(dma_config[0])) +#endif +/** @} */ + /** * @name Timer configuration * @{ @@ -106,7 +127,11 @@ static const uart_conf_t uart_config[] = { .rx_pin = GPIO_PIN(PORT_A, 10), .tx_pin = GPIO_PIN(PORT_A, 9), .bus = APB2, - .irqn = USART1_IRQn + .irqn = USART1_IRQn, +#ifdef MODULE_PERIPH_DMA + .dma = 2, + .dma_chan = 2 +#endif }, { .dev = USART2, @@ -114,7 +139,11 @@ static const uart_conf_t uart_config[] = { .rx_pin = GPIO_PIN(PORT_A, 3), .tx_pin = GPIO_PIN(PORT_A, 2), .bus = APB1, - .irqn = USART2_IRQn + .irqn = USART2_IRQn, +#ifdef MODULE_PERIPH_DMA + .dma = 3, + .dma_chan = 2 +#endif } }; diff --git a/boards/iotlab-m3/Makefile.dep b/boards/iotlab-m3/Makefile.dep index bb828bd706..2353690840 100644 --- a/boards/iotlab-m3/Makefile.dep +++ b/boards/iotlab-m3/Makefile.dep @@ -1,5 +1,7 @@ include $(RIOTBOARD)/common/iotlab/Makefile.dep +FEATURES_REQUIRED += periph_dma + ifneq (,$(filter saul_default,$(USEMODULE))) USEMODULE += isl29020 USEMODULE += lps331ap diff --git a/boards/iotlab-m3/Makefile.features b/boards/iotlab-m3/Makefile.features index e3bcc4007e..b5c4f50913 100644 --- a/boards/iotlab-m3/Makefile.features +++ b/boards/iotlab-m3/Makefile.features @@ -1,3 +1,5 @@ include $(RIOTBOARD)/common/iotlab/Makefile.features +FEATURES_PROVIDED += periph_dma + include $(RIOTCPU)/stm32f1/Makefile.features diff --git a/boards/iotlab-m3/include/periph_conf.h b/boards/iotlab-m3/include/periph_conf.h index a21c55535d..9ec6ffd7c3 100644 --- a/boards/iotlab-m3/include/periph_conf.h +++ b/boards/iotlab-m3/include/periph_conf.h @@ -39,7 +39,13 @@ static const spi_conf_t spi_config[] = { .sclk_pin = GPIO_PIN(PORT_A, 5), .cs_pin = GPIO_UNDEF, .rccmask = RCC_APB2ENR_SPI1EN, - .apbbus = APB2 + .apbbus = APB2, +#ifdef MODULE_PERIPH_DMA + .tx_dma = 1, + .tx_dma_chan = 1, + .rx_dma = 0, + .rx_dma_chan = 1, +#endif } };