Added support for timers 9...14 to STM32 ST driver.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@13225 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
Giovanni Di Sirio 2019-12-29 09:40:44 +00:00
parent 5fec21c877
commit ba42fce97b
3 changed files with 369 additions and 0 deletions

View File

@ -138,6 +138,150 @@
#define ST_ENABLE_STOP() DBGMCU->APB1FZ |= DBGMCU_APB1_FZ_DBG_TIM5_STOP
#endif
#elif STM32_ST_USE_TIMER == 9
#if !STM32_HAS_TIM9
#error "TIM9 not present in the selected device"
#endif
#if (OSAL_ST_RESOLUTION == 32) && !STM32_TIM9_IS_32BITS
#error "TIM9 is not a 32bits timer"
#endif
#define ST_HANDLER STM32_TIM9_HANDLER
#define ST_NUMBER STM32_TIM9_NUMBER
#define ST_CLOCK_SRC STM32_TIMCLK2
#define ST_ENABLE_CLOCK() rccEnableTIM9(true)
#if defined(STM32F1XX)
#define ST_ENABLE_STOP() DBGMCU->CR |= DBGMCU_CR_DBG_TIM9_STOP
#elif defined(STM32L4XX) || defined(STM32L4XXP) || defined(STM32G4XX)
#define ST_ENABLE_STOP() DBGMCU->APB2FZR1 |= DBGMCU_APB2FZR1_DBG_TIM9_STOP
#elif defined(STM32H7XX)
#define ST_ENABLE_STOP() DBGMCU->APB2LFZ1 |= DBGMCU_APB2LFZ1_DBG_TIM9
#else
#define ST_ENABLE_STOP() DBGMCU->APB2FZ |= DBGMCU_APB2_FZ_DBG_TIM9_STOP
#endif
#elif STM32_ST_USE_TIMER == 10
#if !STM32_HAS_TIM10
#error "TIM10 not present in the selected device"
#endif
#if (OSAL_ST_RESOLUTION == 32) && !STM32_TIM10_IS_32BITS
#error "TIM10 is not a 32bits timer"
#endif
#define ST_HANDLER STM32_TIM10_HANDLER
#define ST_NUMBER STM32_TIM10_NUMBER
#define ST_CLOCK_SRC STM32_TIMCLK2
#define ST_ENABLE_CLOCK() rccEnableTIM10(true)
#if defined(STM32F1XX)
#define ST_ENABLE_STOP() DBGMCU->CR |= DBGMCU_CR_DBG_TIM10_STOP
#elif defined(STM32L4XX) || defined(STM32L4XXP) || defined(STM32G4XX)
#define ST_ENABLE_STOP() DBGMCU->APB2FZR1 |= DBGMCU_APB2FZR1_DBG_TIM10_STOP
#elif defined(STM32H7XX)
#define ST_ENABLE_STOP() DBGMCU->APB2LFZ1 |= DBGMCU_APB2LFZ1_DBG_TIM10
#else
#define ST_ENABLE_STOP() DBGMCU->APB2FZ |= DBGMCU_APB2_FZ_DBG_TIM10_STOP
#endif
#elif STM32_ST_USE_TIMER == 11
#if !STM32_HAS_TIM11
#error "TIM11 not present in the selected device"
#endif
#if (OSAL_ST_RESOLUTION == 32) && !STM32_TIM11_IS_32BITS
#error "TIM11 is not a 32bits timer"
#endif
#define ST_HANDLER STM32_TIM11_HANDLER
#define ST_NUMBER STM32_TIM11_NUMBER
#define ST_CLOCK_SRC STM32_TIMCLK2
#define ST_ENABLE_CLOCK() rccEnableTIM11(true)
#if defined(STM32F1XX)
#define ST_ENABLE_STOP() DBGMCU->CR |= DBGMCU_CR_DBG_TIM11_STOP
#elif defined(STM32L4XX) || defined(STM32L4XXP) || defined(STM32G4XX)
#define ST_ENABLE_STOP() DBGMCU->APB2FZR1 |= DBGMCU_APB2FZR1_DBG_TIM11_STOP
#elif defined(STM32H7XX)
#define ST_ENABLE_STOP() DBGMCU->APB2LFZ1 |= DBGMCU_APB2LFZ1_DBG_TIM11
#else
#define ST_ENABLE_STOP() DBGMCU->APB2FZ |= DBGMCU_APB2_FZ_DBG_TIM11_STOP
#endif
#elif STM32_ST_USE_TIMER == 12
#if !STM32_HAS_TIM12
#error "TIM12 not present in the selected device"
#endif
#if (OSAL_ST_RESOLUTION == 32) && !STM32_TIM12_IS_32BITS
#error "TIM12 is not a 32bits timer"
#endif
#define ST_HANDLER STM32_TIM12_HANDLER
#define ST_NUMBER STM32_TIM12_NUMBER
#define ST_CLOCK_SRC STM32_TIMCLK1
#define ST_ENABLE_CLOCK() rccEnableTIM12(true)
#if defined(STM32F1XX)
#define ST_ENABLE_STOP() DBGMCU->CR |= DBGMCU_CR_DBG_TIM12_STOP
#elif defined(STM32L4XX) || defined(STM32L4XXP) || defined(STM32G4XX)
#define ST_ENABLE_STOP() DBGMCU->APB1FZR1 |= DBGMCU_APB1FZR1_DBG_TIM12_STOP
#elif defined(STM32H7XX)
#define ST_ENABLE_STOP() DBGMCU->APB1LFZ1 |= DBGMCU_APB1LFZ1_DBG_TIM12
#else
#define ST_ENABLE_STOP() DBGMCU->APB1FZ |= DBGMCU_APB1_FZ_DBG_TIM12_STOP
#endif
#elif STM32_ST_USE_TIMER == 13
#if !STM32_HAS_TIM13
#error "TIM13 not present in the selected device"
#endif
#if (OSAL_ST_RESOLUTION == 32) && !STM32_TIM13_IS_32BITS
#error "TIM13 is not a 32bits timer"
#endif
#define ST_HANDLER STM32_TIM13_HANDLER
#define ST_NUMBER STM32_TIM13_NUMBER
#define ST_CLOCK_SRC STM32_TIMCLK1
#define ST_ENABLE_CLOCK() rccEnableTIM13(true)
#if defined(STM32F1XX)
#define ST_ENABLE_STOP() DBGMCU->CR |= DBGMCU_CR_DBG_TIM13_STOP
#elif defined(STM32L4XX) || defined(STM32L4XXP) || defined(STM32G4XX)
#define ST_ENABLE_STOP() DBGMCU->APB1FZR1 |= DBGMCU_APB1FZR1_DBG_TIM13_STOP
#elif defined(STM32H7XX)
#define ST_ENABLE_STOP() DBGMCU->APB1LFZ1 |= DBGMCU_APB1LFZ1_DBG_TIM13
#else
#define ST_ENABLE_STOP() DBGMCU->APB1FZ |= DBGMCU_APB1_FZ_DBG_TIM13_STOP
#endif
#elif STM32_ST_USE_TIMER == 14
#if !STM32_HAS_TIM14
#error "TIM14 not present in the selected device"
#endif
#if (OSAL_ST_RESOLUTION == 32) && !STM32_TIM14_IS_32BITS
#error "TIM14 is not a 32bits timer"
#endif
#define ST_HANDLER STM32_TIM14_HANDLER
#define ST_NUMBER STM32_TIM14_NUMBER
#define ST_CLOCK_SRC STM32_TIMCLK1
#define ST_ENABLE_CLOCK() rccEnableTIM14(true)
#if defined(STM32F1XX)
#define ST_ENABLE_STOP() DBGMCU->CR |= DBGMCU_CR_DBG_TIM14_STOP
#elif defined(STM32L4XX) || defined(STM32L4XXP) || defined(STM32G4XX)
#define ST_ENABLE_STOP() DBGMCU->APB1FZR1 |= DBGMCU_APB1FZR1_DBG_TIM14_STOP
#elif defined(STM32H7XX)
#define ST_ENABLE_STOP() DBGMCU->APB1LFZ1 |= DBGMCU_APB1LFZ1_DBG_TIM14
#else
#define ST_ENABLE_STOP() DBGMCU->APB1FZ |= DBGMCU_APB1_FZ_DBG_TIM14_STOP
#endif
#elif STM32_ST_USE_TIMER == 21
#if !STM32_HAS_TIM21

