ieee802154: add modem reset and fix ieee802154 test app reg command error

This commit is contained in:
xiaqilin 2023-06-25 14:15:45 +08:00
parent c41abacb3a
commit 509d004587
3 changed files with 23 additions and 4 deletions

View File

@ -565,6 +565,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);

View File

@ -20,7 +20,6 @@
esp_err_t esp_ieee802154_enable(void)
{
ieee802154_enable();
esp_phy_enable();
esp_btbb_enable();

View File

@ -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 **) &reg_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]);