Procházet zdrojové kódy

Merge branch 'bugfix/put_spihost_handle_in_sram_v4.0' into 'release/v4.0'

spi: always put spihost handle in SRAM (backport 4.0)

See merge request espressif/esp-idf!7902
Michael (XIAO Xufeng) před 6 roky
rodič
revize
6023d60966
1 změnil soubory, kde provedl 2 přidání a 2 odebrání
  1. 2 2
      components/driver/spi_master.c

+ 2 - 2
components/driver/spi_master.c

@@ -237,8 +237,8 @@ esp_err_t spi_bus_initialize(spi_host_device_t host, const spi_bus_config_t *bus
             SPI_CHECK(false, "dma channel already in use", ESP_ERR_INVALID_STATE);
         }
     }
-
-    spihost[host]=malloc(sizeof(spi_host_t));
+    // spihost contains atomic variables, which should not be put in PSRAM
+    spihost[host] = heap_caps_malloc(sizeof(spi_host_t), MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
     if (spihost[host]==NULL) {
         ret = ESP_ERR_NO_MEM;
         goto cleanup;