📄 mz4e1ip.c
字号:
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=alarmmyport; /*udp head*/
rtl8019dma=alarmcenterport;
temp1=readbaghead.alarmlong+0x0008;
rtl8019dma=((temp1&0x00ff)<<8)|((temp1&0xff00)>>8);
rtl8019dma=0x0000;
temp2=readbaghead.alarmused/2;
for(temp1=0;temp1<temp2;temp1++)
{
temp3=dspalarm&0x00ff; /*alarm high 8 bit must link low*/
temp4=(dspalarm&0x00ff)<<8;
rtl8019dma=temp3|temp4;
}
if((readbaghead.alarmused%2)!=0x0000)
{
rtl8019dma=dspalarm&0x00ff;
}
rtl8019dma=0x0000;
rtl8019dma=0x0000;
rtl8019dma=0x0000;
rtl8019dma=0x0000;
rtl8019dma=0x0000;
rtl8019dma=0x0000;
rtl8019dma=0x0000;
rtl8019dma=0x0000;
rtl8019dma=0x0000;
rtl8019rbcr0=0x0000; /*DMA end*/
rtl8019rbcr1=0x0000;
rtl8019cr=0x0022;
temp1=readbaghead.alarmlong+0x002a;
rtl8019tbcr0=temp1&0x00ff; /*send out position and length*/
rtl8019tbcr1=(temp1&0xff00)>>8;
rtl8019tpsr=0x0040;
if(lastsendposition==0x0001)
{
rtl8019tpsr=0x0048;
}
rtl8019cr=0x0026; /*------------start send out----------*/
settime(0x0004);
}
void reportipin8019()
{
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=0x2e00;
crccreat.crctotal+=0x002e;
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+=((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;
rtl8019dma=reportipmyport; /*udp head*/
rtl8019dma=reportipcenterport;
temp1=0x0012+0x0008; /*----udp long-------*/
rtl8019dma=((temp1&0x00ff)<<8)|((temp1&0xff00)>>8);
rtl8019dma=0x0000; /*----udp crc----*/
rtl8019dma=0x5150;
rtl8019dma=0x5352;
rtl8019dma=0x5150;
rtl8019dma=0x5352;
rtl8019dma=0x0303;
rtl8019dma=nicaddr.myip0;
rtl8019dma=nicaddr.myip1;
rtl8019dma=nicaddr.centerip0;
rtl8019dma=nicaddr.centerip1;
rtl8019rbcr0=0x0000; /*DMA end*/
rtl8019rbcr1=0x0000;
rtl8019cr=0x0022;
rtl8019tbcr0=0x003c; /*send out position and length*/
rtl8019tbcr1=0x0000;
rtl8019tpsr=0x0040;
if(lastsendposition==0x0001)
{
rtl8019tpsr=0x0048;
}
rtl8019cr=0x0026; /*------------start send out----------*/
settime(0x0002);
}
void delay1us() /*delay 3us*/
{
temp1++;
temp1++;
temp1++;
temp1++;
temp1++;
temp1++;
temp1++;
temp1++;
temp1++;
temp1++;
temp1++;
temp1++;
temp1++;
temp1++;
temp1++;
temp1++;
temp1++;
temp1++;
temp1++;
temp1++;
temp1++;
temp1++;
temp1++;
temp1++;
temp1++;
temp1++;
temp1++;
temp1++;
temp1++;
temp1++;
temp1++;
temp1++;
}
void delay(unsigned int timen100us) /*delay 100us*/
{
for(temp3=0;temp3<timen100us;temp3++)
{
for(temp2=0;temp2<0x0042;temp2++)
{
temp1++;
temp1++;
temp1++;
temp1++;
temp1++;
temp1++;
temp1++;
temp1++;
}
}
}
void settime(unsigned int n100us) /*timer set time*/
{
temp1=rtl8019isr; /*send end*/
while((temp1&0x000a)==0)
{
temp1=rtl8019isr;
}
dsptcr=0x0fff;
dspifr=0x0004; /*clr the Tint flag bit*/
dspprd=0x0bff;
dsptim=0x0bff; /* 120us*n */
dsptcr=0x0fe0|(n100us-1);
}
void dog_wrongcheck() /*20480 time not correct read---reset---min 819ms*/
{
if(fpgareply==0xcccc)
{
dogcounter=0x0000;
}
else
{
dogcounter++;
if(dogcounter>=0x5000)
{
asm(" clrc xf");
dogcounter=0x0000;
delay(0x0001);
asm(" setc xf");
delay(0x0a00); /* delay 256ms---for FPGA download end---*/
}
}
}
void endbagread()
{
rtl8019cr=0x0022;
rtl8019rbcr0=0x0000;
rtl8019rbcr1=0x0000;
if(readbaghead.statuspointer>0x0050)
{
rtl8019bnry=readbaghead.statuspointer-1;
}
else
{
rtl8019bnry=0x007f;
}
}
void testend()
{
temp1=dspifr&0x0004;
while(temp1==0)
{
temp1=dspifr&0x0004;
}
}
void comread()
{
if(comtimer<0x1fff) /*-----least than 400ms data in one group---*/
{
comtimer++;
temp1=dspiosr&0x0100;
if(temp1!=0)
{
comtimer=0x0000;
if(comcounter<0x000c)
{
comdata[comcounter]=dspadtr&0x00ff;
comcounter++;
}
else if(comcounter=0x000c)
{
comdata[comcounter]=dspadtr&0x00ff;
comcounter=0x0000;
temp1=dspcommycode;
if((comdata[0]==0x0051)&&(comdata[1]==0x0052)&&(comdata[2]==0x0053)&&(comdata[3]==0x0054)&&(comdata[4]==temp1))
{
dsp24c02_0=comdata[5];
dsp24c02_1=comdata[6];
dsp24c02_2=comdata[7];
dsp24c02_3=comdata[8];
dsp24c02_4=comdata[9];
dsp24c02_5=comdata[10];
dsp24c02_6=comdata[11];
dsp24c02_7=comdata[12];
dspadtr=0x0051; /*---write end answer---*/
}
}
else
{
comcounter=0x0000;
temp1=dspadtr;
}
}
}
else /*-------over 400ms another group---------*/
{
comcounter=0x0000;
comtimer=0x0000;
temp1=dspiosr&0x0100;
if(temp1!=0)
{
comdata[comcounter]=dspadtr&0x00ff;
comcounter++;
}
}
}
void initiale1single()
{
dspe1addr=e1ccr2;
dspe1data=0x0004;
delay(0x00a0);
dspe1addr=e1imr1; /*int mask----------clr all------------*/
dspe1data=0x0000;
delay1us();
dspe1addr=e1imr2;
dspe1data=0x0000;
delay1us();
dspe1addr=e1rir;
dspe1data=0x0000;
delay1us();
dspe1addr=e1rcr1;
dspe1data=0x0000;
delay1us();
dspe1addr=e1rcr2;
dspe1data=0x0000;
delay1us();
dspe1addr=e1tcr1;
dspe1data=0x0000;
delay1us();
dspe1addr=e1tcr2;
dspe1data=0x0000;
delay1us();
dspe1addr=e1ccr1;
dspe1data=0x0000;
delay1us();
dspe1addr=e1ccr3;
dspe1data=0x0000;
delay1us();
dspe1addr=e1test1;
dspe1data=0x0000;
delay1us();
dspe1addr=e1test2;
dspe1data=0x0000;
delay1us();
dspe1addr=e1licr;
dspe1data=0x0000;
delay1us();
dspe
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -