1 /*
2  * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include <stdint.h>
8 
9 typedef enum {
10     OK = 0,
11     FAIL,
12     PENDING,
13     BUSY,
14     CANCEL,
15 } STATUS;
16 
17 extern int phy_printf(const char* format, ...);
18 
19 static uint8_t g_rf_cmdstop = 3;
20 
esp_phy_test_start_stop(uint8_t value)21 void esp_phy_test_start_stop(uint8_t value)
22 {
23     g_rf_cmdstop = value;
24 }
25 
esp_phy_cmdstop_callback(void)26 int esp_phy_cmdstop_callback(void)
27 {
28     return g_rf_cmdstop;
29 }
30 
esp_phy_getstopcmd(void)31 STATUS esp_phy_getstopcmd(void)
32 {
33     uint8_t value = esp_phy_cmdstop_callback();
34     if (value == 0) {
35         return OK;
36     } else if (value == 1) {
37         return BUSY;
38     } else if (value == 2) {
39         phy_printf("Please run cmdstop to exit current cmd!\n");
40         return FAIL;
41     } else {
42         return FAIL;
43     }
44 }
45