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

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

?? if_cs.c

?? 這是一個(gè)在VxWorks系統(tǒng)實(shí)現(xiàn)CS網(wǎng)卡END驅(qū)動(dòng)的原代碼
?? C
?? 第 1 頁(yè) / 共 5 頁(yè)
字號(hào):
   PRXBUF pRxBuff;
   PRXBUF pRxLast;

   /* Allocate the receive frame buffers */
   pCS->pFreeRxBuff = (PRXBUF)malloc( sizeof(RXBUF)*CS_NUM_RX_BUFFERS );
   if ( pCS->pFreeRxBuff == NULL ) 
   {
     return ERROR;
   }

   /* Link all the receive frame buffers together on the free list */
   pRxLast = pCS->pFreeRxBuff + CS_NUM_RX_BUFFERS - 1;
   for ( pRxBuff=pCS->pFreeRxBuff; pRxBuff<pRxLast; pRxBuff++ )
   {
      pRxBuff->pNext  = pRxBuff+1;
      pRxBuff->Status = RXBUF_FREE;
   }
   pRxLast->pNext  = NULL;
   pRxLast->Status = RXBUF_FREE;

   return OK;
}



/*******************************************************************************
*
* csAllocRxBuff -
*
* This routine removes a receive buffer from the free receive buffer list.
*
*/

LOCAL PRXBUF csAllocRxBuff( CS_SOFTC *pCS )
{
   PRXBUF pRxBuff;

   if ( pCS->pFreeRxBuff == NULL ) 
   {
     return NULL;
   }

   /* Remove a buffer from the free list */
   pRxBuff = pCS->pFreeRxBuff;
   pCS->pFreeRxBuff = pRxBuff->pNext;
   pRxBuff->pNext = NULL;

   /* Init the reference count to zero */
   pRxBuff->RefCount = 0;

   /* The buffer is now allocated */
   pRxBuff->Status = RXBUF_ALLOCATED;

   /* Increment number of receive buffers currently in use */
   pCS->RxDepth++;
   if ( pCS->RxDepth > pCS->MaxRxDepth )
   {
      pCS->MaxRxDepth = pCS->RxDepth;
   }

   return pRxBuff;
}



/*******************************************************************************
*
* csFreeRxBuff -
*
* This routine returns an allocated receive buffer back to the free list.
*
*/

LOCAL void csFreeRxBuff( CS_SOFTC *pCS, PRXBUF pRxBuff )
{
   int IntState;

   /* Disable interrupts at the CPU so csAllocRxBuff() will not interrupt */
   IntState = intLock();

   /* Put the buffer at the head of the free list */
   pRxBuff->pNext = pCS->pFreeRxBuff;
   pCS->pFreeRxBuff = pRxBuff;

   /* The buffer is now free */
   pRxBuff->Status = RXBUF_FREE;

   /* Decrement the outstanding receive depth */
   pCS->RxDepth--;

   /* Re-enable interrupts at the CPU */
   intUnlock( IntState );

}




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



/*******************************************************************************
* csInitQueue -
*
* Initializes an array-implemented circular queue.
*
* RETURNS: Nothing.
*
*/
LOCAL void csInitQueue( CIR_QUEUE *Q )
{
   Q->Head = Q->Tail = 0;
}



/*******************************************************************************
* csQueueEmpty -
*
* Checks the queue's status.
*
* RETURNS: TRUE if queue is empty, FALSE if queue is not empty.
*
*/

LOCAL BOOL csQueueEmpty( CIR_QUEUE *Q )
{
   if( Q->Head == Q->Tail )
      return TRUE;  /* Queue is empty */
   else
      return FALSE;
}




/*******************************************************************************
* csDequeue -
*
* This routine removes a pointer to a value from the end off an 
* array-implemented circular queue.  Assumes the queue is not empty.
*
* RETURNS: Pointer to the dequeued value.
*
*/
LOCAL void *csDequeue( CIR_QUEUE *Q )
{
   FAST void  *Element;

   Element = Q->Queue[Q->Head];
   Q->Head = (Q->Head == CS_MAX_QUEUE) ? 0 : (Q->Head + 1);
   return Element;

}



/*******************************************************************************
* csEnqueue -
*
* This routine adds a pointer to a value to the front of an array-implmented
* circular queue.
*
* RETURNS: OK, or ERROR if the enqueue would cause a queue overflow.
*
*/
LOCAL STATUS csEnqueue( CIR_QUEUE *Q, void *pBuff )
{
   /* If queue is full return ERROR */
   if ( Q->Tail == ((Q->Head == 0) ? CS_MAX_QUEUE : (Q->Head -1)) )
   {
      LOGMSG("csEnqueue: unit %d, Queue Overflow\n",
         0,0,0,0,0,0 );
      return ERROR;    /* Queue overflow */
   }

   /* Else, add data to the queue and return OK */
   Q->Queue[Q->Tail] = pBuff;
   Q->Tail = (Q->Tail == CS_MAX_QUEUE) ? 0 : (Q->Tail + 1);

   return OK;
}



/*******************************************************************************
*
* csVerifyChip -
*
* This routine verifies that the Ethernet chip is present and correct.
*
*/

LOCAL STATUS csVerifyChip( CS_SOFTC *pCS )
{
   USHORT wrVal, rdVal;
   USHORT errorCount = 0;
   USHORT x;

   /* Verify that we can read from the chip */
   x = csReadPacketPage( pCS, PKTPG_EISA_NUM );
   if ( x == 0xFFFF )
   {
      LOGMSG("csInit: unit %d, can't read from chip (I/O address correct?)\n",
         pCS->ArpCom.ac_if.if_unit, 0,0,0,0,0 );
      return ERROR;
   }

   /* Verify that the chip is a Crystal Semiconductor chip */
   if ( x != EISA_NUM_CRYSTAL )
   {
      LOGMSG("csInit: unit %d, Chip is not a Crystal Semiconductor chip\n",
         pCS->ArpCom.ac_if.if_unit, 0,0,0,0,0 );
      return ERROR;
   }

   /* Verify that the chip is a CS8900 */
   x = csReadPacketPage(pCS,PKTPG_PRODUCT_ID);
   x &= PROD_ID_MASK;
   if ( x != PROD_ID_CS8900)
   {
      LOGMSG("csInit: unit %d, Chip is not a CS8900p\n",
         pCS->ArpCom.ac_if.if_unit, 0,0,0,0,0 );
      return ERROR;
   }

    /* walk a one in the memory of the enet controller */
    for( wrVal = 0x0001; wrVal != 0; wrVal <<= 1 )
    {
 
      for( x=0x150; x<= 0x15d; x+=2 )
      {
        /* write out value - don't swap bytes */
        csWritePacketPage( pCS, x, wrVal );
   
        /* read back value - don't swap bytes */
        rdVal = csReadPacketPage( pCS, x );
  
        if( wrVal != rdVal )
        {
          if( errorCount <=10 )
          {
            LOGMSG("csVerifyChip:  ERROR reg %04X, wrVal %04X, rdVal %04X\n",
              x, 
              (unsigned int) BYTE_SWAP(wrVal), 
              (unsigned int) BYTE_SWAP(rdVal),0,0,0 );
          }
          errorCount++;
        }
      }
    } /* end walking one test */

    /* write incrementing value test */
    for( x=0x150, wrVal=0x0101; x<= 0x15d; x+=2, wrVal+=0x0101 )
    {
      /* write out value - don't worry about swapping bytes */
      csWritePacketPage( pCS, x, wrVal );
    } 

    /* read incrementing value test */
    for( x=0x150, wrVal=0x0101; x<= 0x15d; x+=2, wrVal+=0x0101 )
    {
      /* read back value - don't worry about swapping bytes */
      rdVal = csReadPacketPage( pCS, x );
 
      if( wrVal != rdVal )
      {
        LOGMSG("\ncsVerifyChip:  ERROR reg %04X, wrVal %04X, rdVal %04X\n",
              x, 
              (unsigned int) BYTE_SWAP(wrVal), 
              (unsigned int) BYTE_SWAP(rdVal),0,0,0 );
        errorCount++;
      }
    } /* end walking one test */

    if( errorCount != 0 )
    {
      LOGMSG("csVerifyChip: ERROR SRAM test failed, errorCount %d\n", 
        errorCount,0,0,0,0,0 );
      return( ERROR );
    }

   return OK;
}



/*******************************************************************************
*
* csInitChip -
*
* This routine uses the instance global variables in the cs_softc structure to
* initialize the CS890.
*
*/

