Skip to content
Snippets Groups Projects
Commit 962d81b6 authored by Vincent Dupont's avatar Vincent Dupont
Browse files

boards/nucleo-f091rc: configure and use DMA

parent 021697ae
No related branches found
No related tags found
No related merge requests found
FEATURES_REQUIRED += periph_dma
include $(RIOTBOARD)/common/nucleo/Makefile.dep
# 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
......
......@@ -56,6 +56,22 @@ extern "C" {
#define CLOCK_PLL_MUL (6)
/** @} */
/**
* @name DMA streams configuration
* @{
*/
#ifdef MODULE_PERIPH_DMA
static const dma_conf_t dma_config[] = {
{ .stream = 1 },
{ .stream = 2 },
};
#define DMA_SHARED_ISR_0 isr_dma1_ch2_3_dma2_ch1_2
#define DMA_SHARED_ISR_0_STREAMS { 0, 1 } /* Indexes 0 and 1 of dma_config share the same isr */
#define DMA_NUMOF (sizeof(dma_config) / sizeof(dma_config[0]))
#endif
/**
* @name Timer configuration
* @{
......@@ -88,7 +104,11 @@ static const uart_conf_t uart_config[] = {
.rx_af = GPIO_AF1,
.tx_af = GPIO_AF1,
.bus = APB1,
.irqn = USART2_IRQn
.irqn = USART2_IRQn,
#ifdef MODULE_PERIPH_DMA
.dma = 0,
.dma_chan = 0x9,
#endif
},
{
.dev = USART1,
......@@ -98,7 +118,11 @@ static const uart_conf_t uart_config[] = {
.rx_af = GPIO_AF1,
.tx_af = GPIO_AF1,
.bus = APB2,
.irqn = USART1_IRQn
.irqn = USART1_IRQn,
#ifdef MODULE_PERIPH_DMA
.dma = 0,
.dma_chan = 0x8,
#endif
},
{
.dev = USART3,
......@@ -108,7 +132,11 @@ static const uart_conf_t uart_config[] = {
.rx_af = GPIO_AF1,
.tx_af = GPIO_AF1,
.bus = APB1,
.irqn = USART3_8_IRQn
.irqn = USART3_8_IRQn,
#ifdef MODULE_PERIPH_DMA
.dma = 0,
.dma_chan = 0xA,
#endif
},
};
......@@ -153,7 +181,13 @@ static const spi_conf_t spi_config[] = {
.cs_pin = GPIO_PIN(PORT_B, 6),
.af = GPIO_AF0,
.rccmask = RCC_APB2ENR_SPI1EN,
.apbbus = APB2
.apbbus = APB2,
#ifdef MODULE_PERIPH_DMA
.tx_dma = 1,
.tx_dma_chan = 0,
.rx_dma = 0,
.rx_dma_chan = 0,
#endif
}
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment