Makes the choice CORTEX_M_SYSTICK_LPM dependent upon the
CORTEX_M_SYSTICK to prevent its default from showing up in
the .config of projects that do not use the CORTEX_M_SYSTICK
timer driver.
Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
The GRTC counter is not cleared at startup, therefore the
`last_count` variable needs to be initialized accordingly.
This change:
- Prevents overflow of the `sys_clock_announce()` int32_t parameter
- Ensures the correct uptime value, which should be reset during
initialization
Signed-off-by: Adam Kondraciuk <adam.kondraciuk@nordicsemi.no>
The original logic relied on the tick passed in. This method
is inaccurate as the tick value passed in was the exit latency.
Update the code to calculate the remaining time left and set
a counter using this value.
Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
1. add the ostimer
2. by default, the systick is used.
3. The ostimer could be tested with below configure in xxx.overlay:
&systick {
status = "disabled";
};
&ostimer0 {
status = "okay";
};
And below configure in xxx.conf:
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=1000000
Signed-off-by: Peter Wang <chaoyi.wang@nxp.com>
Selects TIMER_HAS_64BIT_CYCLE_COUNTER as an dependency for MCUX_OS_TIMER
This already is supported in the timer implementation in
drivers/timer/mcux_os_timer.c
Signed-off-by: Tomas Groth Christensen <tgc@foss.dk>
Converting absolute system ticks to RTC ticks is simple. It needs to be
multiplied by CYC_PER_TICK (which by default is 1). Complex algorithm
was used when driver was not tracking current 64 bit tick and function
was returning uint32_t.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
The EC timer runs at 9.2 MHz, which leads to a non-integer number of
ticks per microsecond. This causes slight overestimation when delays
are computed using whole ticks (e.g., using 10 ticks for 1 µs).
To address this, the busy wait calculation is adjusted with a
compensation factor to minimize cumulative timing error over time.
Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
Timer 7 is not used in timer driver, which means that timer
driver doesn't initialize timer 7, it's just declared in dtsi.
So I remove it, timer 7 will be used as alarm timer for counter driver.
Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
This driver currently only supports one instance of this timer and uses
it as the system clock. The instance is selected by being the first one
listed in DT in all places except sys_clock_driver_init() where it uses
the node label "systick_timer".
This driver should be fixed to correctly support multiple instances
of this timer, and the one used for the system timer should be selected
based on a flag or alias, not based on label.
For now simply use the 0th instance like everywhere else which removes
the need to have this node labeled a special way and makes no functional
changes to current users.
Signed-off-by: Andrew Davis <afd@ti.com>
This commit updates the riscv_machine_timer driver to resolve MTIME and
MTIMECMP register addresses by their `reg-names` instead of relying on
index order.
This improves clarity and robustness in DTS bindings, and is a prerequisite
for handling cases where not both MTIME and MTIMECMP registers are present
or accessible.
Signed-off-by: Chen Xingyu <hi@xingrz.me>
Update hal_wch.
As the hal upstream changed name, there is now a name conflict.
Rename ch32fun.h to hal_ch32fun.h to fix this conflict.
Signed-off-by: Miguel Gazquez <miguel.gazquez@bootlin.com>
Expand the current systick compatibility to include the CH32V00x
series. Change the HAL compatibility to include all of the CH32V
family.
Signed-off-by: Michael Hope <michaelh@juju.nz>
This commit add a system timer driver for Renesas RX using the
CMT peripheral. The driver supports both system ticks and
high-resolution cycle counting
- Configures CMT0 as the system tick timer
- Configures CMT1 as a free-running cycle timer for precise
time tracking
- Handles timer overflows to maintain a continuous cycle count.
- Implements sys_clock_cycle_get_32() and sys_clock_cycle_get_64()
for high-resolution timing
- Supports Zephyr tickless kernel mode by tracking elapsed cycles
- Enables interrupt-based tick announcement using CMT0
Signed-off-by: Duy Nguyen <duy.nguyen.xa@renesas.com>
Signed-off-by: Yuichi Nakada <yuichi.nakada.sx@renesas.com>
The CH32V003 CPU is a QingKe V2A while others in the CH32V00x series
use the QingKe V2C. Prepare for adding support for the CH32V006 moving
to the more specifc qingke-v2a, moving some cases of SOC_CH32V003
actually meaning SOC_FAMILY_QINGKE_V2A.
Signed-off-by: Michael Hope <michaelh@juju.nz>
This patch allows ti_dmtimer to provide the symbol z_sys_timer_irq_for_test
whenever tests are enabled. Not providing this results in failing some
kernel test cases which require this symbol.
Signed-off-by: Amneesh Singh <a-singh7@ti.com>
Drivers update to use shared interrupt allocator for Xtensa
and RISCV devices.
Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
Selection of the LF clock source for the GRTC should be performed
as early as possible, before starting GRTC.
Signed-off-by: Adam Kondraciuk <adam.kondraciuk@nordicsemi.no>
Converting absolute system ticks to GRTC ticks is simple and algorithm
can be simplified. Legacy algorithm was copied from nrf_rtc_timer which
back then was working on 32 bits only.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Convert z_clock_hw_cycles_per_sec to unsigned int to increase
supported frequency range.
Signed-off-by: Anisetti Avinash Krishna <anisetti.avinash.krishna@intel.com>
Add ULP Coprocessor board support for C6.
This requires a change in the board qualifier depending on the build
target.
Update esp32c6 overlay and configuration files to the proper name.
Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
Remove deprecated nxp,kinetis-lptmr compatible string
which is superseded by nxp,lptmr compatible due to
removing family specific name.
Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
These socs were missing a config line to disable SYSTICK if the LPTMR is
configured for the system timer, similar to how other SOCs do this for
alternative system timers than systick.
This fixes build errors in the case where that lptmr kconfig is enabled.
Also, the LPTMR kconfig should be default no because it is a secondary
option for the system timer, being lower resolution than systick. This
also resolves build errors.
Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
In the case where more than a full tick was unannounced when
sys_clock_set_timeout() was called, the timer driver would
subtract it from the next timeout. However, this is already
done by the caller through the elapsed() function in timeout.c,
leading to the timer interrupt firing too early.
With this fix, SYS_CLOCK_TICKS_PER_SEC can be increased to the
full speed of the low frequency timer. The underlying sleeptimer
API must be called with a timeout of at least 1, and will if needed
increase the value to the minimum value required by the hardware.
Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
Introduces the Z_IS_TIMEOUT_RELATIVE() macro to help ensure that
checking for relative/absolute timeouts is consistent. Using this
macro also helps ensure that we get the correct behavior when using
32-bit timeouts (CONFIG_TIMEOUT_64BIT=n).
Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
Do not start the LF clock unless CONFIG_CLOCK_CONTROL_NRF is enabled.
This is similar to how it's done in Nordic's GRTC driver.
Authored-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
Correct the introduction comment, removing the native_posix mention,
and something which did not apply for several years.
Also remove an unnecessary include.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Including renaming the kconfig option
NATIVE_POSIX_TIMER into NATIVE_SIM_TIMER deprecating the first one.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Now that native_posix has been removed, this driver only needs to
support native_sim. Let's stop using the transitional headers which
supported both.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>