From 2dbbd1882c7e393da646af4ee41a3bd4576eeaf3 Mon Sep 17 00:00:00 2001 From: J Blackman Date: Wed, 15 Feb 2023 02:47:44 +1100 Subject: [PATCH] timerHardware removal - all targets use fullTimerHardware now. (#12349) * Removing last items associated with old timerHardware * target.c rename, to identify purpose (should probably move to drivers/sitl or similar) * Removing timerHardware dependency from timerup.c --- src/main/drivers/timer.h | 5 ----- src/main/drivers/timer_common.c | 12 ------------ src/main/pg/timerup.c | 11 +---------- src/main/pg/timerup.h | 3 ++- src/main/target/AT32F435/target.c | 22 ---------------------- src/main/target/SITL/{target.c => sitl.c} | 1 - src/main/target/STM32F405/target.c | 22 ---------------------- src/main/target/STM32F411/target.c | 22 ---------------------- src/main/target/STM32F745/target.c | 22 ---------------------- src/main/target/STM32F7X2/target.c | 22 ---------------------- src/main/target/STM32G47X/target.c | 22 ---------------------- src/main/target/STM32G47X/target.h | 1 + src/main/target/STM32H723/target.c | 22 ---------------------- src/main/target/STM32H723/target.h | 1 + src/main/target/STM32H730/target.c | 21 --------------------- src/main/target/STM32H730/target.h | 1 + src/main/target/STM32H743/target.c | 22 ---------------------- src/main/target/STM32H743/target.h | 1 + src/main/target/STM32H750/target.c | 21 --------------------- src/main/target/STM32H750/target.h | 1 + 20 files changed, 8 insertions(+), 247 deletions(-) delete mode 100644 src/main/target/AT32F435/target.c rename src/main/target/SITL/{target.c => sitl.c} (99%) delete mode 100644 src/main/target/STM32F405/target.c delete mode 100644 src/main/target/STM32F411/target.c delete mode 100644 src/main/target/STM32F745/target.c delete mode 100644 src/main/target/STM32F7X2/target.c delete mode 100644 src/main/target/STM32G47X/target.c delete mode 100644 src/main/target/STM32H723/target.c delete mode 100644 src/main/target/STM32H730/target.c delete mode 100644 src/main/target/STM32H743/target.c delete mode 100644 src/main/target/STM32H750/target.c diff --git a/src/main/drivers/timer.h b/src/main/drivers/timer.h index c8aa9015f5..83ed3a0fff 100644 --- a/src/main/drivers/timer.h +++ b/src/main/drivers/timer.h @@ -133,11 +133,6 @@ typedef enum { #define MHZ_TO_HZ(x) ((x) * 1000000) -#if USABLE_TIMER_CHANNEL_COUNT > 0 -extern const timerHardware_t timerHardware[]; -#endif - - #if defined(USE_TIMER_MGMT) #if defined(STM32F4) diff --git a/src/main/drivers/timer_common.c b/src/main/drivers/timer_common.c index 40ea2b09ff..067f6ae484 100644 --- a/src/main/drivers/timer_common.c +++ b/src/main/drivers/timer_common.c @@ -160,20 +160,8 @@ const timerHardware_t *timerAllocate(ioTag_t ioTag, resourceOwner_e owner, uint8 ioTag_t timerioTagGetByUsage(timerUsageFlag_e usageFlag, uint8_t index) { -#if USABLE_TIMER_CHANNEL_COUNT > 0 - uint8_t currentIndex = 0; - for (unsigned i = 0; i < USABLE_TIMER_CHANNEL_COUNT; i++) { - if ((timerHardware[i].usageFlags & usageFlag) == usageFlag) { - if (currentIndex == index) { - return timerHardware[i].tag; - } - currentIndex++; - } - } -#else UNUSED(usageFlag); UNUSED(index); -#endif return IO_TAG_NONE; } #endif diff --git a/src/main/pg/timerup.c b/src/main/pg/timerup.c index 710faf7eb1..238685bc13 100644 --- a/src/main/pg/timerup.c +++ b/src/main/pg/timerup.c @@ -22,7 +22,7 @@ #include "platform.h" -#if defined(USE_TIMER_MGMT) && (defined(STM32H7) || defined(STM32G4)) +#if defined(USE_TIMER_MGMT) && defined(USE_TIMER_UP_CONFIG) #include "drivers/dma_reqmap.h" #include "drivers/timer.h" @@ -36,14 +36,5 @@ void pgResetFn_timerUpConfig(timerUpConfig_t *config) for (unsigned timno = 0; timno < HARDWARE_TIMER_DEFINITION_COUNT; timno++) { config[timno].dmaopt = DMA_OPT_UNUSED; } - -#if USABLE_TIMER_CHANNEL_COUNT > 0 - // Scan target timerHardware and extract dma option for TIMUP - for (unsigned i = 0; i < USABLE_TIMER_CHANNEL_COUNT; i++) { - const timerHardware_t *timhw = &timerHardware[i]; - uint8_t timnum = timerGetTIMNumber(timhw->tim) - 1; - config[timnum].dmaopt = dmaGetUpOptionByTimer(timhw); - } -#endif } #endif diff --git a/src/main/pg/timerup.h b/src/main/pg/timerup.h index ed3b61b872..24ecd1fd7c 100644 --- a/src/main/pg/timerup.h +++ b/src/main/pg/timerup.h @@ -27,11 +27,12 @@ #include "drivers/io.h" #include "drivers/timer.h" // For HARDWARE_TIMER_DEFINITION_COUNT -#ifdef USE_TIMER_MGMT +#if defined(USE_TIMER_MGMT) && defined(USE_TIMER_UP_CONFIG) typedef struct timerUpConfig_s { int8_t dmaopt; } timerUpConfig_t; PG_DECLARE_ARRAY(timerUpConfig_t, HARDWARE_TIMER_DEFINITION_COUNT, timerUpConfig); + #endif diff --git a/src/main/target/AT32F435/target.c b/src/main/target/AT32F435/target.c deleted file mode 100644 index a087e06bd2..0000000000 --- a/src/main/target/AT32F435/target.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - * This file is part of Cleanflight and Betaflight. - * - * Cleanflight and Betaflight are free software. You can redistribute - * this software and/or modify this software under the terms of the - * GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) - * any later version. - * - * Cleanflight and Betaflight are distributed in the hope that they - * will be useful, but WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software. - * - * If not, see . - */ - -// Needed to suppress the pedantic warning about an empty file -#include diff --git a/src/main/target/SITL/target.c b/src/main/target/SITL/sitl.c similarity index 99% rename from src/main/target/SITL/target.c rename to src/main/target/SITL/sitl.c index 0a550430a1..ad69697226 100644 --- a/src/main/target/SITL/target.c +++ b/src/main/target/SITL/sitl.c @@ -40,7 +40,6 @@ #include "drivers/timer.h" #include "drivers/timer_def.h" -const timerHardware_t timerHardware[1]; // unused #include "drivers/accgyro/accgyro_fake.h" #include "flight/imu.h" diff --git a/src/main/target/STM32F405/target.c b/src/main/target/STM32F405/target.c deleted file mode 100644 index a087e06bd2..0000000000 --- a/src/main/target/STM32F405/target.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - * This file is part of Cleanflight and Betaflight. - * - * Cleanflight and Betaflight are free software. You can redistribute - * this software and/or modify this software under the terms of the - * GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) - * any later version. - * - * Cleanflight and Betaflight are distributed in the hope that they - * will be useful, but WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software. - * - * If not, see . - */ - -// Needed to suppress the pedantic warning about an empty file -#include diff --git a/src/main/target/STM32F411/target.c b/src/main/target/STM32F411/target.c deleted file mode 100644 index a087e06bd2..0000000000 --- a/src/main/target/STM32F411/target.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - * This file is part of Cleanflight and Betaflight. - * - * Cleanflight and Betaflight are free software. You can redistribute - * this software and/or modify this software under the terms of the - * GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) - * any later version. - * - * Cleanflight and Betaflight are distributed in the hope that they - * will be useful, but WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software. - * - * If not, see . - */ - -// Needed to suppress the pedantic warning about an empty file -#include diff --git a/src/main/target/STM32F745/target.c b/src/main/target/STM32F745/target.c deleted file mode 100644 index a087e06bd2..0000000000 --- a/src/main/target/STM32F745/target.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - * This file is part of Cleanflight and Betaflight. - * - * Cleanflight and Betaflight are free software. You can redistribute - * this software and/or modify this software under the terms of the - * GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) - * any later version. - * - * Cleanflight and Betaflight are distributed in the hope that they - * will be useful, but WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software. - * - * If not, see . - */ - -// Needed to suppress the pedantic warning about an empty file -#include diff --git a/src/main/target/STM32F7X2/target.c b/src/main/target/STM32F7X2/target.c deleted file mode 100644 index a087e06bd2..0000000000 --- a/src/main/target/STM32F7X2/target.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - * This file is part of Cleanflight and Betaflight. - * - * Cleanflight and Betaflight are free software. You can redistribute - * this software and/or modify this software under the terms of the - * GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) - * any later version. - * - * Cleanflight and Betaflight are distributed in the hope that they - * will be useful, but WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software. - * - * If not, see . - */ - -// Needed to suppress the pedantic warning about an empty file -#include diff --git a/src/main/target/STM32G47X/target.c b/src/main/target/STM32G47X/target.c deleted file mode 100644 index a087e06bd2..0000000000 --- a/src/main/target/STM32G47X/target.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - * This file is part of Cleanflight and Betaflight. - * - * Cleanflight and Betaflight are free software. You can redistribute - * this software and/or modify this software under the terms of the - * GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) - * any later version. - * - * Cleanflight and Betaflight are distributed in the hope that they - * will be useful, but WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software. - * - * If not, see . - */ - -// Needed to suppress the pedantic warning about an empty file -#include diff --git a/src/main/target/STM32G47X/target.h b/src/main/target/STM32G47X/target.h index b94d3ef7f6..8d6cdebd04 100644 --- a/src/main/target/STM32G47X/target.h +++ b/src/main/target/STM32G47X/target.h @@ -75,3 +75,4 @@ #define USE_CUSTOM_DEFAULTS #define USE_EXTI +#define USE_TIMER_UP_CONFIG diff --git a/src/main/target/STM32H723/target.c b/src/main/target/STM32H723/target.c deleted file mode 100644 index a087e06bd2..0000000000 --- a/src/main/target/STM32H723/target.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - * This file is part of Cleanflight and Betaflight. - * - * Cleanflight and Betaflight are free software. You can redistribute - * this software and/or modify this software under the terms of the - * GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) - * any later version. - * - * Cleanflight and Betaflight are distributed in the hope that they - * will be useful, but WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software. - * - * If not, see . - */ - -// Needed to suppress the pedantic warning about an empty file -#include diff --git a/src/main/target/STM32H723/target.h b/src/main/target/STM32H723/target.h index 63f458e578..832ee5f429 100644 --- a/src/main/target/STM32H723/target.h +++ b/src/main/target/STM32H723/target.h @@ -99,3 +99,4 @@ #endif #define USE_EXTI +#define USE_TIMER_UP_CONFIG diff --git a/src/main/target/STM32H730/target.c b/src/main/target/STM32H730/target.c deleted file mode 100644 index 4eca06e63b..0000000000 --- a/src/main/target/STM32H730/target.c +++ /dev/null @@ -1,21 +0,0 @@ -/* - * This file is part of Cleanflight and Betaflight. - * - * Cleanflight and Betaflight are free software. You can redistribute - * this software and/or modify this software under the terms of the - * GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) - * any later version. - * - * Cleanflight and Betaflight are distributed in the hope that they - * will be useful, but WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software. - * - * If not, see . - */ - -#include diff --git a/src/main/target/STM32H730/target.h b/src/main/target/STM32H730/target.h index 5f8adf571d..af4091238e 100644 --- a/src/main/target/STM32H730/target.h +++ b/src/main/target/STM32H730/target.h @@ -111,3 +111,4 @@ #endif #define USE_EXTI +#define USE_TIMER_UP_CONFIG diff --git a/src/main/target/STM32H743/target.c b/src/main/target/STM32H743/target.c deleted file mode 100644 index a087e06bd2..0000000000 --- a/src/main/target/STM32H743/target.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - * This file is part of Cleanflight and Betaflight. - * - * Cleanflight and Betaflight are free software. You can redistribute - * this software and/or modify this software under the terms of the - * GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) - * any later version. - * - * Cleanflight and Betaflight are distributed in the hope that they - * will be useful, but WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software. - * - * If not, see . - */ - -// Needed to suppress the pedantic warning about an empty file -#include diff --git a/src/main/target/STM32H743/target.h b/src/main/target/STM32H743/target.h index 7077cb1d8b..de3d1a35f7 100644 --- a/src/main/target/STM32H743/target.h +++ b/src/main/target/STM32H743/target.h @@ -85,3 +85,4 @@ #define USE_CUSTOM_DEFAULTS #define USE_EXTI +#define USE_TIMER_UP_CONFIG diff --git a/src/main/target/STM32H750/target.c b/src/main/target/STM32H750/target.c deleted file mode 100644 index 4eca06e63b..0000000000 --- a/src/main/target/STM32H750/target.c +++ /dev/null @@ -1,21 +0,0 @@ -/* - * This file is part of Cleanflight and Betaflight. - * - * Cleanflight and Betaflight are free software. You can redistribute - * this software and/or modify this software under the terms of the - * GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) - * any later version. - * - * Cleanflight and Betaflight are distributed in the hope that they - * will be useful, but WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software. - * - * If not, see . - */ - -#include diff --git a/src/main/target/STM32H750/target.h b/src/main/target/STM32H750/target.h index 32fc5637b7..57d9fa1f01 100644 --- a/src/main/target/STM32H750/target.h +++ b/src/main/target/STM32H750/target.h @@ -106,3 +106,4 @@ #endif #define USE_EXTI +#define USE_TIMER_UP_CONFIG