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

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

?? csend.c

?? VxWorks系統CS網卡END驅動(源碼).zip
?? C
?? 第 1 頁 / 共 5 頁
字號:
         if ( TxEvent & TX_EVENT_LOSS_CRS )
         {
            LOGMSG("csTransmitEvent: CS_END_DEVICE %d, Loss of carrier\n",
               pCS->unit, 0,0,0,0,0 );
         }
         if ( TxEvent & TX_EVENT_SQE_ERR )
         {
            LOGMSG("csTransmitEvent: CS_END_DEVICE %d, SQE error\n",
               pCS->unit, 0,0,0,0,0 );
         }
         if ( TxEvent & TX_EVENT_OUT_WIN )
         {
            LOGMSG("csTransmitEvent: CS_END_DEVICE %d, Out-of-window collision\n",
               pCS->unit, 0,0,0,0,0 );
         }
         if ( TxEvent & TX_EVENT_JABBER )
         {
            LOGMSG("csTransmitEvent: CS_END_DEVICE %d, Jabber\n",
               pCS->unit, 0,0,0,0,0 );
         }
         if ( TxEvent & TX_EVENT_16_COLL )
         {
            LOGMSG("csTransmitEvent: CS_END_DEVICE %d, 16 collisions\n",
               pCS->unit, 0,0,0,0,0 );
         }
#endif

    }

   /* Previous TX complete so start the next TX now if more to transmit */
   csTxNextFrame( pCS );

}




/*******************************************************************************
*
* csReceiveEvent -
*
* This routine is called whenever a packet is received at the chip.  If the
* packet is received with errors, then the input error count is incremented.
* If the packet is received OK, then the data is copied to an internal receive
* buffer and processed at task level (in csEventHandler). 
*
* RETURNS: Nothing
*/

LOCAL void csReceiveEvent( CS_END_DEVICE *pCS, USHORT RxEvent )
{
   M_BLK_ID         pMblk;
   CL_BLK_ID        pClBlk;
   char *pData;
   int DataLen;

 
  /* If the frame was not received OK */
   if ( !(RxEvent & RX_EVENT_RX_OK) )
   {

      /* Increment the input error count */
      /*pIf->if_ierrors++;*/
      END_ERR_ADD (&pCS->end, MIB2_IN_ERRS, +1);

      /* If debugging is enabled then log error messages */
#ifdef  CS_DEBUG_ENABLE

         /* If an error bit is set */
         if ( RxEvent != REG_NUM_RX_EVENT )
         {
            if ( RxEvent & RX_EVENT_RUNT )
            {
              LOGMSG("csReceiveEvent: CS_END_DEVICE %d, Runt\n",
                 pCS->unit, 0,0,0,0,0 );
            }
            if ( RxEvent & RX_EVENT_X_DATA )
            {
              LOGMSG("csReceiveEvent: CS_END_DEVICE %d, Extra data\n",
                 pCS->unit, 0,0,0,0,0 );
            }
            if ( RxEvent & RX_EVENT_CRC_ERR )
            {
               if ( RxEvent & RX_EVENT_DRIBBLE )
               {
                  LOGMSG("csReceiveEvent: CS_END_DEVICE %d, Alignment error\n",
                     pCS->unit, 0,0,0,0,0 );
               }
               else
               {
                  LOGMSG("csReceiveEvent: CS_END_DEVICE %d, CRC Error\n",
                     pCS->unit, 0,0,0,0,0 );
               }
            }
            else if ( RxEvent & RX_EVENT_DRIBBLE )
            {
               LOGMSG("csReceiveEvent: CS_END_DEVICE %d, Dribble bits\n",
                  pCS->unit, 0,0,0,0,0 );
            }
         }
#endif
      

      /* Skip this error frame */
      csReadPacketPage( pCS, PKTPG_RX_LENGTH );
      csWritePacketPage( pCS, PKTPG_RX_CFG,
                         csReadPacketPage(pCS,PKTPG_RX_CFG) | RX_CFG_SKIP );

      return;
   }

   /* Get a receive frame buffer */
     pData = netClusterGet(pCS->end.pNetPool, pCS->pClPoolId);

    /* Grab a cluster block to marry to the cluster we received. */

    pClBlk = netClBlkGet (pCS->end.pNetPool, M_DONTWAIT);

           
    /*
     * OK we've got a spare, let's get an M_BLK_ID and marry it to the
     * one in the ring.
     */

    pMblk = mBlkGet (pCS->end.pNetPool, M_DONTWAIT, MT_DATA);
 
   if ( pData == NULL || pClBlk == NULL || pMblk == NULL)  /* If no buffer available */
   {
           if (pData) {
        netClFree (pCS->end.pNetPool, pData);
       }

                if (pClBlk) {
        netClBlkFree (pCS->end.pNetPool, pClBlk); 
        }

        if ( pMblk ) {
        netMblkFree (pCS->end.pNetPool, pMblk);
                }

      /* Increment the input error count */
      /*pIf->if_ierrors++;*/
      END_ERR_ADD (&pCS->end, MIB2_IN_ERRS, +1);
 
      LOGMSG("csReceiveEvent(): unit=%d, No receive buffer available!\n",
         pCS->unit, 0,0,0,0,0 );


      /* Must read the length of all received frames */
      csReadPacketPage( pCS, PKTPG_RX_LENGTH );

      /* Skip the received frame */
      csWritePacketPage( pCS, PKTPG_RX_CFG,
            csReadPacketPage(pCS,PKTPG_RX_CFG) | RX_CFG_SKIP );
      return;
   }


   /* Copy the received frame from the chip to the buffer */
   /* Set offset 2 to the receiving buffer pointer so that the IP heater starts the
      17th bytes for 32-bits alignment*/
   DataLen=csCopyRxFrame( pCS, pData+2);

    /* Join the cluster to the MBlock */

    netClBlkJoin (pClBlk, pData, DataLen, NULL, 0, 0, 0);
    netMblkClJoin (pMblk, pClBlk);

   /* Set offset 2 to the receiving buffer pointer so that the IP heater starts the
      17th bytes for 32-bits alignment*/
    /*pMblk->mBlkHdr.mData += pDrvCtrl->offset;*/
    pMblk->mBlkHdr.mData += 2;
    pMblk->mBlkHdr.mLen = DataLen;
    pMblk->mBlkHdr.mFlags |= M_PKTHDR;
    pMblk->mBlkPktHdr.len = DataLen;

   /* Queue a pointer to the buffer to be processed at task level */
   csEnqueue( pCS->pRxBuffProcessList, pMblk );
}



