kopia lustrzana https://github.com/espressif/esp-idf
esp_flash: deprecate the cs_id member, which is no longer used.
We used to manually specify the CS id. However after the SPI bus lock is introduced, the lock is responsible to assign the CS lines and provide the CS id. The esp_flash driver now depends on the ID assigned by the SPI bus lock, the configuration field is deprecated.pull/5182/head
rodzic
5404e3d434
commit
9d9d22c920
|
@ -73,14 +73,14 @@ __attribute__((unused)) static const char TAG[] = "spi_flash";
|
|||
esp_flash_t *esp_flash_default_chip = NULL;
|
||||
|
||||
|
||||
static IRAM_ATTR NOINLINE_ATTR void cs_initialize(esp_flash_t *chip, const esp_flash_spi_device_config_t *config, bool use_iomux)
|
||||
static IRAM_ATTR NOINLINE_ATTR void cs_initialize(esp_flash_t *chip, const esp_flash_spi_device_config_t *config, bool use_iomux, int cs_id)
|
||||
{
|
||||
//Not using spicommon_cs_initialize since we don't want to put the whole
|
||||
//spi_periph_signal into the DRAM. Copy these data from flash before the
|
||||
//cache disabling
|
||||
int cs_io_num = config->cs_io_num;
|
||||
int spics_in = spi_periph_signal[config->host_id].spics_in;
|
||||
int spics_out = spi_periph_signal[config->host_id].spics_out[config->cs_id];
|
||||
int spics_out = spi_periph_signal[config->host_id].spics_out[cs_id];
|
||||
int spics_func = spi_periph_signal[config->host_id].func;
|
||||
uint32_t iomux_reg = GPIO_PIN_MUX_REG[cs_io_num];
|
||||
|
||||
|
@ -101,7 +101,7 @@ static IRAM_ATTR NOINLINE_ATTR void cs_initialize(esp_flash_t *chip, const esp_f
|
|||
}
|
||||
GPIO.pin[cs_io_num].pad_driver = 0;
|
||||
gpio_matrix_out(cs_io_num, spics_out, false, false);
|
||||
if (config->cs_id == 0) {
|
||||
if (cs_id == 0) {
|
||||
gpio_matrix_in(cs_io_num, spics_in, false);
|
||||
}
|
||||
PIN_FUNC_SELECT(iomux_reg, PIN_FUNC_GPIO);
|
||||
|
@ -167,7 +167,8 @@ esp_err_t spi_bus_add_flash_device(esp_flash_t **out_chip, const esp_flash_spi_d
|
|||
goto fail;
|
||||
}
|
||||
|
||||
cs_initialize(chip, config, use_iomux);
|
||||
// The cs_id inside `config` is deprecated, use the `dev_id` provided by the bus lock instead.
|
||||
cs_initialize(chip, config, use_iomux, dev_id);
|
||||
*out_chip = chip;
|
||||
return ret;
|
||||
fail:
|
||||
|
|
|
@ -24,11 +24,12 @@ extern "C" {
|
|||
/// Configurations for the SPI Flash to init
|
||||
typedef struct {
|
||||
spi_host_device_t host_id; ///< Bus to use
|
||||
int cs_id; ///< CS pin (signal) to use
|
||||
int cs_io_num; ///< GPIO pin to output the CS signal
|
||||
esp_flash_io_mode_t io_mode; ///< IO mode to read from the Flash
|
||||
esp_flash_io_mode_t io_mode; ///< IO mode to read from the Flash
|
||||
esp_flash_speed_t speed; ///< Speed of the Flash clock
|
||||
int input_delay_ns; ///< Input delay of the data pins, in ns. Set to 0 if unknown.
|
||||
|
||||
int cs_id; ///< @deprecated CS pin (signal) to use
|
||||
} esp_flash_spi_device_config_t;
|
||||
|
||||
/**
|
||||
|
|
Ładowanie…
Reference in New Issue