From 2d072ab141537260fcbcac22c4aed9b513ba7fe4 Mon Sep 17 00:00:00 2001 From: alanmaxwell Date: Sun, 23 Apr 2023 13:08:39 +0800 Subject: [PATCH] example: support legacy PHY commands in cert_test --- .gitlab/CODEOWNERS | 1 + examples/phy/cert_test/README.md | 7 +++++-- examples/phy/cert_test/main/Kconfig.projbuild | 14 ++++++++++++++ examples/phy/cert_test/main/cmd_phy.c | 13 +++++++++++++ 4 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 examples/phy/cert_test/main/Kconfig.projbuild diff --git a/.gitlab/CODEOWNERS b/.gitlab/CODEOWNERS index 14f32db48a..402dc6060d 100644 --- a/.gitlab/CODEOWNERS +++ b/.gitlab/CODEOWNERS @@ -172,6 +172,7 @@ /examples/openthread/ @esp-idf-codeowners/ieee802154 /examples/peripherals/ @esp-idf-codeowners/peripherals /examples/peripherals/usb/ @esp-idf-codeowners/peripherals @esp-idf-codeowners/peripherals/usb +/examples/phy/ @esp-idf-codeowners/bluetooth @esp-idf-codeowners/wifi @esp-idf-codeowners/ieee802154 /examples/protocols/ @esp-idf-codeowners/network @esp-idf-codeowners/app-utilities /examples/provisioning/ @esp-idf-codeowners/app-utilities/provisioning /examples/security/ @esp-idf-codeowners/security diff --git a/examples/phy/cert_test/README.md b/examples/phy/cert_test/README.md index ee41af138c..fa8dd04ba3 100644 --- a/examples/phy/cert_test/README.md +++ b/examples/phy/cert_test/README.md @@ -115,7 +115,10 @@ I (191970) phy: BT TX TONE STOP! phy> ``` +## PHY Commands Format + +For BLE test, if you want to use `fcc_le_tx` and `rw_le_rx_per` legacy commands for tx/rx test, you need to enable `ESP_PHY_LEGACY_COMMANDS` in menuconfig, otherwise, the new format commands `esp_ble_tx` and `esp_ble_rx` are supported. + ## Troubleshooting -For any technical queries, please open an [issue](https://github.com/espressif/esp-idf/issues) on GitHub. We will get back to you soon. - +For any technical queries, please open an [issue](https://github.com/espressif/esp-idf/issues) on GitHub. We will get back to you soon. \ No newline at end of file diff --git a/examples/phy/cert_test/main/Kconfig.projbuild b/examples/phy/cert_test/main/Kconfig.projbuild new file mode 100644 index 0000000000..ce75aded8f --- /dev/null +++ b/examples/phy/cert_test/main/Kconfig.projbuild @@ -0,0 +1,14 @@ +menu "Example Configuration" + + choice COMMANDS_FORMAT + prompt "PHY Commands Format" + default ESP_PHY_NEW_COMMANDS + config ESP_PHY_LEGACY_COMMANDS + bool "Legacy Commands Format" + + config ESP_PHY_NEW_COMMANDS + bool "New Commands Format" + + endchoice + +endmenu diff --git a/examples/phy/cert_test/main/cmd_phy.c b/examples/phy/cert_test/main/cmd_phy.c index 35365861d0..a21d197a8f 100644 --- a/examples/phy/cert_test/main/cmd_phy.c +++ b/examples/phy/cert_test/main/cmd_phy.c @@ -29,6 +29,11 @@ static phy_ble_rx_t phy_ble_rx_args; static phy_bt_tx_tone_t phy_bt_tx_tone_args; #endif +#if CONFIG_ESP_PHY_LEGACY_COMMANDS +#define arg_int0(_a, _b, _c, _d) arg_int0(NULL, NULL, _c, _d) +#define arg_int1(_a, _b, _c, _d) arg_int1(NULL, NULL, _c, _d) +#endif + static int esp_phy_tx_contin_en_func(int argc, char **argv) { int nerrors = arg_parse(argc, argv, (void **) &phy_args); @@ -487,7 +492,11 @@ void register_phy_cmd(void) phy_ble_tx_args.end = arg_end(1); const esp_console_cmd_t esp_ble_tx_cmd = { +#if CONFIG_ESP_PHY_NEW_COMMANDS .command = "esp_ble_tx", +#elif CONFIG_ESP_PHY_LEGACY_COMMANDS + .command = "fcc_le_tx", +#endif .help = "BLE TX command", .hint = NULL, .func = &esp_phy_ble_tx_func, @@ -501,7 +510,11 @@ void register_phy_cmd(void) phy_ble_rx_args.end = arg_end(1); const esp_console_cmd_t esp_ble_rx_cmd = { +#if CONFIG_ESP_PHY_NEW_COMMANDS .command = "esp_ble_rx", +#elif CONFIG_ESP_PHY_LEGACY_COMMANDS + .command = "rw_le_rx_per", +#endif .help = "BLE RX command", .hint = NULL, .func = &esp_phy_ble_rx_func,