LOCAL void csInitChip( CS_SOFTC *pCS )
{
   PIA    pIA;
   USHORT RxCtl;/*Promiscuous@kml*/

   /* Configure the adapter for board-specific IO and media type support */
   sysEnetHWInit( pCS );

   /* Initialize the config and control registers */
   csWritePacketPage( pCS, PKTPG_RX_CFG, RX_CFG_ALL_IE );
   csWritePacketPage( pCS, PKTPG_RX_CTL,
         RX_CTL_RX_OK_A | RX_CTL_IND_A | RX_CTL_BCAST_A | RX_CTL_MCAST_A);
   csWritePacketPage( pCS, PKTPG_TX_CFG, TX_CFG_ALL_IE );
   csWritePacketPage( pCS, PKTPG_BUF_CFG, BUF_CFG_ALL_IE ); 

   /* Put Ethernet address into the Individual Address register */
   pIA = (PIA)pCS->ArpCom.ac_enaddr;
   csWritePacketPage( pCS, PKTPG_IND_ADDR,   pIA->word[0] );
   csWritePacketPage( pCS, PKTPG_IND_ADDR+2, pIA->word[1] );
   csWritePacketPage( pCS, PKTPG_IND_ADDR+4, pIA->word[2] );

   /* Set the interrupt level in the chip */
   if ( pCS->IntLevel == 5 )
      csWritePacketPage( pCS, PKTPG_INT_NUM, BYTE_SWAP(3) );
   else
      csWritePacketPage( pCS, PKTPG_INT_NUM, BYTE_SWAP( (pCS->IntLevel)-10 ) );

   /* Promiscuous@kml If need to enable the promiscuous mode */
   if ( pCS->ConfigFlags & CFGFLG_PROMISC_MODE ) {
	  RxCtl=csReadPacketPage(pCS,PKTPG_RX_CTL);
      RxCtl |= (RX_CTL_PROM_A|RX_CTL_MCAST_A|RX_CTL_RX_OK_A | RX_CTL_IND_A | RX_CTL_BCAST_A);
      csWritePacketPage( pCS, PKTPG_RX_CTL, RxCtl );

	  LOGMSG ("csInitChip() Setting promiscuous mode on!\n", 0, 0, 0, 0, 0, 0);
   } else {
	  LOGMSG ("csInitChip() Setting promiscuous mode off!\n", 0, 0, 0, 0, 0, 0);
   }

     
   /* Enable reception and transmission of frames */
   csWritePacketPage( pCS, PKTPG_LINE_CTL,
   csReadPacketPage(pCS,PKTPG_LINE_CTL) | LINE_CTL_RX_ON | LINE_CTL_TX_ON );

   /* Enable interrupt at the chip */
   csWritePacketPage( pCS, PKTPG_BUS_CTL,
   csReadPacketPage(pCS,PKTPG_BUS_CTL) | BUS_CTL_INT_ENBL );
}



/*******************************************************************************
*
* csResetChip -
*
* This routine resets the CS8900 chip.
*
*/

