本人比较小白 实在看不懂下面这段代码 希望大侠 能帮分析下~~~谢谢了~
代码如下:
_WrL3Addr(0x14 + 0); //DATA0 (000101xx+00)
_WrL3Data(0xc2,0); // 1100 0010: DATA0, Extended addr(010)
_WrL3Data(0xf2,0); // 111 111 01: DATA0, MS=9dB, Ch1=on Ch2=on
_WrL3Data(0xc4,0); // 1100 0010: DATA0, Extended addr(010)
_WrL3Data(0xE0,0); // 111 111 01: DATA0, MS=9dB, Ch1=on Ch2=on
_WrL3Data(0xc5,0); // 1100 0010: DATA0, Extended addr(010)
_WrL3Data(0xE0,0); // 111 111 01: DATA0, MS=9dB, Ch1=on Ch2=on
RETAILMSG(DBG_ON, (TEXT("-IIS InitCodec\r\n")));
函数定义如下:
void _WrL3Data(unsigned char data,int halt)
{
volatile int i,j;
if(halt)
{
g_pIOPregs->GPGDAT = g_pIOPregs->GPGDAT & ~(L3D | L3M | L3C) | L3C; //L3C=H(while tstp, L3 interface halt condition)
for(j=0;j<4;j++); //tstp(L3) > 190ns
}
g_pIOPregs->GPGDAT = g_pIOPregs->GPGDAT & ~(L3D | L3M | L3C) | (L3C | L3M); //L3M=H(in data transfer mode)
for(j=0;j<4;j++); //tsu(L3)D > 190ns
//GPG[2:0]=L3C:L3D:L3M
for(i=0;i<8;i++)
{
if(data & 0x1) //if data's LSB is 'H'
{
g_pIOPregs->GPGDAT &= ~L3C; //L3C=L
g_pIOPregs->GPGDAT |= L3D; //L3D=H
for(j=0;j<4;j++); //tcy(L3) > 500ns
g_pIOPregs->GPGDAT |= (L3C | L3D); //L3C=H,L3D=H
for(j=0;j<4;j++); //tcy(L3) > 500ns
}
else //If data's LSB is 'L'
{
g_pIOPregs->GPGDAT &= ~L3C; //L3C=L
g_pIOPregs->GPGDAT &= ~L3D; //L3D=L
for(j=0;j<4;j++); //tcy(L3) > 500ns
g_pIOPregs->GPGDAT |= L3C; //L3C=H
g_pIOPregs->GPGDAT &= ~L3D; //L3D=L
for(j=0;j<4;j++); //tcy(L3) > 500ns
}
data >>= 1; //For check next bit
}
g_pIOPregs->GPGDAT = g_pIOPregs->GPGDAT & ~(L3D | L3M | L3C) | (L3C | L3M); //L3M=H,L3C=H
}
。。。没有人知道吗? 帮帮忙,,,
_WrL3Data(0xf2,0); 这个函数没有人用过吗。。。