From e5e278c89f2edd0750749dfca551fc531cf317f2 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 4 Sep 2013 12:41:44 +0000 Subject: [PATCH] git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6261 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/nil/NIL-STM32F051-DISCOVERY/nilconf.h | 4 ++-- os/nil/src/nil.c | 15 ++++++--------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/demos/nil/NIL-STM32F051-DISCOVERY/nilconf.h b/demos/nil/NIL-STM32F051-DISCOVERY/nilconf.h index c8a0b34c5..2805beb50 100644 --- a/demos/nil/NIL-STM32F051-DISCOVERY/nilconf.h +++ b/demos/nil/NIL-STM32F051-DISCOVERY/nilconf.h @@ -41,7 +41,7 @@ /** * @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. @@ -51,7 +51,7 @@ * The value one is not valid, timeouts are rounded up to * this value. */ -#define NIL_CFG_TIMEDELTA 0 +#define NIL_CFG_TIMEDELTA 2 /** * @brief Events Flags APIs. diff --git a/os/nil/src/nil.c b/os/nil/src/nil.c index 809887de3..20b454fa8 100644 --- a/os/nil/src/nil.c +++ b/os/nil/src/nil.c @@ -165,17 +165,14 @@ void chSysTimerHandlerI(void) { thread_reference_t tr = &nil.threads[0]; systime_t next = 0; - chDbgAssert(nil.nexttime == port_timer_get_alarm(), - "chSysTimerHandlerI(), #1", "time mismatch"); + chDbgAssert(nil.nexttime == port_timer_get_alarm(), "time mismatch"); do { /* Is the thread in a wait state with timeout?.*/ if (tr->timeout > 0) { - chDbgAssert(!NIL_THD_IS_READY(tr), - "chSysTimerHandlerI(), #2", "is ready"); - chDbgAssert(tr->timeout >= nil.nexttime - nil.lasttime, - "chSysTimerHandlerI(), #3", "skipped one"); + chDbgAssert(!NIL_THD_IS_READY(tr), "is ready"); + chDbgAssert(tr->timeout >= nil.nexttime - nil.lasttime, "skipped one"); tr->timeout -= nil.nexttime - nil.lasttime; if (tr->timeout == 0) { @@ -185,7 +182,7 @@ void chSysTimerHandlerI(void) { tr->u1.semp->cnt++; else if (NIL_THD_IS_SUSP(tr)) tr->u1.trp = NULL; - chSchReadyI(tr, NIL_MSG_TMO); + chSchReadyI(tr, MSG_TIMEOUT); } else { if (tr->timeout <= next - 1) @@ -328,7 +325,7 @@ msg_t chSchGoSleepTimeoutS(tstate_t newstate, systime_t timeout) { #if NIL_CFG_TIMEDELTA > 0 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 before the free-running timer counter reaches the selected timeout.*/ @@ -343,7 +340,7 @@ msg_t chSchGoSleepTimeoutS(tstate_t newstate, systime_t timeout) { else { /* Special case, there are already other threads with a timeout activated, evaluating the order.*/ - if (chTimeIsWithin(time, nil.lasttime, nil.nexttime)) { + if (chVTIsTimeWithinX(time, nil.lasttime, nil.nexttime)) { port_timer_set_alarm(time); nil.nexttime = time; }