phy_callback.c 775 B

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