From ddbf64ccca58b92f72c6fdb8ecc6b126a528f21a Mon Sep 17 00:00:00 2001 From: Karl Fessel Date: Wed, 23 Feb 2022 17:41:51 +0100 Subject: [PATCH] sys/suit_transport_coap: convert to ztimer_msec, rm unused deadline_fns --- sys/Makefile.dep | 2 +- sys/suit/transport/coap.c | 25 ++----------------------- 2 files changed, 3 insertions(+), 24 deletions(-) diff --git a/sys/Makefile.dep b/sys/Makefile.dep index f6a4b00b31..35cd8dab9c 100644 --- a/sys/Makefile.dep +++ b/sys/Makefile.dep @@ -817,7 +817,7 @@ endif ifneq (,$(filter suit_transport_coap, $(USEMODULE))) USEMODULE += nanocoap_sock - USEMODULE += xtimer + USEMODULE += ztimer_msec USEMODULE += sock_util endif diff --git a/sys/suit/transport/coap.c b/sys/suit/transport/coap.c index a3a7edf9da..43ce661364 100644 --- a/sys/suit/transport/coap.c +++ b/sys/suit/transport/coap.c @@ -32,7 +32,7 @@ #include "net/nanocoap_sock.h" #include "thread.h" #include "periph/pm.h" -#include "xtimer.h" +#include "ztimer.h" #include "suit/transport/coap.h" #include "net/sock/util.h" @@ -112,27 +112,6 @@ ssize_t coap_subtree_handler(coap_pkt_t *pkt, uint8_t *buf, size_t len, subtree->resources_numof); } -static inline uint32_t _now(void) -{ - return xtimer_now_usec(); -} - -static inline uint32_t deadline_from_interval(int32_t interval) -{ - assert(interval >= 0); - return _now() + (uint32_t)interval; -} - -static inline uint32_t deadline_left(uint32_t deadline) -{ - int32_t left = (int32_t)(deadline - _now()); - - if (left < 0) { - left = 0; - } - return left; -} - static void _suit_handle_url(const char *url, coap_blksize_t blksize, void *work_buf) { LOG_INFO("suit_coap: downloading \"%s\"\n", url); @@ -161,7 +140,7 @@ static void _suit_handle_url(const char *url, coap_blksize_t blksize, void *work const riotboot_hdr_t *hdr = riotboot_slot_get_hdr( riotboot_slot_other()); riotboot_hdr_print(hdr); - xtimer_sleep(1); + ztimer_sleep(ZTIMER_MSEC, 1 * MS_PER_SEC); if (riotboot_hdr_validate(hdr) == 0) { LOG_INFO("suit_coap: rebooting...\n");