1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

gnrc/netif: convert to ztimer

This commit is contained in:
Koen Zandberg 2021-12-08 10:54:51 +01:00
parent 99d245f538
commit 3b5662e116
No known key found for this signature in database
GPG Key ID: BA1718B37D79F51C
2 changed files with 8 additions and 6 deletions

View File

@ -137,6 +137,7 @@ ifneq (,$(filter gnrc_netif,$(USEMODULE)))
USEMODULE += netif
USEMODULE += l2util
USEMODULE += fmt
USEMODULE += ztimer_msec
ifneq (,$(filter netdev_ieee802154_submac,$(USEMODULE)))
USEMODULE += gnrc_netif_pktq
endif

View File

@ -41,8 +41,8 @@
#include "fmt.h"
#include "log.h"
#include "sched.h"
#if IS_USED(MODULE_XTIMER) || IS_USED(MODULE_ZTIMER_XTIMER_COMPAT)
#include "xtimer.h"
#if IS_USED(MODULE_ZTIMER)
#include "ztimer.h"
#endif
#include "net/gnrc/netif.h"
@ -1370,7 +1370,7 @@ bool gnrc_netif_ipv6_wait_for_global_address(gnrc_netif_t *netif,
/* wait for global address */
msg_t m;
while (!has_global) {
if (xtimer_msg_receive_timeout(&m, timeout_ms * US_PER_MS) < 0) {
if (ztimer_msg_receive_timeout(ZTIMER_MSEC, &m, timeout_ms) < 0) {
DEBUG_PUTS("gnrc_netif: timeout waiting for prefix");
break;
}
@ -1867,7 +1867,7 @@ static void *_gnrc_netif_thread(void *args)
/* now let rest of GNRC use the interface */
gnrc_netif_release(netif);
#if (CONFIG_GNRC_NETIF_MIN_WAIT_AFTER_SEND_US > 0U)
xtimer_ticks32_t last_wakeup = xtimer_now();
uint32_t last_wakeup = ztimer_now(ZTIMER_USEC);
#endif
while (1) {
@ -1893,13 +1893,14 @@ static void *_gnrc_netif_thread(void *args)
DEBUG("gnrc_netif: GNRC_NETDEV_MSG_TYPE_SND received\n");
_send(netif, msg.content.ptr, false);
#if (CONFIG_GNRC_NETIF_MIN_WAIT_AFTER_SEND_US > 0U)
xtimer_periodic_wakeup(
ztimer_periodic_wakeup(
ZTIMER_USEC,
&last_wakeup,
CONFIG_GNRC_NETIF_MIN_WAIT_AFTER_SEND_US
);
/* override last_wakeup in case last_wakeup +
* CONFIG_GNRC_NETIF_MIN_WAIT_AFTER_SEND_US was in the past */
last_wakeup = xtimer_now();
last_wakeup = ztimer_now(ZTIMER_USEC);
#endif
break;
case GNRC_NETAPI_MSG_TYPE_SET: