mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-16 10:03:50 +01:00
Merge pull request #17811 from fjmolinas/pr_xtimer_dep_rework_simple
sys/*timer: rework dependecies to ease backend switch, prefer ztimer_xtimer_compat over xtimer_on_ztimer
This commit is contained in:
commit
202fb261fe
@ -39,14 +39,14 @@ config MODULE_PERIPH_RTC_SERIES1
|
|||||||
help
|
help
|
||||||
RTC driver implementation for EFM32 series 1.
|
RTC driver implementation for EFM32 series 1.
|
||||||
|
|
||||||
config MODULE_PERIPH_RTT_SERIES0
|
config PERIPH_RTT_SERIES0
|
||||||
bool
|
bool
|
||||||
depends on CPU_EFM32_SERIES0
|
depends on CPU_EFM32_SERIES0
|
||||||
default MODULE_PERIPH_RTT
|
default MODULE_PERIPH_RTT
|
||||||
help
|
help
|
||||||
RTT driver implementation for EFM32 series 0.
|
RTT driver implementation for EFM32 series 0.
|
||||||
|
|
||||||
config MODULE_PERIPH_RTT_SERIES1
|
config PERIPH_RTT_SERIES1
|
||||||
bool
|
bool
|
||||||
depends on CPU_EFM32_SERIES1
|
depends on CPU_EFM32_SERIES1
|
||||||
default MODULE_PERIPH_RTT
|
default MODULE_PERIPH_RTT
|
||||||
|
|||||||
@ -21,6 +21,4 @@ config MODULE_PERIPH_GPIO_MUX
|
|||||||
config MODULE_PERIPH_ADC
|
config MODULE_PERIPH_ADC
|
||||||
bool "ADC peripheral driver"
|
bool "ADC peripheral driver"
|
||||||
depends on HAS_PERIPH_ADC
|
depends on HAS_PERIPH_ADC
|
||||||
select MODULE_ZTIMER
|
select ZTIMER_USEC
|
||||||
select MODULE_ZTIMER_USEC
|
|
||||||
select MODULE_ZTIMER_PERIPH_TIMER
|
|
||||||
|
|||||||
@ -14,9 +14,7 @@ menuconfig MODULE_CCS811
|
|||||||
depends on TEST_KCONFIG
|
depends on TEST_KCONFIG
|
||||||
select MODULE_PERIPH_GPIO
|
select MODULE_PERIPH_GPIO
|
||||||
select MODULE_PERIPH_I2C
|
select MODULE_PERIPH_I2C
|
||||||
select MODULE_ZTIMER
|
select ZTIMER_USEC
|
||||||
select MODULE_ZTIMER_USEC
|
|
||||||
select MODULE_ZTIMER_PERIPH_TIMER
|
|
||||||
|
|
||||||
config MODULE_CCS811_FULL
|
config MODULE_CCS811_FULL
|
||||||
bool "Full functionalities"
|
bool "Full functionalities"
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
# Include this for boards whose timer periph cannot generate a clock frequency
|
# Include this for boards whose timer periph cannot generate a clock frequency
|
||||||
# suitable for xtimer with the available clock sources and dividers.
|
# suitable for xtimer with the available clock sources and dividers.
|
||||||
# This will use ztimer to perform the required frequency conversion.
|
# This will use ztimer to perform the required frequency conversion.
|
||||||
# By default, xtimer is still used with ztimer as backed, unless
|
# By default, ztimer_xtimer_compat is used unless xtimer_on_ztimer is
|
||||||
# ztimer_xtimer_compat is used.
|
# selected.
|
||||||
|
|
||||||
ifneq (,$(filter xtimer,$(USEMODULE)))
|
ifneq (,$(filter xtimer,$(USEMODULE)))
|
||||||
ifeq (,$(filter ztimer_xtimer_compat ztimer64_xtimer_compat,$(USEMODULE)))
|
ifeq (,$(filter xtimer_on_ztimer,$(USEMODULE)))
|
||||||
USEMODULE += xtimer_on_ztimer
|
USEMODULE += ztimer_xtimer_compat
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|||||||
@ -13,3 +13,9 @@ endif
|
|||||||
ifneq (,$(filter auto_init_saul,$(USEMODULE)))
|
ifneq (,$(filter auto_init_saul,$(USEMODULE)))
|
||||||
USEMODULE += saul_init_devs
|
USEMODULE += saul_init_devs
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifneq (,$(filter xtimer,$(USEMODULE)))
|
||||||
|
ifeq (,$(filter ztimer_xtimer_compat,$(USEMODULE)))
|
||||||
|
USEMODULE += div
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|||||||
@ -257,6 +257,7 @@ PSEUDOMODULES += vfs_default
|
|||||||
PSEUDOMODULES += wakaama_objects_%
|
PSEUDOMODULES += wakaama_objects_%
|
||||||
PSEUDOMODULES += wifi_enterprise
|
PSEUDOMODULES += wifi_enterprise
|
||||||
PSEUDOMODULES += xtimer_on_ztimer
|
PSEUDOMODULES += xtimer_on_ztimer
|
||||||
|
PSEUDOMODULES += xtimer_no_ztimer_default
|
||||||
PSEUDOMODULES += zptr
|
PSEUDOMODULES += zptr
|
||||||
PSEUDOMODULES += ztimer
|
PSEUDOMODULES += ztimer
|
||||||
PSEUDOMODULES += ztimer_%
|
PSEUDOMODULES += ztimer_%
|
||||||
|
|||||||
@ -10,8 +10,7 @@ config PACKAGE_U8G2
|
|||||||
depends on TEST_KCONFIG
|
depends on TEST_KCONFIG
|
||||||
depends on HAS_PERIPH_GPIO
|
depends on HAS_PERIPH_GPIO
|
||||||
select MODULE_PERIPH_GPIO
|
select MODULE_PERIPH_GPIO
|
||||||
select MODULE_ZTIMER
|
select ZTIMER_USEC
|
||||||
select MODULE_ZTIMER_USEC
|
|
||||||
select MODULE_U8G2_RIOT
|
select MODULE_U8G2_RIOT
|
||||||
select MODULE_U8G2_CSRC
|
select MODULE_U8G2_CSRC
|
||||||
|
|
||||||
|
|||||||
@ -10,8 +10,7 @@ config PACKAGE_UCGLIB
|
|||||||
depends on TEST_KCONFIG
|
depends on TEST_KCONFIG
|
||||||
depends on HAS_PERIPH_GPIO
|
depends on HAS_PERIPH_GPIO
|
||||||
select MODULE_PERIPH_GPIO
|
select MODULE_PERIPH_GPIO
|
||||||
select MODULE_ZTIMER
|
select ZTIMER_USEC
|
||||||
select MODULE_ZTIMER_USEC
|
|
||||||
select MODULE_UCGLIB_RIOT
|
select MODULE_UCGLIB_RIOT
|
||||||
select MODULE_UCGLIB_CSRC
|
select MODULE_UCGLIB_CSRC
|
||||||
|
|
||||||
|
|||||||
@ -857,20 +857,7 @@ endif
|
|||||||
|
|
||||||
# handle xtimer's deps. Needs to be done *after* ztimer
|
# handle xtimer's deps. Needs to be done *after* ztimer
|
||||||
ifneq (,$(filter xtimer,$(USEMODULE)))
|
ifneq (,$(filter xtimer,$(USEMODULE)))
|
||||||
ifeq (,$(filter ztimer_xtimer_compat,$(USEMODULE)))
|
include $(RIOTBASE)/sys/xtimer/Makefile.dep
|
||||||
# xtimer is used, ztimer xtimer wrapper is not
|
|
||||||
DEFAULT_MODULE += auto_init_xtimer
|
|
||||||
USEMODULE += div
|
|
||||||
ifeq (,$(filter xtimer_on_ztimer,$(USEMODULE)))
|
|
||||||
# ztimer is not used, so use *periph_timer as low-level timer*.
|
|
||||||
FEATURES_REQUIRED += periph_timer
|
|
||||||
else
|
|
||||||
# will use *ztimer_usec as low-level timer*
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
# ztimer_xtimer_compat is used, all of *xtimer's API will be mapped on ztimer
|
|
||||||
# or ztimer64 *
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq (,$(filter devfs_hwrng,$(USEMODULE)))
|
ifneq (,$(filter devfs_hwrng,$(USEMODULE)))
|
||||||
|
|||||||
@ -31,9 +31,10 @@
|
|||||||
#include "net/utils.h"
|
#include "net/utils.h"
|
||||||
#include "timex.h"
|
#include "timex.h"
|
||||||
#include "utlist.h"
|
#include "utlist.h"
|
||||||
#if IS_USED(MODULE_ZTIMER)
|
#if IS_USED(MODULE_ZTIMER_USEC) || IS_USED(MODULE_ZTIMER_MSEC)
|
||||||
#include "ztimer.h"
|
#include "ztimer.h"
|
||||||
#else
|
#endif
|
||||||
|
#if IS_USED(MODULE_XTIMER)
|
||||||
#include "xtimer.h"
|
#include "xtimer.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -8,6 +8,4 @@
|
|||||||
config MODULE_TRACE
|
config MODULE_TRACE
|
||||||
bool "Trace program flows"
|
bool "Trace program flows"
|
||||||
depends on TEST_KCONFIG
|
depends on TEST_KCONFIG
|
||||||
select MODULE_ZTIMER
|
select ZTIMER_USEC
|
||||||
select MODULE_ZTIMER_USEC
|
|
||||||
select MODULE_ZTIMER_PERIPH_TIMER
|
|
||||||
|
|||||||
@ -8,17 +8,22 @@
|
|||||||
menuconfig MODULE_XTIMER
|
menuconfig MODULE_XTIMER
|
||||||
bool "xtimer"
|
bool "xtimer"
|
||||||
depends on HAS_PERIPH_TIMER
|
depends on HAS_PERIPH_TIMER
|
||||||
depends on TEST_KCONFIG
|
select MODULE_PERIPH_TIMER
|
||||||
# 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 && !MODULE_ZTIMER64_XTIMER_COMPAT
|
|
||||||
|
|
||||||
select MODULE_DIV if !MODULE_ZTIMER_XTIMER_COMPAT
|
select MODULE_DIV if !MODULE_ZTIMER_XTIMER_COMPAT
|
||||||
|
select ZTIMER_USEC if !MODULE_XTIMER_NO_ZTIMER_DEFAULT
|
||||||
help
|
help
|
||||||
Include xtimer module. xtimer requires a low-level timer implementation
|
Include xtimer module. xtimer requires a low-level timer implementation
|
||||||
that can be provided either by a peripheral timer or the ztimer module
|
that can be provided either by a peripheral timer or the ztimer module
|
||||||
when MODULE_XTIMER_ON_ZTIMER is enabled.
|
when MODULE_XTIMER_ON_ZTIMER is enabled.
|
||||||
|
|
||||||
|
if MODULE_XTIMER
|
||||||
|
|
||||||
|
config MODULE_XTIMER_NO_ZTIMER_DEFAULT
|
||||||
|
bool "xtimer does not select ztimer"
|
||||||
|
default y
|
||||||
|
|
||||||
config MODULE_AUTO_INIT_XTIMER
|
config MODULE_AUTO_INIT_XTIMER
|
||||||
bool "Auto-init xtimer"
|
bool "Auto-init xtimer"
|
||||||
default y if MODULE_AUTO_INIT && !MODULE_ZTIMER_XTIMER_COMPAT
|
default y if MODULE_AUTO_INIT && !MODULE_ZTIMER_XTIMER_COMPAT
|
||||||
depends on MODULE_XTIMER
|
|
||||||
|
endif # MODULE_XTIMER
|
||||||
|
|||||||
31
sys/xtimer/Makefile.dep
Normal file
31
sys/xtimer/Makefile.dep
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
DEFAULT_MODULE += auto_init_xtimer
|
||||||
|
# In whatever combination of backends periph_timer will be required
|
||||||
|
# - xtimer (only) -> periph_timer
|
||||||
|
# - xtimer_on_ztimer -> ztimer_usec -> ztimer_periph_timer -> periph_timer
|
||||||
|
# - ztimer_xtimer_compat -> ztimer_usec -> ztimer_periph_timer -> periph_timer
|
||||||
|
# But requesting it here avoid an ifeq dependency that would be subject to
|
||||||
|
# dependency inclusion order issues
|
||||||
|
FEATURES_REQUIRED += periph_timer
|
||||||
|
|
||||||
|
USEMODULE += xtimer_no_ztimer_default
|
||||||
|
ifeq (,$(filter xtimer_no_ztimer_default,$(USEMODULE)))
|
||||||
|
ifeq (,$(filter xtimer_on_ztimer,$(USEMODULE)))
|
||||||
|
USEMODULE += ztimer_xtimer_compat
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
ifneq (,$(filter ztimer,$(USEMODULE)))
|
||||||
|
ifeq (,$(filter xtimer_on_ztimer,$(USEMODULE)))
|
||||||
|
USEMODULE += ztimer_xtimer_compat
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq (,$(filter ztimer_xtimer_compat,$(USEMODULE)))
|
||||||
|
DISABLE_MODULE += auto_init_xtimer
|
||||||
|
USEMODULE += div
|
||||||
|
endif
|
||||||
|
|
||||||
|
# make xtimer use ztimer_usec as low level timer
|
||||||
|
ifneq (,$(filter xtimer_on_ztimer,$(USEMODULE)))
|
||||||
|
USEMODULE += ztimer_usec
|
||||||
|
endif
|
||||||
@ -143,22 +143,18 @@ choice
|
|||||||
bool "xtimer compatibility"
|
bool "xtimer compatibility"
|
||||||
depends on MODULE_XTIMER && MODULE_ZTIMER
|
depends on MODULE_XTIMER && MODULE_ZTIMER
|
||||||
|
|
||||||
config MODULE_XTIMER_ON_ZTIMER
|
|
||||||
bool "ztimer_usec as timer backend for xtimer"
|
|
||||||
select MODULE_ZTIMER_USEC
|
|
||||||
select MODULE_ZTIMER_PERIPH_TIMER
|
|
||||||
|
|
||||||
config MODULE_ZTIMER_XTIMER_COMPAT
|
config MODULE_ZTIMER_XTIMER_COMPAT
|
||||||
bool "map xtimer calls to ztimer"
|
bool "map xtimer calls to ztimer"
|
||||||
select MODULE_DIV
|
select MODULE_DIV
|
||||||
select MODULE_ZTIMER_USEC
|
select MODULE_ZTIMER_USEC
|
||||||
|
select MODULE_ZTIMER_PERIPH_TIMER
|
||||||
help
|
help
|
||||||
This is a wrapper of xtimer API on ztimer_usec and is currently
|
This is a wrapper of xtimer API on ztimer_usec.
|
||||||
incomplete. Unless doing testing, use xtimer on ztimer.
|
|
||||||
|
|
||||||
comment "The ztimer xtimer compatibility module is incomplete, consider using MODULE_ZTIMER64_XTIMER_COMPAT instead."
|
|
||||||
depends on MODULE_ZTIMER_XTIMER_COMPAT
|
|
||||||
|
|
||||||
|
config MODULE_XTIMER_ON_ZTIMER
|
||||||
|
bool "ztimer_usec as timer backend for xtimer"
|
||||||
|
select MODULE_ZTIMER_USEC
|
||||||
|
select MODULE_ZTIMER_PERIPH_TIMER
|
||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
config MODULE_ZTIMER64_XTIMER_COMPAT
|
config MODULE_ZTIMER64_XTIMER_COMPAT
|
||||||
|
|||||||
@ -13,13 +13,6 @@ endif
|
|||||||
|
|
||||||
# unless ztimer_xtimer_compat is used, make xtimer use ztimer_usec as backend.
|
# unless ztimer_xtimer_compat is used, make xtimer use ztimer_usec as backend.
|
||||||
ifneq (,$(filter ztimer,$(USEMODULE)))
|
ifneq (,$(filter ztimer,$(USEMODULE)))
|
||||||
ifneq (,$(filter xtimer,$(USEMODULE)))
|
|
||||||
ifeq (,$(filter ztimer_xtimer_compat ztimer64_xtimer_compat,$(USEMODULE)))
|
|
||||||
USEMODULE += xtimer_on_ztimer
|
|
||||||
else
|
|
||||||
USEMODULE += div
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
ifneq (,$(filter evtimer,$(USEMODULE)))
|
ifneq (,$(filter evtimer,$(USEMODULE)))
|
||||||
USEMODULE += evtimer_on_ztimer
|
USEMODULE += evtimer_on_ztimer
|
||||||
endif
|
endif
|
||||||
@ -34,11 +27,6 @@ ifneq (,$(filter ztimer64_xtimer_compat,$(USEMODULE)))
|
|||||||
USEMODULE += ztimer_xtimer_compat
|
USEMODULE += ztimer_xtimer_compat
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# make xtimer use ztimer_usec as low level timer
|
|
||||||
ifneq (,$(filter xtimer_on_ztimer,$(USEMODULE)))
|
|
||||||
USEMODULE += ztimer_usec
|
|
||||||
endif
|
|
||||||
|
|
||||||
# make evtimer use ztimer_msec as low level timer
|
# make evtimer use ztimer_msec as low level timer
|
||||||
ifneq (,$(filter evtimer_on_ztimer,$(USEMODULE)))
|
ifneq (,$(filter evtimer_on_ztimer,$(USEMODULE)))
|
||||||
USEMODULE += ztimer_msec
|
USEMODULE += ztimer_msec
|
||||||
|
|||||||
@ -1,7 +1,23 @@
|
|||||||
include ../Makefile.tests_common
|
include ../Makefile.tests_common
|
||||||
|
|
||||||
USEMODULE += xtimer
|
USEMODULE += xtimer
|
||||||
|
USEMODULE += xtimer_no_ztimer_default
|
||||||
|
|
||||||
DISABLE_MODULE += auto_init_xtimer
|
DISABLE_MODULE += auto_init_xtimer
|
||||||
|
|
||||||
|
# Boards that can't run only on xtimer or that always select ztimer
|
||||||
|
BOARD_BLACKLIST += \
|
||||||
|
feather-nrf52840 \
|
||||||
|
hamilton \
|
||||||
|
mulle \
|
||||||
|
pinetime \
|
||||||
|
ruuvitag \
|
||||||
|
stm32f429i-disco \
|
||||||
|
thingy52 \
|
||||||
|
waspmote-pro \
|
||||||
|
weact-f401cc \
|
||||||
|
weact-f401ce \
|
||||||
|
weact-f411ce \
|
||||||
|
#
|
||||||
|
|
||||||
include $(RIOTBASE)/Makefile.include
|
include $(RIOTBASE)/Makefile.include
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
# this file enables modules defined in Kconfig. Do not use this file for
|
# this file enables modules defined in Kconfig. Do not use this file for
|
||||||
# application configuration. This is only needed during migration.
|
# application configuration. This is only needed during migration.
|
||||||
CONFIG_MODULE_XTIMER=y
|
CONFIG_MODULE_XTIMER=y
|
||||||
|
CONFIG_MODULE_XTIMER_NO_ZTIMER_DEFAULT=y
|
||||||
CONFIG_MODULE_AUTO_INIT_XTIMER=n
|
CONFIG_MODULE_AUTO_INIT_XTIMER=n
|
||||||
|
|||||||
@ -2,8 +2,23 @@ include ../Makefile.tests_common
|
|||||||
|
|
||||||
USEMODULE += fmt
|
USEMODULE += fmt
|
||||||
USEMODULE += xtimer
|
USEMODULE += xtimer
|
||||||
|
USEMODULE += xtimer_no_ztimer_default
|
||||||
|
|
||||||
# This test randomly fails on `native` so disable it from CI
|
# This test randomly fails on `native` so disable it from CI
|
||||||
TEST_ON_CI_BLACKLIST += native
|
TEST_ON_CI_BLACKLIST += native
|
||||||
|
# Boards that can't run only on xtimer or that always select ztimer
|
||||||
|
BOARD_BLACKLIST += \
|
||||||
|
feather-nrf52840 \
|
||||||
|
hamilton \
|
||||||
|
mulle \
|
||||||
|
pinetime \
|
||||||
|
ruuvitag \
|
||||||
|
stm32f429i-disco \
|
||||||
|
thingy52 \
|
||||||
|
waspmote-pro \
|
||||||
|
weact-f401cc \
|
||||||
|
weact-f401ce \
|
||||||
|
weact-f411ce \
|
||||||
|
#
|
||||||
|
|
||||||
include $(RIOTBASE)/Makefile.include
|
include $(RIOTBASE)/Makefile.include
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
# this file enables modules defined in Kconfig. Do not use this file for
|
# this file enables modules defined in Kconfig. Do not use this file for
|
||||||
# application configuration. This is only needed during migration.
|
# application configuration. This is only needed during migration.
|
||||||
CONFIG_MODULE_XTIMER=y
|
CONFIG_MODULE_XTIMER=y
|
||||||
|
CONFIG_MODULE_XTIMER_NO_ZTIMER_DEFAULT=y
|
||||||
CONFIG_MODULE_FMT=y
|
CONFIG_MODULE_FMT=y
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user