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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? csend.c

?? CS8900的Vxworks驅動源代碼 1.0
?? C
?? 第 1 頁 / 共 5 頁
字號:
      /* Bid for space on the chip and start the TX if bid successful */
      if ( pCS->InMemoryMode )
      {
             csWritePacketPage( pCS, PKTPG_TX_CMD, pCS->TxStartCMD );
             csWritePacketPage( pCS, PKTPG_TX_LENGTH, BYTE_SWAP(pCS->TxLength) );
      }
      else  /* In IO mode */
      {
             SYS_ENET_OUT_WORD( (pCS->IOAddr)+PORT_TX_CMD, pCS->TxStartCMD );
             SYS_ENET_OUT_WORD( (pCS->IOAddr)+PORT_TX_LENGTH, 
                                 BYTE_SWAP(pCS->TxLength));
      }

      /* Read BusStatus register which indicates success of the request */
      BusStatus = csReadPacketPage( pCS, PKTPG_BUS_ST );

      if ( BusStatus & BUS_ST_RDY4TXNOW )
      {
         /* The chip is ready for transmission now */
         /* Copy the frame to the chip to start transmission */
         csCopyTxFrame( pCS, pCS->pTxFrameChain );

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

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

         break;
      }
      else /* Not ready for TX */
      {

         /* If there was an error in the transmit bid */
         if ( BusStatus & BUS_ST_TX_BID_ERR )
         {
            /* Set TX not in progress */
            pMbuf = pCS->pTxFrameChain;
            pCS->pTxFrameChain = NULL;
            pCS->TxInProgress = FALSE;

            if ( !pCS->InISR )
            {
	          /* Re-enable interrupts at the CPU */
	          INT_UNLOCK( State );

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

            /* Update output stats */
            END_ERR_ADD (&pCS->end, MIB2_OUT_ERRS, +1);
            /*   END_ERR_ADD (&pCS->end, MIB2_OUT_UCAST, -1);*/
            /* @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."*/
#ifdef CS_DEBUG_ENABLE
            logMsg("csStartOutput: CS_END_DEVICE %d, Transmit bid error (too big)\n",
                       pCS->unit, 0,0,0,0,0 );
#endif

            /* Loop up to transmit the next chain */

         }
         else /* Not Rdy4Tx and Not Bid Error */
         {


            /* Start the TX on Rdy4Tx interrupt */
            /* TX buff space not available now. */

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

	          /* Re-enable interrupts at the CPU */
	          INT_UNLOCK( 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_END_DEVICE *pCS, M_BLK_ID pMbufChain )
{
   M_BLK_ID 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;
   pFrame += (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->mBlkHdr.mNext )
   {
      /* Setup starting pointer and length */
      pStart = pMbuf->mBlkHdr.mData;
      Length = pMbuf->mBlkHdr.mLen;

#ifdef ALIGMENT_32BIT
      /* 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 )
            {
#if CPU_FAMILY == ARM 
               SYS_ENET_OUT_WORD(pFrame++, Straddle.word);
#else
               *pFrame++ = Straddle.word;
#endif
            }
            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 )
               {
#if CPU_FAMILY == ARM 
               SYS_ENET_OUT_WORD(pFrame++, Straddle.word);
#else
               *pFrame++ = Straddle.word;
#endif
              }
               else
                  SYS_ENET_OUT_WORD( TxDataPort, Straddle.word );
    
               Length -= 2;
            }
         }
      }

#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 )
         {
#if CPU_FAMILY == ARM 
               SYS_ENET_OUT_WORD(pFrame++, Straddle.word);
#else
               *pFrame++ = Straddle.word;
#endif
         }
         else
            SYS_ENET_OUT_WORD( TxDataPort, Straddle.word );
   
         /* Adjust starting pointer and length */
         pStart++;
         Length--;

#ifdef ALIGMENT_32BIT
         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 )
            {
#if CPU_FAMILY == ARM 
               SYS_ENET_OUT_WORD(pFrame++, Straddle.word);
#else
               *pFrame++ = Straddle.word;
#endif
            }
            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 ) 
         {
#if CPU_FAMILY == ARM 
               SYS_ENET_OUT_WORD(pFrame++, *pBuff++);
#else
                         *pFrame++ = *pBuff++;
#endif
         }
      }
      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 )
      {
#if CPU_FAMILY == ARM 
               SYS_ENET_OUT_WORD(pFrame++, Straddle.word);
#else
               *pFrame++ = Straddle.word;
#endif
      }
      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 int csCopyRxFrame( CS_END_DEVICE *pCS, char *pRxBuff )
{
   FAST USHORT *pFrame;
   FAST USHORT *pBuff;
   FAST USHORT *pBuffLimit;
   FAST int RxDataPort;
   USHORT RxLength, RxStatus;
   int test_int;

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

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


   /* Setup pointers to the buffer for copying */
   pBuff = (USHORT *)pRxBuff;
   test_int = (int) pBuff;
   if ((test_int % 2) != 0)
   {
#ifdef CS_DEBUG_ENABLE
      logMsg("receive buffer not on half word boundary: %x\n", (int)pBuff,0,0,0,0,0);
#endif
   }
   pBuffLimit  = pBuff;
   pBuffLimit += ((RxLength+1)/2);

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

   return (RxLength);
}


/*******************************************************************************
*
* 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().
*
* The packet is copied to an mbuf chain.  The mbuf chain is then
* passed up to the protocol stack.
*
*/
LOCAL void csProcessReceive( CS_END_DEVICE *pCS, M_BLK_ID pMBuff )
{

   /* Spl = splnet( );*/
   
        /* Update the MIB2 Static */
    END_ERR_ADD (&pCS->end, MIB2_IN_UCAST, +1);

   /* Pass the mbuf chain up to the protocol stack */
    /* Call the upper layer's receive routine. */
    END_RCV_RTN_CALL(&pCS->end, pMBuff);
   /* splx( Spl ); */
}



/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
 * Misc. Routines                       

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文字幕一区在线| 粉嫩av一区二区三区| 国产精品亚洲第一| 欧美体内she精高潮| 久久精品一区二区三区不卡| 一区二区三区国产| 大桥未久av一区二区三区中文| 欧美日韩视频不卡| 亚洲婷婷综合久久一本伊一区| 欧美a级一区二区| 色婷婷激情综合| 中文字幕第一区二区| 蜜臀av性久久久久蜜臀aⅴ| 色嗨嗨av一区二区三区| 久久久电影一区二区三区| 日韩中文欧美在线| 色呦呦日韩精品| 中文字幕不卡在线播放| 国产又粗又猛又爽又黄91精品| 在线播放日韩导航| 亚洲成在线观看| 色综合激情五月| 亚洲私人影院在线观看| 风间由美性色一区二区三区| 亚洲精品一线二线三线| 首页欧美精品中文字幕| 在线影院国内精品| 亚洲女子a中天字幕| 不卡在线视频中文字幕| 国产无遮挡一区二区三区毛片日本| 久久国产日韩欧美精品| 日韩视频免费直播| 久久电影网站中文字幕| 欧美不卡视频一区| 久久99久久99小草精品免视看| 欧美一区二区福利视频| 青青草精品视频| 日韩三级中文字幕| 激情偷乱视频一区二区三区| 日韩视频国产视频| 国产一区二区三区| 国产免费久久精品| 99精品1区2区| 亚洲在线视频网站| 欧美日韩国产中文| 另类成人小视频在线| 欧美精品一区二区三区蜜臀| 国产乱码精品一区二区三区av | 国产精品一线二线三线精华| 欧美mv和日韩mv的网站| 久久福利资源站| 国产欧美一区二区三区在线看蜜臀 | 日韩丝袜美女视频| 国产一区二区三区久久久| 国产日韩欧美精品在线| 91免费小视频| 亚洲电影一级片| 精品国产免费一区二区三区四区 | 成人高清在线视频| 亚洲美女屁股眼交3| 欧美男生操女生| 韩国毛片一区二区三区| 中文字幕一区视频| 在线成人av影院| 国产精品18久久久久久vr| 亚洲欧美综合在线精品| 欧美疯狂性受xxxxx喷水图片| 激情综合网激情| 亚洲少妇屁股交4| 日韩精品一区二区三区在线观看 | 亚洲国产日产av| 欧美videossexotv100| proumb性欧美在线观看| 日韩在线观看一区二区| 久久精品视频在线免费观看| 欧美中文字幕一二三区视频| 久久99精品久久久久久久久久久久| 国产精品国产三级国产aⅴ入口| 欧美中文字幕亚洲一区二区va在线| 精品一区二区三区的国产在线播放 | 91久久精品午夜一区二区| 久久精品噜噜噜成人av农村| 亚洲视频一区二区在线| 精品久久久久一区二区国产| 在线视频一区二区免费| 国产精品456露脸| 亚洲va韩国va欧美va| 国产精品国产自产拍高清av王其| 欧美一区二区三区影视| 日本二三区不卡| 丰满白嫩尤物一区二区| 免费的成人av| 亚洲第一久久影院| 国产精品麻豆一区二区| 精品国产91久久久久久久妲己| 欧美视频自拍偷拍| www.爱久久.com| 国产一区二区三区香蕉| 免费的成人av| 五月天精品一区二区三区| 中文字幕一区二区三中文字幕 | 欧美视频一区二区三区四区 | 视频一区二区三区入口| 亚洲黄色录像片| 国产精品久久久久永久免费观看 | www.亚洲免费av| 国产91精品精华液一区二区三区| 蜜臀av一级做a爰片久久| 香蕉影视欧美成人| 亚洲一区二区高清| 亚洲男人的天堂在线aⅴ视频| 欧美经典一区二区三区| 久久久国产精品麻豆| 精品国产伦一区二区三区观看方式| 欧美精品在线观看播放| 欧美三级视频在线| 欧美视频一区在线观看| 91国偷自产一区二区三区成为亚洲经典 | 成人听书哪个软件好| 国产很黄免费观看久久| 韩国v欧美v亚洲v日本v| 国产精品中文字幕欧美| 国产一区二区三区高清播放| 国产伦精品一区二区三区在线观看| 美女视频免费一区| 久久国产婷婷国产香蕉| 国产一区二三区| 国产91清纯白嫩初高中在线观看 | 国产日韩欧美电影| 国产精品视频在线看| 亚洲天堂精品在线观看| 亚洲午夜一区二区| 奇米777欧美一区二区| 国产在线看一区| 成人免费的视频| 色婷婷av一区二区三区大白胸| 欧洲国内综合视频| 欧美一区永久视频免费观看| 精品国产凹凸成av人网站| 国产欧美一区二区精品秋霞影院| 欧美极品少妇xxxxⅹ高跟鞋 | 日韩欧美第一区| 久久久精品蜜桃| 亚洲欧美综合另类在线卡通| 偷拍亚洲欧洲综合| 麻豆精品在线视频| 极品少妇xxxx精品少妇偷拍| 成人app在线观看| 欧美日韩精品高清| 精品欧美一区二区久久| 中国av一区二区三区| 亚洲二区在线视频| 久久精品国产99久久6| www.成人网.com| 欧美日韩国产不卡| 欧美国产一区二区在线观看| 亚洲一区二区三区四区在线免费观看| 日韩av一区二区在线影视| 国产麻豆精品久久一二三| 在线视频国内自拍亚洲视频| 精品久久久久久久久久久久久久久久久 | 国产欧美日韩综合精品一区二区| 亚洲乱码国产乱码精品精的特点| 免费看日韩a级影片| av中文字幕亚洲| 日韩视频中午一区| 一区二区三区中文字幕在线观看| 极品少妇xxxx偷拍精品少妇| 欧美亚洲国产一区二区三区| 国产农村妇女精品| 免费成人你懂的| 91首页免费视频| 国产偷国产偷亚洲高清人白洁| 日日嗨av一区二区三区四区| 99精品视频一区二区| 26uuu国产电影一区二区| 亚洲国产成人精品视频| a4yy欧美一区二区三区| 精品播放一区二区| 视频一区二区三区中文字幕| 99v久久综合狠狠综合久久| 亚洲精品一区在线观看| 日韩激情av在线| 欧美另类久久久品| 亚洲激情图片qvod| 91片在线免费观看| 国产精品久久久久久久久免费相片 | 91精品一区二区三区久久久久久 | 欧美日韩在线三级| 亚洲乱码国产乱码精品精98午夜| 国产电影精品久久禁18| 日韩午夜激情视频| 日本vs亚洲vs韩国一区三区二区| 色婷婷精品久久二区二区蜜臀av | 国产精品996| 久久伊99综合婷婷久久伊| 日本免费在线视频不卡一不卡二 | 亚洲高清中文字幕| 色偷偷成人一区二区三区91| 中文字幕视频一区二区三区久|