spi_common: add interface to get whether the bus is on IOMUX

This commit is contained in:
Michael (XIAO Xufeng) 2019-06-26 11:42:02 +08:00
parent b76ab9142d
commit 65c0d354e4
2 changed files with 22 additions and 0 deletions

View file

@ -310,6 +310,17 @@ void spicommon_cs_free_io(int cs_gpio_num);
*/
bool spicommon_bus_using_iomux(spi_host_device_t host);
/**
* @brief Check whether all pins used by a host are through IOMUX.
*
* @param host SPI peripheral
*
* @note This public API is deprecated.
*
* @return false if any pins are through the GPIO matrix, otherwise true.
*/
bool spicommon_bus_using_iomux(spi_host_device_t host);
/**
* @brief Get the IRQ source for a specific SPI host
*

View file

@ -352,6 +352,17 @@ void spicommon_cs_free_io(int cs_gpio_num)
gpio_reset_pin(cs_gpio_num);
}
bool spicommon_bus_using_iomux(spi_host_device_t host)
{
#define CHECK_IOMUX_PIN(HOST, PIN_NAME) if (GPIO.func_in_sel_cfg[spi_periph_signal[(HOST)].PIN_NAME##_in].sig_in_sel) return false
CHECK_IOMUX_PIN(host, spid);
CHECK_IOMUX_PIN(host, spiq);
CHECK_IOMUX_PIN(host, spiwp);
CHECK_IOMUX_PIN(host, spihd);
return true;
}
/*
Code for workaround for DMA issue in ESP32 v0/v1 silicon
*/