mirror of
https://github.com/apache/nuttx.git
synced 2026-09-24 08:45:04 +08:00
esp32s3/i2s: Add initial support to I2S peripheral
The I2S peripherals are now supported for both receiving and transmitting controllers.
This commit is contained in:
committed by
Xiang Xiao
parent
45d17551b3
commit
5065849ab6
@@ -276,6 +276,248 @@ config ESP32S3_I2C
|
||||
bool
|
||||
default n
|
||||
|
||||
config ESP32S3_I2S
|
||||
bool "I2S"
|
||||
select I2S
|
||||
---help---
|
||||
See the Board Selection menu to configure the pins used by I2S.
|
||||
|
||||
if ESP32S3_I2S
|
||||
|
||||
config ESP32S3_I2S0
|
||||
bool "I2S 0"
|
||||
default n
|
||||
select ESP32S3_DMA
|
||||
select ESP32S3_GPIO_IRQ
|
||||
select SCHED_HPWORK
|
||||
|
||||
if ESP32S3_I2S0
|
||||
|
||||
config ESP32S3_I2S0_RX
|
||||
bool "Enable I2S receiver"
|
||||
default y
|
||||
---help---
|
||||
Enable I2S receiver (port 0)
|
||||
|
||||
config ESP32S3_I2S0_TX
|
||||
bool "Enable I2S transmitter"
|
||||
default y
|
||||
---help---
|
||||
Enable I2S transmitter (port 0)
|
||||
|
||||
choice
|
||||
prompt "I2S0 role"
|
||||
default ESP32S3_I2S0_ROLE_MASTER
|
||||
---help---
|
||||
Selects the operation role of the I2S0.
|
||||
|
||||
config ESP32S3_I2S0_ROLE_MASTER
|
||||
bool "Master"
|
||||
|
||||
config ESP32S3_I2S0_ROLE_SLAVE
|
||||
bool "Slave"
|
||||
|
||||
endchoice
|
||||
|
||||
choice
|
||||
prompt "Bit width"
|
||||
default ESP32S3_I2S0_DATA_BIT_WIDTH_16BIT
|
||||
---help---
|
||||
Selects the valid data bits per sample.
|
||||
Note that this option may be overwritten by the audio
|
||||
according to the bit width of the file being played
|
||||
|
||||
config ESP32S3_I2S0_DATA_BIT_WIDTH_8BIT
|
||||
bool "8 bits"
|
||||
|
||||
config ESP32S3_I2S0_DATA_BIT_WIDTH_16BIT
|
||||
bool "16 bits"
|
||||
|
||||
config ESP32S3_I2S0_DATA_BIT_WIDTH_24BIT
|
||||
bool "24 bits"
|
||||
|
||||
config ESP32S3_I2S0_DATA_BIT_WIDTH_32BIT
|
||||
bool "32 bits"
|
||||
|
||||
endchoice
|
||||
|
||||
config ESP32S3_I2S0_DATA_BIT_WIDTH
|
||||
int
|
||||
default 8 if ESP32S3_I2S0_DATA_BIT_WIDTH_8BIT
|
||||
default 16 if ESP32S3_I2S0_DATA_BIT_WIDTH_16BIT
|
||||
default 24 if ESP32S3_I2S0_DATA_BIT_WIDTH_24BIT
|
||||
default 32 if ESP32S3_I2S0_DATA_BIT_WIDTH_32BIT
|
||||
|
||||
config ESP32S3_I2S0_SAMPLE_RATE
|
||||
int "I2S0 sample rate"
|
||||
default 44100
|
||||
range 8000 48000
|
||||
---help---
|
||||
Selects the sample rate.
|
||||
Note that this option may be overwritten by the audio
|
||||
according to the bit width of the file being played
|
||||
|
||||
config ESP32S3_I2S0_BCLKPIN
|
||||
int "I2S0 BCLK pin"
|
||||
default 4
|
||||
range 0 33 if ESP32S3_I2S0_ROLE_MASTER
|
||||
range 0 39 if ESP32S3_I2S0_ROLE_SLAVE
|
||||
|
||||
config ESP32S3_I2S0_WSPIN
|
||||
int "I2S0 WS pin"
|
||||
default 5
|
||||
range 0 33 if ESP32S3_I2S0_ROLE_MASTER
|
||||
range 0 39 if ESP32S3_I2S0_ROLE_SLAVE
|
||||
|
||||
config ESP32S3_I2S0_DINPIN
|
||||
int "I2S0 DIN pin"
|
||||
depends on ESP32S3_I2S0_RX
|
||||
default 19
|
||||
range 0 39
|
||||
|
||||
config ESP32S3_I2S0_DOUTPIN
|
||||
int "I2S0 DOUT pin"
|
||||
depends on ESP32S3_I2S0_TX
|
||||
default 18
|
||||
range 0 33
|
||||
|
||||
config ESP32S3_I2S0_MCLK
|
||||
bool "Enable I2S Master Clock"
|
||||
depends on ESP32S3_I2S0_ROLE_MASTER
|
||||
default n
|
||||
---help---
|
||||
Enable I2S master clock
|
||||
|
||||
config ESP32S3_I2S0_MCLKPIN
|
||||
int "I2S MCLK pin"
|
||||
depends on ESP32S3_I2S0_MCLK
|
||||
default 0
|
||||
range 0 39
|
||||
|
||||
endif #ESP32S3_I2S0
|
||||
|
||||
config ESP32S3_I2S1
|
||||
bool "I2S 1"
|
||||
default n
|
||||
select ESP32S3_DMA
|
||||
select ESP32S3_GPIO_IRQ
|
||||
select SCHED_HPWORK
|
||||
|
||||
if ESP32S3_I2S1
|
||||
|
||||
config ESP32S3_I2S1_RX
|
||||
bool "Enable I2S receiver"
|
||||
default y
|
||||
---help---
|
||||
Enable I2S receiver (port 1)
|
||||
|
||||
config ESP32S3_I2S1_TX
|
||||
bool "Enable I2S transmitter"
|
||||
default y
|
||||
---help---
|
||||
Enable I2S transmitter (port 1)
|
||||
|
||||
choice
|
||||
prompt "I2S1 role"
|
||||
default ESP32S3_I2S1_ROLE_MASTER
|
||||
---help---
|
||||
Selects the operation role of the I2S1.
|
||||
|
||||
config ESP32S3_I2S1_ROLE_MASTER
|
||||
bool "Master"
|
||||
|
||||
config ESP32S3_I2S1_ROLE_SLAVE
|
||||
bool "Slave"
|
||||
|
||||
endchoice
|
||||
|
||||
choice
|
||||
prompt "Bit width"
|
||||
default ESP32S3_I2S1_DATA_BIT_WIDTH_16BIT
|
||||
---help---
|
||||
Selects the valid data bits per sample.
|
||||
Note that this option may be overwritten by the audio
|
||||
according to the bit width of the file being played
|
||||
|
||||
config ESP32S3_I2S1_DATA_BIT_WIDTH_8BIT
|
||||
bool "8 bits"
|
||||
|
||||
config ESP32S3_I2S1_DATA_BIT_WIDTH_16BIT
|
||||
bool "16 bits"
|
||||
|
||||
config ESP32S3_I2S1_DATA_BIT_WIDTH_24BIT
|
||||
bool "24 bits"
|
||||
|
||||
config ESP32S3_I2S1_DATA_BIT_WIDTH_32BIT
|
||||
bool "32 bits"
|
||||
|
||||
endchoice
|
||||
|
||||
config ESP32S3_I2S1_DATA_BIT_WIDTH
|
||||
int
|
||||
default 8 if ESP32S3_I2S1_DATA_BIT_WIDTH_8BIT
|
||||
default 16 if ESP32S3_I2S1_DATA_BIT_WIDTH_16BIT
|
||||
default 24 if ESP32S3_I2S1_DATA_BIT_WIDTH_24BIT
|
||||
default 32 if ESP32S3_I2S1_DATA_BIT_WIDTH_32BIT
|
||||
|
||||
config ESP32S3_I2S1_SAMPLE_RATE
|
||||
int "I2S1 sample rate"
|
||||
default 44100
|
||||
range 8000 48000
|
||||
---help---
|
||||
Selects the sample rate.
|
||||
Note that this option may be overwritten by the audio
|
||||
according to the bit width of the file being played
|
||||
|
||||
config ESP32S3_I2S1_BCLKPIN
|
||||
int "I2S1 BCLK pin"
|
||||
default 22
|
||||
range 0 33 if ESP32S3_I2S1_ROLE_MASTER
|
||||
range 0 39 if ESP32S3_I2S1_ROLE_SLAVE
|
||||
|
||||
config ESP32S3_I2S1_WSPIN
|
||||
int "I2S1 WS pin"
|
||||
default 23
|
||||
range 0 33 if ESP32S3_I2S1_ROLE_MASTER
|
||||
range 0 39 if ESP32S3_I2S1_ROLE_SLAVE
|
||||
|
||||
config ESP32S3_I2S1_DINPIN
|
||||
int "I2S1 DIN pin"
|
||||
depends on ESP32S3_I2S1_RX
|
||||
default 26
|
||||
range 0 39
|
||||
|
||||
config ESP32S3_I2S1_DOUTPIN
|
||||
int "I2S1 DOUT pin"
|
||||
depends on ESP32S3_I2S1_TX
|
||||
default 25
|
||||
range 0 33
|
||||
|
||||
config ESP32S3_I2S1_MCLK
|
||||
bool "Enable I2S Master Clock"
|
||||
depends on ESP32S3_I2S1_ROLE_MASTER
|
||||
default n
|
||||
---help---
|
||||
Enable I2S master clock
|
||||
|
||||
config ESP32S3_I2S1_MCLKPIN
|
||||
int "I2S MCLK pin"
|
||||
depends on ESP32S3_I2S1_MCLK
|
||||
default 1
|
||||
range 0 39
|
||||
|
||||
endif #ESP32S3_I2S1
|
||||
|
||||
config I2S_DMADESC_NUM
|
||||
int "I2S DMA maximum number of descriptors"
|
||||
default 2
|
||||
---help---
|
||||
Configure the maximum number of out-link/in-link descriptors to
|
||||
be chained for a I2S DMA transfer.
|
||||
|
||||
endif #ESP32S3_I2S
|
||||
|
||||
|
||||
config ESP32S3_SPI
|
||||
bool
|
||||
default n
|
||||
@@ -966,7 +1208,7 @@ choice ESP32S3_POWER_SAVE_MODE
|
||||
BB are turned off in order to reduce power consumption. Station can keep connection with AP in modem-sleep mode.
|
||||
|
||||
Modem-sleep mode includes minimum and maximum power-saving modes.
|
||||
|
||||
|
||||
In minimum power-saving mode, station wakes
|
||||
up every DTIM to receive beacon. Broadcast data will not be lost because it is transmitted after DTIM.
|
||||
However, it cannot save much more power if DTIM is short for DTIM is determined by AP.
|
||||
@@ -983,7 +1225,7 @@ choice ESP32S3_POWER_SAVE_MODE
|
||||
|
||||
config ESP32S3_POWER_SAVE_NONE
|
||||
bool "No power save"
|
||||
|
||||
|
||||
config ESP32S3_POWER_SAVE_MIN_MODEM
|
||||
bool "Minimum modem power saving."
|
||||
|
||||
|
||||
@@ -105,6 +105,10 @@ ifeq ($(CONFIG_ESP32S3_I2C),y)
|
||||
CHIP_CSRCS += esp32s3_i2c.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ESP32S3_I2S),y)
|
||||
CHIP_CSRCS += esp32s3_i2s.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ESP32S3_SPI),y)
|
||||
ifeq ($(CONFIG_ESP32S3_SPI_IO_SPI),y)
|
||||
CHIP_CSRCS += esp32s3_spi.c
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,75 @@
|
||||
/****************************************************************************
|
||||
* arch/xtensa/src/esp32s3/esp32s3_i2s.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ARCH_XTENSA_SRC_ESP32S3_ESP32S3_I2S_H
|
||||
#define __ARCH_XTENSA_SRC_ESP32S3_ESP32S3_I2S_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/audio/i2s.h>
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESP32S3_I2S
|
||||
|
||||
#define ESP32S3_I2S0 0
|
||||
#define ESP32S3_I2S1 1
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_i2sbus_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the selected I2S port
|
||||
*
|
||||
* Input Parameters:
|
||||
* Port number (for hardware that has multiple I2S interfaces)
|
||||
*
|
||||
* Returned Value:
|
||||
* Valid I2S device structure reference on success; a NULL on failure
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
struct i2s_dev_s *esp32s3_i2sbus_initialize(int port);
|
||||
|
||||
#endif /* CONFIG_ESP32S3_I2S */
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __ARCH_XTENSA_SRC_ESP32S3_ESP32S3_I2S_H */
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user