diff --git a/boards/b-l072z-lrwan1/Makefile.dep b/boards/b-l072z-lrwan1/Makefile.dep index 52861764e8..c683c1cda0 100644 --- a/boards/b-l072z-lrwan1/Makefile.dep +++ b/boards/b-l072z-lrwan1/Makefile.dep @@ -1,3 +1,5 @@ +FEATURES_REQUIRED += periph_dma + ifneq (,$(filter netdev_default,$(USEMODULE))) USEMODULE += sx1276 endif diff --git a/boards/b-l072z-lrwan1/Makefile.features b/boards/b-l072z-lrwan1/Makefile.features index 83fdca2d4c..7a15c81241 100644 --- a/boards/b-l072z-lrwan1/Makefile.features +++ b/boards/b-l072z-lrwan1/Makefile.features @@ -1,4 +1,5 @@ # Put defined MCU peripherals here (in alphabetical order) +FEATURES_PROVIDED += periph_dma FEATURES_PROVIDED += periph_i2c FEATURES_PROVIDED += periph_rtc FEATURES_PROVIDED += periph_spi diff --git a/boards/b-l072z-lrwan1/include/periph_conf.h b/boards/b-l072z-lrwan1/include/periph_conf.h index 42177f890b..4db35af48f 100644 --- a/boards/b-l072z-lrwan1/include/periph_conf.h +++ b/boards/b-l072z-lrwan1/include/periph_conf.h @@ -49,6 +49,28 @@ extern "C" { #define CLOCK_APB1 (CLOCK_CORECLOCK / 1) /** @} */ +/** + * @name DMA streams configuration + * @{ + */ +#ifdef MODULE_PERIPH_DMA +static const dma_conf_t dma_config[] = { + { .stream = 1 }, /* channel 2 */ + { .stream = 2 }, /* channel 3 */ + { .stream = 3 }, /* channel 4 */ + { .stream = 4 }, /* channel 5 */ + { .stream = 5 }, /* channel 6 */ +}; + +#define DMA_SHARED_ISR_0 isr_dma1_channel2_3 +#define DMA_SHARED_ISR_0_STREAMS { 0, 1 } /* Indexes 0 and 1 of dma_config share the same isr */ +#define DMA_SHARED_ISR_1 isr_dma1_channel4_5_6_7 +#define DMA_SHARED_ISR_1_STREAMS { 2, 3, 4 } /* Indexes 2, 3 and 4 of dma_config share the same isr */ + +#define DMA_NUMOF (sizeof(dma_config) / sizeof(dma_config[0])) +#endif +/** @} */ + /** * @name Timer configuration * @{ @@ -84,6 +106,10 @@ static const uart_conf_t uart_config[] = { .irqn = USART2_IRQn, .type = STM32_USART, .clk_src = 0, /* Use APB clock */ +#ifdef MODULE_PERIPH_DMA + .dma = 2, + .dma_chan = 4, +#endif }, { .dev = USART1, @@ -96,6 +122,10 @@ static const uart_conf_t uart_config[] = { .irqn = USART1_IRQn, .type = STM32_USART, .clk_src = 0, /* Use APB clock */ +#ifdef MODULE_PERIPH_DMA + .dma = 0, + .dma_chan = 3, +#endif }, }; @@ -138,7 +168,13 @@ static const spi_conf_t spi_config[] = { .cs_pin = GPIO_UNDEF, .af = GPIO_AF0, .rccmask = RCC_APB1ENR_SPI2EN, - .apbbus = APB1 + .apbbus = APB1, +#ifdef MODULE_PERIPH_DMA + .tx_dma = 3, + .tx_dma_chan = 2, + .rx_dma = 2, + .rx_dma_chan = 2, +#endif }, { .dev = SPI1, /* connected to SX1276 */ @@ -148,7 +184,13 @@ static const spi_conf_t spi_config[] = { .cs_pin = GPIO_UNDEF, .af = GPIO_AF0, .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 }, };