Skip to content

Commit

Permalink
Merge pull request #18349 from maribu/sys/shell/commands/sc_gnrc_icmp…
Browse files Browse the repository at this point in the history
…v6_echo

sys/shell/commands/ping: fix dependency & convert to ztimer
  • Loading branch information
maribu authored Jul 21, 2022
2 parents a43f4cb + cab761b commit de064b7
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 11 deletions.
1 change: 1 addition & 0 deletions examples/asymcute_mqttsn/Makefile.ci
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ BOARD_INSUFFICIENT_MEMORY := \
stk3200 \
stm32f030f4-demo \
stm32f0discovery \
stm32f7508-dk \
stm32g0316-disco \
stm32l0538-disco \
telosb \
Expand Down
1 change: 1 addition & 0 deletions examples/cord_lc/Makefile.ci
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ BOARD_INSUFFICIENT_MEMORY := \
stk3200 \
stm32f030f4-demo \
stm32f0discovery \
stm32f7508-dk \
stm32g0316-disco \
stm32l0538-disco \
telosb \
Expand Down
1 change: 1 addition & 0 deletions examples/gcoap/Makefile.ci
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ BOARD_INSUFFICIENT_MEMORY := \
stk3200 \
stm32f030f4-demo \
stm32f0discovery \
stm32f7508-dk \
stm32g0316-disco \
stm32l0538-disco \
telosb \
Expand Down
2 changes: 1 addition & 1 deletion sys/Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ ifneq (,$(filter shell_commands,$(USEMODULE)))
endif

ifneq (,$(filter gnrc_icmpv6_echo,$(USEMODULE)))
USEMODULE += netutils
USEMODULE += netutils ztimer_usec
endif

ifneq (,$(gnrc_udp_cmd,$(USEMODULE)))
Expand Down
2 changes: 0 additions & 2 deletions sys/shell/commands/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,8 @@ ifneq (,$(filter gnrc_ipv6_blacklist,$(USEMODULE)))
SRC += sc_blacklist.c
endif
ifneq (,$(filter gnrc_icmpv6_echo,$(USEMODULE)))
ifneq (,$(filter xtimer,$(USEMODULE)))
SRC += sc_gnrc_icmpv6_echo.c
endif
endif
ifneq (,$(filter gnrc_pktbuf_cmd,$(USEMODULE)))
SRC += sc_gnrc_pktbuf.c
endif
Expand Down
14 changes: 7 additions & 7 deletions sys/shell/commands/sc_gnrc_icmpv6_echo.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include "timex.h"
#include "unaligned.h"
#include "utlist.h"
#include "xtimer.h"
#include "ztimer.h"

#ifdef MODULE_LUID
#include "luid.h"
Expand All @@ -60,7 +60,7 @@

typedef struct {
gnrc_netreg_entry_t netreg;
xtimer_t sched_timer;
ztimer_t sched_timer;
msg_t sched_msg;
ipv6_addr_t host;
char *hostname;
Expand Down Expand Up @@ -110,7 +110,7 @@ static int _gnrc_icmpv6_ping(int argc, char **argv)
msg_receive(&msg);
switch (msg.type) {
case GNRC_NETAPI_MSG_TYPE_RCV: {
_handle_reply(&data, msg.content.ptr, xtimer_now_usec());
_handle_reply(&data, msg.content.ptr, ztimer_now(ZTIMER_USEC));
gnrc_pktbuf_release(msg.content.ptr);
break;
}
Expand All @@ -126,7 +126,7 @@ static int _gnrc_icmpv6_ping(int argc, char **argv)
}
} while (data.num_recv < data.count);
finish:
xtimer_remove(&data.sched_timer);
ztimer_remove(ZTIMER_USEC, &data.sched_timer);
res = _finish(&data);
gnrc_netreg_unregister(GNRC_NETTYPE_ICMPV6, &data.netreg);
while (msg_avail() > 0) {
Expand Down Expand Up @@ -232,7 +232,7 @@ static int _configure(int argc, char **argv, _ping_data_t *data)
if (res != 0) {
_usage(cmdname);
}
data->id ^= (xtimer_now_usec() & UINT16_MAX);
data->id ^= (ztimer_now(ZTIMER_USEC) & UINT16_MAX);
#ifdef MODULE_LUID
luid_custom(&data->id, sizeof(data->id), data->id);
#endif
Expand All @@ -244,7 +244,7 @@ static void _fill_payload(uint8_t *buf, size_t len)
uint8_t i = 0;

if (len >= sizeof(uint32_t)) {
uint32_t now = xtimer_now_usec();
uint32_t now = ztimer_now(ZTIMER_USEC);
memcpy(buf, &now, sizeof(now));
len -= sizeof(now);
buf += sizeof(now);
Expand Down Expand Up @@ -305,7 +305,7 @@ static void _pinger(_ping_data_t *data)
}
}
}
xtimer_set_msg(&data->sched_timer, timer, &data->sched_msg,
ztimer_set_msg(ZTIMER_USEC, &data->sched_timer, timer, &data->sched_msg,
thread_getpid());
bf_unset(data->cktab, (size_t)data->num_sent % CKTAB_SIZE);
pkt = gnrc_icmpv6_echo_build(ICMPV6_ECHO_REQ, data->id,
Expand Down
3 changes: 2 additions & 1 deletion tests/gnrc_rpl/Makefile.ci
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ BOARD_INSUFFICIENT_MEMORY := \
arduino-mega2560 \
arduino-nano \
arduino-uno \
atmega1284p \
atmega328p \
atmega328p-xplained-mini \
atmega1284p \
atxmega-a3bu-xplained \
bluepill-stm32f030c8 \
derfmega128 \
Expand All @@ -32,6 +32,7 @@ BOARD_INSUFFICIENT_MEMORY := \
stk3200 \
stm32f030f4-demo \
stm32f0discovery \
stm32f7508-dk \
stm32g0316-disco \
stm32l0538-disco \
telosb \
Expand Down

0 comments on commit de064b7

Please sign in to comment.