From a7a5c8cff3ae0975597849c5befa73f602fae9c3 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 23 Oct 2014 06:41:31 -0600 Subject: [PATCH] Fixes to tickless operation code. From Brandon Warhurst --- include/nuttx/arch.h | 2 +- sched/sched/sched_timerexpiration.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/nuttx/arch.h b/include/nuttx/arch.h index 7a8b9d0004..f2b2b8d5ea 100644 --- a/include/nuttx/arch.h +++ b/include/nuttx/arch.h @@ -1676,7 +1676,7 @@ void sched_timer_expiration(void); ****************************************************************************/ #if defined(CONFIG_SCHED_TICKLESS) && defined(CONFIG_SCHED_TICKLESS_ALARM) -void sched_alarm_expiration(FAR const struct *ts); +void sched_alarm_expiration(FAR const struct timespec *ts); #endif /************************************************************************ diff --git a/sched/sched/sched_timerexpiration.c b/sched/sched/sched_timerexpiration.c index b7702804de..e844579514 100644 --- a/sched/sched/sched_timerexpiration.c +++ b/sched/sched/sched_timerexpiration.c @@ -131,14 +131,14 @@ static struct timespec g_stop_time; #ifdef CONFIG_SCHED_TICKLESS_ALARM static void sched_timespec_add(FAR const struct timespec *ts1, FAR const struct timespec *ts2, - FAR struct timespec ts3) + FAR struct timespec *ts3) { time_t sec = ts1->tv_sec + ts2->tv_sec; long nsec = ts1->tv_nsec + ts2->tv_nsec; if (nsec >= NSEC_PER_SEC) { - nsec -= NSEC_PER_SEC + nsec -= NSEC_PER_SEC; sec++; } @@ -166,7 +166,7 @@ static void sched_timespec_add(FAR const struct timespec *ts1, #ifdef CONFIG_SCHED_TICKLESS_ALARM static void sched_timespec_subtract(FAR const struct timespec *ts1, FAR const struct timespec *ts2, - FAR struct timespec ts3) + FAR struct timespec *ts3) { time_t sec; long nsec; @@ -196,7 +196,7 @@ static void sched_timespec_subtract(FAR const struct timespec *ts1, } ts3->tv_sec = sec; - ts3->tv_nsec = sec; + ts3->tv_nsec = nsec; } #endif @@ -497,7 +497,7 @@ static void sched_timer_start(unsigned int ticks) ****************************************************************************/ #ifdef CONFIG_SCHED_TICKLESS_ALARM -void sched_alarm_expiration(FAR const struct *ts); +void sched_alarm_expiration(FAR const struct timespec *ts) { unsigned int elapsed; unsigned int nexttime;