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
This commit is contained in:
patacongo 2011-04-13 21:44:24 +00:00
parent 9e93215ef4
commit 10538a3f2e
19 changed files with 46 additions and 46 deletions

View File

@ -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,
};

View File

@ -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. */

View File

@ -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 */

View File

@ -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;

View File

@ -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

View File

@ -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)
{

View File

@ -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 */

View File

@ -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 */

View File

@ -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 */

View File

@ -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 \

View File

@ -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);

View File

@ -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,

View File

@ -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;
}

View File

@ -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
}

View File

@ -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;
}

View File

@ -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 */

View File

@ -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);

View File

@ -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 */

View File

@ -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"

Can't render this file because it has a wrong number of fields in line 2.