summaryrefslogtreecommitdiff
path: root/nuttx/sched
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-04-13 21:44:24 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-04-13 21:44:24 +0000
commit7cbeae30b426e0912d1814c76e6223fb0842a9fc (patch)
treea18e5e084078df356178ec94987ed828ec669f22 /nuttx/sched
parentea4461bfe4f667a624055c6a061aaef49e33cace (diff)
downloadpx4-nuttx-7cbeae30b426e0912d1814c76e6223fb0842a9fc.tar.gz
px4-nuttx-7cbeae30b426e0912d1814c76e6223fb0842a9fc.tar.bz2
px4-nuttx-7cbeae30b426e0912d1814c76e6223fb0842a9fc.zip
Macro clock_systimer replaces direct access to g_system_timer variable
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3500 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/sched')
-rw-r--r--nuttx/sched/Makefile2
-rw-r--r--nuttx/sched/clock_gettime.c4
-rw-r--r--nuttx/sched/clock_settime.c4
-rw-r--r--nuttx/sched/clock_systimer.c (renamed from nuttx/sched/clock_systime32.c)8
-rwxr-xr-xnuttx/sched/pg_worker.c6
-rwxr-xr-xnuttx/sched/work_queue.c12
-rwxr-xr-xnuttx/sched/work_thread.c2
7 files changed, 19 insertions, 19 deletions
diff --git a/nuttx/sched/Makefile b/nuttx/sched/Makefile
index 9cd8e5588..3c89a5c32 100644
--- a/nuttx/sched/Makefile
+++ b/nuttx/sched/Makefile
@@ -81,7 +81,7 @@ CLOCK_SRCS = clock_initialize.c clock_settime.c clock_gettime.c clock_getres.c \
clock_gettimeofday.c
ifeq ($(CONFIG_NUTTX_KERNEL),y)
-CLOCK_SRCS += clock_systime32.c
+CLOCK_SRCS += clock_systimer.c
endif
SIGNAL_SRCS = sig_initialize.c \
diff --git a/nuttx/sched/clock_gettime.c b/nuttx/sched/clock_gettime.c
index 6b8ac8c79..f3ffe2a6c 100644
--- a/nuttx/sched/clock_gettime.c
+++ b/nuttx/sched/clock_gettime.c
@@ -1,7 +1,7 @@
/************************************************************************
* sched/clock_gettime.c
*
- * Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -110,7 +110,7 @@ int clock_gettime(clockid_t clock_id, struct timespec *tp)
* as appropriate.
*/
- msecs = MSEC_PER_TICK * (g_system_timer - g_tickbias);
+ msecs = MSEC_PER_TICK * (clock_systimer() - g_tickbias);
sdbg("msecs = %d g_tickbias=%d\n",
(int)msecs, (int)g_tickbias);
diff --git a/nuttx/sched/clock_settime.c b/nuttx/sched/clock_settime.c
index da0d8f1ac..2af27acf1 100644
--- a/nuttx/sched/clock_settime.c
+++ b/nuttx/sched/clock_settime.c
@@ -1,7 +1,7 @@
/************************************************************************
* sched/clock_settime.c
*
- * Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -109,7 +109,7 @@ int clock_settime(clockid_t clock_id, const struct timespec *tp)
* as appropriate.
*/
- g_tickbias = g_system_timer;
+ g_tickbias = clock_systimer();
sdbg("basetime=(%d,%d) tickbias=%d\n",
(int)g_basetime.tv_sec, (int)g_basetime.tv_nsec,
diff --git a/nuttx/sched/clock_systime32.c b/nuttx/sched/clock_systimer.c
index f8709e551..921f9ebc5 100644
--- a/nuttx/sched/clock_systime32.c
+++ b/nuttx/sched/clock_systimer.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * sched/clock_systime32.c
+ * sched/clock_systimer.c
*
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
@@ -49,7 +49,7 @@
* Pre-processor Definitions
****************************************************************************/
-#undef os_systime32
+#undef clock_systimer
/****************************************************************************
* Private Data
@@ -60,7 +60,7 @@
****************************************************************************/
/****************************************************************************
- * Function: os_systime32
+ * Function: clock_systimer
*
* Description:
* Return the current value of the system timer counter
@@ -75,7 +75,7 @@
*
****************************************************************************/
-uint32_t os_systime32(void)
+uint32_t clock_systimer(void)
{
return g_system_timer;
}
diff --git a/nuttx/sched/pg_worker.c b/nuttx/sched/pg_worker.c
index 2ee0b3904..c9c175b5a 100755
--- a/nuttx/sched/pg_worker.c
+++ b/nuttx/sched/pg_worker.c
@@ -2,7 +2,7 @@
* sched/pg_worker.c
* Page fill worker thread implementation.
*
- * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2010-2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -407,7 +407,7 @@ static inline bool pg_startfill(void)
*/
#ifdef CONFIG_PAGING_TIMEOUT_TICKS
- g_starttime = g_system_timer;
+ g_starttime = clock_systimer();
#endif
/* Return and wait to be signaled for the next event -- the fill completion
@@ -613,7 +613,7 @@ int pg_worker(int argc, char *argv[])
else
{
lldbg("Timeout!\n");
- ASSERT(g_system_timer - g_starttime < CONFIG_PAGING_TIMEOUT_TICKS);
+ ASSERT(clock_systimer() - g_starttime < CONFIG_PAGING_TIMEOUT_TICKS);
}
#endif
}
diff --git a/nuttx/sched/work_queue.c b/nuttx/sched/work_queue.c
index dc371a136..4b0380643 100755
--- a/nuttx/sched/work_queue.c
+++ b/nuttx/sched/work_queue.c
@@ -1,7 +1,7 @@
/****************************************************************************
* sched/work_queue.c
*
- * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2009-2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -112,9 +112,9 @@ int work_queue(struct work_s *work, worker_t worker, FAR void *arg, uint32_t del
/* First, initialize the work structure */
- work->worker = worker; /* Work callback */
- work->arg = arg; /* Callback argument */
- work->delay = delay; /* Delay until work performed */
+ work->worker = worker; /* Work callback */
+ work->arg = arg; /* Callback argument */
+ work->delay = delay; /* Delay until work performed */
/* Now, time-tag that entry and put it in the work queue. This must be
* done with interrupts disabled. This permits this function to be called
@@ -122,9 +122,9 @@ int work_queue(struct work_s *work, worker_t worker, FAR void *arg, uint32_t del
*/
flags = irqsave();
- work->qtime = g_system_timer; /* Time work queued */
+ work->qtime = clock_systimer(); /* Time work queued */
dq_addlast((FAR dq_entry_t *)work, &g_work);
- work_signal(); /* Wake up the worker thread */
+ work_signal(); /* Wake up the worker thread */
irqrestore(flags);
return OK;
}
diff --git a/nuttx/sched/work_thread.c b/nuttx/sched/work_thread.c
index 49542b532..a0e0d78e9 100755
--- a/nuttx/sched/work_thread.c
+++ b/nuttx/sched/work_thread.c
@@ -152,7 +152,7 @@ int work_thread(int argc, char *argv[])
* zero. Therefore a delay of zero will always execute immediately.
*/
- elapsed = g_system_timer - work->qtime;
+ elapsed = clock_systimer() - work->qtime;
if (elapsed >= work->delay)
{
/* Remove the ready-to-execute work from the list */