aboutsummaryrefslogtreecommitdiffstats
path: root/os
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-09-12 13:57:51 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-09-12 13:57:51 +0000
commite525eb795a7a27dc7778f399a6df68ac1ab48a97 (patch)
tree32781f328468a1343ad6b3514c48bd5a17c7b78a /os
parent232ae706e91fb0113591dab7116965c7c2b09351 (diff)
downloadChibiOS-e525eb795a7a27dc7778f399a6df68ac1ab48a97.tar.gz
ChibiOS-e525eb795a7a27dc7778f399a6df68ac1ab48a97.tar.bz2
ChibiOS-e525eb795a7a27dc7778f399a6df68ac1ab48a97.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6296 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os')
-rw-r--r--os/hal/ports/STM32/TIMv1/st_lld.c48
-rw-r--r--os/hal/ports/STM32/TIMv1/st_lld.h30
2 files changed, 52 insertions, 26 deletions
diff --git a/os/hal/ports/STM32/TIMv1/st_lld.c b/os/hal/ports/STM32/TIMv1/st_lld.c
index a8b858e8c..7858e1fd8 100644
--- a/os/hal/ports/STM32/TIMv1/st_lld.c
+++ b/os/hal/ports/STM32/TIMv1/st_lld.c
@@ -35,37 +35,49 @@
#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 == 5
-#if (OSAL_ST_RESOLUTION == 32) && !STM32_TIM5_IS_32BITS
-#error "TIM5 is not a 32bits timer"
+#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_TIM5_HANDLER
-#define ST_NUMBER STM32_TIM5_NUMBER
-#define ST_ENABLE_CLOCK() rccEnableTIM5(FALSE)
+#define ST_HANDLER STM32_TIM3_HANDLER
+#define ST_NUMBER STM32_TIM3_NUMBER
+#define ST_ENABLE_CLOCK() rccEnableTIM3(FALSE)
-#elif STM32_ST_USE_TIMER == 6
-#if (OSAL_ST_RESOLUTION == 32) && !STM32_TIM6_IS_32BITS
-#error "TIM6 is not a 32bits timer"
+#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_TIM6_HANDLER
-#define ST_NUMBER STM32_TIM6_NUMBER
-#define ST_ENABLE_CLOCK() rccEnableTIM6(FALSE)
+#define ST_HANDLER STM32_TIM4_HANDLER
+#define ST_NUMBER STM32_TIM4_NUMBER
+#define ST_ENABLE_CLOCK() rccEnableTIM4(FALSE)
-#elif STM32_ST_USE_TIMER == 7
-#if (OSAL_ST_RESOLUTION == 32) && !STM32_TIM7_IS_32BITS
-#error "TIM7 is not a 32bits timer"
+#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_TIM7_HANDLER
-#define ST_NUMBER STM32_TIM7_NUMBER
-#define ST_ENABLE_CLOCK() rccEnableTIM7(FALSE)
+#define ST_HANDLER STM32_TIM5_HANDLER
+#define ST_NUMBER STM32_TIM5_NUMBER
+#define ST_ENABLE_CLOCK() rccEnableTIM5(FALSE)
#else
#error "STM32_ST_USE_TIMER specifies an unsupported timer"
diff --git a/os/hal/ports/STM32/TIMv1/st_lld.h b/os/hal/ports/STM32/TIMv1/st_lld.h
index 0013d7913..37da6fdcd 100644
--- a/os/hal/ports/STM32/TIMv1/st_lld.h
+++ b/os/hal/ports/STM32/TIMv1/st_lld.h
@@ -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,16 +54,28 @@
/*===========================================================================*/
#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 == 5
-#define STM32_ST_TIM STM32_TIM5
+#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 == 6
-#define STM32_ST_TIM STM32_TIM6
+#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 == 7
-#define STM32_ST_TIM STM32_TIM7
+#elif STM32_ST_USE_TIMER == 5
+#if !STM32_HAS_TIM5
+#error "TIM5 not present"
+#endif
+#define STM32_ST_TIM STM32_TIM5
#else
#error "STM32_ST_USE_TIMER specifies an unsupported timer"