mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-08 04:02:27 +00:00
component/esp32 : fix dualcore bug
1. When dual core cpu run access DPORT register, must do protection. 2. If access DPORT register, must use DPORT_REG_READ/DPORT_REG_WRITE and DPORT_XXX register operation macro.
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
#include "esp_err.h"
|
||||
#include "esp_intr.h"
|
||||
#include "esp_attr.h"
|
||||
#include "esp_dport_access.h"
|
||||
#include "soc/dport_reg.h"
|
||||
#include "sdkconfig.h"
|
||||
|
||||
@@ -51,7 +52,7 @@ void esp_cache_err_int_init()
|
||||
// CPU.
|
||||
|
||||
if (core_id == PRO_CPU_NUM) {
|
||||
SET_PERI_REG_MASK(DPORT_CACHE_IA_INT_EN_REG,
|
||||
DPORT_SET_PERI_REG_MASK(DPORT_CACHE_IA_INT_EN_REG,
|
||||
DPORT_CACHE_IA_INT_PRO_OPPOSITE |
|
||||
DPORT_CACHE_IA_INT_PRO_DRAM1 |
|
||||
DPORT_CACHE_IA_INT_PRO_DROM0 |
|
||||
@@ -59,7 +60,7 @@ void esp_cache_err_int_init()
|
||||
DPORT_CACHE_IA_INT_PRO_IRAM0 |
|
||||
DPORT_CACHE_IA_INT_PRO_IRAM1);
|
||||
} else {
|
||||
SET_PERI_REG_MASK(DPORT_CACHE_IA_INT_EN_REG,
|
||||
DPORT_SET_PERI_REG_MASK(DPORT_CACHE_IA_INT_EN_REG,
|
||||
DPORT_CACHE_IA_INT_APP_OPPOSITE |
|
||||
DPORT_CACHE_IA_INT_APP_DRAM1 |
|
||||
DPORT_CACHE_IA_INT_APP_DROM0 |
|
||||
@@ -80,7 +81,7 @@ int IRAM_ATTR esp_cache_err_get_cpuid()
|
||||
DPORT_PRO_CPU_DISABLED_CACHE_IA_IRAM1 |
|
||||
DPORT_APP_CPU_DISABLED_CACHE_IA_OPPOSITE;
|
||||
|
||||
if (GET_PERI_REG_MASK(DPORT_PRO_DCACHE_DBUG3_REG, pro_mask)) {
|
||||
if (DPORT_GET_PERI_REG_MASK(DPORT_PRO_DCACHE_DBUG3_REG, pro_mask)) {
|
||||
return PRO_CPU_NUM;
|
||||
}
|
||||
|
||||
@@ -92,7 +93,7 @@ int IRAM_ATTR esp_cache_err_get_cpuid()
|
||||
DPORT_APP_CPU_DISABLED_CACHE_IA_IRAM1 |
|
||||
DPORT_PRO_CPU_DISABLED_CACHE_IA_OPPOSITE;
|
||||
|
||||
if (GET_PERI_REG_MASK(DPORT_APP_DCACHE_DBUG3_REG, app_mask)) {
|
||||
if (DPORT_GET_PERI_REG_MASK(DPORT_APP_DCACHE_DBUG3_REG, app_mask)) {
|
||||
return APP_CPU_NUM;
|
||||
}
|
||||
return -1;
|
||||
|
Reference in New Issue
Block a user