/*******************************************************************************
* csEventHandler -
*
* This routine runs at the task level to processes RX frames and frees TX'd 
* mbuf chains queued at the ISR level.  Up to two instances of this
* routine may be queued to tNetTask to prevent a race condition between final
* checking of a queue here and an enqueue at the ISR level.  A netJob
* "counter" is decremented each time this routine starts.
*
* RETURNS: Nothing.
*
*/

LOCAL void csEventHandler( CS_END_DEVICE *pCS )
{
   void  *pBuff;

   if( pCS->NetJobDepth > 0 ) 
       pCS->NetJobDepth--;
      
   while( !csQueueEmpty( pCS->pRxBuffProcessList ) )
   {
      /* Process an RX frame */  
      pBuff = csDequeue( pCS->pRxBuffProcessList );
      csProcessReceive( pCS, pBuff ); 
   }

   while( !csQueueEmpty( pCS->pTxBuffFreeList ) )
   {
      /* Free up the TX'd mbuf chains */
      pBuff = csDequeue( pCS->pTxBuffFreeList );    
      netMblkClChainFree (pBuff);
   }
}






/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
 * Transmit-releated Routines                                              *
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */



/*******************************************************************************
*
* csStartOutput -
*
* This routine is called to start the transmission of the packet at the head
* of the transmit queue.  This routine is called by the ether_output() routine
* when a new packet is added to the transmit queue. 
*
* RETURNS: Nothing
*
*/

