Use the `silabs,sleeptimer` chosen node instead of a devicetree
compatible to select the devicetree node for the RTC.
Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
8498c39e13 seems to have introduce
an incorrect dependency which prevents the RTC timer from
been built if any of the RTC's are enabled.
It should only depend on the rtc1.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
In eb785ef, "prescaler" has been deprecated and
"prescale_glitch_filter" is used for prescale setting.
This patch removes "prescaler" parameter and use
"prescale_glitch_filter" to simplify code and fix build
error caused by "precsaler" parameter.
Signed-off-by: Felix Wang <fei.wang_3@nxp.com>
The Kconfig symbols for selecting HAL content should be part
of the HAL module integration, not defined by the SoC. Split the
symbols between the Series 0/1 Gecko HAL and Series 2 SiSDK HAL
when moving them.
For now, the Series 0/1 HAL symbols retain their name, while new
names consistent with the symbols already defined in the module
integration layer are used for the Series 2 HAL.
Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
Kconfig symbols for selecting HAL content should be part of the
HAL module integration, not defined in the SoC tree. Define the
sleeptimer symbol for WiSeConnect and SiSDK since both use it.
In the future, WiSeConnect should include the SiSDK configuration
and reuse it instead of redefining everything itself. This is a
larger scale refactor that this commit doesn't start tackling.
Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
There is no need to disable systimer in application level
as the restart procedure automatically handles it.
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
Remove the possibility to configure the LPTIM timer clock source
through Kconfig. The deprecation warning was added 3 years ago in
Zephyr 3.2 by commit bbac316be7; more
than enough time has elapsed for this option to be removed.
Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
GRTC is used by the logger, so it must be initialized
as early as possible. On the other hand, clock requests
are allowed once the clock control API has been initialized.
This PR introduces a two-stage GRTC initialization to meet
these requirements.
Signed-off-by: Adam Kondraciuk <adam.kondraciuk@nordicsemi.no>
Provide PM support, specifically suspend-to-ram, for STM32WB0x.
Enable STM32_RADIO_TIMER Kconfig parameter when PM is set.
Signed-off-by: Ali Hozhabri <ali.hozhabri@st.com>
Use radio timer as the system timer when Bluetooth is used.
Modify CMakeLists.txt to compile radio timer driver when
STM32WB0_RADIO_TIMER is enabled.
Remove the common parts from hci_stm32wb0.c that are present
in the radio timer driver.
Set and retrieve the appropriate value for SYS_CLOCK_TICKS_PER_SEC and
SYS_CLOCK_HW_CYCLES_PER_SEC respectively.
Define radio_timer node and its properties.
Enable radio_timer node in nucleo_wb0x boards.
Signed-off-by: Ali Hozhabri <ali.hozhabri@st.com>
Fix timer clock source initialization for MT8188, MT8186 platform.
Add 26Mhz define that is specific for MT818X.
Signed-off-by: Andrew Perepech <andrew.perepech@mediatek.com>
ti_dmtimer.h contains mask definitions only used internally by the
driver. Make it a private header.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Add system timer driver support for RZ/V2L, RZ/A3UL
Signed-off-by: Hoang Nguyen <hoang.nguyen.jx@bp.renesas.com>
Signed-off-by: Tien Nguyen <tien.nguyen.zg@renesas.com>
drivers: timers: Improve ISR Prototype for Renesas RZ
Switch to using the new NXP_ENABLE_WAKEUP_SIGNAL and
NXP_DISABLE_WAKEUP_SIGNAL macros to avoid adding
platform specific calls in the Zephyr drivers.
Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
The timer is enabled before comparison value is set, which can lead to
unexpected behavior if the registers contain uninitialized values.
Should call arm_arch_timer_enable() after arm_arch_timer_set_compare().
Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
z_nxp_os_timer_ignore_timer_wakeup() was only added
when Standby mode was enabled. Move this function
out of the conditional section.
Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
We can both optimize and clean up the code by using short circuit logic
and static variables instead of stack variables.
Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Refactor ISR by:
1) making a helper function to put the tickful calculation in, to reduce
an indentation level and cognitively separate this case while reading
2) Rewrite the calculations to simplify them. More info on that below.
Math changes:
- In the ISR, there was a variable called "now" which represented the
current cycle count of the timer. last_count was updated using a
calculation based on the number of elapsed ticks
and the hardware cycles per second value. However, this is
redundant because mathematically, this is equivalent to "now". So the
variable can just be set to now.
Proof is that the previous calculation was (in programming language):
(1) last_count = last_count + elapsed_ticks * CYC_PER_TICK
So let's rewrite this as the following to be clear about the different
values we are talking about here (in math language):
(2) count[t] = count[t-1] + elapsed_ticks * CYC_PER_TICK
We calculated elapsed ticks in the function as:
(3) elapsed_ticks = (now - last_count) / CYC_PER_TICK
(4) elapsed_ticks = (now - count[t-1]) / CYC_PER_TICK
Rearranging (2), we see
(5) elapsed_ticks = ( count[t] - count[t-1] ) / CYC_PER_TICK
Substituting this into (4), we get:
(6) ( count[t] - count[t-1] ) / CYC_PER_TICK =
(now - count[t-1]) / CYC_PER_TICK
Doing simple algebra, you can see we result with:
(7) count[t] = now
So therefore, we can simplify the programming expression to
(8) last_count = now
- The other change is regarding the calculation of the next tick match
value for tickful kernel mode. The previous calculation was doing:
(1) next = now + CYC_PER_TICK
We know that last_count is equivalent to now, at this point in the code
with the first change:
(2) next = last_count + CYC_PER_TICK
And then, for some reason, we are adding yet another CYC_PER_TICK to
next if (next - now) < MIN_DELAY. The reason for that I do not
understand, but let's write that down:
(3) next - now < MIN_DELAY
Now rewrite (2) as (4) and (3) as (5):
(4) count[t+1] = count[t] + CYC_PER_TICK
(5) count[t+1] - count[t] < MIN_DELAY
And now we substitute (4) into (5):
(6) count[t] + CYC_PER_TICK - count[t] < MIN_DELAY
And simplify:
(7) CYC_PER_TICK < MIN_DELAY
So actually no runtime calculations are needed here, this is a
hardcoding. The reason for this calculation I don't know, but we can
simplify the code.
Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
There are a couple places where effectively the exact same calculation
is done. Refactor to share code to do this calculation to make it easier
to read, and explode the code to multiple statements to be even easier
to follow the calculation. Compiler will likely optimize the same way
when opt enabled. Rename dticks variable to be more explicit what that
means (elapsed ticks).
Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Refactor to remove nesting and consolidate lines of code.
I also ran clang format but that actually did not change very much in
addition to what I had already changed manually.
Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
The counter that is used in Power Mode 3 to track System time could
overflow for large timeouts.
Add an API that the power system could use to ignore wakeup events
from the timer.
Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
Use channel 0 for RTC wrapping. Skip that channel when processing
channels.
Fix algorithm that prevents setting CC=0 when custom wrapping is used.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Allowed use of counter bit width lower than hardware 24.
In that case, PPI connection is established to trigger
clear task once maximum value is reached.
Signed-off-by: Michał Stasiak <michal.stasiak@nordicsemi.no>
Fixed build fail since 4c93fcd35b.
Fixed test run fail on Ambiq platforms.
Added Ambiq section in the test.
Signed-off-by: Swift Tian <swift.tian@ambiq.com>
when CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC set to 960M
and CONFIG_SYS_CLOCK_TICKS_PER_SEC set to 100
the MAX_TICKS will be zero or even negative value, which is not
expected.
so need add a protection here downgrading the accuracy to
its as high as possible
also add build message to show that tickless has no effect
fixes: #36766
there used to be a workaround, not a fix,
either change the CONFIG_SYS_CLOCK_TICKS_PER_SEC=200
or
CONFIG_PM to set the CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC
to 32678
Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
We want to simplify the maintenance burden and confusion of having
more than one driver for the same kernel timer peripheral used on
all Microchip MEC parts. The XEC version of the driver was converted
register definitions in the driver. Register access is performed using
Zephyr sys_read/write architecture specific inline routines. Driver DT
YAML was updated to use phandle for the 32-bit basic timer used for
ARCH_HAS_CUSTOM_BUSY_WAIT support, basic timer max value property,
and GIRQ interrtup aggregator hardware information.
SoC part Kconfigs, chip level/board level DTSI updated to use the
unified driver.
Signed-off-by: Scott Worley <scott.worley@microchip.com>
Turn MCX series into families.
Reasoning:
1. The MCX SOCs are quite different from each other and having them all
under one family in the HWMv2 hierarchy is fruitless because there
are so many differences that it is confusing to try to introduce
family-level code and configs since they would each only apply to a
subset of the series. There is almost nothing that can be shared
between all of them. Which is why there are comments in the MCX
family files saying not to put anything in them. This is a technical
waste.
2. Therefore, turning all of them into families is almost 0 effort and
makes sense. It will allow these different types of MCX to be
further subdivided into series in the future as the MCX portfolio
expands and such division will be necessary as new SOCs within each
letter family are released.
Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
To be consistent with the definition of label stm32_lp_tick_source,
be sure "st,timeout" is taken from the LPTIM defined as lp_tick_source.
Then, fix the computation of lptim_time_base.
Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
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>