bf0_hal_audcodec.h
Header file of AUDCODEC HAL module.
- Author
- Sifli software development team 
- Attention
Defines
- 
HAL_AUDCODEC_ERROR_NONE
- No error 
- 
HAL_AUDCODEC_ERROR_TIMEOUT
- Timeout error 
- 
HAL_AUDCODEC_ERROR_OVR
- OVR error 
- 
HAL_AUDCODEC_ERROR_UDR
- UDR error 
- 
HAL_AUDCODEC_ERROR_DMA
- DMA transfer error 
- 
HAL_AUDCODEC_ERROR_UNKNOW
- Unknow Error error 
- 
AUDCODEC_TX_OUT1_FIFO_UNDERF
- AUDCODEC STATUS TX OUT1 FIFO UNDER FLOW 
- 
AUDCODEC_TX_OUT0_FIFO_UNDERF
- AUDCODEC STATUS TX OUT0 FIFO UNDER FLOW 
- 
AUDCODEC_RX_IN_FIFO_OVERF
- AUDCODEC STATUS Rx IN FIFO OVER FLOW 
- 
AUDCODEC_TX_OUT_FIFO_UNDERF
- AUDCODEC STATUS TX OUT FIFO UNDER FLOW 
- 
AUDCODEC_RX1_FIFO_UNDERF
- AUDCODEC STATUS Rx0 FIF1 UNDER FLOW 
- 
AUDCODEC_RX0_FIFO_UNDERF
- AUDCODEC STATUS Rx0 FIFO UNDER FLOW 
- 
AUDCODEC_TX3_FIFO_OVERF
- AUDCODEC STATUS Tx3 FIFO OVER FLOW 
- 
AUDCODEC_TX2_FIFO_OVERF
- AUDCODEC STATUS Tx2 FIFO OVER FLOW 
- 
AUDCODEC_TX1_FIFO_OVERF
- AUDCODEC STATUS Tx1 FIFO OVER FLOW 
- 
AUDCODEC_TX0_FIFO_OVERF
- AUDCODEC STATUS Tx0 FIFO OVER FLOW 
- 
__HAL_AUDCODEC_HP_ENABLE(__HANDLE__)
- Enable audio codec . - 参数:
- __HANDLE__ – specifies the AUDCODEC Handle. 
 
- 返回值:
- None – 
 
- 
__HAL_AUDCODEC_HP_DISABLE(__HANDLE__)
- Disable the AUDCODEC . - 参数:
- __HANDLE__ – specifies the AUDCODEC Handle. 
 
- 返回值:
- None – 
 
- 
__HAL_AUDCODEC_HP_DAC_CH0_DISABLE(__HANDLE__)
- Disable the AUDCODEC DAC CHannel0. - 参数:
- __HANDLE__ – specifies the AUDCODEC Handle. 
 
- 返回值:
- None – 
 
- 
__HAL_AUDCODEC_HP_DAC_CH1_DISABLE(__HANDLE__)
- Disable the AUDCODEC DAC CHannel1. - 参数:
- __HANDLE__ – specifies the AUDCODEC Handle. 
 
- 返回值:
- None – 
 
- 
__HAL_AUDCODEC_LP_ENABLE(__HANDLE__)
- Enable audio prc . - 参数:
- __HANDLE__ – specifies the AUDCODEC Handle. 
 
- 返回值:
- None – 
 
- 
__HAL_AUDCODEC_LP_DISABLE(__HANDLE__)
- Disable the AUDCODEC . - 参数:
- __HANDLE__ – specifies the AUDCODEC Handle. 
 
- 返回值:
- None – 
 
- 
__HAL_AUDCODEC_HP_ADC_CH0_DISABLE(__HANDLE__)
- Disable the AUDCODEC ADC CHannel0. - 参数:
- __HANDLE__ – specifies the AUDCODEC Handle. 
 
- 返回值:
- None – 
 
- 
__HAL_AUDCODEC_HP_ADC_CH1_DISABLE(__HANDLE__)
- Disable the AUDCODEC ADC CHannel1. - 参数:
- __HANDLE__ – specifies the AUDCODEC Handle. 
 
- 返回值:
- None – 
 
Enums
- 
enum HAL_AUDCODEC_StateTypeDef
- HAL State structures definition. - Values: - 
enumerator HAL_AUDCODEC_STATE_RESET
- AUDCODEC not yet initialized or disabled 
 - 
enumerator HAL_AUDCODEC_STATE_READY
- AUDCODEC initialized and ready for use 
 - 
