📄 aic27.h
字号:
/******************************************************************************/
/******************************************************************************/
/* aic27.h - AIC27 AIC27 driver routines */
/* */
/* This module is the device library for the AIC27 AIC27 on the */
/* 5510 EVM . */
/* */
/* MACRO FUNCTIONS: */
/* */
/* FUNCTIONS: */
/* */
/* aic27_open() - allocate identifying handle for an instance of a codec */
/* aic27_close() - release a codec handle */
/* aic27_reset() - Reset the codec to the default configuration. */
/* aic27_init() - Initialize the codec . */
/* aic27_read_reg() - Read an AIC27 control register */
/* aic27_write_reg() - Write an AIC27 control register */
/* int aic27_cont_play() - Sets continuous play (D/A) mode */
/* int aic27_cont_capture() - Sets continuous capture (A/D) mode */
/* */
/******************************************************************************/
#ifndef _AIC27_H_
#define _AIC27_H_
#include <board.h>
/*****************************************************************************/
/* DEFINES */
/*****************************************************************************/
#define AIC27_MUTE_MASK 0x8000
#define AIC27_MUTE 0x8000
#define AIC27_MUTE_REL 0x0000
#define AIC27_8000HZ 0x1f40ul
#define AIC27_11025HZ 0x2b11ul
#define AIC27_16000HZ 0x3e80ul
#define AIC27_22050HZ 0x5622ul
#define AIC27_44100HZ 0xac44ul
#define AIC27_48000HZ 0xbb80ul
#ifdef OLD_BOARD
#define AIC27_PORT 1 //McBSP1
#else
#define AIC27_PORT 2 //McBSP2
#endif
#ifdef OLD_BOARD
#define MCBSP1_TO_DB 0x2
#define MCBSP1_TO_CODEC1 (~MCBSP1_TO_DB)
#endif
/*****************************************************************************/
/* typedefs & enums */
/*****************************************************************************/
/*****************************************************************************/
/* AIC27 actions */
/*****************************************************************************/
typedef enum
{
AIC27_PLAY,
AIC27_CAPTURE
} AIC27Action, *PAIC27Action;
/*
// Codec instance enumeration
typedef enum
{
AIC27_LEFT_CH = 0x1000, //Play data to left channel only
AIC27_RIGHT_CH = 0x0800, //Play data to Right channel only
AIC27_BOTH_CH = 0x1800 //Play data to both channels
} AIC27Channel, *PAIC27Channel;
*/
/*****************************************************************************/
/* AIC27 register enumeration (AC'97 Compliant) */
/*****************************************************************************/
typedef enum
{
RESET = 0x00,
MASTER_VOL = 0x02,
LNLVL_VOL = 0x04,
MASTER_MONO_VOL = 0x06,
PCBEEP_VOL = 0x0a,
PHONE_VOL = 0x0c,
MIC_VOL = 0x0e,
LINEIN_VOL = 0x10,
CD_VOL = 0x12,
VIDE0_VOL = 0x14,
AUX_VOL = 0x16,
PCMOUT_VOL = 0x18,
REC_SEL = 0x1a,
REC_GAIN = 0x1c,
GP_REG = 0x20,
CTRL_3D = 0x22,
PWRDN_CSR = 0x26,
EXTD_AUDIO_ID = 0x28,
EXTD_AUDIO_STATCTRL = 0x2a,
FRONT_DAC_SRATE = 0x2c,
REAR_DAC_SRATE = 0x2e,
LFE_DAC_SRATE = 0x30,
AUDIO_ADC_RRATE = 0x32,
SIXCH_VOL_CNTR_LFE = 0x36,
SIXCH_VOL_LR_SURR = 0x38,
EXTD_MODEM_ID = 0x3c,
EXTD_MODEM_STAT = 0x3e,
LINE1_SRATE = 0x40,
LINE2_SRATE = 0x42,
LINE1_DAC_ADC_LVL = 0x46,
LINE2_DAC_ADC_LVL = 0x48,
GPIO_PIN_CONFIG = 0x4c, //Not supported
GPIO_PIN_TYPE = 0x4e,
GPIO_PIN_STICKY = 0x50,
GPIO_PIN_WKUP = 0x52,
GPIO_PIN_STAT = 0x54,
MISC_MODEM_STAT_CTRL = 0x56,
VENDOR_RSVD1 = 0x5a,
REAR_PCMOUT_VOL = 0x70, //Not supported
FRONT_MIXER_VOL = 0x72,
REAR_MIXER_VOL = 0x74, //Not supported
VENDOR_RSVD2 = 0x7a,
VENDOR_ID1 = 0x7c,
VENDOR_ID2 = 0x7e
} AIC27Reg, *PAIC27Reg;
/*****************************************************************************/
/* MASTER_VOL, LNLVL_VOL, & MASTER_MONO_VOL register settings */
/* */
/* Note that only the first 5 bits of the enumeration are written to the */
/* register bits based on the mapping below: */
/* */
/* b0-b4: Right Ch */
/* b8-b12: Left Ch (MASTER_VOL & LNLVL_VOL only) */
/* */
/* b15: 1=Mute */
/*****************************************************************************/
typedef enum
{
MS_VOL_0dB = 0x00, //0dB
MS_VOL_MINUS_1_5dB = 0x01, //-1.5dB
MS_VOL_MINUS_46_5dB = 0x1f //-46.5dB
} AIC27MasterVol, *PAIC27MasterVol;
/*****************************************************************************/
/* Analog input gain register settings */
/* LINEIN_VOL,CD_VOL, VIDEO_VOL, AUX_VOL, PCMOUT_VOL */
/* */
/* Note that only the first 5 bits of the enumeration are written to the */
/* register bits based on the mapping below: */
/* */
/* b0-b4: Right Ch */
/* b8-b12: Left Ch */
/* */
/* b15: 1=Mute */
/* */
/* Each step corresponds to approx. 1.5dB */
/* */
/* MAX gain = (2^5)*1.5 dB = 48dB */
/*****************************************************************************/
typedef enum
{
AIN_VOL_0dB = 0x00, //0dB
AIN_VOL_1_5dB = 0x01, //1.5dB
AIN_VOL_3dB = 0x02, //3dB
AIN_VOL_4_5dB = 0x03, //4.5dB
AIN_VOL_6dB = 0x04, //6dB
AIN_VOL_7_5dB = 0x05, //7.5dB
AIN_VOL_9dB = 0x06, //9dB
AIN_VOL_10_5dB = 0x07, //10.5dB
AIN_VOL_12dB = 0x08, //12dB
AIN_VOL_13_dB = 0x09, //13.5dB
AIN_VOL_15dB = 0x0a, //15dB
AIN_VOL_16_dB = 0x0b, //16.5dB
AIN_VOL_18dB = 0x0c, //18dB
AIN_VOL_19_5dB = 0x0d, //19.5dB
AIN_VOL_21dB = 0x0e, //21dB
AIN_VOL_22_5dB = 0x0f, //22.5dB
AIN_VOL_24dB = 0x10, //24dB
AIN_VOL_25_5dB = 0x11, //25.5dB
//fill in the gap
AIN_VOL_45_dB = 0x1e, //45dB
AIN_VOL_46_5dB = 0x1f //46.5dB
} AIC27AinGain, *PAIC27AinGain;
/*****************************************************************************/
/* MIC_VOL register settings */
/* */
/* Only the first 5 bits of the enumeration are relevant */
/* */
/* b0-b4: Vol control */
/* b5-b14: Don't care */
/* */
/* b15: 1=Mute */
/*****************************************************************************/
typedef enum
{
MIC_VOL_12dB = 0x01, //12dB
MIC_VOL_0dB = 0x09, //0dB
MIC_VOL_MINUS_34_5dB = 0x1f //-34.5dB
} AIC27MicVol, *PAIC27MicVol;
/*****************************************************************************/
/* REC_SEL register settings */
/* */
/* Note that only the first 3 bits of the enumeration are written to the */
/* register bits based on the mapping below: */
/* */
/* b0-b2: Right Ch */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -