diff --git a/sys/net/link_layer/Kconfig b/sys/net/link_layer/Kconfig index bb915b4e01..7b0c2c7794 100644 --- a/sys/net/link_layer/Kconfig +++ b/sys/net/link_layer/Kconfig @@ -8,4 +8,5 @@ rsource "csma_sender/Kconfig" rsource "eui_provider/Kconfig" rsource "ieee802154/Kconfig" rsource "l2filter/Kconfig" +rsource "l2util/Kconfig" rsource "Kconfig.lorawan" diff --git a/sys/net/link_layer/l2util/Kconfig b/sys/net/link_layer/l2util/Kconfig new file mode 100644 index 0000000000..44d77fb200 --- /dev/null +++ b/sys/net/link_layer/l2util/Kconfig @@ -0,0 +1,10 @@ +# Copyright (c) 2021 HAW Hamburg +# +# 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. +# + +config MODULE_L2UTIL + bool "Link layer utils" + select MODULE_FMT diff --git a/tests/ieee802154_hal/Makefile b/tests/ieee802154_hal/Makefile index 434bb3fe8b..3f2ae06c03 100644 --- a/tests/ieee802154_hal/Makefile +++ b/tests/ieee802154_hal/Makefile @@ -21,14 +21,16 @@ DISABLE_MODULE += auto_init_at86rf2xx auto_init_nrf802154 USEMODULE += od USEMODULE += luid +USEMODULE += l2util USEMODULE += ieee802154 USEMODULE += shell +USEMODULE += shell_commands USEMODULE += ps -USEMODULE += event_thread_highest +USEMODULE += event_thread USEMODULE += event_callback USEMODULE += xtimer USEMODULE += netdev_default -CFLAGS += -DEVENT_THREAD_HIGHEST_STACKSIZE=1024 +CFLAGS += -DEVENT_THREAD_MEDIUM_STACKSIZE=1024 include $(RIOTBASE)/Makefile.include diff --git a/tests/ieee802154_hal/app.config.test b/tests/ieee802154_hal/app.config.test index 5366bdab71..1c9285f9bc 100644 --- a/tests/ieee802154_hal/app.config.test +++ b/tests/ieee802154_hal/app.config.test @@ -4,11 +4,12 @@ CONFIG_MODULE_OD=y CONFIG_MODULE_LUID=y CONFIG_MODULE_IEEE802154=y CONFIG_MODULE_SHELL=y +CONFIG_MODULE_SHELL_COMMANDS=y +CONFIG_MODULE_L2UTIL=y CONFIG_MODULE_PS=y CONFIG_MODULE_EVENT=y CONFIG_MODULE_EVENT_THREAD=y -CONFIG_MODULE_EVENT_THREAD_HIGHEST=y CONFIG_MODULE_EVENT_CALLBACK=y CONFIG_MODULE_XTIMER=y diff --git a/tests/ieee802154_hal/main.c b/tests/ieee802154_hal/main.c index 35dcf33b55..c1043fb7ba 100644 --- a/tests/ieee802154_hal/main.c +++ b/tests/ieee802154_hal/main.c @@ -26,7 +26,9 @@ #include "errno.h" #include "event/thread.h" #include "luid.h" +#include "od.h" +#include "net/l2util.h" #include "net/ieee802154.h" #include "net/ieee802154/radio.h" @@ -37,6 +39,8 @@ #define SYMBOL_TIME (16U) /**< 16 us */ #define ACK_TIMEOUT_TIME (40 * SYMBOL_TIME) +#define IEEE802154_LONG_ADDRESS_LEN_STR_MAX \ + (sizeof("00:00:00:00:00:00:00:00")) static inline void _set_trx_state(int state, bool verbose); @@ -57,25 +61,20 @@ static void _print_packet(size_t size, uint8_t lqi, int16_t rssi) printf("Received valid ACK with sqn %i\n", buffer[2]); } else { - puts("Packet received:"); - for (unsigned i=0;i= in) { - int a = 0, b = _dehex(*end_str--, -1); - if (b < 0) { - if (assert_cell) { - return 0; - } - else { - assert_cell = 1; - continue; - } - } - assert_cell = 0; - - if (end_str >= in) { - a = _dehex(*end_str--, 0); - } - - if (++count > out_len) { - return 0; - } - *out_end++ = (a << 4) | b; - } - if (assert_cell) { - return 0; - } - /* out is reversed */ - - while (out < --out_end) { - uint8_t tmp = *out_end; - *out_end = *out; - *out++ = tmp; - } - - return count; -} - int _cca(int argc, char **argv) { (void) argc; @@ -504,13 +437,13 @@ int txtsnd(int argc, char **argv) size_t res; if (argc != 3) { - puts("Usage: txtsnd "); + puts("Usage: txtsnd "); return 1; } - res = _parse_addr(addr, sizeof(addr), argv[1]); + res = l2util_addr_from_str(argv[ 1], addr); if (res == 0) { - puts("Usage: txtsnd "); + puts("Usage: txtsnd "); return 1; } len = atoi(argv[2]);