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

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

?? if_ne2kd.c

?? 嵌入式TCP/IP協議棧
?? C
?? 第 1 頁 / 共 4 頁
字號:
/****************************************************************************** if_ne2k.c - NE2000 specific functions (or simply NE2000 driver)** portions Copyright (c) 2001 by Partner Voxtream A/S.** The authors hereby grant permission to use, copy, modify, distribute,* and license this software and its documentation for any purpose, provided* that existing copyright notices are retained in all copies and that this* notice and the following disclaimer are included verbatim in any* distributions. No written agreement, license, or royalty fee is required* for any of the authorized uses.** THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.******************************************************************************** REVISION HISTORY (please don't use tabs!)**(yyyy-mm-dd)* 2001-03-01 Mads Christiansen <mads@mogi.dk>, Partner Voxtream.*            Original file.** 2001-10-01 Craig Graham <c_graham@hinge.mistral.co.uk>.*            NBuf's all the way...*****************************************************************************///#include <config.h>#include <stdio.h>#include <string.h>#include "../../netconf.h"#include "../../netbuf.h"#include "if_ne2kr.h"#include "if_ne2k.h"#include "if_os.h"#include "../../netifdev.h"
// ***** INTERNAL TYPE DEFINEStypedef struct{  u_char Status;  u_char NextPage;  u_short Length;} BufferHeader;typedef union{  u_short Word;  u_char  Uchar[2];} Word;// ***** PROTOTYPESstatic int ReadBuffer(BufferHeader *, u_char *, u_short);static NBuf *ReadBufferNBuf(BufferHeader *header, u_short length);// ***** DEFINES// Interrupt Mask Register Setup// Packet received, packet sent, receive error, transmit error, buffer overflow//     No interrupt for counter overflow!#define IMR IMR_PRXE | IMR_PTXE | IMR_RXEE | IMR_TXEE | IMR_OVWE// Minimum packet size for the ethernet (this is without the trailing CRC)#define MIN_PACKET_SIZE 60// ***** LOCAL VARIABLES// Specific NIC info (first 6 bytes are cards MAC address)static u_char CardInfo[16];// Driver statisticsstatic Ne2kStatistics Statistics;// Next packet buffer pointer, used by Ne2kReceivestatic u_char NextPacket;u_char Ne2k_MacAddress[6];int Ne2k_MacAddressSet=0;/** * Override the cards default MAC address * @param pointer to a 6byte array containing the MAC address to use */void Ne2kSetMacAddress(const u_char *address){    memcpy(Ne2k_MacAddress,address,6);    Ne2k_MacAddressSet=1;}static u_char Ne2kInitialize(u_char* address){    u_char ReadData;    UINT32 Test0;    UINT32 Test1;    int Count;    printf("Ne2kInitialise\n");    // ***** Reset statistics    memset(&Statistics, 0, sizeof(Statistics));    printf("0\n");    // ***** Stop NIC    OUTPORTB(NIC_CR, CR_STOP | CR_NO_DMA | CR_PAGE0);    // Do a long wait to let the NIC finish receive/sending    // THIS IS MANDATORY!    LONGPAUSE;    printf("1\n");    // ***** Detect NIC    // Write 0x55 to 'Boundary Pointer Register' on page 0    OUTPORTB(PG0W_BNRY, 0x55);    PAUSE;    printf("2\n");    // Write 0xaa to 'Physical Address Pointer Register2' on page 1    OUTPORTB(NIC_CR, CR_STOP | CR_NO_DMA | CR_PAGE1);    PAUSE;    OUTPORTB(PG1W_PAR2, 0xaa);    PAUSE;    printf("3\n");    // Read 'Boundary Pointer Register' on page 0    OUTPORTB(NIC_CR, CR_STOP | CR_NO_DMA | CR_PAGE0);    PAUSE;    Test0 = INPORTB(PG0R_BNRY);    PAUSE;    printf("4\n");    // Read 'Physical Address Pointer Register2' on page 1    OUTPORTB(NIC_CR, CR_STOP | CR_NO_DMA | CR_PAGE1);    PAUSE;    Test1 = INPORTB(PG1R_PAR2);    PAUSE;    printf("5\n");    // ***** IF NIC is not found THEN RETURN FALSE    if ((Test0 != 0x55) || (Test1 != 0xaa)) {        printf("NIC not found Test0=%lx Test1=%lx\n",Test0,Test1);        return FALSE;    }    printf("Detected Ne2k NIC :)\n");    // ***** Read NIC's MAC address    // We want to read MAC address, select transfer mode (word), no loopback, FIFO 4 words    OUTPORTB(NIC_CR, CR_PAGE0 | CR_NO_DMA | CR_STOP );    PAUSE;    OUTPORTB(PG0W_DCR, DCR_FT1 | DCR_LS | DCR_WTS);    PAUSE;    // Setup Remote Byte Count Register    // We need 16 bytes (value must be doubled)    OUTPORTB(PG0W_RBCR0, 0x20);    PAUSE;    OUTPORTB(PG0W_RBCR1, 0x00);    PAUSE;    // Setup Remote Start Address Register    OUTPORTB(PG0W_RSAR0, 0x00);    PAUSE;    OUTPORTB(PG0W_RSAR1, 0x00);    PAUSE;    // DMA Remote Read and Start NIC    OUTPORTB(NIC_CR, CR_PAGE0 | CR_DMA_READ | CR_START);    PAUSE;    // Read 16 bytes of data (first 6 is our MAC address), the rest is currently not used    for (Count = 0; Count < 16; Count++)        CardInfo[Count] = INPORTB(NIC_DATAPORT);    //++cg[25/09/2001]: allow overrider of MAC address, as current ls808 design doesn't include the bootrom/e2 with the MAC in it...    if(Ne2k_MacAddressSet) {        printf("ne2k reports");        memcpy(CardInfo,Ne2k_MacAddress,6);    } else {        printf("override");    }    printf(" MAC address = %x:%x:%x:%x:%x:%x\n",CardInfo[0],CardInfo[1],CardInfo[2],CardInfo[3],CardInfo[4],CardInfo[5]);    // ***** Reset NIC    // Stop NS 8390 CHIP, somewhere it states that issuing a read to    // NIC address + 1fh (NIC_RESET) will issue a reset on the NIC! SO THIS IS DONE!    ReadData = INPORTB(NIC_RESET);    // Do a long wait for the 8390 to reset.    // THIS IS MANDATORY!    LONGPAUSE;    OUTPORTB(NIC_RESET, ReadData); // THIS IS DONE IN A PACKET DRIVER ?    PAUSE;    // ***********************************************************************************    // ***** The following initialization procedure is taken from the datasheet    // ***** DP8390D/NS32490D NIC Network Interface Controller (July 1995) from National    // ***** Semiconductor.    // ***** 1. Stop NIC (again...)    OUTPORTB(NIC_CR, CR_PAGE0 | CR_STOP | CR_NO_DMA );    // Don't do a longpause, the NIC should already be stopped    PAUSE;    // ***** 2. Initialize Data Configuration Register (DCR) to normal operation,    //          word wide transfer, 4 words FIFO threshold    OUTPORTB(PG0W_DCR, DCR_FT1 | DCR_LS | DCR_WTS);    PAUSE;    // ***** 3. Clear Remote Byte Count Registers (RBCR0, RBCR1)    OUTPORTB(PG0W_RBCR0, 0x00);    PAUSE;    OUTPORTB(PG0W_RBCR1, 0x00);    PAUSE;    // ***** 4. Initialize Receive Configuration Register (RCR) to accept broadcast packets and    //          packets addressed to this NIC (MAC address).    // NOTICE THAT SOME NE2000 CLONES HAVE ACCEPT BROADCAST AND ACCEPT MULTICAST BITS HARDWIRED TOGETHER!    // SO IF YOU SET ONE YOU ALSO SET THE OTHER!    OUTPORTB(PG0W_RCR, RCR_AB | RCR_AM);    PAUSE;    // ***** 5. Place the NIC in Loopback Mode 1, internal loopback (Transmit Configuration Register).    OUTPORTB(PG0W_TCR, TCR_LB0);    PAUSE;    // ***** 6. Initialize Page Start Register, Boundary Pointer & Page Stop Register    OUTPORTB(PG0W_PSTART, RSTART_PG);    PAUSE;    OUTPORTB(PG0W_BNRY, RSTART_PG);    PAUSE;    OUTPORTB(PG0W_PSTOP, RSTOP_PG);    PAUSE;    // ***** 7. Clear Interrupt Status Register (ISR) by writing 0FFh to it..    OUTPORTB(PG0W_ISR, 0xFF);    PAUSE;    // ***** 8. Initialize IMR (Interrupt Mask Register) to accept:    OUTPORTB(PG0W_IMR, IMR);    PAUSE;    // ***** 9. Initialize Physical Address Registers (PAR0-PAR5) (MAC Address)    // Select PAGE 1    OUTPORTB(NIC_CR, CR_PAGE1 | CR_NO_DMA | CR_STOP);    PAUSE;    // Setup MAC address    for (Count = 0; Count < 6; Count++) {        OUTPORTB(PG1W_PAR0 + Count, CardInfo[Count]);        PAUSE;    }    // ***** Initialize Multicast Address Registers to 00h (MAR0-MAR7) (don't accept multicast packets)    for (Count = 0; Count < 8; Count++) {        OUTPORTB(PG1W_MAR0 + Count, 0x00);        PAUSE;    }    // ***** Initialize CURRent pointer to Boundary Pointer + 1    OUTPORTB(PG1W_CURR, RSTART_PG+1);    PAUSE;    NextPacket = RSTART_PG + 1;    // ***** 10. Start NIC    OUTPORTB(NIC_CR, CR_PAGE0 | CR_NO_DMA | CR_START);    PAUSE;    // ***** 11. Initialize the Transmit Configuration Register for normal operation (out of loopback mode)    OUTPORTB(PG0W_TCR, 0x00);    PAUSE;    // ***** Copy the 6 bytes long MAC address    if (address) memcpy(address, CardInfo, 6);    // ***** RETURN TRUE    return TRUE;}static u_char Ne2kStop(void){    // ***** Stop NIC    OUTPORTB(NIC_CR, CR_STOP | CR_NO_DMA | CR_PAGE0);    PAUSE;    // ***** Disable interrupts from NIC    OUTPORTB(PG0W_IMR, 0x00);    PAUSE;    // Clear any generated interrupts    OUTPORTB(PG0W_ISR, 0xff);    PAUSE;    return 0;}void Ne2kProcessInterrupts(void){    register unsigned char i;    // ***** Disable netcard IRQ    DISABLE_NE2K_IRQ;    // ***** Disable interrupts from NIC (IMR = 0)    OUTPORTB(PG0W_IMR, 0x00);    PAUSE;    i = INPORTB(PG0R_ISR);    // ***** WHILE (ISR > 0)    while (i = INPORTB(PG0R_ISR) & 0x3F) {        PAUSE;        // ***** ALL INTERRUPTS MUST BE CLEARED        // ***** (except for OVW, which is cleared when calling Ne2kReceive)        // ***** IF overwrite warning interrupt THEN        if (i & ISR_OVW) {            //printf("nei-OVW\n");            PAUSE;            // ***** CALL Ne2kReceiveEvent()            Ne2kReceiveEvent();        }        else PAUSE;        // ***** IF packet received interrupt THEN        if (i & ISR_PRX) {            //printf("nei-Rx\n");            PAUSE;            // ***** clear packet received interrupt status bit            OUTPORTB(PG0W_ISR, ISR_PRX);            PAUSE;            // ***** CALL Ne2kReceiveEvent()            Ne2kReceiveEvent();        }        else PAUSE;        // ***** IF packet transmitted interrupt THEN        if (i & ISR_PTX) {            //printf("nei-Tx\n");            PAUSE;            // ***** clear packet transmitted interrupt status bit            OUTPORTB(PG0W_ISR, ISR_PTX);            PAUSE;            // ***** CALL Ne2kTransmitEvent()            Ne2kTransmitEvent();        }        else PAUSE;        // ***** IF receive error interrupt THEN        if (i & ISR_RXE) {            //printf("nei-4\n");            PAUSE;            // ***** clear receive error interrupt status bit            OUTPORTB(PG0W_ISR, ISR_RXE);            PAUSE;            // ***** update receive error statistics            Statistics.ReceiveErrors++;        }        else PAUSE;        // ***** IF transmit error interrupt THEN        if (i & ISR_TXE) {            //printf("nei-5\n");            PAUSE;            // ***** clear transmit error interrupt status bit            OUTPORTB(PG0W_ISR, ISR_TXE);            PAUSE;            // ***** update transmit error statistics            Statistics.TransmitErrors++;            // ***** CALL Ne2kTransmitEvent()            Ne2kTransmitEvent();        }        else PAUSE;        /* NETWORK TALLY COUNTERS ARE NOT USED, THEY COULD BE USED FOR MORE PRECISE STATISTICS        // ***** IF counter overflow interrupt THEN        if (i & ISR_CNT) {            PAUSE;            // ***** clear counter overflow interrupt status bit            OUTPORTB(PG0W_ISR, ISR_CNT);            PAUSE;            // ***** empty tally counters            INPORTB(PG0R_CNTR0);            PAUSE;            INPORTB(PG0R_CNTR2);            PAUSE;            INPORTB(PG0R_CNTR3);            PAUSE;        }        else PAUSE;        */    }    // Enabling interrupts again, don't change this order or you might loose interrupts!    DISABLE_INTERRUPTS;    ENABLE_NE2K_IRQ;    SIGNAL_EOI;    ENABLE_INTERRUPTS;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久综合色之久久综合| 91精品国产91久久久久久一区二区 | 日韩精品一区二区三区中文不卡| 精品99一区二区| 亚洲摸摸操操av| 国产精品一二三四区| 国产91丝袜在线观看| 久久99精品视频| 国产69精品久久久久777| 在线观看视频欧美| 国产亚洲女人久久久久毛片| 亚洲一区二区三区精品在线| 国产精品综合久久| 欧美另类z0zxhd电影| 成人欧美一区二区三区黑人麻豆 | 久久久久国产精品厨房| 久久这里都是精品| 丝瓜av网站精品一区二区| 91免费版在线| 欧美激情一区二区三区| 免费成人av资源网| 欧美一级爆毛片| 婷婷中文字幕一区三区| 97久久精品人人做人人爽50路| 久久日韩精品一区二区五区| av一区二区三区黑人| 综合色天天鬼久久鬼色| 欧美成人r级一区二区三区| 亚洲综合在线电影| av不卡一区二区三区| 欧美国产1区2区| 福利91精品一区二区三区| 欧美电影免费观看高清完整版在线观看| 亚洲一区二区中文在线| 91久久香蕉国产日韩欧美9色| 综合电影一区二区三区 | www.一区二区| 国产亚洲精品福利| 国产一区二区三区在线观看免费| 欧美不卡视频一区| 精品一二三四区| 久久久久久久av麻豆果冻| 国产一区二区女| 国产精品美女视频| 91黄色免费版| 成人午夜精品一区二区三区| 亚洲欧美国产77777| 不卡av在线网| 亚洲曰韩产成在线| 欧美日韩国产小视频| 免费在线一区观看| 久久久久久久一区| 91伊人久久大香线蕉| 亚洲人成网站影音先锋播放| 色av成人天堂桃色av| 无码av免费一区二区三区试看| 欧美一区二区三区在线观看视频| 免费成人在线网站| 中文乱码免费一区二区| 91蝌蚪国产九色| 日本视频免费一区| 亚洲国产精品99久久久久久久久| www.成人网.com| 午夜电影一区二区| 亚洲国产视频a| 2024国产精品| 在线看一区二区| 美日韩黄色大片| 国产精品久久久久久久裸模| 欧美日韩一区二区在线观看| 九九国产精品视频| 亚洲精品乱码久久久久久黑人| 欧美群妇大交群中文字幕| 国产一区二区不卡| 亚洲永久免费av| 久久精品亚洲乱码伦伦中文 | 欧美日韩色一区| 国产在线视频精品一区| 亚洲欧美日韩国产中文在线| 91精品国产色综合久久久蜜香臀| 国产91综合网| 免费观看91视频大全| 日韩理论片一区二区| 91在线无精精品入口| 亚洲精品国产成人久久av盗摄| 欧美日本韩国一区| 成人免费视频caoporn| 日本视频免费一区| 亚洲在线中文字幕| 国产精品视频你懂的| 在线综合亚洲欧美在线视频| 成人动漫视频在线| 国产激情视频一区二区三区欧美 | 亚洲影院在线观看| 中文字幕精品三区| 欧美r级在线观看| 911精品国产一区二区在线| 波多野结衣91| 丰满岳乱妇一区二区三区| 蜜桃av噜噜一区二区三区小说| 国产黄人亚洲片| 免费观看成人鲁鲁鲁鲁鲁视频| 亚洲一区二区三区爽爽爽爽爽| 欧美日韩免费在线视频| 一区二区三区产品免费精品久久75| 日韩欧美国产成人一区二区| 欧日韩精品视频| 色综合久久久久久久久| 国产高清无密码一区二区三区| 久久成人18免费观看| 亚洲不卡av一区二区三区| 亚洲精品欧美专区| 亚洲欧美激情插| 亚洲伦在线观看| 一二三区精品福利视频| 综合在线观看色| 亚洲美女精品一区| 亚洲最大色网站| 亚瑟在线精品视频| 日韩福利电影在线观看| 亚洲国产sm捆绑调教视频 | 精品成人一区二区三区| 欧美一级欧美三级| 精品久久久久av影院| 欧美不卡123| 欧美韩国日本不卡| 日韩专区一卡二卡| 日韩av一区二| 日韩女优制服丝袜电影| 最新国产の精品合集bt伙计| 亚洲欧洲另类国产综合| 亚洲品质自拍视频网站| 亚洲激情欧美激情| 天天免费综合色| 日本美女一区二区| 国产一区二区三区高清播放| 国产精品996| 一本大道综合伊人精品热热 | 精品写真视频在线观看| 久久 天天综合| 国产精品性做久久久久久| 丁香六月综合激情| 欧美色视频在线观看| 在线不卡免费av| 久久蜜桃av一区精品变态类天堂| 久久精品人人做人人爽人人 | 久久这里只有精品6| 国产精品少妇自拍| 亚洲国产wwwccc36天堂| 国产综合一区二区| 91久久精品一区二区二区| 制服丝袜国产精品| 国产精品免费久久久久| 亚洲午夜一区二区| 国产精品66部| 欧美日韩一区二区在线观看| 精品国产精品网麻豆系列| 亚洲欧洲精品一区二区三区| 日韩不卡一区二区| 99久久久国产精品免费蜜臀| 欧美人与性动xxxx| 中文字幕欧美三区| 日韩va欧美va亚洲va久久| 国产福利电影一区二区三区| 亚洲高清视频的网址| 欧美日韩国产中文| 91在线观看免费视频| 91精品国产麻豆| 亚洲免费在线看| 国模一区二区三区白浆| 欧美在线三级电影| 国产精品天美传媒沈樵| 日韩激情中文字幕| 一本久久a久久免费精品不卡| 久久综合九色综合欧美98| 亚洲成人精品一区二区| 99视频超级精品| 久久久一区二区三区| 亚洲成av人片观看| 一本一道波多野结衣一区二区| 久久久久久久久久久久久久久99 | 不卡的av在线播放| 精品国产人成亚洲区| 三级欧美韩日大片在线看| a4yy欧美一区二区三区| 国产亚洲一二三区| 精品一区精品二区高清| 欧美日韩国产综合一区二区三区 | 欧美性色欧美a在线播放| 99久久久精品| 精品免费日韩av| 日本一区中文字幕| 欧美日韩免费视频| 亚洲国产一区二区在线播放| 91啪亚洲精品| 亚洲欧洲av另类| 99久久婷婷国产综合精品| 欧美高清在线视频| 高清不卡在线观看av| 国产亚洲欧洲一区高清在线观看|