feat(i2s): c5mp i2s support

This commit is contained in:
wanlei
2024-05-14 20:27:09 +08:00
parent 207966d64c
commit fb8376cb8c
16 changed files with 1361 additions and 139 deletions

View File

@@ -14,6 +14,7 @@
#include "sdkconfig.h"
#include "driver/gpio.h"
#include "hal/gpio_hal.h"
#include "esp_private/gpio.h"
#include "esp_err.h"
#include "esp_attr.h"
#include "unity.h"
@@ -71,9 +72,9 @@
static void i2s_test_io_config(int mode)
{
// Connect internal signals using IO matrix.
gpio_hal_iomux_func_sel(GPIO_PIN_MUX_REG[MASTER_BCK_IO], PIN_FUNC_GPIO);
gpio_hal_iomux_func_sel(GPIO_PIN_MUX_REG[MASTER_WS_IO], PIN_FUNC_GPIO);
gpio_hal_iomux_func_sel(GPIO_PIN_MUX_REG[DATA_OUT_IO], PIN_FUNC_GPIO);
gpio_func_sel(MASTER_BCK_IO, PIN_FUNC_GPIO);
gpio_func_sel(MASTER_WS_IO, PIN_FUNC_GPIO);
gpio_func_sel(DATA_OUT_IO, PIN_FUNC_GPIO);
gpio_set_direction(MASTER_BCK_IO, GPIO_MODE_INPUT_OUTPUT);
gpio_set_direction(MASTER_WS_IO, GPIO_MODE_INPUT_OUTPUT);
@@ -745,7 +746,7 @@ static void i2s_test_common_sample_rate(i2s_chan_handle_t rx_chan, i2s_std_clk_c
TEST_ESP_OK(pcnt_unit_enable(pcnt_unit));
// Reconfig GPIO signal
gpio_hal_iomux_func_sel(GPIO_PIN_MUX_REG[MASTER_WS_IO], PIN_FUNC_GPIO);
gpio_func_sel(MASTER_WS_IO, PIN_FUNC_GPIO);
gpio_set_direction(MASTER_WS_IO, GPIO_MODE_INPUT_OUTPUT);
esp_rom_gpio_connect_out_signal(MASTER_WS_IO, i2s_periph_signal[0].m_rx_ws_sig, 0, 0);
esp_rom_gpio_connect_in_signal(MASTER_WS_IO, pcnt_periph_signals.groups[0].units[0].channels[0].pulse_sig, 0);

View File

@@ -54,6 +54,14 @@ extern "C" {
#define SLAVE_WS_IO 23
#define DATA_IN_IO 47
#define DATA_OUT_IO 48
#elif CONFIG_IDF_TARGET_ESP32C5
#define MASTER_MCK_IO 6
#define MASTER_BCK_IO 8
#define MASTER_WS_IO 9
#define SLAVE_BCK_IO 23
#define SLAVE_WS_IO 24
#define DATA_IN_IO 10
#define DATA_OUT_IO 25
#else
#define MASTER_MCK_IO 0
#define MASTER_BCK_IO 4