mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
9d1d2f9e21
sys/ztimer: add ZTIMER_SEC, improve auto_init
158 lines
4.3 KiB
Plaintext
158 lines
4.3 KiB
Plaintext
# Copyright (c) 2021 HAW Hamburg
|
|
#
|
|
# This file is subject to the terms and conditions of the GNU Lesser
|
|
# General Public License v2.1. See the file LICENSE in the top level
|
|
# directory for more details.
|
|
#
|
|
|
|
menuconfig MODULE_ZTIMER
|
|
bool "ztimer - High level timer abstraction layer"
|
|
depends on TEST_KCONFIG
|
|
select MODULE_ZTIMER_CORE
|
|
select MODULE_ZTIMER_CONVERT_FRAC
|
|
select MODULE_ZTIMER_CONVERT_SHIFT
|
|
select MODULE_ZTIMER_EXTEND
|
|
|
|
if MODULE_ZTIMER
|
|
|
|
menu "Backends"
|
|
|
|
config MODULE_ZTIMER_PERIPH_RTC
|
|
bool "RTC peripheral"
|
|
depends on HAS_PERIPH_RTC
|
|
select MODULE_PERIPH_RTC
|
|
|
|
config MODULE_ZTIMER_PERIPH_RTT
|
|
bool "RTT peripheral"
|
|
depends on HAS_PERIPH_RTT
|
|
select MODULE_PERIPH_RTT
|
|
default y if !MODULE_ZTIMER_PERIPH_TIMER
|
|
|
|
config MODULE_ZTIMER_PERIPH_PTP
|
|
bool "PTP peripheral"
|
|
depends on HAS_PERIPH_PTP_TIMER
|
|
select MODULE_PERIPH_PTP_TIMER
|
|
|
|
config MODULE_ZTIMER_PERIPH_TIMER
|
|
bool "Timer peripheral"
|
|
depends on HAS_PERIPH_TIMER
|
|
select MODULE_PERIPH_TIMER
|
|
default y
|
|
|
|
endmenu # Backends
|
|
|
|
menu "Clocks"
|
|
|
|
config MODULE_ZTIMER_USEC
|
|
bool "Microseconds"
|
|
depends on MODULE_ZTIMER_PERIPH_TIMER
|
|
|
|
config MODULE_ZTIMER_MSEC
|
|
bool "Milliseconds"
|
|
depends on MODULE_ZTIMER_PERIPH_TIMER || MODULE_ZTIMER_PERIPH_RTT
|
|
|
|
config MODULE_ZTIMER_SEC
|
|
bool "Seconds"
|
|
depends on MODULE_ZTIMER_PERIPH_TIMER || MODULE_ZTIMER_PERIPH_RTT || MODULE_ZTIMER_PERIPH_RTC
|
|
|
|
endmenu # Clocks
|
|
|
|
|
|
menu "Frequency conversion"
|
|
|
|
config MODULE_ZTIMER_CONVERT_MULDIV64
|
|
bool "64-bits arithmetic conversion"
|
|
select MODULE_ZTIMER_CONVERT
|
|
help
|
|
muldiv64 is very precise, but the overhead is the highest. On MCUs
|
|
without hardware division this might not be a good choice.
|
|
|
|
config MODULE_ZTIMER_CONVERT_FRAC
|
|
bool "Fractional conversion"
|
|
select MODULE_ZTIMER_CONVERT
|
|
select MODULE_FRAC
|
|
help
|
|
Frac can be used for arbitrary frequency conversions, but trades in
|
|
precision to gain speed. In cases where shift conversion cannot be used,
|
|
this is likely the best trade off.
|
|
|
|
config MODULE_ZTIMER_CONVERT_SHIFT
|
|
bool "Shift conversion"
|
|
select MODULE_ZTIMER_CONVERT
|
|
help
|
|
Shift conversion is both fast and super precise, but cannot work for
|
|
arbitrary frequencies. It's kind of a software prescaler for the
|
|
underlying clock. So if the hardware clock frequency and the target
|
|
clock frequency differ by a factor that is a power of two, this is the
|
|
best choice - otherwise it is simply not usable.
|
|
|
|
config MODULE_ZTIMER_CONVERT
|
|
bool
|
|
|
|
endmenu # Frequency conversion
|
|
|
|
|
|
menu "xtimer and evtimer compatibility"
|
|
|
|
choice
|
|
bool "xtimer compatibility"
|
|
optional
|
|
depends on MODULE_ZTIMER_USEC
|
|
|
|
config MODULE_XTIMER_ON_ZTIMER
|
|
bool "ztimer_usec as timer backend for xtimer"
|
|
|
|
config MODULE_ZTIMER_XTIMER_COMPAT
|
|
bool "map xtimer calls to ztimer"
|
|
select MODULE_DIV
|
|
help
|
|
This is a wrapper of xtimer API on ztimer_usec and is currently
|
|
incomplete. Unless doing testing, use xtimer on ztimer.
|
|
|
|
endchoice
|
|
|
|
comment "The ztimer xtimer compatibility module is incomplete, consider using MODULE_XTIMER_ON_ZTIMER instead."
|
|
depends on MODULE_ZTIMER_XTIMER_COMPAT
|
|
|
|
config MODULE_EVTIMER_ON_ZTIMER
|
|
bool "Use ztimer_msec as timer backend for evtimer"
|
|
depends on MODULE_ZTIMER_MSEC
|
|
select MODULE_ZTIMER_NOW64
|
|
|
|
endmenu # xtimer compatibility
|
|
|
|
|
|
# TODO: only use MODULE_ZTIMER_AUTO_INIT, for now we try to get the same modules
|
|
# as the Makefile dependency resolution. See sys/ztimer/Makefile.dep for more
|
|
# info on why two modules are used.
|
|
config MODULE_AUTO_INIT_ZTIMER
|
|
bool "Auto initialize ztimer"
|
|
depends on MODULE_AUTO_INIT
|
|
select MODULE_ZTIMER_AUTO_INIT
|
|
default y
|
|
|
|
config MODULE_ZTIMER_NOW64
|
|
bool "Use a 64-bits result for ztimer_now()"
|
|
|
|
config MODULE_ZTIMER_OVERHEAD
|
|
bool "Overhead measurement functionalities"
|
|
|
|
config MODULE_ZTIMER_MOCK
|
|
bool "Mock backend (for testing only)"
|
|
help
|
|
This ztimer module implements a virtual clock that can be used for
|
|
unittests. It can be manually adjusted to different timestamps and
|
|
manually fired to simulate different scenarios and test the ztimer
|
|
implementation using this as a backing timer.
|
|
|
|
config MODULE_ZTIMER_AUTO_INIT
|
|
bool
|
|
|
|
config MODULE_ZTIMER_CORE
|
|
bool
|
|
|
|
config MODULE_ZTIMER_EXTEND
|
|
bool
|
|
|
|
endif # MODULE_ZTIMER
|