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 #if defined(USE_TIMER_MGMT) && defined(USE_TIMER_UP_CONFIG)
27 #include "drivers/dma_reqmap.h"
28 #include "drivers/timer.h"
32 PG_REGISTER_ARRAY_WITH_RESET_FN(timerUpConfig_t
, HARDWARE_TIMER_DEFINITION_COUNT
, timerUpConfig
, PG_TIMER_UP_CONFIG
, 0);
34 void pgResetFn_timerUpConfig(timerUpConfig_t
*config
)
36 for (unsigned timno
= 0; timno
< HARDWARE_TIMER_DEFINITION_COUNT
; timno
++) {
37 config
[timno
].dmaopt
= DMA_OPT_UNUSED
;
40 #if defined(TIMUP1_DMA_OPT) && (HARDWARE_TIMER_DEFINITION_COUNT > 0)
41 config
[0].dmaopt
= TIMUP1_DMA_OPT
;
43 #if defined(TIMUP2_DMA_OPT) && (HARDWARE_TIMER_DEFINITION_COUNT > 1)
44 config
[1].dmaopt
= TIMUP2_DMA_OPT
;
46 #if defined(TIMUP3_DMA_OPT) && (HARDWARE_TIMER_DEFINITION_COUNT > 2)
47 config
[2].dmaopt
= TIMUP3_DMA_OPT
;
49 #if defined(TIMUP4_DMA_OPT) && (HARDWARE_TIMER_DEFINITION_COUNT > 3)
50 config
[3].dmaopt
= TIMUP4_DMA_OPT
;
52 #if defined(TIMUP5_DMA_OPT) && (HARDWARE_TIMER_DEFINITION_COUNT > 4)
53 config
[4].dmaopt
= TIMUP5_DMA_OPT
;
55 #if defined(TIMUP8_DMA_OPT) && (HARDWARE_TIMER_DEFINITION_COUNT > 7)
56 config
[7].dmaopt
= TIMUP8_DMA_OPT
;
58 #if defined(TIMUP9_DMA_OPT) && (HARDWARE_TIMER_DEFINITION_COUNT > 8)
59 config
[8].dmaopt
= TIMUP9_DMA_OPT
;
61 #if defined(TIMUP10_DMA_OPT) && (HARDWARE_TIMER_DEFINITION_COUNT > 9)
62 config
[9].dmaopt
= TIMUP10_DMA_OPT
;
64 #if defined(TIMUP11_DMA_OPT) && (HARDWARE_TIMER_DEFINITION_COUNT > 10)
65 config
[10].dmaopt
= TIMUP11_DMA_OPT
;
67 #if defined(TIMUP12_DMA_OPT) && (HARDWARE_TIMER_DEFINITION_COUNT > 11)
68 config
[11].dmaopt
= TIMUP12_DMA_OPT
;
70 #if defined(TIMUP13_DMA_OPT) && (HARDWARE_TIMER_DEFINITION_COUNT > 12)
71 config
[12].dmaopt
= TIMUP13_DMA_OPT
;
73 #if defined(TIMUP14_DMA_OPT) && (HARDWARE_TIMER_DEFINITION_COUNT > 13)
74 config
[13].dmaopt
= TIMUP14_DMA_OPT
;
76 #if defined(TIMUP15_DMA_OPT) && (HARDWARE_TIMER_DEFINITION_COUNT > 14)
77 config
[14].dmaopt
= TIMUP15_DMA_OPT
;
79 #if defined(TIMUP16_DMA_OPT) && (HARDWARE_TIMER_DEFINITION_COUNT > 15)
80 config
[15].dmaopt
= TIMUP16_DMA_OPT
;
82 #if defined(TIMUP17_DMA_OPT) && (HARDWARE_TIMER_DEFINITION_COUNT > 16)
83 config
[16].dmaopt
= TIMUP17_DMA_OPT
;
85 #if defined(TIMUP20_DMA_OPT) && (HARDWARE_TIMER_DEFINITION_COUNT > 19)
86 config
[19].dmaopt
= TIMUP20_DMA_OPT
;