refactor(hal): clean up some hal file dependency on sdkconfig.h

This commit is contained in:
morris
2025-07-16 18:05:06 +08:00
parent 0296c30908
commit ccd092d7dc
35 changed files with 108 additions and 149 deletions

View File

@@ -3,9 +3,9 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "sdkconfig.h"
#include "hal/config.h"
#include "hal/spi_flash_hal.h"
#include "soc/soc_caps.h"
#if SOC_SPI_MEM_SUPPORT_AUTO_SUSPEND
void spi_flash_hal_setup_auto_suspend_mode(spi_flash_host_inst_t *host);
@@ -15,7 +15,7 @@ void spi_flash_hal_setup_auto_resume_mode(spi_flash_host_inst_t *host);
#define SPI_FLASH_TSHSL2_SAFE_VAL_NS (30)
#endif //SOC_SPI_MEM_SUPPORT_AUTO_SUSPEND
#ifndef CONFIG_SPI_FLASH_ROM_IMPL
#if !HAL_CONFIG_SPI_FLASH_USE_ROM_API
#include "spi_flash_hal_common.inc"
@@ -88,7 +88,7 @@ esp_err_t spi_flash_hal_set_write_protect(spi_flash_host_inst_t *host, bool wp)
return ESP_OK;
}
#else // defined CONFIG_SPI_FLASH_ROM_IMPL
#else
static inline spi_dev_t *get_spi_dev(spi_flash_host_inst_t *host)
{
@@ -101,7 +101,7 @@ static inline int get_host_id(spi_flash_host_inst_t* host)
return spi_flash_ll_hw_get_id(dev);
}
#endif // !CONFIG_SPI_FLASH_ROM_IMPL
#endif // !HAL_CONFIG_SPI_FLASH_USE_ROM_API
uint32_t spi_flash_hal_check_status(spi_flash_host_inst_t *host)
{
@@ -115,7 +115,7 @@ uint32_t spi_flash_hal_check_status(spi_flash_host_inst_t *host)
// Not clear if this is necessary, or only necessary if
// chip->spi == SPI1. But probably doesn't hurt...
if ((void*) dev == spi_flash_ll_get_hw(SPI1_HOST)) {
#if CONFIG_IDF_TARGET_ESP32
#if SOC_IS(ESP32)
status &= spi_flash_ll_host_idle(&SPI0);
#endif
}