📄 aic27.h
字号:
/* b8-b10: Left Ch */
/*****************************************************************************/
typedef enum
{
MIC_IN = 0x0000,
CD_IN = 0x0101,
VIDEO_IN = 0x0202,
AUX_IN = 0x0303,
LINE_IN = 0x0404,
STEREO_MIX = 0x0505,
MONO_MIX = 0x0606,
PHONE_MIX = 0x0707
} AIC27RecordSel, *PAIC27RecordSel;
/*****************************************************************************/
/* REC_GAIN register settings */
/* */
/* Note that only the first 4 bits of the enumeration are written to the */
/* register bits based on the mapping below: */
/* */
/* b0-b3: Right Ch */
/* b8-b11: Left Ch */
/* */
/* b15: 1=Mute */
/*****************************************************************************/
typedef enum
{
REC_GAIN_0dB = 0x0, //0dB
REC_GAIN_22_5dB = 0xf //22.5dB
} AIC27RecordGain, *PAIC27RecordGain;
/*****************************************************************************/
/* GP_REG register settings */
/* Only supported bits are indicated here */
/*****************************************************************************/
typedef enum
{
DAC_ADC_LP = 0x0080, //ADC/DAC loopback
MIC_SEL = 0x0100, //1=mic2, 0=mic1
MONO_OUT_SEL = 0x0200, //0=mix, 1=mic
THREED_EN = 0x2000 //3D enhancement 1=on, 0=off
} AIC27GPbits, *PAIC27GPbits;
/*****************************************************************************/
/* PWRDN_CSR register settings */
/*****************************************************************************
typedef enum
{
DAC_ADC_LP = 0x0080, //ADC/DAC loopback
MIC_SEL = 0x0100, //1=mic2, 0=mic1
MONO_OUT_SEL = 0x0200, //0=mix, 1=mic
THREED_EN = 0x2000 //3D enhancement 1=on, 0=off
} AIC27PwrCsr, *PAIC27PwrCsr;
*/
/*****************************************************************************/
/* PUBLIC FUNCTION PROTOTYPES */
/*****************************************************************************/
/******************************************************************************/
/* aic27_open() - Open AIC27 codec and connect codec to McBSP. */
/* */
/* */
/* Parameters - None */
/* */
/* Returns - BRD_OK on success, BRD_ERROR on failure */
/* */
/******************************************************************************/
int aic27_open();
/******************************************************************************/
/* aic27_init() - Initialize AIC27 codec by setting up the registers */
/* */
/* Parameters - None */
/* */
/* Returns - None */
/* */
/******************************************************************************/
void aic27_init();
/******************************************************************************/
/* aic27_close() - Closes codec connection */
/* */
/* Parameters - None */
/* */
/* Returns - BRD_OK on success, BRD_ERROR on failure */
/* */
/******************************************************************************/
int aic27_close();
/******************************************************************************/
/* aic27_reset() - Reset the codec to the default configuration. */
/* */
/* This function resets the AIC27 codec by sending it a software reset. */
/* All registers are configured to their default values. */
/* */
/* Parameters - None */
/* */
/* Returns - BRD_OK on success, BRD_ERROR on failure */
/* */
/******************************************************************************/
int aic27_reset();
/******************************************************************************/
/* aic27_read_reg() - Read an AIC27 control register */
/* */
/* Parameters - */
/* reg - an element of an enumeration indicating the register to read. */
/* */
/* Returns - Content of the indicated register */
/* */
/******************************************************************************/
u16 aic27_read_reg(AIC27Reg reg);
/******************************************************************************/
/* aic27_write_reg() - Write an AIC27 control register */
/* */
/* Parameters - */
/* reg - an element of an enumeration indicating the register to write. */
/* value - a number containing the bits to be written, already in their */
/* correct field locations. */
/* mask - a number indicating the position of the bits in "value" to be */
/* written. */
/* */
/* Returns - BRD_OK on success, BRD_ERROR on failure */
/* */
/******************************************************************************/
u16 aic27_write_reg(AIC27Reg reg, u16 value, u16 mask);
/******************************************************************************/
/* aic27_sample_rate() - Set the specified channel sample rate. */
/* */
/* Parameters - */
/* reg - an element of an enumeration indicating the pertinent register. */
/* freq - an element of an enumeration indicating the frequency. */
/* */
/* Returns - BRD_OK on success, BRD_ERROR on failure */
/* */
/******************************************************************************/
int aic27_sample_rate(AIC27Reg reg, u16 freq);
/******************************************************************************/
/* aic27_stop_capture() - Stops capturing data from AIC27. */
/* */
/* Parameters - None */
/* */
/* Returns - None */
/* */
/******************************************************************************/
void aic27_stop_capture();
/******************************************************************************/
/* aic27_stop_play() - Set the specified channel sample rate. */
/* */
/* Parameters - */
/* reg - an element of an enumeration indicating the pertinent register. */
/* freq - an element of an enumeration indicating the frequency. */
/* */
/* Returns - None */
/* */
/******************************************************************************/
void aic27_stop_play();
/******************************************************************************/
/* aic27_cont_play() */
/* */
/* This function is used to continuously send data to the codec. */
/* */
/* Parameters - */
/* pingBuf - a buffer containing data to play */
/* pongBuf - a second buffer containing data to play */
/* size - the number of samples in each buffer */
/* pfunc - Pointer to function to run at end of buffer */
/* bufStatus - pointer to transfer status. */
/* 1 = transfer in progress, 0 = transfer complete */
/* */
/* Returns - BRD_OK on success, BRD_ERROR on failure. */
/* */
/* */
/******************************************************************************/
int aic27_cont_play(int *pingBuf,
int *pongBuf,
unsigned int size,
Fp pfunc,
int **bufStatus);
/******************************************************************************/
/* aic27_cont_capture() */
/* */
/* This function is used to capture data from the codec */
/* */
/* Parameters - */
/* pingBuf - a buffer to contain data read */
/* pongBuf - a second buffer to contain data read */
/* size - the number of samples in each buffer */
/* pfunc - Pointer to function to run at end of buffer */
/* bufStatus - pointer to transfer status. */
/* 1 = transfer in progress, 0 = transfer complete */
/* */
/* Returns - BRD_OK on success, BRD_ERROR on failure. */
/* */
/* */
/******************************************************************************/
int aic27_cont_capture(int *pingBuf,
int *pongBuf,
unsigned int size,
Fp pfunc,
int **bufStatus);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -