1 /* 2 * SPDX-FileCopyrightText: 2013-2022 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/chip_revision.h" 11 #include "soc/efuse_reg.h" 12 #include "hal/efuse_ll.h" 13 #include "hal/efuse_hal.h" 14 esp_chip_info(esp_chip_info_t * out_info)15void esp_chip_info(esp_chip_info_t* out_info) 16 { 17 memset(out_info, 0, sizeof(*out_info)); 18 19 out_info->model = CHIP_ESP32; 20 out_info->revision = efuse_hal_chip_revision(); 21 22 if (efuse_ll_get_disable_app_cpu() == 0) { 23 out_info->cores = 2; 24 } else { 25 out_info->cores = 1; 26 } 27 out_info->features = CHIP_FEATURE_WIFI_BGN; 28 if (efuse_ll_get_disable_bt() == 0) { 29 out_info->features |= CHIP_FEATURE_BT | CHIP_FEATURE_BLE; 30 } 31 uint32_t package = efuse_ll_get_chip_ver_pkg(); 32 if (package == EFUSE_RD_CHIP_VER_PKG_ESP32D2WDQ5 || 33 package == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD2 || 34 package == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD4 || 35 package == EFUSE_RD_CHIP_VER_PKG_ESP32PICOV302) { 36 out_info->features |= CHIP_FEATURE_EMB_FLASH; 37 } 38 if(package == EFUSE_RD_CHIP_VER_PKG_ESP32D0WDR2V3 || 39 package == EFUSE_RD_CHIP_VER_PKG_ESP32PICOV302) { 40 out_info->features |= CHIP_FEATURE_EMB_PSRAM; 41 } 42 } 43 44 #if CONFIG_ESP32_ECO3_CACHE_LOCK_FIX soc_has_cache_lock_bug(void)45inline bool soc_has_cache_lock_bug(void) 46 { 47 unsigned rev = efuse_hal_chip_revision(); 48 return ESP_CHIP_REV_ABOVE(rev, 300); 49 } 50 #endif 51