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

📄 mz4e1ip.c

📁 用TMS320F206实现图像等高速上网传输功能
💻 C
📖 第 1 页 / 共 5 页
字号:
         { 
           readbaghead.statuspointer=temp3; 
           readbaghead.receivebaglong=rtl8019dma;   
           readbaghead.sourcenic0=rtl8019dma;   
           readbaghead.sourcenic1=rtl8019dma;
           readbaghead.sourcenic2=rtl8019dma; 
           readbaghead.aimnic0=rtl8019dma; 
           readbaghead.aimnic1=rtl8019dma; 
           readbaghead.aimnic2=rtl8019dma; 
           readbaghead.bagtype=rtl8019dma; 
           if(readbaghead.bagtype==0x0608)        /****------------------arp bag---------****/
           {   
               arpbag.hardtype=rtl8019dma;
               arpbag.protocoltype=rtl8019dma;
               arpbag.addrlong=rtl8019dma;
               arpbag.operatetype=rtl8019dma; 
               if(arpbag.operatetype==0x0200)      /*is arp answer*/          
               {         
                  readbaghead.aimnic0=rtl8019dma;
                  readbaghead.aimnic1=rtl8019dma;  
                  readbaghead.aimnic2=rtl8019dma; 
                  readbaghead.aimip0=rtl8019dma;    
                  readbaghead.aimip1=rtl8019dma; 
                  readbaghead.sourcenic0=rtl8019dma;
                  readbaghead.sourcenic1=rtl8019dma;  
                  readbaghead.sourcenic2=rtl8019dma; 
                  readbaghead.sourceip0=rtl8019dma;    
                  readbaghead.sourceip1=rtl8019dma;  
                  endbagread();
                  if((readbaghead.aimip0==nicaddr.centerip0)&&(readbaghead.aimip1==nicaddr.centerip1))
                  {  
                     nicaddr.centernic0=readbaghead.aimnic0;
                     nicaddr.centernic1=readbaghead.aimnic1;
                     nicaddr.centernic2=readbaghead.aimnic2; 
                  }
               }  
               else if(arpbag.operatetype==0x0100)     /*is arp ask*/
               {     
                  readbaghead.aimnic0=rtl8019dma;
                  readbaghead.aimnic1=rtl8019dma;  
                  readbaghead.aimnic2=rtl8019dma; 
                  readbaghead.aimip0=rtl8019dma;    
                  readbaghead.aimip1=rtl8019dma; 
                  readbaghead.sourcenic0=rtl8019dma;
                  readbaghead.sourcenic1=rtl8019dma;  
                  readbaghead.sourcenic2=rtl8019dma; 
                  readbaghead.sourceip0=rtl8019dma;    
                  readbaghead.sourceip1=rtl8019dma;   
                  endbagread();
                  if((readbaghead.sourceip0==nicaddr.myip0)&&(readbaghead.sourceip1==nicaddr.myip1)) 
                  {     
                    testend();
                    arpanswerin8019();     
                  }    
               }   
               else
               {  
                  endbagread();
               }
           }                                           /****-----------arp bag--------****/
           else if(readbaghead.bagtype==0x0008)        /****------------ip bag--------****/ 
           {         
               readbaghead.ipheadlong=rtl8019dma;
               readbaghead.ipbaglong=rtl8019dma;  
               temp1=rtl8019dma;   
               temp1=rtl8019dma;
               readbaghead.udptcp=rtl8019dma; 
               temp1=rtl8019dma;
               if((readbaghead.udptcp&0xff00)==0x0100)     /***----------ICGMP bag----------***/
               {  
                   readbaghead.aimip0=rtl8019dma;
                   readbaghead.aimip1=rtl8019dma;
                   readbaghead.sourceip0=rtl8019dma;
                   readbaghead.sourceip1=rtl8019dma; 
                   pingbag.type=rtl8019dma; 
                   if((pingbag.type==0x0008)&&(readbaghead.sourceip0==nicaddr.myip0)&&(readbaghead.sourceip1==nicaddr.myip1))
                   {                                 
                     temp1=rtl8019dma;  
                     pingbag.sign=rtl8019dma;   
                     pingbag.sequence=rtl8019dma; 
                     temp2=((readbaghead.ipbaglong&0x00ff)<<8)|((readbaghead.ipbaglong&0xff00)>>8);  
                     temp3=(temp2/2)-14;
                     for(temp1=0;temp1<temp3;temp1++)
                     {    
                        pingbag.data[temp1]=rtl8019dma;
                     }
                     if((temp2%2)!=0)
                     {  
                       pingbag.data[temp1]=rtl8019dma&0x00ff;
                     }   
                     endbagread();  
                     testend();
                     pinganswerin8019();     
                   }
                   else
                   {  
                     endbagread();
                   }     
               }                                              /***----------ICGMP bag----------***/
               else if((readbaghead.udptcp&0xff00)==0x1100)   /***----------UDP bag------------***/
               {
               	  readbaghead.aimip0=rtl8019dma;
                  readbaghead.aimip1=rtl8019dma;
                  readbaghead.sourceip0=rtl8019dma;
                  readbaghead.sourceip1=rtl8019dma; 
                  readbaghead.aimport=rtl8019dma; 
                  readbaghead.sourceport=rtl8019dma;
                  temp1=rtl8019dma; 
                  readbaghead.udpbaglong=((temp1&0x00ff)<<8)|((temp1&0xff00)>>8);
                  temp1=rtl8019dma;     
                  if((readbaghead.sourceport==setipmyport)&&(readbaghead.aimport==downcenterport))
                  {  
                     if((readbaghead.sourceip0==nicaddr.myip0)&&(readbaghead.sourceip1==nicaddr.myip1))
                     {  
                       temp1=rtl8019dma;
                       temp2=rtl8019dma;
                       temp3=rtl8019dma;
                       temp4=rtl8019dma;
                       if((temp1==0x5150)&&(temp2==0x5352)&&(temp3==0x5150)&&(temp4==0x5352))
                       { 
                         temp1=rtl8019dma;  
                         if(temp1==0x0202)
                         {                           
                           temp1=rtl8019dma;   
                           dsp24c02_0=temp1;
                           dsp24c02_1=temp1>>8;
                           temp1=rtl8019dma;   
                           dsp24c02_2=temp1;
                           dsp24c02_3=temp1>>8; 
                           temp1=rtl8019dma;   
                           dsp24c02_4=temp1;
                           dsp24c02_5=temp1>>8; 
                           temp1=rtl8019dma;   
                           dsp24c02_6=temp1;
                           dsp24c02_7=temp1>>8;
                         } 
                         endbagread();   
                       } 
                       else
                       { 
                         endbagread(); 
                       } 
                     }
                     endbagread();      
                  }     
                  else if((readbaghead.sourceport==reportipmyport)&&(readbaghead.aimport==downcenterport))
                  {    
                     temp1=rtl8019dma;
                     temp2=rtl8019dma;
                     temp3=rtl8019dma;
                     temp4=rtl8019dma;
                     if((temp1==0x5150)&&(temp2==0x5352)&&(temp3==0x5150)&&(temp4==0x5352))   
                     { 
                       temp1=rtl8019dma;  
                       if(temp1==0x0303)
                       {   
                         endbagread();                  
                         testend();
                         reportipin8019();                        
                       }     
                       else 
                       {      
                         endbagread();  
                       }
                     } 
                     else
                     {      
                       endbagread();      
                     }
                  }  
                  else
                  {
                    endbagread();   
                  }             
               }                                        /***----------UDP bag------------***/
               else                                     /***--------other ip bag---------***/
               {   
                  endbagread();
               }                                        /***--------other ip bag---------***/ 
           }                         /****--------------ip bag------------****/
           else                      /****--------not arp  and not ip-----****/
           {  
               endbagread();    
           }  
         }                  /****----------next bag pointer right------------****/    
         else               /****---------next bag pointer not right---------****/
         {    
           readbaghead.statuspointer=temp4;  
           endbagread();
         }                  /****---------next bag pointer not right---------****/
       }        
       else     /* -----------receive bag have error----------*/
       {   
         temp3=(temp3&0xff00)>>8;  
         if((temp3!=readbaghead.statuspointer)&&(temp3<=0x007f)&&(temp3>=0x0050))
         { 
           readbaghead.statuspointer=temp3;
           endbagread();                        
         }
         else
         {  
            readbaghead.statuspointer=temp4; 
            endbagread();
         }  
       } 
     } 
   }  
 }           
 
    void  arpin8019()        
    {   
        rtl8019rsar0=0x0000;   
        if(lastsendposition==0x0001)
        {   
          rtl8019rsar1=0x0040;
          lastsendposition=0x0000;     
        }  
        else  
        {   
          rtl8019rsar1=0x0048;
          lastsendposition=0x0001;     
        }      
        rtl8019rbcr0=0x0060;        /* pre set DMA length as 100*/     
        rtl8019rbcr1=0x0000;
        rtl8019cr=0x0012;            
        rtl8019dma=nicaddr.centernic0;
        rtl8019dma=nicaddr.centernic1;
        rtl8019dma=nicaddr.centernic2;
        rtl8019dma=nicaddr.mynic0; 
        rtl8019dma=nicaddr.mynic1;
        rtl8019dma=nicaddr.mynic2;
        rtl8019dma=0x0608; 
        rtl8019dma=0x0100;
        rtl8019dma=0x0008; 
        rtl8019dma=0x0406;
        rtl8019dma=0x0100; 
        rtl8019dma=nicaddr.mynic0; 
        rtl8019dma=nicaddr.mynic1;     
        rtl8019dma=nicaddr.mynic2;
        rtl8019dma=nicaddr.myip0;
        rtl8019dma=nicaddr.myip1;  
        rtl8019dma=0x0000; 
        rtl8019dma=0x0000; 
        rtl8019dma=0x0000; 
        rtl8019dma=nicaddr.centerip0;
        rtl8019dma=nicaddr.centerip1; 
        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;       
        rtl8019tbcr0=0x003c;  /*send out*/  
        rtl8019tbcr1=0x0000;
        rtl8019tpsr=0x0040;   
        if(lastsendposition==0x0001)
        { 
          rtl8019tpsr=0x0048;    
        }        
        rtl8019cr=0x0026;         /*------------start send out----------*/
        settime(0x0002);                  
    } 
  
    void arpanswerin8019()
    {    
        rtl8019rsar0=0x0000;
        if(lastsendposition==0x0001)
        {   
          rtl8019rsar1=0x0040;
          lastsendposition=0x0000;     
        }  
        else  
        {   
          rtl8019rsar1=0x0048;
          lastsendposition=0x0001;     
        }       
        rtl8019rbcr0=0x0060;        /* pre set DMA length as 100*/
        rtl8019rbcr1=0x0000;
        rtl8019cr=0x0012;            
        rtl8019dma=readbaghead.aimnic0;
        rtl8019dma=readbaghead.aimnic1;
        rtl8019dma=readbaghead.aimnic2;
        rtl8019dma=nicaddr.mynic0; 
        rtl8019dma=nicaddr.mynic1;
        rtl8019dma=nicaddr.mynic2; 
        rtl8019dma=0x0608; 
        rtl8019dma=0x0100;
        rtl8019dma=0x0008; 
        rtl8019dma=0x0406;
        rtl8019dma=0x0200; 
        rtl8019dma=nicaddr.mynic0;
        rtl8019dma=nicaddr.mynic1;
        rtl8019dma=nicaddr.mynic2; 
        rtl8019dma=nicaddr.myip0;
        rtl8019dma=nicaddr.myip1;
        rtl8019dma=readbaghead.aimnic0; 
        rtl8019dma=readbaghead.aimnic1; 
        rtl8019dma=readbaghead.aimnic2; 
        rtl8019dma=readbaghead.aimip0;
        rtl8019dma=readbaghead.aimip1;
        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;       
        rtl8019tbcr0=0x003c;  /*send out*/  
        rtl8019tbcr1=0x0000;  
        rtl8019tpsr=0x0040; 
        if(lastsendposition==0x0001)
        { 
          rtl8019tpsr=0x0048;    
        }        
        rtl8019cr=0x0026;         /*------------start send out----------*/
        settime(0x0002);                  
    }   
    

⌨️ 快捷键说明

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