2021-09-28 00:04:34 -04:00
/*
* SPDX - FileCopyrightText : 2020 - 2021 Espressif Systems ( Shanghai ) CO LTD
*
* SPDX - License - Identifier : Apache - 2.0
*/
2019-07-15 02:44:15 -04:00
/*******************************************************************************
* NOTICE
* The hal is not public api , don ' t use in application code .
2020-09-11 03:48:08 -04:00
* See readme . md in hal / include / hal / readme . md
2019-07-15 02:44:15 -04:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
// The HAL layer for I2S.
// There is no parameter check in the hal layer, so the caller must ensure the correctness of the parameters.
# pragma once
# include "soc/i2s_periph.h"
2020-09-09 22:37:58 -04:00
# include "soc/soc_caps.h"
2019-07-15 02:44:15 -04:00
# include "hal/i2s_types.h"
2020-05-31 21:47:48 -04:00
# include "hal/i2s_ll.h"
2019-07-15 02:44:15 -04:00
# ifdef __cplusplus
extern " C " {
# endif
2021-06-15 03:43:03 -04:00
/**
2021-08-02 07:17:29 -04:00
* @ brief I2S clock configuration
2021-06-15 03:43:03 -04:00
*/
2021-08-02 07:17:29 -04:00
typedef struct {
uint32_t sclk ; /*!< I2S module clock */
uint32_t mclk ; /*!< I2S master clock */
uint32_t bclk ; /*!< I2S bit clock */
uint16_t mclk_div ; /*!< I2S master clock division */
uint16_t bclk_div ; /*!< I2S bit clock division*/
} i2s_hal_clock_cfg_t ;
2021-06-15 03:43:03 -04:00
/**
* @ brief I2S HAL configurations
*/
typedef struct {
i2s_mode_t mode ; /*!< I2S work mode, using ored mask of `i2s_mode_t`*/
uint32_t sample_rate ; /*!< I2S sample rate*/
i2s_comm_format_t comm_fmt ; /*!< I2S communication format */
i2s_channel_fmt_t chan_fmt ; /*!< I2S channel format, there are total 16 channels in TDM mode.*/
2021-08-02 07:17:29 -04:00
uint32_t sample_bits ; /*!< I2S sample bits in one channel */
uint32_t chan_bits ; /*!< I2S total bits in one channel. Should not be smaller than 'sample_bits', default '0' means equal to 'sample_bits' */
uint32_t active_chan ; /*!< I2S active channel number */
2021-06-17 06:49:44 -04:00
uint32_t total_chan ; /*!< Total number of I2S channels */
2021-08-02 07:17:29 -04:00
# if SOC_I2S_SUPPORTS_TDM
2021-06-17 06:49:44 -04:00
uint32_t chan_mask ; /*!< Active channel bit mask, set value in `i2s_channel_t` to enable specific channel, the bit map of active channel can not exceed (0x1<<total_chan_num). */
2021-08-02 07:17:29 -04:00
bool left_align ; /*!< Set to enable left aligment */
bool big_edin ; /*!< Set to enable big edin */
bool bit_order_msb ; /*!< Set to enable msb order */
bool skip_msk ; /*!< Set to enable skip mask. If it is enabled, only the data of the enabled channels will be sent, otherwise all data stored in DMA TX buffer will be sent */
2021-06-15 03:43:03 -04:00
# endif
} i2s_hal_config_t ;
2019-07-15 02:44:15 -04:00
/**
* Context that should be maintained by both the driver and the HAL
*/
typedef struct {
i2s_dev_t * dev ;
uint32_t version ;
} i2s_hal_context_t ;
2021-08-17 22:52:16 -04:00
/**
* @ brief Enable I2S module clock
*
* @ param hal Context of the HAL layer
*/
# define i2s_hal_enable_module_clock(hal) i2s_ll_enable_clock((hal)->dev);
/**
* @ brief Disable I2S module clock
*
* @ param hal Context of the HAL layer
*/
# define i2s_hal_disable_module_clock(hal) i2s_ll_disable_clock((hal)->dev);
2019-07-15 02:44:15 -04:00
/**
2020-05-31 21:47:48 -04:00
* @ brief Reset I2S TX channel
2019-07-15 02:44:15 -04:00
*
* @ param hal Context of the HAL layer
*/
2021-07-20 09:03:52 -04:00
# define i2s_hal_reset_tx(hal) i2s_ll_tx_reset((hal)->dev)
2019-07-15 02:44:15 -04:00
/**
2020-05-31 21:47:48 -04:00
* @ brief Reset I2S TX fifo
2019-07-15 02:44:15 -04:00
*
* @ param hal Context of the HAL layer
*/
2021-07-20 09:03:52 -04:00
# define i2s_hal_reset_tx_fifo(hal) i2s_ll_tx_reset_fifo((hal)->dev)
2019-07-15 02:44:15 -04:00
/**
2020-05-31 21:47:48 -04:00
* @ brief Reset I2S RX channel
2019-07-15 02:44:15 -04:00
*
* @ param hal Context of the HAL layer
*/
2021-07-20 09:03:52 -04:00
# define i2s_hal_reset_rx(hal) i2s_ll_rx_reset((hal)->dev)
2019-07-15 02:44:15 -04:00
/**
2020-05-31 21:47:48 -04:00
* @ brief Reset I2S RX fifo
2019-07-15 02:44:15 -04:00
*
* @ param hal Context of the HAL layer
*/
2021-07-20 09:03:52 -04:00
# define i2s_hal_reset_rx_fifo(hal) i2s_ll_rx_reset_fifo((hal)->dev)
2019-07-15 02:44:15 -04:00
/**
2021-08-02 07:17:29 -04:00
* @ brief Get I2S hardware instance and enable I2S module clock
* @ note This function should be called first before other hal layer function is called
2019-07-15 02:44:15 -04:00
*
* @ param hal Context of the HAL layer
2020-05-31 21:47:48 -04:00
* @ param i2s_num The uart port number , the max port number is ( I2S_NUM_MAX - 1 )
2019-07-15 02:44:15 -04:00
*/
2021-08-17 22:52:16 -04:00
void i2s_hal_init ( i2s_hal_context_t * hal , int i2s_num ) ;
2019-07-15 02:44:15 -04:00
/**
2020-05-31 21:47:48 -04:00
* @ brief Configure I2S source clock
2019-07-15 02:44:15 -04:00
*
* @ param hal Context of the HAL layer
2020-05-31 21:47:48 -04:00
* @ param sel The source clock index
2019-07-15 02:44:15 -04:00
*/
2020-05-31 21:47:48 -04:00
void i2s_hal_set_clock_src ( i2s_hal_context_t * hal , i2s_clock_src_t sel ) ;
2019-07-15 02:44:15 -04:00
2022-07-20 04:15:39 -04:00
/**
* @ brief Calculate the closest sample rate clock configuration .
* clock relationship :
* Fmclk = bck_div * fbck = fsclk / ( mclk_div + b / a )
*
* @ param clk_cfg I2S clock configuration ( input )
* @ param cal Point to ` i2s_ll_mclk_div_t ` structure ( output ) .
*/
void i2s_hal_mclk_div_decimal_cal ( i2s_hal_clock_cfg_t * clk_cfg , i2s_ll_mclk_div_t * cal ) ;
2019-07-15 02:44:15 -04:00
/**
2021-07-20 09:03:52 -04:00
* @ brief Set Tx channel style
2019-07-15 02:44:15 -04:00
*
* @ param hal Context of the HAL layer
2021-06-15 03:43:03 -04:00
* @ param hal_cfg I2S hal configuration structer , refer to ` i2s_hal_config_t `
2019-07-15 02:44:15 -04:00
*/
2021-07-20 09:03:52 -04:00
void i2s_hal_tx_set_channel_style ( i2s_hal_context_t * hal , const i2s_hal_config_t * hal_cfg ) ;
/**
* @ brief Set Rx channel style
*
* @ param hal Context of the HAL layer
* @ param hal_cfg I2S hal configuration structer , refer to ` i2s_hal_config_t `
*/
void i2s_hal_rx_set_channel_style ( i2s_hal_context_t * hal , const i2s_hal_config_t * hal_cfg ) ;
2019-07-15 02:44:15 -04:00
/**
2021-08-02 07:17:29 -04:00
* @ brief Initialize I2S hardware
2019-07-15 02:44:15 -04:00
*
* @ param hal Context of the HAL layer
2021-06-15 03:43:03 -04:00
* @ param hal_cfg I2S hal configuration structer , refer to ` i2s_hal_config_t `
2019-07-15 02:44:15 -04:00
*/
2021-08-17 22:52:16 -04:00
void i2s_hal_config_param ( i2s_hal_context_t * hal , const i2s_hal_config_t * hal_cfg ) ;
2020-05-31 21:47:48 -04:00
/**
* @ brief Enable I2S master full - duplex mode
*
* @ param hal Context of the HAL layer
*/
void i2s_hal_enable_master_fd_mode ( i2s_hal_context_t * hal ) ;
2019-07-15 02:44:15 -04:00
/**
2020-05-31 21:47:48 -04:00
* @ brief Enable I2S slave full - duplex mode
2019-07-15 02:44:15 -04:00
*
* @ param hal Context of the HAL layer
*/
2020-05-31 21:47:48 -04:00
void i2s_hal_enable_slave_fd_mode ( i2s_hal_context_t * hal ) ;
2019-07-15 02:44:15 -04:00
/**
2020-05-31 21:47:48 -04:00
* @ brief Start I2S tx
2019-07-15 02:44:15 -04:00
*
* @ param hal Context of the HAL layer
*/
2021-09-28 00:04:34 -04:00
void i2s_hal_start_tx ( i2s_hal_context_t * hal ) ;
2019-07-15 02:44:15 -04:00
/**
2020-05-31 21:47:48 -04:00
* @ brief Start I2S rx
2019-07-15 02:44:15 -04:00
*
* @ param hal Context of the HAL layer
*/
2021-09-28 00:04:34 -04:00
void i2s_hal_start_rx ( i2s_hal_context_t * hal ) ;
2019-07-15 02:44:15 -04:00
/**
2020-05-31 21:47:48 -04:00
* @ brief Stop I2S tx
2019-07-15 02:44:15 -04:00
*
* @ param hal Context of the HAL layer
*/
2021-09-28 00:04:34 -04:00
void i2s_hal_stop_tx ( i2s_hal_context_t * hal ) ;
2019-07-15 02:44:15 -04:00
/**
2020-05-31 21:47:48 -04:00
* @ brief Stop I2S rx
2019-07-15 02:44:15 -04:00
*
* @ param hal Context of the HAL layer
*/
2021-09-28 00:04:34 -04:00
void i2s_hal_stop_rx ( i2s_hal_context_t * hal ) ;
2019-07-15 02:44:15 -04:00
/**
2020-05-31 21:47:48 -04:00
* @ brief Set the received data length to trigger ` in_suc_eof ` interrupt .
2019-07-15 02:44:15 -04:00
*
* @ param hal Context of the HAL layer
2020-05-31 21:47:48 -04:00
* @ param eof_byte The byte length that trigger in_suc_eof interrupt .
2019-07-15 02:44:15 -04:00
*/
2021-07-20 09:03:52 -04:00
# define i2s_hal_set_rx_eof_num(hal, eof_byte) i2s_ll_rx_set_eof_num((hal)->dev, eof_byte)
2019-07-15 02:44:15 -04:00
/**
2020-05-31 21:47:48 -04:00
* @ brief Set I2S TX sample bit
2019-07-15 02:44:15 -04:00
*
* @ param hal Context of the HAL layer
2021-06-17 06:49:44 -04:00
* @ param chan_bit I2S TX chan bit
2021-06-15 03:43:03 -04:00
* @ param data_bit The sample data bit length .
2019-07-15 02:44:15 -04:00
*/
2021-07-20 09:03:52 -04:00
# define i2s_hal_set_tx_sample_bit(hal, chan_bit, data_bit) i2s_ll_tx_set_sample_bit((hal)->dev, chan_bit, data_bit)
2019-07-15 02:44:15 -04:00
/**
2020-05-31 21:47:48 -04:00
* @ brief Set I2S RX sample bit
2019-07-15 02:44:15 -04:00
*
* @ param hal Context of the HAL layer
2021-06-17 06:49:44 -04:00
* @ param chan_bit I2S RX chan bit
2021-06-15 03:43:03 -04:00
* @ param data_bit The sample data bit length .
2019-07-15 02:44:15 -04:00
*/
2021-07-20 09:03:52 -04:00
# define i2s_hal_set_rx_sample_bit(hal, chan_bit, data_bit) i2s_ll_rx_set_sample_bit((hal)->dev, chan_bit, data_bit)
2019-07-15 02:44:15 -04:00
/**
2020-05-31 21:47:48 -04:00
* @ brief Configure I2S TX module clock devider
2019-07-15 02:44:15 -04:00
*
* @ param hal Context of the HAL layer
2021-08-02 07:17:29 -04:00
* @ param clk_cfg I2S clock configuration
2019-07-15 02:44:15 -04:00
*/
2021-08-02 07:17:29 -04:00
void i2s_hal_tx_clock_config ( i2s_hal_context_t * hal , i2s_hal_clock_cfg_t * clk_cfg ) ;
2019-07-15 02:44:15 -04:00
/**
2020-05-31 21:47:48 -04:00
* @ brief Configure I2S RX module clock devider
2019-07-15 02:44:15 -04:00
*
* @ param hal Context of the HAL layer
2021-08-02 07:17:29 -04:00
* @ param clk_cfg I2S clock configuration
2019-07-15 02:44:15 -04:00
*/
2021-08-02 07:17:29 -04:00
void i2s_hal_rx_clock_config ( i2s_hal_context_t * hal , i2s_hal_clock_cfg_t * clk_cfg ) ;
2019-07-15 02:44:15 -04:00
/**
2021-08-02 07:17:29 -04:00
* @ brief Set I2S tx clock source
2019-07-15 02:44:15 -04:00
*
* @ param hal Context of the HAL layer
2021-08-02 07:17:29 -04:00
* @ param clk_src i2s tx clock source ( see ' i2s_clock_src_t ' )
2019-07-15 02:44:15 -04:00
*/
2021-08-02 07:17:29 -04:00
# define i2s_hal_tx_set_clock_source(hal, clk_src) i2s_ll_tx_clk_set_src((hal)->dev, clk_src)
2019-07-15 02:44:15 -04:00
/**
2021-08-02 07:17:29 -04:00
* @ brief Set I2S rx clock source
2019-07-15 02:44:15 -04:00
*
* @ param hal Context of the HAL layer
2021-08-02 07:17:29 -04:00
* @ param clk_src i2s rx clock source ( see ' i2s_clock_src_t ' )
2019-07-15 02:44:15 -04:00
*/
2021-08-02 07:17:29 -04:00
# define i2s_hal_rx_set_clock_source(hal, clk_src) i2s_ll_rx_clk_set_src((hal)->dev, clk_src)
/**
* @ brief Enable I2S tx slave mode
*
* @ param hal Context of the HAL layer
* @ param enable set ' true ' to enable tx slave mode
*/
# define i2s_hal_tx_enable_slave_mode(hal, enable) i2s_ll_tx_set_slave_mod((hal)->dev, enable)
/**
* @ brief Enable I2S rx slave mode
*
* @ param hal Context of the HAL layer
* @ param enable set ' true ' to enable rx slave mode
*/
# define i2s_hal_rx_enable_slave_mode(hal, enable) i2s_ll_rx_set_slave_mod((hal)->dev, enable)
2019-07-15 02:44:15 -04:00
/**
2020-05-31 21:47:48 -04:00
* @ brief Enable loopback mode
2019-07-15 02:44:15 -04:00
*
* @ param hal Context of the HAL layer
*/
2021-08-17 22:52:16 -04:00
# define i2s_hal_enable_sig_loopback(hal) i2s_ll_share_bck_ws((hal)->dev, true)
2019-07-15 02:44:15 -04:00
2021-07-27 03:54:31 -04:00
/**
* @ brief Set I2S configuration for common TX mode
* @ note Common mode is for non - PDM mode like philip / MSB / PCM
*
* @ param hal Context of the HAL layer
* @ param hal_cfg hal configuration structure
*/
void i2s_hal_tx_set_common_mode ( i2s_hal_context_t * hal , const i2s_hal_config_t * hal_cfg ) ;
/**
* @ brief Set I2S configuration for common RX mode
* @ note Common mode is for non - PDM mode like philip / MSB / PCM
*
* @ param hal Context of the HAL layer
* @ param hal_cfg hal configuration structure
*/
void i2s_hal_rx_set_common_mode ( i2s_hal_context_t * hal , const i2s_hal_config_t * hal_cfg ) ;
2021-08-02 07:17:29 -04:00
# if SOC_I2S_SUPPORTS_PCM
/**
* @ brief Configure I2S TX PCM encoder or decoder .
*
* @ param hal Context of the HAL layer
* @ param cfg PCM configure paramater , refer to ` i2s_pcm_compress_t `
*/
# define i2s_hal_tx_pcm_cfg(hal, cfg) i2s_ll_tx_set_pcm_type((hal)->dev, cfg)
/**
* @ brief Configure I2S RX PCM encoder or decoder .
*
* @ param hal Context of the HAL layer
* @ param cfg PCM configure paramater , refer to ` i2s_pcm_compress_t `
*/
# define i2s_hal_rx_pcm_cfg(hal, cfg) i2s_ll_rx_set_pcm_type((hal)->dev, cfg)
# endif
2020-05-31 21:47:48 -04:00
# if SOC_I2S_SUPPORTS_PDM_TX
2019-07-15 02:44:15 -04:00
/**
2020-05-31 21:47:48 -04:00
* @ brief Configure I2S TX PDM sample rate
* Fpdm = 64 * Fpcm * fp / fs
2019-07-15 02:44:15 -04:00
*
* @ param hal Context of the HAL layer
2020-05-31 21:47:48 -04:00
* @ param fp TX PDM fp paramater configuration
* @ param fs TX PDM fs paramater configuration
2019-07-15 02:44:15 -04:00
*/
2021-07-20 09:03:52 -04:00
# define i2s_hal_set_tx_pdm_fpfs(hal, fp, fs) i2s_ll_tx_set_pdm_fpfs((hal)->dev, fp, fs)
/**
* @ brief Get I2S TX PDM fp
*
* @ param hal Context of the HAL layer
* @ return
* - fp configuration paramater
*/
# define i2s_hal_get_tx_pdm_fp(hal) i2s_ll_tx_get_pdm_fp((hal)->dev)
2019-07-15 02:44:15 -04:00
/**
2021-07-20 09:03:52 -04:00
* @ brief Get I2S TX PDM fs
2019-07-15 02:44:15 -04:00
*
* @ param hal Context of the HAL layer
2021-07-20 09:03:52 -04:00
* @ return
* - fs configuration paramater
2019-07-15 02:44:15 -04:00
*/
2021-07-20 09:03:52 -04:00
# define i2s_hal_get_tx_pdm_fs(hal) i2s_ll_tx_get_pdm_fs((hal)->dev)
2021-07-27 03:54:31 -04:00
/**
* @ brief Set I2S default configuration for PDM TX mode
*
* @ param hal Context of the HAL layer
* @ param sample_rate PDM sample rate
2022-08-09 06:27:50 -04:00
* @ param is_mono whether is mono
2021-07-27 03:54:31 -04:00
*/
2022-08-09 06:27:50 -04:00
void i2s_hal_tx_set_pdm_mode_default ( i2s_hal_context_t * hal , uint32_t sample_rate , bool is_mono ) ;
2020-05-31 21:47:48 -04:00
# endif
# if SOC_I2S_SUPPORTS_PDM_RX
2019-07-15 02:44:15 -04:00
/**
2020-05-31 21:47:48 -04:00
* @ brief Configure RX PDM downsample
2019-07-15 02:44:15 -04:00
*
* @ param hal Context of the HAL layer
2020-05-31 21:47:48 -04:00
* @ param dsr PDM downsample configuration paramater
2019-07-15 02:44:15 -04:00
*/
2021-07-20 09:03:52 -04:00
# define i2s_hal_set_rx_pdm_dsr(hal, dsr) i2s_ll_rx_set_pdm_dsr((hal)->dev, dsr)
2019-07-15 02:44:15 -04:00
/**
2020-05-31 21:47:48 -04:00
* @ brief Get RX PDM downsample configuration
2019-07-15 02:44:15 -04:00
*
* @ param hal Context of the HAL layer
2020-05-31 21:47:48 -04:00
* @ param dsr Pointer to accept PDM downsample configuration
2019-07-15 02:44:15 -04:00
*/
2021-07-20 09:03:52 -04:00
# define i2s_hal_get_rx_pdm_dsr(hal, dsr) i2s_ll_rx_get_pdm_dsr((hal)->dev, dsr)
2021-07-27 03:54:31 -04:00
/**
* @ brief Set I2S default configuration for PDM R mode
*
* @ param hal Context of the HAL layer
*/
void i2s_hal_rx_set_pdm_mode_default ( i2s_hal_context_t * hal ) ;
2020-05-31 21:47:48 -04:00
# endif
2019-07-15 02:44:15 -04:00
2020-05-31 21:47:48 -04:00
# if !SOC_GDMA_SUPPORTED
2019-07-15 02:44:15 -04:00
/**
2020-05-31 21:47:48 -04:00
* @ brief Enable I2S TX DMA
2019-07-15 02:44:15 -04:00
*
* @ param hal Context of the HAL layer
*/
2021-07-20 09:03:52 -04:00
# define i2s_hal_enable_tx_dma(hal) i2s_ll_enable_dma((hal)->dev,true)
2019-07-15 02:44:15 -04:00
/**
2020-05-31 21:47:48 -04:00
* @ brief Enable I2S RX DMA
2019-07-15 02:44:15 -04:00
*
* @ param hal Context of the HAL layer
*/
2021-07-20 09:03:52 -04:00
# define i2s_hal_enable_rx_dma(hal) i2s_ll_enable_dma((hal)->dev,true)
/**
* @ brief Disable I2S TX DMA
*
* @ param hal Context of the HAL layer
*/
# define i2s_hal_disable_tx_dma(hal) i2s_ll_enable_dma((hal)->dev,false)
/**
* @ brief Disable I2S RX DMA
*
* @ param hal Context of the HAL layer
*/
# define i2s_hal_disable_rx_dma(hal) i2s_ll_enable_dma((hal)->dev,false)
2019-07-15 02:44:15 -04:00
/**
2020-05-31 21:47:48 -04:00
* @ brief Get I2S interrupt status
2019-07-15 02:44:15 -04:00
*
* @ param hal Context of the HAL layer
2021-07-20 09:03:52 -04:00
* @ return
* - module interrupt status
2019-07-15 02:44:15 -04:00
*/
2021-07-20 09:03:52 -04:00
# define i2s_hal_get_intr_status(hal) i2s_ll_get_intr_status((hal)->dev)
2020-05-31 21:47:48 -04:00
/**
* @ brief Get I2S interrupt status
*
* @ param hal Context of the HAL layer
* @ param mask Interrupt mask to be cleared .
*/
# define i2s_hal_clear_intr_status(hal, mask) i2s_ll_clear_intr_status((hal)->dev, mask)
/**
* @ brief Enable I2S RX interrupt
*
* @ param hal Context of the HAL layer
*/
2021-07-20 09:03:52 -04:00
# define i2s_hal_enable_rx_intr(hal) i2s_ll_rx_enable_intr((hal)->dev)
2020-05-31 21:47:48 -04:00
/**
* @ brief Disable I2S RX interrupt
*
* @ param hal Context of the HAL layer
*/
2021-07-20 09:03:52 -04:00
# define i2s_hal_disable_rx_intr(hal) i2s_ll_rx_disable_intr((hal)->dev)
2020-05-31 21:47:48 -04:00
/**
* @ brief Disable I2S TX interrupt
*
* @ param hal Context of the HAL layer
*/
2021-07-20 09:03:52 -04:00
# define i2s_hal_disable_tx_intr(hal) i2s_ll_tx_disable_intr((hal)->dev)
2020-05-31 21:47:48 -04:00
/**
* @ brief Enable I2S TX interrupt
*
* @ param hal Context of the HAL layer
*/
2021-07-20 09:03:52 -04:00
# define i2s_hal_enable_tx_intr(hal) i2s_ll_tx_enable_intr((hal)->dev)
2020-05-31 21:47:48 -04:00
/**
* @ brief Configure TX DMA descriptor address and start TX DMA
*
* @ param hal Context of the HAL layer
* @ param link_addr DMA descriptor link address .
*/
2021-07-20 09:03:52 -04:00
# define i2s_hal_start_tx_link(hal, link_addr) i2s_ll_tx_start_link((hal)->dev, link_addr)
2020-05-31 21:47:48 -04:00
/**
* @ brief Configure RX DMA descriptor address and start RX DMA
*
* @ param hal Context of the HAL layer
* @ param link_addr DMA descriptor link address .
*/
2021-07-20 09:03:52 -04:00
# define i2s_hal_start_rx_link(hal, link_addr) i2s_ll_rx_start_link((hal)->dev, link_addr)
2019-07-15 02:44:15 -04:00
2020-06-04 09:22:49 -04:00
/**
2020-05-31 21:47:48 -04:00
* @ brief Stop TX DMA link
2020-06-04 09:22:49 -04:00
*
* @ param hal Context of the HAL layer
*/
2021-07-20 09:03:52 -04:00
# define i2s_hal_stop_tx_link(hal) i2s_ll_tx_stop_link((hal)->dev)
2020-06-04 09:22:49 -04:00
/**
2020-05-31 21:47:48 -04:00
* @ brief Stop RX DMA link
2020-06-04 09:22:49 -04:00
*
* @ param hal Context of the HAL layer
*/
2021-07-20 09:03:52 -04:00
# define i2s_hal_stop_rx_link(hal) i2s_ll_rx_stop_link((hal)->dev)
2020-06-04 09:22:49 -04:00
/**
2020-05-31 21:47:48 -04:00
* @ brief Reset RX DMA
2020-06-04 09:22:49 -04:00
*
* @ param hal Context of the HAL layer
*/
2021-07-20 09:03:52 -04:00
# define i2s_hal_reset_rxdma(hal) i2s_ll_rx_reset_dma((hal)->dev)
2020-06-04 09:22:49 -04:00
/**
2020-05-31 21:47:48 -04:00
* @ brief Reset TX DMA
2020-06-04 09:22:49 -04:00
*
* @ param hal Context of the HAL layer
*/
2021-07-20 09:03:52 -04:00
# define i2s_hal_reset_txdma(hal) i2s_ll_tx_reset_dma((hal)->dev)
2020-05-31 21:47:48 -04:00
/**
* @ brief Get I2S out eof descriptor address
*
* @ param hal Context of the HAL layer
* @ param addr Pointer to accept out eof des address
*/
2021-07-20 09:03:52 -04:00
# define i2s_hal_get_out_eof_des_addr(hal, addr) i2s_ll_tx_get_eof_des_addr((hal)->dev, addr)
2020-05-31 21:47:48 -04:00
/**
* @ brief Get I2S in suc eof descriptor address
*
* @ param hal Context of the HAL layer
* @ param addr Pointer to accept in suc eof des address
*/
2021-07-20 09:03:52 -04:00
# define i2s_hal_get_in_eof_des_addr(hal, addr) i2s_ll_rx_get_eof_des_addr((hal)->dev, addr)
2020-06-04 09:22:49 -04:00
# endif
2021-08-17 22:52:16 -04:00
# if SOC_I2S_SUPPORTS_ADC
2021-07-27 03:54:31 -04:00
/**
* @ brief Enable Builtin DAC
*
* @ param hal Context of the HAL layer
*/
# define i2s_hal_enable_builtin_dac(hal) i2s_ll_enable_builtin_dac((hal)->dev, true);
/**
* @ brief Enable Builtin ADC
*
* @ param hal Context of the HAL layer
*/
# define i2s_hal_enable_builtin_adc(hal) i2s_ll_enable_builtin_adc((hal)->dev, true);
/**
2021-08-17 22:52:16 -04:00
* @ brief Disable Builtin ADC
2021-07-27 03:54:31 -04:00
*
* @ param hal Context of the HAL layer
*/
2021-08-17 22:52:16 -04:00
# define i2s_hal_disable_builtin_adc(hal) i2s_ll_enable_builtin_adc((hal)->dev, false);
# endif
2021-07-27 03:54:31 -04:00
2021-08-17 22:52:16 -04:00
# if SOC_I2S_SUPPORTS_DAC
2021-07-27 03:54:31 -04:00
/**
2021-08-17 22:52:16 -04:00
* @ brief Disable Builtin DAC
2021-07-27 03:54:31 -04:00
*
* @ param hal Context of the HAL layer
*/
2021-08-17 22:52:16 -04:00
# define i2s_hal_disable_builtin_dac(hal) i2s_ll_enable_builtin_dac((hal)->dev, false);
2021-07-27 03:54:31 -04:00
# endif
2019-07-15 02:44:15 -04:00
# ifdef __cplusplus
}
2019-11-21 08:10:46 -05:00
# endif