esp_chip_info.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #pragma once
  7. #include <stdbool.h>
  8. #include <stdint.h>
  9. #include "sdkconfig.h"
  10. #include "esp_bit_defs.h"
  11. #ifdef __cplusplus
  12. extern "C" {
  13. #endif
  14. /**
  15. * @brief Chip models
  16. */
  17. typedef enum {
  18. CHIP_ESP32 = 1, //!< ESP32
  19. CHIP_ESP32S2 = 2, //!< ESP32-S2
  20. CHIP_ESP32S3 = 9, //!< ESP32-S3
  21. CHIP_ESP32C3 = 5, //!< ESP32-C3
  22. CHIP_ESP32C2 = 12, //!< ESP32-C2
  23. CHIP_ESP32C6 = 13, //!< ESP32-C6
  24. CHIP_ESP32H2 = 16, //!< ESP32-H2
  25. CHIP_ESP32P4 = 18, //!< ESP32-P4
  26. CHIP_POSIX_LINUX = 999, //!< The code is running on POSIX/Linux simulator
  27. } esp_chip_model_t;
  28. /* Chip feature flags, used in esp_chip_info_t */
  29. #define CHIP_FEATURE_EMB_FLASH BIT(0) //!< Chip has embedded flash memory
  30. #define CHIP_FEATURE_WIFI_BGN BIT(1) //!< Chip has 2.4GHz WiFi
  31. #define CHIP_FEATURE_BLE BIT(4) //!< Chip has Bluetooth LE
  32. #define CHIP_FEATURE_BT BIT(5) //!< Chip has Bluetooth Classic
  33. #define CHIP_FEATURE_IEEE802154 BIT(6) //!< Chip has IEEE 802.15.4
  34. #define CHIP_FEATURE_EMB_PSRAM BIT(7) //!< Chip has embedded psram
  35. /**
  36. * @brief The structure represents information about the chip
  37. */
  38. typedef struct {
  39. esp_chip_model_t model; //!< chip model, one of esp_chip_model_t
  40. uint32_t features; //!< bit mask of CHIP_FEATURE_x feature flags
  41. uint16_t revision; //!< chip revision number (in format MXX; where M - wafer major version, XX - wafer minor version)
  42. uint8_t cores; //!< number of CPU cores
  43. } esp_chip_info_t;
  44. /**
  45. * @brief Fill an esp_chip_info_t structure with information about the chip
  46. * @param[out] out_info structure to be filled
  47. */
  48. void esp_chip_info(esp_chip_info_t* out_info);
  49. #if CONFIG_ESP32_ECO3_CACHE_LOCK_FIX
  50. /**
  51. * @brief Cache lock bug exists or not
  52. *
  53. * @return
  54. * - ture : bug exists
  55. * - false : bug not exists
  56. */
  57. bool soc_has_cache_lock_bug(void);
  58. #endif
  59. #ifdef __cplusplus
  60. }
  61. #endif