Fixed tick mode.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@14351 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
parent
38e27cdbb4
commit
d5ce3b21ac
|
@ -291,7 +291,7 @@ void chVTDoResetI(virtual_timer_t *vtp) {
|
||||||
vtp->dlist.next->delta += vtp->dlist.delta;
|
vtp->dlist.next->delta += vtp->dlist.delta;
|
||||||
|
|
||||||
/* Removing the element from the delta list, marking it as not armed.*/
|
/* Removing the element from the delta list, marking it as not armed.*/
|
||||||
dlist_dequeue(&vtp->dlist);
|
ch_dlist_dequeue(&vtp->dlist);
|
||||||
vtp->dlist.next = NULL;
|
vtp->dlist.next = NULL;
|
||||||
|
|
||||||
/* The above code changes the value in the header when the removed element
|
/* The above code changes the value in the header when the removed element
|
||||||
|
@ -374,22 +374,26 @@ void chVTDoResetI(virtual_timer_t *vtp) {
|
||||||
*/
|
*/
|
||||||
sysinterval_t chVTGetRemainingIntervalI(virtual_timer_t *vtp) {
|
sysinterval_t chVTGetRemainingIntervalI(virtual_timer_t *vtp) {
|
||||||
virtual_timers_list_t *vtlp = &currcore->vtlist;
|
virtual_timers_list_t *vtlp = &currcore->vtlist;
|
||||||
sysinterval_t deadline;
|
sysinterval_t delta;
|
||||||
ch_delta_list_t *dlp;
|
ch_delta_list_t *dlp;
|
||||||
|
|
||||||
chDbgCheckClassI();
|
chDbgCheckClassI();
|
||||||
|
|
||||||
deadline = (sysinterval_t)0;
|
delta = (sysinterval_t)0;
|
||||||
dlp = vtlp->dlist.next;
|
dlp = vtlp->dlist.next;
|
||||||
do {
|
do {
|
||||||
deadline += dlp->delta;
|
delta += dlp->delta;
|
||||||
if (dlp == &vtp->dlist) {
|
if (dlp == &vtp->dlist) {
|
||||||
|
#if CH_CFG_ST_TIMEDELTA > 0
|
||||||
systime_t now = chVTGetSystemTimeX();
|
systime_t now = chVTGetSystemTimeX();
|
||||||
sysinterval_t nowdelta = chTimeDiffX(vtlp->lasttime, now);
|
sysinterval_t nowdelta = chTimeDiffX(vtlp->lasttime, now);
|
||||||
if (nowdelta > deadline) {
|
if (nowdelta > delta) {
|
||||||
return (sysinterval_t)0;
|
return (sysinterval_t)0;
|
||||||
}
|
}
|
||||||
return nowdelta - deadline;
|
return nowdelta - delta;
|
||||||
|
#else
|
||||||
|
return delta;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
dlp = dlp->next;
|
dlp = dlp->next;
|
||||||
} while (dlp != &vtlp->dlist);
|
} while (dlp != &vtlp->dlist);
|
||||||
|
@ -415,7 +419,7 @@ void chVTDoTickI(void) {
|
||||||
|
|
||||||
#if CH_CFG_ST_TIMEDELTA == 0
|
#if CH_CFG_ST_TIMEDELTA == 0
|
||||||
vtlp->systime++;
|
vtlp->systime++;
|
||||||
if (!is_vtlist_empty(&vtlp->dlist)) {
|
if (ch_dlist_notempty(&vtlp->dlist)) {
|
||||||
/* The list is not empty, processing elements on top.*/
|
/* The list is not empty, processing elements on top.*/
|
||||||
--vtlp->dlist.next->delta;
|
--vtlp->dlist.next->delta;
|
||||||
while (vtlp->dlist.next->delta == (sysinterval_t)0) {
|
while (vtlp->dlist.next->delta == (sysinterval_t)0) {
|
||||||
|
@ -425,12 +429,11 @@ void chVTDoTickI(void) {
|
||||||
vtp = (virtual_timer_t *)vtlp->dlist.next;
|
vtp = (virtual_timer_t *)vtlp->dlist.next;
|
||||||
|
|
||||||
/* Removing the element from the delta list, marking it as not armed.*/
|
/* Removing the element from the delta list, marking it as not armed.*/
|
||||||
vtp->dlist.next->prev = &vtlp->dlist;
|
ch_dlist_dequeue(&vtp->dlist);
|
||||||
vtlp->dlist.next = vtp->dlist.next;
|
|
||||||
vtp->dlist.next = NULL;
|
vtp->dlist.next = NULL;
|
||||||
|
|
||||||
chSysUnlockFromISR();
|
chSysUnlockFromISR();
|
||||||
vtp->func(vtp->par);
|
vtp->func(vtp, vtp->par);
|
||||||
chSysLockFromISR();
|
chSysLockFromISR();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue