components/driver/i2s.c
/**
 * @brief I2S get DMA buffer size
 *
 * @param   i2s_num     I2S device number
 * @return
 *      - DMA buffer size
 */
@brief I2S get DMA buffer size
@param   i2s_num     I2S device number
@return
- DMA buffer size
@brief I2S get DMA buffer size @param i2s_num I2S device number @return - DMA buffer size
static inline uint32_t i2s_get_buf_size(i2s_port_t i2s_num)
{
    uint32_t bytes_per_sample = ((p_i2s[i2s_num]->hal_cfg.sample_bits + 15) / 16) * 2;
    uint32_t bytes_per_frame = bytes_per_sample * p_i2s[i2s_num]->hal_cfg.active_chan;
    p_i2s[i2s_num]->dma_buf_len = (p_i2s[i2s_num]->dma_buf_len * bytes_per_frame > I2S_DMA_BUFFER_MAX_SIZE) ?
                                  I2S_DMA_BUFFER_MAX_SIZE / bytes_per_frame : p_i2s[i2s_num]->dma_buf_len;
    return p_i2s[i2s_num]->dma_buf_len * bytes_per_frame;
}
static inline uint32_t i2s_get_buf_size ( i2s_port_t i2s_num ) { uint32_t bytes_per_sample = ( ( p_i2s [ i2s_num ] -> hal_cfg . sample_bits + 15 ) / 16 ) * 2 ; uint32_t bytes_per_frame = bytes_per_sample * p_i2s [ i2s_num ] -> hal_cfg . active_chan ; p_i2s [ i2s_num ] -> dma_buf_len = ( p_i2s [ i2s_num ] -> dma_buf_len * bytes_per_frame > I2S_DMA_BUFFER_MAX_SIZE ) ? I2S_DMA_BUFFER_MAX_SIZE / bytes_per_frame : p_i2s [ i2s_num ] -> dma_buf_len ; return p_i2s [ i2s_num ] -> dma_buf_len * bytes_per_frame ; }
@brief I2S get DMA buffer size
 @param   i2s_num     I2S device number
 @return
      - DMA buffer size
@brief I2S get DMA buffer size @param i2s_num I2S device number @return - DMA buffer size
/* Calculate bytes per sample, align to 16 bit */ /* The DMA buffer limitation is 4092 bytes */