void InitMcBSP0(void)
{
SetMcBSPReg(0,SPCR1,0x00);
SetMcBSPReg(0,SPCR2,0x00);
/*SET McBSP0*/
SetMcBSPReg(0,SPCR1,0x00);
SetMcBSPReg(0,SPCR2,0x0200);
SetMcBSPReg(0,PCR,0x0A00);
SetMcBSPReg(0,RCR1,0x40);
SetMcBSPReg(0,RCR2,0x41);
SetMcBSPReg(0,XCR1,0x40);
SetMcBSPReg(0,XCR2,0x41);
SetMcBSPReg(0,SRGR1,0x1027); ////FWID=1+1;CLKDGV=39+1,SCLK = CPU CLK /(CLKDGV+1) =1MhZ
SetMcBSPReg(0,SRGR2,0x02027);
}
void StartMcBSP0(void)
{
/* 开始McBSP0发送和采集数据 */
SetMcBSPReg(0,SPCR2,0xC0);
SetMcBSPReg(0,SPCR1,0x01);
SetMcBSPReg(0,SPCR2,0xc1);
/* ***************************/
}
void StopMcBSP0()
{
SetMcBSPReg(0,SPCR1,0x00);
SetMcBSPReg(0,SPCR2,0x00);
}
void StartDataCollect(void)
{
SetMcBSPReg(1,SPCR2,0xC0);
SetMcBSPReg(1,SPCR1,0x01);
SetMcBSPReg(1,SPCR2,0xc1);
}
void StopDataCollect()
{
SetMcBSPReg(1,SPCR1,0x0);
SetMcBSPReg(1,SPCR2,0x0);
}
void SetMcBSPReg(unsigned int McBSPNo,unsigned int McBSPReg,unsigned int Value)
{
switch(McBSPNo)
{
case 0: {
SPSA0 = McBSPReg;
C_NOP;C_NOP;C_NOP; C_NOP;C_NOP;C_NOP;
SPSD0 = Value;
C_NOP;C_NOP;C_NOP; C_NOP;C_NOP;C_NOP;
}
break;
case 1: {
SPSA1 = McBSPReg;
C_NOP;C_NOP;C_NOP; C_NOP;C_NOP;C_NOP;
SPSD1 = Value;
C_NOP;C_NOP;C_NOP; C_NOP;C_NOP;C_NOP;
}
break;
default:
break;
}
} |