LOCAL void csStartOutput( CS_END_DEVICE *pCS,  M_BLK_ID pMBuf)
{
   BOOL  QError;

   END_TX_SEM_TAKE(&pCS->end, WAIT_FOREVER);
   QError = csEnqueue( pCS->pTxQueue, pMBuf );
   END_TX_SEM_GIVE(&pCS->end);
     
   if ( QError )
   {
      /* TxQueue is full -- dump the frame and exit loop */             
      netMblkClChainFree (pMBuf);
      /* Update output stats */
      END_ERR_ADD (&pCS->end, MIB2_OUT_ERRS, +1);
      LOGMSG("csStartOutput: CS_END_DEVICE %d, Transmit queue overflow\n",
              pCS->unit, 0,0,0,0,0 );
   }

#ifdef CS_DEBUG_ENABLE
   pCS->TxQueueDepth++;
   if ( pCS->TxQueueDepth > pCS->MaxTxQueueDepth )
             pCS->MaxTxQueueDepth = pCS->TxQueueDepth;
#endif

   /* Update output stats */
   END_ERR_ADD (&pCS->end, MIB2_OUT_UCAST, +1);

   /* Transmit another frame if a TX is not currently in progress */
   if ( !pCS->TxInProgress ) 
   {
      csTxNextFrame( pCS );
   }
}



/*******************************************************************************
* csTxNextFrame -
*
* This routine start the TX of the next frame in the local TX send queue.
* If an error occurs, the output error count is incremented and the mbuf chain
* is freed, either by immediately calling mfree_m() if we are at task level, 
* or queueing the mbuf chain for release at the task level if we are currently
* at the ISR level.
*
* RETURNS: Nothing
*
*/

