mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
fix(driver): allocate driver objects containing atomic variables from internal SRAM
Objects with atomic members must not be allocated to PSRAM, otherwise the ordering guarantee of atomic accesses is weakened due to a hardware behavior on ESP32 chips. Explicitly request MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT for: - i2c master bus object (atomic status/trans_idx) - i3c master bus object (atomic fsm) - ISP processor and AE/AF/AWB/HIST controllers (atomic fsm) - JPEG decoder/encoder dma2d transaction descriptors (atomic started) - PPA transaction storage embedding dma2d_trans_t - dma2d m2m test transaction embedding dma2d_trans_t
This commit is contained in:
@@ -541,7 +541,8 @@ esp_err_t i3c_new_master_bus(const i3c_master_bus_config_t *bus_config, i3c_mast
|
||||
esp_err_t ret = ESP_OK;
|
||||
i3c_master_bus_t *i3c_master_handle = NULL;
|
||||
|
||||
i3c_master_handle = (i3c_master_bus_t*) heap_caps_calloc(1, sizeof(i3c_master_bus_t), I3C_MASTER_MEM_ALLOC_CAPS);
|
||||
// always allocate memory from internal memory because the driver object contains atomic variable
|
||||
i3c_master_handle = (i3c_master_bus_t*) heap_caps_calloc(1, sizeof(i3c_master_bus_t), MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
|
||||
ESP_RETURN_ON_FALSE(i3c_master_handle, ESP_ERR_NO_MEM, TAG, "no mem for i3c master bus handle");
|
||||
|
||||
s_i3c_master_platform.spinlock = (portMUX_TYPE)portMUX_INITIALIZER_UNLOCKED;
|
||||
|
||||
Reference in New Issue
Block a user