mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
boards/b-l072z-lrwan1: configure and use DMA
This commit is contained in:
parent
962d81b652
commit
08a85fbfdd
@ -1,3 +1,5 @@
|
||||
FEATURES_REQUIRED += periph_dma
|
||||
|
||||
ifneq (,$(filter netdev_default,$(USEMODULE)))
|
||||
USEMODULE += sx1276
|
||||
endif
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
},
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user