mirror of
https://github.com/apache/nuttx.git
synced 2026-06-02 01:21:26 +08:00
!nuttx: drop redundant casts on tv_sec/tv_nsec and fix printf formats
Now that time_t is unconditionally 64-bit (signed int64_t) and the
struct timespec fields tv_sec / tv_nsec are wide enough on their own,
the explicit (uint64_t)/(int64_t)/(int) casts that used to guard the
multiplications and subtractions in *_us / *_ms / *_ns helpers are no
longer needed. Drop them to keep the timekeeping math readable and
consistent with the previous sclock_t/time_t cleanup.
In the same spirit, this commit also:
* Normalises the printf-style format specifiers and casts used to
print tv_sec / tv_nsec / tv_usec values across arch/, drivers/,
fs/, sched/ and libs/. The prior code was a mix of
"%d"/"%u"/"%ld"/"%lu"/"%lld"/PRIu32/PRIu64 with matching
(int)/(unsigned long)/(long long)/PRIu* casts; some formats
truncated time_t on 32-bit hosts, others mismatched signedness or
width. Replace all such cases with the portable POSIX-recommended
forms:
- tv_sec (time_t, signed, impl-defined width) -> %jd + (intmax_t)
- tv_nsec (long, signed) -> %ld (no cast)
- tv_usec (suseconds_t / long) -> %ld (no cast)
Add #include <stdint.h> where required.
* Drops a few stale `(FAR const time_t *)&ts.tv_sec` casts and
related `(FAR struct tm *)` / `(const time_t *)` casts in
gmtime_r() / localtime_r() / gmtime() callers; ts.tv_sec is plain
time_t now and the casts only obscured the type.
* Fixes one overflow in fs/procfs/fs_procfscritmon.c where
all_time.tv_sec * 1000000 could overflow on 32-bit time_t before
being multiplied again; cast to uint64_t at the start.
No behavioural change.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
@@ -75,7 +75,7 @@
|
|||||||
|
|
||||||
/* convert seconds to 64bit counter value running at 32kHz */
|
/* convert seconds to 64bit counter value running at 32kHz */
|
||||||
|
|
||||||
#define SEC_TO_CNT(sec) ((uint64_t)(((uint64_t)(sec)) << 15))
|
#define SEC_TO_CNT(sec) (((uint64_t)(sec)) << 15)
|
||||||
|
|
||||||
/* convert nano-seconds to 32kHz counter less than 1 second */
|
/* convert nano-seconds to 32kHz counter less than 1 second */
|
||||||
|
|
||||||
@@ -157,7 +157,7 @@ static void rtc_dumptime(const struct timespec *tp, const char *msg)
|
|||||||
gmtime_r(&tp->tv_sec, &tm);
|
gmtime_r(&tp->tv_sec, &tm);
|
||||||
|
|
||||||
rtcinfo("%s:\n", msg);
|
rtcinfo("%s:\n", msg);
|
||||||
rtcinfo("RTC %u.%09u\n", tp->tv_sec, tp->tv_nsec);
|
rtcinfo("RTC %jd.%09ld\n", (intmax_t)tp->tv_sec, tp->tv_nsec);
|
||||||
rtcinfo("%4d/%02d/%02d %02d:%02d:%02d\n",
|
rtcinfo("%4d/%02d/%02d %02d:%02d:%02d\n",
|
||||||
tm.tm_year, tm.tm_mon, tm.tm_mday,
|
tm.tm_year, tm.tm_mon, tm.tm_mday,
|
||||||
tm.tm_hour, tm.tm_min, tm.tm_sec);
|
tm.tm_hour, tm.tm_min, tm.tm_sec);
|
||||||
|
|||||||
@@ -336,7 +336,7 @@ static int cxd56_getstatus(struct timer_lowerhalf_s *lower,
|
|||||||
|
|
||||||
/* Get the time remaining until the timer expires (in microseconds). */
|
/* Get the time remaining until the timer expires (in microseconds). */
|
||||||
|
|
||||||
remaining = (uint64_t)getreg32(priv->base + CXD56_TIMER_VALUE);
|
remaining = getreg32(priv->base + CXD56_TIMER_VALUE);
|
||||||
status->timeleft =
|
status->timeleft =
|
||||||
(uint32_t)(remaining * 1000000ULL * TIMER_DIVIDER / priv->clkticks);
|
(uint32_t)(remaining * 1000000ULL * TIMER_DIVIDER / priv->clkticks);
|
||||||
|
|
||||||
|
|||||||
@@ -391,7 +391,7 @@ static int cxd56_getstatus(struct watchdog_lowerhalf_s *lower,
|
|||||||
|
|
||||||
/* Get the time remaining until the watchdog expires (in milliseconds) */
|
/* Get the time remaining until the watchdog expires (in milliseconds) */
|
||||||
|
|
||||||
remain = (uint64_t)cxd56_getreg(CXD56_WDT_WDOGVALUE);
|
remain = cxd56_getreg(CXD56_WDT_WDOGVALUE);
|
||||||
status->timeleft = (uint32_t)(remain * 1000 / cxd56_get_cpu_baseclk());
|
status->timeleft = (uint32_t)(remain * 1000 / cxd56_get_cpu_baseclk());
|
||||||
if (cxd56_getreg(CXD56_WDT_WDOGRIS) != WDOGRIS_RAWINT)
|
if (cxd56_getreg(CXD56_WDT_WDOGRIS) != WDOGRIS_RAWINT)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -431,7 +431,7 @@ int up_rtc_gettime(struct timespec *tp)
|
|||||||
tp->tv_nsec = (val % CONFIG_RTC_FREQUENCY) *
|
tp->tv_nsec = (val % CONFIG_RTC_FREQUENCY) *
|
||||||
(NSEC_PER_SEC / CONFIG_RTC_FREQUENCY);
|
(NSEC_PER_SEC / CONFIG_RTC_FREQUENCY);
|
||||||
|
|
||||||
rtcinfo("Get RTC %u.%09u\n", tp->tv_sec, tp->tv_nsec);
|
rtcinfo("Get RTC %jd.%09ld\n", (intmax_t)tp->tv_sec, tp->tv_nsec);
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@@ -481,8 +481,8 @@ int up_rtc_settime(const struct timespec *tp)
|
|||||||
cnt_carry = val / __CNT_TOP;
|
cnt_carry = val / __CNT_TOP;
|
||||||
cnt = val % __CNT_TOP;
|
cnt = val % __CNT_TOP;
|
||||||
|
|
||||||
rtcinfo("Set RTC %u.%09u carry %u zero %u reg %u\n",
|
rtcinfo("Set RTC %jd.%09ld carry %u zero %u reg %u\n",
|
||||||
tp->tv_sec, tp->tv_nsec, cnt_carry, cnt, cnt_reg);
|
(intmax_t)tp->tv_sec, tp->tv_nsec, cnt_carry, cnt, cnt_reg);
|
||||||
|
|
||||||
putreg32(cnt_carry, __CNT_CARRY_REG);
|
putreg32(cnt_carry, __CNT_CARRY_REG);
|
||||||
putreg32(cnt , __CNT_ZERO_REG);
|
putreg32(cnt , __CNT_ZERO_REG);
|
||||||
|
|||||||
@@ -515,8 +515,7 @@ static int kinetis_rdalarm(struct rtc_lowerhalf_s *lower,
|
|||||||
flags = enter_critical_section();
|
flags = enter_critical_section();
|
||||||
ret = kinetis_rtc_rdalarm(&ts);
|
ret = kinetis_rtc_rdalarm(&ts);
|
||||||
|
|
||||||
localtime_r((const time_t *)&ts.tv_sec,
|
localtime_r(&ts.tv_sec, (struct tm *)alarminfo->time);
|
||||||
(struct tm *)alarminfo->time);
|
|
||||||
leave_critical_section(flags);
|
leave_critical_section(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -727,6 +727,6 @@ int up_rtc_gettime(struct timespec *tp)
|
|||||||
tp->tv_sec = secs;
|
tp->tv_sec = secs;
|
||||||
tp->tv_nsec = nsecs;
|
tp->tv_nsec = nsecs;
|
||||||
|
|
||||||
tmrinfo("Returning tp=(%d,%d)\n", (int)tp->tv_sec, (int)tp->tv_nsec);
|
tmrinfo("Returning tp=(%jd,%ld)\n", (intmax_t)tp->tv_sec, tp->tv_nsec);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ void up_timer_initialize(void)
|
|||||||
* of the timer0 module clock (in the AHB0APB1_BASE domain (2)).
|
* of the timer0 module clock (in the AHB0APB1_BASE domain (2)).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
freq = (uint64_t)lpc31_clkfreq(CLKID_TIMER0PCLK, DOMAINID_AHB0APB1);
|
freq = lpc31_clkfreq(CLKID_TIMER0PCLK, DOMAINID_AHB0APB1);
|
||||||
|
|
||||||
/* If the clock is >1MHz, use pre-dividers */
|
/* If the clock is >1MHz, use pre-dividers */
|
||||||
|
|
||||||
|
|||||||
@@ -276,8 +276,8 @@ int sam_freerun_counter(struct sam_freerun_s *freerun, struct timespec *ts)
|
|||||||
ts->tv_sec = sec;
|
ts->tv_sec = sec;
|
||||||
ts->tv_nsec = (usec - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
ts->tv_nsec = (usec - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
||||||
|
|
||||||
tmrinfo("usec=%llu ts=(%lu, %lu)\n",
|
tmrinfo("usec=%llu ts=(%jd, %ld)\n",
|
||||||
usec, (unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
|
usec, (intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -233,7 +233,7 @@ int sam_oneshot_max_delay(struct sam_oneshot_s *oneshot, uint64_t *usec)
|
|||||||
{
|
{
|
||||||
DEBUGASSERT(oneshot && usec);
|
DEBUGASSERT(oneshot && usec);
|
||||||
*usec = (0xffffull * USEC_PER_SEC) /
|
*usec = (0xffffull * USEC_PER_SEC) /
|
||||||
(uint64_t)sam_tc_divfreq(oneshot->tch);
|
sam_tc_divfreq(oneshot->tch);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -266,9 +266,8 @@ int sam_oneshot_start(struct sam_oneshot_s *oneshot,
|
|||||||
uint64_t regval;
|
uint64_t regval;
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
|
|
||||||
tmrinfo("handler=%p arg=%p, ts=(%lu, %lu)\n",
|
tmrinfo("handler=%p arg=%p, ts=(%jd, %ld)\n",
|
||||||
handler, arg, (unsigned long)ts->tv_sec,
|
handler, arg, (intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
(unsigned long)ts->tv_nsec);
|
|
||||||
DEBUGASSERT(oneshot && handler && ts);
|
DEBUGASSERT(oneshot && handler && ts);
|
||||||
|
|
||||||
/* Was the oneshot already running? */
|
/* Was the oneshot already running? */
|
||||||
@@ -500,8 +499,8 @@ int sam_oneshot_cancel(struct sam_oneshot_s *oneshot,
|
|||||||
ts->tv_nsec = nsec;
|
ts->tv_nsec = nsec;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmrinfo("remaining (%lu, %lu)\n",
|
tmrinfo("remaining (%jd, %ld)\n",
|
||||||
(unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
|
(intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
}
|
}
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
|
|||||||
@@ -277,8 +277,8 @@ int sam_freerun_counter(struct sam_freerun_s *freerun, struct timespec *ts)
|
|||||||
ts->tv_sec = sec;
|
ts->tv_sec = sec;
|
||||||
ts->tv_nsec = (usec - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
ts->tv_nsec = (usec - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
||||||
|
|
||||||
tmrinfo("usec=%llu ts=(%lu, %lu)\n",
|
tmrinfo("usec=%llu ts=(%jd, %ld)\n",
|
||||||
usec, (unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
|
usec, (intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -243,7 +243,7 @@ int sam_oneshot_max_delay(struct sam_oneshot_s *oneshot, uint64_t *usec)
|
|||||||
{
|
{
|
||||||
DEBUGASSERT(oneshot != NULL && usec != NULL);
|
DEBUGASSERT(oneshot != NULL && usec != NULL);
|
||||||
*usec = (0xffffull * USEC_PER_SEC) /
|
*usec = (0xffffull * USEC_PER_SEC) /
|
||||||
(uint64_t)sam_tc_divfreq(oneshot->tch);
|
sam_tc_divfreq(oneshot->tch);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,9 +276,8 @@ int sam_oneshot_start(struct sam_oneshot_s *oneshot,
|
|||||||
uint64_t regval;
|
uint64_t regval;
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
|
|
||||||
tmrinfo("handler=%p arg=%p, ts=(%lu, %lu)\n",
|
tmrinfo("handler=%p arg=%p, ts=(%jd, %ld)\n",
|
||||||
handler, arg, (unsigned long)ts->tv_sec,
|
handler, arg, (intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
(unsigned long)ts->tv_nsec);
|
|
||||||
DEBUGASSERT(oneshot && handler && ts);
|
DEBUGASSERT(oneshot && handler && ts);
|
||||||
|
|
||||||
/* Was the oneshot already running? */
|
/* Was the oneshot already running? */
|
||||||
@@ -511,8 +510,8 @@ int sam_oneshot_cancel(struct sam_oneshot_s *oneshot,
|
|||||||
ts->tv_nsec = nsec;
|
ts->tv_nsec = nsec;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmrinfo("remaining (%lu, %lu)\n",
|
tmrinfo("remaining (%jd, %ld)\n",
|
||||||
(unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
|
(intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
}
|
}
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
|
|||||||
@@ -265,7 +265,7 @@ void up_timer_initialize(void)
|
|||||||
/* Convert this to configured clock ticks for use by the OS timer logic */
|
/* Convert this to configured clock ticks for use by the OS timer logic */
|
||||||
|
|
||||||
max_delay /= CONFIG_USEC_PER_TICK;
|
max_delay /= CONFIG_USEC_PER_TICK;
|
||||||
if (max_delay > (uint64_t)UINT32_MAX)
|
if (max_delay > UINT32_MAX)
|
||||||
{
|
{
|
||||||
g_oneshot_maxticks = UINT32_MAX;
|
g_oneshot_maxticks = UINT32_MAX;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -213,8 +213,8 @@ int sam_freerun_counter(struct sam_freerun_s *freerun, struct timespec *ts)
|
|||||||
ts->tv_sec = sec;
|
ts->tv_sec = sec;
|
||||||
ts->tv_nsec = (usec - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
ts->tv_nsec = (usec - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
||||||
|
|
||||||
tmrinfo("usec=%llu ts=(%lu, %lu)\n",
|
tmrinfo("usec=%llu ts=(%jd, %ld)\n",
|
||||||
usec, (unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
|
usec, (intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ int sam_oneshot_max_delay(struct sam_oneshot_s *oneshot, uint64_t *usec)
|
|||||||
{
|
{
|
||||||
DEBUGASSERT(oneshot != NULL && usec != NULL);
|
DEBUGASSERT(oneshot != NULL && usec != NULL);
|
||||||
*usec = (0xffffull * USEC_PER_SEC) /
|
*usec = (0xffffull * USEC_PER_SEC) /
|
||||||
(uint64_t)sam_tc_divfreq(oneshot->tch);
|
sam_tc_divfreq(oneshot->tch);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -211,8 +211,8 @@ int sam_oneshot_start(struct sam_oneshot_s *oneshot,
|
|||||||
uint64_t regval;
|
uint64_t regval;
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
|
|
||||||
tmrinfo("handler=%p arg=%p, ts=(%lu, %lu)\n",
|
tmrinfo("handler=%p arg=%p, ts=(%jd, %ld)\n",
|
||||||
handler, arg, (unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
|
handler, arg, (intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
DEBUGASSERT(oneshot && handler && ts);
|
DEBUGASSERT(oneshot && handler && ts);
|
||||||
|
|
||||||
/* Was the oneshot already running? */
|
/* Was the oneshot already running? */
|
||||||
@@ -445,8 +445,8 @@ int sam_oneshot_cancel(struct sam_oneshot_s *oneshot,
|
|||||||
ts->tv_nsec = nsec;
|
ts->tv_nsec = nsec;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmrinfo("remaining (%lu, %lu)\n",
|
tmrinfo("remaining (%jd, %ld)\n",
|
||||||
(unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
|
(intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
}
|
}
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
|
|||||||
@@ -263,7 +263,7 @@ void up_timer_initialize(void)
|
|||||||
/* Convert this to configured clock ticks for use by the OS timer logic */
|
/* Convert this to configured clock ticks for use by the OS timer logic */
|
||||||
|
|
||||||
max_delay /= CONFIG_USEC_PER_TICK;
|
max_delay /= CONFIG_USEC_PER_TICK;
|
||||||
if (max_delay > (uint64_t)UINT32_MAX)
|
if (max_delay > UINT32_MAX)
|
||||||
{
|
{
|
||||||
g_oneshot_maxticks = UINT32_MAX;
|
g_oneshot_maxticks = UINT32_MAX;
|
||||||
}
|
}
|
||||||
@@ -398,8 +398,7 @@ int up_timer_cancel(struct timespec *ts)
|
|||||||
|
|
||||||
int up_timer_start(const struct timespec *ts)
|
int up_timer_start(const struct timespec *ts)
|
||||||
{
|
{
|
||||||
tmrinfo("ts=(%lu, %lu)\n", (unsigned long)ts->tv_sec,
|
tmrinfo("ts=(%jd, %ld)\n", (intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
(unsigned long)ts->tv_nsec);
|
|
||||||
return ONESHOT_INITIALIZED(&g_tickless.oneshot) ?
|
return ONESHOT_INITIALIZED(&g_tickless.oneshot) ?
|
||||||
sam_oneshot_start(&g_tickless.oneshot, &g_tickless.freerun,
|
sam_oneshot_start(&g_tickless.oneshot, &g_tickless.freerun,
|
||||||
sam_oneshot_handler, NULL, ts) :
|
sam_oneshot_handler, NULL, ts) :
|
||||||
|
|||||||
@@ -277,8 +277,8 @@ int sam_freerun_counter(struct sam_freerun_s *freerun, struct timespec *ts)
|
|||||||
ts->tv_sec = sec;
|
ts->tv_sec = sec;
|
||||||
ts->tv_nsec = (usec - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
ts->tv_nsec = (usec - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
||||||
|
|
||||||
tmrinfo("usec=%llu ts=(%lu, %lu)\n",
|
tmrinfo("usec=%llu ts=(%jd, %ld)\n",
|
||||||
usec, (unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
|
usec, (intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ int sam_oneshot_max_delay(struct sam_oneshot_s *oneshot, uint64_t *usec)
|
|||||||
{
|
{
|
||||||
DEBUGASSERT(oneshot != NULL && usec != NULL);
|
DEBUGASSERT(oneshot != NULL && usec != NULL);
|
||||||
*usec = (0xffffull * USEC_PER_SEC) /
|
*usec = (0xffffull * USEC_PER_SEC) /
|
||||||
(uint64_t)sam_tc_divfreq(oneshot->tch);
|
sam_tc_divfreq(oneshot->tch);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -277,9 +277,8 @@ int sam_oneshot_start(struct sam_oneshot_s *oneshot,
|
|||||||
uint64_t regval;
|
uint64_t regval;
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
|
|
||||||
tmrinfo("handler=%p arg=%p, ts=(%lu, %lu)\n",
|
tmrinfo("handler=%p arg=%p, ts=(%jd, %ld)\n",
|
||||||
handler, arg, (unsigned long)ts->tv_sec,
|
handler, arg, (intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
(unsigned long)ts->tv_nsec);
|
|
||||||
DEBUGASSERT(oneshot && handler && ts);
|
DEBUGASSERT(oneshot && handler && ts);
|
||||||
|
|
||||||
/* Was the oneshot already running? */
|
/* Was the oneshot already running? */
|
||||||
@@ -510,8 +509,8 @@ int sam_oneshot_cancel(struct sam_oneshot_s *oneshot,
|
|||||||
ts->tv_nsec = nsec;
|
ts->tv_nsec = nsec;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmrinfo("remaining (%lu, %lu)\n",
|
tmrinfo("remaining (%jd, %ld)\n",
|
||||||
(unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
|
(intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
}
|
}
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
@@ -177,7 +178,8 @@ static void stm32_bbsram_dump(struct bbsramfh_s *bbf, char *op)
|
|||||||
_info(" fileno:%d\n", (int) bbf->fileno);
|
_info(" fileno:%d\n", (int) bbf->fileno);
|
||||||
_info(" dirty:%d\n", (int) bbf->dirty);
|
_info(" dirty:%d\n", (int) bbf->dirty);
|
||||||
_info(" length:%d\n", (int) bbf->len);
|
_info(" length:%d\n", (int) bbf->len);
|
||||||
_info(" time:%ld:%ld\n", bbf->lastwrite.tv_sec, bbf->lastwrite.tv_nsec);
|
_info(" time:%jd:%ld\n", (intmax_t)bbf->lastwrite.tv_sec,
|
||||||
|
bbf->lastwrite.tv_nsec);
|
||||||
_info(" data: 0x%2x 0x%2x 0x%2x 0x%2x 0x%2x\n",
|
_info(" data: 0x%2x 0x%2x 0x%2x 0x%2x 0x%2x\n",
|
||||||
bbf->data[0], bbf->data[1], bbf->data[2], bbf->data[3], bbf->data[4]);
|
bbf->data[0], bbf->data[1], bbf->data[2], bbf->data[3], bbf->data[4]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3582,7 +3582,7 @@ static int stm32_eth_ptp_adjust(long ppb)
|
|||||||
|
|
||||||
if (ppb != 0)
|
if (ppb != 0)
|
||||||
{
|
{
|
||||||
addend += (int64_t)addend * ppb / NSEC_PER_SEC;
|
addend += addend * ppb / NSEC_PER_SEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for overflows */
|
/* Check for overflows */
|
||||||
|
|||||||
@@ -247,7 +247,7 @@ int stm32_freerun_counter(struct stm32_freerun_s *freerun,
|
|||||||
ts->tv_sec = sec;
|
ts->tv_sec = sec;
|
||||||
ts->tv_nsec = (usec - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
ts->tv_nsec = (usec - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
||||||
|
|
||||||
tmrinfo("usec=%llu ts=(%ju, %lu)\n",
|
tmrinfo("usec=%llu ts=(%jd, %ld)\n",
|
||||||
usec, (intmax_t)ts->tv_sec, ts->tv_nsec);
|
usec, (intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
@@ -257,7 +257,7 @@ int stm32_freerun_counter(struct stm32_freerun_s *freerun,
|
|||||||
|
|
||||||
int stm32_freerun_counter(struct stm32_freerun_s *freerun, uint64_t *counter)
|
int stm32_freerun_counter(struct stm32_freerun_s *freerun, uint64_t *counter)
|
||||||
{
|
{
|
||||||
*counter = (uint64_t)STM32_TIM_GETCOUNTER(freerun->tch);
|
*counter = STM32_TIM_GETCOUNTER(freerun->tch);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -259,9 +259,8 @@ int stm32_oneshot_start(struct stm32_oneshot_s *oneshot,
|
|||||||
uint64_t period;
|
uint64_t period;
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
|
|
||||||
tmrinfo("handler=%p arg=%p, ts=(%lu, %lu)\n",
|
tmrinfo("handler=%p arg=%p, ts=(%jd, %ld)\n",
|
||||||
handler, arg, (unsigned long)ts->tv_sec,
|
handler, arg, (intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
(unsigned long)ts->tv_nsec);
|
|
||||||
DEBUGASSERT(oneshot && handler && ts);
|
DEBUGASSERT(oneshot && handler && ts);
|
||||||
DEBUGASSERT(oneshot->tch);
|
DEBUGASSERT(oneshot->tch);
|
||||||
|
|
||||||
@@ -449,8 +448,8 @@ int stm32_oneshot_cancel(struct stm32_oneshot_s *oneshot,
|
|||||||
ts->tv_nsec = nsec;
|
ts->tv_nsec = nsec;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmrinfo("remaining (%lu, %lu)\n",
|
tmrinfo("remaining (%jd, %ld)\n",
|
||||||
(unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
|
(intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
}
|
}
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
|
|||||||
@@ -832,8 +832,8 @@ int stm32_rtc_rdalarm(FAR struct alm_rdalarm_s *alminfo)
|
|||||||
regvals.cnth = getreg16(STM32_RTC_ALRH);
|
regvals.cnth = getreg16(STM32_RTC_ALRH);
|
||||||
regvals.cntl = getreg16(STM32_RTC_ALRL);
|
regvals.cntl = getreg16(STM32_RTC_ALRL);
|
||||||
tp.tv_sec = regvals.cnth << 16 | regvals.cntl;
|
tp.tv_sec = regvals.cnth << 16 | regvals.cntl;
|
||||||
memcpy(alminfo->ar_time, (FAR struct tm *)gmtime(&tp.tv_sec),
|
memcpy(alminfo->ar_time, gmtime(&tp.tv_sec),
|
||||||
sizeof(FAR struct tm));
|
sizeof(struct tm));
|
||||||
ret = OK;
|
ret = OK;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -686,8 +686,8 @@ int up_timer_gettime(struct timespec *ts)
|
|||||||
ts->tv_sec = sec;
|
ts->tv_sec = sec;
|
||||||
ts->tv_nsec = (usec - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
ts->tv_nsec = (usec - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
||||||
|
|
||||||
tmrinfo("usec=%llu ts=(%lu, %lu)\n",
|
tmrinfo("usec=%llu ts=(%jd, %ld)\n",
|
||||||
usec, (unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
|
usec, (intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@@ -872,8 +872,8 @@ int up_timer_cancel(struct timespec *ts)
|
|||||||
ts->tv_sec = sec;
|
ts->tv_sec = sec;
|
||||||
ts->tv_nsec = nsec;
|
ts->tv_nsec = nsec;
|
||||||
|
|
||||||
tmrinfo("remaining (%lu, %lu)\n",
|
tmrinfo("remaining (%jd, %ld)\n",
|
||||||
(unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
|
(intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
}
|
}
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
@@ -911,8 +911,8 @@ int up_timer_start(const struct timespec *ts)
|
|||||||
uint32_t count;
|
uint32_t count;
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
|
|
||||||
tmrinfo("ts=(%lu, %lu)\n",
|
tmrinfo("ts=(%jd, %ld)\n",
|
||||||
(unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
|
(intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
DEBUGASSERT(ts);
|
DEBUGASSERT(ts);
|
||||||
DEBUGASSERT(g_tickless.tch);
|
DEBUGASSERT(g_tickless.tch);
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
@@ -177,7 +178,8 @@ static void stm32_bbsram_dump(struct bbsramfh_s *bbf, char *op)
|
|||||||
_info(" fileno:%d\n", (int) bbf->fileno);
|
_info(" fileno:%d\n", (int) bbf->fileno);
|
||||||
_info(" dirty:%d\n", (int) bbf->dirty);
|
_info(" dirty:%d\n", (int) bbf->dirty);
|
||||||
_info(" length:%d\n", (int) bbf->len);
|
_info(" length:%d\n", (int) bbf->len);
|
||||||
_info(" time:%ld:%ld\n", bbf->lastwrite.tv_sec, bbf->lastwrite.tv_nsec);
|
_info(" time:%jd:%ld\n", (intmax_t)bbf->lastwrite.tv_sec,
|
||||||
|
bbf->lastwrite.tv_nsec);
|
||||||
_info(" data: 0x%2x 0x%2x 0x%2x 0x%2x 0x%2x\n",
|
_info(" data: 0x%2x 0x%2x 0x%2x 0x%2x 0x%2x\n",
|
||||||
bbf->data[0], bbf->data[1], bbf->data[2], bbf->data[3], bbf->data[4]);
|
bbf->data[0], bbf->data[1], bbf->data[2], bbf->data[3], bbf->data[4]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -727,8 +727,8 @@ int up_timer_gettime(struct timespec *ts)
|
|||||||
ts->tv_sec = sec;
|
ts->tv_sec = sec;
|
||||||
ts->tv_nsec = (usec - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
ts->tv_nsec = (usec - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
||||||
|
|
||||||
tmrinfo("usec=%llu ts=(%lu, %lu)\n",
|
tmrinfo("usec=%llu ts=(%jd, %ld)\n",
|
||||||
usec, (unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
|
usec, (intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@@ -914,8 +914,8 @@ int up_timer_cancel(struct timespec *ts)
|
|||||||
ts->tv_sec = sec;
|
ts->tv_sec = sec;
|
||||||
ts->tv_nsec = nsec;
|
ts->tv_nsec = nsec;
|
||||||
|
|
||||||
tmrinfo("remaining (%lu, %lu)\n",
|
tmrinfo("remaining (%jd, %ld)\n",
|
||||||
(unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
|
(intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
}
|
}
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
@@ -955,8 +955,8 @@ int up_timer_start(const struct timespec *ts)
|
|||||||
uint32_t count;
|
uint32_t count;
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
|
|
||||||
tmrinfo("ts=(%lu, %lu)\n",
|
tmrinfo("ts=(%jd, %ld)\n",
|
||||||
(unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
|
(intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
DEBUGASSERT(ts);
|
DEBUGASSERT(ts);
|
||||||
DEBUGASSERT(g_tickless.tch);
|
DEBUGASSERT(g_tickless.tch);
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
@@ -198,7 +199,8 @@ static void stm32_bbsram_dump(struct bbsramfh_s *bbf, char *op)
|
|||||||
_info(" fileno:%d\n", (int) bbf->fileno);
|
_info(" fileno:%d\n", (int) bbf->fileno);
|
||||||
_info(" dirty:%d\n", (int) bbf->dirty);
|
_info(" dirty:%d\n", (int) bbf->dirty);
|
||||||
_info(" length:%d\n", (int) bbf->len);
|
_info(" length:%d\n", (int) bbf->len);
|
||||||
_info(" time:%ld:%ld\n", bbf->lastwrite.tv_sec, bbf->lastwrite.tv_nsec);
|
_info(" time:%jd:%ld\n", (intmax_t)bbf->lastwrite.tv_sec,
|
||||||
|
bbf->lastwrite.tv_nsec);
|
||||||
_info(" data: 0x%2x 0x%2x 0x%2x 0x%2x 0x%2x\n",
|
_info(" data: 0x%2x 0x%2x 0x%2x 0x%2x 0x%2x\n",
|
||||||
bbf->data[0], bbf->data[1], bbf->data[2], bbf->data[3], bbf->data[4]);
|
bbf->data[0], bbf->data[1], bbf->data[2], bbf->data[3], bbf->data[4]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -263,8 +263,8 @@ int stm32_oneshot_start(struct stm32_oneshot_s *oneshot,
|
|||||||
uint64_t period;
|
uint64_t period;
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
|
|
||||||
tmrinfo("handler=%p arg=%p, ts=(%lu, %lu)\n", handler, arg,
|
tmrinfo("handler=%p arg=%p, ts=(%jd, %ld)\n", handler, arg,
|
||||||
(unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
|
(intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
DEBUGASSERT(oneshot && handler && ts);
|
DEBUGASSERT(oneshot && handler && ts);
|
||||||
DEBUGASSERT(oneshot->tch);
|
DEBUGASSERT(oneshot->tch);
|
||||||
|
|
||||||
|
|||||||
@@ -701,8 +701,8 @@ int up_timer_gettime(struct timespec *ts)
|
|||||||
ts->tv_sec = sec;
|
ts->tv_sec = sec;
|
||||||
ts->tv_nsec = (usec - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
ts->tv_nsec = (usec - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
||||||
|
|
||||||
tmrinfo("usec=%llu ts=(%lu, %lu)\n",
|
tmrinfo("usec=%llu ts=(%jd, %ld)\n",
|
||||||
usec, (unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
|
usec, (intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@@ -888,8 +888,8 @@ int up_timer_cancel(struct timespec *ts)
|
|||||||
ts->tv_sec = sec;
|
ts->tv_sec = sec;
|
||||||
ts->tv_nsec = nsec;
|
ts->tv_nsec = nsec;
|
||||||
|
|
||||||
tmrinfo("remaining (%lu, %lu)\n",
|
tmrinfo("remaining (%jd, %ld)\n",
|
||||||
(unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
|
(intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
}
|
}
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
@@ -929,8 +929,8 @@ int up_timer_start(const struct timespec *ts)
|
|||||||
uint32_t count;
|
uint32_t count;
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
|
|
||||||
tmrinfo("ts=(%lu, %lu)\n",
|
tmrinfo("ts=(%jd, %ld)\n",
|
||||||
(unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
|
(intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
DEBUGASSERT(ts);
|
DEBUGASSERT(ts);
|
||||||
DEBUGASSERT(g_tickless.tch);
|
DEBUGASSERT(g_tickless.tch);
|
||||||
|
|
||||||
|
|||||||
@@ -231,8 +231,8 @@ int stm32l4_freerun_counter(struct stm32l4_freerun_s *freerun,
|
|||||||
ts->tv_sec = sec;
|
ts->tv_sec = sec;
|
||||||
ts->tv_nsec = (usec - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
ts->tv_nsec = (usec - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
||||||
|
|
||||||
tmrinfo("usec=%llu ts=(%u, %lu)\n",
|
tmrinfo("usec=%llu ts=(%jd, %ld)\n",
|
||||||
usec, (unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
|
usec, (intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -260,9 +260,8 @@ int stm32l4_oneshot_start(struct stm32l4_oneshot_s *oneshot,
|
|||||||
uint64_t period;
|
uint64_t period;
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
|
|
||||||
tmrinfo("handler=%p arg=%p, ts=(%lu, %lu)\n",
|
tmrinfo("handler=%p arg=%p, ts=(%jd, %ld)\n",
|
||||||
handler, arg, (unsigned long)ts->tv_sec,
|
handler, arg, (intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
(unsigned long)ts->tv_nsec);
|
|
||||||
DEBUGASSERT(oneshot && handler && ts);
|
DEBUGASSERT(oneshot && handler && ts);
|
||||||
DEBUGASSERT(oneshot->tch);
|
DEBUGASSERT(oneshot->tch);
|
||||||
|
|
||||||
@@ -451,8 +450,8 @@ int stm32l4_oneshot_cancel(struct stm32l4_oneshot_s *oneshot,
|
|||||||
ts->tv_nsec = nsec;
|
ts->tv_nsec = nsec;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmrinfo("remaining (%lu, %lu)\n",
|
tmrinfo("remaining (%jd, %ld)\n",
|
||||||
(unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
|
(intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
}
|
}
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
|
|||||||
@@ -245,7 +245,7 @@ int stm32wb_freerun_counter(struct stm32wb_freerun_s *freerun,
|
|||||||
ts->tv_sec = sec;
|
ts->tv_sec = sec;
|
||||||
ts->tv_nsec = (usec - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
ts->tv_nsec = (usec - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
||||||
|
|
||||||
tmrinfo("usec=%llu ts=(%ju, %lu)\n",
|
tmrinfo("usec=%llu ts=(%jd, %ld)\n",
|
||||||
usec, (intmax_t)ts->tv_sec, ts->tv_nsec);
|
usec, (intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
@@ -256,7 +256,7 @@ int stm32wb_freerun_counter(struct stm32wb_freerun_s *freerun,
|
|||||||
int stm32wb_freerun_counter(struct stm32wb_freerun_s *freerun,
|
int stm32wb_freerun_counter(struct stm32wb_freerun_s *freerun,
|
||||||
uint64_t *counter)
|
uint64_t *counter)
|
||||||
{
|
{
|
||||||
*counter = (uint64_t)STM32WB_TIM_GETCOUNTER(freerun->tch);
|
*counter = STM32WB_TIM_GETCOUNTER(freerun->tch);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -260,9 +260,8 @@ int stm32wb_oneshot_start(struct stm32wb_oneshot_s *oneshot,
|
|||||||
uint64_t period;
|
uint64_t period;
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
|
|
||||||
tmrinfo("handler=%p arg=%p, ts=(%lu, %lu)\n",
|
tmrinfo("handler=%p arg=%p, ts=(%jd, %ld)\n",
|
||||||
handler, arg, (unsigned long)ts->tv_sec,
|
handler, arg, (intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
(unsigned long)ts->tv_nsec);
|
|
||||||
DEBUGASSERT(oneshot && handler && ts);
|
DEBUGASSERT(oneshot && handler && ts);
|
||||||
DEBUGASSERT(oneshot->tch);
|
DEBUGASSERT(oneshot->tch);
|
||||||
|
|
||||||
@@ -450,8 +449,8 @@ int stm32wb_oneshot_cancel(struct stm32wb_oneshot_s *oneshot,
|
|||||||
ts->tv_nsec = nsec;
|
ts->tv_nsec = nsec;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmrinfo("remaining (%lu, %lu)\n",
|
tmrinfo("remaining (%jd, %ld)\n",
|
||||||
(unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
|
(intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
}
|
}
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
|
|||||||
@@ -552,8 +552,8 @@ int up_timer_gettime(struct timespec *ts)
|
|||||||
ts->tv_sec = sec;
|
ts->tv_sec = sec;
|
||||||
ts->tv_nsec = (usec - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
ts->tv_nsec = (usec - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
||||||
|
|
||||||
tmrinfo("usec=%llu ts=(%lu, %lu)\n",
|
tmrinfo("usec=%llu ts=(%jd, %ld)\n",
|
||||||
usec, (unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
|
usec, (intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@@ -738,8 +738,8 @@ int up_timer_cancel(struct timespec *ts)
|
|||||||
ts->tv_sec = sec;
|
ts->tv_sec = sec;
|
||||||
ts->tv_nsec = nsec;
|
ts->tv_nsec = nsec;
|
||||||
|
|
||||||
tmrinfo("remaining (%lu, %lu)\n",
|
tmrinfo("remaining (%jd, %ld)\n",
|
||||||
(unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
|
(intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
}
|
}
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
@@ -777,8 +777,8 @@ int up_timer_start(const struct timespec *ts)
|
|||||||
uint32_t count;
|
uint32_t count;
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
|
|
||||||
tmrinfo("ts=(%lu, %lu)\n",
|
tmrinfo("ts=(%jd, %ld)\n",
|
||||||
(unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
|
(intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
DEBUGASSERT(ts);
|
DEBUGASSERT(ts);
|
||||||
DEBUGASSERT(g_tickless.tch);
|
DEBUGASSERT(g_tickless.tch);
|
||||||
|
|
||||||
|
|||||||
@@ -375,8 +375,8 @@ int up_timer_gettime(struct timespec *ts)
|
|||||||
ts->tv_sec = sec;
|
ts->tv_sec = sec;
|
||||||
ts->tv_nsec = (usec - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
ts->tv_nsec = (usec - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
||||||
|
|
||||||
tmrinfo("usec=%llu ts=(%lu, %lu)\n",
|
tmrinfo("usec=%llu ts=(%jd, %ld)\n",
|
||||||
usec, (unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
|
usec, (intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@@ -412,8 +412,8 @@ int up_timer_start(const struct timespec *ts)
|
|||||||
uint64_t period;
|
uint64_t period;
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
|
|
||||||
tmrinfo("ts=(%lu, %lu)\n",
|
tmrinfo("ts=(%jd, %ld)\n",
|
||||||
(unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
|
(intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
DEBUGASSERT(ts);
|
DEBUGASSERT(ts);
|
||||||
|
|
||||||
/* Was an interval already running? */
|
/* Was an interval already running? */
|
||||||
@@ -566,8 +566,8 @@ int up_timer_cancel(struct timespec *ts)
|
|||||||
ts->tv_sec = sec;
|
ts->tv_sec = sec;
|
||||||
ts->tv_nsec = nsec;
|
ts->tv_nsec = nsec;
|
||||||
|
|
||||||
tmrinfo("remaining count : %lu (%lu, %lu)\n", count,
|
tmrinfo("remaining count : %lu (%jd, %ld)\n", count,
|
||||||
(unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
|
(intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
}
|
}
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
|
|||||||
@@ -260,8 +260,8 @@ int pic32mz_freerun_counter(struct pic32mz_freerun_s *freerun,
|
|||||||
ts->tv_sec = sec;
|
ts->tv_sec = sec;
|
||||||
ts->tv_nsec = (usec - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
ts->tv_nsec = (usec - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
||||||
|
|
||||||
tmrinfo("usec=%llu ts=(%u, %lu)\n",
|
tmrinfo("usec=%llu ts=(%jd, %ld)\n",
|
||||||
usec, (unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
|
usec, (intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@@ -271,7 +271,7 @@ int pic32mz_freerun_counter(struct pic32mz_freerun_s *freerun,
|
|||||||
int pic32mz_freerun_counter(struct pic32mz_freerun_s *freerun,
|
int pic32mz_freerun_counter(struct pic32mz_freerun_s *freerun,
|
||||||
uint64_t *counter)
|
uint64_t *counter)
|
||||||
{
|
{
|
||||||
*counter = (uint64_t)PIC32MZ_TIMER_GETCOUNTER(freerun->timer) &
|
*counter = PIC32MZ_TIMER_GETCOUNTER(freerun->timer) &
|
||||||
freerun->counter_mask;
|
freerun->counter_mask;
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -277,9 +277,8 @@ int pic32mz_oneshot_start(struct pic32mz_oneshot_s *oneshot,
|
|||||||
uint64_t period;
|
uint64_t period;
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
|
|
||||||
tmrinfo("handler=%p arg=%p, ts=(%lu, %lu)\n",
|
tmrinfo("handler=%p arg=%p, ts=(%jd, %ld)\n",
|
||||||
handler, arg, (unsigned long)ts->tv_sec,
|
handler, arg, (intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
(unsigned long)ts->tv_nsec);
|
|
||||||
DEBUGASSERT(oneshot && handler && ts);
|
DEBUGASSERT(oneshot && handler && ts);
|
||||||
DEBUGASSERT(oneshot->timer);
|
DEBUGASSERT(oneshot->timer);
|
||||||
|
|
||||||
@@ -437,8 +436,8 @@ int pic32mz_oneshot_cancel(struct pic32mz_oneshot_s *oneshot,
|
|||||||
ts->tv_nsec = nsec;
|
ts->tv_nsec = nsec;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmrinfo("remaining (%lu, %lu)\n",
|
tmrinfo("remaining (%jd, %ld)\n",
|
||||||
(unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
|
(intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
}
|
}
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
@@ -170,7 +171,8 @@ static void rx65n_sbram_dump(struct sbramfh_s *bbf, char *op)
|
|||||||
_info(" fileno:%d\n", (int) bbf->fileno);
|
_info(" fileno:%d\n", (int) bbf->fileno);
|
||||||
_info(" dirty:%d\n", (int) bbf->dirty);
|
_info(" dirty:%d\n", (int) bbf->dirty);
|
||||||
_info(" length:%d\n", (int) bbf->len);
|
_info(" length:%d\n", (int) bbf->len);
|
||||||
_info(" time:%ld:%ld\n", bbf->lastwrite.tv_sec, bbf->lastwrite.tv_nsec);
|
_info(" time:%jd:%ld\n", (intmax_t)bbf->lastwrite.tv_sec,
|
||||||
|
bbf->lastwrite.tv_nsec);
|
||||||
_info(" data: 0x%2x 0x%2x 0x%2x 0x%2x 0x%2x\n",
|
_info(" data: 0x%2x 0x%2x 0x%2x 0x%2x 0x%2x\n",
|
||||||
bbf->data[0], bbf->data[1], bbf->data[2], bbf->data[3], bbf->data[4]);
|
bbf->data[0], bbf->data[1], bbf->data[2], bbf->data[3], bbf->data[4]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -630,8 +630,7 @@ static int esp_rtc_rdalarm(struct rtc_lowerhalf_s *lower,
|
|||||||
ts.tv_nsec = ((esp_hr_timer_time_us() + g_rtc_save->offset +
|
ts.tv_nsec = ((esp_hr_timer_time_us() + g_rtc_save->offset +
|
||||||
cbinfo->deadline_us) % USEC_PER_SEC) * NSEC_PER_USEC;
|
cbinfo->deadline_us) % USEC_PER_SEC) * NSEC_PER_USEC;
|
||||||
|
|
||||||
localtime_r((const time_t *)&ts.tv_sec,
|
localtime_r(&ts.tv_sec, (struct tm *)alarminfo->time);
|
||||||
(struct tm *)alarminfo->time);
|
|
||||||
|
|
||||||
spin_unlock_irqrestore(&priv->lock, flags);
|
spin_unlock_irqrestore(&priv->lock, flags);
|
||||||
|
|
||||||
|
|||||||
@@ -1399,7 +1399,7 @@ static uint32_t IRAM_ATTR btdm_lpcycles_2_hus(uint32_t cycles,
|
|||||||
static uint32_t IRAM_ATTR btdm_hus_2_lpcycles(uint32_t us)
|
static uint32_t IRAM_ATTR btdm_hus_2_lpcycles(uint32_t us)
|
||||||
{
|
{
|
||||||
uint64_t cycles;
|
uint64_t cycles;
|
||||||
cycles = ((uint64_t)(us) << g_btdm_lpcycle_us_frac) / g_btdm_lpcycle_us;
|
cycles = ((uint64_t)us << g_btdm_lpcycle_us_frac) / g_btdm_lpcycle_us;
|
||||||
return (uint32_t)cycles;
|
return (uint32_t)cycles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -301,8 +301,8 @@ int esp32c3_freerun_counter(struct esp32c3_freerun_s *freerun,
|
|||||||
ts->tv_sec = sec;
|
ts->tv_sec = sec;
|
||||||
ts->tv_nsec = (usec - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
ts->tv_nsec = (usec - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
||||||
|
|
||||||
tmrinfo(" usec=%" PRIu64 " ts=(%lu, %lu)\n",
|
tmrinfo(" usec=%" PRIu64 " ts=(%jd, %ld)\n",
|
||||||
usec, (unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
|
usec, (intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@@ -258,9 +259,8 @@ int esp32c3_oneshot_start(struct esp32c3_oneshot_s *oneshot,
|
|||||||
uint64_t timeout_us;
|
uint64_t timeout_us;
|
||||||
int ret = OK;
|
int ret = OK;
|
||||||
|
|
||||||
tmrinfo("handler=%p arg=%p, ts=(%lu, %lu)\n",
|
tmrinfo("handler=%p arg=%p, ts=(%jd, %ld)\n",
|
||||||
handler, arg, (unsigned long)ts->tv_sec,
|
handler, arg, (intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
(unsigned long)ts->tv_nsec);
|
|
||||||
DEBUGASSERT(oneshot != NULL);
|
DEBUGASSERT(oneshot != NULL);
|
||||||
DEBUGASSERT(handler != NULL);
|
DEBUGASSERT(handler != NULL);
|
||||||
DEBUGASSERT(ts != NULL);
|
DEBUGASSERT(ts != NULL);
|
||||||
|
|||||||
@@ -483,8 +483,7 @@ static int rtc_lh_rdalarm(struct rtc_lowerhalf_s *lower,
|
|||||||
flags = spin_lock_irqsave(&priv->lock);
|
flags = spin_lock_irqsave(&priv->lock);
|
||||||
|
|
||||||
ret = up_rtc_rdalarm(&ts, alarminfo->id);
|
ret = up_rtc_rdalarm(&ts, alarminfo->id);
|
||||||
localtime_r((const time_t *)&ts.tv_sec,
|
localtime_r(&ts.tv_sec, (struct tm *)alarminfo->time);
|
||||||
(struct tm *)alarminfo->time);
|
|
||||||
|
|
||||||
spin_unlock_irqrestore(&priv->lock, flags);
|
spin_unlock_irqrestore(&priv->lock, flags);
|
||||||
|
|
||||||
|
|||||||
@@ -384,10 +384,10 @@ static void esp32c3_tim_getcounter(struct esp32c3_tim_dev_s *dev,
|
|||||||
/* Discard the top 12 bits */
|
/* Discard the top 12 bits */
|
||||||
|
|
||||||
value_32 &= LOW_20_MASK;
|
value_32 &= LOW_20_MASK;
|
||||||
*value |= (uint64_t)value_32;
|
*value |= value_32;
|
||||||
*value <<= SHIFT_32;
|
*value <<= SHIFT_32;
|
||||||
value_32 = getreg32(SYS_TIMER_SYSTIMER_UNIT1_VALUE_LO_REG);
|
value_32 = getreg32(SYS_TIMER_SYSTIMER_UNIT1_VALUE_LO_REG);
|
||||||
*value |= (uint64_t)value_32;
|
*value |= value_32;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -402,10 +402,10 @@ static void esp32c3_tim_getcounter(struct esp32c3_tim_dev_s *dev,
|
|||||||
/* Discard the top 10 bits */
|
/* Discard the top 10 bits */
|
||||||
|
|
||||||
value_32 &= LOW_22_MASK;
|
value_32 &= LOW_22_MASK;
|
||||||
*value |= (uint64_t)value_32;
|
*value |= value_32;
|
||||||
*value <<= SHIFT_32;
|
*value <<= SHIFT_32;
|
||||||
value_32 = getreg32(TIMG_T0LO_REG(priv->id)); /* Low 32 bits */
|
value_32 = getreg32(TIMG_T0LO_REG(priv->id)); /* Low 32 bits */
|
||||||
*value |= (uint64_t)value_32;
|
*value |= value_32;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -521,10 +521,10 @@ static void esp32c3_tim_getalarmvalue(struct esp32c3_tim_dev_s *dev,
|
|||||||
/* Get only the 20 low bits. */
|
/* Get only the 20 low bits. */
|
||||||
|
|
||||||
value_32 &= LOW_20_MASK;
|
value_32 &= LOW_20_MASK;
|
||||||
*value |= (uint64_t)value_32;
|
*value |= value_32;
|
||||||
*value <<= SHIFT_32;
|
*value <<= SHIFT_32;
|
||||||
value_32 = getreg32(SYS_TIMER_SYSTIMER_TARGET2_LO_REG); /* Low 32 bits */
|
value_32 = getreg32(SYS_TIMER_SYSTIMER_TARGET2_LO_REG); /* Low 32 bits */
|
||||||
*value |= (uint64_t)value_32;
|
*value |= value_32;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -535,10 +535,10 @@ static void esp32c3_tim_getalarmvalue(struct esp32c3_tim_dev_s *dev,
|
|||||||
/* Get only the 22 low bits. */
|
/* Get only the 22 low bits. */
|
||||||
|
|
||||||
value_32 &= LOW_22_MASK;
|
value_32 &= LOW_22_MASK;
|
||||||
*value |= (uint64_t)value_32;
|
*value |= value_32;
|
||||||
*value <<= SHIFT_32;
|
*value <<= SHIFT_32;
|
||||||
value_32 = getreg32(TIMG_T0ALARMLO_REG(priv->id)); /* Low 32 bits */
|
value_32 = getreg32(TIMG_T0ALARMLO_REG(priv->id)); /* Low 32 bits */
|
||||||
*value |= (uint64_t)value_32;
|
*value |= value_32;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2090,7 +2090,7 @@ static inline uint64_t rotl(uint64_t x, int k)
|
|||||||
return (x << k) | (x >> (-k & 0x3f));
|
return (x << k) | (x >> (-k & 0x3f));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mpfs_ddr_rand(void)
|
static uint32_t mpfs_ddr_rand(void)
|
||||||
{
|
{
|
||||||
uint64_t s0 = prng_state[0];
|
uint64_t s0 = prng_state[0];
|
||||||
uint64_t s1 = prng_state[1];
|
uint64_t s1 = prng_state[1];
|
||||||
@@ -2099,7 +2099,7 @@ static int mpfs_ddr_rand(void)
|
|||||||
prng_state[0] = s0 ^ rotl(s1, 29);
|
prng_state[0] = s0 ^ rotl(s1, 29);
|
||||||
prng_state[1] = s0 ^ (s1 << 9);
|
prng_state[1] = s0 ^ (s1 << 9);
|
||||||
|
|
||||||
return (int)result;
|
return (uint32_t)result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -2145,7 +2145,7 @@ static void mpfs_ddr_write(struct mpfs_ddr_priv_s *priv,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PATTERN_RANDOM:
|
case PATTERN_RANDOM:
|
||||||
data = (uint64_t)mpfs_ddr_rand();
|
data = mpfs_ddr_rand();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PATTERN_CCCCCCCC:
|
case PATTERN_CCCCCCCC:
|
||||||
@@ -2212,7 +2212,7 @@ static void mpfs_ddr_write(struct mpfs_ddr_priv_s *priv,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PATTERN_RANDOM:
|
case PATTERN_RANDOM:
|
||||||
data = (uint64_t)mpfs_ddr_rand();
|
data = mpfs_ddr_rand();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PATTERN_CCCCCCCC:
|
case PATTERN_CCCCCCCC:
|
||||||
@@ -2287,7 +2287,7 @@ uint32_t mpfs_ddr_read(struct mpfs_ddr_priv_s *priv,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PATTERN_RANDOM:
|
case PATTERN_RANDOM:
|
||||||
data = (uint64_t)mpfs_ddr_rand();
|
data = mpfs_ddr_rand();
|
||||||
*ddr_word_ptr = data;
|
*ddr_word_ptr = data;
|
||||||
*ddr_32_pt_t = (uint32_t)data;
|
*ddr_32_pt_t = (uint32_t)data;
|
||||||
break;
|
break;
|
||||||
@@ -2366,8 +2366,8 @@ uint32_t mpfs_ddr_read(struct mpfs_ddr_priv_s *priv,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PATTERN_RANDOM:
|
case PATTERN_RANDOM:
|
||||||
data = (uint64_t)mpfs_ddr_rand();
|
data = mpfs_ddr_rand();
|
||||||
mpfs_ddr_rand_addr_offset = (uint32_t)(mpfs_ddr_rand() &
|
mpfs_ddr_rand_addr_offset = (mpfs_ddr_rand() &
|
||||||
0xffffc);
|
0xffffc);
|
||||||
ddr_word_ptr = first_ddr_word_pt_t +
|
ddr_word_ptr = first_ddr_word_pt_t +
|
||||||
mpfs_ddr_rand_addr_offset;
|
mpfs_ddr_rand_addr_offset;
|
||||||
|
|||||||
@@ -232,8 +232,8 @@ int bm3803_freerun_counter(struct bm3803_freerun_s *freerun,
|
|||||||
ts->tv_sec = sec;
|
ts->tv_sec = sec;
|
||||||
ts->tv_nsec = (usec - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
ts->tv_nsec = (usec - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
||||||
|
|
||||||
tmrinfo("usec=%llu ts=(%lld, %ld)\n",
|
tmrinfo("usec=%llu ts=(%jd, %ld)\n",
|
||||||
usec, ts->tv_sec, ts->tv_nsec);
|
usec, (intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -206,8 +206,8 @@ int bm3803_oneshot_start(struct bm3803_oneshot_s *oneshot,
|
|||||||
uint64_t period;
|
uint64_t period;
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
|
|
||||||
tmrinfo("handler=%p arg=%p, ts=(%lu, %lu)\n", handler, arg,
|
tmrinfo("handler=%p arg=%p, ts=(%jd, %ld)\n", handler, arg,
|
||||||
(unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
|
(intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
DEBUGASSERT(oneshot && handler && ts);
|
DEBUGASSERT(oneshot && handler && ts);
|
||||||
DEBUGASSERT(oneshot->tch);
|
DEBUGASSERT(oneshot->tch);
|
||||||
|
|
||||||
@@ -393,8 +393,8 @@ int bm3803_oneshot_cancel(struct bm3803_oneshot_s *oneshot,
|
|||||||
ts->tv_nsec = nsec;
|
ts->tv_nsec = nsec;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmrinfo("remaining (%lu, %lu)\n",
|
tmrinfo("remaining (%jd, %ld)\n",
|
||||||
(unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
|
(intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
}
|
}
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
|
|||||||
@@ -290,9 +290,8 @@ int intel64_oneshot_start(struct intel64_oneshot_s *oneshot,
|
|||||||
uint64_t compare = 0;
|
uint64_t compare = 0;
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
|
|
||||||
tmrinfo("handler=%p arg=%p, ts=(%lu, %lu)\n",
|
tmrinfo("handler=%p arg=%p, ts=(%jd, %ld)\n",
|
||||||
handler, arg, (unsigned long)ts->tv_sec,
|
handler, arg, (intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
(unsigned long)ts->tv_nsec);
|
|
||||||
|
|
||||||
DEBUGASSERT(oneshot && handler && ts);
|
DEBUGASSERT(oneshot && handler && ts);
|
||||||
DEBUGASSERT(oneshot->tch);
|
DEBUGASSERT(oneshot->tch);
|
||||||
@@ -464,8 +463,8 @@ int intel64_oneshot_cancel(struct intel64_oneshot_s *oneshot,
|
|||||||
ts->tv_sec = sec;
|
ts->tv_sec = sec;
|
||||||
ts->tv_nsec = nsec;
|
ts->tv_nsec = nsec;
|
||||||
|
|
||||||
tmrinfo("remaining (%lu, %lu)\n",
|
tmrinfo("remaining (%jd, %ld)\n",
|
||||||
(unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
|
(intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
}
|
}
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
|
|||||||
@@ -629,8 +629,7 @@ static int esp_rtc_rdalarm(struct rtc_lowerhalf_s *lower,
|
|||||||
ts.tv_nsec = ((esp_hr_timer_time_us() + g_rtc_save->offset +
|
ts.tv_nsec = ((esp_hr_timer_time_us() + g_rtc_save->offset +
|
||||||
cbinfo->deadline_us) % USEC_PER_SEC) * NSEC_PER_USEC;
|
cbinfo->deadline_us) % USEC_PER_SEC) * NSEC_PER_USEC;
|
||||||
|
|
||||||
localtime_r((const time_t *)&ts.tv_sec,
|
localtime_r(&ts.tv_sec, (struct tm *)alarminfo->time);
|
||||||
(struct tm *)alarminfo->time);
|
|
||||||
|
|
||||||
spin_unlock_irqrestore(&priv->lock, flags);
|
spin_unlock_irqrestore(&priv->lock, flags);
|
||||||
|
|
||||||
|
|||||||
@@ -292,8 +292,8 @@ int esp32_freerun_counter(struct esp32_freerun_s *freerun,
|
|||||||
ts->tv_sec = sec;
|
ts->tv_sec = sec;
|
||||||
ts->tv_nsec = (usec - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
ts->tv_nsec = (usec - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
||||||
|
|
||||||
tmrinfo("usec=%llu ts=(%" PRIu32 ", %" PRIu32 ")\n",
|
tmrinfo("usec=%llu ts=(%jd, %ld)\n",
|
||||||
usec, (unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
|
usec, (intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@@ -249,9 +250,8 @@ int esp32_oneshot_start(struct esp32_oneshot_s *oneshot,
|
|||||||
uint64_t timeout_us;
|
uint64_t timeout_us;
|
||||||
int ret = OK;
|
int ret = OK;
|
||||||
|
|
||||||
tmrinfo("handler=%p arg=%p, ts=(%" PRIu32 ", %" PRIu32 ")\n",
|
tmrinfo("handler=%p arg=%p, ts=(%jd, %ld)\n",
|
||||||
handler, arg, (unsigned long)ts->tv_sec,
|
handler, arg, (intmax_t)ts->tv_sec, ts->tv_nsec);
|
||||||
(unsigned long)ts->tv_nsec);
|
|
||||||
DEBUGASSERT(oneshot != NULL);
|
DEBUGASSERT(oneshot != NULL);
|
||||||
DEBUGASSERT(handler != NULL);
|
DEBUGASSERT(handler != NULL);
|
||||||
DEBUGASSERT(ts != NULL);
|
DEBUGASSERT(ts != NULL);
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user