enumerator HAL_AUDCODEC_STATE_BUSY
- AUDCODEC internal process is ongoing 
 - 
enumerator HAL_AUDCODEC_STATE_BUSY_TX
- Data Transmission process is ongoing 
 - 
enumerator HAL_AUDCODEC_STATE_BUSY_RX
- Data Reception process is ongoing 
 - 
enumerator HAL_AUDCODEC_STATE_PAUSE
- AUDCODEC pause state: used in case of DMA 
 - 
enumerator HAL_AUDCODEC_STATE_ERROR
- AUDCODEC error state 
 
- 
enumerator HAL_AUDCODEC_STATE_RESET
- 
enum HAL_AUDCODEC_ChannelTypeDef
- AUDCODEC TX/RX BUFFER/DMA ENUM definition. - Values: - 
enumerator HAL_AUDCODEC_DAC_CH0
- AUDCODEC DAC channel 0 
 - 
enumerator HAL_AUDCODEC_DAC_CH1
- AUDCODEC DAC channel 1 
 - 
enumerator HAL_AUDCODEC_ADC_CH0
- AUDCODEC ADC channel 0 
 - 
enumerator HAL_AUDCODEC_ADC_CH1
- AUDCODEC ADC channel 1 
 - 
enumerator HAL_AUDCODEC_INSTANC_CNT
- Total dma/buffer counter 
 
- 
enumerator HAL_AUDCODEC_DAC_CH0
Functions
- 
HAL_StatusTypeDef HAL_AUDCODEC_Config_Analog_DACPath(AUDCODE_DAC_CLK_CONFIG_TYPE *cfg)
- 
void HAL_TURN_OFF_PLL()
- 
void HAL_AUDCODEC_Close_Analog_DACPath(void)
- 
void HAL_AUCODEC_Refgen_Init(void)
- 
void HAL_AUDCODEC_Config_Analog_ADCPath(AUDCODE_ADC_CLK_CONFIG_TYPE *cfg)
- 
void HAL_AUDCODEC_Close_Analog_ADCPath(void)
- 
HAL_StatusTypeDef HAL_AUDCODEC_Init(AUDCODEC_HandleTypeDef *hacodec)
- Initializes the AUDCODEC according to the specified parameters in the AUDCODEC_InitTypeDef and create the associated handle. - 参数:
- hacodec – pointer to a AUDCODEC_HandleTypeDef structure that contains the configuration information for AUDCODEC module 
 
- 返回值:
- HAL – status 
 
- 
HAL_StatusTypeDef HAL_AUDCODEC_DeInit(AUDCODEC_HandleTypeDef *hacodec)
- DeInitializes the AUDCODEC peripheral. - 参数:
- hacodec – pointer to a AUDCODEC_HandleTypeDef structure that contains the configuration information for AUDCODEC module 
 
- 返回值:
- HAL – status 
 
- 
void HAL_AUDCODEC_MspInit(AUDCODEC_HandleTypeDef *hacodec)
- Initializes the AUDCODEC pin setting. - 参数:
- hacodec – pointer to a AUDCODEC_HandleTypeDef structure that contains the configuration information for AUDCODEC module 
 
- 返回值:
- None – 
 
- 
void HAL_AUDCODEC_MspDeInit(AUDCODEC_HandleTypeDef *hacodec)
- deunitializes the AUDCODEC pin setting. - 参数:
- hacodec – pointer to a AUDCODEC_HandleTypeDef structure that contains the configuration information for AUDCODEC module 
 
- 返回值:
- None – 
 
- 
HAL_StatusTypeDef HAL_AUDCODEC_Config_TChanel(AUDCODEC_HandleTypeDef *hacodec, int channel, AUDCODEC_DACCfgTypeDef *cfg)
- Set AUDCODEC transmit channel configures. - 参数:
- hacodec – pointer to a AUDCODEC_HandleTypeDef structure that contains the configuration information for AUDCODEC module 
- channel – configure channel number 
- cfg – configure parameters 
 
- 返回值:
- HAL – status 
 
- 
HAL_StatusTypeDef HAL_AUDCODEC_Config_RChanel(AUDCODEC_HandleTypeDef *hacodec, int channel, AUDCODEC_ADCCfgTypeDef *cfg)
- Set AUDCODEC Receive configures. - 参数:
- hacodec – pointer to a AUDCODEC_HandleTypeDef structure that contains the configuration information for AUDCODEC module 
- channel – configure channel number 
- cfg – configure parameters 
 
