HPM SDK
HPMicro Software Development Kit
hpm_i2s_drv.h File Reference
#include "hpm_common.h"
#include "hpm_soc_feature.h"
#include "hpm_i2s_regs.h"
#include "hpm_i2s_common.h"

Go to the source code of this file.

Data Structures

struct  i2s_config
 I2S config. More...
 
struct  i2s_transfer_config
 I2S transfer config. More...
 
struct  i2s_multiline_transfer_config
 I2S multiline transfer config. More...
 

Typedefs

typedef struct i2s_config i2s_config_t
 I2S config. More...
 
typedef struct i2s_transfer_config i2s_transfer_config_t
 I2S transfer config. More...
 
typedef struct i2s_multiline_transfer_config i2s_multiline_transfer_config_t
 I2S multiline transfer config. More...
 

Enumerations

enum  i2s_line_num_t {
  I2S_DATA_LINE_0 = 0 , I2S_DATA_LINE_1 , I2S_DATA_LINE_2 , I2S_DATA_LINE_3 ,
  I2S_DATA_LINE_MAX = I2S_DATA_LINE_3
}
 
enum  i2s_irq_mask_t { i2s_tx_fifo_threshold_irq_mask = I2S_CTRL_TXDNIE_MASK , i2s_rx_fifo_threshold_irq_mask = I2S_CTRL_RXDAIE_MASK , i2s_fifo_error_irq_mask = I2S_CTRL_ERRIE_MASK }
 
enum  i2s_data_line_stat_t { i2s_data_line_rx_fifo_avail = 1U , i2s_data_line_tx_fifo_avail = 2U , i2s_data_line_rx_fifo_overrun = 4U , i2s_data_line_tx_fifo_underrun = 8U }
 

Functions

static void i2s_enable_tdm (I2S_Type *ptr)
 enable TDM More...
 
static void i2s_disable_tdm (I2S_Type *ptr)
 disable TDM More...
 
static void i2s_update_rx_fifo_threshold (I2S_Type *ptr, uint8_t threshold)
 update rx fifo threshold More...
 
static void i2s_update_tx_fifo_threshold (I2S_Type *ptr, uint8_t threshold)
 update tx fifo threshold More...
 
static void i2s_ungate_bclk (I2S_Type *ptr)
 open BCLK More...
 
static void i2s_gate_bclk (I2S_Type *ptr)
 gete off BCLK More...
 
static void i2s_ungate_mclk (I2S_Type *ptr)
 open MCLK More...
 
static void i2s_gate_mclk (I2S_Type *ptr)
 gate off MCLK More...
 
static void i2s_enable_tx_dma_request (I2S_Type *ptr)
 enable TX dma request More...
 
static void i2s_disable_tx_dma_request (I2S_Type *ptr)
 disable TX dma request More...
 
static void i2s_enable_rx_dma_request (I2S_Type *ptr)
 enable RX dma request More...
 
static void i2s_disable_rx_dma_request (I2S_Type *ptr)
 disable RX dma request More...
 
static void i2s_enable_irq (I2S_Type *ptr, uint32_t mask)
 enable IRQ More...
 
static void i2s_disable_irq (I2S_Type *ptr, uint32_t mask)
 disable IRQ More...
 
static void i2s_enable (I2S_Type *ptr)
 I2S enable. More...
 
static void i2s_disable (I2S_Type *ptr)
 I2S disable. More...
 
static void i2s_start (I2S_Type *ptr)
 I2S start. More...
 
static void i2s_stop (I2S_Type *ptr)
 I2S stop. More...
 
static void i2s_enable_rx (I2S_Type *ptr, uint8_t rx_mask)
 I2S enable rx function. More...
 
static void i2s_disable_rx (I2S_Type *ptr, uint8_t rx_mask)
 I2S disable rx function. More...
 
static void i2s_enable_rx_line (I2S_Type *ptr, i2s_line_num_t line)
 I2S enable rx line function. More...
 
static void i2s_disable_rx_line (I2S_Type *ptr, i2s_line_num_t line)
 I2S disable rx line function. More...
 
static void i2s_enable_tx (I2S_Type *ptr, uint8_t tx_mask)
 I2S enable tx function. More...
 
static void i2s_disable_tx (I2S_Type *ptr, uint8_t tx_mask)
 I2S disbale tx function. More...
 
static void i2s_enable_tx_line (I2S_Type *ptr, i2s_line_num_t line)
 I2S enable tx function. More...
 
static void i2s_disable_tx_line (I2S_Type *ptr, i2s_line_num_t line)
 I2S disbale tx function. More...
 
static void i2s_set_txd_slot (I2S_Type *ptr, i2s_line_num_t line, uint32_t slot_mask)
 I2S set tx slot mask. More...
 
