Fixed #1003 again.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12584 110e8d01-0319-4d1e-a829-52ad28d1bb01
This commit is contained in:
Giovanni Di Sirio 2019-01-26 07:51:27 +00:00
parent cf4cfd2a4f
commit 450cf7a783
3 changed files with 24 additions and 60 deletions

View File

@ -84,12 +84,10 @@
extern "C" { extern "C" {
#endif #endif
void stInit(void); void stInit(void);
#if OSAL_ST_MODE == OSAL_ST_MODE_FREERUNNING
void stStartAlarm(systime_t abstime); void stStartAlarm(systime_t abstime);
void stStopAlarm(void); void stStopAlarm(void);
void stSetAlarm(systime_t abstime); void stSetAlarm(systime_t abstime);
systime_t stGetAlarm(void); systime_t stGetAlarm(void);
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -39,6 +39,9 @@
#endif #endif
#if STM32_ST_USE_TIMER == 2 #if STM32_ST_USE_TIMER == 2
#if !STM32_HAS_TIM2
#error "TIM2 not present in the selected device"
#endif
#if (OSAL_ST_RESOLUTION == 32) && !STM32_TIM2_IS_32BITS #if (OSAL_ST_RESOLUTION == 32) && !STM32_TIM2_IS_32BITS
#error "TIM2 is not a 32bits timer" #error "TIM2 is not a 32bits timer"
#endif #endif
@ -58,6 +61,9 @@
#endif #endif
#elif STM32_ST_USE_TIMER == 3 #elif STM32_ST_USE_TIMER == 3
#if !STM32_HAS_TIM3
#error "TIM3 not present in the selected device"
#endif
#if (OSAL_ST_RESOLUTION == 32) && !STM32_TIM3_IS_32BITS #if (OSAL_ST_RESOLUTION == 32) && !STM32_TIM3_IS_32BITS
#error "TIM3 is not a 32bits timer" #error "TIM3 is not a 32bits timer"
#endif #endif
@ -77,6 +83,9 @@
#endif #endif
#elif STM32_ST_USE_TIMER == 4 #elif STM32_ST_USE_TIMER == 4
#if !STM32_HAS_TIM4
#error "TIM4 not present in the selected device"
#endif
#if (OSAL_ST_RESOLUTION == 32) && !STM32_TIM4_IS_32BITS #if (OSAL_ST_RESOLUTION == 32) && !STM32_TIM4_IS_32BITS
#error "TIM4 is not a 32bits timer" #error "TIM4 is not a 32bits timer"
#endif #endif
@ -96,6 +105,9 @@
#endif #endif
#elif STM32_ST_USE_TIMER == 5 #elif STM32_ST_USE_TIMER == 5
#if !STM32_HAS_TIM5
#error "TIM5 not present in the selected device"
#endif
#if (OSAL_ST_RESOLUTION == 32) && !STM32_TIM5_IS_32BITS #if (OSAL_ST_RESOLUTION == 32) && !STM32_TIM5_IS_32BITS
#error "TIM5 is not a 32bits timer" #error "TIM5 is not a 32bits timer"
#endif #endif
@ -115,6 +127,9 @@
#endif #endif
#elif STM32_ST_USE_TIMER == 21 #elif STM32_ST_USE_TIMER == 21
#if !STM32_HAS_TIM21
#error "TIM21 not present in the selected device"
#endif
#if (OSAL_ST_RESOLUTION == 32) && !STM32_TIM21_IS_32BITS #if (OSAL_ST_RESOLUTION == 32) && !STM32_TIM21_IS_32BITS
#error "TIM21 is not a 32bits timer" #error "TIM21 is not a 32bits timer"
#endif #endif
@ -126,6 +141,9 @@
#define ST_ENABLE_STOP() DBGMCU->APB1FZ |= DBGMCU_APB2_FZ_DBG_TIM21_STOP #define ST_ENABLE_STOP() DBGMCU->APB1FZ |= DBGMCU_APB2_FZ_DBG_TIM21_STOP
#elif STM32_ST_USE_TIMER == 22 #elif STM32_ST_USE_TIMER == 22
#if !STM32_HAS_TIM22
#error "TIM22 not present in the selected device"
#endif
#if (OSAL_ST_RESOLUTION == 32) && !STM32_TIM22_IS_32BITS #if (OSAL_ST_RESOLUTION == 32) && !STM32_TIM22_IS_32BITS
#error "TIM21 is not a 32bits timer" #error "TIM21 is not a 32bits timer"
#endif #endif

View File

@ -89,77 +89,27 @@
#define STM32_HAS_TIM22 FALSE #define STM32_HAS_TIM22 FALSE
#endif #endif
#if OSAL_ST_MODE == OSAL_ST_MODE_FREERUNNING
#if STM32_ST_USE_TIMER == 2 #if STM32_ST_USE_TIMER == 2
#if !STM32_HAS_TIM2
#error "TIM2 not present in the selected device"
#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 STM32_ST_TIM STM32_TIM2 #define STM32_ST_TIM STM32_TIM2
#elif STM32_ST_USE_TIMER == 3 #elif STM32_ST_USE_TIMER == 3
#if !STM32_HAS_TIM3
#error "TIM3 not present in the selected device"
#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 STM32_ST_TIM STM32_TIM3 #define STM32_ST_TIM STM32_TIM3
#elif STM32_ST_USE_TIMER == 4 #elif STM32_ST_USE_TIMER == 4
#if !STM32_HAS_TIM4
#error "TIM4 not present in the selected device"
#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 STM32_ST_TIM STM32_TIM4 #define STM32_ST_TIM STM32_TIM4
#elif STM32_ST_USE_TIMER == 5 #elif STM32_ST_USE_TIMER == 5
#if !STM32_HAS_TIM5
#error "TIM5 not present in the selected device"
#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 STM32_ST_TIM STM32_TIM5 #define STM32_ST_TIM STM32_TIM5
#elif STM32_ST_USE_TIMER == 21 #elif STM32_ST_USE_TIMER == 21
#if !STM32_HAS_TIM21
#error "TIM21 not present in the selected device"
#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 STM32_ST_TIM STM32_TIM21 #define STM32_ST_TIM STM32_TIM21
#elif STM32_ST_USE_TIMER == 22 #elif STM32_ST_USE_TIMER == 22
#if !STM32_HAS_TIM22
#error "TIM22 not present in the selected device"
#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 STM32_ST_TIM STM32_TIM22 #define STM32_ST_TIM STM32_TIM22
#else #else
#error "STM32_ST_USE_TIMER specifies an unsupported timer" #error "STM32_ST_USE_TIMER specifies an unsupported timer"
#endif #endif
#endif /* OSAL_ST_MODE == OSAL_ST_MODE_FREERUNNING */
/*===========================================================================*/ /*===========================================================================*/
/* Driver data structures and types. */ /* Driver data structures and types. */
@ -185,7 +135,6 @@ extern "C" {
/* Driver inline functions. */ /* Driver inline functions. */
/*===========================================================================*/ /*===========================================================================*/
#if (OSAL_ST_MODE == OSAL_ST_MODE_FREERUNNING) || defined(__DOXYGEN__)
/** /**
* @brief Returns the time counter value. * @brief Returns the time counter value.
* *
@ -261,7 +210,6 @@ static inline bool st_lld_is_alarm_active(void) {
return (bool)((STM32_ST_TIM->DIER & STM32_TIM_DIER_CC1IE) != 0); return (bool)((STM32_ST_TIM->DIER & STM32_TIM_DIER_CC1IE) != 0);
} }
#endif /* OSAL_ST_MODE == OSAL_ST_MODE_FREERUNNING */
#endif /* HAL_ST_LLD_H */ #endif /* HAL_ST_LLD_H */