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

master
gdisirio 2013-09-04 12:41:44 +00:00
parent 71ee071933
commit e5e278c89f
2 changed files with 8 additions and 11 deletions

View File

@ -41,7 +41,7 @@
/** /**
* @brief System tick frequency. * @brief System tick frequency.
*/ */
#define NIL_CFG_ST_FREQUENCY 1000 #define NIL_CFG_ST_FREQUENCY 50000
/** /**
* @brief Time delta constant for the tick-less mode. * @brief Time delta constant for the tick-less mode.
@ -51,7 +51,7 @@
* The value one is not valid, timeouts are rounded up to * The value one is not valid, timeouts are rounded up to
* this value. * this value.
*/ */
#define NIL_CFG_TIMEDELTA 0 #define NIL_CFG_TIMEDELTA 2
/** /**
* @brief Events Flags APIs. * @brief Events Flags APIs.

View File

@ -165,17 +165,14 @@ void chSysTimerHandlerI(void) {
thread_reference_t tr = &nil.threads[0]; thread_reference_t tr = &nil.threads[0];
systime_t next = 0; systime_t next = 0;
chDbgAssert(nil.nexttime == port_timer_get_alarm(), chDbgAssert(nil.nexttime == port_timer_get_alarm(), "time mismatch");
"chSysTimerHandlerI(), #1", "time mismatch");
do { do {
/* Is the thread in a wait state with timeout?.*/ /* Is the thread in a wait state with timeout?.*/
if (tr->timeout > 0) { if (tr->timeout > 0) {
chDbgAssert(!NIL_THD_IS_READY(tr), chDbgAssert(!NIL_THD_IS_READY(tr), "is ready");
"chSysTimerHandlerI(), #2", "is ready"); chDbgAssert(tr->timeout >= nil.nexttime - nil.lasttime, "skipped one");
chDbgAssert(tr->timeout >= nil.nexttime - nil.lasttime,
"chSysTimerHandlerI(), #3", "skipped one");
tr->timeout -= nil.nexttime - nil.lasttime; tr->timeout -= nil.nexttime - nil.lasttime;
if (tr->timeout == 0) { if (tr->timeout == 0) {
@ -185,7 +182,7 @@ void chSysTimerHandlerI(void) {
tr->u1.semp->cnt++; tr->u1.semp->cnt++;
else if (NIL_THD_IS_SUSP(tr)) else if (NIL_THD_IS_SUSP(tr))
tr->u1.trp = NULL; tr->u1.trp = NULL;
chSchReadyI(tr, NIL_MSG_TMO); chSchReadyI(tr, MSG_TIMEOUT);
} }
else { else {
if (tr->timeout <= next - 1) if (tr->timeout <= next - 1)
@ -328,7 +325,7 @@ msg_t chSchGoSleepTimeoutS(tstate_t newstate, systime_t timeout) {
#if NIL_CFG_TIMEDELTA > 0 #if NIL_CFG_TIMEDELTA > 0
if (timeout != TIME_INFINITE) { if (timeout != TIME_INFINITE) {
systime_t time = chTimeNowI() + timeout; systime_t time = chVTGetSystemTimeX() + timeout;
/* TIMEDELTA makes sure to have enough time to reprogram the timer /* TIMEDELTA makes sure to have enough time to reprogram the timer
before the free-running timer counter reaches the selected timeout.*/ before the free-running timer counter reaches the selected timeout.*/
@ -343,7 +340,7 @@ msg_t chSchGoSleepTimeoutS(tstate_t newstate, systime_t timeout) {
else { else {
/* Special case, there are already other threads with a timeout /* Special case, there are already other threads with a timeout
activated, evaluating the order.*/ activated, evaluating the order.*/
if (chTimeIsWithin(time, nil.lasttime, nil.nexttime)) { if (chVTIsTimeWithinX(time, nil.lasttime, nil.nexttime)) {
port_timer_set_alarm(time); port_timer_set_alarm(time);
nil.nexttime = time; nil.nexttime = time;
} }