LOCAL STATUS csResetChip( CS_SOFTC *pCS )
{
   int y;
   int x;
   UCHAR dummyVal;

   LOGMSG("csResetChip: unit %d, Reseting the chip......\n",
         pCS->ArpCom.ac_if.if_unit,0,0,0,0,0);

/*@kml assign an initial values to avoid "unused variable" warning when compiling*/
   x=0;
   dummyVal=0;
   
#ifdef HARD_RESET
   /* Disable interrupts at the CPU so reset command is atomic */
   y = intLock();

   /* We are now resetting the chip */
   /* A spurious interrupt is generated by the chip when it is reset. */
   /* This variable informs the interrupt handler to ignore this interrupt. */
   pCS->Resetting = TRUE;

   /* Issue a reset command to the chip */
   csWritePacketPage( pCS, PKTPG_SELF_CTL, SELF_CTL_RESET );

   /* Re-enable interrupts at the CPU */
   intUnlock( y );

   /* If transmission was in progress, it is not now */
   pCS->TxInProgress = FALSE;
   pCS->pTxFrameChain = NULL;

   /* The chip is always in IO mode after a reset */
   pCS->InMemoryMode = FALSE;

   /* Initialize locale flag */
   pCS->InISR = FALSE;

   /* Delay for 125 micro-seconds (one eighth of a second) */
   taskDelay( sysClkRateGet()/8 );

   /* Transition SBHE to switch chip from 8-bit to 16-bit */
   dummyVal = SYS_ENET_IN_BYTE( (pCS->IOAddr)+PORT_PKTPG_PTR );
   dummyVal = SYS_ENET_IN_BYTE( (pCS->IOAddr)+PORT_PKTPG_PTR+1 );
   dummyVal = SYS_ENET_IN_BYTE( (pCS->IOAddr)+PORT_PKTPG_PTR );
   dummyVal = SYS_ENET_IN_BYTE( (pCS->IOAddr)+PORT_PKTPG_PTR+1 );

   /* If EEPROM present, wait up to 125 mSec for EEPROM not busy*/
   y = sysClkRateGet()/8;
   for ( x=0; x<y; x++ )
   {
      if( !(csReadPacketPage(pCS,PKTPG_SELF_ST)&SELF_ST_SI_BUSY) )
         break;
   }
   if ( x == y )
      return ERROR;

   /* Wait up to 125 mSec for initialization is become done */
   for ( x=0; x<y; x++ )
   {
      if ( csReadPacketPage(pCS,PKTPG_SELF_ST)&SELF_ST_INIT_DONE )
         break;
   }
   if ( x == y )
      return ERROR;

   /* Reset is no longer in progress */
   pCS->Resetting = FALSE;

   return OK;
#else
   /* Disable interrupts at the CPU so reset command is atomic */
   y = intLock();

   pCS->Resetting = TRUE;
   /* Disable RX and TX */
   csWritePacketPage(pCS,PKTPG_LINE_CTL, csReadPacketPage(pCS, PKTPG_LINE_CTL) & ~(LINE_CTL_RX_ON | LINE_CTL_TX_ON));

   /* @kml Disable interrupt at the chip to avoid no detection of 
           inter

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久成人久久鬼色| 久久久久88色偷偷免费| 欧美一二三区精品| 国产精品进线69影院| 免费在线一区观看| 欧美私模裸体表演在线观看| 国产日产精品1区| 午夜精品爽啪视频| 99视频在线精品| www成人在线观看| 日韩av在线免费观看不卡| 91亚洲精品久久久蜜桃网站| 久久久久9999亚洲精品| 蜜臀av性久久久久av蜜臀妖精| 91小视频在线免费看| 国产午夜精品一区二区三区嫩草 | 国产欧美1区2区3区| 性欧美疯狂xxxxbbbb| 一本到不卡精品视频在线观看| 久久精品人人做人人爽97| 久久99国产精品尤物| 欧美人狂配大交3d怪物一区 | zzijzzij亚洲日本少妇熟睡| 日韩视频中午一区| 日韩电影免费一区| 欧美日韩一区二区三区视频| 最新久久zyz资源站| 粉嫩aⅴ一区二区三区四区| 精品国产成人在线影院 | 欧美videossexotv100| 午夜精品久久久久久| 欧美午夜在线观看| 亚洲午夜久久久久久久久电影网 | av亚洲精华国产精华精华| 久久久久久免费| 国产麻豆日韩欧美久久| 国产亚洲综合在线| 成人午夜av在线| 国产精品欧美一区二区三区| 国产成人av电影在线观看| 国产婷婷色一区二区三区在线| 国内一区二区在线| 国产网红主播福利一区二区| 成人妖精视频yjsp地址| 国产精品久久久久精k8| 99在线精品观看| 亚洲午夜一二三区视频| 欧美一区二区福利视频| 美女视频黄久久| 国产欧美一区二区精品性| 成人高清视频在线观看| 一区二区三区四区五区视频在线观看| 91在线小视频| 91一区二区在线观看| 亚洲男人的天堂av| 欧美日韩国产影片| 国产一区二区三区香蕉| 国产欧美精品国产国产专区| 91麻豆swag| 久久精品国产99国产| 国产精品天天看| 欧美在线一区二区三区| 欧美a级理论片| 亚洲国产激情av| 欧美视频在线播放| 国产乱码字幕精品高清av | 欧美xxxx老人做受| 国产精品系列在线播放| 玉米视频成人免费看| 欧美一级国产精品| 91在线视频在线| 日日夜夜免费精品| 中文字幕第一区综合| 欧美片网站yy| 99久久免费视频.com| 免费观看一级欧美片| 国产精品不卡一区| 日韩欧美aaaaaa| 一本到不卡免费一区二区| 久久精品国产精品青草| 一区二区三区四区在线免费观看 | 国产精品美日韩| 欧美精品久久久久久久多人混战| 国产精品资源在线看| 亚洲成人av福利| 欧美高清一级片在线观看| 欧美人体做爰大胆视频| av一区二区不卡| 国产自产视频一区二区三区| 婷婷久久综合九色综合绿巨人| 欧美极品美女视频| 欧美哺乳videos| 色欧美乱欧美15图片| 丰满少妇久久久久久久| 日韩二区在线观看| 亚洲国产日日夜夜| 亚洲视频资源在线| 国产日韩av一区| 久久久久久久久97黄色工厂| 91精品福利在线一区二区三区| 99re66热这里只有精品3直播 | 国产蜜臀av在线一区二区三区| 欧美日韩在线免费视频| 日本道免费精品一区二区三区| 国产91综合网| 国产馆精品极品| 国产精品综合在线视频| 国产在线播放一区三区四| 男女激情视频一区| 毛片av中文字幕一区二区| 午夜精品一区在线观看| 亚洲图片欧美综合| 亚洲激情六月丁香| 日韩伦理av电影| 国产精品国产馆在线真实露脸| 久久精品免费在线观看| 欧美精彩视频一区二区三区| 日本亚洲免费观看| 免费人成黄页网站在线一区二区| 亚洲午夜一区二区三区| 午夜影院久久久| 天天综合色天天综合| 午夜亚洲国产au精品一区二区| 亚洲影院久久精品| 午夜国产不卡在线观看视频| 天堂va蜜桃一区二区三区漫画版| 午夜精品久久久久久不卡8050 | 亚洲欧美自拍偷拍| 亚洲激情在线播放| 亚洲国产精品久久久男人的天堂| 一区二区三区四区精品在线视频 | 欧美精品少妇一区二区三区| 7777精品伊人久久久大香线蕉经典版下载| 欧美日韩美女一区二区| 欧美一级高清片在线观看| 久久久综合精品| 亚洲欧洲av一区二区三区久久| 亚洲精品高清在线| 日本中文字幕一区二区视频| 毛片av一区二区| 99久久综合99久久综合网站| 在线观看国产一区二区| 91精品国产色综合久久ai换脸| 精品第一国产综合精品aⅴ| 国产丝袜在线精品| 亚洲午夜精品一区二区三区他趣| 日韩中文字幕区一区有砖一区| 国内不卡的二区三区中文字幕| 波多野结衣精品在线| 欧美视频在线不卡| 国产午夜精品久久久久久免费视| 亚洲精品一二三四区| 看片网站欧美日韩| www.亚洲精品| 91精品国产91久久综合桃花| 国产欧美日韩精品a在线观看| 亚洲欧美另类小说视频| 麻豆国产一区二区| 色综合久久综合| 777a∨成人精品桃花网| 日本一区二区综合亚洲| 三级影片在线观看欧美日韩一区二区| 国产自产高清不卡| 欧美日本不卡视频| 国产精品嫩草影院com| 奇米777欧美一区二区| 91丨porny丨首页| 精品国产精品网麻豆系列 | 91精品黄色片免费大全| 国产欧美精品一区二区三区四区| 偷拍自拍另类欧美| 94-欧美-setu| 中文欧美字幕免费| 激情图区综合网| 欧美日韩高清一区| 一区二区三区在线免费观看| 国产一区 二区| 欧美一区二区人人喊爽| 亚洲专区一二三| av成人免费在线| 国产视频一区在线播放| 久久精品国产99国产| 欧美巨大另类极品videosbest| 亚洲日本韩国一区| 菠萝蜜视频在线观看一区| xnxx国产精品| 九色porny丨国产精品| 欧美一区二区福利视频| 婷婷久久综合九色综合伊人色| 在线亚洲免费视频| 亚洲色图在线播放| 一本久久综合亚洲鲁鲁五月天| 国产精品天干天干在观线| 7777精品伊人久久久大香线蕉的| 亚洲免费在线播放| 日本高清成人免费播放| 亚洲视频免费在线观看| 色一区在线观看| 亚洲综合色在线| 欧美日韩综合色|