nuttx/drivers
Max Kriegleder eb92f0f8c8 drivers/timers: avoid 32-bit overflow in arch_timer current_usec
current_usec() returns a uint64_t, but it used TICK2USEC(timebase)
to convert scheduler ticks to microseconds. On 32-bit clock_t builds,
TICK2USEC() performs the multiplication in 32-bit arithmetic before the
result is widened.

With CONFIG_USEC_PER_TICK=10000, this wraps after about 71.6 minutes:

  UINT32_MAX / 1000000 ~= 4294 seconds

After the wrap, up_timer_gettick() can report time near zero again. This
can leave absolute watchdog timeouts, such as those used by usleep() /
clock_nanosleep(), waiting for a tick value that will not be reached until
the 32-bit scheduler counter wraps.

Cast timebase to uint64_t before multiplying by USEC_PER_TICK so
current_usec() remains monotonic across the 32-bit microsecond boundary.

Signed-off-by: Max Kriegleder <max.kriegleder@gmail.com>
2026-05-06 08:49:52 +02:00
..
1wire style: fix checkpatch issues after debug.h move 2026-04-07 07:50:06 -03:00
aie include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
analog include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
audio style: fix checkpatch issues after debug.h move 2026-04-07 07:50:06 -03:00
bch include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
can drivers/can: Fix close drain, write-only reader lifecycle, and STM32 RX header 2026-04-28 10:32:56 -03:00
clk include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
contactless include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
coresight style: fix checkpatch issues after debug.h move 2026-04-07 07:50:06 -03:00
crypto include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
devicetree include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
dma drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
dummy drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
eeprom include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
efuse include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
i2c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
i2s include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
i3c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
input drivers/mpr121: Add support to MPR121 Capacitive Keypad 2026-04-23 15:56:32 -03:00
ioexpander include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
ipcc include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
lcd !boards: Remove NSH_ARCHINIT and board_app_initialize 2026-05-02 18:36:46 +08:00
leds include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
loop include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
math include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
misc include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
mmcsd include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
modem style: fix checkpatch issues after debug.h move 2026-04-07 07:50:06 -03:00
motor style: fix checkpatch issues after debug.h move 2026-04-07 07:50:06 -03:00
mtd drivers/mtd/w25n: address review comments 2026-04-23 16:26:44 +02:00
net include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
note include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
pci include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
pinctrl drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
pipes include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
power include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
rc include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
regmap include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
reset include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
rf include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
rpmsg include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
rptun include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
segger drivers/segger: Add a kconfig to override Segger SystemView target sources version 2025-07-22 23:21:31 +08:00
sensors drivers/sensors: Add support to MT6816 2026-05-03 07:56:38 -03:00
serial style: fix checkpatch issues after debug.h move 2026-04-07 07:50:06 -03:00
spi include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
syslog include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
thermal include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
timers drivers/timers: avoid 32-bit overflow in arch_timer current_usec 2026-05-06 08:49:52 +02:00
usbdev include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
usbhost drivers/usbhost/usbhost_cdcecm.c: Converted CDC-ECM to lower half 2026-05-06 06:20:03 +08:00
usbmisc include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
usbmonitor include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
usrsock include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
vhost include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
video drivers/fb: Fix a symbol missing CONFIG_ 2026-05-02 15:26:10 -03:00
virtio include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
wireless style: fix checkpatch issues after debug.h move 2026-04-07 07:50:06 -03:00
.gitignore build: Remve the unnecessary .gitignore 2020-05-23 18:00:40 +01:00
CMakeLists.txt drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
drivers_initialize.c serial/uart_rpmsg: add _raw version of driver 2026-02-23 09:19:57 -03:00
Kconfig espressif/rmt: replace rmtchar with arch-specific lirc adapter 2026-04-04 11:18:32 -03:00
Makefile docs/rc: document RC/LIRC drivers and remove empty drivers/rmt files 2026-04-04 11:18:32 -03:00