亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? if_cs.c

?? 這是一個在VxWorks系統(tǒng)實現(xiàn)CS網(wǎng)卡END驅(qū)動的原代碼
?? C
?? 第 1 頁 / 共 5 頁
字號:

	       /* Free the bad mbuf chain */
	       m_freem( pMbuf );
	    }
	    else
	    {
	       /* queue the mbuf chain to be freed at task level */
	       csEnqueue( pCS->pTxBuffFreeList, pMbuf );
	    }

	    /* Update output stats */
  /* @kml	 The definition of the MIB-II variable ifOutUcastPkts in Interface
	   group from RFC 1158 is "The total  number of  packets that higher-level 
	   protocols requested be transmitted to a subnetwork-unicast address, 
	   INCLUDE those that were discarded or not sent."*/

	   /* pCS->ArpCom.ac_if.if_opackets--;*/
	    pCS->ArpCom.ac_if.if_oerrors++;

	    LOGMSG("csStartOutput: unit %d, Transmit bid error (too big)\n",
	       pCS->ArpCom.ac_if.if_unit, 0,0,0,0,0 );

	    /* Loop up to transmit the next chain */
	 }
	 else
	 {
	    /* Start the TX on Rdy4Tx interrupt */
	    /* TX buff space not available now. */

	    /* Mark TX as in progress */
	    pCS->TxInProgress = TRUE;

	    if ( !pCS->InISR )
	    {
	       /* Re-enable interrupts at the CPU */
	       intUnlock( State );
	    }
	    
	    /* Exit loop */
	    break;
	 }
      }
   }
}



/*******************************************************************************
*
* csCopyTxFrame -
*
* This routine copies the packet from a chain of mbufs to the chip.  When all
* the data has been copied, then the chip automatically begins transmitting
* the data.
*
* The reason why this "simple" copy routine is so long and complicated is
* because all reads and writes to the chip must be done as 16-bit words.
* If an mbuf has an odd number of bytes, then the last byte must be saved
* and combined with the first byte of the next mbuf.  Also, some processors,
* such as the MIPS do not allow word writes to non-word aligned addresses.
*
*/

