Added STM32 TIM units use collisions checks.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8250 35acf78f-673a-0410-8e92-d51de3d6d3f4
master
Giovanni Di Sirio 2015-08-28 08:17:47 +00:00
parent 096d7f989d
commit fbd03ea88c
5 changed files with 252 additions and 0 deletions

View File

@ -295,6 +295,104 @@
#error "GPT driver activated but no TIM peripheral assigned"
#endif
/* Checks on allocation of TIMx units.*/
#if STM32_GPT_USE_TIM1
#if defined(STM32_TIM1_IS_USED)
#error "GPTD1 requires TIM1 but the timer is already used"
#else
#define STM32_TIM1_IS_USED
#endif
#endif
#if STM32_GPT_USE_TIM2
#if defined(STM32_TIM2_IS_USED)
#error "GPTD2 requires TIM2 but the timer is already used"
#else
#define STM32_TIM2_IS_USED
#endif
#endif
#if STM32_GPT_USE_TIM3
#if defined(STM32_TIM3_IS_USED)
#error "GPTD3 requires TIM3 but the timer is already used"
#else
#define STM32_TIM3_IS_USED
#endif
#endif
#if STM32_GPT_USE_TIM4
#if defined(STM32_TIM4_IS_USED)
#error "GPTD4 requires TIM4 but the timer is already used"
#else
#define STM32_TIM4_IS_USED
#endif
#endif
#if STM32_GPT_USE_TIM5
#if defined(STM32_TIM5_IS_USED)
#error "GPTD5 requires TIM5 but the timer is already used"
#else
#define STM32_TIM5_IS_USED
#endif
#endif
#if STM32_GPT_USE_TIM6
#if defined(STM32_TIM6_IS_USED)
#error "GPTD6 requires TIM6 but the timer is already used"
#else
#define STM32_TIM6_IS_USED
#endif
#endif
#if STM32_GPT_USE_TIM7
#if defined(STM32_TIM7_IS_USED)
#error "GPTD7 requires TIM7 but the timer is already used"
#else
#define STM32_TIM7_IS_USED
#endif
#endif
#if STM32_GPT_USE_TIM8
#if defined(STM32_TIM8_IS_USED)
#error "GPTD8 requires TIM8 but the timer is already used"
#else
#define STM32_TIM8_IS_USED
#endif
#endif
#if STM32_GPT_USE_TIM9
#if defined(STM32_TIM9_IS_USED)
#error "GPTD9 requires TIM9 but the timer is already used"
#else
#define STM32_TIM9_IS_USED
#endif
#endif
#if STM32_GPT_USE_TIM11
#if defined(STM32_TIM11_IS_USED)
#error "GPTD11 requires TIM11 but the timer is already used"
#else
#define STM32_TIM11_IS_USED
#endif
#endif
#if STM32_GPT_USE_TIM12
#if defined(STM32_TIM12_IS_USED)
#error "GPTD12 requires TIM12 but the timer is already used"
#else
#define STM32_TIM12_IS_USED
#endif
#endif
#if STM32_GPT_USE_TIM14
#if defined(STM32_TIM14_IS_USED)
#error "GPTD14 requires TIM14 but the timer is already used"
#else
#define STM32_TIM14_IS_USED
#endif
#endif
/* IRQ priority checks.*/
#if STM32_GPT_USE_TIM1 && \
!OSAL_IRQ_IS_VALID_PRIORITY(STM32_GPT_TIM1_IRQ_PRIORITY)
#error "Invalid IRQ priority assigned to TIM1"

View File

@ -193,6 +193,64 @@
#error "ICU driver activated but no TIM peripheral assigned"
#endif
/* Checks on allocation of TIMx units.*/
#if STM32_ICU_USE_TIM1
#if defined(STM32_TIM1_IS_USED)
#error "ICUD1 requires TIM1 but the timer is already used"
#else
#define STM32_TIM1_IS_USED
#endif
#endif
#if STM32_ICU_USE_TIM2
#if defined(STM32_TIM2_IS_USED)
#error "ICUD2 requires TIM2 but the timer is already used"
#else
#define STM32_TIM2_IS_USED
#endif
#endif
#if STM32_ICU_USE_TIM3
#if defined(STM32_TIM3_IS_USED)
#error "ICUD3 requires TIM3 but the timer is already used"
#else
#define STM32_TIM3_IS_USED
#endif
#endif
#if STM32_ICU_USE_TIM4
#if defined(STM32_TIM4_IS_USED)
#error "ICUD4 requires TIM4 but the timer is already used"
#else
#define STM32_TIM4_IS_USED
#endif
#endif
#if STM32_ICU_USE_TIM5
#if defined(STM32_TIM5_IS_USED)
#error "ICUD5 requires TIM5 but the timer is already used"
#else
#define STM32_TIM5_IS_USED
#endif
#endif
#if STM32_ICU_USE_TIM8
#if defined(STM32_TIM8_IS_USED)
#error "ICUD8 requires TIM8 but the timer is already used"
#else
#define STM32_TIM8_IS_USED
#endif
#endif
#if STM32_ICU_USE_TIM9
#if defined(STM32_TIM9_IS_USED)
#error "ICUD9 requires TIM9 but the timer is already used"
#else
#define STM32_TIM9_IS_USED
#endif
#endif
/* IRQ priority checks.*/
#if STM32_ICU_USE_TIM1 && \
!OSAL_IRQ_IS_VALID_PRIORITY(STM32_ICU_TIM1_IRQ_PRIORITY)
#error "Invalid IRQ priority assigned to TIM1"

