Browse Source

drivers: i2s: esp32 fix warnings and errors due to variable declarations

Fixes warnings and errors due to misplacement of variable declarations

Signed-off-by: Marcio Ribeiro <marcio.ribeiro@espressif.com>
pull/71458/head
Marcio Ribeiro 3 months ago committed by Benjamin Cabé
parent
commit
a5d69a5b63
  1. 14
      drivers/i2s/i2s_esp32.c

14
drivers/i2s/i2s_esp32.c

@ -605,11 +605,14 @@ int i2s_esp32_config_dma(const struct device *dev, enum i2s_dir dir, @@ -605,11 +605,14 @@ int i2s_esp32_config_dma(const struct device *dev, enum i2s_dir dir,
static int i2s_esp32_start_dma(const struct device *dev, enum i2s_dir dir)
{
const struct i2s_esp32_cfg *dev_cfg = dev->config;
const i2s_hal_context_t *hal = &(dev_cfg->hal);
const struct i2s_esp32_stream *stream = NULL;
unsigned int key;
int err = 0;
#if !SOC_GDMA_SUPPORTED || I2S_ESP32_IS_DIR_EN(rx)
const i2s_hal_context_t *hal = &(dev_cfg->hal);
#endif /* SOC_GDMA_SUPPORTED || I2S_ESP32_IS_DIR_EN(rx) */
if (dir == I2S_DIR_RX) {
stream = &dev_cfg->rx;
} else if (dir == I2S_DIR_TX) {
@ -662,6 +665,7 @@ static int i2s_esp32_start_dma(const struct device *dev, enum i2s_dir dir) @@ -662,6 +665,7 @@ static int i2s_esp32_start_dma(const struct device *dev, enum i2s_dir dir)
i2s_hal_rx_enable_dma(hal);
i2s_hal_rx_enable_intr(hal);
i2s_hal_rx_start_link(hal, (uint32_t)&(stream->conf->dma_desc[0]));
}
#endif /* I2S_ESP32_IS_DIR_EN(rx) */
#if I2S_ESP32_IS_DIR_EN(tx)
@ -681,10 +685,13 @@ unlock: @@ -681,10 +685,13 @@ unlock:
static int i2s_esp32_restart_dma(const struct device *dev, enum i2s_dir dir)
{
const struct i2s_esp32_cfg *dev_cfg = dev->config;
const i2s_hal_context_t *hal = &(dev_cfg->hal);
const struct i2s_esp32_stream *stream;
int err = 0;
#if !SOC_GDMA_SUPPORTED || I2S_ESP32_IS_DIR_EN(rx)
const i2s_hal_context_t *hal = &(dev_cfg->hal);
#endif /* SOC_GDMA_SUPPORTED || I2S_ESP32_IS_DIR_EN(rx) */
if (dir == I2S_DIR_RX) {
stream = &dev_cfg->rx;
} else if (dir == I2S_DIR_TX) {
@ -695,11 +702,10 @@ static int i2s_esp32_restart_dma(const struct device *dev, enum i2s_dir dir) @@ -695,11 +702,10 @@ static int i2s_esp32_restart_dma(const struct device *dev, enum i2s_dir dir)
}
#if SOC_GDMA_SUPPORTED
uint16_t chunk_len;
void *src = NULL, *dst = NULL;
#if I2S_ESP32_IS_DIR_EN(rx)
uint16_t chunk_len;
if (dir == I2S_DIR_RX) {
dst = stream->data->mem_block;

Loading…
Cancel
Save