static void i2s_set_rxd_slot (I2S_Type *ptr, i2s_line_num_t line, uint32_t slot_mask)
 I2S set rx slot mask. More...
 
static void i2s_reset_clock_gen (I2S_Type *ptr)
 I2S reset clock generator. More...
 
static void i2s_reset_tx (I2S_Type *ptr)
 I2S reset tx function. More...
 
static void i2s_reset_rx (I2S_Type *ptr)
 I2S reset rx function. More...
 
static void i2s_reset_tx_rx (I2S_Type *ptr)
 I2S reset tx and rx function. More...
 
void i2s_reset_all (I2S_Type *ptr)
 I2S reset tx/rx and clock generator module. More...
 
static uint32_t i2s_get_tx_fifo_level (I2S_Type *ptr)
 I2S get tx fifo level. More...
 
static uint32_t i2s_get_tx_line_fifo_level (I2S_Type *ptr, i2s_line_num_t line)
 I2S get data line tx fifo level. More...
 
static uint32_t i2s_get_rx_fifo_level (I2S_Type *ptr)
 I2S get rx fifo level. More...
 
static uint32_t i2s_get_rx_line_fifo_level (I2S_Type *ptr, i2s_line_num_t line)
 I2S get data line rx fifo level. More...
 
static uint32_t i2s_check_data_line_status (I2S_Type *ptr, i2s_line_num_t line)
 Check I2S data line status. More...
 
static uint32_t i2s_get_irq_status (I2S_Type *ptr)
 I2S get IRQ status. More...
 
static void i2s_clear_irq_status (I2S_Type *ptr, uint32_t mask)
 I2S get IRQ status. More...
 
static void i2s_stop_transfer (I2S_Type *ptr)
 I2S stop transfer. More...
 
hpm_stat_t i2s_config_tx (I2S_Type *ptr, uint32_t mclk_in_hz, i2s_transfer_config_t *config)
 I2S config tx. More...
 
hpm_stat_t i2s_config_tx_slave (I2S_Type *ptr, i2s_transfer_config_t *config)
 I2S config tx for slave. More...
 
hpm_stat_t i2s_config_rx (I2S_Type *ptr, uint32_t mclk_in_hz, i2s_transfer_config_t *config)
 I2S config rx. More...
 
hpm_stat_t i2s_config_rx_slave (I2S_Type *ptr, i2s_transfer_config_t *config)
 I2S config rx for slave. More...
 
hpm_stat_t i2s_config_transfer (I2S_Type *ptr, uint32_t mclk_in_hz, i2s_transfer_config_t *config)
 I2S config transfer. More...
 
hpm_stat_t i2s_config_transfer_slave (I2S_Type *ptr, i2s_transfer_config_t *config)
 I2S config transfer for slave. More...
 
hpm_stat_t i2s_config_multiline_transfer (I2S_Type *ptr, uint32_t mclk_in_hz, i2s_multiline_transfer_config_t *config)
 I2S config multiline transfer. More...
 
static void i2s_send_data (I2S_Type *ptr, i2s_line_num_t tx_line_index, uint32_t data)
 I2S send data. More...
 
static void i2s_receive_data (I2S_Type *ptr, i2s_line_num_t rx_line_index, uint32_t *data)
 I2S receive data. More...
 
uint32_t i2s_send_buff (I2S_Type *ptr, i2s_line_num_t tx_line_index, uint8_t samplebits, uint8_t *src, uint32_t size)
 I2S send data in buff. More...
 
uint32_t i2s_receive_buff (I2S_Type *ptr, i2s_line_num_t rx_line_index, uint8_t samplebits, uint8_t *dst, uint32_t size)
 I2S receive data in buff. More...
 
void i2s_get_default_config (I2S_Type *ptr, i2s_config_t *config)
 I2S get default config. More...
 
void i2s_init (I2S_Type *ptr, i2s_config_t *config)
 I2S initialization. More...
 
void i2s_get_default_transfer_config_for_pdm (i2s_transfer_config_t *transfer)
 I2S get default transfer config for pdm. More...
 
void i2s_get_default_transfer_config_for_dao (i2s_transfer_config_t *transfer)
 I2S get default transfer config for dao. More...
 
void i2s_get_default_transfer_config (i2s_transfer_config_t *transfer)
 I2S get default transfer config. More...
 
void i2s_get_default_multiline_transfer_config (i2s_multiline_transfer_config_t *transfer)
 I2S get default multiline transfer config. More...
 
hpm_stat_t i2s_fill_tx_dummy_data (I2S_Type *ptr, i2s_line_num_t data_line, uint8_t data_count)
 I2S fill dummy data into TX fifo. More...