- 返回值:
- HAL – status 
 
- 
HAL_StatusTypeDef HAL_AUDCODEC_Clear_All_Channel(AUDCODEC_HandleTypeDef *hacodec, uint8_t ch_type_bit)
- all channel disable - 参数:
- hacodec – -pointer to a AUDCODEC_HandleTypeDef structure that contains the configuration information for AUDCODEC module 
- ch_type_bit – : bit0 is dac, bit1 is adc 
 
- 返回:
- HAL status 
 
- 
HAL_StatusTypeDef HAL_AUDCODEC_Config_DACPath_Volume(AUDCODEC_HandleTypeDef *hacodec, int channel, int volume)
- Configure DAC path volume. - 参数:
- hacodec – pointer to a AUDCODEC_HandleTypeDef structure that contains the configuration information for AUDCODEC module 
- channel – channel 0 or 1 
- volume – configure volume -36dB~54dB, unit is 0.5db, use fix point Q15.1 format 
 
- 返回值:
- HAL – status 
 
- 
HAL_StatusTypeDef HAL_AUDCODEC_Config_DACPath(AUDCODEC_HandleTypeDef *hacodec, uint16_t bypass)
- Bypass DAC path. - 参数:
- hacodec – pointer to a AUDCODEC_HandleTypeDef structure that contains the configuration information for AUDCODEC module 
- bypass – 1:enable, 0: disable 
 
- 返回值:
- HAL – status 
 
- 
HAL_StatusTypeDef HAL_AUDCODEC_Mute_DACPath(AUDCODEC_HandleTypeDef *hacodec, int mute)
- Configure DAC path mute. - 参数:
- hacodec – pointer to a AUDCODEC_HandleTypeDef structure that contains the configuration information for AUDCODEC module 
- mute – is mute or not 
 
- 返回值:
- HAL – status 
 
- 
HAL_StatusTypeDef HAL_AUDCODEC_Config_ADCPath(AUDCODEC_HandleTypeDef *hacodec, AUDCODEC_ADCCfgTypeDef *cfg)
- Configure ADC path. - 参数:
- hacodec – pointer to a AUDCODEC_HandleTypeDef structure that contains the configuration information for AUDCODEC module 
- cfg – configure parameters 
 
- 返回值:
- HAL – status 
 
- 
HAL_StatusTypeDef HAL_AUDCODEC_Transmit_DMA(AUDCODEC_HandleTypeDef *hacodec, uint8_t *pData, uint32_t Size, uint32_t did)
- Set AUDCODEC Transmit data with DMA mode. - 参数:
- hacodec – pointer to a AUDCODEC_HandleTypeDef structure that contains the configuration information for AUDCODEC module 
- pData – data buffer 
- Size – data length need to be transmit 
- did – DMA channel index 
 
- 返回值:
- HAL – status 
 
- 
HAL_StatusTypeDef HAL_AUDCODEC_Receive_DMA(AUDCODEC_HandleTypeDef *hacodec, uint8_t *pData, uint32_t Size, uint32_t did)
- Set AUDCODEC Receive configures. - 参数:
- hacodec – pointer to a AUDCODEC_HandleTypeDef structure that contains the configuration information for AUDCODEC module 
- pData – data buffer 
- Size – data length need to be transmit 
- did – DMA channel index 
 
- 返回值:
- HAL – status 
 
- 
HAL_StatusTypeDef HAL_AUDCODEC_DMAStop(AUDCODEC_HandleTypeDef *hacodec, uint32_t did)
- Stop AUD PRC DMA. - 参数:
- hacodec – pointer to a AUDCODEC_HandleTypeDef structure that contains the configuration information for AUDCODEC module 
- did – DMA channel index 
 
- 返回值:
- HAL – status 
 
- 
void set_pll_state(uint8_t state)
- 
uint8_t get_pll_state()
- 
void set_pll_freq_type(uint8_t type)
- 
uint8_t get_pll_freq_type()
- 
int updata_pll_freq(uint8_t type)
- 
int bf0_enable_pll(uint32_t freq, uint8_t type)
- 
void bf0_disable_pll()
- 
void HAL_TURN_ON_PLL()
- 
struct AUDCODEC_DacChnlCfgTypeDef
- #include <bf0_hal_audcodec.h>AUDCODEC TX/RX channel configure structure definition. Public Members - 
uint8_t clk_ana_pol
 - 
uint8_t dither_en
 - 
