mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 11:10:54 +03:00
feat(ieee802154): add support for phyreg -g register debug
This commit is contained in:
@@ -246,6 +246,14 @@ menu "IEEE 802.15.4"
|
|||||||
counts, errors, and other metrics for transmitted and received frames.
|
counts, errors, and other metrics for transmitted and received frames.
|
||||||
Statistics can be accessed via debug APIs for performance analysis.
|
Statistics can be accessed via debug APIs for performance analysis.
|
||||||
|
|
||||||
|
config IEEE802154_PRINT_PHY_REG
|
||||||
|
bool "Enable print IEEE802154 PHY register command"
|
||||||
|
default n
|
||||||
|
help
|
||||||
|
Enable the 'phyreg' console command to print IEEE 802.15.4 PHY register
|
||||||
|
information for debugging purposes. This command displays register values
|
||||||
|
and configuration settings of the IEEE 802.15.4 hardware.
|
||||||
|
|
||||||
endmenu # IEEE 802.15.4 Debug Parameters
|
endmenu # IEEE 802.15.4 Debug Parameters
|
||||||
|
|
||||||
endmenu # IEEE 802.15.4
|
endmenu # IEEE 802.15.4
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||||
*/
|
*/
|
||||||
@@ -26,6 +26,10 @@ static void register_txrx_statistic(void);
|
|||||||
static void register_record(void);
|
static void register_record(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_IEEE802154_PRINT_PHY_REG
|
||||||
|
static void register_phyreg(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
void register_ieee802154_debug_cmd(void)
|
void register_ieee802154_debug_cmd(void)
|
||||||
{
|
{
|
||||||
#if CONFIG_IEEE802154_RX_BUFFER_STATISTIC
|
#if CONFIG_IEEE802154_RX_BUFFER_STATISTIC
|
||||||
@@ -37,6 +41,9 @@ void register_ieee802154_debug_cmd(void)
|
|||||||
#if CONFIG_IEEE802154_RECORD
|
#if CONFIG_IEEE802154_RECORD
|
||||||
register_record();
|
register_record();
|
||||||
#endif
|
#endif
|
||||||
|
#if CONFIG_IEEE802154_PRINT_PHY_REG
|
||||||
|
register_phyreg();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -173,4 +180,76 @@ static void register_record(void)
|
|||||||
ESP_ERROR_CHECK(esp_console_cmd_register(&cmd));
|
ESP_ERROR_CHECK(esp_console_cmd_register(&cmd));
|
||||||
}
|
}
|
||||||
#endif // CONFIG_IEEE802154_RECORD
|
#endif // CONFIG_IEEE802154_RECORD
|
||||||
|
|
||||||
|
#if CONFIG_IEEE802154_PRINT_PHY_REG
|
||||||
|
__attribute__((weak)) void pbus_print(void)
|
||||||
|
{
|
||||||
|
ESP_LOGE("", "pbus_print not in phylib");
|
||||||
|
}
|
||||||
|
|
||||||
|
__attribute__((weak)) void phy_cal_print(void)
|
||||||
|
{
|
||||||
|
ESP_LOGE("", "phy_cal_print not in phylib");
|
||||||
|
}
|
||||||
|
|
||||||
|
__attribute__((weak)) void phy_i2c_check(void)
|
||||||
|
{
|
||||||
|
ESP_LOGE("", "phy_i2c_check not in phylib");
|
||||||
|
}
|
||||||
|
|
||||||
|
__attribute__((weak)) void phy_reg_check(void)
|
||||||
|
{
|
||||||
|
ESP_LOGE("", "phy_reg_check not in phylib");
|
||||||
|
}
|
||||||
|
|
||||||
|
extern void pbus_print(void);
|
||||||
|
extern void phy_cal_print(void);
|
||||||
|
extern void phy_i2c_check(void);
|
||||||
|
extern void phy_reg_check(void);
|
||||||
|
|
||||||
|
static void ieee802154_phy_reg_print(void)
|
||||||
|
{
|
||||||
|
pbus_print();
|
||||||
|
phy_cal_print();
|
||||||
|
phy_i2c_check();
|
||||||
|
phy_reg_check();
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct {
|
||||||
|
struct arg_lit *get_phyreg;
|
||||||
|
struct arg_end *end;
|
||||||
|
} phyreg_args;
|
||||||
|
|
||||||
|
static int process_phyreg(int argc, char **argv)
|
||||||
|
{
|
||||||
|
int nerrors = arg_parse(argc, argv, (void **) &phyreg_args);
|
||||||
|
if (nerrors != 0) {
|
||||||
|
arg_print_errors(stderr, phyreg_args.end, argv[0]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (phyreg_args.get_phyreg->count) {
|
||||||
|
ieee802154_phy_reg_print();
|
||||||
|
} else {
|
||||||
|
ESP_LOGE(TAG, "no valid arguments");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void register_phyreg(void)
|
||||||
|
{
|
||||||
|
phyreg_args.get_phyreg =
|
||||||
|
arg_lit0("g", "get", "get IEEE802154 PHY register debug info");
|
||||||
|
phyreg_args.end = arg_end(1);
|
||||||
|
|
||||||
|
const esp_console_cmd_t cmd = {
|
||||||
|
.command = "phyreg",
|
||||||
|
.help = "get IEEE802154 PHY register debug info",
|
||||||
|
.hint = NULL,
|
||||||
|
.func = &process_phyreg,
|
||||||
|
.argtable = &phyreg_args
|
||||||
|
};
|
||||||
|
ESP_ERROR_CHECK(esp_console_cmd_register(&cmd));
|
||||||
|
}
|
||||||
|
#endif // CONFIG_IEEE802154_PRINT_PHY_REG
|
||||||
#endif // CONFIG_IEEE802154_DEBUG
|
#endif // CONFIG_IEEE802154_DEBUG
|
||||||
|
|||||||
Reference in New Issue
Block a user