-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use counter drivers as a system clock source #12068
Comments
FYI: @carlescufi, @ioannisg, @nordic-krch, @nashif, @andyross, @andrewboie |
The generic solution may add additional sources of increased latency. |
Back here the motivation for preserving tick as a distinct kernel time unit was that some architectures tick so fast that a If we base system time on a 64-bit--capable counter, is this distinction still necessary? I.e., do we need a tick interface that's different from the cycle interface? I very much want to see a 64-bit system time (capable of measuring up to 10 years) on any IoT device I develop for, and to not have to muck about with converting between different units (ticks, ms, whatever). |
TSC: defer after 1.14 and allow for basic prototyping once counter is merged. |
This commit introduces new "reset" parameter to the set_top_value() making resetting counter optional during change of top value. Such change allows for zephyrproject-rtos#12068 implementation on hardware which does not provide alarms. Signed-off-by: Piotr Zięcik <[email protected]> Signed-off-by: Krzysztof Chruscinski <[email protected]>
This commit introduces new "reset" parameter to the set_top_value() making resetting counter optional during change of top value. Such change allows for zephyrproject-rtos#12068 implementation on hardware which does not provide alarms. Signed-off-by: Piotr Zięcik <[email protected]> Signed-off-by: Krzysztof Chruscinski <[email protected]>
This commit introduces new "reset" parameter to the set_top_value() making resetting counter optional during change of top value. Such change allows for zephyrproject-rtos#12068 implementation on hardware which does not provide alarms. Signed-off-by: Piotr Zięcik <[email protected]> Signed-off-by: Krzysztof Chruscinski <[email protected]>
This commit introduces new top_value setting configuration structure with flag for controlling resetting of the counter during change of top value. Such change allows for zephyrproject-rtos#12068 implementation on hardware which does not provide alarms. Signed-off-by: Piotr Zięcik <[email protected]> Signed-off-by: Krzysztof Chruscinski <[email protected]> Signed-off-by: Benjamin Valentin <[email protected]>
This commit introduces new top_value setting configuration structure with flag for controlling resetting of the counter during change of top value. Such change allows for zephyrproject-rtos#12068 implementation on hardware which does not provide alarms. Signed-off-by: Piotr Zięcik <[email protected]> Signed-off-by: Krzysztof Chruscinski <[email protected]> Signed-off-by: Benjamin Valentin <[email protected]>
This commit introduces new top_value setting configuration structure with flag for controlling resetting of the counter during change of top value. Such change allows for #12068 implementation on hardware which does not provide alarms. Signed-off-by: Piotr Zięcik <[email protected]> Signed-off-by: Krzysztof Chruscinski <[email protected]> Signed-off-by: Benjamin Valentin <[email protected]>
@nordic-krch should we close this now? |
outdated, closing. |
At the moment the system clock source needs dedicated driver, which exports both tick interface (
z_clock_*()
) as well as cycle interface (_timer_cycle_get_32()
). Any change in the area needs rework of several drivers (see the #10556 as the example).Moreover, adding a new platform or extending current ones is also tricky. For example, the nRF5x platform could use different peripherals as a system clock source (RTC running at 32kHz or TIMER running at 1-16 MHz). The driver for TIMER is available, however it cannot be easily plugged in as a system clock source.
There is another drawback of current situation: The kernel expects some behaviour from the time source provided by the driver: The clock counter has to count up and has to be exactly 32-bit. Any platform which does not meet the expectations, has to implement software translation, which cannot be reused by other platforms or subsystems.
The recent feature requests (#9043 (comment), #6498, #2921), suggests that the rework of timers is not done and we might benefit from a kind of cleanup of this subsystem.
Part of such rework is already ongoing: #8331. I would like to take further steps and implement 2 hardware independent layers on top of the counter interface.
The first proposed layer would implement a generic counter and make it available for the system as well as the application. Such generic counter will have fixed width (for example 64 bits) and will always count up regardless of underlying hardware capabilities. Such interface might be generic implementation of
k_cycle_get_32()
(or even thek_cycle_get_64()
) as well as provide a stable base for other subsystems.The second proposed layer, would implement generic system clock source (the tick interface). As capabilities of the underlying "hardware" will be fixed, this layer will be generic and easy to extend and maintain.
Benefits of the proposed approach:
The text was updated successfully, but these errors were encountered: