diff options
author | Damien George <damien@micropython.org> | 2023-05-09 09:52:54 +1000 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2023-06-23 15:34:22 +1000 |
commit | e4650125b88a35f074097f16d84a8f49bd22ac06 (patch) | |
tree | 6b87f056d0c23f2eb043fa2da0f949429af50e94 /ports/esp32/machine_i2s.c | |
parent | 2af229c3cc55ceefc4cfba0f50092af725c3bfa9 (diff) | |
download | micropython-e4650125b88a35f074097f16d84a8f49bd22ac06.tar.gz micropython-e4650125b88a35f074097f16d84a8f49bd22ac06.zip |
esp32: Update port to support IDF v5.0.2.
This commit updates the esp32 port to work exclusively with ESP-IDF v5.
IDF v5 is needed for some of the newer ESP32 SoCs to work, and it also
cleans up a lot of the inconsistencies between existing SoCs (eg S2, S3,
and C3).
Support for IDF v4 is dropped because it's a lot of effort to maintain both
versions at the same time.
The following components have been verified to work on the various SoCs:
ESP32 ESP32-S2 ESP32-S3 ESP32-C3
build pass pass pass pass
SPIRAM pass pass pass N/A
REPL (UART) pass pass pass pass
REPL (USB) N/A pass pass N/A
filesystem pass pass pass pass
GPIO pass pass pass pass
SPI pass pass pass pass
I2C pass pass pass pass
PWM pass pass pass pass
ADC pass pass pass pass
WiFi STA pass pass pass pass
WiFi AP pass pass pass pass
BLE pass N/A pass pass
ETH pass -- -- --
PPP pass pass pass --
sockets pass pass pass pass
SSL pass ENOMEM pass pass
RMT pass pass pass pass
NeoPixel pass pass pass pass
I2S pass pass pass N/A
ESPNow pass pass pass pass
ULP-FSM pass pass pass N/A
SDCard pass N/A N/A pass
WDT pass pass pass pass
Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Diffstat (limited to 'ports/esp32/machine_i2s.c')
-rw-r--r-- | ports/esp32/machine_i2s.c | 30 |
1 files changed, 4 insertions, 26 deletions
diff --git a/ports/esp32/machine_i2s.c b/ports/esp32/machine_i2s.c index f0163486cd..59b24ae70c 100644 --- a/ports/esp32/machine_i2s.c +++ b/ports/esp32/machine_i2s.c @@ -148,7 +148,7 @@ STATIC const int8_t i2s_frame_map[NUM_I2S_USER_FORMATS][I2S_RX_FRAME_SIZE_IN_BYT }; void machine_i2s_init0() { - for (i2s_port_t p = 0; p < I2S_NUM_MAX; p++) { + for (i2s_port_t p = 0; p < I2S_NUM_AUTO; p++) { MP_STATE_PORT(machine_i2s_obj)[p] = NULL; } } @@ -269,15 +269,6 @@ STATIC uint32_t fill_appbuf_from_dma(machine_i2s_obj_t *self, mp_buffer_info_t * num_bytes_requested_from_dma, &num_bytes_received_from_dma, delay); - - // the following is a workaround for a bug in ESP-IDF v4.4 - // https://github.com/espressif/esp-idf/issues/8121 - #if (ESP_IDF_VERSION_MAJOR == 4) && (ESP_IDF_VERSION_MINOR >= 4) - if ((delay != portMAX_DELAY) && (ret == ESP_ERR_TIMEOUT)) { - ret = ESP_OK; - } - #endif - check_esp_err(ret); // process the transform buffer one frame at a time. @@ -334,15 +325,6 @@ STATIC size_t copy_appbuf_to_dma(machine_i2s_obj_t *self, mp_buffer_info_t *appb } esp_err_t ret = i2s_write(self->port, appbuf->buf, appbuf->len, &num_bytes_written, delay); - - // the following is a workaround for a bug in ESP-IDF v4.4 - // https://github.com/espressif/esp-idf/issues/8121 - #if (ESP_IDF_VERSION_MAJOR == 4) && (ESP_IDF_VERSION_MINOR >= 4) - if ((delay != portMAX_DELAY) && (ret == ESP_ERR_TIMEOUT)) { - ret = ESP_OK; - } - #endif - check_esp_err(ret); if ((self->io_mode == ASYNCIO) && (num_bytes_written < appbuf->len)) { @@ -467,10 +449,8 @@ STATIC void machine_i2s_init_helper(machine_i2s_obj_t *self, size_t n_pos_args, i2s_config.use_apll = false; i2s_config.tx_desc_auto_clear = true; i2s_config.fixed_mclk = 0; - #if (ESP_IDF_VERSION_MAJOR == 4) && (ESP_IDF_VERSION_MINOR >= 4) - i2s_config.mclk_multiple = I2S_MCLK_MULTIPLE_DEFAULT; + i2s_config.mclk_multiple = I2S_MCLK_MULTIPLE_256; i2s_config.bits_per_chan = 0; - #endif // I2S queue size equals the number of DMA buffers check_esp_err(i2s_driver_install(self->port, &i2s_config, i2s_config.dma_buf_count, &self->i2s_event_queue)); @@ -487,9 +467,7 @@ STATIC void machine_i2s_init_helper(machine_i2s_obj_t *self, size_t n_pos_args, #endif i2s_pin_config_t pin_config; - #if (ESP_IDF_VERSION_MAJOR == 4) && (ESP_IDF_VERSION_MINOR >= 4) pin_config.mck_io_num = I2S_PIN_NO_CHANGE; - #endif pin_config.bck_io_num = self->sck; pin_config.ws_io_num = self->ws; @@ -527,7 +505,7 @@ STATIC mp_obj_t machine_i2s_make_new(const mp_obj_type_t *type, size_t n_pos_arg mp_arg_check_num(n_pos_args, n_kw_args, 1, MP_OBJ_FUN_ARGS_MAX, true); i2s_port_t port = mp_obj_get_int(args[0]); - if (port < 0 || port >= I2S_NUM_MAX) { + if (port < 0 || port >= I2S_NUM_AUTO) { mp_raise_ValueError(MP_ERROR_TEXT("invalid id")); } @@ -841,6 +819,6 @@ MP_DEFINE_CONST_OBJ_TYPE( locals_dict, &machine_i2s_locals_dict ); -MP_REGISTER_ROOT_POINTER(struct _machine_i2s_obj_t *machine_i2s_obj[I2S_NUM_MAX]); +MP_REGISTER_ROOT_POINTER(struct _machine_i2s_obj_t *machine_i2s_obj[I2S_NUM_AUTO]); #endif // MICROPY_PY_MACHINE_I2S |