⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 aic23.h

📁 dm270 source code
💻 H
字号:

/** \defgroup AIC23_USER AIC23 Control APIs */
/*@{*/

/**
	\file aic23.h
	\brief AIC23 Control APIs

	Refer AIC23 datasheet for details of each AIC23 command/register
*/

#ifndef __AIC23_H__
#define __AIC23_H__

#include <system/armsys270.h>

#define DSP_CLK_SPEED					121500000	// 121.5
#define XTAL_SPEED						12000000

#define AIC23_ADDR_CS0 0x1A
#define AIC23_ADDR_CS1 0x1B

#define AIC23_CS0

#ifdef  AIC23_CS0
	#define AIC23_ADDR AIC23_ADDR_CS0
#else
	#define AIC23_ADDR AIC23_ADDR_CS1
#endif

#define AICVOL_MAX 127
#define AICVOL_MIN 87
#define AICVOL  ((AICVOL_MAX+AICVOL_MIN)/2)
#define AICVOL_LEVEL ((AICVOL_MAX-AICVOL_MIN)/20)
extern unsigned char AICvol;

#define AIC23_ADDR_SHIFT	   9

#define AIC23_L_LIN_VOL_ADDR   0x00
#define AIC23_R_LIN_VOL_ADDR   0x01
#define AIC23_L_HP_VOL_ADDR    0x02
#define AIC23_R_HP_VOL_ADDR    0x03
#define AIC23_A_PATH_ADDR      0x04
#define AIC23_D_PATH_ADDR      0x05
#define AIC23_POW_CTRL_ADDR    0x06
#define AIC23_D_AUDIO_FMT_ADDR 0x07
#define AIC23_SMPL_RATE_ADDR   0x08
#define AIC23_D_INTERFACE_ADDR 0x09
#define AIC23_RESET_ADDR       0x0F


#define AIC23_BIN_MSK 0x1

// Left Line Volume
#define AIC23_LRS     0x8
#define AIC23_LRS_DIS 0x0
#define AIC23_LRS_ENA 0x1

#define AIC23_LIM      0x7
#define AIC23_LIM_NML  0x0
#define AIC23_LIM_MUTE 0x1

#define AIC23_LIV     0x0
#define AIC23_LIV_MSK 0x1F

// Right Line Volume
#define AIC23_RLS     0x8
#define AIC23_RLS_DIS 0x0
#define AIC23_RLS_ENA 0x1

#define AIC23_RIM      0x7
#define AIC23_RIM_NML  0x0
#define AIC23_RIM_MUTE 0x1

#define AIC23_RIV     0x0
#define AIC23_RIV_MSK 0x1F

// Left Headphone Volume
#define AIC23_LZC     0x7
#define AIC23_LZC_ON  0x1
#define AIC23_LZC_OFF 0x0

#define AIC23_LHV     0x0
#define AIC23_LHV_MSK 0x7F

// Right Headphone Volume
#define AIC23_RZC     0x7
#define AIC23_RZC_ON  0x1
#define AIC23_RZC_OFF 0x0

#define AIC23_RHV     0x0
#define AIC23_RHV_MSK 0x7F

// Analog Audio Path Control
#define AIC23_STA     0x6
#define AIC23_STA_MSK 0x3
#define AIC23_STA_m6  0x0
#define AIC23_STA_m9  0x1
#define AIC23_STA_m12 0x2
#define AIC23_STA_m18 0x3

#define AIC23_STE 0x5
#define AIC23_STE_ENA 0x1
#define AIC23_STE_DIS 0x0

#define AIC23_DAC 0x4
#define AIC23_DAC_ON  0x1
#define AIC23_DAC_OFF 0x0

#define AIC23_BYP 0x3
#define AIC23_BYP_ENA 0x1
#define AIC23_BYP_DIS 0x0

#define AIC23_INSEL 0x2
#define AIC23_INSEL_MIC 0x1
#define AIC23_INSEL_LIN 0x0

#define AIC23_MICM 0x1
#define AIC23_MICM_MUTE 0x1
#define AIC23_MICM_NML  0x0

#define AIC23_MICB 0x0
#define AIC23_MICB_ON  0x1
#define AIC23_MICB_OFF 0x0

// Digital Audio Path Control
#define AIC23_DACM 0x3
#define AIC23_DACM_ENA 0x1
#define AIC23_DACM_DIS 0x0

#define AIC23_DEEMP     0x1
#define AIC23_DEEMP_MSK 0x3
#define AIC23_DEEMP_32  0x1
#define AIC23_DEEMP_441 0x2
#define AIC23_DEEMP_48  0x3
#define AIC23_DEEMP_DIS 0x0

#define AIC23_ADCHP 0x0
#define AIC23_ADCHP_ENA 0x1
#define AIC23_ADCHP_DIS 0x0

// Power Down Control
#define AIC23_OFF     0x7
#define AIC23_OFF_ON  0x0
#define AIC23_OFF_OFF 0x1