LOCAL void csCopyTxFrame( CS_SOFTC *pCS, struct mbuf *pMbufChain )
{
   struct mbuf *pMbuf;
   FAST USHORT *pFrame;
   FAST USHORT *pBuff;
   FAST USHORT *pBuffLimit;
   IOADDR TxDataPort;
   UCHAR  *pStart;
   USHORT  Length;
   BOOL HaveExtraByte;
   union
   {
      UCHAR  byte[2];
      USHORT word;
   } Straddle;

   /* Initialize frame pointer and data port address */
   pFrame = pCS->pPacketPage + (PKTPG_TX_FRAME/2);
   TxDataPort = pCS->IOAddr + PORT_RXTX_DATA;

   HaveExtraByte = FALSE;  /* Start out with no extra byte */

   /* Process the chain of mbufs */
   for ( pMbuf=pMbufChain; pMbuf!=NULL; pMbuf=pMbuf->m_next )
   {

      /* Setup starting pointer and length */
      pStart = mtod( pMbuf, UCHAR * );
      Length = pMbuf->m_len;

#if (CPU_FAMILY == MIPS || CPU_FAMILY == ARM)
      /* if the mbuf payload starts on an odd address boundary */
      if( (UINT32)pStart & 0x01 )
      {
         /* If there is an extra byte left over from the previous mbuf */
         if ( HaveExtraByte )
         {
            /* Add the first byte from this mbuf to make a word */
            Straddle.byte[1] = *pStart;
 
            /* Write the word which straddles the mbufs to the chip */
            if ( pCS->InMemoryMode )
               *pFrame++ = Straddle.word;
            else
               SYS_ENET_OUT_WORD( TxDataPort, Straddle.word );
 
            /* Adjust starting pointer and length */
            pStart++;
            Length--;

            HaveExtraByte = FALSE;
         }
         else
         {
            while( Length>=2 )
            {
               /* fetch 16 bits, 8 bits at a time */
               Straddle.byte[0] = *(UCHAR *)pStart++;
               Straddle.byte[1] = *(UCHAR *)pStart++;
    
               /* Write the word which straddles the mbufs to the chip */
               if ( pCS->InMemoryMode )
                  *pFrame++ = Straddle.word;
               else
                  SYS_ENET_OUT_WORD( TxDataPort, Straddle.word );
    
               Length -= 2;
            }
/* @kml Fixed the bug that if CPU type is MIPS, an extra byte is sent
 when an odd-aligned buffer and odd length data are passed.*/
/*            if ( Length == 1 )
            {
               HaveExtraByte = TRUE;

               // Save the extra byte for later 
               Straddle.byte[0] = *(UCHAR *)pStart++;
            }
*/
         }
      }
#endif

      /* If there is an extra byte left over from the previous mbuf */
      if ( HaveExtraByte )
      {
         /* Add the first byte from this mbuf to make a word */
         Straddle.byte[1] = *pStart;

         /* Write the word which straddles the mbufs to the chip */
         if ( pCS->InMemoryMode )
            *pFrame++ = Straddle.word;
         else
            SYS_ENET_OUT_WORD( TxDataPort, Straddle.word );
   
         /* Adjust starting pointer and length */
         pStart++;
         Length--;

#if (CPU_FAMILY == MIPS || CPU_FAMILY == ARM)
         while( Length>=2 )
         {
            /* fetch 16 bits, 8 bits at a time */
            Straddle.byte[0] = *(UCHAR *)pStart++;
            Straddle.byte[1] = *(UCHAR *)pStart++;
 
            /* Write the word which straddles the mbufs to the chip */
            if ( pCS->InMemoryMode )
               *pFrame++ = Straddle.word;
            else
               SYS_ENET_OUT_WORD( TxDataPort, Straddle.word );

            Length -= 2;
         }
#endif
      }

      /* Point pBuff to the correct starting point */
      pBuff = (USHORT *)pStart;

      /* If there are odd bytes remaining in the mbuf */
      if ( Length & 1 )
      {
         HaveExtraByte = TRUE;

         /* Point pBuffLimit to the extra byte */
         pBuffLimit = (USHORT *)(pStart+Length-1);
      }
      else  /* There is an even number of bytes remaining */
      {
         HaveExtraByte = FALSE;

         /* Point pBuffLimit to just beyond the last word */
         pBuffLimit = (USHORT *)(pStart+Length);
      }

      /* Copy the words in the mbuf to the chip */
      if ( pCS->InMemoryMode )
      {
         while ( pBuff < pBuffLimit ) 
            *pFrame++ = *pBuff++;
      }
      else
      {
         while ( pBuff < pBuffLimit ) 
            SYS_ENET_OUT_WORD( TxDataPort, *pBuff++ );
      }

      /* If there is an extra byte left over in this mbuf */
      if ( HaveExtraByte )
      {
         /* Save the extra byte for later */
         Straddle.byte[0] = *(UCHAR *)pBuff;
      }

   } /* end Process the chain of mbufs */

   /* If there is an extra byte left over from the last mbuf */
   if ( HaveExtraByte )
   {
      /* Add a zero byte to make a word */
      Straddle.byte[1] = 0;

      /* Write the last word to the chip */
      if ( pCS->InMemoryMode )
         *pFrame = Straddle.word;
      else
         SYS_ENET_OUT_WORD( TxDataPort, Straddle.word );
   }
}






/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
 * Receive-related Routines                                                *
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */


/*******************************************************************************
*
* csCopyRxFrame -
*
* This routine copies a received frame from the chip to a receive buffer.
*
*/

LOCAL void csCopyRxFrame( CS_SOFTC *pCS, PRXBUF pRxBuff )
{
   FAST USHORT *pFrame;
   FAST USHORT *pBuff;
   FAST USHORT *pBuffLimit;
   FAST int RxDataPort;
   USHORT RxLength, RxStatus;

   /* Initialize the frame pointer and data port address */
   pFrame = pCS->pPacketPage + (PKTPG_RX_LENGTH/2);
   RxDataPort = pCS->IOAddr + PORT_RXTX_DATA;

   /* Get the length of the received frame */
   if ( pCS->InMemoryMode )
   {
      RxLength = *pFrame++;
      pRxBuff->Length = BYTE_SWAP( RxLength );
   }
   else  /* In IO mode */
   {
      RxStatus = SYS_ENET_IN_WORD( RxDataPort );  /* Discard RxStatus */
      RxLength = SYS_ENET_IN_WORD( RxDataPort );
      pRxBuff->Length = BYTE_SWAP( RxLength );
   }


   /* Setup pointers to the buffer for copying */
   pBuff = (USHORT *)pRxBuff->Data;
   pBuffLimit = pBuff + ((pRxBuff->Length+1)/2);

   /* Copy the frame from the chip to the buffer */
   if ( pCS->InMemoryMode )
   {
      while ( pBuff < pBuffLimit ) 
         *pBuff++ = *pFrame++;
   }
   else
   {
      while ( pBuff < pBuffLimit ) 
         *pBuff++ = SYS_ENET_IN_WORD( RxDataPort );
   }
}


/*******************************************************************************
*
* csProcessReceive -
*
* This routine processes a received packet.  The received packet was copied to
* a receive buffer at interrupt time and this routine processses the receive
* buffer at task time via netTask().
*
* If a recieve hook routine is specified, then the packet is given to the
* hook routine for processing.  If the received packet does not use trailers
* and the packet is large, then a cluster mbuf is built that points to the
* receive buffer directly.  If a cluster mbuf is not used, then the packet
* is copied to an mbuf chain.  The cluster mbuf or mbuf chain is then passed
* up to the protocol stack.
*
*/

LOCAL void csProcessReceive( CS_SOFTC *pCS, PRXBUF pRxBuff )
{
   struct ifnet *pIf;
   struct mbuf *pMbufChain;
   struct ether_header *pEtherHeader;
   UCHAR *pData;
   int DataLength;
   int Spl;
   
#ifdef BSD43_DRIVER
   int TrailerOffset;
   USHORT Type;
#endif /* BSD43_DRIVER */

 

   pIf = &pCS->ArpCom.ac_if;

   /*pIf->if_ipackets++;*/

   /* If a hook routine is specified */
   if ( etherInputHookRtn != NULL )
   {
      /* Call the hook routine */
      if ( (*etherInputHookRtn)(pIf,pRxBuff->Data,pRxBuff->Length) != 0 )
      {
         /* The hook routine has handled the received frame */
         csFreeRxBuff( pCS, pRxBuff );
         return;
      }
   }

   /* Setup working variables */
   pEtherHeader = (struct ether_header *)pRxBuff->Data;
   pData = &pRxBuff->Data[SIZEOF_ETHERHEADER];
   DataLength = pRxBuff->Length - SIZEOF_ETHERHEADER;

#ifdef BSD43_DRIVER
   /* Check if the received frame uses trailers */
   check_trailer( pEtherHeader, pData, &DataLength, &TrailerOffset, pIf );

   /* Save the type because build_cluster() will overwrite it */
   Type = pEtherHeader->ether_type;
#endif

#if (CPU_FAMILY != MIPS )
   
   /* Current VxWorks build_cluster routine causes a bus fault with the MIPS
    * processor.  Likely due to an addressing violation.
    */
#ifdef BSD43_DRIVER
   /* If trailers are not used and there is enough data for clustering */
   if ( (TrailerOffset==0) && USE_CLUSTER(DataLength) )
#else
   if ( USE_CLUSTER(DataLength) )
#endif /* BSD43_DRIVER */
   {
      /* Build a cluster mbuf that points to my receive buffer */
      Spl = splnet( );
      pMbufChain = build_cluster( pData, DataLength, pIf, MC_LOANED,
         &pRxBuff->RefCount, (FUNCPTR)csFreeRxBuff, (int)pCS, (int)pRxBuff, 0 );
      splx( Spl );
      if ( pMbufChain != NULL )
      {
         pRxBuff->Status = RXBUF_LOANED;
         pCS->LoanCount++;
      }
      else 
      {
	 csFreeRxBuff( pCS, pRxBuff );
      }
   }
   else  /* Can not do clustering */

#endif

   {
      /* Copy the received data to a chain of mbufs */
      Spl = splnet( );

#ifdef BSD43_DRIVER
      pMbufChain = copy_to_mbufs( pData, DataLength, TrailerOffset, pIf );
#else
      pMbufChain = copy_to_mbufs( pData, DataLength, 0, pIf ); /*Cannot use Trailer*/ 
#endif

      splx( Spl );
      csFreeRxBuff( pCS, pRxBuff );
   }

   /* If could not get an mbuf */
   if ( pMbufChain == NULL )
   {
      pIf->if_ierrors++;
      LOGMSG( "csProcessReceive: unit %d, No receive mbuf available\n",
         pCS->ArpCom.ac_if.if_unit, 0,0,0,0,0 );
      return;
   }

   /* Pass the mbuf chain up to the protocol stack */
   Spl = splnet( );

   /* @kml */
   pIf->if_ipackets++;

#ifdef BSD43_DRIVER
    do_protocol_with_type(Type, pMbufChain, &pCS->ArpCom, DataLength);
#else /* BSD4.4 DRIVER */
    do_protocol(pEtherHeader, pMbufChain, &pCS->ArpCom, DataLength);
#endif /* BSD4.4 DRIVER */

   splx( Spl );
}