View File

@ -248,6 +248,64 @@
#error "advanced mode selected but no advanced timer assigned"
#endif
/* Checks on allocation of TIMx units.*/
#if STM32_PWM_USE_TIM1
#if defined(STM32_TIM1_IS_USED)
#error "PWMD1 requires TIM1 but the timer is already used"
#else
#define STM32_TIM1_IS_USED
#endif
#endif
#if STM32_PWM_USE_TIM2
#if defined(STM32_TIM2_IS_USED)
#error "PWMD2 requires TIM2 but the timer is already used"
#else
#define STM32_TIM2_IS_USED
#endif
#endif
#if STM32_PWM_USE_TIM3
#if defined(STM32_TIM3_IS_USED)
#error "PWMD3 requires TIM3 but the timer is already used"
#else
#define STM32_TIM3_IS_USED
#endif
#endif
#if STM32_PWM_USE_TIM4
#if defined(STM32_TIM4_IS_USED)
#error "PWMD4 requires TIM4 but the timer is already used"
#else
#define STM32_TIM4_IS_USED
#endif
#endif
#if STM32_PWM_USE_TIM5
#if defined(STM32_TIM5_IS_USED)
#error "PWMD5 requires TIM5 but the timer is already used"
#else
#define STM32_TIM5_IS_USED
#endif
#endif
#if STM32_PWM_USE_TIM8
#if defined(STM32_TIM8_IS_USED)
#error "PWMD8 requires TIM8 but the timer is already used"
#else
#define STM32_TIM8_IS_USED
#endif
#endif
#if STM32_PWM_USE_TIM9
#if defined(STM32_TIM9_IS_USED)
#error "PWMD9 requires TIM9 but the timer is already used"
#else
#define STM32_TIM9_IS_USED
#endif
#endif
/* IRQ priority checks.*/
#if STM32_PWM_USE_TIM1 && \
!OSAL_IRQ_IS_VALID_PRIORITY(STM32_PWM_TIM1_IRQ_PRIORITY)
#error "Invalid IRQ priority assigned to TIM1"

View File

@ -43,6 +43,12 @@
#error "TIM2 is not a 32bits timer"
#endif
#if defined(STM32_TIM2_IS_USED)
#error "ST requires TIM2 but the timer is already used"
#else
#define STM32_TIM2_IS_USED
#endif
#define ST_HANDLER STM32_TIM2_HANDLER
#define ST_NUMBER STM32_TIM2_NUMBER
#define ST_CLOCK_SRC STM32_TIMCLK1
@ -58,6 +64,12 @@
#error "TIM3 is not a 32bits timer"
#endif
#if defined(STM32_TIM3_IS_USED)
#error "ST requires TIM3 but the timer is already used"
#else
#define STM32_TIM3_IS_USED
#endif
#define ST_HANDLER STM32_TIM3_HANDLER
#define ST_NUMBER STM32_TIM3_NUMBER
#define ST_CLOCK_SRC STM32_TIMCLK1
@ -73,6 +85,12 @@
#error "TIM4 is not a 32bits timer"
#endif
#if defined(STM32_TIM4_IS_USED)
#error "ST requires TIM4 but the timer is already used"
#else
#define STM32_TIM4_IS_USED
#endif
#define ST_HANDLER STM32_TIM4_HANDLER
#define ST_NUMBER STM32_TIM4_NUMBER
#define ST_CLOCK_SRC STM32_TIMCLK1
@ -88,6 +106,12 @@
#error "TIM5 is not a 32bits timer"
#endif
#if defined(STM32_TIM5_IS_USED)
#error "ST requires TIM5 but the timer is already used"
#else
#define STM32_TIM5_IS_USED
#endif
#define ST_HANDLER STM32_TIM5_HANDLER
#define ST_NUMBER STM32_TIM5_NUMBER
#define ST_CLOCK_SRC STM32_TIMCLK1
@ -103,6 +127,12 @@
#error "TIM21 is not a 32bits timer"
#endif
#if defined(STM32_TIM21_IS_USED)
#error "ST requires TIM21 but the timer is already used"
#else
#define STM32_TIM21_IS_USED
#endif
#define ST_HANDLER STM32_TIM21_HANDLER
#define ST_NUMBER STM32_TIM21_NUMBER
#define ST_CLOCK_SRC STM32_TIMCLK2
@ -114,6 +144,12 @@
#error "TIM21 is not a 32bits timer"
#endif
#if defined(STM32_TIM22_IS_USED)
#error "ST requires TIM22 but the timer is already used"
#else
#define STM32_TIM22_IS_USED
#endif
#define ST_HANDLER STM32_TIM22_HANDLER
#define ST_NUMBER STM32_TIM22_NUMBER
#define ST_CLOCK_SRC STM32_TIMCLK2

View File

@ -73,6 +73,8 @@
*****************************************************************************
*** 3.1.0 ***
- HAL: Added TIM units use cross-check in STM32 GPT, ICU, PWM and ST drivers,
now use collisions are explicitly reported.
- NIL: Added polled delays required to fix bug #629.
- HAL: Added support for I2C3 and I2C4 to the STM32 I2Cv2 I2C driver.
- HAL: Added support for SPI4...SPI6 to the STM32 SPIv2 SPI driver.