1 /*
2  * SPDX-FileCopyrightText: 2021 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_ESP32H2 = 6, //!< ESP32-H2
28 } esp_chip_model_t;
29 
30 /* Chip feature flags, used in esp_chip_info_t */
31 #define CHIP_FEATURE_EMB_FLASH      BIT(0)      //!< Chip has embedded flash memory
32 #define CHIP_FEATURE_WIFI_BGN       BIT(1)      //!< Chip has 2.4GHz WiFi
33 #define CHIP_FEATURE_BLE            BIT(4)      //!< Chip has Bluetooth LE
34 #define CHIP_FEATURE_BT             BIT(5)      //!< Chip has Bluetooth Classic
35 #define CHIP_FEATURE_IEEE802154     BIT(6)      //!< Chip has IEEE 802.15.4
36 #define CHIP_FEATURE_EMB_PSRAM      BIT(7)      //!< Chip has embedded psram
37 
38 /**
39  * @brief The structure represents information about the chip
40  */
41 typedef struct {
42     esp_chip_model_t model;  //!< chip model, one of esp_chip_model_t
43     uint32_t features;       //!< bit mask of CHIP_FEATURE_x feature flags
44     uint8_t cores;           //!< number of CPU cores
45     uint8_t revision;        //!< chip revision number
46 } esp_chip_info_t;
47 
48 /**
49  * @brief Fill an esp_chip_info_t structure with information about the chip
50  * @param[out] out_info structure to be filled
51  */
52 void esp_chip_info(esp_chip_info_t* out_info);
53 
54 #if CONFIG_ESP32_ECO3_CACHE_LOCK_FIX
55 /**
56  * @brief Cache lock bug exists or not
57  *
58  * @return
59  *          - ture : bug exists
60  *          - false : bug not exists
61  */
62 bool soc_has_cache_lock_bug(void);
63 #endif
64 
65 #ifdef __cplusplus
66 }
67 #endif
68