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

📄 mz4e1ip.c

📁 用TMS320F206实现图像等高速上网传输功能
💻 C
📖 第 1 页 / 共 5 页
字号:
                    }      
                  }     
               }                          
               else
               {                                                 
                  endbagread();       
               }
           }
           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.sourceip0==nicaddr.myip0)&&(readbaghead.sourceip1==nicaddr.myip1))    /*------------my ip------------*/
                  {
                    if((readbaghead.aimip0==nicaddr.centerip0)&&(readbaghead.aimip1==nicaddr.centerip1))/*--*--------center ip------*--*/
                    {
                      if((readbaghead.sourceport==sounddownmyport)&&(readbaghead.aimport==downsoundcenterport))
                      {
                        temp2=(readbaghead.udpbaglong-0x0008)/2;	
                        for(temp1=0;temp1<temp2;temp1++)	
                        {
                          dspsounddown=rtl8019dma;   
                        }    
                        endbagread();	   
                      }
                      else if((readbaghead.sourceport==controlmyport)&&(readbaghead.aimport==downcenterport))
                      {
                        temp2=(readbaghead.udpbaglong-0x0008)/2;	
                        for(temp1=0;temp1<temp2;temp1++)	
                        {
                          temp3=rtl8019dma;  
                          dspcontrol=temp3;
                          dspcontrol=temp3>>8;                        
                        }
                        if(((readbaghead.udpbaglong-0x0008)%2)!=0x0000)
                        {
                          temp3=rtl8019dma;  
                          dspcontrol=temp3;
                        } 
                        endbagread();	 
                      }   
                      else if((readbaghead.sourceport==resetmyport)&&(readbaghead.aimport==downcenterport))
                      {    
                         temp1=rtl8019dma;
                         temp2=rtl8019dma;
                         temp3=rtl8019dma;
                         temp4=rtl8019dma;
                         if((temp1==0x5150)&&(temp2==0x5352)&&(temp3==0x5150)&&(temp4==0x5352))
                         { 
                           temp1=rtl8019dma;  
                           if(temp1==0x0101)
                           {  
                             asm(" clrc xf");  
                             delay(0x0001);    
                             asm(" setc xf");        
                             delay(0x0a00);   
                           }
                         } 
                         endbagread();
                      }    
                      else if((readbaghead.sourceport==setipmyport)&&(readbaghead.aimport==downcenterport))
                      {    
                         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();                        
                         } 
                         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();  	   
                      }			 	
                    }                /*--*----------center ip--------*--*/ 
                    else             /*--*--------not center ip------*--*/  
                    {   
                      if((readbaghead.sourceport==setipmyport)&&(readbaghead.aimport==downcenterport))
                      {    
                         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();                        
                         } 
                         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();  	   
                      }			 
                    }                /*--*--------not center ip------*--*/
                  }                  /*--------------------------my ip----------------------*/
                  else               /*-----------------------not my ip----------------------*/
                  {       
                    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();    	   
                    }			 	
                  } 		       /*-----------------------not my ip----------------------*/
               }                  /**---------------UDP bag-----------------**/
               else               /**---------------other ip bag------------**/
               {   
                  endbagread();
               }                  /**---------------other ip bag------------**/
           }                      /***------------------------ip bag-------------------***/
           else                   /***---------------------not arp  and not ip---------***/
           {  
               endbagread();
           }                      /***---------------------not arp  and not ip---------***/
         }                        /****------------next bag pointer right-------------****/
         else                     /****------------next bag pointer not correct-------****/
         {    
           readbaghead.statuspointer=temp4;
           endbagread();
         }                        /****------------next bag pointer not correct---------****/
       }                          /*****----------------correct bag deal with end------*****/      
       else                       /*****----------------receive bag error--------------*****/
       {   
         temp3=(temp3&0xff00)>>8;  
         if((temp3!=readbaghead.statuspointer)&&(temp3<=0x007f)&&(temp3>=0x0050))
         { 
           readbaghead.statuspointer=temp3;
           endbagread(); 
         }
         else
         {  
            readbaghead.statuspointer=temp4; 
            endbagread();
         }  
       }      /*****--------------------receive bag error---------*****/
     }        /******-----------------deal with accept packet-------******/ 
   }          /*******------------------------while end------------*******/  
 }    /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% main end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/  
  
   
 
/*------------------------------------subprogramme----------------------------------*/
 void arpcenter()
 {   
   rtl8019cr=0x0022;   
   while((nicaddr.centernic2==0xffff)&&(nicaddr.centernic1==0xffff)&&(nicaddr.centernic0==0xffff)) 
   {     
   /*--------------------------dog check--------------------------*/  
     dog_wrongcheck();          
     comread();             
   /*---------------------------------------------------------------*/   
     arpcounter++;        
     delay(0x0001);         /*----------100us*6100=610ms---send a ARP----*/
     if(arpcounter>=0x1800)                    
     { 
       testend();
       arpin8019();      
       dsparpsend=0x4444;      /*---send a arp wr fpga---*/      
       arpcounter=0x0000;            
     }   
  /*----------------judge accept bag or not and read bag out rtl8019-------------*/
     rtl8019cr=0x0062;
     temp4=rtl8019curr&0x00ff; 
     rtl8019cr=0x0022;  
     if(temp4!=readbaghead.statuspointer)          
     {   
       rtl8019rsar0=0x0000; 
       rtl8019rsar1=readbaghead.statuspointer;  
       rtl8019rbcr0=0x0040;        /* pre set DMA length as 1600*/
       rtl8019rbcr1=0x0006;  
       rtl8019cr=0x000a; 
       temp3=rtl8019dma; 
       if((temp3&0x0001)==1)       /* ------------receive bag no error------------*/ 
       {
         temp3=(temp3&0xff00)>>8;
         if((temp3!=readbaghead.statuspointer)&&(temp3<=0x007f)&&(temp3>=0x0050))   /*-------next bag pointer right---------*/

⌨️ 快捷键说明

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