// Copyright 2020 Espressif Systems (Shanghai) PTE LTD // // Licensed 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. #pragma once #include #include #include #include #include "soc/soc_caps.h" #ifdef __cplusplus extern "C" { #endif /** * @brief I2S bit width per sample. * */ typedef enum { I2S_BITS_PER_SAMPLE_8BIT = 8, /*!< data bit-width: 8 */ I2S_BITS_PER_SAMPLE_16BIT = 16, /*!< data bit-width: 16 */ I2S_BITS_PER_SAMPLE_24BIT = 24, /*!< data bit-width: 24 */ I2S_BITS_PER_SAMPLE_32BIT = 32, /*!< data bit-width: 32 */ } i2s_bits_per_sample_t; /** * @brief I2S bit width per chan. * */ typedef enum { I2S_BITS_PER_CHAN_DEFAULT = (0), /*!< channel bit-width equals to data bit-width */ I2S_BITS_PER_CHAN_8BIT = (8), /*!< channel bit-width: 8 */ I2S_BITS_PER_CHAN_16BIT = (16), /*!< channel bit-width: 16 */ I2S_BITS_PER_CHAN_24BIT = (24), /*!< channel bit-width: 24 */ I2S_BITS_PER_CHAN_32BIT = (32), /*!< channel bit-width: 32 */ } i2s_bits_per_chan_t; /** * @brief I2S channel. * */ typedef enum { I2S_CHANNEL_MONO = (0x01 << 31) | 0x03, /*!< I2S channel (mono), two channel enabled. In this mode, you only need to send one channel data but the fifo will copy same data for another channel automatically, then both channels will transmit same data. The highest bit is for differentiating I2S_CHANNEL_STEREO since they both use two channels */ I2S_CHANNEL_STEREO = 0x03, /*!< I2S channel (stereo), two channel enabled. In this mode, two channels will transmit different data. */ #if SOC_I2S_SUPPORTS_TDM // Bit map of active chan. // There are 16 channels in TDM mode. // For TX module, only the active channel send the audio data, the inactive channel send a constant(configurable) or will be skiped if 'skip_msk' is set. // For RX module, only receive the audio data in active channels, the data in inactive channels will be ignored. // the bit map of active channel can not exceed (0x1<