Logging of the S -term values in blackbox for Fixed wings. (#14012)
[betaflight.git] / src / main / drivers / dma_reqmap.h
blobc8bb516f68ebf2f651b4f280d1650daa1ced790d
1 /*
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)
8 * any later version.
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/>.
21 #pragma once
23 #include "platform.h"
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 {
33 dmaCode_t code;
34 dmaResource_t *ref;
35 #if defined(USE_DMA_MUX)
36 uint32_t dmaMuxId;
37 #else
38 uint32_t channel;
39 #endif
40 } dmaChannelSpec_t;
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)
48 typedef enum {
49 DMA_PERIPH_SPI_SDO,
50 DMA_PERIPH_SPI_SDI,
51 DMA_PERIPH_ADC,
52 DMA_PERIPH_SDIO,
53 DMA_PERIPH_UART_TX, // LPUART is handled as UART
54 DMA_PERIPH_UART_RX,
55 DMA_PERIPH_TIMUP,
56 } dmaPeripheral_e;
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);