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

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

?? if_cs.c

?? 這是一個在VxWorks系統實現CS網卡END驅動的原代碼
?? C
?? 第 1 頁 / 共 5 頁
字號:
                    );

    pCS->ArpCom.ac_if.if_start = (FUNCPTR) csStartOutput; 
#endif

     /* Promiscuous@kml Set promiscuous mode if user asked for. */ 
	if ( pCS->ConfigFlags & CFGFLG_PROMISC_MODE ) {
		pCS->ArpCom.ac_if.if_flags |= IFF_PROMISC;
    }


   return OK;
}



/*******************************************************************************
*
* csInit -
*
* This routine is a major entry point and is called to initialize this network
* interface driver.  This routine may be called several times for each
* operating system reboot to dynamically bring the network interface driver
* to an up and running state.  This routine is called by the protocol stack,
* the set_if_addr() routine, and the csIoctl() routine.
*
* This routine resets and then initializes the CS8900 chip.
*
*/

LOCAL STATUS csInit( int Unit )
{
   FAST CS_SOFTC *pCS;

   if ( Unit >= CS_MAX_NUM_UNITS ) 
      return ERROR;

   pCS = &cs_softc[Unit];

   /* Mark the interface as down */
   pCS->ArpCom.ac_if.if_flags &= ~(IFF_UP | IFF_RUNNING);

   LOGMSG("csInit: unit %d, Initializing interface\n",
      pCS->ArpCom.ac_if.if_unit, 0,0,0,0,0 );

   /* Reset the chip */
   if ( csResetChip(pCS) == ERROR )
   {
      LOGMSG("csInit: unit %d, Can not reset the chip\n",
         pCS->ArpCom.ac_if.if_unit, 0,0,0,0,0 );
      return ERROR;
   }

   /* Initialize the chip */
   csInitChip( pCS );

   /* Mark the interface as up and running and supporting multicasting*/
#ifdef BSD43_DRIVER
   pCS->ArpCom.ac_if.if_flags |= (IFF_UP | IFF_RUNNING ); /* Multicast not supported by BSD43. */
#else
   pCS->ArpCom.ac_if.if_flags |= (IFF_UP | IFF_RUNNING | IFF_MULTICAST );
#endif

   return OK;
}




/*******************************************************************************
*
* csReset -
*
* This routine is a major entry point and is called by the protocol stack to
* shut down this network interface driver.  This routine may be called several
* times for each operating system reboot to dynamically bring the network
* interface driver to a non-running state.
*
* This routine resets the CS8900 chip.
*
*/

LOCAL void csReset( int Unit )
{
   FAST CS_SOFTC *pCS;

   if ( Unit >= CS_MAX_NUM_UNITS ) 
      return;

   pCS = &cs_softc[Unit];

   LOGMSG("csReset: unit %d, Resetting interface\n",
     pCS->ArpCom.ac_if.if_unit, 0,0,0,0,0 );

   /* Mark the interface as down */
   pCS->ArpCom.ac_if.if_flags &= ~IFF_RUNNING;

   /* Reset the chip */
   csResetChip( pCS );
}




/*******************************************************************************
*
* csIoctl -
*
* This routine is a major entry point and is called by the protocol stack to
* modify characteristics of this network interface driver.  There are many
* network interface ioctl commands, but this driver only supports two of them:
* Set Interface Address and Set Interface Flags.
*
*/

