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