libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
dma_common_csel.c
Go to the documentation of this file.
1
/** @addtogroup dma_file
2
*/
3
/*
4
* This file is part of the libopencm3 project.
5
*
6
* Copyright (C) 2019 Guillaume Revaillot <g.revaillot@gmail.com>
7
*
8
* This library is free software: you can redistribute it and/or modify
9
* it under the terms of the GNU Lesser General Public License as published by
10
* the Free Software Foundation, either version 3 of the License, or
11
* (at your option) any later version.
12
*
13
* This library is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU Lesser General Public License for more details.
17
*
18
* You should have received a copy of the GNU Lesser General Public License
19
* along with this library. If not, see <http://www.gnu.org/licenses/>.
20
*/
21
22
/**@{*/
23
24
#include <
libopencm3/stm32/dma.h
>
25
26
/*---------------------------------------------------------------------------*/
27
/** @brief DMA Channel Set Request Selection
28
29
Set DMA request mapping selection for given channel. Refer to datasheet for channel
30
request mapping tables.
31
32
@param[in] dma DMA controller base address: DMA1 or DMA2
33
@param[in] channel Channel number: 1-7 for DMA1 or 1-5 for DMA2
34
@param[in] request DMA request mapping.
35
*/
36
37
void
dma_set_channel_request
(uint32_t dma, uint8_t channel, uint8_t request)
38
{
39
uint32_t reg32 =
DMA_CSELR
(dma) & ~(
DMA_CSELR_CxS_MASK
<<
DMA_CSELR_CxS_SHIFT
(channel));
40
DMA_CSELR
(dma) = reg32 | ((
DMA_CSELR_CxS_MASK
& request) <<
DMA_CSELR_CxS_SHIFT
(channel));
41
}
42
43
/**@}*/
dma.h
DMA_CSELR_CxS_MASK
#define DMA_CSELR_CxS_MASK
Definition:
dma_common_csel.h:40
DMA_CSELR
#define DMA_CSELR(dma_base)
Definition:
dma_common_csel.h:33
DMA_CSELR_CxS_SHIFT
#define DMA_CSELR_CxS_SHIFT(channel)
Definition:
dma_common_csel.h:39
dma_set_channel_request
void dma_set_channel_request(uint32_t dma, uint8_t channel, uint8_t request)
DMA Channel Set Request Selection.
Definition:
dma_common_csel.c:37
lib
stm32
common
dma_common_csel.c
Generated on Tue Mar 7 2023 16:11:16 for libopencm3 by
1.9.4