/*******************************************************************************
*
* csInitRxBuff -
*
* This routine initializes the network interface driver's collection of
* receive buffers.  The receive buffers are allocated from system memory
* and linked together in a linked list of free receive buffers.
*
*/

LOCAL STATUS csInitRxBuff( CS_SOFTC *pCS )
{

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品午夜电影| 国产精品性做久久久久久| 在线看日本不卡| 最新不卡av在线| 91麻豆免费观看| 伊人夜夜躁av伊人久久| 欧美网站一区二区| 日韩高清中文字幕一区| 7777精品伊人久久久大香线蕉| 国产尤物一区二区| 亚洲精品国产一区二区三区四区在线 | 精品久久国产字幕高潮| 欧美aaaaa成人免费观看视频| 久草在线在线精品观看| 欧美一级免费大片| 国产精品亚洲а∨天堂免在线| 欧美视频一区二区| 蜜桃视频在线观看一区二区| 欧美videofree性高清杂交| 国产一区二区三区在线观看精品| 日本久久电影网| 天天亚洲美女在线视频| 久久老女人爱爱| 97久久久精品综合88久久| 亚洲福中文字幕伊人影院| 欧美成人高清电影在线| 91在线无精精品入口| 丝瓜av网站精品一区二区| 久久一区二区三区四区| 91热门视频在线观看| 人禽交欧美网站| 国产精品欧美经典| 欧美日产国产精品| 国产成人在线视频播放| 亚洲地区一二三色| 国产亚洲欧美日韩在线一区| 99久久精品免费看国产免费软件| 2022国产精品视频| 久久免费视频色| 色欧美88888久久久久久影院| 国产欧美日产一区| 91传媒视频在线播放| 久久精品噜噜噜成人88aⅴ| 国产精品亲子乱子伦xxxx裸| 777亚洲妇女| av高清不卡在线| 麻豆精品久久精品色综合| 亚洲欧美视频在线观看| 精品国产免费一区二区三区香蕉| 美国毛片一区二区三区| 亚洲视频一区在线| 久久亚洲免费视频| 在线91免费看| 99久久免费国产| 国产成人精品免费在线| 日韩电影网1区2区| 亚洲最大色网站| 中文一区在线播放| 久久一日本道色综合| 欧美精品在欧美一区二区少妇| 五月婷婷激情综合| 亚洲伦理在线免费看| 国产日韩精品一区二区浪潮av| 国产一区二区三区香蕉| 青椒成人免费视频| 亚洲综合成人在线视频| 亚洲欧美日韩国产一区二区三区| 91成人免费在线| 91网站最新网址| 成人av动漫网站| 欧美亚洲一区三区| 欧美自拍丝袜亚洲| av午夜一区麻豆| 不卡视频免费播放| 成人av免费观看| 成人动漫一区二区三区| 国产夫妻精品视频| 高清久久久久久| 国产91精品露脸国语对白| 国产一区二区影院| 国产成人精品三级麻豆| 成人国产一区二区三区精品| 精品制服美女丁香| 国精产品一区一区三区mba视频| 国产精品国产自产拍高清av| 中文字幕 久热精品 视频在线| 色综合久久88色综合天天免费| 日韩—二三区免费观看av| 视频一区二区三区中文字幕| 亚洲成a人片在线观看中文| 亚洲国产乱码最新视频 | 国产精品一区二区三区网站| 欧美96一区二区免费视频| 秋霞午夜av一区二区三区| 日本成人在线网站| 精品一区二区久久久| 韩日av一区二区| 豆国产96在线|亚洲| 9久草视频在线视频精品| 色婷婷综合久久久久中文| 在线观看日韩一区| 7777精品伊人久久久大香线蕉完整版| 精品理论电影在线| 久久久精品影视| 国产精品久久久久久久久搜平片| 欧美日韩五月天| 日韩美女主播在线视频一区二区三区 | 麻豆精品一区二区综合av| 极品少妇xxxx精品少妇偷拍| 国产资源精品在线观看| 不卡一卡二卡三乱码免费网站| 裸体歌舞表演一区二区| 国产99久久久精品| 欧美三级电影网| 久久久蜜桃精品| 日韩毛片高清在线播放| 日精品一区二区| 国产不卡高清在线观看视频| 在线观看日韩国产| 久久综合九色综合久久久精品综合| 欧美精品v国产精品v日韩精品| 一本色道亚洲精品aⅴ| 欧美日韩精品久久久| 久久久久久久久久久99999| 亚洲色图欧美激情| 久久99久久99| 欧美亚洲综合久久| 国产亚洲欧美激情| 日本亚洲最大的色成网站www| 亚洲bdsm女犯bdsm网站| 国产91丝袜在线观看| 91精品一区二区三区在线观看| 91麻豆精品秘密| 久久免费偷拍视频| 日韩精品亚洲专区| 99国产欧美另类久久久精品| 日韩精品自拍偷拍| 亚洲伊人伊色伊影伊综合网| 国产福利一区二区三区| 欧美日韩三级一区二区| 中文字幕精品一区二区精品绿巨人 | 成人动漫在线一区| 亚洲精品在线观看网站| 亚洲小说春色综合另类电影| 不卡视频在线观看| 亚洲国产高清在线观看视频| 免费欧美高清视频| 欧美日韩精品专区| 亚洲精品欧美综合四区| 成人午夜激情视频| 久久免费看少妇高潮| 日本 国产 欧美色综合| 欧美精品一级二级| 亚洲成人黄色小说| 91美女片黄在线观看| 国产精品久久久一本精品| 国产精品一区二区久久不卡| 日韩午夜在线观看| 奇米精品一区二区三区在线观看| 国产成人综合网站| 久久久亚洲欧洲日产国码αv| 久久精品夜色噜噜亚洲aⅴ| 亚洲国产你懂的| 91小视频在线免费看| 亚洲婷婷国产精品电影人久久| 中文字幕亚洲在| 国内外精品视频| 日韩一区二区免费视频| 偷拍与自拍一区| 一本色道久久综合亚洲91| 久久久噜噜噜久久人人看| 国产欧美日韩激情| 成人国产精品免费观看视频| 精品欧美一区二区三区精品久久 | 亚洲亚洲精品在线观看| 色婷婷综合久久久中文字幕| 精品国产免费视频| 麻豆传媒一区二区三区| 欧洲国产伦久久久久久久| 洋洋成人永久网站入口| 色噜噜狠狠一区二区三区果冻| 欧美日本一区二区三区四区| 亚洲乱码国产乱码精品精的特点 | 亚洲午夜电影网| 日本丰满少妇一区二区三区| 一区二区三区在线视频播放| 99久久er热在这里只有精品15 | 国产亚洲女人久久久久毛片| 韩国毛片一区二区三区| 日韩精品综合一本久道在线视频| 国产精品久久久久久妇女6080| 尤物在线观看一区| 欧美在线观看一二区| 亚洲美女淫视频| jiyouzz国产精品久久| 亚洲日本乱码在线观看| 在线精品视频小说1| 亚洲成人在线观看视频| 欧美精品亚洲一区二区在线播放| 日韩你懂的在线观看|