zephyr/drivers/timer
Grant Ramsay e032f9520d drivers: systick: Fix Cortex-M systick jumping forward and back again
The existing implementation did not properly
handle when `SysTick->VAL` is zero.

This caused three subtle edge cases:
* val1=0,COUNTFLAG=0,val2=0
  This should result in no cycles elapsed,
  however `(last_load - val2) = last_load`.
  So an extra `last_load` cycles was returned.
* val1=0,COUNTFLAG=0,val2=(last_load-1)
  This should result in 1 cycle elapsed,
  however `val1 < val2` so an extra `last_load`
  cycles was returned.
* val1=[2,1,0],COUNTFLAG=1,val2=0
  This should result in `last_load` cycles elapsed.
  However, `last_load * 2` cycles was returned.

To fix the calculation, val1 and val2 are first
wrapped/realigned from [0:last_load-1] to [1:last_load].

Tidy comments to better reflect the SysTick
behaviour and link reference manuals.

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
2023-10-05 15:30:20 +01:00
..
altera_avalon_timer_hal.c drivers: timer: s/device.h/init.h 2023-08-29 11:29:18 +01:00
ambiq_stimer.c drivers: timer: Add driver for Ambiq system timer (STIMER) 2023-08-04 10:48:58 +02:00
apic_timer.c drivers: timer: s/device.h/init.h 2023-08-29 11:29:18 +01:00
apic_tsc.c drivers: timer: s/device.h/init.h 2023-08-29 11:29:18 +01:00
arcv2_timer0.c drivers: timer: s/device.h/init.h 2023-08-29 11:29:18 +01:00
arm_arch_timer.c drivers: timer: s/device.h/init.h 2023-08-29 11:29:18 +01:00
cc13xx_cc26xx_rtc_timer.c drivers: timer: s/device.h/init.h 2023-08-29 11:29:18 +01:00
CMakeLists.txt drivers: timer: Add driver for Ambiq system timer (STIMER) 2023-08-04 10:48:58 +02:00
cortex_m_systick.c drivers: systick: Fix Cortex-M systick jumping forward and back again 2023-10-05 15:30:20 +01:00
esp32c3_sys_timer.c drivers: timer: s/device.h/init.h 2023-08-29 11:29:18 +01:00
gecko_burtc_timer.c drivers: timer: s/device.h/init.h 2023-08-29 11:29:18 +01:00
hpet.c drivers: timer: s/device.h/init.h 2023-08-29 11:29:18 +01:00
intel_adsp_timer.c drivers: timer: s/device.h/init.h 2023-08-29 11:29:18 +01:00
ite_it8xxx2_timer.c drivers: timer: s/device.h/init.h 2023-08-29 11:29:18 +01:00
Kconfig drivers: timer: Add driver for Ambiq system timer (STIMER) 2023-08-04 10:48:58 +02:00
Kconfig.altera_avalon
Kconfig.ambiq drivers: timer: Add driver for Ambiq system timer (STIMER) 2023-08-04 10:48:58 +02:00
Kconfig.apic
Kconfig.arcv2
Kconfig.arm_arch
Kconfig.cavs
Kconfig.cc13xx_cc26xx_rtc dts: ti: cc13xx_cc26xx: devicetree sysclk alignment 2023-07-07 18:46:24 -04:00
Kconfig.cortex_m_systick drivers: systick: implement option for sys_clock_cycle_get_64() 2023-07-01 12:04:10 +02:00
Kconfig.esp32c3_sys soc: xtensa,riscv: esp32xx: refactor folder structure 2023-07-25 18:12:33 +02:00
Kconfig.gecko soc/arm/silabs_exx32: fix PM implementation - wake up using BURTC timer 2023-04-21 16:24:05 +02:00
Kconfig.hpet
Kconfig.ite_it8xxx2
Kconfig.leon_gptimer
Kconfig.litex
Kconfig.mchp_xec_rtos
Kconfig.mcux_gpt
Kconfig.mcux_lptmr
Kconfig.mcux_os
Kconfig.mips_cp0
Kconfig.native_posix
Kconfig.npcx_itim
Kconfig.nrf_rtc nrf53: pretick with NRF_802154_RADIO_DRIVER 2023-09-30 18:48:19 +02:00
Kconfig.rcar_cmt
Kconfig.riscv_machine riscv_machine_timer: remove unused config option 2023-06-01 04:53:19 -04:00
Kconfig.rv32m1_lptmr
Kconfig.sam0_rtc
Kconfig.stm32_lptim
Kconfig.xlnx_psttc
Kconfig.xtensa
leon_gptimer.c drivers: timer: s/device.h/init.h 2023-08-29 11:29:18 +01:00
litex_timer.c drivers: timer: s/device.h/init.h 2023-08-29 11:29:18 +01:00
mchp_xec_rtos_timer.c drivers: timer: s/device.h/init.h 2023-08-29 11:29:18 +01:00
mcux_gpt_timer.c drivers: timer: s/device.h/init.h 2023-08-29 11:29:18 +01:00
mcux_lptmr_timer.c drivers: timer: s/device.h/init.h 2023-08-29 11:29:18 +01:00
mcux_os_timer.c drivers: timer: s/device.h/init.h 2023-08-29 11:29:18 +01:00
mips_cp0_timer.c drivers: timer: s/device.h/init.h 2023-08-29 11:29:18 +01:00
native_posix_timer.c include: always use <> for Zephyr includes 2023-09-14 13:49:58 +02:00
npcx_itim_timer.c drivers: timer: s/device.h/init.h 2023-08-29 11:29:18 +01:00
nrf_rtc_timer.c nrf53: RTC pretick allows user channels and require just one CC 2023-09-30 18:48:19 +02:00
rcar_cmt_timer.c drivers: timer: s/device.h/init.h 2023-08-29 11:29:18 +01:00
riscv_machine_timer.c drivers: timer: s/device.h/init.h 2023-08-29 11:29:18 +01:00
rv32m1_lptmr_timer.c drivers: timer: s/device.h/init.h 2023-08-29 11:29:18 +01:00
sam0_rtc_timer.c drivers: timer: s/device.h/init.h 2023-08-29 11:29:18 +01:00
stm32_lptim_timer.c drivers: timer: s/device.h/init.h 2023-08-29 11:29:18 +01:00
sys_clock_init.c
xlnx_psttc_timer_priv.h
xlnx_psttc_timer.c drivers: timer: s/device.h/init.h 2023-08-29 11:29:18 +01:00
xtensa_sys_timer.c drivers: timer: s/device.h/init.h 2023-08-29 11:29:18 +01:00