From b4a70fc29c38344773d5c7fcab1ce7d7c4dadd47 Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Wed, 23 Feb 2022 09:36:49 +0100 Subject: [PATCH] sys/event/timeout: remove alternative xtimer implementation The old event_timeout API is no soley implemented on top of ztimer_usec. --- sys/Makefile.dep | 9 ++------ sys/event/Kconfig | 17 --------------- sys/event/Makefile | 6 ------ sys/event/timeout.c | 42 ------------------------------------- sys/include/event/timeout.h | 12 ----------- 5 files changed, 2 insertions(+), 84 deletions(-) delete mode 100644 sys/event/timeout.c diff --git a/sys/Makefile.dep b/sys/Makefile.dep index 132fee3f80..d0aef926af 100644 --- a/sys/Makefile.dep +++ b/sys/Makefile.dep @@ -539,13 +539,8 @@ ifneq (,$(filter event_timeout_ztimer,$(USEMODULE))) endif ifneq (,$(filter event_timeout,$(USEMODULE))) - ifneq (,$(filter event_timeout_ztimer,$(USEMODULE))) - USEMODULE += ztimer_usec - else - ifeq (,$(filter ztimer_usec,$(USEMODULE))) - USEMODULE += xtimer - endif - endif + USEMODULE += event_timeout_ztimer + USEMODULE += ztimer_usec endif ifneq (,$(filter event_periodic,$(USEMODULE))) diff --git a/sys/event/Kconfig b/sys/event/Kconfig index 3a2704e39e..255debe040 100644 --- a/sys/event/Kconfig +++ b/sys/event/Kconfig @@ -49,24 +49,7 @@ config MODULE_EVENT_TIMEOUT_ZTIMER config MODULE_EVENT_TIMEOUT bool "Legacy API, support for triggering events after timeout" - -if MODULE_EVENT_TIMEOUT - -choice EVENT_TIMEOUT_IMPLEMENTATION - bool "Event Timeout Implementation" - default EVENT_TIMEOUT_ON_XTIMER - -config EVENT_TIMEOUT_ON_ZTIMER - bool "Use ztimer as backend" select MODULE_EVENT_TIMEOUT_ZTIMER select ZTIMER_USEC -config EVENT_TIMEOUT_ON_XTIMER - bool "Use xtimer as backend" - select MODULE_XTIMER if !ZTIMER_USEC - -endchoice # EVENT_TIMEOUT_IMPLEMENTATION - -endif # MODULE_EVENT_TIMEOUT - endif # MODULE_EVENT diff --git a/sys/event/Makefile b/sys/event/Makefile index 0f3bbf926a..5343c5af5d 100644 --- a/sys/event/Makefile +++ b/sys/event/Makefile @@ -2,10 +2,4 @@ SRC := event.c SUBMODULES := 1 -ifneq (,$(filter event_timeout_ztimer,$(USEMODULE))) - ifneq (,$(filter ztimer_usec,$(USEMODULE))) - SUBMODULES_NO_SRC += timeout.c - endif -endif - include $(RIOTBASE)/Makefile.base diff --git a/sys/event/timeout.c b/sys/event/timeout.c deleted file mode 100644 index e30157201c..0000000000 --- a/sys/event/timeout.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2017 Inria - * 2017 Freie Universität Berlin - * 2017 Kaspar Schleiser - * - * 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. - */ - -#include "kernel_defines.h" -#include "event/timeout.h" -#if IS_USED(MODULE_ZTIMER_USEC) -#include "ztimer/xtimer_compat.h" -#else -#include "xtimer.h" -#endif - -static void _event_timeout_callback(void *arg) -{ - event_timeout_t *event_timeout = (event_timeout_t *)arg; - - event_post(event_timeout->queue, event_timeout->event); -} - -void event_timeout_init(event_timeout_t *event_timeout, event_queue_t *queue, event_t *event) -{ - event_timeout->timer.callback = _event_timeout_callback; - event_timeout->timer.arg = event_timeout; - event_timeout->queue = queue; - event_timeout->event = event; -} - -void event_timeout_set(event_timeout_t *event_timeout, uint32_t timeout) -{ - xtimer_set(&event_timeout->timer, timeout); -} - -void event_timeout_clear(event_timeout_t *event_timeout) -{ - xtimer_remove(&event_timeout->timer); -} diff --git a/sys/include/event/timeout.h b/sys/include/event/timeout.h index af5a0362dc..eee2b881cf 100644 --- a/sys/include/event/timeout.h +++ b/sys/include/event/timeout.h @@ -38,11 +38,7 @@ #define EVENT_TIMEOUT_H #include "event.h" -#if IS_USED(MODULE_EVENT_TIMEOUT_ZTIMER) || IS_USED(MODULE_ZTIMER_USEC) #include "ztimer.h" -#else -#include "xtimer.h" -#endif #ifdef __cplusplus extern "C" { @@ -52,19 +48,12 @@ extern "C" { * @brief Timeout Event structure */ typedef struct { -#if IS_USED(MODULE_EVENT_TIMEOUT_ZTIMER) ztimer_clock_t *clock; /**< ztimer clock to use */ -#endif -#if IS_USED(MODULE_EVENT_TIMEOUT_ZTIMER) || IS_USED(MODULE_ZTIMER_USEC) ztimer_t timer; /**< ztimer object used for timeout */ -#else - xtimer_t timer; /**< ztimer object used for timeout */ -#endif event_queue_t *queue; /**< event queue to post event to */ event_t *event; /**< event to post after timeout */ } event_timeout_t; -#if IS_USED(MODULE_EVENT_TIMEOUT_ZTIMER) || DOXYGEN /** * @brief Initialize timeout event object * @@ -75,7 +64,6 @@ typedef struct { */ void event_timeout_ztimer_init(event_timeout_t *event_timeout, ztimer_clock_t *clock, event_queue_t *queue, event_t *event); -#endif #if IS_USED(MODULE_EVENT_TIMEOUT) || DOXYGEN /**