#define AIC23_CLK     0x6
#define AIC23_CLK_ON  0x0
#define AIC23_CLK_OFF 0x1

#define AIC23_OSC     0x5
#define AIC23_OSC_ON  0x0
#define AIC23_OSC_OFF 0x1

#define AIC23_OUT     0x4
#define AIC23_OUT_ON  0x0
#define AIC23_OUT_OFF 0x1

#define AIC23_DACP     0x3
#define AIC23_DACP_ON  0x0
#define AIC23_DACP_OFF 0x1

#define AIC23_ADC     0x2
#define AIC23_ADC_ON  0x0
#define AIC23_ADC_OFF 0x1

#define AIC23_MIC     0x1
#define AIC23_MIC_ON  0x0
#define AIC23_MIC_OFF 0x1

#define AIC23_LINE     0x0
#define AIC23_LINE_ON  0x0
#define AIC23_LINE_OFF 0x1

// Digital Audio Interface Format
#define AIC23_MS 0x6
#define AIC23_MS_MAS 0x1
#define AIC23_MS_SLV 0x0

#define AIC23_LRSWAP 0x5
#define AIC23_LRSWAP_ENA 0x1
#define AIC23_LRSWAP_DIS 0x0

#define AIC23_LRP 0x4
#define AIC23_LRP_ON  0x1
#define AIC23_LRP_OFF 0x0

#define AIC23_IWL 0x2
#define AIC23_IWL_MSK 0x3
#define AIC23_IWL_16 0x0
#define AIC23_IWL_20 0x1
#define AIC23_IWL_24 0x2
#define AIC23_IWL_32 0x3

#define AIC23_FOR 0x0
#define AIC23_FOR_MSK 0x3
#define AIC23_FOR_MSB_L 0x0
#define AIC23_FOR_MSB_R 0x1
#define AIC23_FOR_I2S   0x2
#define AIC23_FOR_DSP   0x3

// Sample Rate Control
#define AIC23_CLKOUT 0x7
#define AIC23_CLKOUT_MCLK  0x0
#define AIC23_CLKOUT_HMCLK 0x1

#define AIC23_CLKIN 0x6
#define AIC23_CLKIN_MCLK  0x0
#define AIC23_CLKIN_HMCLK 0x1

#define AIC23_SR 0x2
#define AIC23_SR_MSK 0xF

#define AIC23_BOSR 0x1
#define AIC23_BOSR_256 0x0
#define AIC23_BOSR_384 0x1

#define AIC23_USB 0x0
#define AIC23_USB_USB 0x1
#define AIC23_USB_NML 0x0

#define AIC23_SR_12288_96_96 0x7
#define AIC23_SR_12288_48_48 0x0
#define AIC23_SR_12288_32_32 0x6
#define AIC23_SR_12288_8_8   0x3
#define AIC23_SR_12288_48_8  0x1
#define AIC23_SR_12288_8_48  0x2


#define AIC23_SR_12_48	0x0
#define AIC23_SR_12_44 	0x8
#define AIC23_SR_12_32  0x6
#define AIC23_SR_12_8	0x3

// Digital Interface Activation
#define AIC23_ACT 0x0
#define AIC23_ACT_ACT   0x1
#define AIC23_ACT_INACT 0x0


STATUS AIC23_reset();
STATUS AIC23_L_lin_vol( const Uint8 lrs,  const Uint8 lim,  const Uint8 liv  );
STATUS AIC23_R_lin_vol(  const Uint8 rls,  const Uint8 rim,  const Uint8 riv  );
STATUS AIC23_L_hp_vol(  const Uint8 lrs,  const Uint8 lzc,  const Uint8 lhv  );
STATUS AIC23_R_hp_vol(  const Uint8 rls,  const Uint8 rzc,  const Uint8 rhv  );

STATUS AIC23_A_path( const Uint8 sta,  const Uint8 ste,  const Uint8 dac,  const Uint8 byp,
						const Uint8 insel,  const Uint8 micm,  const Uint8 micb  );

STATUS AIC23_D_path(  const Uint8 dacm,  const Uint8 deemp,  const Uint8 adchp );

STATUS AIC23_pow_ctrl(  Uint8 off,  Uint8 clk,  Uint8 osc,  Uint8 out,
							Uint8 dacp,  Uint8 adc,  Uint8 mic,  Uint8 line);

STATUS AIC23_D_audio_fmt(  const Uint8 ms,  const Uint8 lrswap,  const Uint8 lrp,
							const Uint8 iwl,  const Uint8 For );

STATUS AIC23_smpl_rate(	const Uint8 clkout,  const Uint8 clkin,  const Uint8 sr,  
		const Uint8 bosr,  const Uint8 usb );

STATUS AIC23_D_interface(  const Uint8 act);

STATUS AIC_init();

#endif	/*	 __AIC23_H__	*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -