nuttx/arch
Jukka Laitinen 429252152a arch/arm64/src/common/arm64_arch_timer.c: Remove clock drift from tick timer
This fixes two issues with the tick timer
1) Each tick was longer than the requested period. This is because setting
   the compare register was done by first reading the current time, and only
   after that setting the compare register. In addition, when handling the
   timer interrupts in arch_alarm.c / oneshot_callback, the current_tick is
   first read, all the tick handling is done and only after that the next tick
   is started. The whole tick processing time was added to the total tick time.

2) When the compare time is not aligned with tick period, and is drifting,
   eventually any call to ONESHOT_TICK_CURRENT would either return the current
   tick, or the next one, depending on the rounding of division by the
   cycle_per_tick. This again leads to oneshot_callback randomly handling
   two ticks at a time, which breaks all wdog based timers, causing them to
   randomly timeout too early.

The issues are fixed as follows:

Align the compare time register to be evenly divisible by cycle_per_tick.
This will lead arm64_tick_current always to return the currently ongoing tick,
fixing 2). Also calculating the next tick's start from the aligned current
count will fix 1), as there is no time drift in the start cycle.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-09-30 19:23:01 +08:00
..
arm pci alloc mis irq support new interface 2024-09-30 15:41:28 +08:00
arm64 arch/arm64/src/common/arm64_arch_timer.c: Remove clock drift from tick timer 2024-09-30 19:23:01 +08:00
avr compile: add DEBUG_SYMBOLS_LEVEL allow custom the level 2024-09-27 00:13:07 +08:00
ceva arch: change nxsched_suspend/resume_scheduler() called position 2024-09-27 09:53:33 +08:00
dummy
hc Revert "build depend:Revert Make.dep intermediate ddc file" 2024-09-15 19:29:47 +08:00
mips compile: add DEBUG_SYMBOLS_LEVEL allow custom the level 2024-09-27 00:13:07 +08:00
misoc compile: add DEBUG_SYMBOLS_LEVEL allow custom the level 2024-09-27 00:13:07 +08:00
or1k compile: add DEBUG_SYMBOLS_LEVEL allow custom the level 2024-09-27 00:13:07 +08:00
renesas Revert "build depend:Revert Make.dep intermediate ddc file" 2024-09-15 19:29:47 +08:00
risc-v risc-v: Support customize idle loop 2024-09-30 14:08:56 +08:00
sim sim: add NXSYMBOLS pthread_gettid_np pthread_self 2024-09-30 18:26:00 +08:00
sparc sched: change the SMP scheduling policy from synchronous to asynchronous 2024-09-29 08:54:51 +08:00
tricore compile: add DEBUG_SYMBOLS_LEVEL allow custom the level 2024-09-27 00:13:07 +08:00
x86 arch: change nxsched_suspend/resume_scheduler() called position 2024-09-27 09:53:33 +08:00
x86_64 pci alloc mis irq support new interface 2024-09-30 15:41:28 +08:00
xtensa xtensa: fix up_saveusercontext in interrupt context 2024-09-30 14:59:00 +08:00
z16 arch: use up_current_regs/up_set_current_regs replace CURRENT_REGS 2024-09-13 23:18:58 +08:00
z80 compile: add DEBUG_SYMBOLS_LEVEL allow custom the level 2024-09-27 00:13:07 +08:00
CMakeLists.txt greenhills: fix the arch_interface archive error 2024-09-27 23:39:56 +08:00
Kconfig binfmt/modlib: support loading each sections to different memory for Relocate object 2024-09-29 15:06:54 +08:00