1 /* 2 * SPDX-FileCopyrightText: 2013-2021 Espressif Systems (Shanghai) CO LTD 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #include <string.h> 8 #include "esp_chip_info.h" 9 #include "soc/soc.h" 10 #include "soc/efuse_reg.h" 11 #include "esp_efuse.h" 12 esp_chip_info(esp_chip_info_t * out_info)13void esp_chip_info(esp_chip_info_t* out_info) 14 { 15 uint32_t efuse_rd3 = REG_READ(EFUSE_BLK0_RDATA3_REG); 16 memset(out_info, 0, sizeof(*out_info)); 17 18 out_info->model = CHIP_ESP32; 19 out_info->revision = esp_efuse_get_chip_ver(); 20 21 if ((efuse_rd3 & EFUSE_RD_CHIP_VER_DIS_APP_CPU_M) == 0) { 22 out_info->cores = 2; 23 } else { 24 out_info->cores = 1; 25 } 26 out_info->features = CHIP_FEATURE_WIFI_BGN; 27 if ((efuse_rd3 & EFUSE_RD_CHIP_VER_DIS_BT_M) == 0) { 28 out_info->features |= CHIP_FEATURE_BT | CHIP_FEATURE_BLE; 29 } 30 uint32_t package = esp_efuse_get_pkg_ver(); 31 if (package == EFUSE_RD_CHIP_VER_PKG_ESP32D2WDQ5 || 32 package == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD2 || 33 package == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD4 || 34 package == EFUSE_RD_CHIP_VER_PKG_ESP32PICOV302) { 35 out_info->features |= CHIP_FEATURE_EMB_FLASH; 36 } 37 if(package == EFUSE_RD_CHIP_VER_PKG_ESP32D0WDR2V3) { 38 out_info->features |= CHIP_FEATURE_EMB_PSRAM; 39 } 40 } 41 42 #if CONFIG_ESP32_ECO3_CACHE_LOCK_FIX soc_has_cache_lock_bug(void)43inline bool soc_has_cache_lock_bug(void) 44 { 45 return (esp_efuse_get_chip_ver() == 3); 46 } 47 #endif 48