Rename clock_systime[r|spec] to clock_systime_[ticks|timespec]

follow up the new naming convention:
https://cwiki.apache.org/confluence/display/NUTTX/Naming+of+OS+Internal+Functions
This commit is contained in:
Xiang Xiao 2020-05-04 22:15:10 +08:00 committed by patacongo
parent 153eee6de2
commit 517974787f
83 changed files with 393 additions and 349 deletions

View File

@ -2597,7 +2597,7 @@ config ARCH_SIM
<p>
<b><code>CONFIG_USEC_PER_TICK</code></b>:
This option is not unique to <i>Tickless OS</i> operation, but changes its relevance when the <i>Tickless OS</i> is selected.
In the default configuration where system time is provided by a periodic timer interrupt, the default system timer is configure the timer for 100Hz or <code>CONFIG_USEC_PER_TICK=10000</code>. If <code>CONFIG_SCHED_TICKLESS</code> is selected, then there are no system timer interrupt. In this case, <code>CONFIG_USEC_PER_TICK</code> does not control any timer rates. Rather, it only determines the resolution of time reported by <code>clock_systimer()</code> and the resolution of times that can be set for certain delays including watchdog timers and delayed work.
In the default configuration where system time is provided by a periodic timer interrupt, the default system timer is configure the timer for 100Hz or <code>CONFIG_USEC_PER_TICK=10000</code>. If <code>CONFIG_SCHED_TICKLESS</code> is selected, then there are no system timer interrupt. In this case, <code>CONFIG_USEC_PER_TICK</code> does not control any timer rates. Rather, it only determines the resolution of time reported by <code>clock_systime_ticks()</code> and the resolution of times that can be set for certain delays including watchdog timers and delayed work.
</p>
<p>
In this case there is still a trade-off: It is better to have the <code>CONFIG_USEC_PER_TICK</code> as low as possible for higher timing resolution. However, the time is currently held in <code>unsigned int</code>. On some systems, this may be 16-bits in width but on most contemporary systems it will be 32-bits. In either case, smaller values of <code>CONFIG_USEC_PER_TICK</code> will reduce the range of values that delays that can be represented. So the trade-off is between range and resolution (you could also modify the code to use a 64-bit value if you really want both).

View File

