esp32/i2s: implement I2S receiver module
- Add ioctl method to enable allocating the apb buffer. - Add RX methods to set data width, sample rate, channels and for receiving data from the I2S peripheral. - Update the i2schar defconfig to enable the I2S receiver. - Add nxlooper defconfig to enable testing the RX interface. - Add specific bindings on ESP32 bringup to enable nxlooper to work without the need of any specific codec.
This commit is contained in:
parent
7ae4152f47
commit
3b5ab27893
@ -369,9 +369,9 @@ config ESP32_I2S0_WSPIN
|
|||||||
range 0 39 if ESP32_I2S0_ROLE_SLAVE
|
range 0 39 if ESP32_I2S0_ROLE_SLAVE
|
||||||
|
|
||||||
config ESP32_I2S0_DINPIN
|
config ESP32_I2S0_DINPIN
|
||||||
int "I2S0 DOUT pin"
|
int "I2S0 DIN pin"
|
||||||
depends on ESP32_I2S0_RX
|
depends on ESP32_I2S0_RX
|
||||||
default 12
|
default 19
|
||||||
range 0 39
|
range 0 39
|
||||||
|
|
||||||
config ESP32_I2S0_DOUTPIN
|
config ESP32_I2S0_DOUTPIN
|
||||||
@ -471,7 +471,6 @@ endchoice
|
|||||||
|
|
||||||
config ESP32_I2S1_DATA_BIT_WIDTH
|
config ESP32_I2S1_DATA_BIT_WIDTH
|
||||||
int
|
int
|
||||||
default 16
|
|
||||||
default 8 if ESP32_I2S1_DATA_BIT_WIDTH_8BIT
|
default 8 if ESP32_I2S1_DATA_BIT_WIDTH_8BIT
|
||||||
default 16 if ESP32_I2S1_DATA_BIT_WIDTH_16BIT
|
default 16 if ESP32_I2S1_DATA_BIT_WIDTH_16BIT
|
||||||
default 24 if ESP32_I2S1_DATA_BIT_WIDTH_24BIT
|
default 24 if ESP32_I2S1_DATA_BIT_WIDTH_24BIT
|
||||||
@ -488,26 +487,26 @@ config ESP32_I2S1_SAMPLE_RATE
|
|||||||
|
|
||||||
config ESP32_I2S1_BCLKPIN
|
config ESP32_I2S1_BCLKPIN
|
||||||
int "I2S1 BCLK pin"
|
int "I2S1 BCLK pin"
|
||||||
default 19
|
default 22
|
||||||
range 0 33 if ESP32_I2S1_ROLE_MASTER
|
range 0 33 if ESP32_I2S1_ROLE_MASTER
|
||||||
range 0 39 if ESP32_I2S1_ROLE_SLAVE
|
range 0 39 if ESP32_I2S1_ROLE_SLAVE
|
||||||
|
|
||||||
config ESP32_I2S1_WSPIN
|
config ESP32_I2S1_WSPIN
|
||||||
int "I2S1 WS pin"
|
int "I2S1 WS pin"
|
||||||
default 18
|
default 23
|
||||||
range 0 33 if ESP32_I2S1_ROLE_MASTER
|
range 0 33 if ESP32_I2S1_ROLE_MASTER
|
||||||
range 0 39 if ESP32_I2S1_ROLE_SLAVE
|
range 0 39 if ESP32_I2S1_ROLE_SLAVE
|
||||||
|
|
||||||
config ESP32_I2S1_DOUTPIN
|
config ESP32_I2S1_DINPIN
|
||||||
int "I2S1 DOUT pin"
|
int "I2S1 DIN pin"
|
||||||
depends on ESP32_I2S1_RX
|
depends on ESP32_I2S1_RX
|
||||||
default 17
|
default 26
|
||||||
range 0 39
|
range 0 39
|
||||||
|
|
||||||
config ESP32_I2S1_DOUTPIN
|
config ESP32_I2S1_DOUTPIN
|
||||||
int "I2S1 DOUT pin"
|
int "I2S1 DOUT pin"
|
||||||
depends on ESP32_I2S1_TX
|
depends on ESP32_I2S1_TX
|
||||||
default 16
|
default 25
|
||||||
range 0 33
|
range 0 33
|
||||||
|
|
||||||
config ESP32_I2S1_MCLK
|
config ESP32_I2S1_MCLK
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -41,13 +41,8 @@ extern "C"
|
|||||||
|
|
||||||
#ifdef CONFIG_ESP32_I2S
|
#ifdef CONFIG_ESP32_I2S
|
||||||
|
|
||||||
#ifdef CONFIG_ESP32_I2S0
|
|
||||||
#define ESP32_I2S0 0
|
#define ESP32_I2S0 0
|
||||||
#endif /* CONFIG_ESP32_I2S0 */
|
|
||||||
|
|
||||||
#ifdef CONFIG_ESP32_I2S1
|
|
||||||
#define ESP32_I2S1 1
|
#define ESP32_I2S1 1
|
||||||
#endif /* CONFIG_ESP32_I2S1 */
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Function Prototypes
|
* Public Function Prototypes
|
||||||
|
@ -37,8 +37,8 @@
|
|||||||
|
|
||||||
#include "esp32_i2s.h"
|
#include "esp32_i2s.h"
|
||||||
|
|
||||||
#if defined(CONFIG_ESP32_I2S0) && !defined(CONFIG_AUDIO_CS4344) && \
|
#if defined(CONFIG_ESP32_I2S0) && !defined(CONFIG_AUDIO_CS4344) || \
|
||||||
!defined(CONFIG_AUDIO_ES8388) || defined(CONFIG_ESP32_I2S1)
|
defined(CONFIG_ESP32_I2S1)
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
@ -55,6 +55,8 @@
|
|||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* port - The I2S port used for the device
|
* port - The I2S port used for the device
|
||||||
|
* enable_tx - Register device as TX if true
|
||||||
|
* enable_rx - Register device as RX if true
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Zero is returned on success. Otherwise, a negated errno value is
|
* Zero is returned on success. Otherwise, a negated errno value is
|
||||||
@ -62,12 +64,11 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int board_i2sdev_initialize(int port)
|
int board_i2sdev_initialize(int port, bool enable_tx, bool enable_rx)
|
||||||
{
|
{
|
||||||
struct audio_lowerhalf_s *audio_i2s;
|
struct audio_lowerhalf_s *audio_i2s;
|
||||||
struct audio_lowerhalf_s *pcm;
|
|
||||||
struct i2s_dev_s *i2s;
|
struct i2s_dev_s *i2s;
|
||||||
char devname[12];
|
char devname[8];
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ainfo("Initializing I2S\n");
|
ainfo("Initializing I2S\n");
|
||||||
@ -75,7 +76,7 @@ int board_i2sdev_initialize(int port)
|
|||||||
i2s = esp32_i2sbus_initialize(port);
|
i2s = esp32_i2sbus_initialize(port);
|
||||||
|
|
||||||
#ifdef CONFIG_AUDIO_I2SCHAR
|
#ifdef CONFIG_AUDIO_I2SCHAR
|
||||||
ret = i2schar_register(i2s, 0);
|
ret = i2schar_register(i2s, port);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
aerr("ERROR: i2schar_register failed: %d\n", ret);
|
aerr("ERROR: i2schar_register failed: %d\n", ret);
|
||||||
@ -83,29 +84,71 @@ int board_i2sdev_initialize(int port)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (enable_tx)
|
||||||
|
{
|
||||||
|
/* Initialize audio output */
|
||||||
|
|
||||||
audio_i2s = audio_i2s_initialize(i2s, true);
|
audio_i2s = audio_i2s_initialize(i2s, true);
|
||||||
|
|
||||||
if (!audio_i2s)
|
if (audio_i2s == NULL)
|
||||||
{
|
{
|
||||||
auderr("ERROR: Failed to initialize I2S\n");
|
auderr("ERROR: Failed to initialize I2S audio output\n");
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snprintf(devname, sizeof(devname), "pcm%d", port);
|
||||||
|
|
||||||
|
/* If nxlooper is selected, the playback buffer is not rendered as
|
||||||
|
* a WAV file. Therefore, PCM decode will fail while processing such
|
||||||
|
* output buffer. In such a case, we bypass the PCM decode.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef CONFIG_SYSTEM_NXLOOPER
|
||||||
|
ret = audio_register(devname, audio_i2s);
|
||||||
|
#else
|
||||||
|
struct audio_lowerhalf_s *pcm;
|
||||||
|
|
||||||
pcm = pcm_decode_initialize(audio_i2s);
|
pcm = pcm_decode_initialize(audio_i2s);
|
||||||
|
|
||||||
if (!pcm)
|
if (pcm == NULL)
|
||||||
{
|
{
|
||||||
auderr("ERROR: Failed create the PCM decoder\n");
|
auderr("ERROR: Failed create the PCM decoder\n");
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(devname, 12, "pcm%d", port);
|
|
||||||
|
|
||||||
ret = audio_register(devname, pcm);
|
ret = audio_register(devname, pcm);
|
||||||
|
#endif /* CONFIG_SYSTEM_NXLOOPER */
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
auderr("ERROR: Failed to register /dev/%s device: %d\n", devname, ret);
|
auderr("ERROR: Failed to register /dev/%s device: %d\n",
|
||||||
|
devname, ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (enable_rx)
|
||||||
|
{
|
||||||
|
/* Initialize audio input */
|
||||||
|
|
||||||
|
audio_i2s = audio_i2s_initialize(i2s, false);
|
||||||
|
|
||||||
|
if (audio_i2s == NULL)
|
||||||
|
{
|
||||||
|
auderr("ERROR: Failed to initialize I2S audio input\n");
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
|
snprintf(devname, sizeof(devname), "pcm_in%d", port);
|
||||||
|
|
||||||
|
ret = audio_register(devname, audio_i2s);
|
||||||
|
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
auderr("ERROR: Failed to register /dev/%s device: %d\n",
|
||||||
|
devname, ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
# modifications.
|
# modifications.
|
||||||
#
|
#
|
||||||
# CONFIG_ARCH_LEDS is not set
|
# CONFIG_ARCH_LEDS is not set
|
||||||
# CONFIG_ESP32_I2S0_RX is not set
|
|
||||||
# CONFIG_NDEBUG is not set
|
# CONFIG_NDEBUG is not set
|
||||||
# CONFIG_NSH_ARGCAT is not set
|
# CONFIG_NSH_ARGCAT is not set
|
||||||
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
|
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
|
||||||
@ -25,13 +24,18 @@ CONFIG_AUDIO_I2S=y
|
|||||||
CONFIG_AUDIO_I2SCHAR=y
|
CONFIG_AUDIO_I2SCHAR=y
|
||||||
CONFIG_BOARD_LOOPSPERMSEC=16717
|
CONFIG_BOARD_LOOPSPERMSEC=16717
|
||||||
CONFIG_BUILTIN=y
|
CONFIG_BUILTIN=y
|
||||||
CONFIG_DEBUG_SYMBOLS=y
|
|
||||||
CONFIG_DRIVERS_AUDIO=y
|
CONFIG_DRIVERS_AUDIO=y
|
||||||
CONFIG_ESP32_I2S0=y
|
CONFIG_ESP32_I2S0=y
|
||||||
|
CONFIG_ESP32_I2S0_DATA_BIT_WIDTH_16BIT=y
|
||||||
CONFIG_ESP32_I2S0_MCLK=y
|
CONFIG_ESP32_I2S0_MCLK=y
|
||||||
|
CONFIG_ESP32_I2S1=y
|
||||||
CONFIG_ESP32_I2S=y
|
CONFIG_ESP32_I2S=y
|
||||||
CONFIG_ESP32_UART0=y
|
CONFIG_ESP32_UART0=y
|
||||||
CONFIG_EXAMPLES_I2SCHAR=y
|
CONFIG_EXAMPLES_I2SCHAR=y
|
||||||
|
CONFIG_EXAMPLES_I2SCHAR_BUFSIZE=1024
|
||||||
|
CONFIG_EXAMPLES_I2SCHAR_RX=y
|
||||||
|
CONFIG_EXAMPLES_I2SCHAR_RXBUFFERS=2
|
||||||
|
CONFIG_EXAMPLES_I2SCHAR_RXSTACKSIZE=4096
|
||||||
CONFIG_EXAMPLES_I2SCHAR_TX=y
|
CONFIG_EXAMPLES_I2SCHAR_TX=y
|
||||||
CONFIG_EXAMPLES_I2SCHAR_TXBUFFERS=2
|
CONFIG_EXAMPLES_I2SCHAR_TXBUFFERS=2
|
||||||
CONFIG_EXAMPLES_I2SCHAR_TXSTACKSIZE=4096
|
CONFIG_EXAMPLES_I2SCHAR_TXSTACKSIZE=4096
|
||||||
|
129
boards/xtensa/esp32/esp32-devkitc/configs/nxlooper/defconfig
Normal file
129
boards/xtensa/esp32/esp32-devkitc/configs/nxlooper/defconfig
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
#
|
||||||
|
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||||
|
#
|
||||||
|
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||||
|
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||||
|
# modifications.
|
||||||
|
#
|
||||||
|
# CONFIG_ARCH_LEDS is not set
|
||||||
|
# CONFIG_ESP32_I2S0_RX is not set
|
||||||
|
# CONFIG_ESP32_I2S1_TX is not set
|
||||||
|
# CONFIG_NDEBUG is not set
|
||||||
|
# CONFIG_NSH_ARGCAT is not set
|
||||||
|
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
|
||||||
|
# CONFIG_NSH_CMDPARMS is not set
|
||||||
|
CONFIG_ALLOW_BSD_COMPONENTS=y
|
||||||
|
CONFIG_ARCH="xtensa"
|
||||||
|
CONFIG_ARCH_BOARD="esp32-devkitc"
|
||||||
|
CONFIG_ARCH_BOARD_COMMON=y
|
||||||
|
CONFIG_ARCH_BOARD_ESP32_DEVKITC=y
|
||||||
|
CONFIG_ARCH_CHIP="esp32"
|
||||||
|
CONFIG_ARCH_CHIP_ESP32=y
|
||||||
|
CONFIG_ARCH_CHIP_ESP32WROVER=y
|
||||||
|
CONFIG_ARCH_INTERRUPTSTACK=4096
|
||||||
|
CONFIG_ARCH_STACKDUMP=y
|
||||||
|
CONFIG_ARCH_XTENSA=y
|
||||||
|
CONFIG_AUDIO=y
|
||||||
|
CONFIG_AUDIOUTILS_MMLPARSER_LIB=y
|
||||||
|
CONFIG_AUDIO_BUFFER_NUMBYTES=4092
|
||||||
|
CONFIG_AUDIO_EXCLUDE_BALANCE=y
|
||||||
|
CONFIG_AUDIO_EXCLUDE_FFORWARD=y
|
||||||
|
CONFIG_AUDIO_EXCLUDE_TONE=y
|
||||||
|
CONFIG_AUDIO_EXCLUDE_VOLUME=y
|
||||||
|
CONFIG_AUDIO_I2S=y
|
||||||
|
CONFIG_AUDIO_I2SCHAR=y
|
||||||
|
CONFIG_AUDIO_NUM_BUFFERS=4
|
||||||
|
CONFIG_BOARDCTL_ROMDISK=y
|
||||||
|
CONFIG_BOARD_LOOPSPERMSEC=16717
|
||||||
|
CONFIG_BUILTIN=y
|
||||||
|
CONFIG_DEFAULT_TASK_STACKSIZE=4096
|
||||||
|
CONFIG_DEV_URANDOM=y
|
||||||
|
CONFIG_DRIVERS_AUDIO=y
|
||||||
|
CONFIG_DRIVERS_IEEE80211=y
|
||||||
|
CONFIG_DRIVERS_WIRELESS=y
|
||||||
|
CONFIG_ESP32_I2S0=y
|
||||||
|
CONFIG_ESP32_I2S0_DATA_BIT_WIDTH_16BIT=y
|
||||||
|
CONFIG_ESP32_I2S0_MCLK=y
|
||||||
|
CONFIG_ESP32_I2S1=y
|
||||||
|
CONFIG_ESP32_I2S1_DATA_BIT_WIDTH_16BIT=y
|
||||||
|
CONFIG_ESP32_I2S=y
|
||||||
|
CONFIG_ESP32_SPIFLASH=y
|
||||||
|
CONFIG_ESP32_SPIFLASH_SPIFFS=y
|
||||||
|
CONFIG_ESP32_STORAGE_MTD_SIZE=0x80000
|
||||||
|
CONFIG_ESP32_UART0=y
|
||||||
|
CONFIG_ESP32_WIFI=y
|
||||||
|
CONFIG_ESP32_WIFI_SAVE_PARAM=y
|
||||||
|
CONFIG_EXAMPLES_I2SCHAR=y
|
||||||
|
CONFIG_EXAMPLES_I2SCHAR_BUFSIZE=960
|
||||||
|
CONFIG_EXAMPLES_I2SCHAR_RX=y
|
||||||
|
CONFIG_EXAMPLES_I2SCHAR_RXBUFFERS=2
|
||||||
|
CONFIG_EXAMPLES_I2SCHAR_RXSTACKSIZE=2048
|
||||||
|
CONFIG_EXAMPLES_I2SCHAR_TX=y
|
||||||
|
CONFIG_EXAMPLES_I2SCHAR_TXBUFFERS=2
|
||||||
|
CONFIG_EXAMPLES_I2SCHAR_TXSTACKSIZE=2048
|
||||||
|
CONFIG_EXAMPLES_ROMFS=y
|
||||||
|
CONFIG_FS_PROCFS=y
|
||||||
|
CONFIG_FS_ROMFS=y
|
||||||
|
CONFIG_HAVE_CXX=y
|
||||||
|
CONFIG_HAVE_CXXINITIALIZE=y
|
||||||
|
CONFIG_I2S_DMADESC_NUM=4
|
||||||
|
CONFIG_IDLETHREAD_STACKSIZE=3072
|
||||||
|
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
||||||
|
CONFIG_INTELHEX_BINARY=y
|
||||||
|
CONFIG_IOB_NBUFFERS=24
|
||||||
|
CONFIG_IOB_THROTTLE=0
|
||||||
|
CONFIG_MM_REGIONS=3
|
||||||
|
CONFIG_NAME_MAX=48
|
||||||
|
CONFIG_NETDB_DNSCLIENT=y
|
||||||
|
CONFIG_NETDB_DNSCLIENT_NAMESIZE=64
|
||||||
|
CONFIG_NETDEV_LATEINIT=y
|
||||||
|
CONFIG_NETDEV_PHY_IOCTL=y
|
||||||
|
CONFIG_NETDEV_WIRELESS_IOCTL=y
|
||||||
|
CONFIG_NETINIT_WAPI_ALG=1
|
||||||
|
CONFIG_NETUTILS_IPERF=y
|
||||||
|
CONFIG_NETUTILS_TELNETD=y
|
||||||
|
CONFIG_NET_BROADCAST=y
|
||||||
|
CONFIG_NET_ETH_PKTSIZE=1518
|
||||||
|
CONFIG_NET_ICMP=y
|
||||||
|
CONFIG_NET_ICMP_SOCKET=y
|
||||||
|
CONFIG_NET_NACTIVESOCKETS=32
|
||||||
|
CONFIG_NET_STATISTICS=y
|
||||||
|
CONFIG_NET_TCP=y
|
||||||
|
CONFIG_NET_TCP_DELAYED_ACK=y
|
||||||
|
CONFIG_NET_TCP_WRITE_BUFFERS=y
|
||||||
|
CONFIG_NET_UDP=y
|
||||||
|
CONFIG_NSH_ARCHINIT=y
|
||||||
|
CONFIG_NSH_BUILTIN_APPS=y
|
||||||
|
CONFIG_NSH_FILEIOSIZE=512
|
||||||
|
CONFIG_NSH_LINELEN=300
|
||||||
|
CONFIG_NSH_READLINE=y
|
||||||
|
CONFIG_NXPLAYER_HTTP_STREAMING_SUPPORT=y
|
||||||
|
CONFIG_NXPLAYER_PLAYTHREAD_STACKSIZE=4096
|
||||||
|
CONFIG_POSIX_SPAWN_DEFAULT_STACKSIZE=2048
|
||||||
|
CONFIG_PREALLOC_TIMERS=4
|
||||||
|
CONFIG_PTHREAD_MUTEX_TYPES=y
|
||||||
|
CONFIG_PTHREAD_STACK_DEFAULT=2048
|
||||||
|
CONFIG_RAM_SIZE=114688
|
||||||
|
CONFIG_RAM_START=0x20000000
|
||||||
|
CONFIG_RR_INTERVAL=200
|
||||||
|
CONFIG_SCHED_HPWORK=y
|
||||||
|
CONFIG_SCHED_HPWORKSTACKSIZE=2048
|
||||||
|
CONFIG_SCHED_LPWORK=y
|
||||||
|
CONFIG_SCHED_WAITPID=y
|
||||||
|
CONFIG_SIG_DEFAULT=y
|
||||||
|
CONFIG_SPI=y
|
||||||
|
CONFIG_SPIFFS_NAME_MAX=48
|
||||||
|
CONFIG_START_DAY=6
|
||||||
|
CONFIG_START_MONTH=12
|
||||||
|
CONFIG_START_YEAR=2011
|
||||||
|
CONFIG_SYSTEM_DHCPC_RENEW=y
|
||||||
|
CONFIG_SYSTEM_NSH=y
|
||||||
|
CONFIG_SYSTEM_NXLOOPER=y
|
||||||
|
CONFIG_SYSTEM_NXPLAYER=y
|
||||||
|
CONFIG_SYSTEM_PING=y
|
||||||
|
CONFIG_TELNET_CHARACTER_MODE=y
|
||||||
|
CONFIG_TLS_TASK_NELEM=4
|
||||||
|
CONFIG_UART0_SERIAL_CONSOLE=y
|
||||||
|
CONFIG_WIRELESS=y
|
||||||
|
CONFIG_WIRELESS_WAPI=y
|
||||||
|
CONFIG_WIRELESS_WAPI_CMDTOOL=y
|
@ -166,6 +166,8 @@ int esp32_twai_setup(void);
|
|||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* port - The I2S port used for the device
|
* port - The I2S port used for the device
|
||||||
|
* enable_tx - Register device as TX if true
|
||||||
|
* enable_rx - Register device as RX if true
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Zero is returned on success. Otherwise, a negated errno value is
|
* Zero is returned on success. Otherwise, a negated errno value is
|
||||||
@ -175,7 +177,7 @@ int esp32_twai_setup(void);
|
|||||||
|
|
||||||
#if defined(CONFIG_ESP32_I2S0) && !defined(CONFIG_AUDIO_CS4344) || \
|
#if defined(CONFIG_ESP32_I2S0) && !defined(CONFIG_AUDIO_CS4344) || \
|
||||||
defined(CONFIG_ESP32_I2S1)
|
defined(CONFIG_ESP32_I2S1)
|
||||||
int board_i2sdev_initialize(int port);
|
int board_i2sdev_initialize(int port, bool enable_tx, bool enable_rx);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
@ -488,6 +488,12 @@ int esp32_bringup(void)
|
|||||||
|
|
||||||
#ifdef CONFIG_ESP32_I2S
|
#ifdef CONFIG_ESP32_I2S
|
||||||
|
|
||||||
|
#if defined(CONFIG_ESP32_I2S0) && !defined(CONFIG_AUDIO_CS4344) || \
|
||||||
|
defined(CONFIG_ESP32_I2S1)
|
||||||
|
bool i2s_enable_tx;
|
||||||
|
bool i2s_enable_rx;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_ESP32_I2S0
|
#ifdef CONFIG_ESP32_I2S0
|
||||||
|
|
||||||
/* Configure I2S0 */
|
/* Configure I2S0 */
|
||||||
@ -503,27 +509,52 @@ int esp32_bringup(void)
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
#ifdef CONFIG_ESP32_I2S0_TX
|
||||||
|
i2s_enable_tx = true;
|
||||||
|
#else
|
||||||
|
i2s_enable_tx = false;
|
||||||
|
#endif /* CONFIG_ESP32_I2S0_TX */
|
||||||
|
|
||||||
|
#ifdef CONFIG_ESP32_I2S0_RX
|
||||||
|
i2s_enable_rx = true;
|
||||||
|
#else
|
||||||
|
i2s_enable_rx = false;
|
||||||
|
#endif /* CONFIG_ESP32_I2S0_RX */
|
||||||
|
|
||||||
/* Configure I2S generic audio on I2S0 */
|
/* Configure I2S generic audio on I2S0 */
|
||||||
|
|
||||||
ret = board_i2sdev_initialize(ESP32_I2S0);
|
ret = board_i2sdev_initialize(ESP32_I2S0, i2s_enable_tx, i2s_enable_rx);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
syslog(LOG_ERR, "Failed to initialize I2S%d driver: %d\n",
|
syslog(LOG_ERR, "Failed to initialize I2S%d driver: %d\n",
|
||||||
CONFIG_ESP32_I2S0, ret);
|
CONFIG_ESP32_I2S0, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_AUDIO_CS4344 */
|
#endif /* CONFIG_AUDIO_CS4344 */
|
||||||
|
|
||||||
#endif /* CONFIG_ESP32_I2S0 */
|
#endif /* CONFIG_ESP32_I2S0 */
|
||||||
|
|
||||||
#ifdef CONFIG_ESP32_I2S1
|
#ifdef CONFIG_ESP32_I2S1
|
||||||
|
|
||||||
|
#ifdef CONFIG_ESP32_I2S1_TX
|
||||||
|
i2s_enable_tx = true;
|
||||||
|
#else
|
||||||
|
i2s_enable_tx = false;
|
||||||
|
#endif /* CONFIG_ESP32_I2S1_TX */
|
||||||
|
|
||||||
|
#ifdef CONFIG_ESP32_I2S1_RX
|
||||||
|
i2s_enable_rx = true;
|
||||||
|
#else
|
||||||
|
i2s_enable_rx = false;
|
||||||
|
#endif /* CONFIG_ESP32_I2S1_RX */
|
||||||
|
|
||||||
/* Configure I2S generic audio on I2S1 */
|
/* Configure I2S generic audio on I2S1 */
|
||||||
|
|
||||||
ret = board_i2sdev_initialize(ESP32_I2S1);
|
ret = board_i2sdev_initialize(ESP32_I2S1, i2s_enable_tx, i2s_enable_rx);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
syslog(LOG_ERR, "Failed to initialize I2S%d driver: %d\n",
|
syslog(LOG_ERR, "Failed to initialize I2S%d driver: %d\n",
|
||||||
CONFIG_ESP32_I2S0, ret);
|
CONFIG_ESP32_I2S1, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_ESP32_I2S1 */
|
#endif /* CONFIG_ESP32_I2S1 */
|
||||||
|
Loading…
Reference in New Issue
Block a user