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

📄 codec_config.c

📁 dsp vc5509 的多通道SPI通信程序
💻 C
字号:
#include "csl.h"
//#include "csl_irq.h"
//#include "csl_mcbsp.h"
#include "init_mcbsp1.h"
#include "registers.h"
MCBSP_Handle mhMcbsp;
MCBSP_Handle hMcbsp0;
void codec_config(void)
{
 /* Define a MCBSP_Handle object to be used with MCBSP_open function */
unsigned  int m,h,t; 



/* Initialize CSL library - This is REQUIRED !!! */
//init_mcbsp();    
  /* Open MCBSP Port 1 and set registers to their power on defaults */
  mhMcbsp = MCBSP_open(MCBSP_PORT1, MCBSP_OPEN_RESET);

//*IER0=0x00d0;   
    MCBSP_config(mhMcbsp, &MCBSP1_CONFIG); 


   	 MCBSP_start(mhMcbsp,MCBSP_SRGR_START | MCBSP_SRGR_FRAMESYNC,0x300);

 

  /* Enable MCBSP transmit and receive */

  MCBSP_start(mhMcbsp, 

    MCBSP_RCV_START | MCBSP_XMIT_START, 

    0);
//bring codec reser_ high 
//for(t=0;t<65535;t++)
asm(" nop ");
*IODOR=0x0010;
asm(" nop ");
*IODATA =0x0010;
asm(" nop ");
//config codec
while (!MCBSP_xrdy(mhMcbsp));		
MCBSP_write32(mhMcbsp,0x9502014f);// send write_operation instruction 10010100

for(t=0;t<300;t++)
asm(" nop ");
//power contral 1 (Address 02h) 
//while (!MCBSP_xrdy(mhMcbsp));	 
//MCBSP_write16(mhMcbsp,0x02);
//while (!MCBSP_xrdy(mhMcbsp));	 
//MCBSP_write16(mhMcbsp,0x01);//disable every channel
//for(t=0;t<300;t++)
//asm(" nop ");

//MIC power control & speed control (Address 03h)
//while (!MCBSP_xrdy(mhMcbsp));	 
//MCBSP_write16(mhMcbsp,0x43);



//DAC output control(Address 08h)

//DAC control (Address 09h)

//ALCX & PGAX control (Address 0Ah & 0Bh)

//ADCX attenuator (Address 0Ch & 0Dh)

//ADCX mixer volume control (Address 0Eh & 0Fh)

//PCMX mixer volume control (Address 10h & 11h)

//Beep frequency & Timing configuration (Address 12h)

//Beep off time & volume (Address 13h)

//Beep configuration & Tone configuration (Address 14h)

//Tone control (Address 15h)

//AOUTX volume control (Address 16h & 17h)

//PCM channel mixer (Address 18h)

//limiter threshold SZC disable (Address 19h)

//limiter release rate register (Address 1Ah)

//limiter attack rate register (Address 1Bh)

//ALC enable & attack rate (Address 1Ch)

//ALC release rate (Address 1Dh)

//ALC threshold (Address 1Eh)

//Noise fate configuation & misc. (Address 1Fh)

//Status (read only) (Address 20h) 

//Charge pump frequence (Address 21h)

//power contral 1 (Address 02h) 
while (!MCBSP_xrdy(mhMcbsp));	 
MCBSP_write32(mhMcbsp,0x94020000);
for(t=0;t<300;t++)
asm(" nop ");


MCBSP_close(mhMcbsp);

//open mcbsp0
hMcbsp0= MCBSP_open(MCBSP_PORT0, MCBSP_OPEN_RESET);
MCBSP_config(hMcbsp0, &MCBSP1_CONFIG); 


   	MCBSP_start(hMcbsp0, 

        MCBSP_SRGR_START | MCBSP_SRGR_FRAMESYNC
       | MCBSP_RCV_START | MCBSP_XMIT_START, 
        0x3000
        );

MCBSP_close(hMcbsp0);
//while(1);
}

⌨️ 快捷键说明

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