@ -644,13 +644,13 @@ static inline int am335x_i2c_sem_waitdone(FAR struct am335x_i2c_priv_s *priv)
#endif
priv->intstate = INTSTATE_WAITING;
start = clock_systimer();
start = clock_systime_ticks();
do
{
/* Calculate the elapsed time */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
/* Poll by simply calling the timer interrupt handler until it
* reports that it is done.
@ -704,12 +704,12 @@ static inline bool
* detected, set by hardware when a timeout error is detected."
*/
start = clock_systimer();
start = clock_systime_ticks();
do
{
/* Calculate the elapsed time */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
/* Check for Bus Free condition */
@ -808,7 +808,7 @@ static void am335x_i2c_tracereset(FAR struct am335x_i2c_priv_s *priv)
/* Reset the trace info for a new data collection */
priv->tndx = 0;
priv->start_time = clock_systimer();
priv->start_time = clock_systime_ticks();
am335x_i2c_traceclear(priv);
}
@ -842,7 +842,7 @@ static void am335x_i2c_tracenew(FAR struct am335x_i2c_priv_s *priv,
am335x_i2c_traceclear(priv);
trace->status = status;
trace->count = 1;
trace->time = clock_systimer();
trace->time = clock_systime_ticks();
}
else
{
@ -885,7 +885,7 @@ static void am335x_i2c_tracedump(FAR struct am335x_i2c_priv_s *priv)
int i;
syslog(LOG_DEBUG, "Elapsed time: %ld\n",
(long)(clock_systimer() - priv->start_time));
(long)(clock_systime_ticks() - priv->start_time));
for (i = 0; i < priv->tndx; i++)
{

View File

@ -329,7 +329,7 @@ static void cxd56_rtc_initialize(int argc, uint32_t arg, ...)
{
/* Keep the system operating time before RTC is enabled. */
clock_systimespec(&ts);
clock_systime_timespec(&ts);
}
/* Synchronize the system time to the RTC time */

View File

@ -637,7 +637,7 @@ static inline int efm32_i2c_sem_waitdone(FAR struct efm32_i2c_priv_s *priv)
* nxsem_timedwait() sleeps.
*/
start = clock_systimer();
start = clock_systime_ticks();
do
{
@ -649,7 +649,7 @@ static inline int efm32_i2c_sem_waitdone(FAR struct efm32_i2c_priv_s *priv)
/* Calculate the elapsed time */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
}
/* Loop until the transfer is complete. */
@ -747,7 +747,7 @@ static void efm32_i2c_tracereset(FAR struct efm32_i2c_priv_s *priv)
/* Reset the trace info for a new data collection */
priv->tndx = 0;
priv->start_time = clock_systimer();
priv->start_time = clock_systime_ticks();
efm32_i2c_traceclear(priv);
}
@ -787,7 +787,7 @@ static void efm32_i2c_tracenew(FAR struct efm32_i2c_priv_s *priv)
trace->i2c_reg_if = priv->i2c_reg_if;
trace->count = 1;
trace->dcnt = priv->dcnt;
trace->time = clock_systimer();
trace->time = clock_systime_ticks();
}
else
{
@ -803,7 +803,7 @@ static void efm32_i2c_tracedump(FAR struct efm32_i2c_priv_s *priv)
int i;
syslog(LOG_DEBUG, "Elapsed time: %ld\n",
(long)(clock_systimer() - priv->start_time));
(long)(clock_systime_ticks() - priv->start_time));
for (i = 0; i < priv->tndx; i++)
{

View File

@ -1725,7 +1725,7 @@ static int efm32_ctrl_sendsetup(FAR struct efm32_usbhost_s *priv,
/* Loop while the device reports NAK (and a timeout is not exceeded */
chan = &priv->chan[ep0->outndx];
start = clock_systimer();
start = clock_systime_ticks();
do
{
@ -1774,7 +1774,7 @@ static int efm32_ctrl_sendsetup(FAR struct efm32_usbhost_s *priv,
/* Get the elapsed time (in frames) */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
}
while (elapsed < EFM32_SETUP_DELAY);
@ -1963,7 +1963,7 @@ static ssize_t efm32_in_transfer(FAR struct efm32_usbhost_s *priv, int chidx,
chan->buflen = buflen;
chan->xfrd = 0;
start = clock_systimer();
start = clock_systime_ticks();
while (chan->xfrd < chan->buflen)
{
/* Set up for the wait BEFORE starting the transfer */
@ -2004,7 +2004,7 @@ static ssize_t efm32_in_transfer(FAR struct efm32_usbhost_s *priv, int chidx,
* pointer and buffer size will be unaltered.
*/
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
if (ret != -EAGAIN || /* Not a NAK condition OR */
elapsed >= EFM32_DATANAK_DELAY || /* Timeout has elapsed OR */
chan->xfrd > 0) /* Data has been partially transferred */
@ -2224,7 +2224,7 @@ static ssize_t efm32_out_transfer(FAR struct efm32_usbhost_s *priv,
*/
chan = &priv->chan[chidx];
start = clock_systimer();
start = clock_systime_ticks();
xfrd = 0;
zlp = (buflen == 0);
@ -2275,7 +2275,7 @@ static ssize_t efm32_out_transfer(FAR struct efm32_usbhost_s *priv,
* pointer and buffer size will be unaltered.
*/
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
if (ret != -EAGAIN || /* Not a NAK condition OR */
elapsed >= EFM32_DATANAK_DELAY || /* Timeout has elapsed OR */
chan->xfrd > 0) /* Data has been partially transferred */
@ -4524,7 +4524,7 @@ static int efm32_ctrlin(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0,
/* Get the start time. Loop again until the timeout expires */
start = clock_systimer();
start = clock_systime_ticks();
do
{
/* Handle the status OUT phase */
@ -4543,7 +4543,7 @@ static int efm32_ctrlin(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0,
/* Get the elapsed time (in frames) */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
}
while (elapsed < EFM32_DATANAK_DELAY);
}
@ -4599,7 +4599,7 @@ static int efm32_ctrlout(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0,
/* Get the start time. Loop again until the timeout expires */
start = clock_systimer();
start = clock_systime_ticks();
do
{
/* Handle the data OUT phase (if any) */
@ -4635,7 +4635,7 @@ static int efm32_ctrlout(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0,
/* Get the elapsed time (in frames) */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
}
while (elapsed < EFM32_DATANAK_DELAY);
}

View File

@ -727,13 +727,13 @@ static inline int
*/
priv->intstate = INTSTATE_WAITING;
start = clock_systimer();
start = clock_systime_ticks();
do
{
/* Calculate the elapsed time */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
/* Poll by simply calling the timer interrupt handler until it
* reports that it is done.
@ -787,12 +787,12 @@ static inline void
* detected, set by hardware when a timeout error is detected."
*/
start = clock_systimer();
start = clock_systime_ticks();
do
{
/* Calculate the elapsed time */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
/* Check for STOP condition */
@ -923,7 +923,7 @@ static void imxrt_lpi2c_tracereset(FAR struct imxrt_lpi2c_priv_s *priv)
/* Reset the trace info for a new data collection */
priv->tndx = 0;
priv->start_time = clock_systimer();
priv->start_time = clock_systime_ticks();
imxrt_lpi2c_traceclear(priv);
}
@ -957,7 +957,7 @@ static void imxrt_lpi2c_tracenew(FAR struct imxrt_lpi2c_priv_s *priv,
imxrt_lpi2c_traceclear(priv);
trace->status = status;
trace->count = 1;
trace->time = clock_systimer();
trace->time = clock_systime_ticks();
}
else
{
@ -1000,7 +1000,7 @@ static void imxrt_lpi2c_tracedump(FAR struct imxrt_lpi2c_priv_s *priv)
int i;
syslog(LOG_DEBUG, "Elapsed time: %ld\n",
(long)(clock_systimer() - priv->start_time));
(long)(clock_systime_ticks() - priv->start_time));
for (i = 0; i < priv->tndx; i++)
{

View File

@ -186,13 +186,13 @@ static int imxrt_ocotp_wait_for_completion(uint32_t timeout_ms)
timeout = MSEC2TICK(timeout_ms);
start = clock_systimer();
start = clock_systime_ticks();
while (getreg32(IMXRT_OCOTP_CTRL) & OCOTP_CTRL_BUSY)
{
/* If a timeout is specified check for timeout */
if (timeout_ms && clock_systimer() - start >= timeout)
if (timeout_ms && clock_systime_ticks() - start >= timeout)
{
return -ETIME;
}

View File

@ -2081,13 +2081,13 @@ static int imxrt_sendcmd(FAR struct sdio_dev_s *dev, uint32_t cmd,
*/
timeout = USDHC_CMDTIMEOUT;
start = clock_systimer();
start = clock_systime_ticks();
while ((getreg32(priv->addr + IMXRT_USDHC_PRSSTAT_OFFSET) &
USDHC_PRSSTAT_CIHB) != 0)
{
/* Calculate the elapsed time */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
if (elapsed >= timeout)
{
mcerr("ERROR: Timeout (waiting CIHB) cmd: %08x PRSSTAT: %08x\n",
@ -2362,13 +2362,13 @@ static int imxrt_waitresponse(FAR struct sdio_dev_s *dev, uint32_t cmd)
* (except Auto CMD12).
*/
start = clock_systimer();
start = clock_systime_ticks();
while ((getreg32(priv->addr + IMXRT_USDHC_IRQSTAT_OFFSET) &
USDHC_INT_CC) == 0)
{
/* Calculate the elapsed time */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
if (elapsed >= timeout)
{
mcerr("ERROR: Timeout cmd: %08x IRQSTAT: %08x\n", cmd,

View File

@ -830,11 +830,11 @@ static int kinetis_i2c_start(struct kinetis_i2cdev_s *priv)
{
/* We are not currently the bus master, wait for bus ready or timeout */
start = clock_systimer();
start = clock_systime_ticks();
while (kinetis_i2c_getreg(priv, KINETIS_I2C_S_OFFSET) & I2C_S_BUSY)
{
if (clock_systimer() - start > I2C_TIMEOUT)
if (clock_systime_ticks() - start > I2C_TIMEOUT)
{
priv->state = STATE_TIMEOUT;
return -EIO;
@ -854,12 +854,12 @@ static int kinetis_i2c_start(struct kinetis_i2cdev_s *priv)
* a timeout occurs
*/
start = clock_systimer();
start = clock_systime_ticks();
while ((kinetis_i2c_getreg(priv, KINETIS_I2C_S_OFFSET) & I2C_S_BUSY)
== 0)
{
if (clock_systimer() - start > I2C_TIMEOUT)
if (clock_systime_ticks() - start > I2C_TIMEOUT)
{
priv->state = STATE_TIMEOUT;
return -EIO;

View File

@ -1866,13 +1866,13 @@ static int kinetis_sendcmd(FAR struct sdio_dev_s *dev, uint32_t cmd,
*/
timeout = SDHC_CMDTIMEOUT;
start = clock_systimer();
start = clock_systime_ticks();
while ((getreg32(KINETIS_SDHC_PRSSTAT) & SDHC_PRSSTAT_CIHB) != 0)
{
/* Calculate the elapsed time */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
if (elapsed >= timeout)
{
mcerr("ERROR: Timeout cmd: %08x PRSSTAT: %08x\n",
@ -2149,13 +2149,13 @@ static int kinetis_waitresponse(FAR struct sdio_dev_s *dev, uint32_t cmd)
* (except Auto CMD12).
*/
start = clock_systimer();
start = clock_systime_ticks();
while ((getreg32(KINETIS_SDHC_IRQSTAT) & SDHC_INT_CC) == 0)
{
/* Calculate the elapsed time */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
if (elapsed >= timeout)
{
mcerr("ERROR: Timeout cmd: %08x IRQSTAT: %08x\n",

View File

@ -372,7 +372,7 @@ static inline int
* sem_timedwait() sleeps.
*/
start = clock_systimer();
start = clock_systime_ticks();
do
{
@ -384,7 +384,7 @@ static inline int
/* Calculate the elapsed time */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
}
while (priv->irqstate != IRQSTATE_DONE && elapsed < timeout);

View File

@ -148,15 +148,15 @@ SINT_T sddep0_hw_init(struct SdDrCfg_s *cfg)
{
irqstate_t flags = enter_critical_section();
/* set COREVLT to 1 (i.e. 1.2v) */
/* set MMCVLT0 to 1.8v */
/* set EMMC */
/* set COREVLT to 1 (i.e. 1.2v)
* set MMCVLT0 to 1.8v
* set EMMC
*/
modifyreg32(SDCTL,
0,
SDCTL_COREVLT | SDCTL_MMCVLT0_18V | SDCTL_SDMMC0_MMC);
/* pull-up SDCMD0/SDAT00-03 */
modifyreg32(PUDCNT6, 0, (1UL << 2) | (1UL << 4));
@ -185,8 +185,9 @@ SINT_T sddep1_hw_init(struct SdDrCfg_s *cfg)
irqstate_t flags = enter_critical_section();
/* pull up SDCMD1/SDDATA10-13 which correspond to GPIO23-27 */
/* NOTE: SDCLK1 is not changed (i.e. none) */
/* pull up SDCMD1/SDDATA10-13 which correspond to GPIO23-27
* NOTE: SDCLK1 is not changed (i.e. none)
*/
for (i = 3; i <= 7; i++)
{
@ -229,8 +230,9 @@ SINT_T sddep1_hw_exit(struct SdDrCfg_s *cfg)
{
irqstate_t flags = enter_critical_section();
/* pull down SDCMD1/SDDATA10-13 which correspond to GPIO23-27 */
/* NOTE: SDCLK1 is not changed (i.e. none) */
/* pull down SDCMD1/SDDATA10-13 which correspond to GPIO23-27
* NOTE: SDCLK1 is not changed (i.e. none)
*/
int i;
for (i = 3; i <= 7; i++)
@ -262,7 +264,6 @@ SINT_T sddep1_hw_exit(struct SdDrCfg_s *cfg)
}
#endif /* CONFIG_LC823450_SDIF_SDC */
/****************************************************************************
* Name: sddep_voltage_switch
****************************************************************************/
@ -358,12 +359,12 @@ uint64_t sddep_set_timeout(uint64_t t)
SINT_T sddep_wait_status(UI_32 req_status, UI_32 *status,
struct SdDrCfg_s *cfg)
{
clock_t tick0 = clock_systimer();
clock_t tick0 = clock_systime_ticks();
int ret = 0;
while (1)
{
clock_t tick1 = clock_systimer();
clock_t tick1 = clock_systime_ticks();
*status = sdif_get_status(cfg->regbase);
if (req_status & (*status))
{
@ -375,6 +376,7 @@ SINT_T sddep_wait_status(UI_32 req_status, UI_32 *status,
ret = -100;
break;
}
sched_yield();
}
@ -397,7 +399,8 @@ SINT_T sddep_read(void *src, void *dst, UI_32 size, SINT_T type,
lc823450_dmasetup(_hrdma[ch],
LC823450_DMA_SRCWIDTH_WORD |
LC823450_DMA_DSTWIDTH_WORD |
(type == SDDR_RW_INC_WORD ? LC823450_DMA_DSTINC : 0),
(type == SDDR_RW_INC_WORD ?
LC823450_DMA_DSTINC : 0),
(uint32_t)src, (uint32_t)dst, size / 4);
break;
@ -406,7 +409,8 @@ SINT_T sddep_read(void *src, void *dst, UI_32 size, SINT_T type,
lc823450_dmasetup(_hrdma[ch],
LC823450_DMA_SRCWIDTH_WORD |
LC823450_DMA_DSTWIDTH_HWORD |
(type == SDDR_RW_INC_HWORD ? LC823450_DMA_DSTINC : 0),
(type == SDDR_RW_INC_HWORD ?
LC823450_DMA_DSTINC : 0),
(uint32_t)src, (uint32_t)dst, size / 4);
break;
@ -415,7 +419,8 @@ SINT_T sddep_read(void *src, void *dst, UI_32 size, SINT_T type,
lc823450_dmasetup(_hrdma[ch],
LC823450_DMA_SRCWIDTH_WORD |
LC823450_DMA_DSTWIDTH_BYTE |
(type == SDDR_RW_INC_BYTE ? LC823450_DMA_DSTINC : 0),
(type == SDDR_RW_INC_BYTE ?
LC823450_DMA_DSTINC : 0),
(uint32_t)src, (uint32_t)dst, size / 4);
break;
}
@ -427,7 +432,7 @@ SINT_T sddep_read(void *src, void *dst, UI_32 size, SINT_T type,
UI_32 *p = (UI_32 *)src;
UI_32 *buf = cfg->workbuf;
for (i = 0; i < size/sizeof(UI_32); i++)
for (i = 0; i < size / sizeof(UI_32); i++)
{
buf[i] = *p;
}
@ -441,21 +446,21 @@ SINT_T sddep_read(void *src, void *dst, UI_32 size, SINT_T type,
break;
case SDDR_RW_NOINC_WORD:
for (i = 0; i < size/sizeof(UI_32); i++)
for (i = 0; i < size / sizeof(UI_32); i++)
{
*(UI_32 *)dst = *(((UI_32 *)buf) + i);
}
break;
case SDDR_RW_NOINC_HWORD:
for (i = 0; i < size/sizeof(UI_16); i++)
for (i = 0; i < size / sizeof(UI_16); i++)
{
*(UI_16 *)dst = *(((UI_16 *)buf) + i);
}
break;
case SDDR_RW_NOINC_BYTE:
for (i = 0; i < size/sizeof(UI_8); i++)
for (i = 0; i < size / sizeof(UI_8); i++)
{
*(UI_8 *)dst = *(((UI_8 *)buf) + i);
}
@ -485,7 +490,8 @@ SINT_T sddep_write(void *src, void *dst, UI_32 size, SINT_T type,
lc823450_dmasetup(_hwdma[ch],
LC823450_DMA_SRCWIDTH_WORD |
LC823450_DMA_DSTWIDTH_WORD |
(type == SDDR_RW_INC_WORD ? LC823450_DMA_SRCINC : 0),
(type == SDDR_RW_INC_WORD ?
LC823450_DMA_SRCINC : 0),
(uint32_t)src, (uint32_t)dst, size / 4);
break;
@ -494,7 +500,8 @@ SINT_T sddep_write(void *src, void *dst, UI_32 size, SINT_T type,
lc823450_dmasetup(_hwdma[ch],
LC823450_DMA_SRCWIDTH_HWORD |
LC823450_DMA_DSTWIDTH_WORD |
(type == SDDR_RW_INC_HWORD ? LC823450_DMA_SRCINC : 0),
(type == SDDR_RW_INC_HWORD ?
LC823450_DMA_SRCINC : 0),
(uint32_t)src, (uint32_t)dst, size / 2);
break;
@ -503,7 +510,8 @@ SINT_T sddep_write(void *src, void *dst, UI_32 size, SINT_T type,
lc823450_dmasetup(_hwdma[ch],
LC823450_DMA_SRCWIDTH_BYTE |
LC823450_DMA_DSTWIDTH_WORD |
(type == SDDR_RW_INC_BYTE ? LC823450_DMA_SRCINC : 0),
(type == SDDR_RW_INC_BYTE ?
LC823450_DMA_SRCINC : 0),
(uint32_t)src, (uint32_t)dst, size);
break;
}
@ -525,21 +533,21 @@ SINT_T sddep_write(void *src, void *dst, UI_32 size, SINT_T type,
break;
case SDDR_RW_NOINC_WORD:
for (i = 0; i < size/sizeof(UI_32); i++)
for (i = 0; i < size / sizeof(UI_32); i++)
{
*(((UI_32 *)buf) + i) = *(UI_32 *)src;
}
break;
case SDDR_RW_NOINC_HWORD:
for (i = 0; i < size/sizeof(UI_16); i++)
for (i = 0; i < size / sizeof(UI_16); i++)
{
*(((UI_16 *)buf) + i) = *(UI_16 *)src;
}
break;
case SDDR_RW_NOINC_BYTE:
for (i = 0; i < size/sizeof(UI_8); i++)
for (i = 0; i < size / sizeof(UI_8); i++)
{
*(((UI_8 *)buf) + i) = *(UI_8 *)src;
}
@ -549,7 +557,7 @@ SINT_T sddep_write(void *src, void *dst, UI_32 size, SINT_T type,
return -100;
}
for (i = 0; i < size/sizeof(UI_32); i++)
for (i = 0; i < size / sizeof(UI_32); i++)
{
*p = buf[i];
}

View File

@ -638,11 +638,11 @@ static int lpc43_ciu_sendcmd(uint32_t cmd, uint32_t arg)
/* Poll until command is accepted by the CIU, or we timeout */
watchtime = clock_systimer();
watchtime = clock_systime_ticks();
while ((lpc43_getreg(LPC43_SDMMC_CMD) & SDMMC_CMD_STARTCMD) != 0)
{
if (watchtime - clock_systimer() > SDCARD_CMDTIMEOUT)
if (watchtime - clock_systime_ticks() > SDCARD_CMDTIMEOUT)
{
mcerr("TMO Timed out (%08X)\n",
lpc43_getreg(LPC43_SDMMC_CMD));
@ -1944,10 +1944,10 @@ static int lpc43_waitresponse(FAR struct sdio_dev_s *dev, uint32_t cmd)
/* Then wait for the response (or timeout or error) */
watchtime = clock_systimer();
watchtime = clock_systime_ticks();
while ((lpc43_getreg(LPC43_SDMMC_RINTSTS) & events) != events)
{
if (clock_systimer() - watchtime > timeout)
if (clock_systime_ticks() - watchtime > timeout)
{
mcerr("ERROR: Timeout cmd: %04x events: %04x STA: %08x "
"RINTSTS: %08x\n",

View File

@ -638,11 +638,11 @@ static int lpc54_ciu_sendcmd(uint32_t cmd, uint32_t arg)
/* Poll until command is accepted by the CIU, or we timeout */
watchtime = clock_systimer();
watchtime = clock_systime_ticks();
while ((lpc54_getreg(LPC54_SDMMC_CMD) & SDMMC_CMD_STARTCMD) != 0)
{
if (watchtime - clock_systimer() > SDCARD_CMDTIMEOUT)
if (watchtime - clock_systime_ticks() > SDCARD_CMDTIMEOUT)
{
mcerr("TMO Timed out (%08X)\n",
lpc54_getreg(LPC54_SDMMC_CMD));
@ -1944,10 +1944,10 @@ static int lpc54_waitresponse(FAR struct sdio_dev_s *dev, uint32_t cmd)
/* Then wait for the response (or timeout or error) */
watchtime = clock_systimer();
watchtime = clock_systime_ticks();
while ((lpc54_getreg(LPC54_SDMMC_RINTSTS) & events) != events)
{
if (clock_systimer() - watchtime > timeout)
if (clock_systime_ticks() - watchtime > timeout)
{
mcerr("ERROR: Timeout cmd: %04x events: %04x STA: %08x "
"RINTSTS: %08x\n",

View File

@ -169,7 +169,7 @@ static inline void max326_wdog_reset(FAR struct max326_wdt_lowerhalf_s *priv)
putreg32(WDT0_RST_SEQ1, MAX326_WDT0_RST);
putreg32(WDT0_RST_SEQ2, MAX326_WDT0_RST);
priv->lastping = clock_systimer();
priv->lastping = clock_systime_ticks();
}
/****************************************************************************
@ -253,7 +253,7 @@ static uint32_t max326_time_left(FAR struct max326_wdt_lowerhalf_s *priv)
exp = (ctrl & WDT0_CTRL_INTPERIOD_MASK) >> WDT0_CTRL_INTPERIOD_SHIFT;
timeout = max326_exp2msec(max326_pclk_frequency(), exp);
elapsed = TICK2MSEC(clock_systimer() - priv->lastping);
elapsed = TICK2MSEC(clock_systime_ticks() - priv->lastping);
if (elapsed > timeout)
{

View File

@ -283,7 +283,7 @@ static int nrf52_start(FAR struct watchdog_lowerhalf_s *lower)
if (!priv->started)
{
flags = enter_critical_section();
priv->lastreset = clock_systimer();
priv->lastreset = clock_systime_ticks();
priv->started = true;
nrf52_wdt_int_enable(WDT_INT_TIMEOUT);
nrf52_wdt_task_trigger();
@ -345,7 +345,7 @@ static int nrf52_keepalive(FAR struct watchdog_lowerhalf_s *lower)
flags = enter_critical_section();
priv->lastreset = clock_systimer();
priv->lastreset = clock_systime_ticks();
nrf52_wdt_reload_request_set(0);
leave_critical_section(flags);
@ -394,7 +394,7 @@ static int nrf52_getstatus(FAR struct watchdog_lowerhalf_s *lower,
/* Get the elapsed time since the last ping */
ticks = clock_systimer() - priv->lastreset;
ticks = clock_systime_ticks() - priv->lastreset;
elapsed = (int32_t)TICK2MSEC(ticks);
if (elapsed > priv->timeout)

View File

@ -638,13 +638,13 @@ static inline int
*/
priv->intstate = INTSTATE_WAITING;
start = clock_systimer();
start = clock_systime_ticks();
do
{
/* Calculate the elapsed time */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
/* Poll by simply calling the timer interrupt handler until it
* reports that it is done.
@ -698,12 +698,12 @@ static inline void
* detected, set by hardware when a timeout error is detected."
*/
start = clock_systimer();
start = clock_systime_ticks();
do
{
/* Calculate the elapsed time */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
/* Check for STOP condition */
@ -835,7 +835,7 @@ static void s32k1xx_lpi2c_tracereset(FAR struct s32k1xx_lpi2c_priv_s *priv)
/* Reset the trace info for a new data collection */
priv->tndx = 0;
priv->start_time = clock_systimer();
priv->start_time = clock_systime_ticks();
s32k1xx_lpi2c_traceclear(priv);
}
@ -869,7 +869,7 @@ static void s32k1xx_lpi2c_tracenew(FAR struct s32k1xx_lpi2c_priv_s *priv,
s32k1xx_lpi2c_traceclear(priv);
trace->status = status;
trace->count = 1;
trace->time = clock_systimer();
trace->time = clock_systime_ticks();
}
else
{
@ -912,7 +912,7 @@ static void s32k1xx_lpi2c_tracedump(FAR struct s32k1xx_lpi2c_priv_s *priv)
int i;
syslog(LOG_DEBUG, "Elapsed time: %ld\n",
(long)(clock_systimer() - priv->start_time));
(long)(clock_systime_ticks() - priv->start_time));
for (i = 0; i < priv->tndx; i++)
{

View File

@ -645,13 +645,13 @@ static inline int stm32_i2c_sem_waitdone(FAR struct stm32_i2c_priv_s *priv)
*/
priv->intstate = INTSTATE_WAITING;
start = clock_systimer();
start = clock_systime_ticks();
do
{
/* Calculate the elapsed time */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
/* Poll by simply calling the timer interrupt handler until it
* reports that it is done.
@ -705,12 +705,12 @@ static inline void stm32_i2c_sem_waitstop(FAR struct stm32_i2c_priv_s *priv)
* detected, set by hardware when a timeout error is detected."
*/
start = clock_systimer();
start = clock_systime_ticks();
do
{
/* Calculate the elapsed time */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
/* Check for STOP condition */
@ -816,7 +816,7 @@ static void stm32_i2c_tracereset(FAR struct stm32_i2c_priv_s *priv)
/* Reset the trace info for a new data collection */
priv->tndx = 0;
priv->start_time = clock_systimer();
priv->start_time = clock_systime_ticks();
stm32_i2c_traceclear(priv);
}
@ -849,7 +849,7 @@ static void stm32_i2c_tracenew(FAR struct stm32_i2c_priv_s *priv, uint32_t statu
stm32_i2c_traceclear(priv);
trace->status = status;
trace->count = 1;
trace->time = clock_systimer();
trace->time = clock_systime_ticks();
}
else
{
@ -892,7 +892,7 @@ static void stm32_i2c_tracedump(FAR struct stm32_i2c_priv_s *priv)
int i;
syslog(LOG_DEBUG, "Elapsed time: %ld\n",
(long)(clock_systimer() - priv->start_time));
(long)(clock_systime_ticks() - priv->start_time));
for (i = 0; i < priv->tndx; i++)
{

View File

@ -654,13 +654,13 @@ static int stm32_i2c_sem_waitdone(FAR struct stm32_i2c_priv_s *priv)
*/
priv->intstate = INTSTATE_WAITING;
start = clock_systimer();
start = clock_systime_ticks();
do
{
/* Calculate the elapsed time */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
/* Poll by simply calling the timer interrupt handler until it
* reports that it is done.
@ -714,12 +714,12 @@ static inline void stm32_i2c_sem_waitstop(FAR struct stm32_i2c_priv_s *priv)
* detected, set by hardware when a timeout error is detected."
*/
start = clock_systimer();
start = clock_systime_ticks();
do
{
/* Calculate the elapsed time */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
/* Check for STOP condition */
@ -825,7 +825,7 @@ static void stm32_i2c_tracereset(FAR struct stm32_i2c_priv_s *priv)
/* Reset the trace info for a new data collection */
priv->tndx = 0;
priv->start_time = clock_systimer();
priv->start_time = clock_systime_ticks();
stm32_i2c_traceclear(priv);
}
@ -858,7 +858,7 @@ static void stm32_i2c_tracenew(FAR struct stm32_i2c_priv_s *priv, uint16_t statu
stm32_i2c_traceclear(priv);
trace->status = status;
trace->count = 1;
trace->time = clock_systimer();
trace->time = clock_systime_ticks();
}
else
{
@ -901,7 +901,7 @@ static void stm32_i2c_tracedump(FAR struct stm32_i2c_priv_s *priv)
int i;
syslog(LOG_DEBUG, "Elapsed time: %ld\n",
(long)(clock_systimer() - priv->start_time));
(long)(clock_systime_ticks() - priv->start_time));
for (i = 0; i < priv->tndx; i++)
{

View File

@ -861,13 +861,13 @@ static inline int stm32_i2c_sem_waitdone(FAR struct stm32_i2c_priv_s *priv)
*/
priv->intstate = INTSTATE_WAITING;
start = clock_systimer();
start = clock_systime_ticks();
do
{
/* Calculate the elapsed time */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
/* Poll by simply calling the timer interrupt handler until it
* reports that it is done.
@ -998,12 +998,12 @@ static inline void stm32_i2c_sem_waitstop(FAR struct stm32_i2c_priv_s *priv)
/* Wait as stop might still be in progress */
start = clock_systimer();
start = clock_systime_ticks();
do
{
/* Calculate the elapsed time */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
/* Check for STOP condition */
@ -1109,7 +1109,7 @@ static void stm32_i2c_tracereset(FAR struct stm32_i2c_priv_s *priv)
/* Reset the trace info for a new data collection */
priv->tndx = 0;
priv->start_time = clock_systimer();
priv->start_time = clock_systime_ticks();
stm32_i2c_traceclear(priv);
}
@ -1143,7 +1143,7 @@ static void stm32_i2c_tracenew(FAR struct stm32_i2c_priv_s *priv,
stm32_i2c_traceclear(priv);
trace->status = status;
trace->count = 1;
trace->time = clock_systimer();
trace->time = clock_systime_ticks();
}
else
{
@ -1186,7 +1186,7 @@ static void stm32_i2c_tracedump(FAR struct stm32_i2c_priv_s *priv)
int i;
syslog(LOG_DEBUG, "Elapsed time: %d\n",
(int)(clock_systimer() - priv->start_time));
(int)(clock_systime_ticks() - priv->start_time));
for (i = 0; i < priv->tndx; i++)
{
@ -2451,14 +2451,14 @@ static int stm32_i2c_process(FAR struct i2c_master_s *dev,
* wraps up the transfer with a STOP condition.
*/
clock_t start = clock_systimer();
clock_t start = clock_systime_ticks();
clock_t timeout = USEC2TICK(USEC_PER_SEC / priv->frequency) + 1;
status = stm32_i2c_getstatus(priv);
while (status & I2C_ISR_BUSY)
{
if ((clock_systimer() - start) > timeout)
if ((clock_systime_ticks() - start) > timeout)
{
i2cerr("ERROR: I2C Bus busy");
errval = EBUSY;

View File

@ -358,7 +358,7 @@ static int stm32_start(FAR struct watchdog_lowerhalf_s *lower)
flags = enter_critical_section();
stm32_putreg(IWDG_KR_KEY_START, STM32_IWDG_KR);
priv->lastreset = clock_systimer();
priv->lastreset = clock_systime_ticks();
priv->started = true;
leave_critical_section(flags);
}
@ -417,7 +417,7 @@ static int stm32_keepalive(FAR struct watchdog_lowerhalf_s *lower)
flags = enter_critical_section();
stm32_putreg(IWDG_KR_KEY_RELOAD, STM32_IWDG_KR);
priv->lastreset = clock_systimer();
priv->lastreset = clock_systime_ticks();
leave_critical_section(flags);
return OK;
@ -463,7 +463,7 @@ static int stm32_getstatus(FAR struct watchdog_lowerhalf_s *lower,
/* Get the elapsed time since the last ping */
ticks = clock_systimer() - priv->lastreset;
ticks = clock_systime_ticks() - priv->lastreset;
elapsed = (int32_t)TICK2MSEC(ticks);
if (elapsed > priv->timeout)

View File

@ -1647,7 +1647,7 @@ static int stm32_ctrl_sendsetup(FAR struct stm32_usbhost_s *priv,
/* Loop while the device reports NAK (and a timeout is not exceeded */
chan = &priv->chan[ep0->outndx];
start = clock_systimer();
start = clock_systime_ticks();
do
{
@ -1696,7 +1696,7 @@ static int stm32_ctrl_sendsetup(FAR struct stm32_usbhost_s *priv,
/* Get the elapsed time (in frames) */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
}
while (elapsed < STM32_SETUP_DELAY);
@ -1885,7 +1885,7 @@ static ssize_t stm32_in_transfer(FAR struct stm32_usbhost_s *priv, int chidx,
chan->xfrd = 0;
xfrd = 0;
start = clock_systimer();
start = clock_systime_ticks();
while (chan->xfrd < chan->buflen)
{
/* Set up for the wait BEFORE starting the transfer */
@ -1942,7 +1942,7 @@ static ssize_t stm32_in_transfer(FAR struct stm32_usbhost_s *priv, int chidx,
* if not then try again.
*/
clock_t elapsed = clock_systimer() - start;
clock_t elapsed = clock_systime_ticks() - start;
if (elapsed >= STM32_DATANAK_DELAY)
{
/* Timeout out... break out returning the NAK as
@ -2244,7 +2244,7 @@ static ssize_t stm32_out_transfer(FAR struct stm32_usbhost_s *priv,
*/
chan = &priv->chan[chidx];
start = clock_systimer();
start = clock_systime_ticks();
xfrd = 0;
zlp = (buflen == 0);
@ -2295,7 +2295,7 @@ static ssize_t stm32_out_transfer(FAR struct stm32_usbhost_s *priv,
* pointer and buffer size will be unaltered.
*/
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
if (ret != -EAGAIN || /* Not a NAK condition OR */
elapsed >= STM32_DATANAK_DELAY || /* Timeout has elapsed OR */
chan->xfrd > 0) /* Data has been partially transferred */
@ -4543,7 +4543,7 @@ static int stm32_ctrlin(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0,
/* Get the start time. Loop again until the timeout expires */
start = clock_systimer();
start = clock_systime_ticks();
do
{
/* Handle the status OUT phase */
@ -4562,7 +4562,7 @@ static int stm32_ctrlin(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0,
/* Get the elapsed time (in frames) */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
}
while (elapsed < STM32_DATANAK_DELAY);
}
@ -4618,7 +4618,7 @@ static int stm32_ctrlout(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0,
/* Get the start time. Loop again until the timeout expires */
start = clock_systimer();
start = clock_systime_ticks();
do
{
/* Handle the data OUT phase (if any) */
@ -4654,7 +4654,7 @@ static int stm32_ctrlout(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0,
/* Get the elapsed time (in frames) */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
}
while (elapsed < STM32_DATANAK_DELAY);
}

View File

@ -1648,7 +1648,7 @@ static int stm32_ctrl_sendsetup(FAR struct stm32_usbhost_s *priv,
/* Loop while the device reports NAK (and a timeout is not exceeded */
chan = &priv->chan[ep0->outndx];
start = clock_systimer();
start = clock_systime_ticks();
do
{
@ -1697,7 +1697,7 @@ static int stm32_ctrl_sendsetup(FAR struct stm32_usbhost_s *priv,
/* Get the elapsed time (in frames) */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
}
while (elapsed < STM32_SETUP_DELAY);
@ -1886,7 +1886,7 @@ static ssize_t stm32_in_transfer(FAR struct stm32_usbhost_s *priv, int chidx,
chan->xfrd = 0;
xfrd = 0;
start = clock_systimer();
start = clock_systime_ticks();
while (chan->xfrd < chan->buflen)
{
/* Set up for the wait BEFORE starting the transfer */
@ -1943,7 +1943,7 @@ static ssize_t stm32_in_transfer(FAR struct stm32_usbhost_s *priv, int chidx,
* if not then try again.
*/
clock_t elapsed = clock_systimer() - start;
clock_t elapsed = clock_systime_ticks() - start;
if (elapsed >= STM32_DATANAK_DELAY)
{
/* Timeout out... break out returning the NAK as
@ -2245,7 +2245,7 @@ static ssize_t stm32_out_transfer(FAR struct stm32_usbhost_s *priv,
*/
chan = &priv->chan[chidx];
start = clock_systimer();
start = clock_systime_ticks();
xfrd = 0;
zlp = (buflen == 0);
@ -2296,7 +2296,7 @@ static ssize_t stm32_out_transfer(FAR struct stm32_usbhost_s *priv,
* pointer and buffer size will be unaltered.
*/
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
if (ret != -EAGAIN || /* Not a NAK condition OR */
elapsed >= STM32_DATANAK_DELAY || /* Timeout has elapsed OR */
chan->xfrd > 0) /* Data has been partially transferred */
@ -4543,7 +4543,7 @@ static int stm32_ctrlin(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0,
/* Get the start time. Loop again until the timeout expires */
start = clock_systimer();
start = clock_systime_ticks();
do
{
/* Handle the status OUT phase */
@ -4562,7 +4562,7 @@ static int stm32_ctrlin(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0,
/* Get the elapsed time (in frames) */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
}
while (elapsed < STM32_DATANAK_DELAY);
}
@ -4618,7 +4618,7 @@ static int stm32_ctrlout(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0,
/* Get the start time. Loop again until the timeout expires */
start = clock_systimer();
start = clock_systime_ticks();
do
{
/* Handle the data OUT phase (if any) */
@ -4654,7 +4654,7 @@ static int stm32_ctrlout(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0,
/* Get the elapsed time (in frames) */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
}
while (elapsed < STM32_DATANAK_DELAY);
}

View File

@ -700,13 +700,13 @@ static inline int stm32_i2c_sem_waitdone(FAR struct stm32_i2c_priv_s *priv)
*/
priv->intstate = INTSTATE_WAITING;
start = clock_systimer();
start = clock_systime_ticks();
do
{
/* Calculate the elapsed time */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
/* Poll by simply calling the timer interrupt handler until it
* reports that it is done.
@ -760,12 +760,12 @@ static inline void stm32_i2c_sem_waitstop(FAR struct stm32_i2c_priv_s *priv)
* detected, set by hardware when a timeout error is detected."
*/
start = clock_systimer();
start = clock_systime_ticks();
do
{
/* Calculate the elapsed time */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
/* Check for STOP condition */
@ -871,7 +871,7 @@ static void stm32_i2c_tracereset(FAR struct stm32_i2c_priv_s *priv)
/* Reset the trace info for a new data collection */
priv->tndx = 0;
priv->start_time = clock_systimer();
priv->start_time = clock_systime_ticks();
stm32_i2c_traceclear(priv);
}
@ -904,7 +904,7 @@ static void stm32_i2c_tracenew(FAR struct stm32_i2c_priv_s *priv, uint32_t statu
stm32_i2c_traceclear(priv);
trace->status = status;
trace->count = 1;
trace->time = clock_systimer();
trace->time = clock_systime_ticks();
}
else
{
@ -947,7 +947,7 @@ static void stm32_i2c_tracedump(FAR struct stm32_i2c_priv_s *priv)
int i;
syslog(LOG_DEBUG, "Elapsed time: %ld\n",
(long)(clock_systimer() - priv->start_time));
(long)(clock_systime_ticks() - priv->start_time));
for (i = 0; i < priv->tndx; i++)
{

View File

@ -875,13 +875,13 @@ static inline int stm32_i2c_sem_waitdone(FAR struct stm32_i2c_priv_s *priv)
*/
priv->intstate = INTSTATE_WAITING;
start = clock_systimer();
start = clock_systime_ticks();
do
{
/* Calculate the elapsed time */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
/* Poll by simply calling the timer interrupt handler until it
* reports that it is done.
@ -1012,12 +1012,12 @@ static inline void stm32_i2c_sem_waitstop(FAR struct stm32_i2c_priv_s *priv)
/* Wait as stop might still be in progress */
start = clock_systimer();
start = clock_systime_ticks();
do
{
/* Calculate the elapsed time */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
/* Check for STOP condition */
@ -1123,7 +1123,7 @@ static void stm32_i2c_tracereset(FAR struct stm32_i2c_priv_s *priv)
/* Reset the trace info for a new data collection */
priv->tndx = 0;
priv->start_time = clock_systimer();
priv->start_time = clock_systime_ticks();
stm32_i2c_traceclear(priv);
}
@ -1157,7 +1157,7 @@ static void stm32_i2c_tracenew(FAR struct stm32_i2c_priv_s *priv,
stm32_i2c_traceclear(priv);
trace->status = status;
trace->count = 1;
trace->time = clock_systimer();
trace->time = clock_systime_ticks();
}
else
{
@ -1200,7 +1200,7 @@ static void stm32_i2c_tracedump(FAR struct stm32_i2c_priv_s *priv)
int i;
syslog(LOG_DEBUG, "Elapsed time: %d\n",
(int)(clock_systimer() - priv->start_time));
(int)(clock_systime_ticks() - priv->start_time));
for (i = 0; i < priv->tndx; i++)
{
@ -2461,14 +2461,14 @@ static int stm32_i2c_process(FAR struct i2c_master_s *dev,
* wraps up the transfer with a STOP condition.
*/
clock_t start = clock_systimer();
clock_t start = clock_systime_ticks();
clock_t timeout = USEC2TICK(USEC_PER_SEC / priv->frequency) + 1;
status = stm32_i2c_getstatus(priv);
while (status & I2C_ISR_BUSY)
{
if ((clock_systimer() - start) > timeout)
if ((clock_systime_ticks() - start) > timeout)
{
i2cerr("ERROR: I2C Bus busy");
errval = EBUSY;

View File

@ -899,13 +899,13 @@ static inline int stm32_i2c_sem_waitdone(FAR struct stm32_i2c_priv_s *priv)
*/
priv->intstate = INTSTATE_WAITING;
start = clock_systimer();
start = clock_systime_ticks();
do
{
/* Calculate the elapsed time */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
/* Poll by simply calling the timer interrupt handler until it
* reports that it is done.
@ -1036,12 +1036,12 @@ static inline void stm32_i2c_sem_waitstop(FAR struct stm32_i2c_priv_s *priv)
/* Wait as stop might still be in progress */
start = clock_systimer();
start = clock_systime_ticks();
do
{
/* Calculate the elapsed time */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
/* Check for STOP condition */
@ -1147,7 +1147,7 @@ static void stm32_i2c_tracereset(FAR struct stm32_i2c_priv_s *priv)
/* Reset the trace info for a new data collection */
priv->tndx = 0;
priv->start_time = clock_systimer();
priv->start_time = clock_systime_ticks();
stm32_i2c_traceclear(priv);
}
@ -1181,7 +1181,7 @@ static void stm32_i2c_tracenew(FAR struct stm32_i2c_priv_s *priv,
stm32_i2c_traceclear(priv);
trace->status = status;
trace->count = 1;
trace->time = clock_systimer();
trace->time = clock_systime_ticks();
}
else
{
@ -1224,7 +1224,7 @@ static void stm32_i2c_tracedump(FAR struct stm32_i2c_priv_s *priv)
int i;
syslog(LOG_DEBUG, "Elapsed time: %d\n",
(int)(clock_systimer() - priv->start_time));
(int)(clock_systime_ticks() - priv->start_time));
for (i = 0; i < priv->tndx; i++)
{
@ -2489,14 +2489,14 @@ static int stm32_i2c_process(FAR struct i2c_master_s *dev,
* wraps up the transfer with a STOP condition.
*/
clock_t start = clock_systimer();
clock_t start = clock_systime_ticks();
clock_t timeout = USEC2TICK(USEC_PER_SEC / priv->frequency) + 1;
status = stm32_i2c_getstatus(priv);
while (status & I2C_ISR_BUSY)
{
if ((clock_systimer() - start) > timeout)
if ((clock_systime_ticks() - start) > timeout)
{
i2cerr("ERROR: I2C Bus busy");
errval = EBUSY;

View File

@ -1649,7 +1649,7 @@ static int stm32_ctrl_sendsetup(FAR struct stm32_usbhost_s *priv,
/* Loop while the device reports NAK (and a timeout is not exceeded */
chan = &priv->chan[ep0->outndx];
start = clock_systimer();
start = clock_systime_ticks();
do
{
@ -1698,7 +1698,7 @@ static int stm32_ctrl_sendsetup(FAR struct stm32_usbhost_s *priv,
/* Get the elapsed time (in frames) */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
}
while (elapsed < STM32_SETUP_DELAY);
@ -1887,7 +1887,7 @@ static ssize_t stm32_in_transfer(FAR struct stm32_usbhost_s *priv, int chidx,
chan->xfrd = 0;
xfrd = 0;
start = clock_systimer();
start = clock_systime_ticks();
while (chan->xfrd < chan->buflen)
{
/* Set up for the wait BEFORE starting the transfer */
@ -1944,7 +1944,7 @@ static ssize_t stm32_in_transfer(FAR struct stm32_usbhost_s *priv, int chidx,
* if not then try again.
*/
clock_t elapsed = clock_systimer() - start;
clock_t elapsed = clock_systime_ticks() - start;
if (elapsed >= STM32_DATANAK_DELAY)
{
/* Timeout out... break out returning the NAK as
@ -2246,7 +2246,7 @@ static ssize_t stm32_out_transfer(FAR struct stm32_usbhost_s *priv,
*/
chan = &priv->chan[chidx];
start = clock_systimer();
start = clock_systime_ticks();
xfrd = 0;
zlp = (buflen == 0);
@ -2297,7 +2297,7 @@ static ssize_t stm32_out_transfer(FAR struct stm32_usbhost_s *priv,
* pointer and buffer size will be unaltered.
*/
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
if (ret != -EAGAIN || /* Not a NAK condition OR */
elapsed >= STM32_DATANAK_DELAY || /* Timeout has elapsed OR */
chan->xfrd > 0) /* Data has been partially transferred */
@ -4533,7 +4533,7 @@ static int stm32_ctrlin(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0,
/* Get the start time. Loop again until the timeout expires */
start = clock_systimer();
start = clock_systime_ticks();
do
{
/* Handle the status OUT phase */
@ -4552,7 +4552,7 @@ static int stm32_ctrlin(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0,
/* Get the elapsed time (in frames) */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
}
while (elapsed < STM32_DATANAK_DELAY);
}
@ -4608,7 +4608,7 @@ static int stm32_ctrlout(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0,
/* Get the start time. Loop again until the timeout expires */
start = clock_systimer();
start = clock_systime_ticks();
do
{
/* Handle the data OUT phase (if any) */
@ -4644,7 +4644,7 @@ static int stm32_ctrlout(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0,
/* Get the elapsed time (in frames) */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
}
while (elapsed < STM32_DATANAK_DELAY);
}

View File

@ -852,13 +852,13 @@ static inline int stm32_i2c_sem_waitdone(FAR struct stm32_i2c_priv_s *priv)
*/
priv->intstate = INTSTATE_WAITING;
start = clock_systimer();
start = clock_systime_ticks();
do
{
/* Calculate the elapsed time */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
/* Poll by simply calling the timer interrupt handler until it
* reports that it is done.
@ -989,12 +989,12 @@ static inline void stm32_i2c_sem_waitstop(FAR struct stm32_i2c_priv_s *priv)
/* Wait as stop might still be in progress */
start = clock_systimer();
start = clock_systime_ticks();
do
{
/* Calculate the elapsed time */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
/* Check for STOP condition */
@ -1100,7 +1100,7 @@ static void stm32_i2c_tracereset(FAR struct stm32_i2c_priv_s *priv)
/* Reset the trace info for a new data collection */
priv->tndx = 0;
priv->start_time = clock_systimer();
priv->start_time = clock_systime_ticks();
stm32_i2c_traceclear(priv);
}
@ -1134,7 +1134,7 @@ static void stm32_i2c_tracenew(FAR struct stm32_i2c_priv_s *priv,
stm32_i2c_traceclear(priv);
trace->status = status;
trace->count = 1;
trace->time = clock_systimer();
trace->time = clock_systime_ticks();
}
else
{
@ -1177,7 +1177,7 @@ static void stm32_i2c_tracedump(FAR struct stm32_i2c_priv_s *priv)
int i;
syslog(LOG_DEBUG, "Elapsed time: %d\n",
clock_systimer() - priv->start_time);
clock_systime_ticks() - priv->start_time);
for (i = 0; i < priv->tndx; i++)
{
@ -2434,14 +2434,14 @@ static int stm32_i2c_process(FAR struct i2c_master_s *dev,
* wraps up the transfer with a STOP condition.
*/
uint32_t start = clock_systimer();
uint32_t start = clock_systime_ticks();
uint32_t timeout = USEC2TICK(USEC_PER_SEC / priv->frequency) + 1;
status = stm32_i2c_getstatus(priv);
while ((status & I2C_ISR_BUSY) != 0)
{
if ((clock_systimer() - start) > timeout)
if ((clock_systime_ticks() - start) > timeout)
{
i2cerr("ERROR: I2C Bus busy");
errval = EBUSY;

View File

@ -358,7 +358,7 @@ static int stm32_start(FAR struct watchdog_lowerhalf_s *lower)
flags = enter_critical_section();
stm32_putreg(IWDG_KR_KEY_START, STM32_IWDG_KR);
priv->lastreset = clock_systimer();
priv->lastreset = clock_systime_ticks();
priv->started = true;
leave_critical_section(flags);
}
@ -417,7 +417,7 @@ static int stm32_keepalive(FAR struct watchdog_lowerhalf_s *lower)
flags = enter_critical_section();
stm32_putreg(IWDG_KR_KEY_RELOAD, STM32_IWDG_KR);
priv->lastreset = clock_systimer();
priv->lastreset = clock_systime_ticks();
leave_critical_section(flags);
return OK;
@ -463,7 +463,7 @@ static int stm32_getstatus(FAR struct watchdog_lowerhalf_s *lower,
/* Get the elapsed time since the last ping */
ticks = clock_systimer() - priv->lastreset;
ticks = clock_systime_ticks() - priv->lastreset;
elapsed = (int32_t)TICK2MSEC(ticks);
if (elapsed > priv->timeout)

View File

@ -1654,7 +1654,7 @@ static int stm32_ctrl_sendsetup(FAR struct stm32_usbhost_s *priv,
/* Loop while the device reports NAK (and a timeout is not exceeded */
chan = &priv->chan[ep0->outndx];
start = clock_systimer();
start = clock_systime_ticks();
do
{
@ -1703,7 +1703,7 @@ static int stm32_ctrl_sendsetup(FAR struct stm32_usbhost_s *priv,
/* Get the elapsed time (in frames) */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
}
while (elapsed < STM32_SETUP_DELAY);
@ -1892,7 +1892,7 @@ static ssize_t stm32_in_transfer(FAR struct stm32_usbhost_s *priv, int chidx,
chan->xfrd = 0;
xfrd = 0;
start = clock_systimer();
start = clock_systime_ticks();
while (chan->xfrd < chan->buflen)
{
/* Set up for the wait BEFORE starting the transfer */
@ -1949,7 +1949,7 @@ static ssize_t stm32_in_transfer(FAR struct stm32_usbhost_s *priv, int chidx,
* if not then try again.
*/
clock_t elapsed = clock_systimer() - start;
clock_t elapsed = clock_systime_ticks() - start;
if (elapsed >= STM32_DATANAK_DELAY)
{
/* Timeout out... break out returning the NAK as
@ -2251,7 +2251,7 @@ static ssize_t stm32_out_transfer(FAR struct stm32_usbhost_s *priv,
*/
chan = &priv->chan[chidx];
start = clock_systimer();
start = clock_systime_ticks();
xfrd = 0;
zlp = (buflen == 0);
@ -2302,7 +2302,7 @@ static ssize_t stm32_out_transfer(FAR struct stm32_usbhost_s *priv,
* pointer and buffer size will be unaltered.
*/
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
if (ret != -EAGAIN || /* Not a NAK condition OR */
elapsed >= STM32_DATANAK_DELAY || /* Timeout has elapsed OR */
chan->xfrd > 0) /* Data has been partially transferred */
@ -4539,7 +4539,7 @@ static int stm32_ctrlin(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0,
/* Get the start time. Loop again until the timeout expires */
start = clock_systimer();
start = clock_systime_ticks();
do
{
/* Handle the status OUT phase */
@ -4558,7 +4558,7 @@ static int stm32_ctrlin(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0,
/* Get the elapsed time (in frames) */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
}
while (elapsed < STM32_DATANAK_DELAY);
}
@ -4614,7 +4614,7 @@ static int stm32_ctrlout(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0,
/* Get the start time. Loop again until the timeout expires */
start = clock_systimer();
start = clock_systime_ticks();
do
{
/* Handle the data OUT phase (if any) */
@ -4650,7 +4650,7 @@ static int stm32_ctrlout(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0,
/* Get the elapsed time (in frames) */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
}
while (elapsed < STM32_DATANAK_DELAY);
}

View File

@ -893,13 +893,13 @@ static inline int stm32l4_i2c_sem_waitdone(FAR struct stm32l4_i2c_priv_s *priv)
*/
priv->intstate = INTSTATE_WAITING;
start = clock_systimer();
start = clock_systime_ticks();
do
{
/* Calculate the elapsed time */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
/* Poll by simply calling the timer interrupt handler until it
* reports that it is done.
@ -1030,12 +1030,12 @@ static inline void stm32l4_i2c_sem_waitstop(FAR struct stm32l4_i2c_priv_s *priv)
/* Wait as stop might still be in progress */
start = clock_systimer();
start = clock_systime_ticks();
do
{
/* Calculate the elapsed time */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
/* Check for STOP condition */
@ -1142,7 +1142,7 @@ static void stm32l4_i2c_tracereset(FAR struct stm32l4_i2c_priv_s *priv)
/* Reset the trace info for a new data collection */
priv->tndx = 0;
priv->start_time = clock_systimer();
priv->start_time = clock_systime_ticks();
stm32l4_i2c_traceclear(priv);
}
@ -1176,7 +1176,7 @@ static void stm32l4_i2c_tracenew(FAR struct stm32l4_i2c_priv_s *priv,
stm32l4_i2c_traceclear(priv);
trace->status = status;
trace->count = 1;
trace->time = clock_systimer();
trace->time = clock_systime_ticks();
}
else
{
@ -1219,7 +1219,7 @@ static void stm32l4_i2c_tracedump(FAR struct stm32l4_i2c_priv_s *priv)
int i;
syslog(LOG_DEBUG, "Elapsed time: %d\n",
(int)(clock_systimer() - priv->start_time));
(int)(clock_systime_ticks() - priv->start_time));
for (i = 0; i < priv->tndx; i++)
{
@ -2615,14 +2615,14 @@ static int stm32l4_i2c_process(FAR struct i2c_master_s *dev,
* wraps up the transfer with a STOP condition.
*/
clock_t start = clock_systimer();
clock_t start = clock_systime_ticks();
clock_t timeout = USEC2TICK(USEC_PER_SEC / priv->frequency) + 1;
status = stm32l4_i2c_getstatus(priv);
while (status & I2C_ISR_BUSY)
{
if ((clock_systimer() - start) > timeout)
if ((clock_systime_ticks() - start) > timeout)
{
i2cerr("ERROR: I2C Bus busy");
errval = EBUSY;

View File

@ -349,7 +349,7 @@ static int stm32l4_start(FAR struct watchdog_lowerhalf_s *lower)
flags = enter_critical_section();
stm32l4_putreg(IWDG_KR_KEY_START, STM32L4_IWDG_KR);
priv->lastreset = clock_systimer();
priv->lastreset = clock_systime_ticks();
priv->started = true;
leave_critical_section(flags);
}
@ -409,7 +409,7 @@ static int stm32l4_keepalive(FAR struct watchdog_lowerhalf_s *lower)
flags = enter_critical_section();
stm32l4_putreg(IWDG_KR_KEY_RELOAD, STM32L4_IWDG_KR);
priv->lastreset = clock_systimer();
priv->lastreset = clock_systime_ticks();
leave_critical_section(flags);
return OK;
@ -456,7 +456,7 @@ static int stm32l4_getstatus(FAR struct watchdog_lowerhalf_s *lower,
/* Get the elapsed time since the last ping */
ticks = clock_systimer() - priv->lastreset;
ticks = clock_systime_ticks() - priv->lastreset;
elapsed = (int32_t)TICK2MSEC(ticks);
if (elapsed > priv->timeout)

View File

@ -1667,7 +1667,7 @@ static int stm32l4_ctrl_sendsetup(FAR struct stm32l4_usbhost_s *priv,
/* Loop while the device reports NAK (and a timeout is not exceeded */
chan = &priv->chan[ep0->outndx];
start = clock_systimer();
start = clock_systime_ticks();
do
{
@ -1716,7 +1716,7 @@ static int stm32l4_ctrl_sendsetup(FAR struct stm32l4_usbhost_s *priv,
/* Get the elapsed time (in frames) */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
}
while (elapsed < STM32L4_SETUP_DELAY);
@ -1906,7 +1906,7 @@ static ssize_t stm32l4_in_transfer(FAR struct stm32l4_usbhost_s *priv,
chan->xfrd = 0;
xfrd = 0;
start = clock_systimer();
start = clock_systime_ticks();
while (chan->xfrd < chan->buflen)
{
/* Set up for the wait BEFORE starting the transfer */
@ -1963,7 +1963,7 @@ static ssize_t stm32l4_in_transfer(FAR struct stm32l4_usbhost_s *priv,
* if not then try again.
*/
clock_t elapsed = clock_systimer() - start;
clock_t elapsed = clock_systime_ticks() - start;
if (elapsed >= STM32L4_DATANAK_DELAY)
{
/* Timeout out... break out returning the NAK as
@ -2265,7 +2265,7 @@ static ssize_t stm32l4_out_transfer(FAR struct stm32l4_usbhost_s *priv,
*/
chan = &priv->chan[chidx];
start = clock_systimer();
start = clock_systime_ticks();
xfrd = 0;
zlp = (buflen == 0);
@ -2316,7 +2316,7 @@ static ssize_t stm32l4_out_transfer(FAR struct stm32l4_usbhost_s *priv,
* pointer and buffer size will be unaltered.
*/
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
if (ret != -EAGAIN || /* Not a NAK condition OR */
elapsed >= STM32L4_DATANAK_DELAY || /* Timeout has elapsed OR */
chan->xfrd > 0) /* Data has been partially
@ -4573,7 +4573,7 @@ static int stm32l4_ctrlin(FAR struct usbhost_driver_s *drvr,
/* Get the start time. Loop again until the timeout expires */
start = clock_systimer();
start = clock_systime_ticks();
do
{
/* Handle the status OUT phase */
@ -4592,7 +4592,7 @@ static int stm32l4_ctrlin(FAR struct usbhost_driver_s *drvr,
/* Get the elapsed time (in frames) */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
}
while (elapsed < STM32L4_DATANAK_DELAY);
}
@ -4650,7 +4650,7 @@ static int stm32l4_ctrlout(FAR struct usbhost_driver_s *drvr,
/* Get the start time. Loop again until the timeout expires */
start = clock_systimer();
start = clock_systime_ticks();
do
{
/* Handle the data OUT phase (if any) */
@ -4685,7 +4685,7 @@ static int stm32l4_ctrlout(FAR struct usbhost_driver_s *drvr,
/* Get the elapsed time (in frames) */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
}
while (elapsed < STM32L4_DATANAK_DELAY);
}

View File

@ -784,7 +784,7 @@ static inline int tiva_i2c_sem_waitdone(struct tiva_i2c_priv_s *priv)
* nxsem_timedwait() sleeps.
*/
start = clock_systimer();
start = clock_systime_ticks();
do
{
@ -800,7 +800,7 @@ static inline int tiva_i2c_sem_waitdone(struct tiva_i2c_priv_s *priv)
/* Calculate the elapsed time */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
}
/* Loop until the transfer is complete. */
@ -895,7 +895,7 @@ static void tiva_i2c_tracereset(struct tiva_i2c_priv_s *priv)
priv->tndx = 0;
priv->tcount = 0;
priv->ttime = clock_systimer();
priv->ttime = clock_systime_ticks();
priv->tstatus = 0;
tiva_i2c_traceclear(priv);
}
@ -929,7 +929,7 @@ static void tiva_i2c_tracenew(struct tiva_i2c_priv_s *priv, uint32_t status)
tiva_i2c_traceclear(priv);
trace->status = status;
trace->count = 1;
trace->time = clock_systimer();
trace->time = clock_systime_ticks();
/* Save the status and reset the count */
@ -959,7 +959,7 @@ static void tiva_i2c_traceevent(struct tiva_i2c_priv_s *priv,
trace->event = event;
trace->parm = parm;
trace->count = priv->tcount;
trace->time = clock_systimer();
trace->time = clock_systime_ticks();
/* Bump up the trace index (unless we are out of trace entries) */
@ -976,7 +976,7 @@ static void tiva_i2c_traceevent(struct tiva_i2c_priv_s *priv,
trace = &priv->trace[priv->tndx];
trace->status = priv->tstatus;
trace->count = priv->tcount;
trace->time = clock_systimer();
trace->time = clock_systime_ticks();
}
else
{
@ -991,7 +991,7 @@ static void tiva_i2c_tracedump(struct tiva_i2c_priv_s *priv)
int i;
syslog(LOG_DEBUG, "Elapsed time: %ld\n",
(long)(clock_systimer() - priv->ttime));
(long)(clock_systime_ticks() - priv->ttime));
for (i = 0; i < priv->tndx; i++)
{

View File

@ -497,7 +497,7 @@ static void pic32mz_i2c_tracereset(FAR struct pic32mz_i2c_priv_s *priv)
/* Reset the trace info for a new data collection */
priv->tndx = 0;
priv->start_time = clock_systimer();
priv->start_time = clock_systime_ticks();
pic32mz_i2c_traceclear(priv);
}
@ -531,7 +531,7 @@ static void pic32mz_i2c_tracenew(FAR struct pic32mz_i2c_priv_s *priv,
pic32mz_i2c_traceclear(priv);
trace->status = status;
trace->count = 1;
trace->time = clock_systimer();
trace->time = clock_systime_ticks();
}
else
{
@ -574,7 +574,7 @@ static void pic32mz_i2c_tracedump(FAR struct pic32mz_i2c_priv_s *priv)
int i;
syslog(LOG_DEBUG, "Elapsed time: %ld\n",
(long)(clock_systimer() - priv->start_time));
(long)(clock_systime_ticks() - priv->start_time));
for (i = 0; i < priv->tndx; i++)
{
@ -768,13 +768,13 @@ static inline int
*/
priv->intstate = INTSTATE_WAITING;
start = clock_systimer();
start = clock_systime_ticks();
do
{
/* Calculate the elapsed time */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
/* Poll by simply calling the timer interrupt handler until it
* reports that it is done.
@ -823,10 +823,10 @@ static inline void
timeout = CONFIG_PIC32MZ_I2CTIMEOTICKS;
#endif
start = clock_systimer();
start = clock_systime_ticks();
do
{
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
/* The bus is idle if the five least significant bits of I2CxCON
* are cleared and the I2CxSTAT<TRSTAT> flag is cleared.

View File

@ -221,7 +221,7 @@ static int ft80x_fade(FAR struct ft80x_dev_s *priv,
delay = 1;
}
start = clock_systimer();
start = clock_systime_ticks();
do
{
@ -231,7 +231,7 @@ static int ft80x_fade(FAR struct ft80x_dev_s *priv,
/* Get the elapsed time */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
if (elapsed > INT32_MAX || (int32_t)elapsed >= delay)
{
duty = endduty;

View File

@ -1233,7 +1233,7 @@ static int mmcsd_transferready(FAR struct mmcsd_state_s *priv)
}
#endif
starttime = clock_systimer();
starttime = clock_systime_ticks();
do
{
/* Get the current R1 status from the card */
@ -1280,7 +1280,7 @@ static int mmcsd_transferready(FAR struct mmcsd_state_s *priv)
* time... we can't stay in this loop forever!
*/
elapsed = clock_systimer() - starttime;
elapsed = clock_systime_ticks() - starttime;
}
while (elapsed < TICK_PER_SEC);
@ -3195,7 +3195,7 @@ static int mmcsd_cardidentify(FAR struct mmcsd_state_s *priv)
* but not MMC
*/
start = clock_systimer();
start = clock_systime_ticks();
elapsed = 0;
do
{
@ -3360,7 +3360,7 @@ static int mmcsd_cardidentify(FAR struct mmcsd_state_s *priv)
/* Check the elapsed time. We won't keep trying this forever! */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
}
while (elapsed < TICK_PER_SEC); /* On successful reception while 'breaks', see above. */

View File

@ -118,8 +118,8 @@
#define MMCSD_DELAY_1SEC (CLK_TCK + 1)
#define MMCSD_DELAY_10SEC (10 * CLK_TCK + 1)
#define ELAPSED_TIME(t) (clock_systimer()-(t))
#define START_TIME (clock_systimer())
#define ELAPSED_TIME(t) (clock_systime_ticks()-(t))
#define START_TIME (clock_systime_ticks())
/* SD read timeout: ~100msec, Write Time out ~250ms. Units of clock ticks */

View File

@ -426,7 +426,7 @@ static int sst39vf_chiperase(FAR struct sst39vf_dev_s *priv)
wrinfo.address = CONFIG_SST39VF_BASE_ADDRESS;
wrinfo.data = 0xffff;
start = clock_systimer();
start = clock_systime_ticks();
while (delay < MSEC2TICK(SST39VF_TSCE_MSEC))
{
/* Check if the erase is complete */
@ -438,7 +438,7 @@ static int sst39vf_chiperase(FAR struct sst39vf_dev_s *priv)
/* No, check if the timeout has elapsed */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
if (elapsed > MSEC2TICK(SST39VF_TSCE_MSEC))
{
return -ETIMEDOUT;
@ -502,7 +502,7 @@ static int sst39vf_sectorerase(FAR struct sst39vf_dev_s *priv,
*/
#if 0
start = clock_systimer();
start = clock_systime_ticks();
while (delay < MSEC2TICK(SST39VF_TSE_MSEC))
{
/* Check if the erase is complete */
@ -514,7 +514,7 @@ static int sst39vf_sectorerase(FAR struct sst39vf_dev_s *priv,
/* No, check if the timeout has elapsed */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
if (elapsed > MSEC2TICK(SST39VF_TSE_MSEC))
{
return -ETIMEDOUT;

View File

@ -750,7 +750,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)
{
clock_t start = clock_systimer();
clock_t start = clock_systime_ticks();
clock_t elapsed;
uint8_t rddata;
@ -761,7 +761,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 = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
}
while ((rddata & bits) != value && elapsed < ENC_POLLTIMEOUT);

View File

@ -645,7 +645,7 @@ static void enc_wrreg(FAR struct enc_driver_s *priv, uint16_t ctrlreg,
static int enc_waitreg(FAR struct enc_driver_s *priv, uint16_t ctrlreg,
uint16_t bits, uint16_t value)
{
clock_t start = clock_systimer();
clock_t start = clock_systime_ticks();
clock_t elapsed;
uint16_t rddata;
@ -656,7 +656,7 @@ static int enc_waitreg(FAR struct enc_driver_s *priv, uint16_t ctrlreg,
/* Read the byte from the requested banked register */
rddata = enc_rdreg(priv, ctrlreg);
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
}
while ((rddata & bits) != value && elapsed < ENC_REGPOLLTIMEOUT);

View File

@ -455,7 +455,7 @@ static int slip_txtask(int argc, FAR char *argv[])
/* Loop forever */
start_ticks = clock_systimer();
start_ticks = clock_systime_ticks();
for (; ; )
{
/* Wait for the timeout to expire (or until we are signaled by */
@ -489,7 +489,7 @@ static int slip_txtask(int argc, FAR char *argv[])
/* Has a half second elapsed since the last timer poll? */
now_ticks = clock_systimer();
now_ticks = clock_systime_ticks();
hsec = (unsigned int)((now_ticks - start_ticks) / TICK_PER_HSEC);
if (hsec > 0)
{

View File

@ -228,8 +228,8 @@ static void governor_initialize(void)
for (i = 0; i < CONFIG_PM_NDOMAINS; i++)
{
pdomstate = &g_pm_activity_governor.domain_states[i];
pdomstate->stime = clock_systimer();
pdomstate->btime = clock_systimer();
pdomstate->stime = clock_systime_ticks();
pdomstate->btime = clock_systime_ticks();
}
}
@ -275,7 +275,7 @@ static void governor_activity(int domain, int count)
* level may be over-estimated.
*/
now = clock_systimer();
now = clock_systime_ticks();
elapsed = now - pdomstate->stime;
if (elapsed >= TIME_SLICE_TICKS)
{
@ -419,7 +419,7 @@ static void governor_update(int domain, int16_t accum)
{
/* Yes... reset the count and recommend the normal state. */
pdomstate->btime = clock_systimer();
pdomstate->btime = clock_systime_ticks();
pdomstate->recommended = PM_NORMAL;
return;
}
@ -450,7 +450,7 @@ static void governor_update(int domain, int16_t accum)
{
/* No... reset the count and recommend the current state */
pdomstate->btime = clock_systimer();
pdomstate->btime = clock_systime_ticks();
pdomstate->recommended = state;
}
@ -462,14 +462,14 @@ static void governor_update(int domain, int16_t accum)
* for a state transition?
*/
if (clock_systimer() - pdomstate->btime >=
if (clock_systime_ticks() - pdomstate->btime >=
g_pm_activity_governor.pmcount[index] * TIME_SLICE_TICKS)
{
/* Yes, recommend the new state and set up for the next
* transition.
*/
pdomstate->btime = clock_systimer();
pdomstate->btime = clock_systime_ticks();
pdomstate->recommended = nextstate;
}
}
@ -504,7 +504,7 @@ static enum pm_state_e governor_checkstate(int domain)
* estimated.
*/
now = clock_systimer();
now = clock_systime_ticks();
elapsed = now - pdomstate->stime;
if (elapsed >= TIME_SLICE_TICKS)
{
@ -597,7 +597,7 @@ static void governor_timer(int domain)
if (state < PM_SLEEP && !pdom->stay[pdom->state])
{
int delay = pmtick[state] + pdomstate->btime - clock_systimer();
int delay = pmtick[state] + pdomstate->btime - clock_systime_ticks();
int left = wd_gettime(pdomstate->wdog);
if (delay <= 0)

View File

@ -495,7 +495,7 @@ static int uart_tcdrain(FAR uart_dev_t *dev, clock_t timeout)
* all also cause the lower half driver to clear and reset the Tx FIFO.
*/
start = clock_systimer();
start = clock_systime_ticks();
if (ret >= 0)
{
@ -507,7 +507,7 @@ static int uart_tcdrain(FAR uart_dev_t *dev, clock_t timeout)
/* Check for a timeout */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
if (elapsed >= timeout)
{
return -ETIMEDOUT;

View File

@ -1,7 +1,8 @@
/****************************************************************************
* drivers/syslog/vsyslog.c
*
* Copyright (C) 2007-2009, 2011-2014, 2016-2017 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009, 2011-2014, 2016-2017 Gregory Nutt.
* All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -97,7 +98,7 @@ int nx_vsyslog(int priority, FAR const IPTR char *fmt, FAR va_list *ap)
#else
/* Otherwise, fall back to the system timer */
ret = clock_systimespec(&ts);
ret = clock_systime_timespec(&ts);
#endif
}
@ -132,7 +133,7 @@ int nx_vsyslog(int priority, FAR const IPTR char *fmt, FAR va_list *ap)
/* Pre-pend the message with the current time, if available */
ret = lib_sprintf(&stream.public, "[%5d.%06d] ",
ts.tv_sec, ts.tv_nsec/1000);
ts.tv_sec, ts.tv_nsec / 1000);
#else
ret = 0;
#endif

View File

@ -1849,7 +1849,7 @@ static ssize_t max3421e_out_transfer(FAR struct max3421e_usbhost_s *priv,
* or a fatal error occurs (any error other than a simple NAK)
*/
start = clock_systimer();
start = clock_systime_ticks();
xfrd = 0;
while (buflen > 0)
@ -1902,7 +1902,7 @@ static ssize_t max3421e_out_transfer(FAR struct max3421e_usbhost_s *priv,
* pointer and buffer size will be unaltered.
*/
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
if (ret != -EAGAIN || /* Not a NAK condition OR */
elapsed >= MAX3421E_DATANAK_DELAY || /* Timeout has elapsed OR */
priv->xfrd > 0) /* Data has been partially transferred */
@ -2071,7 +2071,7 @@ static int max3421e_ctrl_sendsetup(FAR struct max3421e_usbhost_s *priv,
/* Loop while the device reports NAK (and a timeout is not exceeded */
start = clock_systimer();
start = clock_systime_ticks();
do
{
/* Send the SETUP packet */
@ -2146,7 +2146,7 @@ static int max3421e_ctrl_sendsetup(FAR struct max3421e_usbhost_s *priv,
/* Get the elapsed time (in frames) */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
}
while (elapsed < MAX3421E_SETUP_DELAY);
@ -2687,7 +2687,7 @@ static ssize_t max3421e_in_transfer(FAR struct max3421e_usbhost_s *priv,
priv->xfrd = 0;
xfrd = 0;
start = clock_systimer();
start = clock_systime_ticks();
while (priv->xfrd < priv->buflen)
{
/* Set up for the wait BEFORE starting the transfer */
@ -2747,7 +2747,7 @@ static ssize_t max3421e_in_transfer(FAR struct max3421e_usbhost_s *priv,
* if not then try again.
*/
clock_t elapsed = clock_systimer() - start;
clock_t elapsed = clock_systime_ticks() - start;
if (elapsed >= MAX3421E_DATANAK_DELAY)
{
/* Timeout out... break out returning the NAK as
@ -4090,7 +4090,7 @@ static int max3421e_ctrlin(FAR struct usbhost_driver_s *drvr,
/* Get the start time. Loop again until the timeout expires */
start = clock_systimer();
start = clock_systime_ticks();
do
{
/* Handle the IN data phase (if any) */
@ -4127,7 +4127,7 @@ static int max3421e_ctrlin(FAR struct usbhost_driver_s *drvr,
/* Get the elapsed time (in frames) */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
}
while (elapsed < MAX3421E_DATANAK_DELAY);
}
@ -4190,7 +4190,7 @@ static int max3421e_ctrlout(FAR struct usbhost_driver_s *drvr,
/* Get the start time. Loop again until the timeout expires */
start = clock_systimer();
start = clock_systime_ticks();
do
{
/* Handle the data OUT phase (if any) */
@ -4229,7 +4229,7 @@ static int max3421e_ctrlout(FAR struct usbhost_driver_s *drvr,
/* Get the elapsed time (in frames) */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
}
while (elapsed < MAX3421E_DATANAK_DELAY);
}

View File

@ -683,7 +683,8 @@ static void nrf24l01_worker(FAR void *arg)
* - Read payload content
*/
pipeno = (status & NRF24L01_RX_P_NO_MASK) >> NRF24L01_RX_P_NO_SHIFT;
pipeno = (status & NRF24L01_RX_P_NO_MASK) >>
NRF24L01_RX_P_NO_SHIFT;
if (pipeno >= NRF24L01_PIPE_COUNT) /* 6=invalid 7=fifo empty */
{
wlerr("invalid pipe rx: %d\n", (int)pipeno);
@ -711,7 +712,8 @@ static void nrf24l01_worker(FAR void *arg)
/* Get payload content */
nrf24l01_access(dev, MODE_READ, NRF24L01_R_RX_PAYLOAD, buf, pktlen);
nrf24l01_access(dev, MODE_READ,
NRF24L01_R_RX_PAYLOAD, buf, pktlen);
fifoput(dev, pipeno, buf, pktlen);
has_data = true;
@ -860,7 +862,7 @@ static int dosend(FAR struct nrf24l01_dev_s *dev, FAR const uint8_t *data,
/* Wait for IRQ (TX_DS or MAX_RT) - but don't hang on lost IRQ */
ret = nxsem_tickwait(&dev->sem_tx, clock_systimer(),
ret = nxsem_tickwait(&dev->sem_tx, clock_systime_ticks(),
MSEC2TICK(NRF24L01_MAX_TX_IRQ_WAIT));
/* Re-acquire the SPI bus */
@ -1201,7 +1203,7 @@ static int nrf24l01_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
case NRF24L01IOC_GETRETRCFG: /* Get retransmit params. arg: Pointer
* to nrf24l01_retrcfg_t */
ret = -ENOSYS; /* TODO */
ret = -ENOSYS; /* TODO */
break;
case NRF24L01IOC_SETPIPESCFG:
@ -1802,7 +1804,8 @@ int nrf24l01_setretransmit(FAR struct nrf24l01_dev_s *dev,
CHECK_ARGS(dev && retrcount <= NRF24L01_MAX_XMIT_RETR);
val = (retrdelay << NRF24L01_ARD_SHIFT) | (retrcount << NRF24L01_ARC_SHIFT);
val = (retrdelay << NRF24L01_ARD_SHIFT) |
(retrcount << NRF24L01_ARC_SHIFT);
nrf24l01_lock(dev->spi);

View File

@ -670,7 +670,7 @@ int spirit_waitstatus(FAR struct spirit_library_s *spirit,
/* The time that we started the wait */
start = clock_systimer();
start = clock_systime_ticks();
/* Loop until the status change occurs (or the wait times out) */
@ -682,7 +682,7 @@ int spirit_waitstatus(FAR struct spirit_library_s *spirit,
return ret;
}
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
}
while (spirit->u.state.MC_STATE != state && elapsed <= ticks);

View File

@ -241,7 +241,7 @@ static ssize_t uptime_read(FAR struct file *filep, FAR char *buffer,
{
/* System time */
ticktime = clock_systimer() - INITIAL_SYSTEM_TIMER_TICKS;
ticktime = clock_systime_ticks() - INITIAL_SYSTEM_TIMER_TICKS;
#if defined(CONFIG_HAVE_DOUBLE) && defined(CONFIG_LIBC_FLOATINGPOINT)
/* Convert the up time to a seconds + hundredths of seconds string */

View File

@ -468,7 +468,7 @@ int nx_poll(FAR struct pollfd *fds, unsigned int nfds, int timeout)
* will return immediately.
*/
ret = nxsem_tickwait(&sem, clock_systimer(), ticks);
ret = nxsem_tickwait(&sem, clock_systime_ticks(), ticks);
if (ret < 0)
{
if (ret == -ETIMEDOUT)

View File

@ -243,7 +243,7 @@ extern "C"
EXTERN volatile clock_t g_system_timer;
#ifndef CONFIG_SYSTEM_TIME64
# define clock_systimer() g_system_timer
# define clock_systime_ticks() g_system_timer
#endif
#endif
@ -366,7 +366,7 @@ void clock_resynchronize(FAR struct timespec *rtc_diff);
#endif
/****************************************************************************
* Name: clock_systimer
* Name: clock_systime_ticks
*
* Description:
* Return the current value of the 32/64-bit system timer counter.
@ -391,11 +391,11 @@ void clock_resynchronize(FAR struct timespec *rtc_diff);
****************************************************************************/
#if !defined(__HAVE_KERNEL_GLOBALS) || defined(CONFIG_SYSTEM_TIME64)
clock_t clock_systimer(void);
clock_t clock_systime_ticks(void);
#endif
/****************************************************************************
* Name: clock_systimespec
* Name: clock_systime_timespec
*
* Description:
* Return the current value of the system timer counter as a struct
@ -411,7 +411,7 @@ clock_t clock_systimer(void);
*
****************************************************************************/
int clock_systimespec(FAR struct timespec *ts);
int clock_systime_timespec(FAR struct timespec *ts);
/****************************************************************************
* Name: clock_cpuload

View File

@ -231,7 +231,7 @@ int arp_update(in_addr_t ipaddr, FAR uint8_t *ethaddr)
tabptr->at_ipaddr = ipaddr;
memcpy(tabptr->at_ethaddr.ether_addr_octet, ethaddr, ETHER_ADDR_LEN);
tabptr->at_time = clock_systimer();
tabptr->at_time = clock_systime_ticks();
return OK;
}
@ -290,7 +290,7 @@ FAR struct arp_entry_s *arp_lookup(in_addr_t ipaddr)
{
tabptr = &g_arptable[i];
if (net_ipv4addr_cmp(ipaddr, tabptr->at_ipaddr) &&
clock_systimer() - tabptr->at_time <= ARP_MAXAGE_TICK)
clock_systime_ticks() - tabptr->at_time <= ARP_MAXAGE_TICK)
{
return tabptr;
}
@ -424,7 +424,7 @@ unsigned int arp_snapshot(FAR struct arp_entry_s *snapshot,
/* Copy all non-empty, non-expired entries in the ARP table. */
for (i = 0, now = clock_systimer(), ncopied = 0;
for (i = 0, now = clock_systime_ticks(), ncopied = 0;
nentries > ncopied && i < CONFIG_NET_ARPTAB_SIZE;
i++)
{

View File

@ -118,7 +118,7 @@ void neighbor_add(FAR struct net_driver_s *dev, FAR net_ipv6addr_t ipaddr,
* "oldest_ndx" variable).
*/
g_neighbors[oldest_ndx].ne_time = clock_systimer();
g_neighbors[oldest_ndx].ne_time = clock_systime_ticks();
net_ipv6addr_copy(g_neighbors[oldest_ndx].ne_ipaddr, ipaddr);
g_neighbors[oldest_ndx].ne_addr.na_lltype = lltype;

View File

@ -72,6 +72,6 @@ void neighbor_update(const net_ipv6addr_t ipaddr)
neighbor = neighbor_findentry(ipaddr);
if (neighbor != NULL)
{
neighbor->ne_time = clock_systimer();
neighbor->ne_time = clock_systime_ticks();
}
}

View File

@ -157,7 +157,7 @@ static void sixlowpan_reass_expire(void)
{
/* Get the elpased time of the reassembly */
elapsed = clock_systimer() - reass->rb_time;
elapsed = clock_systime_ticks() - reass->rb_time;
/* If the reassembly has expired, then free the reassembly buffer */
@ -336,7 +336,7 @@ FAR struct sixlowpan_reassbuf_s *
reass->rb_pool = pool;
reass->rb_active = true;
reass->rb_reasstag = reasstag;
reass->rb_time = clock_systimer();
reass->rb_time = clock_systime_ticks();
/* Add the reassembly buffer to the list of active reassembly buffers */

View File

@ -73,7 +73,7 @@
int net_timeo(clock_t start_time, socktimeo_t timeo)
{
clock_t timeo_ticks = DSEC2TICK(timeo);
clock_t elapsed = clock_systimer() - start_time;
clock_t elapsed = clock_systime_ticks() - start_time;
if (elapsed >= timeo_ticks)
{

View File

@ -720,7 +720,7 @@ FAR struct tcp_conn_s *tcp_alloc(uint8_t domain)
conn->domain = domain;
#endif
#ifdef CONFIG_NET_TCP_KEEPALIVE
conn->keeptime = clock_systimer();
conn->keeptime = clock_systime_ticks();
conn->keepidle = 2 * DSEC_PER_HOUR;
conn->keepintvl = 2 * DSEC_PER_SEC;
conn->keepcnt = 3;

View File

@ -839,7 +839,7 @@ found:
* alive is enabled for this connection.
*/
conn->keeptime = clock_systimer();
conn->keeptime = clock_systime_ticks();
conn->keepretries = 0;
}
#endif

View File

@ -141,7 +141,7 @@ int tcp_setsockopt(FAR struct socket *psock, int option,
else
{
conn->keepalive = (bool)keepalive;
conn->keeptime = clock_systimer(); /* Reset start time */
conn->keeptime = clock_systime_ticks(); /* Reset start time */
ret = OK;
}
}
@ -183,7 +183,7 @@ int tcp_setsockopt(FAR struct socket *psock, int option,
else
{
conn->keepidle = (uint16_t)dsecs;
conn->keeptime = clock_systimer(); /* Reset start time */
conn->keeptime = clock_systime_ticks(); /* Reset start time */
ret = OK;
}
}
@ -221,7 +221,7 @@ int tcp_setsockopt(FAR struct socket *psock, int option,
else
{
conn->keepintvl = (uint16_t)dsecs;
conn->keeptime = clock_systimer(); /* Reset start time */
conn->keeptime = clock_systime_ticks(); /* Reset start time */
ret = OK;
}
}
@ -245,7 +245,7 @@ int tcp_setsockopt(FAR struct socket *psock, int option,
else
{
conn->keepcnt = (uint8_t)keepcnt;
conn->keeptime = clock_systimer(); /* Reset start time */
conn->keeptime = clock_systime_ticks(); /* Reset start time */
ret = OK;
}
}

View File

@ -477,7 +477,7 @@ void tcp_timer(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
#endif
/* Update for the next probe */
conn->keeptime = clock_systimer();
conn->keeptime = clock_systime_ticks();
conn->keepretries++;
}

View File

@ -0,0 +1,29 @@
From fa4904c9d9ad16e791485d0ef22566427869144c Mon Sep 17 00:00:00 2001
From: Xiang Xiao <xiaoxiang@xiaomi.com>
Date: Mon, 11 May 2020 00:03:51 +0800
Subject: [PATCH] system: nuttx: change clock_systimespec to
clock_systime_timespec
follow up the change from NuttX side
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
---
lib/system/nuttx/time.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/system/nuttx/time.c libmetal/lib/system/nuttx/time.c
index bafc957..986f1ba 100644
--- a/lib/system/nuttx/time.c
+++ libmetal/lib/system/nuttx/time.c
@@ -18,7 +18,7 @@ unsigned long long metal_get_timestamp(void)
struct timespec tp;
int r;
- r = clock_systimespec(&tp);
+ r = clock_systime_timespec(&tp);
if (!r) {
t = (unsigned long long)tp.tv_sec * NSEC_PER_SEC;
t += tp.tv_nsec;
--
2.17.1

View File

@ -78,6 +78,7 @@ libmetal.zip:
$(Q) wget https://github.com/OpenAMP/libmetal/archive/v$(VERSION).zip -O libmetal.zip
$(Q) unzip -o libmetal.zip
$(Q) mv libmetal-$(VERSION) libmetal
$(Q) patch -p0 < 0001-system-nuttx-change-clock_systimespec-to-clock_systi.patch
.libmetal_headers: libmetal.zip
$(eval headers := $(wildcard libmetal/lib/compiler/gcc/*.h))

View File

@ -110,7 +110,7 @@ config USEC_PER_TICK
If SCHED_TICKLESS is selected, then there are no system timer
interrupts. In this case, USEC_PER_TICK does not control any timer
rates. Rather, it only determines the resolution of time reported
by clock_systimer() and the resolution of times that can be set for
by clock_systime_ticks() and the resolution of times that can be set for
certain delays including watchdog timers and delayed work. In this
case there is a trade-off: It is better to have the USEC_PER_TICK as
low as possible for higher timing resolution. However, the time

View File

@ -35,7 +35,7 @@
CSRCS += clock_initialize.c clock_settime.c clock_gettime.c clock_getres.c
CSRCS += clock_time2ticks.c clock_abstime2ticks.c clock_ticks2time.c
CSRCS += clock_systimer.c clock_systimespec.c clock_timespec_add.c
CSRCS += clock_systime_ticks.c clock_systime_timespec.c clock_timespec_add.c
CSRCS += clock_timespec_subtract.c clock.c
ifeq ($(CONFIG_CLOCK_TIMEKEEPING),y)

View File

@ -75,5 +75,5 @@
clock_t clock(void)
{
return (clock_t)clock_systimer();
return (clock_t)clock_systime_ticks();
}

View File

@ -1,7 +1,8 @@
/****************************************************************************
* sched/clock/clock_gettime.c
*
* Copyright (C) 2007, 2009, 2011, 2014, 2016 Gregory Nutt. All rights reserved.
* Copyright (C) 2007, 2009, 2011, 2014, 2016 Gregory Nutt.
* All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -93,7 +94,7 @@ int clock_gettime(clockid_t clock_id, struct timespec *tp)
* reset.
*/
ret = clock_systimespec(tp);
ret = clock_systime_timespec(tp);
}
else
#endif
@ -107,7 +108,7 @@ int clock_gettime(clockid_t clock_id, struct timespec *tp)
if (clock_id == CLOCK_REALTIME)
{
/* Get the elapsed time since the time-of-day was last set.
* clock_systimespec() provides the time since power was applied;
* clock_systime_timespec() provides the time since power was applied;
* the bias value corresponds to the time when the time-of-day was
* last set.
*/
@ -115,7 +116,7 @@ int clock_gettime(clockid_t clock_id, struct timespec *tp)
#if defined(CONFIG_CLOCK_TIMEKEEPING)
ret = clock_timekeeping_get_wall_time(tp);
#else
ret = clock_systimespec(&ts);
ret = clock_systime_timespec(&ts);
if (ret == OK)
{
irqstate_t flags;

View File

@ -179,7 +179,7 @@ static void clock_inittime(void)
struct timespec ts;
clock_basetime(&g_basetime);
clock_systimespec(&ts);
clock_systime_timespec(&ts);
/* Adjust base time to hide initial timer ticks. */
@ -336,7 +336,7 @@ void clock_resynchronize(FAR struct timespec *rtc_diff)
* bias value that we need to use to correct the base time.
*/
clock_systimespec(&bias);
clock_systime_timespec(&bias);
/* Add the base time to this. The base time is the time-of-day
* setting. When added to the elapsed time since the time-of-day
@ -358,7 +358,8 @@ void clock_resynchronize(FAR struct timespec *rtc_diff)
/* Check if RTC has advanced past system time. */
if (curr_ts.tv_sec > rtc_time.tv_sec ||
(curr_ts.tv_sec == rtc_time.tv_sec && curr_ts.tv_nsec >= rtc_time.tv_nsec))
(curr_ts.tv_sec == rtc_time.tv_sec &&
curr_ts.tv_nsec >= rtc_time.tv_nsec))
{
/* Setting system time with RTC now would result time going
* backwards. Skip resynchronization.

View File

@ -91,7 +91,7 @@ int clock_settime(clockid_t clock_id, FAR const struct timespec *tp)
* bias value that we need to use to correct the base time.
*/
clock_systimespec(&bias);
clock_systime_timespec(&bias);
/* Save the new base time. */

View File

@ -1,5 +1,5 @@
/****************************************************************************
* sched/clock/clock_systimer.c
* sched/clock/clock_systime_ticks.c
*
* Copyright (C) 2011, 2014-2016, 2018 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@ -53,7 +53,7 @@
/* See nuttx/clock.h */
#undef clock_systimer
#undef clock_systime_ticks
/* 32-bit mask for 64-bit timer values */
@ -64,7 +64,7 @@
****************************************************************************/
/****************************************************************************
* Name: clock_systimer
* Name: clock_systime_ticks
*
* Description:
* Return the current value of the 32/64-bit system timer counter.
@ -88,7 +88,7 @@
*
****************************************************************************/
clock_t clock_systimer(void)
clock_t clock_systime_ticks(void)
{
#ifdef CONFIG_SCHED_TICKLESS
# ifdef CONFIG_SYSTEM_TIME64
@ -97,7 +97,7 @@ clock_t clock_systimer(void)
/* Get the time from the platform specific hardware */
clock_systimespec(&ts);
clock_systime_timespec(&ts);
/* Convert to a 64-bit value in microseconds, then in clock tick units */
@ -110,7 +110,7 @@ clock_t clock_systimer(void)
/* Get the time from the platform specific hardware */
clock_systimespec(&ts);
clock_systime_timespec(&ts);
/* Convert to a 64- then a 32-bit value */

View File

@ -1,5 +1,5 @@
/****************************************************************************
* sched/clock/clock_systimespec.c
* sched/clock/clock_systime_timespec.c
*
* Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@ -53,7 +53,7 @@
****************************************************************************/
/****************************************************************************
* Name: clock_systimespec
* Name: clock_systime_timespec
*
* Description:
* Return the current value of the system timer counter as a struct
@ -70,7 +70,7 @@
*
****************************************************************************/
int clock_systimespec(FAR struct timespec *ts)
int clock_systime_timespec(FAR struct timespec *ts)
{
#ifdef CONFIG_RTC_HIRES
/* Do we have a high-resolution RTC that can provide us with the time? */
@ -144,7 +144,7 @@ int clock_systimespec(FAR struct timespec *ts)
* timer.
*/
usecs = (uint64_t)TICK2USEC(clock_systimer());
usecs = (uint64_t)TICK2USEC(clock_systime_ticks());
secs = usecs / USEC_PER_SEC;
/* Return the elapsed time in seconds and nanoseconds */
@ -183,7 +183,7 @@ int clock_systimespec(FAR struct timespec *ts)
/* Get the time since power-on in seconds and milliseconds */
msecs = TICK2MSEC(WIDE_CAST clock_systimer());
msecs = TICK2MSEC(WIDE_CAST clock_systime_ticks());
secs = msecs / MSEC_PER_SEC;
/* Return the elapsed time in seconds and nanoseconds */

View File

@ -132,7 +132,7 @@ int irq_attach(int irq, xcpt_t isr, FAR void *arg)
g_irqvector[ndx].handler = isr;
g_irqvector[ndx].arg = arg;
#ifdef CONFIG_SCHED_IRQMONITOR
g_irqvector[ndx].start = clock_systimer();
g_irqvector[ndx].start = clock_systime_ticks();
#ifdef CONFIG_HAVE_LONG_LONG
g_irqvector[ndx].count = 0;
#else

View File

@ -75,8 +75,8 @@
while (0)
#endif
/* CALL_VECTOR - Call the interrupt service routine attached to this interrupt
* request
/* CALL_VECTOR - Call the interrupt service routine attached to this
* interrupt request
*/
#ifndef CONFIG_SCHED_IRQMONITOR
@ -106,9 +106,9 @@
struct timespec start; \
struct timespec end; \
struct timespec delta; \
clock_systimespec(&start); \
clock_systime_timespec(&start); \
vector(irq, context, arg); \
clock_systimespec(&end); \
clock_systime_timespec(&end); \
clock_timespec_subtract(&end, &start, &delta); \
if (delta.tv_nsec > g_irqvector[ndx].time) \
{ \

View File

@ -172,7 +172,7 @@ static int irq_callback(int irq, FAR struct irq_info_s *info,
flags = enter_critical_section();
memcpy(&copy, info, sizeof(struct irq_info_s));
now = clock_systimer();
now = clock_systime_ticks();
info->start = now;
#ifdef CONFIG_HAVE_LONG_LONG
info->count = 0;

View File

@ -401,7 +401,7 @@ static inline bool pg_startfill(void)
*/
#ifdef CONFIG_PAGING_TIMEOUT_TICKS
g_starttime = clock_systimer();
g_starttime = clock_systime_ticks();
#endif
/* Return and wait to be signaled for the next event -- the fill
@ -612,7 +612,7 @@ int pg_worker(int argc, char *argv[])
else
{
pgerr("ERROR: Timeout!\n");
DEBUGASSERT(clock_systimer() - g_starttime <
DEBUGASSERT(clock_systime_ticks() - g_starttime <
CONFIG_PAGING_TIMEOUT_TICKS);
}
#endif

View File

@ -149,7 +149,7 @@ static void note_common(FAR struct tcb_s *tcb,
FAR struct note_common_s *note,
uint8_t length, uint8_t type)
{
uint32_t systime = (uint32_t)clock_systimer();
uint32_t systime = (uint32_t)clock_systime_ticks();
/* Save all of the common fields */

View File

@ -285,7 +285,7 @@ static int sporadic_budget_start(FAR struct replenishment_s *mrepl)
/* Save the time that the budget was started */
sporadic->eventtime = clock_systimer();
sporadic->eventtime = clock_systime_ticks();
/* And start the timer for the budget interval */
@ -507,7 +507,7 @@ static void sporadic_budget_expire(int argc, wdparm_t arg1, ...)
* that the thread was delayed for the entire interval).
*/
unrealized = sporadic->eventtime - clock_systimer();
unrealized = sporadic->eventtime - clock_systime_ticks();
if (unrealized > 0)
{
/* Allocate a new replenishment timer. This will limit us to the
@ -857,7 +857,7 @@ int nxsched_start_sporadic(FAR struct tcb_s *tcb)
/* Save the time that the scheduler was started */
sporadic->eventtime = clock_systimer();
sporadic->eventtime = clock_systime_ticks();
sporadic->suspended = true;
/* Then start the first interval */
@ -1025,7 +1025,7 @@ int nxsched_resume_sporadic(FAR struct tcb_s *tcb)
/* Get the time that the thread was [re-]started */
now = clock_systimer();
now = clock_systime_ticks();
/* Check if are in the budget portion of the replenishment interval. We
* know this is the case if the current timeslice is non-zero.
@ -1154,7 +1154,7 @@ int nxsched_suspend_sporadic(FAR struct tcb_s *tcb)
/* Save the time that the thread was suspended */
sporadic->eventtime = clock_systimer();
sporadic->eventtime = clock_systime_ticks();
}
return OK;

View File

@ -121,7 +121,7 @@ int nxsem_tickwait(FAR sem_t *sem, clock_t start, uint32_t delay)
/* Adjust the delay for any time since the delay was calculated */
elapsed = clock_systimer() - start;
elapsed = clock_systime_ticks() - start;
if (/* elapsed >= (UINT32_MAX / 2) || */ elapsed >= delay)
{
ret = -ETIMEDOUT;

View File

@ -124,7 +124,7 @@ int nxsig_nanosleep(FAR const struct timespec *rqtp,
*/
flags = enter_critical_section();
starttick = clock_systimer();
starttick = clock_systime_ticks();
/* Set up for the sleep. Using the empty set means that we are not
* waiting for any particular signal. However, any unmasked signal can
@ -173,7 +173,7 @@ int nxsig_nanosleep(FAR const struct timespec *rqtp,
/* Get the number of ticks that we actually waited */
elapsed = clock_systimer() - starttick;
elapsed = clock_systime_ticks() - starttick;
/* The difference between the number of ticks that we were requested
* to wait and the number of ticks that we actually waited is that

View File

@ -246,7 +246,7 @@ int wd_start(WDOG_ID wdog, int32_t delay, wdentry_t wdentry, int argc, ...)
#ifdef CONFIG_SCHED_TICKLESS
/* Update clock tickbase */
g_wdtickbase = clock_systimer();
g_wdtickbase = clock_systime_ticks();
#endif
/* Add the watchdog to the head == tail of the queue. */

View File

@ -50,7 +50,7 @@
****************************************************************************/
#ifdef CONFIG_SCHED_TICKLESS
# define wd_elapse() (clock_systimer() - g_wdtickbase)
# define wd_elapse() (clock_systime_ticks() - g_wdtickbase)
#else
# define wd_elapse() (0)
#endif

View File

@ -105,7 +105,7 @@ void work_process(FAR struct kwork_wqueue_s *wqueue, int wndx)
/* Get the time that we started processing the queue in clock ticks. */
stick = clock_systimer();
stick = clock_systime_ticks();
/* And check each entry in the work queue. Since we have disabled
* interrupts we know: (1) we will not be suspended unless we do
@ -121,7 +121,7 @@ void work_process(FAR struct kwork_wqueue_s *wqueue, int wndx)
* zero. Therefore a delay of zero will always execute immediately.
*/
ctick = clock_systimer();
ctick = clock_systime_ticks();
elapsed = ctick - work->qtime;
if (elapsed >= work->delay)
{

View File

@ -104,7 +104,7 @@ static void work_qqueue(FAR struct kwork_wqueue_s *wqueue,
/* Now, time-tag that entry and put it in the work queue */
work->qtime = clock_systimer(); /* Time work queued */
work->qtime = clock_systime_ticks(); /* Time work queued */
dq_addlast((FAR dq_entry_t *)work, &wqueue->q);

View File

@ -696,7 +696,7 @@ void mac802154_setupindirect(FAR struct ieee802154_privmac_s *priv,
ticks = mac802154_symtoticks(priv, symbols);
txdesc->purgetime = clock_systimer() + ticks;
txdesc->purgetime = clock_systime_ticks() + ticks;
/* Make sure the beacon gets updated */
@ -763,7 +763,7 @@ static void mac802154_purge_worker(FAR void *arg)
* since in scheduling the timer to expire in only a few ticks.
*/
if (clock_systimer() >= txdesc->purgetime)
if (clock_systime_ticks() >= txdesc->purgetime)
{
/* Unlink the transaction */
@ -784,7 +784,7 @@ static void mac802154_purge_worker(FAR void *arg)
/* Reschedule the transaction for the next timeout */
work_queue(HPWORK, &priv->purge_work, mac802154_purge_worker,
(FAR void *)priv, txdesc->purgetime - clock_systimer());
priv, txdesc->purgetime - clock_systime_ticks());
break;
}
}