stm32: dma: add dma_set_channel_request to ease dma cselr usage.
This commit is contained in:
parent
eb0bc099f4
commit
7d344b187d
@ -43,6 +43,8 @@ specific memorymap.h header before including this header file.*/
|
||||
|
||||
BEGIN_DECLS
|
||||
|
||||
void dma_set_channel_request(uint32_t dma, uint8_t channel, uint8_t request);
|
||||
|
||||
END_DECLS
|
||||
|
||||
/** @cond */
|
||||
|
46
lib/stm32/common/dma_common_csel.c
Normal file
46
lib/stm32/common/dma_common_csel.c
Normal file
@ -0,0 +1,46 @@
|
||||
/** @addtogroup dma_file DMA peripheral API
|
||||
@ingroup peripheral_apis
|
||||
|
||||
LGPL License Terms @ref lgpl_license
|
||||
*/
|
||||
/*
|
||||
* This file is part of the libopencm3 project.
|
||||
*
|
||||
* Copyright (C) 2019 Guillaume Revaillot <g.revaillot@gmail.com>
|
||||
*
|
||||
* This library is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**@{*/
|
||||
|
||||
#include <libopencm3/stm32/dma.h>
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @brief DMA Channel Set Request Selection
|
||||
|
||||
Set DMA request mapping selection for given channel. Refer to datasheet for channel
|
||||
request mapping tables.
|
||||
|
||||
@param[in] dma DMA controller base address: DMA1 or DMA2
|
||||
@param[in] channel Channel number: 1-7 for DMA1 or 1-5 for DMA2
|
||||
@param[in] request DMA request mapping.
|
||||
*/
|
||||
|
||||
void dma_set_channel_request(uint32_t dma, uint8_t channel, uint8_t request)
|
||||
{
|
||||
uint32_t reg32 = DMA_CSELR(dma) & ~(DMA_CSELR_CxS_MASK << DMA_CSELR_CxS_SHIFT(channel));
|
||||
DMA_CSELR(dma) = reg32 | ((DMA_CSELR_CxS_MASK & request) << DMA_CSELR_CxS_SHIFT(channel));
|
||||
}
|
||||
|
||||
/**@}*/
|
@ -39,7 +39,8 @@ OBJS = can.o flash.o rcc.o comparator.o \
|
||||
|
||||
OBJS += gpio_common_all.o gpio_common_f0234.o crc_common_all.o crc_v2.o \
|
||||
pwr_common_v1.o iwdg_common_all.o rtc_common_l1f024.o \
|
||||
dma_common_l1f013.o exti_common_all.o \
|
||||
dma_common_l1f013.o dma_common_csel.o \
|
||||
exti_common_all.o \
|
||||
dac_common_all.o \
|
||||
timer_common_all.o timer_common_f0234.o rcc_common_all.o
|
||||
|
||||
|
@ -42,7 +42,7 @@ OBJS += spi_common_all.o spi_common_v1.o spi_common_v1_frf.o
|
||||
OBJS += gpio_common_all.o gpio_common_f0234.o rcc_common_all.o
|
||||
OBJS += adc_common_v2.o
|
||||
OBJS += crs_common_all.o
|
||||
OBJS += dma_common_l1f013.o
|
||||
OBJS += dma_common_l1f013.o dma_common_csel.o
|
||||
OBJS += exti_common_all.o
|
||||
OBJS += flash_common_all.o flash_common_l01.o
|
||||
OBJS += i2c_common_v2.o
|
||||
|
@ -50,7 +50,7 @@ OBJS += rng_common_v1.o
|
||||
OBJS += timer_common_all.o
|
||||
OBJS += i2c_common_v2.o
|
||||
OBJS += usart_common_all.o usart_common_v2.o
|
||||
OBJS += dma_common_l1f013.o
|
||||
OBJS += dma_common_l1f013.o dma_common_csel.o
|
||||
OBJS += iwdg_common_all.o
|
||||
OBJS += rtc_common_l1f024.o
|
||||
OBJS += spi_common_all.o spi_common_v2.o
|
||||
|
Loading…
x
Reference in New Issue
Block a user