summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2011-04-13 21:44:24 +0000
committerpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2011-04-13 21:44:24 +0000
commit71aa9dc77d2cfab9a04f377a87dec7ae1b053c61 (patch)
treea18e5e084078df356178ec94987ed828ec669f22
parentf88b9c4992c5c60b505288013580004b36afb474 (diff)
Macro clock_systimer replaces direct access to g_system_timer variable
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@3500 7fd9a85b-ad96-42d3-883c-3090e2eb8679
-rwxr-xr-xnuttx/arch/arm/src/lpc17xx/lpc17_serial.c6
-rw-r--r--nuttx/drivers/mmcsd/mmcsd_sdio.c8
-rw-r--r--nuttx/drivers/mmcsd/mmcsd_spi.c6
-rwxr-xr-xnuttx/drivers/net/enc28j60.c6
-rw-r--r--nuttx/include/nuttx/clock.h6
-rw-r--r--nuttx/net/net_timeo.c4
-rw-r--r--nuttx/net/recvfrom.c4
-rw-r--r--nuttx/net/send.c4
-rw-r--r--nuttx/net/uip/uip_icmpping.c4
-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
-rw-r--r--nuttx/syscall/stub_lookup.c2
-rw-r--r--nuttx/syscall/stub_lookup.h2
-rw-r--r--nuttx/syscall/syscall.csv2
19 files changed, 46 insertions, 46 deletions
diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_serial.c b/nuttx/arch/arm/src/lpc17xx/lpc17_serial.c
index 146e985ebc..46413459a7 100755
--- a/nuttx/arch/arm/src/lpc17xx/lpc17_serial.c
+++ b/nuttx/arch/arm/src/lpc17xx/lpc17_serial.c
@@ -203,7 +203,7 @@ static uart_dev_t g_uart1port =
{
.size = CONFIG_UART1_TXBUFSIZE,
.buffer = g_uart1txbuffer,
- },
+ },
.ops = &g_uart_ops,
.priv = &g_uart1priv,
};
@@ -233,7 +233,7 @@ static uart_dev_t g_uart2port =
{
.size = CONFIG_UART2_TXBUFSIZE,
.buffer = g_uart2txbuffer,
- },
+ },
.ops = &g_uart_ops,
.priv = &g_uart2priv,
};
@@ -263,7 +263,7 @@ static uart_dev_t g_uart3port =
{
.size = CONFIG_UART3_TXBUFSIZE,
.buffer = g_uart3txbuffer,
- },
+ },
.ops = &g_uart_ops,
.priv = &g_uart3priv,
};
diff --git a/nuttx/drivers/mmcsd/mmcsd_sdio.c b/nuttx/drivers/mmcsd/mmcsd_sdio.c
index 28bbe08a3a..a37008614a 100644
--- a/nuttx/drivers/mmcsd/mmcsd_sdio.c
+++ b/nuttx/drivers/mmcsd/mmcsd_sdio.c
@@ -1095,7 +1095,7 @@ static int mmcsd_transferready(FAR struct mmcsd_state_s *priv)
* the TRANSFER state when the card completes the WRITE operation.
*/
- starttime = g_system_timer;
+ starttime = clock_systimer();
do
{
/* Get the current R1 status from the card */
@@ -1138,7 +1138,7 @@ static int mmcsd_transferready(FAR struct mmcsd_state_s *priv)
* time... we can't stay in this loop forever!
*/
- elapsed = g_system_timer - starttime;
+ elapsed = clock_systimer() - starttime;
}
while (elapsed < TICK_PER_SEC);
return -ETIMEDOUT;
@@ -2476,7 +2476,7 @@ static int mmcsd_cardidentify(FAR struct mmcsd_state_s *priv)
* but not MMC
*/
- start = g_system_timer;
+ start = clock_systimer();
elapsed = 0;
do
{
@@ -2620,7 +2620,7 @@ static int mmcsd_cardidentify(FAR struct mmcsd_state_s *priv)
#endif
/* Check the elapsed time. We won't keep trying this forever! */
- elapsed = g_system_timer - start;
+ elapsed = clock_systimer() - start;
}
while( elapsed < TICK_PER_SEC ); /* On successful reception while 'breaks', see above. */
diff --git a/nuttx/drivers/mmcsd/mmcsd_spi.c b/nuttx/drivers/mmcsd/mmcsd_spi.c
index 93fd5dcab6..b5f5829a24 100644
--- a/nuttx/drivers/mmcsd/mmcsd_spi.c
+++ b/nuttx/drivers/mmcsd/mmcsd_spi.c
@@ -1,7 +1,7 @@
/****************************************************************************
* drivers/mmcsd/mmcsd_spi.c
*
- * Copyright (C) 2008-2010 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2008-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
@@ -122,8 +122,8 @@
#define MMCSD_DELAY_1SEC (CLK_TCK + 1)
#define MMCSD_DELAY_10SEC (10 * CLK_TCK + 1)
-#define ELAPSED_TIME(t) (g_system_timer-(t))
-#define START_TIME (g_system_timer)
+#define ELAPSED_TIME(t) (clock_systimer()-(t))
+#define START_TIME (clock_systimer())
/* SD read timeout: ~100msec, Write Time out ~250ms. Units of clock ticks */
diff --git a/nuttx/drivers/net/enc28j60.c b/nuttx/drivers/net/enc28j60.c
index 868e860dcd..448decbf89 100755
--- a/nuttx/drivers/net/enc28j60.c
+++ b/nuttx/drivers/net/enc28j60.c
@@ -1,7 +1,7 @@
/****************************************************************************
* drivers/net/enc28j60.c
*
- * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2010-2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* References:
@@ -658,7 +658,7 @@ static void enc_wrbreg(FAR struct enc_driver_s *priv, uint8_t ctrlreg,
static int enc_waitbreg(FAR struct enc_driver_s *priv, uint8_t ctrlreg,
uint8_t bits, uint8_t value)
{
- uint32_t start = g_system_timer;
+ uint32_t start = clock_systimer();
uint32_t elapsed;
uint8_t rddata;
@@ -669,7 +669,7 @@ static int enc_waitbreg(FAR struct enc_driver_s *priv, uint8_t ctrlreg,
/* Read the byte from the requested banked register */
rddata = enc_rdbreg(priv, ctrlreg);
- elapsed = g_system_timer - start;
+ elapsed = clock_systimer() - start;
}
while ((rddata & bits) != value || elapsed > ENC_POLLTIMEOUT);
return (rddata & bits) == value ? -ETIMEDOUT : OK;
diff --git a/nuttx/include/nuttx/clock.h b/nuttx/include/nuttx/clock.h
index 3cd3e36f84..9a9523a2ef 100644
--- a/nuttx/include/nuttx/clock.h
+++ b/nuttx/include/nuttx/clock.h
@@ -113,7 +113,7 @@
#if !defined(CONFIG_DISABLE_CLOCK) && \
(!defined(CONFIG_NUTTX_KERNEL) || defined(__KERNEL__))
extern volatile uint32_t g_system_timer;
-#define os_systime32() g_system_timer
+#define clock_systimer() g_system_timer
#endif
/****************************************************************************
@@ -132,12 +132,12 @@ extern "C" {
#endif
/* If direct access to the system timer/counter is not supported (see above),
- * then the value can be obtained via os_systime32 through a system call.
+ * then the value can be obtained via clock_systimer through a system call.
*/
#if !defined(CONFIG_DISABLE_CLOCK) && \
defined(CONFIG_NUTTX_KERNEL) && !defined(__KERNEL__)
-EXTERN uint32_t os_systime32(void);
+EXTERN uint32_t clock_systimer(void);
#endif
#undef EXTERN
diff --git a/nuttx/net/net_timeo.c b/nuttx/net/net_timeo.c
index 191136fca8..42d1aff0a3 100644
--- a/nuttx/net/net_timeo.c
+++ b/nuttx/net/net_timeo.c
@@ -1,7 +1,7 @@
/****************************************************************************
* net/net_timeo.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
@@ -72,7 +72,7 @@
int net_timeo(uint32_t start_time, socktimeo_t timeo)
{
uint32_t timeo_ticks = DSEC2TICK(timeo);
- uint32_t elapsed = g_system_timer - start_time;
+ uint32_t elapsed = clock_systimer() - start_time;
if (elapsed >= timeo_ticks)
{
diff --git a/nuttx/net/recvfrom.c b/nuttx/net/recvfrom.c
index c35937cce3..335e2b3221 100644
--- a/nuttx/net/recvfrom.c
+++ b/nuttx/net/recvfrom.c
@@ -415,7 +415,7 @@ static uint16_t recvfrom_tcpinterrupt(struct uip_driver_s *dev, void *conn,
*/
#if defined(CONFIG_NET_SOCKOPTS) && !defined(CONFIG_DISABLE_CLOCK)
- pstate->rf_starttime = g_system_timer;
+ pstate->rf_starttime = clock_systimer();
#endif
}
@@ -679,7 +679,7 @@ static void recvfrom_init(FAR struct socket *psock, FAR void *buf, size_t len,
pstate->rf_sock = psock;
#if defined(CONFIG_NET_SOCKOPTS) && !defined(CONFIG_DISABLE_CLOCK)
- pstate->rf_starttime = g_system_timer;
+ pstate->rf_starttime = clock_systimer();
#endif
}
#endif /* CONFIG_NET_UDP || CONFIG_NET_TCP */
diff --git a/nuttx/net/send.c b/nuttx/net/send.c
index 1b4407db1c..ffa6899963 100644
--- a/nuttx/net/send.c
+++ b/nuttx/net/send.c
@@ -290,7 +290,7 @@ static uint16_t send_interrupt(struct uip_driver_s *dev, void *pvconn,
/* Update the send time */
#if defined(CONFIG_NET_SOCKOPTS) && !defined(CONFIG_DISABLE_CLOCK)
- pstate->snd_time = g_system_timer;
+ pstate->snd_time = clock_systimer();
#endif
}
}
@@ -463,7 +463,7 @@ ssize_t send(int sockfd, const void *buf, size_t len, int flags)
/* Update the initial time for calculating timeouts */
#if defined(CONFIG_NET_SOCKOPTS) && !defined(CONFIG_DISABLE_CLOCK)
- state.snd_time = g_system_timer;
+ state.snd_time = clock_systimer();
#endif
/* Set up the callback in the connection */
diff --git a/nuttx/net/uip/uip_icmpping.c b/nuttx/net/uip/uip_icmpping.c
index 0799d1412b..2832a4a83c 100644
--- a/nuttx/net/uip/uip_icmpping.c
+++ b/nuttx/net/uip/uip_icmpping.c
@@ -118,7 +118,7 @@ struct icmp_ping_s
static inline int ping_timeout(struct icmp_ping_s *pstate)
{
- uint32_t elapsed = g_system_timer - pstate->png_time;
+ uint32_t elapsed = clock_systimer() - pstate->png_time;
if (elapsed >= pstate->png_ticks)
{
return TRUE;
@@ -329,7 +329,7 @@ int uip_ping(uip_ipaddr_t addr, uint16_t id, uint16_t seqno,
state.png_sent = false; /* ECHO request not yet sent */
save = uip_lock();
- state.png_time = g_system_timer;
+ state.png_time = clock_systimer();
/* Set up the callback */
diff --git a/nuttx/sched/Makefile b/nuttx/sched/Makefile
index 9cd8e55882..3c89a5c329 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 6b8ac8c795..f3ffe2a6c0 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 da0d8f1aca..2af27acf1c 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 f8709e5511..921f9ebc53 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 2ee0b39041..c9c175b5a7 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 dc371a136b..4b0380643d 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 49542b5324..a0e0d78e98 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 */
diff --git a/nuttx/syscall/stub_lookup.c b/nuttx/syscall/stub_lookup.c
index e46127b143..0c4f4451c9 100644
--- a/nuttx/syscall/stub_lookup.c
+++ b/nuttx/syscall/stub_lookup.c
@@ -107,7 +107,7 @@ extern uintptr_t STUB_usleep(uintptr_t parm1);
* NuttX configuration.
*/
-extern uintptr_t STUB_os_systime32(void);
+extern uintptr_t STUB_clock_systimer(void);
extern uintptr_t STUB_clock_getres(uintptr_t parm1, uintptr_t parm2);
extern uintptr_t STUB_clock_gettime(uintptr_t parm1, uintptr_t parm2);
extern uintptr_t STUB_clock_settime(uintptr_t parm1, uintptr_t parm2);
diff --git a/nuttx/syscall/stub_lookup.h b/nuttx/syscall/stub_lookup.h
index 9a56d0d410..f9b33938b8 100644
--- a/nuttx/syscall/stub_lookup.h
+++ b/nuttx/syscall/stub_lookup.h
@@ -102,7 +102,7 @@ STUB_LOOKUP(3, STUB_up_assert_code) /* SYS_up_assert_code */
*/
#ifndef CONFIG_DISABLE_CLOCK
- STUB_LOOKUP(0, STUB_os_systime32) /* SYS_os_systime32 */
+ STUB_LOOKUP(0, STUB_clock_systimer) /* SYS_clock_systimer */
STUB_LOOKUP(2, STUB_clock_getres) /* SYS_clock_getres */
STUB_LOOKUP(2, STUB_clock_gettime) /* SYS_clock_gettime */
STUB_LOOKUP(2, STUB_clock_settime) /* SYS_clock_settime */
diff --git a/nuttx/syscall/syscall.csv b/nuttx/syscall/syscall.csv
index a6db073976..2499cd4ab3 100644
--- a/nuttx/syscall/syscall.csv
+++ b/nuttx/syscall/syscall.csv
@@ -39,7 +39,7 @@
"open","fcntl.h","CONFIG_NFILE_DESCRIPTORS > 0","int","const char*","int","..."
"opendir","dirent.h","CONFIG_NFILE_DESCRIPTORS > 0","FAR DIR*","FAR const char*"
"pipe","unistd.h","CONFIG_NFILE_DESCRIPTORS > 0","int","int [2]|int*"
-"os_systime32","nuttx/clock.h","!defined(CONFIG_DISABLE_CLOCK)","uint32_t"
+"clock_systimer","nuttx/clock.h","!defined(CONFIG_DISABLE_CLOCK)","uint32_t"
"poll","poll.h","!defined(CONFIG_DISABLE_POLL) && (CONFIG_NSOCKET_DESCRIPTORS > 0 || CONFIG_NFILE_DESCRIPTORS > 0)","int","FAR struct pollfd*","nfds_t","int"
"pthread_barrier_destroy","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_barrier_t*"
"pthread_barrier_init","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_barrier_t*","FAR const pthread_barrierattr_t*","unsigned int"