📄 evm5509_aic23_opencodec.c
字号:
/*
* Copyright 2004 by Spectrum Digital Incorporated.
* All rights reserved. Property of Spectrum Digital Incorporated.
*/
/*
* ======== evm5509_aic23_openCodec.c ========
* EVM5509_AIC23_openCodec() implementation
*/
#include <csl.h>
#include <csl_mcbsp.h>
#include <csl_i2c.h>
#include <evm5509.h>
#include <evm5509_aic23.h>
/* AIC23 McBSP handles */
MCBSP_Handle EVM5509_AIC23_DATAHANDLE;
/*
* ======== EVM5509_AIC23_openCodec ========
* Open the codec and return a codec handle
*/
EVM5509_AIC23_CodecHandle EVM5509_AIC23_openCodec(int id, EVM5509_AIC23_Config *Config)
{
MCBSP_Config mcbspCfgData = {
0x0000, /* Serial Port Control Register 1 */
0x0000, /* Serial Port Control Register 2 */
0x0140, /* Receive Control Register 1 */
0x0000, /* Receive Control Register 2 */
0x0140, /* Transmit Control Register 1 */
0x0000, /* Transmit Control Register 2 */
0x0000, /* Sample Rate Generator Register 1 */
0x0000, /* Sample Rate Generator Register 2 */
0x0000, /* Multichannel Control Register 1 */
0x0000, /* Multichannel Control Register 2 */
0x0003, /* Pin Control Register */
0x0000, /* Receive Channel Enable Register Partition A */
0x0000, /* Receive Channel Enable Register Partition B */
0x0000, /* Receive Channel Enable Register Partition C */
0x0000, /* Receive Channel Enable Register Partition D */
0x0000, /* Receive Channel Enable Register Partition E */
0x0000, /* Receive Channel Enable Register Partition F */
0x0000, /* Receive Channel Enable Register Partition G */
0x0000, /* Receive Channel Enable Register Partition H */
0x0000, /* Transmit Channel Enable Register Partition A */
0x0000, /* Transmit Channel Enable Register Partition B */
0x0000, /* Transmit Channel Enable Register Partition C */
0x0000, /* Transmit Channel Enable Register Partition D */
0x0000, /* Transmit Channel Enable Register Partition E */
0x0000, /* Transmit Channel Enable Register Partition F */
0x0000, /* Transmit Channel Enable Register Partition G */
0x0000 /* Transmit Channel Enable Register Partition H */
};
/* Enable codec data path on board */
EVM5509_rset(EVM5509_MISC, EVM5509_rget(EVM5509_MISC) | 1);
/* Reset the AIC23 */
EVM5509_AIC23_rset(0, EVM5509_AIC23_RESET, 0);
/* Configure the rest of the AIC23 registers */
EVM5509_AIC23_config(0, Config);
/* Open codec data handle */
EVM5509_AIC23_DATAHANDLE = MCBSP_open(MCBSP_PORT0, MCBSP_OPEN_RESET);
if (EVM5509_AIC23_DATAHANDLE == INV)
return (EVM5509_AIC23_CodecHandle)INV;
/* Configure codec data McBSP */
MCBSP_config(EVM5509_AIC23_DATAHANDLE, &mcbspCfgData);
/* Clear any garbage from the codec data port */
if (MCBSP_rrdy(EVM5509_AIC23_DATAHANDLE))
MCBSP_read16(EVM5509_AIC23_DATAHANDLE);
/* Start McBSP1 as the codec data channel */
MCBSP_start(EVM5509_AIC23_DATAHANDLE, MCBSP_XMIT_START | MCBSP_RCV_START |
MCBSP_SRGR_START | MCBSP_SRGR_FRAMESYNC, 1000);
return (0);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -