aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-08-08 12:38:43 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-08-08 12:38:43 +0000
commit9728e44141592787faff89d858ffba528de70f61 (patch)
tree453aa3ac87d639129a8a50a5d7131c7e0861307d
parent0ef4a97438fdcd3b1a26dbf258dbbaf2732358af (diff)
downloadChibiOS-9728e44141592787faff89d858ffba528de70f61.tar.gz
ChibiOS-9728e44141592787faff89d858ffba528de70f61.tar.bz2
ChibiOS-9728e44141592787faff89d858ffba528de70f61.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6105 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r--demos/ARMCM4-STM32F303-DISCOVERY/chconf.h4
-rw-r--r--os/halnew/platforms/STM32/st_lld.c14
-rw-r--r--os/kernel/ports/ARMCMx/chcore_v7m.h8
-rw-r--r--os/kernel/ports/ARMCMx/devices/STM32F30x/systick.h22
4 files changed, 20 insertions, 28 deletions
diff --git a/demos/ARMCM4-STM32F303-DISCOVERY/chconf.h b/demos/ARMCM4-STM32F303-DISCOVERY/chconf.h
index e71632ee9..bc14f02b6 100644
--- a/demos/ARMCM4-STM32F303-DISCOVERY/chconf.h
+++ b/demos/ARMCM4-STM32F303-DISCOVERY/chconf.h
@@ -41,7 +41,7 @@
* setting also defines the system tick time unit.
*/
#if !defined(CH_CFG_ST_FREQUENCY) || defined(__DOXYGEN__)
-#define CH_CFG_ST_FREQUENCY 1000
+#define CH_CFG_ST_FREQUENCY 10000
#endif
/**
@@ -62,7 +62,7 @@
* this value.
*/
#if !defined(CH_CFG_TIMEDELTA) || defined(__DOXYGEN__)
-#define CH_CFG_TIMEDELTA 0
+#define CH_CFG_TIMEDELTA 2
#endif
/**
diff --git a/os/halnew/platforms/STM32/st_lld.c b/os/halnew/platforms/STM32/st_lld.c
index d0788bf93..debfde38f 100644
--- a/os/halnew/platforms/STM32/st_lld.c
+++ b/os/halnew/platforms/STM32/st_lld.c
@@ -104,8 +104,19 @@ void st_lld_init(void) {
#if OSAL_ST_MODE == OSAL_ST_MODE_FREERUNNING
/* Free running counter mode.*/
rccEnableTIM2(FALSE);
+
+ /* Initializing the counter in free running mode.*/
+ STM32_TIM2->PSC = STM32_TIMCLK2 / OSAL_SYSTICK_FREQUENCY - 1;
+ STM32_TIM2->ARR = 0xFFFFFFFF;
+ STM32_TIM2->CCMR1 = 0;
+ STM32_TIM2->CCR[0] = 0;
+ STM32_TIM2->DIER = 0;
+ STM32_TIM2->CR2 = 0;
+ STM32_TIM2->EGR = TIM_EGR_UG;
+ STM32_TIM2->CR1 = TIM_CR1_CEN;
+
+ /* IRQ enabled.*/
nvicEnableVector(STM32_TIM2_NUMBER, ST_TIMER_PRIORITY);
- STM32_TIM2->PSC = STM32_TIMCLK2 / OSAL_SYSTICK_FREQUENCY - 1;
#endif
#if OSAL_ST_MODE == OSAL_ST_MODE_PERIODIC
@@ -117,6 +128,7 @@ void st_lld_init(void) {
SysTick_CTRL_ENABLE_Msk |
SysTick_CTRL_TICKINT_Msk;
+ /* IRQ enabled.*/
nvicSetSystemHandlerPriority(SysTick_IRQn, ST_TIMER_PRIORITY);
#endif
}
diff --git a/os/kernel/ports/ARMCMx/chcore_v7m.h b/os/kernel/ports/ARMCMx/chcore_v7m.h
index 0fc220a34..22f81d00a 100644
--- a/os/kernel/ports/ARMCMx/chcore_v7m.h
+++ b/os/kernel/ports/ARMCMx/chcore_v7m.h
@@ -429,14 +429,10 @@ static inline void port_init(void) {
DWT->CTRL |= DWT_CTRL_CYCCNTENA_Msk;
/* Initialization of the system vectors used by the port.*/
+#if !CORTEX_SIMPLIFIED_PRIORITY
NVIC_SetPriority(SVCall_IRQn, CORTEX_PRIORITY_SVCALL);
- NVIC_SetPriority(PendSV_IRQn, CORTEX_PRIORITY_PENDSV);
-
-#if CH_CFG_TIMEDELTA > 0
- /* TODO: Remove initialization, all the timers handling has to be performed
- outside the port layer.*/
- port_timer_init();
#endif
+ NVIC_SetPriority(PendSV_IRQn, CORTEX_PRIORITY_PENDSV);
}
/**
diff --git a/os/kernel/ports/ARMCMx/devices/STM32F30x/systick.h b/os/kernel/ports/ARMCMx/devices/STM32F30x/systick.h
index 7e036ff3c..3b143780d 100644
--- a/os/kernel/ports/ARMCMx/devices/STM32F30x/systick.h
+++ b/os/kernel/ports/ARMCMx/devices/STM32F30x/systick.h
@@ -26,8 +26,8 @@
* @{
*/
-#ifndef _CHTIMER_H_
-#define _CHTIMER_H_
+#ifndef _SYSTICK_H_
+#define _SYSTICK_H_
/*===========================================================================*/
/* Module constants. */
@@ -58,22 +58,6 @@
/*===========================================================================*/
/**
- * @brief Timer unit initialization.
- *
- * @notapi
- */
-static inline void port_timer_init(void) {
-
- TIM2->ARR = 0xFFFFFFFF;
- TIM2->CCMR1 = 0;
- TIM2->CCR1 = 0;
- TIM2->DIER = 0;
- TIM2->CR2 = 0;
- TIM2->EGR = TIM_EGR_UG;
- TIM2->CR1 = TIM_CR1_CEN;
-}
-
-/**
* @brief Returns the system time.
*
* @return The system time.
@@ -151,6 +135,6 @@ static inline systime_t port_timer_get_alarm(void) {
return TIM2->CCR1;
}
-#endif /* _CHTIMER_H_ */
+#endif /* _SYSTICK_H_ */
/** @} */