1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #15716 from leandrolanzieri/pr/kconfig/ztimer

sys/ztimer: add modules to Kconfig
This commit is contained in:
Francisco 2021-01-20 15:31:20 +01:00 committed by GitHub
commit 5c5ec632a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 299 additions and 5 deletions

View File

@ -8,6 +8,7 @@
: ${TEST_BOARDS_LLVM_COMPILE:=""}
: ${TEST_KCONFIG_samr21_xpro:="examples/hello-world tests/periph_*
tests/xtimer_* tests/ztimer_*
tests/driver_ad7746 tests/driver_adcxx1c tests/driver_ads101x tests/driver_adt101x
tests/driver_adt7310 tests/driver_adxl345 tests/driver_aip31068 tests/driver_apa102
tests/driver_apds99xx tests/driver_apds99xx_full tests/driver_at tests/driver_at24cxxx
@ -22,7 +23,8 @@ tests/driver_motor_driver tests/driver_mpl3115a2 tests/driver_mpu9x50
tests/driver_mq3 tests/driver_my9221 tests/driver_nvram_spi tests/mtd_flashpage
tests/mtd_mapper tests/driver_o* tests/driver_p* tests/driver_q*
tests/driver_r*"}
: ${TEST_KCONFIG_native:="examples/hello-world tests/periph_*"}
: ${TEST_KCONFIG_native:="examples/hello-world tests/periph_*
tests/xtimer_* tests/ztimer_*"}
export RIOT_CI_BUILD=1
export CC_NOCOLOR=1

View File

@ -16,6 +16,7 @@ rsource "embunit/Kconfig"
rsource "entropy_source/Kconfig"
rsource "event/Kconfig"
rsource "fmt/Kconfig"
rsource "frac/Kconfig"
rsource "isrpipe/Kconfig"
rsource "malloc_thread_safe/Kconfig"
rsource "net/Kconfig"
@ -31,6 +32,7 @@ rsource "test_utils/Kconfig"
rsource "tsrb/Kconfig"
rsource "usb/Kconfig"
rsource "xtimer/Kconfig"
rsource "ztimer/Kconfig"
config MODULE_SYS
bool

10
sys/frac/Kconfig Normal file
View File

@ -0,0 +1,10 @@
# 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.
#
config MODULE_FRAC
bool "Fractional integer operations"
depends on TEST_KCONFIG

View File

@ -7,9 +7,12 @@
menuconfig MODULE_XTIMER
bool "xtimer"
select MODULE_PERIPH_TIMER if HAS_PERIPH_TIMER && !MODULE_XTIMER_ON_ZTIMER
depends on HAS_PERIPH_TIMER && !MODULE_XTIMER_ON_ZTIMER || MODULE_XTIMER_ON_ZTIMER
depends on HAS_PERIPH_TIMER || MODULE_XTIMER_ON_ZTIMER || MODULE_ZTIMER_XTIMER_COMPAT
depends on TEST_KCONFIG
# use timer peripheral unless ztimer compatibility module is used
select MODULE_PERIPH_TIMER if HAS_PERIPH_TIMER && !MODULE_XTIMER_ON_ZTIMER && !MODULE_ZTIMER_XTIMER_COMPAT
select MODULE_DIV if !MODULE_ZTIMER_XTIMER_COMPAT
help
Include xtimer module. xtimer requires a low-level timer implementation
@ -18,6 +21,5 @@ menuconfig MODULE_XTIMER
config MODULE_AUTO_INIT_XTIMER
bool "Auto-init xtimer"
default y if MODULE_AUTO_INIT
depends on !MODULE_ZTIMER_XTIMER_COMPAT
default y if MODULE_AUTO_INIT && !MODULE_ZTIMER_XTIMER_COMPAT
depends on MODULE_XTIMER

146
sys/ztimer/Kconfig Normal file
View File

@ -0,0 +1,146 @@
# 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
config MODULE_ZTIMER_PERIPH_TIMER
bool "Timer peripheral"
depends on HAS_PERIPH_TIMER
select MODULE_PERIPH_TIMER
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
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

View File

@ -0,0 +1,3 @@
# this file enables modules defined in Kconfig. Do not use this file for
# application configuration. This is only needed during migration.
CONFIG_MODULE_XTIMER=y

View File

@ -0,0 +1,6 @@
# this file enables modules defined in Kconfig. Do not use this file for
# application configuration. This is only needed during migration.
CONFIG_MODULE_XTIMER=y
CONFIG_MODULE_CORE_MSG=n
CONFIG_MODULE_TEST_UTILS_INTERACTIVE_SYNC=y

View File

@ -0,0 +1,3 @@
# this file enables modules defined in Kconfig. Do not use this file for
# application configuration. This is only needed during migration.
CONFIG_MODULE_XTIMER=y

View File

@ -0,0 +1,5 @@
# this file enables modules defined in Kconfig. Do not use this file for
# application configuration. This is only needed during migration.
CONFIG_MODULE_XTIMER=y
CONFIG_MODULE_TEST_UTILS_INTERACTIVE_SYNC=y

View File

@ -0,0 +1,5 @@
# this file enables modules defined in Kconfig. Do not use this file for
# application configuration. This is only needed during migration.
CONFIG_MODULE_XTIMER=y
CONFIG_MODULE_TEST_UTILS_INTERACTIVE_SYNC=y

View File

@ -0,0 +1,10 @@
# this file enables modules defined in Kconfig. Do not use this file for
# application configuration. This is only needed during migration.
CONFIG_MODULE_XTIMER=y
CONFIG_MODULE_SHELL=y
# for testing
# CONFIG_MODULE_PS=y
# CONFIG_MODULE_SHELL_COMMANDS=y
CONFIG_MODULE_TEST_UTILS_INTERACTIVE_SYNC=y

View File

@ -0,0 +1,6 @@
# this file enables modules defined in Kconfig. Do not use this file for
# application configuration. This is only needed during migration.
CONFIG_MODULE_XTIMER=y
CONFIG_MODULE_AUTO_INIT_XTIMER=n
CONFIG_MODULE_TEST_UTILS_INTERACTIVE_SYNC=y

View File

@ -0,0 +1,6 @@
# this file enables modules defined in Kconfig. Do not use this file for
# application configuration. This is only needed during migration.
CONFIG_MODULE_XTIMER=y
CONFIG_MODULE_FMT=y
CONFIG_MODULE_TEST_UTILS_INTERACTIVE_SYNC=y

View File

@ -0,0 +1,5 @@
# this file enables modules defined in Kconfig. Do not use this file for
# application configuration. This is only needed during migration.
CONFIG_MODULE_XTIMER=y
CONFIG_MODULE_TEST_UTILS_INTERACTIVE_SYNC=y

View File

@ -0,0 +1,5 @@
# this file enables modules defined in Kconfig. Do not use this file for
# application configuration. This is only needed during migration.
CONFIG_MODULE_XTIMER=y
CONFIG_MODULE_TEST_UTILS_INTERACTIVE_SYNC=y

View File

@ -0,0 +1,5 @@
# this file enables modules defined in Kconfig. Do not use this file for
# application configuration. This is only needed during migration.
CONFIG_MODULE_XTIMER=y
CONFIG_MODULE_TEST_UTILS_INTERACTIVE_SYNC=y

View File

@ -0,0 +1,5 @@
# this file enables modules defined in Kconfig. Do not use this file for
# application configuration. This is only needed during migration.
CONFIG_MODULE_XTIMER=y
CONFIG_MODULE_TEST_UTILS_INTERACTIVE_SYNC=y

View File

@ -0,0 +1,5 @@
# this file enables modules defined in Kconfig. Do not use this file for
# application configuration. This is only needed during migration.
CONFIG_MODULE_XTIMER=y
CONFIG_MODULE_TEST_UTILS_INTERACTIVE_SYNC=y

View File

@ -0,0 +1,6 @@
# this file enables modules defined in Kconfig. Do not use this file for
# application configuration. This is only needed during migration.
CONFIG_MODULE_XTIMER=y
CONFIG_MODULE_SHELL=y
CONFIG_MODULE_TEST_UTILS_INTERACTIVE_SYNC=y

View File

@ -0,0 +1,5 @@
# this file enables modules defined in Kconfig. Do not use this file for
# application configuration. This is only needed during migration.
CONFIG_MODULE_XTIMER=y
CONFIG_MODULE_TEST_UTILS_INTERACTIVE_SYNC=y

View File

@ -0,0 +1,5 @@
# this file enables modules defined in Kconfig. Do not use this file for
# application configuration. This is only needed during migration.
CONFIG_MODULE_XTIMER=y
CONFIG_MODULE_TEST_UTILS_INTERACTIVE_SYNC=y

View File

@ -0,0 +1,7 @@
# this file enables modules defined in Kconfig. Do not use this file for
# application configuration. This is only needed during migration.
CONFIG_MODULE_ZTIMER=y
CONFIG_MODULE_ZTIMER_PERIPH_TIMER=y
CONFIG_MODULE_ZTIMER_USEC=y
CONFIG_MODULE_TEST_UTILS_INTERACTIVE_SYNC=y

View File

@ -0,0 +1,7 @@
# this file enables modules defined in Kconfig. Do not use this file for
# application configuration. This is only needed during migration.
CONFIG_MODULE_ZTIMER=y
CONFIG_MODULE_ZTIMER_PERIPH_TIMER=y
CONFIG_MODULE_ZTIMER_USEC=y
CONFIG_MODULE_TEST_UTILS_INTERACTIVE_SYNC=y

View File

@ -0,0 +1,8 @@
# this file enables modules defined in Kconfig. Do not use this file for
# application configuration. This is only needed during migration.
CONFIG_MODULE_ZTIMER=y
CONFIG_MODULE_ZTIMER_PERIPH_TIMER=y
CONFIG_MODULE_ZTIMER_USEC=y
CONFIG_MODULE_ZTIMER_OVERHEAD=y
CONFIG_MODULE_TEST_UTILS_INTERACTIVE_SYNC=y

View File

@ -0,0 +1,10 @@
# this file enables modules defined in Kconfig. Do not use this file for
# application configuration. This is only needed during migration.
CONFIG_MODULE_ZTIMER=y
CONFIG_MODULE_ZTIMER_PERIPH_TIMER=y
CONFIG_MODULE_ZTIMER_USEC=y
CONFIG_MODULE_ZTIMER_MSEC=y
CONFIG_MODULE_FMT=y
CONFIG_MODULE_TEST_UTILS_INTERACTIVE_SYNC=y

View File

@ -7,6 +7,10 @@ USEMODULE += ztimer_usec
ifeq ($(TEST_ZTIMER_CLOCK), ZTIMER_MSEC)
USEMODULE += ztimer_msec
USEMODULE += ztimer_periph_rtt
# the same for Kconfig
ifeq (1,$(TEST_KCONFIG))
KCONFIG_ADD_CONFIG += $(APPDIR)/app.config.msec.test
endif
endif
CFLAGS += -DTEST_ZTIMER_CLOCK=$(TEST_ZTIMER_CLOCK)

View File

@ -0,0 +1,4 @@
# this file enables modules defined in Kconfig. Do not use this file for
# application configuration. This is only needed during migration.
CONFIG_MODULE_ZTIMER_MSEC=y
CONFIG_MODULE_ZTIMER_PERIPH_RTT=y

View File

@ -0,0 +1,7 @@
# this file enables modules defined in Kconfig. Do not use this file for
# application configuration. This is only needed during migration.
CONFIG_MODULE_ZTIMER=y
CONFIG_MODULE_ZTIMER_PERIPH_TIMER=y
CONFIG_MODULE_ZTIMER_USEC=y
CONFIG_MODULE_TEST_UTILS_INTERACTIVE_SYNC=y