Răsfoiți Sursa

Add the output RX result command

xiehang 2 ani în urmă
părinte
comite
c8d7c9bd71

+ 27 - 0
components/esp_phy/include/esp_phy_cert_test.h

@@ -56,6 +56,26 @@ typedef enum {
     PHY_BLE_TYPE_MAX
 } esp_phy_ble_type_t;
 
+/**
+ * @brief Structure holding PHY RX result
+ */
+typedef struct {
+    uint32_t phy_rx_correct_count; /*!< The number of desired packets received */
+    int phy_rx_rssi;               /*!< Average RSSI of desired packets */
+    uint32_t phy_rx_total_count;   /*!< The number of total packets received */
+    uint32_t phy_rx_result_flag;   /*!< 0 means no RX info; 1 means the lastest Wi-Fi RX info; 2 means the lastest BLE RX info. */
+} esp_phy_rx_result_t;
+
+/**
+ * @brief Wifi power domain power on
+ */
+void esp_wifi_power_domain_on(void);
+
+/**
+ * @brief Wifi power domain power off
+ */
+void esp_wifi_power_domain_off(void);
+
 /**
  * @brief Environment variable configuration
  *
@@ -161,6 +181,13 @@ void esp_phy_ble_rx(uint32_t chan, uint32_t syncw, esp_phy_ble_rate_t rate);
  */
 void esp_phy_bt_tx_tone(uint32_t start, uint32_t chan, uint32_t power);
 
+/**
+ * @brief Get some RX information
+ *
+ * @param rx_result: This struct for storing RX information;
+ */
+void esp_phy_get_rx_result(esp_phy_rx_result_t *rx_result);
+
 #ifdef __cplusplus
 }
 #endif

+ 8 - 2
examples/phy/cert_test/README.md

@@ -78,7 +78,10 @@ phy> esp_rx -n 1 -r 0
 I (19348) phy: wifi rx start: channel is 1, rate is 0x0
 phy> 
 phy> cmdstop
-I (24248) phy: Correct: 1112 Desired: 773 RSSI: -633 noise: -960 gain: 629 para1: 12198 para2
+I (142881) phy: Total: 535 Correct: 474 RSSI: -650 noise: -960 gain: 531 para1: 5759 para2: 3
+phy>
+phy> get_rx_result
+I (145991) cmd_phy: Total: 535, Correct: 474, RSSI: -650, flag: 1
 phy> 
 phy> wifiscwout -e 1 -c 1 -p 0
 I (98308) phy:  wifi single carrier tx out, single carrier is in 1 channel, power is about (2
@@ -93,7 +96,10 @@ phy> esp_ble_rx -n 1 -s 0x71764129 -r 0
 I (2898) phy: RW LE V9 RX PER
 phy> 
 phy> cmdstop
-I (7678) phy: 144 0 0 5 13f 0 0 0 0 0 p 0 0 0 0 0 0
+I (381241) phy: 3 0 0 0 3 0 0 0 0 0 p -263 -86 -279 a8 -100 -77
+phy>
+phy> get_rx_result
+I (383871) cmd_phy: Total: 3, Correct: 0, RSSI: 0, flag: 2
 phy> 
 phy> bt_tx_tone -e 1 -n 1 -p 0
 I (56008) phy: BT TX TONE START!

+ 0 - 2
examples/phy/cert_test/main/cert_test.c

@@ -12,8 +12,6 @@
 #include "cmd_phy.h"
 #include "esp_phy_cert_test.h"
 
-#include "esp_private/wifi.h"
-
 void app_main(void)
 {
     ESP_ERROR_CHECK(nvs_flash_init());

+ 26 - 0
examples/phy/cert_test/main/cmd_phy.c

@@ -56,6 +56,23 @@ static int esp_phy_cmdstop_func(int argc, char **argv)
     return 0;
 }
 
+static int esp_phy_get_rx_result_func(int argc, char **argv)
+{
+    esp_phy_rx_result_t rx_result;
+    int nerrors = arg_parse(argc, argv, (void **) &phy_args);
+    if (nerrors != 0) {
+        arg_print_errors(stderr, phy_args.end, argv[0]);
+        return 1;
+    }
+
+    esp_phy_get_rx_result(&rx_result);
+
+    ESP_LOGI(TAG, "Total: %lu, Correct: %lu, RSSI: %d, flag: %lu", rx_result.phy_rx_total_count,
+                rx_result.phy_rx_correct_count, rx_result.phy_rx_rssi, rx_result.phy_rx_result_flag);
+
+    return 0;
+}
+
 #if SOC_WIFI_SUPPORTED
 void cert_wifi_tx(void *arg)
 {
@@ -393,6 +410,15 @@ void register_phy_cmd(void)
     };
     ESP_ERROR_CHECK( esp_console_cmd_register(&cmdstop_cmd) );
 
+    const esp_console_cmd_t get_rx_result = {
+        .command = "get_rx_result",
+        .help = "Get RX information",
+        .hint = NULL,
+        .func = &esp_phy_get_rx_result_func,
+        .argtable = NULL
+    };
+    ESP_ERROR_CHECK( esp_console_cmd_register(&get_rx_result) );
+
 #if SOC_WIFI_SUPPORTED
     const esp_console_cmd_t cbw40m_cmd = {
         .command = "cbw40m_en",

+ 0 - 1
examples/phy/cert_test/sdkconfig.defaults

@@ -1,4 +1,3 @@
-CONFIG_ESP_INT_WDT=n
 CONFIG_ESP_TASK_WDT_EN=n
 
 CONFIG_ESP_PHY_INIT_DATA_IN_PARTITION=y