diff --git a/components/ieee802154/driver/esp_ieee802154_dev.c b/components/ieee802154/driver/esp_ieee802154_dev.c index 51f9078530..dd428c6f29 100644 --- a/components/ieee802154/driver/esp_ieee802154_dev.c +++ b/components/ieee802154/driver/esp_ieee802154_dev.c @@ -605,6 +605,7 @@ void ieee802154_disable(void) esp_err_t ieee802154_mac_init(void) { esp_err_t ret = ESP_OK; + modem_clock_module_mac_reset(PERIPH_IEEE802154_MODULE); // reset ieee802154 MAC ieee802154_pib_init(); ieee802154_ll_enable_events(IEEE802154_EVENT_MASK); diff --git a/components/ieee802154/test_apps/test_ieee802154/main/src/ieee802154_cmd.c b/components/ieee802154/test_apps/test_ieee802154/main/src/ieee802154_cmd.c index a798f75983..2a56811f47 100644 --- a/components/ieee802154/test_apps/test_ieee802154/main/src/ieee802154_cmd.c +++ b/components/ieee802154/test_apps/test_ieee802154/main/src/ieee802154_cmd.c @@ -15,6 +15,7 @@ #include "ieee802154_cmd.h" #include "esp_phy_init.h" #include "soc/soc.h" +#include "soc/ieee802154_reg.h" static uint8_t s_tx_frame[131] = { 0 }; static const char* TAG = "i154test"; @@ -34,6 +35,7 @@ static void register_cca(void); static void register_esp154(void); static void register_reg(void); static void register_free(void); +static void register_restart(void); void register_ieee802154_cmd(void) { @@ -52,6 +54,7 @@ void register_ieee802154_cmd(void) register_esp154(); register_reg(); register_free(); + register_restart(); } static struct { @@ -670,9 +673,7 @@ static void register_free() } /* 'reg' command reads/writes the registers */ -extern uint32_t IEEE802154; static struct { - struct arg_lit *base; struct arg_int *get_reg; struct arg_int *set_reg; struct arg_int *value; @@ -681,7 +682,7 @@ static struct { static int process_reg(int argc, char **argv) { - uint32_t *base = &IEEE802154; + uint32_t base = IEEE802154_REG_BASE; int nerrors = arg_parse(argc, argv, (void **) ®_args); if (nerrors != 0) { @@ -840,6 +841,24 @@ static void register_rx(void) ESP_ERROR_CHECK(esp_console_cmd_register(&cmd)); } +/* 'restart' command restarts the program */ +static int restart(int argc, char **argv) +{ + ESP_EARLY_LOGI(TAG, "Restarting"); + esp_restart(); +} + +static void register_restart(void) +{ + const esp_console_cmd_t cmd = { + .command = "restart", + .help = "Restart the program", + .hint = NULL, + .func = &restart + }; + ESP_ERROR_CHECK(esp_console_cmd_register(&cmd)); +} + void esp_ieee802154_transmit_done(const uint8_t *frame, const uint8_t *ack, esp_ieee802154_frame_info_t *ack_frame_info) { ESP_EARLY_LOGI(TAG, "Tx Done %d bytes", frame[0]);