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

📄 dec6713_codec.c

📁 北京瑞泰TMS320C6713板音频采集演示程序
💻 C
字号:
/********************************************************************************\
\*  DEC6713_GPIO.c	V1.00													    *\

\*  Copyright 2004 by SSD Electronic Technology LTD.                           *\
\*  All rights reserved. SSD Electronic Technology LTD.                        *\
\*  Restricted rights to use, duplicate or disclose this code are               *\
\*  granted through contract.    											    *\
                                             
\*	Designed by: W.Z.H														    *\
\********************************************************************************/
/********************************************************************************\
\*		The example introduces using technique for GPIO. It generates a certain 
	frequency pulse on pin GPIO X. LED D8 will twinkle,if the routine runs correctly.*\
\********************************************************************************/

#include <csl.h>
#include <csl_gpio.h>
#include <csl_mcbsp.h>
#include <csl_i2c.h>
#include <stdio.h>
#include <DEC6713.h>
#include <IIC.h>
#include <McBSP.h>

extern far void vectors();

Uint8	PlayMode = 0,i;
Int16	y=5000;
Uint32	temp;
MCBSP_Handle hMcbsp;  

/********************************************************************************/
/********************************************************************************/
main()
{
	I2C_Handle hI2C;
  	
	Uint32	XmtEvtId;
	/* Initialize CSL,must when using CSL. */
	CSL_init();
	
	/* Initialize DEC6713 board. */
	DEC6713_init();
	 /* Let's open up serial port 1 */
  	hMcbsp = MCBSP_open(MCBSP_DEV0, MCBSP_OPEN_RESET);
	XmtEvtId = MCBSP_getXmtEventId(hMcbsp);
	IRQ_setVecs(vectors);     /* point to the IRQ vector table	*/
  	IRQ_globalEnable();       /* Globally enable interrupts       */ 
  	IRQ_nmiEnable();          /* Enable NMI interrupt             */	
  	IRQ_map(XmtEvtId, 14);
    IRQ_reset(XmtEvtId);
	IRQ_enable(XmtEvtId);
    
	/****************************************************************************/
	DEC6713_cpld_rset(DEC6713_CTR_REG,0x18);
	
	/* Initialize I2C0. */
	/* Open I2C0. */
	hI2C = I2C_open(I2C_DEV0,I2C_OPEN_RESET);

	I2C_write16(hI2C,Reset_Register,0x00);		
	I2C_write16(hI2C,Digital_Interface_Activation,0x01);
	I2C_write16(hI2C,Power_Down_Control,0x00);
	I2C_write16(hI2C,Sample_Rate_Control,0x022);
	I2C_write16(hI2C,Left_Line_Input_Channel_Volume_Control,0x117);
	I2C_write16(hI2C,Right_Line_Input_Channel_Volume_Control,0x117);
	I2C_write16(hI2C,Left_Channel_Headphone_Volume_Control,0x0180 +100);
	I2C_write16(hI2C,Right_Channel_Headphone_Volume_Control,0x0180 + 100);
	I2C_write16(hI2C,Analog_Audio_Path_Control,0x07d);
	I2C_write16(hI2C,Digital_Audio_Path_Control,0x04);

	I2C_write16(hI2C,Digital_Audio_Interface_Format,0x43);//0x52
	DEC6713_wait(1000);

  
  	/* We'll set it up for digital loopback, 32bit mode. We have   */
  	/* to setup the sample rate generator to allow self clocking.  */
  	MCBSP_config(hMcbsp,&ConfigMcbsp1);

  	/* Now that the port is setup, let's enable it in steps. */
  	MCBSP_start(hMcbsp,MCBSP_RCV_START | MCBSP_XMIT_START |
   					 MCBSP_SRGR_START| MCBSP_SRGR_FRAMESYNC,
   			  		 MCBSP_SRGR_DEFAULT_DELAY);
     
	for(temp=30000;temp>0;temp-=100)
	{
		for(i=0;i<2;i++)
		{
			y=5000;       
			DEC6713_wait(temp);
			y=-5000;       
    		DEC6713_wait(temp);
    	}
	}
	PlayMode = 1;
	
	for (; ;);
}	
	

interrupt void    
c_int14(void)    
{
	Int16	temp;
	temp = MCBSP_read(hMcbsp);
	if (PlayMode == 0)
    	MCBSP_write(hMcbsp,y);    		
    else 
    	MCBSP_write(hMcbsp,temp);	
}
/******************************************************************************\
* End of GPIO_Test.c
\******************************************************************************/

⌨️ 快捷键说明

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