LOCAL int csIoctl( struct ifnet *pIf, int Command, char *pData )
{
   int State;
   int Result;
   FAST CS_SOFTC *pCS;

   State = splnet();

   pCS = &cs_softc[pIf->if_unit];

   Result = OK;  /* Assume everything will go OK */

   switch( Command )
   {
      case SIOCSIFADDR:  /* Set interface address (IP address) */
         LOGMSG("csIoctl: unit %d, Set interface address\n",
            pCS->ArpCom.ac_if.if_unit, 0,0,0,0,0 );
         Result = set_if_addr( pIf, pData, (UCHAR *)pCS->ArpCom.ac_enaddr );
         /* Note: set_if_addr() calls csInit() */
         break;

      case SIOCSIFFLAGS:  /* Set interface flags */
         LOGMSG("csIoctl: unit %d, Set interface flags\n",
            pCS->ArpCom.ac_if.if_unit, 0,0,0,0,0 );
         
         /* Promiscuous@kml If need to enable the promiscuous mode */
		 if (pIf->if_flags & IFF_PROMISC) {
            pCS->ArpCom.ac_if.if_flags |= IFF_PROMISC;
            pCS->ConfigFlags |= CFGFLG_PROMISC_MODE;
         } else {
            pCS->ArpCom.ac_if.if_flags &= ~IFF_PROMISC;
            pCS->ConfigFlags &= ~CFGFLG_PROMISC_MODE;
		 }

         if ( pIf->if_flags & IFF_UP )
         {
            /* Mark the interface as up and running */
            pCS->ArpCom.ac_if.if_flags |= (IFF_UP | IFF_RUNNING);

            /* Initialize the interface */
            csInit( pIf->if_unit );
         }
         else  /* The interface is down */
         {
            /* Mark the interface as down */
            pCS->ArpCom.ac_if.if_flags &= ~(IFF_UP | IFF_RUNNING);

            /* Reset the chip */
            csResetChip( pCS );
         }
         break;

#ifndef BSD43_DRIVER
	 case SIOCADDMULTI:
		 if ( !pData) {
		    Result = EINVAL;  /* Invalid argument */
            break;
         }
         csMCastAdd (pCS, pData);
         break;


	 case SIOCDELMULTI:
		 if ( !pData) {
		    Result = EINVAL;  /* Invalid argument */
            break;
         }
         csMCastDel(pCS, pData);
         break;
#endif

      default:
         Result = EINVAL;  /* Invalid argument */
         break;
   }

   splx( State );

   return Result;
}



#ifdef BSD43_DRIVER
/*******************************************************************************
*
* csOutput -
*
* This routine is a major entry point and is called by the protocol stack to
* transmit a packet across the LAN.  The packet data is passed to this routine
* in a chain of mbuf structures.
*
* This routine calls the ether_output() routine, which in turn calls the
* csStartOutput() routine.  The ether_output() routine resolves the destination
* IP address to it's Ethernet address, builds an Ethernet header and prepends
* the Ethernet header to the mbuf chain.  The mbuf chain is added to the end
* of the network interface driver's transmit queue.  
*
*/

LOCAL int csOutput( struct ifnet *pIf, struct mbuf *pMbufChain, SOCKADDR *pDst )
{
   FAST CS_SOFTC *pCS;

   pCS = &cs_softc[pIf->if_unit];

   /* Call ether_ouput to queue the TX frame */
   return ether_output( pIf, pMbufChain, pDst, (FUNCPTR)csStartOutput,
         &pCS->ArpCom );
}

#endif /* BSD43_DRIVER */


/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
 * Interrupt-handler Routines                                              *
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */


/*******************************************************************************
*
* csIntr -
*
* This routine in the interrupt service routine.  This routine is called by
* VxWorks wrapper code whenever the CS8900 chip generates and interrupt.  The 
* wrapper code issues an EOI command.
*
* This routine processes the events on the Interrupt Status Queue.  The events
* are read one at a time from the ISQ and the appropriate event handlers are
* called.  The ISQ is read until it is empty.  Reading a zero from the ISQ will
* deassert the interrupt request line.
*
* RETURNS: Nothing
*
*/

