📄 mz4e1ip.c
字号:
void pinganswerin8019()
{
rtl8019rsar0=0x0000;
if(lastsendposition==0x0001)
{
rtl8019rsar1=0x0040;
lastsendposition=0x0000;
}
else
{
rtl8019rsar1=0x0048;
lastsendposition=0x0001;
}
rtl8019rbcr0=0x0080; /* pre set DMA length as 128*/
rtl8019rbcr1=0x0000;
rtl8019cr=0x0012;
crccreat.crctotal=0x00000000;
rtl8019dma=readbaghead.aimnic0; /*nic head*/
rtl8019dma=readbaghead.aimnic1;
rtl8019dma=readbaghead.aimnic2;
rtl8019dma=nicaddr.mynic0;
rtl8019dma=nicaddr.mynic1;
rtl8019dma=nicaddr.mynic2;
rtl8019dma=0x0008;
rtl8019dma=0x0045; /*ip head*/
crccreat.crctotal+=0x4500;
rtl8019dma=readbaghead.ipbaglong;
crccreat.crctotal+=(((readbaghead.ipbaglong&0xff00)>>8)|((readbaghead.ipbaglong&0x00ff)<<8));
crccreat.crctotal+=nicaddr.ipsequence;
rtl8019dma=((nicaddr.ipsequence&0x00ff)<<8)|((nicaddr.ipsequence&0xff00)>>8);
nicaddr.ipsequence++;
rtl8019dma=0x0000;
rtl8019dma=0x0180;
crccreat.crctotal+=0x8001;
crccreat.crctotal+=((nicaddr.myip0&0x00ff)<<8)|((nicaddr.myip0&0xff00)>>8);
crccreat.crctotal+=((nicaddr.myip1&0x00ff)<<8)|((nicaddr.myip1&0xff00)>>8);
crccreat.crctotal+=((readbaghead.aimip0&0x00ff)<<8)|((readbaghead.aimip0&0xff00)>>8);
crccreat.crctotal+=((readbaghead.aimip1&0x00ff)<<8)|((readbaghead.aimip1&0xff00)>>8);
crccreat.devide.wordlow+=crccreat.devide.wordhigh;
temp1=0xffff-crccreat.devide.wordlow;
rtl8019dma=((temp1&0x00ff)<<8)|((temp1&0xff00)>>8); /*---crc---*/
rtl8019dma=nicaddr.myip0;
rtl8019dma=nicaddr.myip1;
rtl8019dma=readbaghead.aimip0;
rtl8019dma=readbaghead.aimip1;
crccreat.crctotal=0x00000000; /*start to place ping*/
rtl8019dma=0x0000;
crccreat.crctotal+=((pingbag.sign&0x00ff)<<8)|((pingbag.sign&0xff00)>>8);
crccreat.crctotal+=((pingbag.sequence&0x00ff)<<8)|((pingbag.sequence&0xff00)>>8);
temp2=((readbaghead.ipbaglong&0x00ff)<<8)|((readbaghead.ipbaglong&0xff00)>>8);
temp2=((temp2+1)/2)-14;
for(temp1=0;temp1<temp2;temp1++)
{
crccreat.crctotal+=(((pingbag.data[temp1]&0x00ff)<<8)|((pingbag.data[temp1]&0xff00)>>8));
}
crccreat.devide.wordlow+=crccreat.devide.wordhigh;
temp1=0xffff-crccreat.devide.wordlow;
rtl8019dma=((temp1&0x00ff)<<8)|((temp1&0xff00)>>8);
rtl8019dma=pingbag.sign;
rtl8019dma=pingbag.sequence;
for(temp1=0;temp1<temp2;temp1++)
{
rtl8019dma=pingbag.data[temp1];
}
rtl8019rbcr0=0x0000; /*DMA end*/
rtl8019rbcr1=0x0000;
rtl8019cr=0x0022;
rtl8019tbcr0=(((readbaghead.ipbaglong&0x00ff)<<8)|((readbaghead.ipbaglong&0xff00)>>8))+14; /*send out*/
rtl8019tbcr1=0x0000;
rtl8019tpsr=0x0040;
if(lastsendposition==0x0001)
{
rtl8019tpsr=0x0048;
}
rtl8019cr=0x0026; /*------------start send out----------*/
settime(0x0002);
}
void vediobagin8019()
{
rtl8019rsar0=0x0000;
if(lastsendposition==0x0001)
{
rtl8019rsar1=0x0040;
lastsendposition=0x0000;
}
else
{
rtl8019rsar1=0x0048;
lastsendposition=0x0001;
}
rtl8019rbcr0=0x0030; /* pre set DMA length as 1072*/
rtl8019rbcr1=0x0004;
rtl8019cr=0x0012;
crccreat.crctotal=0x00000000; /*nic head*/
rtl8019dma=nicaddr.centernic0;
rtl8019dma=nicaddr.centernic1;
rtl8019dma=nicaddr.centernic2;
rtl8019dma=nicaddr.mynic0;
rtl8019dma=nicaddr.mynic1;
rtl8019dma=nicaddr.mynic2;
rtl8019dma=0x0008;
rtl8019dma=0x0045; /*ip head*/
crccreat.crctotal+=0x4500;
rtl8019dma=0x1c04;
crccreat.crctotal+=0x041c;
crccreat.crctotal+=nicaddr.ipsequence;
rtl8019dma=((nicaddr.ipsequence&0x00ff)<<8)|((nicaddr.ipsequence&0xff00)>>8);
nicaddr.ipsequence++;
rtl8019dma=0x0000;
rtl8019dma=0x1180;
crccreat.crctotal+=0x8011;
crccreat.crctotal+=((nicaddr.myip0&0x00ff)<<8)|((nicaddr.myip0&0xff00)>>8);
crccreat.crctotal+=((nicaddr.myip1&0x00ff)<<8)|((nicaddr.myip1&0xff00)>>8);
crccreat.crctotal+=((nicaddr.centerip0&0x00ff)<<8)|((nicaddr.centerip0&0xff00)>>8);
crccreat.crctotal+=((nicaddr.centerip1&0x00ff)<<8)|((nicaddr.centerip1&0xff00)>>8);
crccreat.devide.wordlow+=crccreat.devide.wordhigh;
temp1=0xffff-crccreat.devide.wordlow;
rtl8019dma=((temp1&0x00ff)<<8)|((temp1&0xff00)>>8); /*---crc---*/
rtl8019dma=nicaddr.myip0;
rtl8019dma=nicaddr.myip1;
rtl8019dma=nicaddr.centerip0;
rtl8019dma=nicaddr.centerip1;
rtl8019dma=vediomyport; /*udp head*/
rtl8019dma=vediocenterport;
rtl8019dma=0x0804;
rtl8019dma=0x0000;
for(temp1=0;temp1<16;temp1++)
{
rtl8019dma=dspvedio;
rtl8019dma=dspvedio;
rtl8019dma=dspvedio;
rtl8019dma=dspvedio;
rtl8019dma=dspvedio;
rtl8019dma=dspvedio;
rtl8019dma=dspvedio;
rtl8019dma=dspvedio;
rtl8019dma=dspvedio;
rtl8019dma=dspvedio;
rtl8019dma=dspvedio;
rtl8019dma=dspvedio;
rtl8019dma=dspvedio;
rtl8019dma=dspvedio;
rtl8019dma=dspvedio;
rtl8019dma=dspvedio;
rtl8019dma=dspvedio;
rtl8019dma=dspvedio;
rtl8019dma=dspvedio;
rtl8019dma=dspvedio;
rtl8019dma=dspvedio;
rtl8019dma=dspvedio;
rtl8019dma=dspvedio;
rtl8019dma=dspvedio;
rtl8019dma=dspvedio;
rtl8019dma=dspvedio;
rtl8019dma=dspvedio;
rtl8019dma=dspvedio;
rtl8019dma=dspvedio;
rtl8019dma=dspvedio;
rtl8019dma=dspvedio;
rtl8019dma=dspvedio;
}
dspvedioend=0x0f0f;
rtl8019rbcr0=0x0000; /*DMA end*/
rtl8019rbcr1=0x0000;
rtl8019cr=0x0022;
rtl8019tbcr0=0x002a; /*send out*/
rtl8019tbcr1=0x0004;
rtl8019tpsr=0x0040;
if(lastsendposition==0x0001)
{
rtl8019tpsr=0x0048;
}
rtl8019cr=0x0026; /*------------start send out----------*/
settime(0x0007);
}
void soundupbagin8019()
{
rtl8019rsar0=0x0000;
if(lastsendposition==0x0001)
{
rtl8019rsar1=0x0040;
lastsendposition=0x0000;
}
else
{
rtl8019rsar1=0x0048;
lastsendposition=0x0001;
}
rtl8019rbcr0=0x0030; /* pre set DMA length as 1072*/
rtl8019rbcr1=0x0004;
rtl8019cr=0x0012;
crccreat.crctotal=0x00000000; /*nic head*/
rtl8019dma=nicaddr.centernic0;
rtl8019dma=nicaddr.centernic1;
rtl8019dma=nicaddr.centernic2;
rtl8019dma=nicaddr.mynic0;
rtl8019dma=nicaddr.mynic1;
rtl8019dma=nicaddr.mynic2;
rtl8019dma=0x0008;
rtl8019dma=0x0045; /*ip head*/
crccreat.crctotal+=0x4500;
rtl8019dma=0x1c04;
crccreat.crctotal+=0x041c;
crccreat.crctotal+=nicaddr.ipsequence;
rtl8019dma=((nicaddr.ipsequence&0x00ff)<<8)|((nicaddr.ipsequence&0xff00)>>8);
nicaddr.ipsequence++;
rtl8019dma=0x0000;
rtl8019dma=0x1180;
crccreat.crctotal+=0x8011;
crccreat.crctotal+=((nicaddr.myip0&0x00ff)<<8)|((nicaddr.myip0&0xff00)>>8);
crccreat.crctotal+=((nicaddr.myip1&0x00ff)<<8)|((nicaddr.myip1&0xff00)>>8);
crccreat.crctotal+=((nicaddr.centerip0&0x00ff)<<8)|((nicaddr.centerip0&0xff00)>>8);
crccreat.crctotal+=((nicaddr.centerip1&0x00ff)<<8)|((nicaddr.centerip1&0xff00)>>8);
crccreat.devide.wordlow+=crccreat.devide.wordhigh;
temp1=0xffff-crccreat.devide.wordlow;
rtl8019dma=((temp1&0x00ff)<<8)|((temp1&0xff00)>>8); /*---crc---*/
rtl8019dma=nicaddr.myip0;
rtl8019dma=nicaddr.myip1;
rtl8019dma=nicaddr.centerip0;
rtl8019dma=nicaddr.centerip1;
rtl8019dma=soundupmyport; /*udp head*/
rtl8019dma=soundupcenterport;
rtl8019dma=0x0804;
rtl8019dma=0x0000;
for(temp1=0;temp1<16;temp1++)
{
rtl8019dma=dspsoundup;
rtl8019dma=dspsoundup;
rtl8019dma=dspsoundup;
rtl8019dma=dspsoundup;
rtl8019dma=dspsoundup;
rtl8019dma=dspsoundup;
rtl8019dma=dspsoundup;
rtl8019dma=dspsoundup;
rtl8019dma=dspsoundup;
rtl8019dma=dspsoundup;
rtl8019dma=dspsoundup;
rtl8019dma=dspsoundup;
rtl8019dma=dspsoundup;
rtl8019dma=dspsoundup;
rtl8019dma=dspsoundup;
rtl8019dma=dspsoundup;
rtl8019dma=dspsoundup;
rtl8019dma=dspsoundup;
rtl8019dma=dspsoundup;
rtl8019dma=dspsoundup;
rtl8019dma=dspsoundup;
rtl8019dma=dspsoundup;
rtl8019dma=dspsoundup;
rtl8019dma=dspsoundup;
rtl8019dma=dspsoundup;
rtl8019dma=dspsoundup;
rtl8019dma=dspsoundup;
rtl8019dma=dspsoundup;
rtl8019dma=dspsoundup;
rtl8019dma=dspsoundup;
rtl8019dma=dspsoundup;
rtl8019dma=dspsoundup;
}
rtl8019rbcr0=0x0000; /*DMA end*/
rtl8019rbcr1=0x0000;
rtl8019cr=0x0022;
rtl8019tbcr0=0x002a; /*send out*/
rtl8019tbcr1=0x0004;
rtl8019tpsr=0x0040;
if(lastsendposition==0x0001)
{
rtl8019tpsr=0x0048;
}
rtl8019cr=0x0026; /*------------start send out----------*/
settime(0x0007);
}
void alarmbagin8019()
{
rtl8019rsar0=0x0000;
if(lastsendposition==0x0001)
{
rtl8019rsar1=0x0040;
lastsendposition=0x0000;
}
else
{
rtl8019rsar1=0x0048;
lastsendposition=0x0001;
}
rtl8019rbcr0=0x0030; /* pre set DMA length as 1072*/
rtl8019rbcr1=0x0004;
rtl8019cr=0x0012;
crccreat.crctotal=0x00000000; /*nic head*/
rtl8019dma=nicaddr.centernic0;
rtl8019dma=nicaddr.centernic1;
rtl8019dma=nicaddr.centernic2;
rtl8019dma=nicaddr.mynic0;
rtl8019dma=nicaddr.mynic1;
rtl8019dma=nicaddr.mynic2;
rtl8019dma=0x0008;
rtl8019dma=0x0045; /*ip head*/
crccreat.crctotal+=0x4500;
temp1=dspalarmused&0x03ff; /*10 addr line | avoid alarmused changing*/
temp2=dspalarmused&0x03ff; /*10 addr line*/
while(temp1!=temp2)
{
temp1=dspalarmused&0x03ff; /*10 addr line*/
temp2=dspalarmused&0x03ff; /*10 addr line*/
}
readbaghead.alarmused=temp1;
if(readbaghead.alarmused<0x0012)
{
readbaghead.alarmlong=0x0012;
}
else
{
readbaghead.alarmlong=readbaghead.alarmused;
}
temp1=readbaghead.alarmlong+0x001c;
crccreat.crctotal+=temp1;
rtl8019dma=((temp1&0x00ff)<<8)|((temp1&0xff00)>>8);
crccreat.crctotal+=nicaddr.ipsequence;
rtl8019dma=((nicaddr.ipsequence&0x00ff)<<8)|((nicaddr.ipsequence&0xff00)>>8);
nicaddr.ipsequence++;
rtl8019dma=0x0000;
rtl8019dma=0x1180;
crccreat.crctotal+=0x8011;
crccreat.crctotal+=((nicaddr.myip0&0x00ff)<<8)|((nicaddr.myip0&0xff00)>>8);
crccreat.crctotal+=((nicaddr.myip1&0x00ff)<<8)|((nicaddr.myip1&0xff00)>>8);
crccreat.crctotal+=((nicaddr.centerip0&0x00ff)<<8)|((nicaddr.centerip0&0xff00)>>8);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -