DSP编程方面的程序

源代码在线查看: codec.c

软件大小: 7 K
上传用户: alin
关键词: DSP 编程 方面 程序
下载地址: 免注册下载 普通下载 VIP

相关代码

				/* Set up the CODEC */
				
				int codec()
				{
				  	int temp = 0;
				
				  	/* Set up control register 3 for S/W reset */
				  	mcbsp0_write(0);
				  	mcbsp0_read();
				  	mcbsp0_write(0);
				  	mcbsp0_read();
				  	mcbsp0_write(0);
				  	mcbsp0_read();
				  	mcbsp0_write(0);
				  	mcbsp0_read();
				  	mcbsp0_write(1);
				  	mcbsp0_read();
				  	mcbsp0_write(0x0386);
				  	mcbsp0_read();
				  	mcbsp0_write(0);
				  	mcbsp0_read();
				
				  	/* Set up control register 3 for mic input */
				  	mcbsp0_write(0);
				  	mcbsp0_read();
				  	mcbsp0_write(0);
				  	mcbsp0_read();
				  	mcbsp0_write(1);
				  	mcbsp0_read();
				  	mcbsp0_write(0x0306);
				  	mcbsp0_read();
				  	mcbsp0_write(0);
				  	mcbsp0_read();
				
				  	mcbsp0_write(0);
				  	mcbsp0_read();
				  	mcbsp0_write(1);
				  	mcbsp0_read();
				  	mcbsp0_write(0x2330);
				  	temp = mcbsp0_read();
				  	mcbsp0_write(0x0);
				  	mcbsp0_read();
				  	mcbsp0_write(0x0);
				  	mcbsp0_read();
				
				  	if((temp & 0xff) != 0x06)
				  	{
				  		printf ("Error in setting up register 3. %x\n", temp);
				  	  	return(1);
				  	}
				
					/* Set up control register 4 */
				  	mcbsp0_write(0);
				  	mcbsp0_read();
				  	mcbsp0_write(0);
				  	mcbsp0_read();
				  	mcbsp0_write(1);
				  	mcbsp0_read();
				  	mcbsp0_write(0x0400);
				  	mcbsp0_read();
				  	mcbsp0_write(0);
				  	mcbsp0_read();
				
				  	mcbsp0_write(0);
				  	mcbsp0_read();
				  	mcbsp0_write(1);
				  	mcbsp0_read();
				  	mcbsp0_write(0x2430);
				  	temp = mcbsp0_read();
				  	mcbsp0_write(0x0);
				  	mcbsp0_read();
				  	mcbsp0_write(0x0);
				  	mcbsp0_read();
				  	if((temp & 0xff) != 0x00)
				  	{
				    	printf ("Error in setting up register 4.\n");
				    	return(1);
				  	}
				
					/* Set up control register 5 */
				  	mcbsp0_write(0);
				  	mcbsp0_read();
				  	mcbsp0_write(0);
				  	mcbsp0_read();
				  	mcbsp0_write(1);
				  	mcbsp0_read();
				  	mcbsp0_write(0x0586);
				  	mcbsp0_read();
				  	mcbsp0_write(0);
				  	mcbsp0_read();
				
				  	mcbsp0_write(0);
				  	mcbsp0_read();
				  	mcbsp0_write(1);
				  	mcbsp0_read();
				  	mcbsp0_write(0x2530);
					temp = mcbsp0_read();
					mcbsp0_write(0x0);
				  	mcbsp0_read();
				  	mcbsp0_write(0x0);
				  	mcbsp0_read();
				  	if((temp & 0xfe) != 0x86)
				  	{
				  		printf ("Error in setting up register 5.\n");
				    	return(1);
				  	}
				
					return(0);
				}
				
							

相关资源