Experimental code.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/rt5_dev_point1@10816 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
750a8f14b6
commit
72d563b45f
|
@ -5,7 +5,7 @@
|
|||
|
||||
# Compiler options here.
|
||||
ifeq ($(USE_OPT),)
|
||||
USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16
|
||||
USE_OPT = -O0 -ggdb -fomit-frame-pointer -falign-functions=16
|
||||
endif
|
||||
|
||||
# C specific options here (added to USE_OPT).
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
* @details Frequency of the system timer that drives the system ticks. This
|
||||
* setting also defines the system tick time unit.
|
||||
*/
|
||||
#define CH_CFG_ST_FREQUENCY 10000
|
||||
#define CH_CFG_ST_FREQUENCY 100000
|
||||
|
||||
/**
|
||||
* @brief Time intervals data size.
|
||||
|
|
|
@ -395,19 +395,26 @@ static inline void chVTDoTickI(void) {
|
|||
systime_t now;
|
||||
sysinterval_t delta;
|
||||
|
||||
/* First timer to be processed.*/
|
||||
/* Looping through timers.*/
|
||||
vtp = ch.vtlist.next;
|
||||
now = chVTGetSystemTimeX();
|
||||
|
||||
/* All timers within the time window are triggered and removed,
|
||||
note that the loop is stopped by the timers header having
|
||||
"ch.vtlist.vt_delta == (sysinterval_t)-1" which is greater than
|
||||
all deltas.*/
|
||||
while (vtp->delta <= chTimeDiffX(ch.vtlist.lasttime, now)) {
|
||||
while (true) {
|
||||
vtfunc_t fn;
|
||||
|
||||
/* The loop is stopped by the timers header having
|
||||
"ch.vtlist.vt_delta == (sysinterval_t)-1" which
|
||||
is greater than all deltas.*/
|
||||
now = chVTGetSystemTimeX();
|
||||
if (vtp->delta > chTimeDiffX(ch.vtlist.lasttime, now)) {
|
||||
break;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* The "last time" becomes this timer's expiration time.*/
|
||||
ch.vtlist.lasttime = chTimeAddX(ch.vtlist.lasttime, vtp->delta);
|
||||
#else
|
||||
/* The "last time" is set to the current time.*/
|
||||
ch.vtlist.lasttime = now;
|
||||
#endif
|
||||
|
||||
vtp->next->prev = (virtual_timer_t *)&ch.vtlist;
|
||||
ch.vtlist.next = vtp->next;
|
||||
|
@ -431,10 +438,8 @@ static inline void chVTDoTickI(void) {
|
|||
of the list.*/
|
||||
chSysLockFromISR();
|
||||
|
||||
/* Next element in the list, the current time could have advanced so
|
||||
recalculating the time window.*/
|
||||
/* Next element in the list.*/
|
||||
vtp = ch.vtlist.next;
|
||||
now = chVTGetSystemTimeX();
|
||||
}
|
||||
|
||||
/* if the list is empty, nothing else to do.*/
|
||||
|
|
|
@ -125,6 +125,13 @@ void chVTDoSetI(virtual_timer_t *vtp, sysinterval_t delay,
|
|||
vtp->prev = (virtual_timer_t *)&ch.vtlist;
|
||||
vtp->delta = delay;
|
||||
|
||||
#if CH_CFG_INTERVALS_SIZE > CH_CFG_ST_RESOLUTION
|
||||
/* The delta could be too large for the physical timer to handle.*/
|
||||
if (delay > (sysinterval_t)TIME_MAX_SYSTIME) {
|
||||
delay = (sysinterval_t)TIME_MAX_SYSTIME;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Being the first element in the list the alarm timer is started.*/
|
||||
port_timer_start_alarm(chTimeAddX(ch.vtlist.lasttime, delay));
|
||||
|
||||
|
|
Loading…
Reference in New Issue