1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

boards/nucleo-f091rc: configure and use DMA

This commit is contained in:
Vincent Dupont 2018-05-23 19:08:37 +02:00
parent 021697ae94
commit 962d81b652
3 changed files with 41 additions and 4 deletions

View File

@ -1 +1,3 @@
FEATURES_REQUIRED += periph_dma
include $(RIOTBOARD)/common/nucleo/Makefile.dep

View File

@ -1,5 +1,6 @@
# 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

@ -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
}
};