uint8_t dither_gain
 - 
uint8_t sinc_gain
 - 
uint8_t data_format
 - 
uint8_t fine_vol
 - 
uint8_t rough_vol
 - 
uint8_t dma_en
 - 
uint8_t dem_mode
 - 
uint8_t dout_mute
 - 
uint8_t enable
 - 
uint8_t ramp_interval
 - 
uint8_t zero_adjust_en
 - 
uint8_t ramp_mode
 - 
uint8_t ramp_en
 - 
uint32_t dc_offset
 
- 
uint8_t clk_ana_pol
- 
struct AUDCODEC_AdcChnlCfgTypeDef
- 
struct AUDCODE_DAC_CLK_CONFIG_TYPE
- #include <bf0_hal_audcodec.h>AUDCODEC DAC clock config definition. Public Members - 
uint32_t samplerate
 - 
uint8_t clk_src_sel
- 0:xtal 48M 1:PLL 44.1M 
 - 
uint8_t clk_div
 - 
uint8_t osr_sel
- 0:100 1:150 2:300 4:64 5:128 6:256 
 - 
uint16_t sinc_gain
 - 
uint8_t sel_clk_dac_source
- 0:xtal 48M 1:PLL 
 - 
uint8_t diva_clk_dac
 - 
uint8_t diva_clk_chop_dac
 - 
uint8_t divb_clk_chop_dac
 - 
uint8_t diva_clk_chop_bg
 - 
uint8_t diva_clk_chop_refgen
 
- 
uint32_t samplerate
- 
struct AUDCODE_ADC_CLK_CONFIG_TYPE
- #include <bf0_hal_audcodec.h>AUDCODEC ADC clock config definition. 
- 
struct AUDCODEC_DACCfgTypeDef
- #include <bf0_hal_audcodec.h>AUDCODEC DAC PATH configure structure definition. Public Members - 
uint8_t opmode
- 0:audprc tx to audcode 1: mem tx to audcodec 
 - 
AUDCODE_DAC_CLK_CONFIG_TYPE *dac_clk
 
- 
uint8_t opmode
- 
struct AUDCODEC_ADCCfgTypeDef
- #include <bf0_hal_audcodec.h>AUDCODEC ADC PATH configure structure definition. 
- 
struct AUDCODEC_InitTypeDef
- #include <bf0_hal_audcodec.h>AUDCODEC Init structure definition. Public Members - 
uint16_t en_dly_sel
- codec enable delay count 
 - 
uint8_t samplerate_index
 - 
AUDCODEC_DACCfgTypeDef dac_cfg
- dac AUDCODEC DAC PATH configure 
 - 
AUDCODEC_ADCCfgTypeDef adc_cfg
- dac AUDCODEC ADC PATH configure 
 
- 
uint16_t en_dly_sel
- 
struct AUDCODEC_HandleTypeDef
- #include <bf0_hal_audcodec.h>AUDCODEC handle Structure definition. Public Members - 
AUDCODEC_HP_TypeDef *Instance_hp
- AUDCODEC HP registers base address 
 - 
AUDCODEC_LP_TypeDef *Instance_lp
- AUDCODEC LP registers base address 
 - 
AUDCODEC_InitTypeDef Init
- AUDCODEC communication parameters 
 - 
AUDCODEC_DacChnlCfgTypeDef DacChnl[2]
 - 
AUDCODEC_AdcChnlCfgTypeDef AdcChnl[2]
 - 
DMA_HandleTypeDef *hdma[HAL_AUDCODEC_INSTANC_CNT]
- AUDCODEC Tx/rx Channel DMA handle parameters 
 - 
uint8_t *buf[HAL_AUDCODEC_INSTANC_CNT]
- AUDCODEC data buffer 
 - 
uint32_t dataSize[HAL_AUDCODEC_INSTANC_CNT]
- AUDCODEC Data size 
 - 
uint16_t bufSize
- AUDCODEC Data buffer size 
 - 
uint16_t channel_ref
- HAL_AUDCODEC_ChannelTypeDef bitmap 
 - 
HAL_LockTypeDef Lock
- AUDCODEC locking object 
 - 
HAL_AUDCODEC_StateTypeDef State[HAL_AUDCODEC_INSTANC_CNT]
- AUDCODEC communication state 
 - 
uint32_t ErrorCode
- AUDCODEC Error code This parameter can be a value of AUDCODEC Error 
 
- 
AUDCODEC_HP_TypeDef *Instance_hp
