refactor(spi): moved spi hw sharing func to hw support

Common spi functionality for sharing the SPI bus between modules is moved from esp_driver_spi to
a more fitting location in esp_hw_support (shared HW resource control).

This also allows us to decouple the spi_flash driver from esp_driver_spi, removing
esp_driver_spi and esp_ringbuf from G1 builds.
This commit is contained in:
Marius Vikhammer
2023-11-14 11:14:34 +08:00
parent e7734a3367
commit 52e3f09b32
18 changed files with 656 additions and 588 deletions

View File

@@ -20,7 +20,7 @@
#include "esp_private/spi_flash_os.h"
#include "esp_private/cache_utils.h"
#include "esp_private/spi_common_internal.h"
#include "esp_private/spi_share_hw_ctrl.h"
#define SPI_FLASH_CACHE_NO_DISABLE (CONFIG_SPI_FLASH_AUTO_SUSPEND || (CONFIG_SPIRAM_FETCH_INSTRUCTIONS && CONFIG_SPIRAM_RODATA) || CONFIG_APP_BUILD_TYPE_RAM)
static const char TAG[] = "spi_flash";
@@ -326,7 +326,7 @@ esp_err_t esp_flash_init_main_bus_lock(void)
* is set. Thus, we must not call them if the macro is not defined, else the linker
* would trigger errors. */
#if CONFIG_SPI_FLASH_SHARE_SPI1_BUS
spi_bus_lock_init_main_bus();
/* bus_lock is registered by `spi_bus_lock_init_main_bus` constructor in spi_common.c */
spi_bus_lock_set_bg_control(g_main_spi_bus_lock, cache_enable, cache_disable, NULL);
esp_err_t err = spi_bus_lock_init_main_dev();