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

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

?? csend.c

?? cs8900在vxworks系統下的驅動
?? 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一区二区三区免费野_久草精品视频
欧美xxxxx裸体时装秀| 2023国产一二三区日本精品2022| 粉嫩aⅴ一区二区三区四区五区| 懂色av一区二区三区免费观看 | 成人免费三级在线| 在线欧美日韩国产| 日韩视频在线你懂得| 日本一区二区三区四区在线视频| 国产欧美日韩三级| 亚洲国产精品麻豆| 成人性视频免费网站| 欧美日韩国产综合久久| 亚洲精品你懂的| 免费在线观看精品| 91在线小视频| 亚洲一区二区三区四区的| 国产精品一区三区| 欧美区在线观看| 尤物视频一区二区| 成年人国产精品| 久久婷婷一区二区三区| 日韩精品视频网| 欧美人妖巨大在线| 亚洲欧美另类图片小说| 国产精品中文字幕日韩精品 | 一区二区三区不卡视频| 久久电影国产免费久久电影| 色又黄又爽网站www久久| 国产精品另类一区| 国产精品18久久久久久久久| 日韩一级免费观看| 蜜臀av一级做a爰片久久| 欧美日韩高清一区| 日本成人中文字幕在线视频 | 亚洲日本电影在线| 91福利精品视频| 性欧美大战久久久久久久久| 欧美色网站导航| 视频一区中文字幕| 精品久久一区二区| 国产精华液一区二区三区| 中文字幕av不卡| 91网址在线看| 日韩精品成人一区二区在线| 国产色产综合产在线视频| 精品一区二区在线视频| 久久久久久夜精品精品免费| 国产福利一区在线| 九色|91porny| 亚洲精品国产精品乱码不99| 51午夜精品国产| aa级大片欧美| 精品在线观看免费| 综合久久久久综合| 日韩精品一区二区三区蜜臀 | 最新国产精品久久精品| 欧美日韩午夜在线| 国产福利一区在线| 日日摸夜夜添夜夜添国产精品| 亚洲精品一区二区三区四区高清| 国产99久久久国产精品潘金| 亚洲国产日韩在线一区模特| 国产女主播一区| 日韩亚洲欧美在线| 欧美色精品天天在线观看视频| 国内精品在线播放| 精品综合免费视频观看| 午夜精品爽啪视频| 一区二区三区小说| 亚洲色图欧美激情| 国产精品久99| 久久精子c满五个校花| 日韩一区二区三区观看| 宅男在线国产精品| 欧美精品在线视频| 欧美日韩亚洲综合在线| 色婷婷香蕉在线一区二区| 成人动漫在线一区| 成人国产视频在线观看 | 精品久久久久久久久久久久包黑料| 91网站视频在线观看| www.爱久久.com| 一本色道久久加勒比精品| 一本大道av伊人久久综合| 欧洲激情一区二区| 欧美日韩成人激情| 久久综合九色综合久久久精品综合 | 欧美午夜视频网站| 宅男噜噜噜66一区二区66| 欧美一级片在线看| 国产亚洲精品aa午夜观看| 中文字幕一区二区三区在线观看 | 成人免费高清视频| 色中色一区二区| 日韩欧美综合在线| 国产精品免费丝袜| 午夜久久久影院| 国产激情一区二区三区| 欧美性三三影院| 26uuu久久综合| 亚洲一区电影777| 福利电影一区二区| 日韩欧美国产精品一区| 亚洲桃色在线一区| 国产一区二区三区蝌蚪| 欧美伊人精品成人久久综合97| 欧美一区三区四区| 亚洲国产成人高清精品| 国产成人精品免费网站| 日韩一区二区免费电影| 亚洲一区二区三区视频在线播放| 久久se这里有精品| 884aa四虎影成人精品一区| 国产精品乱人伦| 国产成人精品午夜视频免费| 日韩视频一区二区在线观看| 亚洲综合一区二区| 成人免费毛片高清视频| 欧美激情资源网| 国产成人小视频| 国产日韩欧美高清| 高清shemale亚洲人妖| 久久香蕉国产线看观看99| 久久疯狂做爰流白浆xx| 69av一区二区三区| 麻豆免费精品视频| 2020国产成人综合网| 国产成人超碰人人澡人人澡| 国产精品麻豆99久久久久久| 不卡的av网站| 调教+趴+乳夹+国产+精品| 7777精品伊人久久久大香线蕉的 | 亚洲图片你懂的| 在线一区二区三区四区五区| 亚洲国产aⅴ天堂久久| 欧美一区二区福利在线| 久草这里只有精品视频| 国产精品久久久久9999吃药| 欧美日韩综合色| 国产成人在线视频网址| 亚洲激情成人在线| 国产欧美日韩不卡| 欧美人体做爰大胆视频| 国产一区日韩二区欧美三区| 欧美激情一区二区在线| 欧美三区免费完整视频在线观看| 日韩高清一区在线| 国产精品久久久久三级| 欧美另类videos死尸| 精品伊人久久久久7777人| 亚洲日本免费电影| 久久影院午夜片一区| 欧美丰满嫩嫩电影| 91视视频在线观看入口直接观看www| 一区二区在线观看免费视频播放| 欧美第一区第二区| 欧美理论片在线| 日本精品一级二级| 国产不卡视频在线播放| 免费久久精品视频| 一区二区在线电影| 日韩一区在线看| 亚洲国产精品国自产拍av| 日韩三级高清在线| 欧美一激情一区二区三区| 欧美午夜电影在线播放| 日本久久电影网| 欧洲一区二区三区免费视频| 成人97人人超碰人人99| 国产.欧美.日韩| 成人av在线播放网址| 国产大陆精品国产| a级精品国产片在线观看| 成人国产在线观看| 99久久精品久久久久久清纯| 91丨porny丨中文| 欧美综合视频在线观看| 欧美日韩国产另类一区| 精品久久久久久久人人人人传媒 | 99re这里只有精品首页| 91免费观看视频在线| 在线视频欧美精品| 精品久久久久av影院| 国产偷国产偷精品高清尤物| 国产女主播在线一区二区| √…a在线天堂一区| 丝袜美腿亚洲综合| 风间由美一区二区av101| 51精品视频一区二区三区| 欧美成人精品二区三区99精品| 国产精品―色哟哟| 亚洲电影中文字幕在线观看| 久久国产剧场电影| 欧美最猛黑人xxxxx猛交| 26uuu欧美| 日韩黄色在线观看| 色88888久久久久久影院野外| 欧美一级xxx| 亚洲国产日韩a在线播放| 成人一级片在线观看|