View File

@ -82,6 +82,30 @@
#define STM32_HAS_TIM5 FALSE
#endif
#if !defined(STM32_HAS_TIM9)
#define STM32_HAS_TIM9 FALSE
#endif
#if !defined(STM32_HAS_TIM10)
#define STM32_HAS_TIM10 FALSE
#endif
#if !defined(STM32_HAS_TIM11)
#define STM32_HAS_TIM11 FALSE
#endif
#if !defined(STM32_HAS_TIM12)
#define STM32_HAS_TIM12 FALSE
#endif
#if !defined(STM32_HAS_TIM13)
#define STM32_HAS_TIM13 FALSE
#endif
#if !defined(STM32_HAS_TIM14)
#define STM32_HAS_TIM14 FALSE
#endif
#if !defined(STM32_HAS_TIM21)
#define STM32_HAS_TIM21 FALSE
#endif
@ -109,6 +133,12 @@
#define STM32_ST_USE_TIM3 FALSE
#define STM32_ST_USE_TIM4 FALSE
#define STM32_ST_USE_TIM5 FALSE
#define STM32_ST_USE_TIM9 FALSE
#define STM32_ST_USE_TIM10 FALSE
#define STM32_ST_USE_TIM11 FALSE
#define STM32_ST_USE_TIM12 FALSE
#define STM32_ST_USE_TIM13 FALSE
#define STM32_ST_USE_TIM14 FALSE
#define STM32_ST_USE_TIM21 FALSE
#define STM32_ST_USE_TIM22 FALSE
@ -130,6 +160,12 @@
#define STM32_ST_USE_TIM3 TRUE
#define STM32_ST_USE_TIM4 FALSE
#define STM32_ST_USE_TIM5 FALSE
#define STM32_ST_USE_TIM9 FALSE
#define STM32_ST_USE_TIM10 FALSE
#define STM32_ST_USE_TIM11 FALSE
#define STM32_ST_USE_TIM12 FALSE
#define STM32_ST_USE_TIM13 FALSE
#define STM32_ST_USE_TIM14 FALSE
#define STM32_ST_USE_TIM21 FALSE
#define STM32_ST_USE_TIM22 FALSE
@ -151,6 +187,12 @@
#define STM32_ST_USE_TIM3 FALSE
#define STM32_ST_USE_TIM4 TRUE
#define STM32_ST_USE_TIM5 FALSE
#define STM32_ST_USE_TIM9 FALSE
#define STM32_ST_USE_TIM10 FALSE
#define STM32_ST_USE_TIM11 FALSE
#define STM32_ST_USE_TIM12 FALSE
#define STM32_ST_USE_TIM13 FALSE
#define STM32_ST_USE_TIM14 FALSE
#define STM32_ST_USE_TIM21 FALSE
#define STM32_ST_USE_TIM22 FALSE
@ -172,6 +214,174 @@
#define STM32_ST_USE_TIM3 FALSE
#define STM32_ST_USE_TIM4 FALSE
#define STM32_ST_USE_TIM5 TRUE
#define STM32_ST_USE_TIM9 FALSE
#define STM32_ST_USE_TIM10 FALSE
#define STM32_ST_USE_TIM11 FALSE
#define STM32_ST_USE_TIM12 FALSE
#define STM32_ST_USE_TIM13 FALSE
#define STM32_ST_USE_TIM14 FALSE
#define STM32_ST_USE_TIM21 FALSE
#define STM32_ST_USE_TIM22 FALSE
#elif STM32_ST_USE_TIMER == 9
#if defined(STM32_TIM9_IS_USED)
#error "ST requires TIM9 but the timer is already used"
#else
#define STM32_TIM9_IS_USED
#endif
#if defined(STM32_TIM9_SUPPRESS_ISR)
#define STM32_SYSTICK_SUPPRESS_ISR
#endif
#define STM32_ST_TIM STM32_TIM9
#define ST_LLD_NUM_ALARMS STM32_TIM9_CHANNELS
#define STM32_ST_USE_TIM2 FALSE
#define STM32_ST_USE_TIM3 FALSE
#define STM32_ST_USE_TIM4 FALSE
#define STM32_ST_USE_TIM5 FALSE
#define STM32_ST_USE_TIM9 TRUE
#define STM32_ST_USE_TIM10 FALSE
#define STM32_ST_USE_TIM11 FALSE
#define STM32_ST_USE_TIM12 FALSE
#define STM32_ST_USE_TIM13 FALSE
#define STM32_ST_USE_TIM14 FALSE
#define STM32_ST_USE_TIM21 FALSE
#define STM32_ST_USE_TIM22 FALSE
#elif STM32_ST_USE_TIMER == 10
#if defined(STM32_TIM10_IS_USED)
#error "ST requires TIM10 but the timer is already used"
#else
#define STM32_TIM10_IS_USED
#endif
#if defined(STM32_TIM10_SUPPRESS_ISR)
#define STM32_SYSTICK_SUPPRESS_ISR
#endif
#define STM32_ST_TIM STM32_TIM10
#define ST_LLD_NUM_ALARMS STM32_TIM10_CHANNELS
#define STM32_ST_USE_TIM2 FALSE
#define STM32_ST_USE_TIM3 FALSE
#define STM32_ST_USE_TIM4 FALSE
#define STM32_ST_USE_TIM5 FALSE
#define STM32_ST_USE_TIM9 FALSE
#define STM32_ST_USE_TIM10 TRUE
#define STM32_ST_USE_TIM11 FALSE
#define STM32_ST_USE_TIM12 FALSE
#define STM32_ST_USE_TIM13 FALSE
#define STM32_ST_USE_TIM14 FALSE
#define STM32_ST_USE_TIM21 FALSE
#define STM32_ST_USE_TIM22 FALSE
#elif STM32_ST_USE_TIMER == 11
#if defined(STM32_TIM11_IS_USED)
#error "ST requires TIM11 but the timer is already used"
#else
#define STM32_TIM11_IS_USED
#endif
#if defined(STM32_TIM11_SUPPRESS_ISR)
#define STM32_SYSTICK_SUPPRESS_ISR
#endif
#define STM32_ST_TIM STM32_TIM11
#define ST_LLD_NUM_ALARMS STM32_TIM11_CHANNELS
#define STM32_ST_USE_TIM2 FALSE
#define STM32_ST_USE_TIM3 FALSE
#define STM32_ST_USE_TIM4 FALSE
#define STM32_ST_USE_TIM5 FALSE
#define STM32_ST_USE_TIM9 FALSE
#define STM32_ST_USE_TIM10 FALSE
#define STM32_ST_USE_TIM11 TRUE
#define STM32_ST_USE_TIM12 FALSE
#define STM32_ST_USE_TIM13 FALSE
#define STM32_ST_USE_TIM14 FALSE
#define STM32_ST_USE_TIM21 FALSE
#define STM32_ST_USE_TIM22 FALSE
#elif STM32_ST_USE_TIMER == 12
#if defined(STM32_TIM12_IS_USED)
#error "ST requires TIM12 but the timer is already used"
#else
#define STM32_TIM12_IS_USED
#endif
#if defined(STM32_TIM12_SUPPRESS_ISR)
#define STM32_SYSTICK_SUPPRESS_ISR
#endif
#define STM32_ST_TIM STM32_TIM12
#define ST_LLD_NUM_ALARMS STM32_TIM12_CHANNELS
#define STM32_ST_USE_TIM2 FALSE
#define STM32_ST_USE_TIM3 FALSE
#define STM32_ST_USE_TIM4 FALSE
#define STM32_ST_USE_TIM5 FALSE
#define STM32_ST_USE_TIM9 FALSE
#define STM32_ST_USE_TIM10 FALSE
#define STM32_ST_USE_TIM11 FALSE
#define STM32_ST_USE_TIM12 TRUE
#define STM32_ST_USE_TIM13 FALSE
#define STM32_ST_USE_TIM14 FALSE
#define STM32_ST_USE_TIM21 FALSE
#define STM32_ST_USE_TIM22 FALSE
#elif STM32_ST_USE_TIMER == 13
#if defined(STM32_TIM13_IS_USED)
#error "ST requires TIM13 but the timer is already used"
#else
#define STM32_TIM13_IS_USED
#endif
#if defined(STM32_TIM13_SUPPRESS_ISR)
#define STM32_SYSTICK_SUPPRESS_ISR
#endif
#define STM32_ST_TIM STM32_TIM13
#define ST_LLD_NUM_ALARMS STM32_TIM13_CHANNELS
#define STM32_ST_USE_TIM2 FALSE
#define STM32_ST_USE_TIM3 FALSE
#define STM32_ST_USE_TIM4 FALSE
#define STM32_ST_USE_TIM5 FALSE
#define STM32_ST_USE_TIM9 FALSE
#define STM32_ST_USE_TIM10 FALSE
#define STM32_ST_USE_TIM11 FALSE
#define STM32_ST_USE_TIM12 FALSE
#define STM32_ST_USE_TIM13 TRUE
#define STM32_ST_USE_TIM14 FALSE
#define STM32_ST_USE_TIM21 FALSE
#define STM32_ST_USE_TIM22 FALSE
#elif STM32_ST_USE_TIMER == 14
#if defined(STM32_TIM14_IS_USED)
#error "ST requires TIM14 but the timer is already used"
#else
#define STM32_TIM14_IS_USED
#endif
#if defined(STM32_TIM14_SUPPRESS_ISR)
#define STM32_SYSTICK_SUPPRESS_ISR
#endif
#define STM32_ST_TIM STM32_TIM14
#define ST_LLD_NUM_ALARMS STM32_TIM14_CHANNELS
#define STM32_ST_USE_TIM2 FALSE
#define STM32_ST_USE_TIM3 FALSE
#define STM32_ST_USE_TIM4 FALSE
#define STM32_ST_USE_TIM5 FALSE
#define STM32_ST_USE_TIM9 FALSE
#define STM32_ST_USE_TIM10 FALSE
#define STM32_ST_USE_TIM11 FALSE
#define STM32_ST_USE_TIM12 FALSE
#define STM32_ST_USE_TIM13 FALSE
#define STM32_ST_USE_TIM14 TRUE
#define STM32_ST_USE_TIM21 FALSE
#define STM32_ST_USE_TIM22 FALSE
@ -193,6 +403,12 @@
#define STM32_ST_USE_TIM3 FALSE
#define STM32_ST_USE_TIM4 FALSE
#define STM32_ST_USE_TIM5 FALSE
#define STM32_ST_USE_TIM9 FALSE
#define STM32_ST_USE_TIM10 FALSE
#define STM32_ST_USE_TIM11 FALSE
#define STM32_ST_USE_TIM12 FALSE
#define STM32_ST_USE_TIM13 FALSE
#define STM32_ST_USE_TIM14 FALSE
#define STM32_ST_USE_TIM21 TRUE
#define STM32_ST_USE_TIM22 FALSE
@ -214,6 +430,12 @@
#define STM32_ST_USE_TIM3 FALSE
#define STM32_ST_USE_TIM4 FALSE
#define STM32_ST_USE_TIM5 FALSE
#define STM32_ST_USE_TIM9 FALSE
#define STM32_ST_USE_TIM10 FALSE
#define STM32_ST_USE_TIM11 FALSE
#define STM32_ST_USE_TIM12 FALSE
#define STM32_ST_USE_TIM13 FALSE
#define STM32_ST_USE_TIM14 FALSE
#define STM32_ST_USE_TIM21 FALSE
#define STM32_ST_USE_TIM22 TRUE

View File

@ -74,6 +74,9 @@
*****************************************************************************
*** Next ***
- HAL: Added support for timers 9...14 to STM32 ST driver.
- HAL: STM32 ST driver is now integrated with new IRQ infrastructure and
performs cross-checks with GPT, ICU and PWM drivers on timers usage.
- HAL: Improved support for shared handlers. Now there are centralized
inclusion modules (.inc) containing shared handlers. The new modules
can be included by the various STM32 platforms. So far the new system