git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6296 35acf78f-673a-0410-8e92-d51de3d6d3f4

master
gdisirio 2013-09-12 13:57:51 +00:00
parent 232ae706e9
commit e525eb795a
2 changed files with 52 additions and 26 deletions

View File

@ -35,38 +35,50 @@
#if (OSAL_ST_RESOLUTION == 32) && !STM32_TIM2_IS_32BITS
#error "TIM2 is not a 32bits timer"
#endif
#if (OSAL_ST_RESOLUTION == 16) && STM32_TIM2_IS_32BITS
#error "TIM2 is not a 16bits timer"
#endif
#define ST_HANDLER STM32_TIM2_HANDLER
#define ST_NUMBER STM32_TIM2_NUMBER
#define ST_ENABLE_CLOCK() rccEnableTIM2(FALSE)
#elif STM32_ST_USE_TIMER == 3
#if (OSAL_ST_RESOLUTION == 32) && !STM32_TIM3_IS_32BITS
#error "TIM3 is not a 32bits timer"
#endif
#if (OSAL_ST_RESOLUTION == 16) && STM32_TIM3_IS_32BITS
#error "TIM3 is not a 16bits timer"
#endif
#define ST_HANDLER STM32_TIM3_HANDLER
#define ST_NUMBER STM32_TIM3_NUMBER
#define ST_ENABLE_CLOCK() rccEnableTIM3(FALSE)
#elif STM32_ST_USE_TIMER == 4
#if (OSAL_ST_RESOLUTION == 32) && !STM32_TIM4_IS_32BITS
#error "TIM4 is not a 32bits timer"
#endif
#if (OSAL_ST_RESOLUTION == 16) && STM32_TIM4_IS_32BITS
#error "TIM4 is not a 16bits timer"
#endif
#define ST_HANDLER STM32_TIM4_HANDLER
#define ST_NUMBER STM32_TIM4_NUMBER
#define ST_ENABLE_CLOCK() rccEnableTIM4(FALSE)
#elif STM32_ST_USE_TIMER == 5
#if (OSAL_ST_RESOLUTION == 32) && !STM32_TIM5_IS_32BITS
#error "TIM5 is not a 32bits timer"
#endif
#if (OSAL_ST_RESOLUTION == 16) && STM32_TIM5_IS_32BITS
#error "TIM5 is not a 16bits timer"
#endif
#define ST_HANDLER STM32_TIM5_HANDLER
#define ST_NUMBER STM32_TIM5_NUMBER
#define ST_ENABLE_CLOCK() rccEnableTIM5(FALSE)
#elif STM32_ST_USE_TIMER == 6
#if (OSAL_ST_RESOLUTION == 32) && !STM32_TIM6_IS_32BITS
#error "TIM6 is not a 32bits timer"
#endif
#define ST_HANDLER STM32_TIM6_HANDLER
#define ST_NUMBER STM32_TIM6_NUMBER
#define ST_ENABLE_CLOCK() rccEnableTIM6(FALSE)
#elif STM32_ST_USE_TIMER == 7
#if (OSAL_ST_RESOLUTION == 32) && !STM32_TIM7_IS_32BITS
#error "TIM7 is not a 32bits timer"
#endif
#define ST_HANDLER STM32_TIM7_HANDLER
#define ST_NUMBER STM32_TIM7_NUMBER
#define ST_ENABLE_CLOCK() rccEnableTIM7(FALSE)
#else
#error "STM32_ST_USE_TIMER specifies an unsupported timer"
#endif

View File

@ -29,6 +29,7 @@
#include "stm32_registry.h"
#include "stm32_tim.h"
#include "mcuconf.h"
/*===========================================================================*/
/* Driver constants. */
@ -40,8 +41,9 @@
/**
* @brief TIMx unit (by number) to be used for free running operations.
* @note You must select a 32 bits timer if a 32 bits systick_t is
* required.
* @note You must select a 32 bits timer if a 32 bits @p systick_t type
* is required or a 16 bits timer if a 16 bits @p systick_t type
* is required.
*/
#if !defined(STM32_ST_USE_TIMER) || defined(__DOXYGEN__)
#define STM32_ST_USE_TIMER 2
@ -52,17 +54,29 @@
/*===========================================================================*/
#if STM32_ST_USE_TIMER == 2
#if !STM32_HAS_TIM2
#error "TIM2 not present"
#endif
#define STM32_ST_TIM STM32_TIM2
#elif STM32_ST_USE_TIMER == 3
#if !STM32_HAS_TIM3
#error "TIM3 not present"
#endif
#define STM32_ST_TIM STM32_TIM3
#elif STM32_ST_USE_TIMER == 4
#if !STM32_HAS_TIM4
#error "TIM4 not present"
#endif
#define STM32_ST_TIM STM32_TIM4
#elif STM32_ST_USE_TIMER == 5
#if !STM32_HAS_TIM5
#error "TIM5 not present"
#endif
#define STM32_ST_TIM STM32_TIM5
#elif STM32_ST_USE_TIMER == 6
#define STM32_ST_TIM STM32_TIM6
#elif STM32_ST_USE_TIMER == 7
#define STM32_ST_TIM STM32_TIM7
#else
#error "STM32_ST_USE_TIMER specifies an unsupported timer"
#endif