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

This commit is contained in:
Giovanni Di Sirio 2015-03-31 10:22:58 +00:00
parent 337db8c8b2
commit 13dd1668a6
3 changed files with 32 additions and 33 deletions

View File

@ -47,6 +47,11 @@
#define ST_NUMBER STM32_TIM2_NUMBER
#define ST_CLOCK_SRC STM32_TIMCLK1
#define ST_ENABLE_CLOCK() rccEnableTIM2(FALSE)
#if defined(STM32F1XX)
#define ST_ENABLE_STOP() DBGMCU->CR |= DBGMCU_CR_DBG_TIM2_STOP
#else
#define ST_ENABLE_STOP() DBGMCU->APB1FZ |= DBGMCU_APB1_FZ_DBG_TIM2_STOP
#endif
#elif STM32_ST_USE_TIMER == 3
#if (OSAL_ST_RESOLUTION == 32) && !STM32_TIM3_IS_32BITS
@ -57,6 +62,11 @@
#define ST_NUMBER STM32_TIM3_NUMBER
#define ST_CLOCK_SRC STM32_TIMCLK1
#define ST_ENABLE_CLOCK() rccEnableTIM3(FALSE)
#if defined(STM32F1XX)
#define ST_ENABLE_STOP() DBGMCU->CR |= DBGMCU_CR_DBG_TIM3_STOP
#else
#define ST_ENABLE_STOP() DBGMCU->APB1FZ |= DBGMCU_APB1_FZ_DBG_TIM3_STOP
#endif
#elif STM32_ST_USE_TIMER == 4
#if (OSAL_ST_RESOLUTION == 32) && !STM32_TIM4_IS_32BITS
@ -67,6 +77,11 @@
#define ST_NUMBER STM32_TIM4_NUMBER
#define ST_CLOCK_SRC STM32_TIMCLK1
#define ST_ENABLE_CLOCK() rccEnableTIM4(FALSE)
#if defined(STM32F1XX)
#define ST_ENABLE_STOP() DBGMCU->CR |= DBGMCU_CR_DBG_TIM4_STOP
#else
#define ST_ENABLE_STOP() DBGMCU->APB1FZ |= DBGMCU_APB1_FZ_DBG_TIM4_STOP
#endif
#elif STM32_ST_USE_TIMER == 5
#if (OSAL_ST_RESOLUTION == 32) && !STM32_TIM5_IS_32BITS
@ -77,6 +92,11 @@
#define ST_NUMBER STM32_TIM5_NUMBER
#define ST_CLOCK_SRC STM32_TIMCLK1
#define ST_ENABLE_CLOCK() rccEnableTIM5(FALSE)
#if defined(STM32F1XX)
#define ST_ENABLE_STOP() DBGMCU->CR |= DBGMCU_CR_DBG_TIM5_STOP
#else
#define ST_ENABLE_STOP() DBGMCU->APB1FZ |= DBGMCU_APB1_FZ_DBG_TIM5_STOP
#endif
#else
#error "STM32_ST_USE_TIMER specifies an unsupported timer"
@ -154,11 +174,16 @@ OSAL_IRQ_HANDLER(ST_HANDLER) {
OSAL_IRQ_PROLOGUE();
STM32_ST_TIM->SR = 0;
/* Note, under rare circumstances an interrupt can remain latched even if
the timer SR register has been cleared, in those cases the interrupt
is simply ignored.*/
if ((STM32_ST_TIM->SR & TIM_SR_CC1IF) != 0U) {
STM32_ST_TIM->SR = 0U;
osalSysLockFromISR();
osalOsTimerHandlerI();
osalSysUnlockFromISR();
osalSysLockFromISR();
osalOsTimerHandlerI();
osalSysUnlockFromISR();
}
OSAL_IRQ_EPILOGUE();
}
@ -181,6 +206,9 @@ void st_lld_init(void) {
/* Enabling timer clock.*/
ST_ENABLE_CLOCK();
/* Enabling the stop mode during debug for this timer.*/
ST_ENABLE_STOP();
/* Initializing the counter in free running mode.*/
STM32_ST_TIM->PSC = (ST_CLOCK_SRC / OSAL_ST_FREQUENCY) - 1;
STM32_ST_TIM->ARR = ST_ARR_INIT;

View File

@ -481,10 +481,6 @@ static inline void chVTDoTickI(void) {
chVTGetSystemTimeX() + 1),
"out of time window");
/* if (now > 21) {
__BKPT(0);
}*/
/* Timers processing loop.*/
while (true) {
systime_t now;
@ -534,11 +530,6 @@ static inline void chVTDoTickI(void) {
if (delta < (systime_t)CH_CFG_ST_TIMEDELTA) {
delta = (systime_t)CH_CFG_ST_TIMEDELTA;
}
// if (now + delta >= 23) {
// __BKPT(0);
// }
port_timer_set_alarm(now + delta);
chDbgAssert((chVTGetSystemTimeX() - ch.vtlist.vt_lasttime) < delta,

View File

@ -99,11 +99,6 @@ void chVTDoSetI(virtual_timer_t *vtp, systime_t delay,
chDbgCheckClassI();
chDbgCheck((vtp != NULL) && (vtfunc != NULL) && (delay != TIME_IMMEDIATE));
/* systime_t tm = chVTGetSystemTimeX();
if (tm >= 23) {
__BKPT(0);
}*/
vtp->vt_par = par;
vtp->vt_func = vtfunc;
p = ch.vtlist.vt_next;
@ -156,11 +151,6 @@ void chVTDoSetI(virtual_timer_t *vtp, systime_t delay,
value in the header must be restored.*/;
p->vt_delta -= delay;
ch.vtlist.vt_delta = (systime_t)-1;
/* systime_t tmx = chVTGetSystemTimeX();
if (tmx >= 23) {
__BKPT(0);
}*/
}
/**
@ -180,11 +170,6 @@ void chVTDoResetI(virtual_timer_t *vtp) {
chDbgCheck(vtp != NULL);
chDbgAssert(vtp->vt_func != NULL, "timer not set or already triggered");
/* systime_t tm = chVTGetSystemTimeX();
if (tm >= 23) {
__BKPT(0);
}*/
/* Checking if the element to be removed was the first in the list.*/
#if CH_CFG_ST_TIMEDELTA > 0
first = ch.vtlist.vt_next;
@ -242,11 +227,6 @@ void chVTDoResetI(virtual_timer_t *vtp) {
}
port_timer_set_alarm(ch.vtlist.vt_lasttime + nowdelta + delta);
/* systime_t tmx = chVTGetSystemTimeX();
if (tmx >= 23) {
__BKPT(0);
}*/
}
#endif /* CH_CFG_ST_TIMEDELTA > 0 */
}