LOCAL void csTxNextFrame ( CS_END_DEVICE *pCS )
{
USHORT BusStatus;
M_BLK_ID  pMbuf;

   /* Transmit the next frame in the local TxQueue */
   while( !csQueueEmpty( pCS->pTxQueue ) )
   {
#ifdef CS_DEBUG_ENABLE
      pCS->TxQueueDepth--;
#endif

      pCS->pTxFrameChain = csDequeue( pCS->pTxQueue );
         
      /* Find the total length of the data to transmit */
      pCS->TxLength = 0;
      for ( pMbuf = pCS->pTxFrameChain; pMbuf!=NULL; pMbuf=pMbuf->mBlkHdr.mNext )
      {
         pCS->TxLength += pMbuf->mBlkHdr.mLen;
      }

      /* 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 */
         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 )
            {
               /* 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."*/
            LOGMSG("csStartOutput: CS_END_DEVICE %d, Transmit bid error (too big)\n",
                       pCS->unit, 0,0,0,0,0 );

            /* 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;

            /* 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;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品中文欧美| 欧美国产国产综合| 亚洲sss视频在线视频| 色天天综合色天天久久| 亚洲你懂的在线视频| 欧美在线免费播放| 婷婷开心久久网| 欧美精品一区二区三区在线播放| 激情国产一区二区| 国产欧美一区二区精品久导航 | 欧美日本一区二区| 麻豆精品在线看| 国产午夜一区二区三区| 91亚洲精华国产精华精华液| 亚洲第一av色| 久久只精品国产| 99re这里只有精品首页| 亚洲成人激情社区| 久久蜜桃香蕉精品一区二区三区| 国产.欧美.日韩| 亚洲一区二区三区中文字幕| 日韩一卡二卡三卡国产欧美| 国产美女精品在线| 亚洲精品老司机| 日韩精品在线看片z| av在线不卡观看免费观看| 香蕉影视欧美成人| 国产亚洲一区二区三区| 91在线你懂得| 精品一区二区三区的国产在线播放| 久久精品日产第一区二区三区高清版 | 天堂成人免费av电影一区| 欧美精品一区二| 色综合久久久久| 久久精品99国产国产精| 亚洲天堂福利av| 精品美女一区二区| 欧美综合亚洲图片综合区| 国产乱码精品一区二区三区av| 亚洲乱码国产乱码精品精小说 | 欧美猛男男办公室激情| 国产**成人网毛片九色 | 国产精品综合av一区二区国产馆| 亚洲精品一卡二卡| 久久久久久久久岛国免费| 91成人国产精品| 成人91在线观看| 久久99蜜桃精品| 亚洲成人www| 亚洲女爱视频在线| 国产精品色在线| 亚洲精品在线三区| 3atv在线一区二区三区| 色老汉一区二区三区| 福利视频网站一区二区三区| 日本免费在线视频不卡一不卡二| 亚洲欧洲综合另类在线| 国产精品青草综合久久久久99| 欧美一级xxx| 欧美精品在线视频| 日本高清免费不卡视频| 99re66热这里只有精品3直播 | 成人ar影院免费观看视频| 久久国产乱子精品免费女| 亚洲第一福利视频在线| 亚洲自拍都市欧美小说| 《视频一区视频二区| 日本一区二区电影| 亚洲国产成人在线| 国产日本一区二区| 久久久久一区二区三区四区| 久久综合九色综合97_久久久| 日韩一卡二卡三卡国产欧美| 欧美一区二区三区精品| 欧美一区二区三区视频在线观看 | 欧美一区二区三区四区五区 | 欧美午夜精品理论片a级按摩| 成人aa视频在线观看| 成人av资源网站| 不卡视频在线观看| 成人99免费视频| 91亚洲永久精品| 91视频.com| 欧洲日韩一区二区三区| 欧美性高清videossexo| 欧美三级电影网站| 欧美剧情片在线观看| 日韩三级视频在线看| 日韩欧美久久久| 久久久激情视频| 国产精品狼人久久影院观看方式| 国产精品免费看片| 亚洲精品国产无套在线观| 亚洲午夜免费视频| 免费人成在线不卡| 国产麻豆成人精品| 色综合久久精品| 欧美一区二区三区免费在线看 | 欧美韩日一区二区三区四区| 国产精品久久久久影视| 亚洲精品中文字幕乱码三区| 亚洲成人久久影院| 黑人巨大精品欧美一区| 高清beeg欧美| 欧美午夜片在线观看| 精品国产一区二区精华| 国产精品毛片无遮挡高清| 亚洲综合在线五月| 麻豆精品国产91久久久久久| 国产91色综合久久免费分享| 一本到高清视频免费精品| 88在线观看91蜜桃国自产| 国产三级欧美三级日产三级99 | 精品国产一区二区亚洲人成毛片| 国产精品视频免费看| 亚洲成a人片综合在线| 黄页网站大全一区二区| 91蜜桃在线免费视频| 日韩视频一区在线观看| 中文av一区二区| 五月开心婷婷久久| 国产99精品国产| 日韩午夜激情电影| 亚洲免费观看高清完整版在线观看熊| 日韩主播视频在线| 99热精品国产| 欧美精品一区二区三区很污很色的| 亚洲图片激情小说| 精品一区二区日韩| 欧美日韩一区成人| 中文字幕不卡在线| 麻豆一区二区在线| 欧美午夜电影在线播放| 国产精品久久久久久亚洲毛片 | 亚洲www啪成人一区二区麻豆| 国产精品一区二区三区四区| 欧美日韩一区国产| 国产精品久线观看视频| 日本欧美在线观看| 日本道色综合久久| 欧美国产精品v| 国内精品写真在线观看| 欧美美女一区二区在线观看| 中文字幕一区在线观看视频| 极品少妇一区二区三区精品视频 | 337p亚洲精品色噜噜狠狠| 国产精品电影一区二区| 激情综合五月婷婷| 欧美一区二区不卡视频| 亚洲国产日韩av| 色视频一区二区| 国产精品久久久久一区| 国产91在线看| 国产日韩av一区| 高清不卡在线观看| 国产亚洲va综合人人澡精品| 久久精品国产秦先生| 日韩美女天天操| 麻豆精品一区二区三区| 日韩一级完整毛片| 麻豆精品视频在线| 欧美大片国产精品| 久久成人久久鬼色| 精品sm捆绑视频| 韩国精品一区二区| 久久精品视频一区二区三区| 国产精品538一区二区在线| 久久久精品免费网站| 国产成人亚洲综合色影视 | 国产精品剧情在线亚洲| 成人一级黄色片| 国产精品卡一卡二卡三| 91在线一区二区| 亚洲欧美aⅴ...| 欧美视频在线播放| 日本成人超碰在线观看| 日韩欧美国产午夜精品| 久久精品72免费观看| 国产亚洲制服色| 成人免费不卡视频| 亚洲激情自拍视频| 欧美日韩国产首页| 麻豆成人91精品二区三区| 2021国产精品久久精品| 国产成人精品午夜视频免费| 中文字幕av免费专区久久| 99久久99久久精品免费看蜜桃| 一区二区在线免费| 91精品国产色综合久久ai换脸| 蜜臀av性久久久久蜜臀aⅴ四虎 | 丁香一区二区三区| 亚洲免费观看视频| 日韩一区二区精品葵司在线| 国产精品综合久久| 亚洲精品国产第一综合99久久 | 久久精品在线观看| 在线免费av一区| 国内精品伊人久久久久av一坑 | 亚洲福利一二三区| 精品国产亚洲在线|