Fixed bugs 573 and 574.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7876 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
Giovanni Di Sirio 2015-04-09 09:59:15 +00:00
parent 071db6ae06
commit 5f8df8485c
7 changed files with 27 additions and 28 deletions

View File

@ -1,7 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?> <?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings"> <storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="0.114656749"> <cconfiguration id="0.114656749">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.114656749" moduleId="org.eclipse.cdt.core.settings" name="Default"> <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.114656749" moduleId="org.eclipse.cdt.core.settings" name="Default">

View File

@ -101,7 +101,7 @@
/** /**
* @brief HAL version string. * @brief HAL version string.
*/ */
#define HAL_VERSION "3.0.0p1" #define HAL_VERSION "3.0.0p2"
/** /**
* @brief HAL version major number. * @brief HAL version major number.

View File

@ -61,7 +61,7 @@ typedef struct nil_thread thread_t;
/** /**
* @brief Kernel version string. * @brief Kernel version string.
*/ */
#define CH_KERNEL_VERSION "1.0.0p1" #define CH_KERNEL_VERSION "1.0.0p2"
/** /**
* @brief Kernel version major number. * @brief Kernel version major number.

View File

@ -48,7 +48,7 @@
/** /**
* @brief Kernel version string. * @brief Kernel version string.
*/ */
#define CH_KERNEL_VERSION "3.0.0p1" #define CH_KERNEL_VERSION "3.0.0p2"
/** /**
* @brief Kernel version major number. * @brief Kernel version major number.

View File

@ -498,7 +498,7 @@ static inline void chVTDoTickI(void) {
note that the loop is stopped by the timers header having note that the loop is stopped by the timers header having
"ch.vtlist.vt_delta == (systime_t)-1" which is greater than "ch.vtlist.vt_delta == (systime_t)-1" which is greater than
all deltas.*/ all deltas.*/
while (vtp->vt_delta <= now - ch.vtlist.vt_lasttime) { while (vtp->vt_delta <= (systime_t)(now - ch.vtlist.vt_lasttime)) {
vtfunc_t fn; vtfunc_t fn;
/* The "last time" becomes this timer's expiration time.*/ /* The "last time" becomes this timer's expiration time.*/

View File

@ -95,6 +95,7 @@ void _vt_init(void) {
void chVTDoSetI(virtual_timer_t *vtp, systime_t delay, void chVTDoSetI(virtual_timer_t *vtp, systime_t delay,
vtfunc_t vtfunc, void *par) { vtfunc_t vtfunc, void *par) {
virtual_timer_t *p; virtual_timer_t *p;
systime_t delta;
chDbgCheckClassI(); chDbgCheckClassI();
chDbgCheck((vtp != NULL) && (vtfunc != NULL) && (delay != TIME_IMMEDIATE)); chDbgCheck((vtp != NULL) && (vtfunc != NULL) && (delay != TIME_IMMEDIATE));
@ -106,14 +107,15 @@ void chVTDoSetI(virtual_timer_t *vtp, systime_t delay,
{ {
systime_t now = chVTGetSystemTimeX(); systime_t now = chVTGetSystemTimeX();
/* Special case where the timers list is empty.*/
if (&ch.vtlist == (virtual_timers_list_t *)ch.vtlist.vt_next) {
/* If the requested delay is lower than the minimum safe delta then it /* If the requested delay is lower than the minimum safe delta then it
is raised to the minimum safe value.*/ is raised to the minimum safe value.*/
if (delay < (systime_t)CH_CFG_ST_TIMEDELTA) { if (delay < (systime_t)CH_CFG_ST_TIMEDELTA) {
delay = (systime_t)CH_CFG_ST_TIMEDELTA; delay = (systime_t)CH_CFG_ST_TIMEDELTA;
} }
/* Special case where the timers list is empty.*/
if (&ch.vtlist == (virtual_timers_list_t *)ch.vtlist.vt_next) {
/* The delta list is empty, the current time becomes the new /* The delta list is empty, the current time becomes the new
delta list base time, the timer is inserted.*/ delta list base time, the timer is inserted.*/
ch.vtlist.vt_lasttime = now; ch.vtlist.vt_lasttime = now;
@ -131,28 +133,23 @@ void chVTDoSetI(virtual_timer_t *vtp, systime_t delay,
/* Special case where the timer will be placed as first element in a /* Special case where the timer will be placed as first element in a
non-empty list, the alarm needs to be recalculated.*/ non-empty list, the alarm needs to be recalculated.*/
if ((now + delay) < (ch.vtlist.vt_lasttime + ch.vtlist.vt_next->vt_delta)) { delta = now + delay - ch.vtlist.vt_lasttime;
/* If the requested delay is lower than the minimum safe delta then it if (delta < ch.vtlist.vt_next->vt_delta) {
is raised to the minimum safe value.*/
if (delay < (systime_t)CH_CFG_ST_TIMEDELTA) {
delay = (systime_t)CH_CFG_ST_TIMEDELTA;
}
/* Now the delay is calculated as delta from the last tick interrupt
time.*/
delay += now - ch.vtlist.vt_lasttime;
/* New alarm deadline.*/ /* New alarm deadline.*/
port_timer_set_alarm(ch.vtlist.vt_lasttime + delay); port_timer_set_alarm(ch.vtlist.vt_lasttime + delta);
} }
} }
#endif /* CH_CFG_ST_TIMEDELTA > 0 */ #else /* CH_CFG_ST_TIMEDELTA == 0 */
/* Delta is initially equal to the specified delay.*/
delta = delay;
#endif /* CH_CFG_ST_TIMEDELTA == 0 */
/* The delta list is scanned in order to find the correct position for /* The delta list is scanned in order to find the correct position for
this timer. */ this timer. */
p = ch.vtlist.vt_next; p = ch.vtlist.vt_next;
while (p->vt_delta < delay) { while (p->vt_delta < delta) {
delay -= p->vt_delta; delta -= p->vt_delta;
p = p->vt_next; p = p->vt_next;
} }
@ -161,11 +158,11 @@ void chVTDoSetI(virtual_timer_t *vtp, systime_t delay,
vtp->vt_prev = vtp->vt_next->vt_prev; vtp->vt_prev = vtp->vt_next->vt_prev;
vtp->vt_prev->vt_next = vtp; vtp->vt_prev->vt_next = vtp;
p->vt_prev = vtp; p->vt_prev = vtp;
vtp->vt_delta = delay vtp->vt_delta = delta
/* Special case when the timer is in last position in the list, the /* Special case when the timer is in last position in the list, the
value in the header must be restored.*/; value in the header must be restored.*/;
p->vt_delta -= delay; p->vt_delta -= delta;
ch.vtlist.vt_delta = (systime_t)-1; ch.vtlist.vt_delta = (systime_t)-1;
} }

View File

@ -73,5 +73,9 @@
*** Releases and Change Log *** *** Releases and Change Log ***
***************************************************************************** *****************************************************************************
*** 3.0.0p2 ***
- HAL: Fixed instances of RT API in HAL drivers (bug 574).
- RT: Fixed system time overflow issue in tickless mode (bug 573).
*** 3.0.0p1 *** *** 3.0.0p1 ***
- First 3.0.0 release, see release note 3.0.0. - First 3.0.0 release, see release note 3.0.0.