!sched/clock: remove CONFIG_SYSTEM_TIME64 and always use 64-bit time

The 32-bit system clock has a limited range (~497 days) and the
configuration knob is no longer worth the complexity given that
practically every modern target already enables it.  Make 64-bit
time_t/clock_t/sclock_t/nuttx_time_t the only supported flavor.

Specifically:
  - Drop the SYSTEM_TIME64 Kconfig option and its dependent
    PERF_OVERFLOW_CORRECTION/HRTIMER guards in sched/Kconfig.
  - Remove every #ifdef CONFIG_SYSTEM_TIME64 branch in headers
    (include/{sys/types.h,limits.h,inttypes.h,nuttx/clock.h,
    nuttx/fs/hostfs.h}) and core code paths
    (sched/clock/clock.h, drivers/power/pm/pm_procfs.c,
    drivers/rpmsg/rpmsg_ping.c, fs/procfs/fs_procfsuptime.c,
    libs/libc/wqueue/work_usrthread.c,
    arch/avr/src/avrdx/avrdx_timerisr_tickless_alarm.c).
  - Strip CONFIG_SYSTEM_TIME64=y from every board defconfig.
  - Update Documentation/guides/rust.rst accordingly.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao
2026-05-19 16:21:28 +08:00
committed by Xiang Xiao
parent 1b3af76bf3
commit c6654b1106
187 changed files with 147 additions and 338 deletions
-1
View File
@@ -57,7 +57,6 @@ Please ensure that you have a working NuttX build environment, and with the foll
Please enable the following configurations in your NuttX configuration:
- CONFIG_SYSTEM_TIME64
- CONFIG_FS_LARGEFILE
- CONFIG_TLS_NELEM = 16
- CONFIG_DEV_URANDOM
+1 -1
View File
@@ -95,6 +95,6 @@ void up_perf_convert(clock_t elapsed, struct timespec *ts)
ts->tv_sec = elapsed / g_cpu_freq;
left = elapsed - ts->tv_sec * g_cpu_freq;
ts->tv_nsec = NSEC_PER_SEC * (uint64_t)left / g_cpu_freq;
ts->tv_nsec = NSEC_PER_SEC * left / g_cpu_freq;
}
#endif
+1 -1
View File
@@ -76,6 +76,6 @@ void up_perf_convert(clock_t elapsed, struct timespec *ts)
ts->tv_sec = elapsed / g_cpu_freq;
left = elapsed - ts->tv_sec * g_cpu_freq;
ts->tv_nsec = NSEC_PER_SEC * (uint64_t)left / g_cpu_freq;
ts->tv_nsec = NSEC_PER_SEC * left / g_cpu_freq;
}
#endif
+1 -1
View File
@@ -91,7 +91,7 @@ void up_perf_convert(clock_t elapsed, struct timespec *ts)
ts->tv_sec = elapsed / g_cpu_freq;
left = elapsed - ts->tv_sec * g_cpu_freq;
ts->tv_nsec = NSEC_PER_SEC * (uint64_t)left / g_cpu_freq;
ts->tv_nsec = NSEC_PER_SEC * left / g_cpu_freq;
}
#endif /* CONFIG_BUILD_FLAT || __KERNEL__ */
+1 -1
View File
@@ -76,6 +76,6 @@ void up_perf_convert(clock_t elapsed, struct timespec *ts)
ts->tv_sec = elapsed / g_cpu_freq;
left = elapsed - ts->tv_sec * g_cpu_freq;
ts->tv_nsec = NSEC_PER_SEC * (uint64_t)left / g_cpu_freq;
ts->tv_nsec = NSEC_PER_SEC * left / g_cpu_freq;
}
#endif
+1 -1
View File
@@ -87,6 +87,6 @@ void up_perf_convert(clock_t elapsed, struct timespec *ts)
ts->tv_sec = elapsed / g_cpu_freq;
left = elapsed - ts->tv_sec * g_cpu_freq;
ts->tv_nsec = NSEC_PER_SEC * (uint64_t)left / g_cpu_freq;
ts->tv_nsec = NSEC_PER_SEC * left / g_cpu_freq;
}
#endif /* CONFIG_ARCH_PERF_EVENTS */
+1 -1
View File
@@ -288,7 +288,7 @@ static uint64_t cisif_get_msec_time(void)
clock_systime_timespec(&tp);
return (((uint64_t)tp.tv_sec) * 1000 + tp.tv_nsec / 1000000);
return tp.tv_sec * 1000 + tp.tv_nsec / 1000000;
}
static void cisif_trace_time_start(void)
+4 -4
View File
@@ -2096,8 +2096,8 @@ static int cxd56_power_on_micbias(struct cxd56_dev_s *dev)
clock_systime_timespec(&start);
dev->mic_boot_start = (uint64_t)start.tv_sec * 1000 +
(uint64_t)start.tv_nsec / 1000000;
dev->mic_boot_start = start.tv_sec * 1000 +
start.tv_nsec / 1000000;
return OK;
}
@@ -2951,8 +2951,8 @@ static int cxd56_start(struct audio_lowerhalf_s *lower)
clock_systime_timespec(&end);
uint64_t time = (uint64_t)end.tv_sec * 1000 +
(uint64_t)end.tv_nsec / 1000000 -
uint64_t time = end.tv_sec * 1000 +
end.tv_nsec / 1000000 -
priv->mic_boot_start;
if (time < CXD56_MIC_BOOT_WAIT)
+1 -1
View File
@@ -481,7 +481,7 @@ int up_rtc_settime(const struct timespec *tp)
/* Only save the difference from HW raw value */
count = SEC_TO_CNT(tp->tv_sec) | NSEC_TO_PRECNT(tp->tv_nsec);
g_rtc_save->offset = (int64_t)count - (int64_t)cxd56_rtc_count();
g_rtc_save->offset = count - cxd56_rtc_count();
#endif
cxd56_update_basetime(&g_basetime);
+1 -1
View File
@@ -466,7 +466,7 @@ int up_rtc_settime(const struct timespec *tp)
/* Compute Burtc offset because we cannot reset counter */
val = (((uint64_t)tp->tv_sec) * CONFIG_RTC_FREQUENCY) + \
val = (tp->tv_sec * CONFIG_RTC_FREQUENCY) + \
(tp->tv_nsec / (NSEC_PER_SEC / CONFIG_RTC_FREQUENCY));
if (val < cnt_reg)
+1 -1
View File
@@ -501,7 +501,7 @@ int up_timer_gettime(struct timespec *ts)
int up_alarm_start(const struct timespec *ts)
{
size_t offset = 1;
uint64_t tm = ((uint64_t)ts->tv_sec * NSEC_PER_SEC + ts->tv_nsec) /
uint64_t tm = (ts->tv_sec * NSEC_PER_SEC + ts->tv_nsec) /
NSEC_PER_TICK;
irqstate_t flags;
uint32_t regval;
+1 -1
View File
@@ -131,7 +131,7 @@ static uint64_t _get_current_time64(void)
struct timespec ts;
clock_systime_timespec(&ts);
return (uint64_t)ts.tv_sec * NSEC_PER_SEC + (uint64_t)ts.tv_nsec;
return ts.tv_sec * NSEC_PER_SEC + ts.tv_nsec;
}
/****************************************************************************
+1 -1
View File
@@ -706,7 +706,7 @@ int up_rtc_gettime(struct timespec *tp)
/* Get the elapsed time */
elapsed = NSEC_PER_TICK * (uint64_t)clock_systime_ticks();
elapsed = NSEC_PER_TICK * clock_systime_ticks();
/* Add the timer fraction in nanoseconds */
+1 -1
View File
@@ -111,7 +111,7 @@ void up_timer_initialize(void)
freq >>= 4;
}
load = ((freq * (uint64_t)10000) / 1000000);
load = ((freq * 10000) / 1000000);
putreg32((uint32_t)load, LPC31_TIMER0_LOAD);
/* Set periodic mode */
+3 -5
View File
@@ -81,7 +81,7 @@ static int lpc43_rit_isr(int irq, void *context, void *arg)
putreg32(RIT_CTRL_INT, LPC43_RIT_CTRL);
g_internal_timer += (uint64_t)RIT_TIMER_RESOLUTION;
g_internal_timer += RIT_TIMER_RESOLUTION;
if (g_alarm > 0 && g_internal_timer >= g_alarm)
{
/* handle expired alarm */
@@ -228,8 +228,7 @@ int up_alarm_start(const struct timespec *ts)
* coded.
*/
g_alarm = (uint64_t)ts->tv_sec * (uint64_t)1000000000 +
(uint64_t)ts->tv_nsec;
g_alarm = ts->tv_sec * 1000000000 + ts->tv_nsec;
return OK;
}
@@ -252,8 +251,7 @@ int up_timer_start(const struct timespec *ts)
*/
g_alarm = g_internal_timer;
g_alarm += (uint64_t)ts->tv_sec * (uint64_t)1000000000 +
(uint64_t)ts->tv_nsec;
g_alarm += ts->tv_sec * 1000000000 + ts->tv_nsec;
return OK;
}
+2 -2
View File
@@ -273,8 +273,8 @@ static void lpc54_ts_sub(const struct timespec *ts1,
static inline uint64_t lpc54_ts2tick(const struct timespec *ts)
{
return ((uint64_t)ts->tv_sec * LPC54_CCLK +
((uint64_t)ts->tv_nsec / g_min_nsec * g_min_ticks));
return (ts->tv_sec * LPC54_CCLK +
(ts->tv_nsec / g_min_nsec * g_min_ticks));
}
static uint64_t lpc54_tick2ts(uint64_t ticks, struct timespec *ts,
+2 -2
View File
@@ -289,8 +289,8 @@ int sam_oneshot_start(struct sam_oneshot_s *oneshot,
/* Express the delay in microseconds */
usec = (uint64_t)ts->tv_sec * USEC_PER_SEC +
(uint64_t)(ts->tv_nsec / NSEC_PER_USEC);
usec = ts->tv_sec * USEC_PER_SEC +
(ts->tv_nsec / NSEC_PER_USEC);
/* Get the timer counter frequency and determine the number of counts need
* to achieve the requested delay.
+3 -3
View File
@@ -299,8 +299,8 @@ int sam_oneshot_start(struct sam_oneshot_s *oneshot,
/* Express the delay in microseconds */
usec = (uint64_t)ts->tv_sec *
USEC_PER_SEC + (uint64_t)(ts->tv_nsec /
usec = ts->tv_sec *
USEC_PER_SEC + (ts->tv_nsec /
NSEC_PER_USEC);
/* Get the timer counter frequency and determine the number of counts
@@ -311,7 +311,7 @@ int sam_oneshot_start(struct sam_oneshot_s *oneshot,
* = (usecs * frequency) / USEC_PER_SEC;
*/
regval = (usec * (uint64_t)sam_tc_divfreq(oneshot->tch)) / USEC_PER_SEC;
regval = (usec * sam_tc_divfreq(oneshot->tch)) / USEC_PER_SEC;
tmrinfo("usec=%llu regval=%08llx\n", usec, regval);
DEBUGASSERT(regval <= UINT32_MAX);
+1 -2
View File
@@ -233,8 +233,7 @@ int sam_oneshot_start(struct sam_oneshot_s *oneshot,
/* Express the delay in microseconds */
usec = (uint64_t)ts->tv_sec * USEC_PER_SEC + (uint64_t)(ts->tv_nsec /
NSEC_PER_USEC);
usec = ts->tv_sec * USEC_PER_SEC + (ts->tv_nsec / NSEC_PER_USEC);
/* Get the timer counter frequency and determine
* the number of counts need to achieve the requested delay.
+2 -2
View File
@@ -300,8 +300,8 @@ int sam_oneshot_start(struct sam_oneshot_s *oneshot,
/* Express the delay in microseconds */
usec = (uint64_t)ts->tv_sec * USEC_PER_SEC +
(uint64_t)(ts->tv_nsec / NSEC_PER_USEC);
usec = ts->tv_sec * USEC_PER_SEC +
(ts->tv_nsec / NSEC_PER_USEC);
/* Get the timer counter frequency and determine the number of counts
* needed to achieve the requested delay.
+2 -2
View File
@@ -283,8 +283,8 @@ int stm32_oneshot_start(struct stm32_oneshot_s *oneshot,
/* Express the delay in microseconds */
usec = (uint64_t)ts->tv_sec * USEC_PER_SEC +
(uint64_t)(ts->tv_nsec / NSEC_PER_USEC);
usec = ts->tv_sec * USEC_PER_SEC +
(ts->tv_nsec / NSEC_PER_USEC);
/* Get the timer counter frequency and determine the number of counts need
* to achieve the requested delay.
+1 -1
View File
@@ -296,7 +296,7 @@ static void stm32_rtc_breakout(const struct timespec *tp,
* our use
*/
frac = ((uint64_t)tp->tv_nsec * CONFIG_RTC_FREQUENCY) / 1000000000;
frac = (tp->tv_nsec * CONFIG_RTC_FREQUENCY) / 1000000000;
cnt = (tp->tv_sec << RTC_CLOCKS_SHIFT) |
((uint32_t)frac & (CONFIG_RTC_FREQUENCY - 1));
ovf = (tp->tv_sec >> (32 - RTC_CLOCKS_SHIFT));
+2 -2
View File
@@ -929,8 +929,8 @@ int up_timer_start(const struct timespec *ts)
/* Express the delay in microseconds */
usec = (uint64_t)ts->tv_sec * USEC_PER_SEC +
(uint64_t)(ts->tv_nsec / NSEC_PER_USEC);
usec = ts->tv_sec * USEC_PER_SEC +
(ts->tv_nsec / NSEC_PER_USEC);
/* Get the timer counter frequency and determine the number of counts need
* to achieve the requested delay.
+3 -3
View File
@@ -973,8 +973,8 @@ int up_timer_start(const struct timespec *ts)
/* Express the delay in microseconds */
usec = (uint64_t)ts->tv_sec * USEC_PER_SEC +
(uint64_t)(ts->tv_nsec / NSEC_PER_USEC);
usec = ts->tv_sec * USEC_PER_SEC +
(ts->tv_nsec / NSEC_PER_USEC);
/* Get the timer counter frequency and determine the number of counts need
* to achieve the requested delay.
@@ -1021,7 +1021,7 @@ int up_timer_start(const struct timespec *ts)
int up_alarm_start(const struct timespec *ts)
{
size_t offset = 1;
uint64_t tm = ((uint64_t)ts->tv_sec * NSEC_PER_SEC + ts->tv_nsec) /
uint64_t tm = (ts->tv_sec * NSEC_PER_SEC + ts->tv_nsec) /
NSEC_PER_TICK;
irqstate_t flags;
+2 -2
View File
@@ -286,8 +286,8 @@ int stm32_oneshot_start(struct stm32_oneshot_s *oneshot,
/* Express the delay in microseconds */
usec = (uint64_t)ts->tv_sec * USEC_PER_SEC +
(uint64_t)(ts->tv_nsec / NSEC_PER_USEC);
usec = ts->tv_sec * USEC_PER_SEC +
(ts->tv_nsec / NSEC_PER_USEC);
/* Get the timer counter frequency and determine the number of counts need
* to achieve the requested delay.
+3 -3
View File
@@ -947,8 +947,8 @@ int up_timer_start(const struct timespec *ts)
/* Express the delay in microseconds */
usec = (uint64_t)ts->tv_sec * USEC_PER_SEC +
(uint64_t)(ts->tv_nsec / NSEC_PER_USEC);
usec = ts->tv_sec * USEC_PER_SEC +
(ts->tv_nsec / NSEC_PER_USEC);
/* Get the timer counter frequency and determine the number of counts need
* to achieve the requested delay.
@@ -995,7 +995,7 @@ int up_timer_start(const struct timespec *ts)
int up_alarm_start(const struct timespec *ts)
{
size_t offset = 1;
uint64_t tm = ((uint64_t)ts->tv_sec * NSEC_PER_SEC + ts->tv_nsec) /
uint64_t tm = (ts->tv_sec * NSEC_PER_SEC + ts->tv_nsec) /
NSEC_PER_TICK;
irqstate_t flags;
+2 -2
View File
@@ -284,8 +284,8 @@ int stm32l4_oneshot_start(struct stm32l4_oneshot_s *oneshot,
/* Express the delay in microseconds */
usec = (uint64_t)ts->tv_sec * USEC_PER_SEC +
(uint64_t)(ts->tv_nsec / NSEC_PER_USEC);
usec = ts->tv_sec * USEC_PER_SEC +
(ts->tv_nsec / NSEC_PER_USEC);
/* Get the timer counter frequency and determine the number of counts need
* to achieve the requested delay.
+2 -2
View File
@@ -284,8 +284,8 @@ int stm32wb_oneshot_start(struct stm32wb_oneshot_s *oneshot,
/* Express the delay in microseconds */
usec = (uint64_t)ts->tv_sec * USEC_PER_SEC +
(uint64_t)(ts->tv_nsec / NSEC_PER_USEC);
usec = ts->tv_sec * USEC_PER_SEC +
(ts->tv_nsec / NSEC_PER_USEC);
/* Get the timer counter frequency and determine the number of counts need
* to achieve the requested delay.
+2 -2
View File
@@ -795,8 +795,8 @@ int up_timer_start(const struct timespec *ts)
/* Express the delay in microseconds */
usec = (uint64_t)ts->tv_sec * USEC_PER_SEC +
(uint64_t)(ts->tv_nsec / NSEC_PER_USEC);
usec = ts->tv_sec * USEC_PER_SEC +
(ts->tv_nsec / NSEC_PER_USEC);
/* Get the timer counter frequency and determine the number of counts need
* to achieve the requested delay.
+2 -2
View File
@@ -429,8 +429,8 @@ int up_timer_start(const struct timespec *ts)
/* Express the delay in microseconds */
usec = (uint64_t)ts->tv_sec * USEC_PER_SEC +
(uint64_t)(ts->tv_nsec / NSEC_PER_USEC);
usec = ts->tv_sec * USEC_PER_SEC +
(ts->tv_nsec / NSEC_PER_USEC);
/* Compute periods of the timers to match delay to wait */
@@ -301,8 +301,7 @@ static void avrdx_check_alarm_expired(uint8_t context)
/* Note about data types - struct timespec is defined
* in include/time.h, tv_sec is of type time_t which is defined
* in include/sys/types.h as uint32_t or uint64_t based
* on CONFIG_SYSTEM_TIME64
* in include/sys/types.h as uint64_t.
*
* tv_nsec is defined as long, signed value
*/
+3 -3
View File
@@ -302,10 +302,10 @@ int pic32mz_oneshot_start(struct pic32mz_oneshot_s *oneshot,
/* Express the delay in microseconds */
usec = (uint64_t)ts->tv_sec * USEC_PER_SEC +
(uint64_t)(ts->tv_nsec / NSEC_PER_USEC);
usec = ts->tv_sec * USEC_PER_SEC +
(ts->tv_nsec / NSEC_PER_USEC);
period = (usec * (uint64_t)oneshot->freq) / USEC_PER_SEC;
period = (usec * oneshot->freq) / USEC_PER_SEC;
tmrinfo("usec=%llu period=%08llx\n", usec, period);
DEBUGASSERT(period <= ((1ull << oneshot->width) - 1ul));
@@ -199,7 +199,7 @@ static uint32_t pic32mz_usec2ticks(struct pic32mz_lowerhalf_s *priv,
{
uint64_t bigticks;
bigticks = ((uint64_t)usecs * (uint64_t)priv->freq) / 1000000;
bigticks = (usecs * priv->freq) / 1000000;
if (bigticks > UINT32_MAX)
{
@@ -124,7 +124,7 @@ static inline uint64_t bl602_get_nsec(void)
up_timer_gettime(&ts);
return (uint64_t)ts.tv_nsec + (uint64_t)ts.tv_sec * NSEC_PER_SEC;
return ts.tv_nsec + ts.tv_sec * NSEC_PER_SEC;
}
/****************************************************************************
+2 -2
View File
@@ -1510,7 +1510,7 @@ static void esp_i2c_tracedump(struct esp_i2c_priv_s *priv)
struct esp_trace_s *trace;
int i;
syslog(LOG_DEBUG, "Elapsed time: %" PRIu32 "\n",
syslog(LOG_DEBUG, "Elapsed time: %" PRId64 "\n",
(clock_systime_ticks() - priv->start_time));
for (i = 0; i < priv->tndx; i++)
@@ -1518,7 +1518,7 @@ static void esp_i2c_tracedump(struct esp_i2c_priv_s *priv)
trace = &priv->trace[i];
syslog(LOG_DEBUG,
"%2d. STATUS: %08" PRIx32 " COUNT: %3" PRIu32 " EVENT: %s(%2d)"
" PARM: %08" PRIx32 " TIME: %" PRIu32 "\n",
" PARM: %08" PRIx32 " TIME: %" PRId64 "\n",
i + 1, trace->status, trace->count, g_trace_names[trace->event],
trace->event, trace->parm, trace->time - priv->start_time);
}
+1 -1
View File
@@ -775,7 +775,7 @@ int up_rtc_settime(const struct timespec *ts)
flags = spin_lock_irqsave(&g_rtc_lowerhalf.lock);
now_us = ((uint64_t) ts->tv_sec) * USEC_PER_SEC +
now_us = ts->tv_sec * USEC_PER_SEC +
ts->tv_nsec / NSEC_PER_USEC;
#ifdef CONFIG_RTC_DRIVER
@@ -359,8 +359,8 @@ int IRAM_ATTR up_timer_start(const struct timespec *ts)
up_timer_cancel(NULL);
}
target_us = (uint64_t)ts->tv_sec * USEC_PER_SEC +
(uint64_t)(ts->tv_nsec / NSEC_PER_USEC);
target_us = ts->tv_sec * USEC_PER_SEC +
(ts->tv_nsec / NSEC_PER_USEC);
alarm_ticks = systimer_hal_get_counter_value(&systimer_hal,
SYSTIMER_COUNTER_OS_TICK);
+2 -2
View File
@@ -1281,7 +1281,7 @@ static void esp32c3_i2c_tracedump(struct esp32c3_i2c_priv_s *priv)
struct esp32c3_trace_s *trace;
int i;
syslog(LOG_DEBUG, "Elapsed time: %" PRIu32 "\n",
syslog(LOG_DEBUG, "Elapsed time: %" PRId64 "\n",
(clock_systime_ticks() - priv->start_time));
for (i = 0; i < priv->tndx; i++)
@@ -1289,7 +1289,7 @@ static void esp32c3_i2c_tracedump(struct esp32c3_i2c_priv_s *priv)
trace = &priv->trace[i];
syslog(LOG_DEBUG,
"%2d. STATUS: %08" PRIx32 " COUNT: %3" PRIu32 " EVENT: %s(%2d)"
" PARM: %08" PRIx32 " TIME: %" PRIu32 "\n",
" PARM: %08" PRIx32 " TIME: %" PRId64 "\n",
i + 1, trace->status, trace->count, g_trace_names[trace->event],
trace->event, trace->parm, trace->time - priv->start_time);
}
@@ -283,8 +283,8 @@ int esp32c3_oneshot_start(struct esp32c3_oneshot_s *oneshot,
/* Retrieve the duration from timespec in microsecond */
timeout_us = (uint64_t)ts->tv_sec * USEC_PER_SEC +
(uint64_t)(ts->tv_nsec / NSEC_PER_USEC);
timeout_us = ts->tv_sec * USEC_PER_SEC +
(ts->tv_nsec / NSEC_PER_USEC);
/* Verify if it is a multiple of the configured resolution.
* In case it isn't, warn the user.
@@ -452,7 +452,7 @@ int esp32c3_oneshot_current(struct esp32c3_oneshot_s *oneshot,
ESP32C3_TIM_GETCTR(oneshot->tim, usec);
*usec = *usec * (uint64_t)oneshot->resolution;
*usec = *usec * oneshot->resolution;
return OK;
}
+2 -2
View File
@@ -444,8 +444,8 @@ static uint32_t IRAM_ATTR esp32c3_get_power_down_flags(void)
static void IRAM_ATTR esp32c3_timer_wakeup_prepare(void)
{
int64_t ticks;
int64_t sleep_duration = (int64_t)s_config.sleep_duration -
(int64_t) s_config.sleep_time_adjustment;
int64_t sleep_duration = s_config.sleep_duration -
s_config.sleep_time_adjustment;
if (sleep_duration < 0)
{
sleep_duration = 0;
+1 -1
View File
@@ -3136,7 +3136,7 @@ int up_rtc_settime(const struct timespec *ts)
DEBUGASSERT(ts != NULL && ts->tv_nsec < NSEC_PER_SEC);
flags = spin_lock_irqsave(&g_rtc_lock);
now_us = ((uint64_t) ts->tv_sec) * USEC_PER_SEC +
now_us = ts->tv_sec * USEC_PER_SEC +
ts->tv_nsec / NSEC_PER_USEC;
if (g_rt_timer_enabled == true)
{
@@ -453,8 +453,8 @@ int IRAM_ATTR up_timer_start(const struct timespec *ts)
up_timer_cancel(NULL);
}
cpu_ticks = SEC_2_CTICK((uint64_t)ts->tv_sec) +
NSEC_2_CTICK((uint64_t)ts->tv_nsec);
cpu_ticks = SEC_2_CTICK(ts->tv_sec) +
NSEC_2_CTICK(ts->tv_nsec);
up_tmr_setcounter(cpu_ticks);
g_timer_started = true;
@@ -386,7 +386,7 @@ static int esp32c3_timer_settimeout(struct timer_lowerhalf_s *lower,
/* Set the timeout */
ESP32C3_TIM_SETALRVL(priv->tim, (uint64_t)timeout);
ESP32C3_TIM_SETALRVL(priv->tim, timeout);
return ret;
}
@@ -2926,7 +2926,7 @@ static void wifi_rtc_disable_iso(void)
int64_t esp_timer_get_time(void)
{
return (int64_t)rt_timer_time_us();
return rt_timer_time_us();
}
/****************************************************************************
+2 -2
View File
@@ -1585,7 +1585,7 @@ static uint32_t IRAM_ATTR btdm_lpcycles_2_hus(uint32_t cycles,
uint64_t local_error_corr;
uint64_t res;
local_error_corr = (error_corr == NULL) ? 0 : (uint64_t)(*error_corr);
local_error_corr = (error_corr == NULL) ? 0 : (*error_corr);
res = (uint64_t)g_btdm_lpcycle_us * cycles * 2;
local_error_corr += res;
@@ -2981,7 +2981,7 @@ static void coex_bt_wakeup_request_end(void)
static IRAM_ATTR int64_t get_time_us_wrapper(void)
{
return (int64_t)esp_hr_timer_time_us();
return esp_hr_timer_time_us();
}
/****************************************************************************
+1 -1
View File
@@ -117,7 +117,7 @@ coex_adapter_funcs_t g_coex_adapter_funcs =
static IRAM_ATTR int64_t esp_coex_esp_timer_get_time_wrapper(void)
{
return (int64_t)esp_hr_timer_time_us();
return esp_hr_timer_time_us();
}
/****************************************************************************
+1 -1
View File
@@ -114,7 +114,7 @@ coex_adapter_funcs_t g_coex_adapter_funcs =
static IRAM_ATTR int64_t esp_coex_esp_timer_get_time_wrapper(void)
{
return (int64_t)esp_hr_timer_time_us();
return esp_hr_timer_time_us();
}
/****************************************************************************
+2 -2
View File
@@ -302,8 +302,8 @@ int up_timer_start(const struct timespec *ts)
litex_timer_cancel();
cpu_ticks = SEC_2_LITEX_TICK((uint64_t)ts->tv_sec) +
NSEC_2_LITEX_TICK((uint64_t)ts->tv_nsec);
cpu_ticks = SEC_2_LITEX_TICK(ts->tv_sec) +
NSEC_2_LITEX_TICK(ts->tv_nsec);
DEBUGASSERT(cpu_ticks <= UINT32_MAX);
+2 -2
View File
@@ -232,8 +232,8 @@ int bm3803_freerun_counter(struct bm3803_freerun_s *freerun,
ts->tv_sec = sec;
ts->tv_nsec = (usec - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
tmrinfo("usec=%llu ts=(%u, %lu)\n",
usec, ts->tv_sec, (unsigned long)ts->tv_nsec);
tmrinfo("usec=%llu ts=(%lld, %ld)\n",
usec, ts->tv_sec, ts->tv_nsec);
return OK;
}
+3 -3
View File
@@ -229,8 +229,8 @@ int bm3803_oneshot_start(struct bm3803_oneshot_s *oneshot,
/* Express the delay in microseconds */
usec = (uint64_t)ts->tv_sec * USEC_PER_SEC +
(uint64_t)(ts->tv_nsec / NSEC_PER_USEC);
usec = ts->tv_sec * USEC_PER_SEC +
(ts->tv_nsec / NSEC_PER_USEC);
/* Get the timer counter frequency and determine the number of counts need
* to achieve the requested delay.
@@ -240,7 +240,7 @@ int bm3803_oneshot_start(struct bm3803_oneshot_s *oneshot,
* = (usecs * frequency) / USEC_PER_SEC;
*/
period = (usec * (uint64_t)oneshot->frequency) / USEC_PER_SEC;
period = (usec * oneshot->frequency) / USEC_PER_SEC;
tmrinfo("usec=%llu period=%08llx\n", usec, period);
DEBUGASSERT(period <= UINT24_MAX);

Some files were not shown because too many files have changed in this diff Show More