2 * This file is part of Cleanflight and Betaflight.
4 * Cleanflight and Betaflight are free software. You can redistribute
5 * this software and/or modify this software under the terms of the
6 * GNU General Public License as published by the Free Software
7 * Foundation, either version 3 of the License, or (at your option)
10 * Cleanflight and Betaflight are distributed in the hope that they
11 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
12 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this software.
18 * If not, see <http://www.gnu.org/licenses/>.
25 #include "drivers/dma.h"
26 #include "drivers/timer.h"
28 #include "dma_reqmap_mcu.h"
30 typedef uint16_t dmaCode_t
;
32 typedef struct dmaChannelSpec_s
{
35 #if defined(USE_DMA_MUX)
42 #define DMA_CODE(dma, stream, chanreq) ((dma << 12)|(stream << 8)|(chanreq << 0))
43 #define DMA_CODE_CONTROLLER(code) ((code >> 12) & 0xf)
44 #define DMA_CODE_STREAM(code) ((code >> 8) & 0xf)
45 #define DMA_CODE_CHANNEL(code) ((code >> 0) & 0xff)
46 #define DMA_CODE_REQUEST(code) DMA_CODE_CHANNEL(code)
53 DMA_PERIPH_UART_TX
, // LPUART is handled as UART
58 typedef int8_t dmaoptValue_t
;
60 #define DMA_OPT_UNUSED (-1)
62 struct timerHardware_s
;
64 dmaoptValue_t
dmaoptByTag(ioTag_t ioTag
);
65 const dmaChannelSpec_t
*dmaGetChannelSpecByPeripheral(dmaPeripheral_e device
, uint8_t index
, int8_t opt
);
66 const dmaChannelSpec_t
*dmaGetChannelSpecByTimerValue(TIM_TypeDef
*tim
, uint8_t channel
, dmaoptValue_t dmaopt
);
67 const dmaChannelSpec_t
*dmaGetChannelSpecByTimer(const struct timerHardware_s
*timer
);
68 dmaoptValue_t
dmaGetOptionByTimer(const struct timerHardware_s
*timer
);
69 dmaoptValue_t
dmaGetUpOptionByTimer(const struct timerHardware_s
*timer
);