LOCAL void csIntr( int Unit )
{
   FAST CS_SOFTC *pCS;
   USHORT Event;
   struct ifnet *pIf;

   if( Unit >= CS_MAX_NUM_UNITS ) 
      return;

   pCS = &cs_softc[Unit];
   pIf = &pCS->ArpCom.ac_if;

   /* Ignore any interrupts that happen while the chip is being reset */
   if( pCS->Resetting )
      return;

   /* Set locale flag */
   pCS->InISR = TRUE;

   /* Read an event from the Interrupt Status Queue */
   if( pCS->InMemoryMode )
      Event = csReadPacketPage( pCS, PKTPG_ISQ );
   else
      Event = SYS_ENET_IN_WORD( (pCS->IOAddr)+PORT_ISQ );

   /* Process all the events in the Interrupt Status Queue */
   while( Event != 0 )
   {
      /* Dispatch to an event handler based on the register number */
      switch ( Event & REG_NUM_MASK )
      {
         case REG_NUM_RX_EVENT:
            csReceiveEvent( pCS, Event );
            break;

         case REG_NUM_TX_EVENT:
            csTransmitEvent( pCS, Event );
            break;

         case REG_NUM_BUF_EVENT:
            csBufferEvent( pCS, Event );
            break;

         case REG_NUM_RX_MISS: 
            /* Read the Rx Miss count (clears the counter). */
	    /* Miss count is in the 10 MSBs */
            pCS->ArpCom.ac_if.if_ierrors += ( (BYTE_SWAP(Event)) >> 6); 

            LOGMSG("csRxMissEvent: unit %d,, %d added to RX miss counter\n",
	       pCS->ArpCom.ac_if.if_unit, ( (BYTE_SWAP(Event)) >> 6),0,0,0,0 );
            break;

         case REG_NUM_TX_COL:  
            /* Read the collision counter (clears the counter). */           
	    /* Collision count is in the 10 MSBs */
            pCS->ArpCom.ac_if.if_collisions += ( (BYTE_SWAP(Event)) >> 6); 

            LOGMSG("csTxColEvent: unit %d, %d added to collision counter\n",
               pCS->ArpCom.ac_if.if_unit, ( (BYTE_SWAP(Event)) >> 6),0,0,0,0 );
            break;
  
         default: 
            LOGMSG("csIntr: unit %d, Unknown interrupt event: %04X\n",
               pCS->ArpCom.ac_if.if_unit, (BYTE_SWAP(Event)),0,0,0,0 );
            break;
      }

      /* Read another event from the Interrupt Status Queue */
      if ( pCS->InMemoryMode )
         Event = csReadPacketPage( pCS, PKTPG_ISQ );
      else
         Event = SYS_ENET_IN_WORD( (pCS->IOAddr)+PORT_ISQ );
   }
   
   /* Ensure task-level event handler is running */
   if( pCS->NetJobDepth < 2 )
   {
      pCS->NetJobDepth++;
	  netJobAdd ((FUNCPTR)csEventHandler, (int)pCS, 0, 0, 0, 0);
   }

   /* Clear locale flag */
   pCS->InISR = FALSE;
}


/*******************************************************************************
*
* csBufferEvent -
*
* The routine is called whenever an event occurs regarding the transmit and
* receive buffers within the CS8900 chip.  The only buffer events we 
* currently handle are Rdy4TX interrupts, Tx Underruns, and SW ints.
*
*/

