summaryrefslogtreecommitdiffstats
path: root/nuttx/sched
diff options
context:
space:
mode:
authorpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2011-04-16 13:00:57 +0000
committerpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2011-04-16 13:00:57 +0000
commitcf98affaae10f065b6a7ff3558e5ce7e91bea645 (patch)
tree15b55003014272570f06703cf7e612d9321a87e6 /nuttx/sched
parent136df171f461d857eeda764b0f5d587a1c2ffb9f (diff)
More changes from Uros
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@3513 7fd9a85b-ad96-42d3-883c-3090e2eb8679
Diffstat (limited to 'nuttx/sched')
-rw-r--r--nuttx/sched/Makefile5
-rw-r--r--nuttx/sched/clock_initialize.c15
-rw-r--r--nuttx/sched/clock_systimer.c8
-rw-r--r--nuttx/sched/clock_uptime.c3
4 files changed, 11 insertions, 20 deletions
diff --git a/nuttx/sched/Makefile b/nuttx/sched/Makefile
index 20e3522d02..bc2852c545 100644
--- a/nuttx/sched/Makefile
+++ b/nuttx/sched/Makefile
@@ -78,14 +78,11 @@ endif
CLOCK_SRCS = clock_initialize.c clock_settime.c clock_gettime.c clock_getres.c \
clock_time2ticks.c clock_abstime2ticks.c clock_ticks2time.c \
- clock_gettimeofday.c
+ clock_gettimeofday.c clock_systimer.c
-ifeq ($(CONFIG_NUTTX_KERNEL),y)
-CLOCK_SRCS += clock_systimer.c
ifeq ($(CONFIG_UPTIME),y)
CLOCK_SRCS += clock_uptime.c
endif
-endif
SIGNAL_SRCS = sig_initialize.c \
sig_action.c sig_procmask.c sig_pending.c sig_suspend.c \
diff --git a/nuttx/sched/clock_initialize.c b/nuttx/sched/clock_initialize.c
index 0079e9f57a..2bb4d87a8e 100644
--- a/nuttx/sched/clock_initialize.c
+++ b/nuttx/sched/clock_initialize.c
@@ -46,6 +46,7 @@
#include <nuttx/clock.h>
#include <nuttx/time.h>
+#include <nuttx/rtc.h>
#include "clock_internal.h"
@@ -152,10 +153,7 @@ static inline void incr_uptime(void)
void clock_initialize(void)
{
- time_t jdn;
-#ifdef CONFIG_PTIMER
- bool rtc_enabled = false;
-#endif
+ time_t jdn = 0;
/* Initialize the real time close (this should be un-nesssary except on a
* restart).
@@ -169,18 +167,13 @@ void clock_initialize(void)
/* Do we have hardware periodic timer support? */
#ifdef CONFIG_RTC
- if (up_rtcinitialize() == OK)
- {
- rtc_enabled = true;
- }
-#endif
+ up_rtcinitialize();
/* Get the EPOCH-relative julian date from the calendar year,
* month, and date
*/
-#ifdef CONFIG_PTIMER
- if (!rtc_enabled)
+ if (g_rtc_enabled==false)
#endif
{
jdn = clock_calendar2utc(CONFIG_START_YEAR, CONFIG_START_MONTH,
diff --git a/nuttx/sched/clock_systimer.c b/nuttx/sched/clock_systimer.c
index fde303be63..c4560a8a18 100644
--- a/nuttx/sched/clock_systimer.c
+++ b/nuttx/sched/clock_systimer.c
@@ -42,7 +42,7 @@
#include <stdint.h>
#include <nuttx/clock.h>
-#include <nuttx/ptimer.h>
+#include <nuttx/rtc.h>
#include <nuttx/time.h>
#if !defined(clock_systimer) /* See nuttx/clock.h */
@@ -79,17 +79,17 @@ uint32_t clock_systimer(void)
{
/* Fetch the g_system_timer value from timer hardware, if available */
-#ifdef CONFIG_PTIMER
+#ifdef CONFIG_RTC
/* Check if the periodic timer is initialized
*
* Note that the unit of the g_system_timer and and up_rtc_getclock() must
- * be the same in order.
+ * be the same in order (must have same [unit]) to allow smooth transitions.
*/
if (g_rtc_enabled)
{
- up_rtc_getclock();
+// return up_rtc_getclock();
}
#endif
diff --git a/nuttx/sched/clock_uptime.c b/nuttx/sched/clock_uptime.c
index cea3262c89..203d056fd9 100644
--- a/nuttx/sched/clock_uptime.c
+++ b/nuttx/sched/clock_uptime.c
@@ -42,6 +42,7 @@
#include <stdint.h>
#include <nuttx/clock.h>
#include <nuttx/time.h>
+#include <nuttx/rtc.h>
#if !defined(CONFIG_DISABLE_CLOCK) && defined(CONFIG_UPTIME) && !defined(clock_uptime)
@@ -76,7 +77,7 @@
time_t clock_uptime(void)
{
-#ifdef CONFIG_PTIMER
+#ifdef CONFIG_RTC
if (g_rtc_enabled)
{
return up_rtc_gettime();