esp_phy_cert_test.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. /*
  2. * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #pragma once
  7. #ifdef __cplusplus
  8. extern "C" {
  9. #endif
  10. #include <stdint.h>
  11. #include <stdbool.h>
  12. typedef enum {
  13. //11b
  14. PHY_RATE_1M = 0x0,
  15. PHY_RATE_2M = 0x1,
  16. PHY_RATE_5M5 = 0x2,
  17. PHY_RATE_11M = 0x3,
  18. //11g
  19. PHY_RATE_6M = 0xb,
  20. PHY_RATE_9M = 0xf,
  21. PHY_RATE_12M = 0xa,
  22. PHY_RATE_18M = 0xe,
  23. PHY_RATE_24M = 0x9,
  24. PHY_RATE_36M = 0xd,
  25. PHY_RATE_48M = 0x8,
  26. PHY_RATE_54M = 0xc,
  27. //11n
  28. PHY_RATE_MCS0 = 0x10,
  29. PHY_RATE_MCS1 = 0x11,
  30. PHY_RATE_MCS2 = 0x12,
  31. PHY_RATE_MCS3 = 0x13,
  32. PHY_RATE_MCS4 = 0x14,
  33. PHY_RATE_MCS5 = 0x15,
  34. PHY_RATE_MCS6 = 0x16,
  35. PHY_RATE_MCS7 = 0x17,
  36. PHY_WIFI_RATE_MAX
  37. } esp_phy_wifi_rate_t;
  38. typedef enum {
  39. PHY_BLE_RATE_1M = 0,
  40. PHY_BLE_RATE_2M,
  41. PHY_BLE_RATE_125K,
  42. PHY_BLE_RATE_500k,
  43. PHY_BLE_RATE_MAX
  44. } esp_phy_ble_rate_t;
  45. typedef enum {
  46. PHY_BLE_TYPE_1010 = 0,
  47. PHY_BLE_TYPE_00001111 = 1,
  48. PHY_BLE_TYPE_prbs9 = 2,
  49. PHY_BLE_TYPE_00111100 = 4,
  50. PHY_BLE_TYPE_MAX
  51. } esp_phy_ble_type_t;
  52. /**
  53. * @brief Structure holding PHY RX result
  54. */
  55. typedef struct {
  56. uint32_t phy_rx_correct_count; /*!< The number of desired packets received */
  57. int phy_rx_rssi; /*!< Average RSSI of desired packets */
  58. uint32_t phy_rx_total_count; /*!< The number of total packets received */
  59. 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. */
  60. } esp_phy_rx_result_t;
  61. /**
  62. * @brief Wifi power domain power on
  63. */
  64. void esp_wifi_power_domain_on(void);
  65. /**
  66. * @brief Wifi power domain power off
  67. */
  68. void esp_wifi_power_domain_off(void);
  69. /**
  70. * @brief Environment variable configuration
  71. *
  72. * @param conf:
  73. * Set to 1 to enter RF test mode.
  74. */
  75. void esp_phy_rftest_config(uint8_t conf);
  76. /**
  77. * @brief RF initialization configuration
  78. */
  79. void esp_phy_rftest_init(void);
  80. /**
  81. * @brief TX Continuous mode
  82. *
  83. * @param contin_en:
  84. * Set to true for continuous packet sending, which can be used for certification testing;
  85. * Set to false to cancel continuous mode, which is the default mode and can be used for WLAN tester.
  86. */
  87. void esp_phy_tx_contin_en(bool contin_en);
  88. /**
  89. * @brief HT40/HT20 mode selection
  90. *
  91. * @param en:
  92. * Set to false to enter 11n HT20 mode;
  93. * Set to true to enter 11n HT40 mode;
  94. **/
  95. void esp_phy_cbw40m_en(bool en);
  96. /**
  97. * @brief Wi-Fi TX command
  98. *
  99. * @param chan: channel setting, 1~14;
  100. * @param rate: rate setting;
  101. * @param backoff: Transmit power attenuation, unit is 0.25dB. For example, 4 means that the power is attenuated by 1dB;
  102. * @param length_byte: TX packet length configuration, indicating PSDU Length, unit is byte;
  103. * @param packet_delay: TX packet interval configuration, unit is us;
  104. * @param packet_num: The number of packets sent, 0 means sending packets continuously, other values represent the number of packets to send.
  105. */
  106. void esp_phy_wifi_tx(uint32_t chan, esp_phy_wifi_rate_t rate, int8_t backoff, uint32_t length_byte, uint32_t packet_delay, uint32_t packet_num);
  107. /**
  108. * @brief Test start/stop command, used to stop transmitting or reciving state.
  109. *
  110. * @param value:
  111. * Value should be set to 3 before TX/RX.
  112. * Set value to 0 to end TX/RX state.
  113. */
  114. void esp_phy_test_start_stop(uint8_t value);
  115. /**
  116. * @brief Wi-Fi RX command
  117. *
  118. * @param chan: channel setting, 1~14;
  119. * @param rate: rate setting;
  120. *
  121. */
  122. void esp_phy_wifi_rx(uint32_t chan, esp_phy_wifi_rate_t rate);
  123. /**
  124. * @brief Wi-Fi Carrier Wave(CW) TX command
  125. *
  126. * @param start: enable CW, 1 means transmit, 0 means stop transmitting;
  127. * @param chan: CW channel setting, 1~14;
  128. * @param backoff: CW power attenuation parameter, unit is 0.25dB. 4 indicates the power is attenuated by 1dB.
  129. *
  130. */
  131. void esp_phy_wifi_tx_tone(uint32_t start, uint32_t chan, uint32_t backoff);
  132. /**
  133. * @brief BLE TX command
  134. *
  135. * @param txpwr: Transmit power level. Tx power is about (level-8)*3 dBm, step is 3dB. Level 8 is around 0 dBm;
  136. * @param chan: channel setting, range is 0~39, corresponding frequency = 2402+chan*2;
  137. * @param len: Payload length setting, range is 0-255, unit is byte, 37 bytes is employed generally;
  138. * @param data_type: Data type setting;
  139. * @param syncw: Packet identification (need to be provided by the packet generator or instrument manufacturer), 0x71764129 is employed generally;
  140. * @param rate: rate setting;
  141. * @param tx_num_in: The number of packets sent, 0 means sending packets continuously, other values represent the number of packets to send.
  142. */
  143. void esp_phy_ble_tx(uint32_t txpwr, uint32_t chan, uint32_t len, esp_phy_ble_type_t data_type, uint32_t syncw, esp_phy_ble_rate_t rate, uint32_t tx_num_in);
  144. /**
  145. * @brief BLE RX command
  146. *
  147. * @param chan: channel selection, range is 0-39;
  148. * Channels 0, 1, 2~10 correspond to 2404MHz, 2406MHz, 2408MHz~2424MHz respectively;
  149. * Channels 11, 12, 13~36 correspond to 2428MHz, 2430MHz, 2432MHz~2478MHz respectively;
  150. * Channel 37: 2402MHz, Channel 38: 2426MHz, Channel 39: 2480MHz;
  151. * @param syncw: Packet identification (need to be provided by the packet generator or instrument manufacturer), 0x71764129 is employed generally;
  152. * @param rate: rate setting;
  153. */
  154. void esp_phy_ble_rx(uint32_t chan, uint32_t syncw, esp_phy_ble_rate_t rate);
  155. /**
  156. * @brief BLE Carrier Wave(CW) TX command
  157. *
  158. * @param start: enable CW, 1 means transmit, 0 means stop transmitting;
  159. * @param chan: Single carrier transmission channel selection, range is 0~39, corresponding frequency freq = 2402+chan*2;
  160. * @param power: CW power attenuation parameter, unit is 0.25dB. 4 indicates the power is attenuated by 1dB.
  161. */
  162. void esp_phy_bt_tx_tone(uint32_t start, uint32_t chan, uint32_t power);
  163. /**
  164. * @brief Get some RX information
  165. *
  166. * @param rx_result: This struct for storing RX information;
  167. */
  168. void esp_phy_get_rx_result(esp_phy_rx_result_t *rx_result);
  169. #ifdef __cplusplus
  170. }
  171. #endif