LOCAL void csBufferEvent( CS_SOFTC *pCS, USHORT BufEvent )
{

   USHORT BusStatus;

  if ( BufEvent & BUF_EVENT_TX_UNDR )
   {

      /* TX underrun occured */
      pCS->TxUnderruns++;

      /* Modify start command if total underruns > threshold value */
      /* by setting TX start command to next increment */
      if( pCS->TxUnderruns == CS_TX_UNDRUN_TRHSHOLD )
      {
          /* Reset the threshold counter */
          pCS->TxUnderruns = 0;
          
          /* Select the next TxStartCommand */ 
          if( pCS->TxStartCMD == TX_CMD_START_5 )
             pCS->TxStartCMD = TX_CMD_START_381;

          else if( pCS->TxStartCMD == TX_CMD_START_381 )
             pCS->TxStartCMD = TX_CMD_START_1021;

	  else pCS->TxStartCMD = TX_CMD_START_ALL;
      }
       
      /* Try to TX the frame again */
      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 )
      {
	    /* On-chip buffer space available -- start transmission */
	    csCopyTxFrame( pCS, pCS->pTxFrameChain );
      } /* @kml Do NOT give up the frame. */
     /* else
      {*/
	    /* Give up on this frame */
	    /* Queue the mbuf chain to be freed at task level */
	 /*   csEnqueue( pCS->pTxBuffFreeList, pCS->pTxFrameChain );*/

	    /* Set TX not in progress */
	 /*   pCS->pTxFrameChain = NULL;
	    pCS->TxInProgress = FALSE;*/

	    /* Update output stats */
	   /* pCS->ArpCom.ac_if.if_opackets--;*/
  /* @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_oerrors++;*/

	    /* Start TX of the next frame if any */
	    /*csTxNextFrame( pCS );*/
      /*}*/

      LOGMSG("csBufferEvent: unit %d, Transmit underrun\n",
         pCS->ArpCom.ac_if.if_unit, 0,0,0,0,0 );

      pCS->TotalTxUnderruns++;
   }


   else if ( BufEvent & BUF_EVENT_RDY4TX )
   {
      (pCS->Rdy4TxInts) += 1;

      /* The chip is ready for transmission now */

      /* If a TX is pending, copy the frame to the chip to start transmission */
      if( pCS->pTxFrameChain != NULL )
      {
         csCopyTxFrame( pCS, pCS->pTxFrameChain );
      }
   }


   else if ( BufEvent & BUF_EVENT_SW_INT )

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
天天操天天干天天综合网| 亚洲午夜日本在线观看| 亚洲男人的天堂av| 激情五月婷婷综合| 欧美揉bbbbb揉bbbbb| 中文字幕av一区二区三区免费看| 午夜视频一区在线观看| 97精品国产97久久久久久久久久久久| 日韩精品中文字幕一区二区三区| 中文字幕一区二区在线观看 | 日韩高清一区二区| 99久免费精品视频在线观看| 久久一二三国产| 蜜臀av性久久久久蜜臀aⅴ| 欧美日韩亚洲丝袜制服| 亚洲欧洲精品一区二区精品久久久 | 日本韩国精品一区二区在线观看| 欧美精品一区二区蜜臀亚洲| 日本美女一区二区三区视频| 欧美男人的天堂一二区| 亚洲午夜电影网| 欧美怡红院视频| 亚洲美女免费视频| 93久久精品日日躁夜夜躁欧美| 国产女同互慰高潮91漫画| 美女免费视频一区二区| 欧美一区二区三区啪啪| 午夜影院久久久| 欧美精品日韩精品| 亚洲成人激情社区| 欧美美女网站色| 午夜成人免费电影| 91精品在线观看入口| 天天综合色天天| 日韩视频一区在线观看| 麻豆精品一区二区av白丝在线| 91精品国产综合久久精品图片| 成人免费黄色在线| 国产精品久久久久久久久晋中| 成人午夜大片免费观看| 中文字幕在线一区| 99精品国产热久久91蜜凸| 亚洲免费观看高清完整版在线| 欧美性大战xxxxx久久久| 国产成人精品影视| 国产女主播视频一区二区| 国产99久久久久| 亚洲天堂免费在线观看视频| 欧美性生活影院| 免费观看30秒视频久久| 国产午夜一区二区三区| 99视频一区二区| 亚洲国产毛片aaaaa无费看| 精品视频资源站| 精品亚洲国内自在自线福利| 国产日韩欧美精品电影三级在线| 91网站在线播放| 老司机精品视频导航| 久久久www免费人成精品| 99国内精品久久| 日韩av电影天堂| 欧美高清在线精品一区| 欧美亚洲动漫制服丝袜| 久久99精品国产麻豆婷婷洗澡| 欧美人与性动xxxx| 老司机免费视频一区二区| 精品少妇一区二区三区在线播放 | 亚洲欧美日韩国产手机在线| 91黄色激情网站| 精品一区二区免费视频| 亚洲乱码国产乱码精品精小说| 欧美精品vⅰdeose4hd| 国产成人av电影| 午夜精品在线看| 日本一区二区三区免费乱视频| 欧美丰满美乳xxx高潮www| 丁香激情综合五月| 日本欧美一区二区三区| 亚洲免费av观看| 欧美精品一区二区不卡| 91国偷自产一区二区使用方法| 久久影视一区二区| 大胆欧美人体老妇| 亚洲精品中文字幕乱码三区| 91精品视频网| 色综合天天综合网天天狠天天| 免费观看一级特黄欧美大片| 亚洲人123区| 久久久精品国产免大香伊 | 国产日产欧美一区| 91麻豆精品国产91久久久 | 91亚洲永久精品| 国产精品中文字幕欧美| 天天综合网天天综合色| 91精品免费观看| 91在线一区二区三区| 国产福利一区二区| 狠狠色狠狠色综合| 日韩国产欧美在线观看| 亚洲综合丁香婷婷六月香| 国产精品少妇自拍| 久久日韩精品一区二区五区| 884aa四虎影成人精品一区| 欧美自拍偷拍一区| 成人精品国产一区二区4080| 成人一区二区在线观看| 国产成人精品亚洲777人妖| 国产精品一品二品| 免费精品99久久国产综合精品| 日韩av在线发布| 麻豆成人免费电影| 免费在线观看一区二区三区| 日韩中文字幕1| 日韩av电影免费观看高清完整版 | 91免费版pro下载短视频| a4yy欧美一区二区三区| 国产成人精品免费在线| 国产精品1区2区3区在线观看| 国产精品一二三在| 国产九色sp调教91| voyeur盗摄精品| 91影院在线免费观看| 色综合久久久网| 91老司机福利 在线| 色乱码一区二区三区88| 色婷婷一区二区三区四区| 在线视频一区二区三| 欧美三电影在线| 日韩欧美在线一区二区三区| 欧美精品一区二区蜜臀亚洲| 中文字幕+乱码+中文字幕一区| 国产精品久久夜| 亚洲乱码国产乱码精品精的特点| 亚洲高清久久久| 老司机午夜精品| 99久久综合精品| 欧美情侣在线播放| 久久久精品影视| 亚洲欧美日韩一区二区三区在线观看 | 久久这里只有精品6| 欧美大尺度电影在线| 天天综合天天综合色| 国模一区二区三区白浆| 成人va在线观看| 欧美性xxxxxxxx| 精品国产精品一区二区夜夜嗨| 国产免费久久精品| 亚洲国产视频在线| 国产麻豆精品视频| 在线中文字幕一区二区| 久久综合色8888| 一区二区三区波多野结衣在线观看| 日本最新不卡在线| 不卡的av在线| 欧美一区二区人人喊爽| 亚洲欧洲精品一区二区三区| 奇米色777欧美一区二区| 成人h动漫精品一区二区| 欧美精品九九99久久| 国产精品久久久久久久久免费丝袜 | 亚洲午夜激情网站| 亚洲国产精品一区二区www| 韩国理伦片一区二区三区在线播放| www.成人网.com| 精品国产免费久久 | 中文字幕一区二区视频| 日韩福利视频网| 91亚洲国产成人精品一区二区三| 日韩女同互慰一区二区| 夜夜爽夜夜爽精品视频| 国产传媒欧美日韩成人| 91精品国产综合久久久久久| 亚洲色图.com| 国产盗摄一区二区| 日韩欧美亚洲另类制服综合在线| 一区二区三区四区在线| 懂色一区二区三区免费观看| 综合在线观看色| 福利一区福利二区| 久久综合色天天久久综合图片| 天堂成人免费av电影一区| 色综合久久久久综合体桃花网| 青青草原综合久久大伊人精品优势 | 日韩理论片在线| 国产一区二区毛片| 日韩精品一区国产麻豆| 天堂在线一区二区| 欧美日韩免费观看一区三区| 亚洲最新在线观看| 色噜噜夜夜夜综合网| 亚洲色图自拍偷拍美腿丝袜制服诱惑麻豆 | 日韩av中文字幕一区二区三区| 在线观看精品一区| 亚洲日穴在线视频| 91免费视频网| 亚洲免费观看高清完整版在线观看| 成人黄色777网| 亚洲色图在线看| 91福利在线导航| 亚洲一区二区三区四区在线|