⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mib.c

📁 VIA VT6656 USB linux source code.
💻 C
📖 第 1 页 / 共 2 页
字号:
/* * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc. * All rights reserved. * * This software is copyrighted by and is the sole property of * VIA Networking Technologies, Inc. This software may only be used * in accordance with the corresponding license agreement. Any unauthorized * use, duplication, transmission, distribution, or disclosure of this * software is expressly forbidden. * * This software is provided by VIA Networking Technologies, Inc. "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 VIA Networking Technologies, Inc. * be liable for any direct, indirect, incidental, special, exemplary, or * consequential damages. *  * File: mib.c * * Purpose: Implement MIB Data Structure * * Author: Tevin Chen * * Date: May 21, 1996 * * Functions:  *      STAvClearAllCounter - Clear All MIB Counter *      STAvUpdateIstStatCounter - Update ISR statistic counter *      STAvUpdateRDStatCounter - Update Rx statistic counter *      STAvUpdateRDStatCounterEx - Update Rx statistic counter and copy rcv data *      STAvUpdateTDStatCounter - Update Tx statistic counter *      STAvUpdateTDStatCounterEx - Update Tx statistic counter and copy tx data *      STAvUpdate802_11Counter - Update 802.11 mib counter * * Revision History: * */ #if !defined(__UPC_H__)#include "upc.h"#endif#if !defined(__MAC_H__)#include "mac.h"#endif#if !defined(__TBIT_H__)#include "tbit.h"#endif#if !defined(__TETHER_H__)#include "tether.h"#endif#if !defined(__MIB_H__)#include "mib.h"#endif#if !defined(__WCTL_H__)#include "wctl.h"#endif#if !defined(__UMEM_H__)#include "umem.h"#endif#if !defined(__BASEBAND_H__)#include "baseband.h"#endif/*---------------------  Static Definitions -------------------------*/static int          msglevel                =MSG_LEVEL_INFO;/*---------------------  Static Classes  ----------------------------*//*---------------------  Static Variables  --------------------------*//*---------------------  Static Functions  --------------------------*//*---------------------  Export Variables  --------------------------*//*---------------------  Export Functions  --------------------------*//* * Description: Clear All Statistic Counter * * Parameters: *  In: *      pStatistic  - Pointer to Statistic Counter Data Structure *  Out: *      none * * Return Value: none * */void STAvClearAllCounter (PSStatCounter pStatistic){    // set memory to zero    ZERO_MEMORY(pStatistic, sizeof(SStatCounter));}/* * Description: Update Isr Statistic Counter * * Parameters: *  In: *      pStatistic  - Pointer to Statistic Counter Data Structure *      wisr        - Interrupt status *  Out: *      none * * Return Value: none * */void STAvUpdateIsrStatCounter (PSStatCounter pStatistic, BYTE byIsr0, BYTE byIsr1){    /**********************/    /* ABNORMAL interrupt */    /**********************/    // not any IMR bit invoke irq    if (byIsr0 == 0) {        pStatistic->ISRStat.dwIsrUnknown++;        return;    }    if (BITbIsBitOn(byIsr0, ISR_ACTX))              // ISR, bit0        pStatistic->ISRStat.dwIsrTx0OK++;           // TXDMA0 successful    if (BITbIsBitOn(byIsr0, ISR_BNTX))              // ISR, bit2        pStatistic->ISRStat.dwIsrBeaconTxOK++;      // BeaconTx successful    if (BITbIsBitOn(byIsr0, ISR_RXDMA0))            // ISR, bit3        pStatistic->ISRStat.dwIsrRx0OK++;           // Rx0 successful    if (BITbIsBitOn(byIsr0, ISR_TBTT))              // ISR, bit4        pStatistic->ISRStat.dwIsrTBTTInt++;         // TBTT successful    if (BITbIsBitOn(byIsr0, ISR_SOFTTIMER))         // ISR, bit6        pStatistic->ISRStat.dwIsrSTIMERInt++;    if (BITbIsBitOn(byIsr0, ISR_WATCHDOG))          // ISR, bit7        pStatistic->ISRStat.dwIsrWatchDog++;    if (BITbIsBitOn(byIsr1, ISR_FETALERR))              // ISR, bit8        pStatistic->ISRStat.dwIsrUnrecoverableError++;    if (BITbIsBitOn(byIsr1, ISR_SOFTINT))               // ISR, bit9        pStatistic->ISRStat.dwIsrSoftInterrupt++;       // software interrupt    if (BITbIsBitOn(byIsr1, ISR_MIBNEARFULL))           // ISR, bit10        pStatistic->ISRStat.dwIsrMIBNearfull++;    if (BITbIsBitOn(byIsr1, ISR_RXNOBUF))               // ISR, bit11        pStatistic->ISRStat.dwIsrRxNoBuf++;             // Rx No Buff}/* * Description: Update Rx Statistic Counter * * Parameters: *  In: *      pStatistic      - Pointer to Statistic Counter Data Structure *      byRSR           - Rx Status *      byNewRSR        - Rx Status *      pbyBuffer       - Rx Buffer *      cbFrameLength   - Rx Length *  Out: *      none * * Return Value: none * */void STAvUpdateRDStatCounter (PSStatCounter pStatistic,                              BYTE byRSR, BYTE byNewRSR, BYTE byRxSts, BYTE byRxRate,                                                            PBYTE pbyBuffer, UINT cbFrameLength){    //need change    PS802_11Header pHeader = (PS802_11Header)pbyBuffer;    if (BITbIsBitOn(byRSR, RSR_ADDROK))        pStatistic->dwRsrADDROk++;    if (BITbIsBitOn(byRSR, RSR_CRCOK)) {        pStatistic->dwRsrCRCOk++;        pStatistic->ullRsrOK++;        if (cbFrameLength >= U_ETHER_ADDR_LEN) {            // update counters in case that successful transmit            if (BITbIsBitOn(byRSR, RSR_ADDRBROAD)) {                pStatistic->ullRxBroadcastFrames++;                pStatistic->ullRxBroadcastBytes += (ULONGLONG)cbFrameLength;            }            else if (BITbIsBitOn(byRSR, RSR_ADDRMULTI)) {                pStatistic->ullRxMulticastFrames++;                pStatistic->ullRxMulticastBytes += (ULONGLONG)cbFrameLength;            }            else {                pStatistic->ullRxDirectedFrames++;                pStatistic->ullRxDirectedBytes += (ULONGLONG)cbFrameLength;            }        }    }    if(byRxRate==22) {        pStatistic->CustomStat.ullRsr11M++;        if(BITbIsBitOn(byRSR, RSR_CRCOK)) {            pStatistic->CustomStat.ullRsr11MCRCOk++;	        }        DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"11M: ALL[%d], OK[%d]:[%02x]\n", (INT)pStatistic->CustomStat.ullRsr11M, (INT)pStatistic->CustomStat.ullRsr11MCRCOk, byRSR);    }    else if(byRxRate==11) {        pStatistic->CustomStat.ullRsr5M++;        if(BITbIsBitOn(byRSR, RSR_CRCOK)) {            pStatistic->CustomStat.ullRsr5MCRCOk++;	        }        DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" 5M: ALL[%d], OK[%d]:[%02x]\n", (INT)pStatistic->CustomStat.ullRsr5M, (INT)pStatistic->CustomStat.ullRsr5MCRCOk, byRSR);    }    else if(byRxRate==4) {        pStatistic->CustomStat.ullRsr2M++;        if(BITbIsBitOn(byRSR, RSR_CRCOK)) {            pStatistic->CustomStat.ullRsr2MCRCOk++;	        }        DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" 2M: ALL[%d], OK[%d]:[%02x]\n", (INT)pStatistic->CustomStat.ullRsr2M, (INT)pStatistic->CustomStat.ullRsr2MCRCOk, byRSR);    }    else if(byRxRate==2){        pStatistic->CustomStat.ullRsr1M++;        if(BITbIsBitOn(byRSR, RSR_CRCOK)) {            pStatistic->CustomStat.ullRsr1MCRCOk++;	        }        DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" 1M: ALL[%d], OK[%d]:[%02x]\n", (INT)pStatistic->CustomStat.ullRsr1M, (INT)pStatistic->CustomStat.ullRsr1MCRCOk, byRSR);    }    else if(byRxRate==12){        pStatistic->CustomStat.ullRsr6M++;        if(BITbIsBitOn(byRSR, RSR_CRCOK)) {            pStatistic->CustomStat.ullRsr6MCRCOk++;	        }        DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" 6M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr6M, (INT)pStatistic->CustomStat.ullRsr6MCRCOk);    }    else if(byRxRate==18){        pStatistic->CustomStat.ullRsr9M++;        if(BITbIsBitOn(byRSR, RSR_CRCOK)) {            pStatistic->CustomStat.ullRsr9MCRCOk++;	        }        DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" 9M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr9M, (INT)pStatistic->CustomStat.ullRsr9MCRCOk);    }    else if(byRxRate==24){        pStatistic->CustomStat.ullRsr12M++;        if(BITbIsBitOn(byRSR, RSR_CRCOK)) {            pStatistic->CustomStat.ullRsr12MCRCOk++;	        }        DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"12M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr12M, (INT)pStatistic->CustomStat.ullRsr12MCRCOk);    }    else if(byRxRate==36){        pStatistic->CustomStat.ullRsr18M++;        if(BITbIsBitOn(byRSR, RSR_CRCOK)) {            pStatistic->CustomStat.ullRsr18MCRCOk++;	        }        DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"18M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr18M, (INT)pStatistic->CustomStat.ullRsr18MCRCOk);    }    else if(byRxRate==48){        pStatistic->CustomStat.ullRsr24M++;        if(BITbIsBitOn(byRSR, RSR_CRCOK)) {            pStatistic->CustomStat.ullRsr24MCRCOk++;	        }        DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"24M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr24M, (INT)pStatistic->CustomStat.ullRsr24MCRCOk);    }    else if(byRxRate==72){        pStatistic->CustomStat.ullRsr36M++;        if(BITbIsBitOn(byRSR, RSR_CRCOK)) {            pStatistic->CustomStat.ullRsr36MCRCOk++;	        }        DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"36M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr36M, (INT)pStatistic->CustomStat.ullRsr36MCRCOk);    }    else if(byRxRate==96){        pStatistic->CustomStat.ullRsr48M++;        if(BITbIsBitOn(byRSR, RSR_CRCOK)) {            pStatistic->CustomStat.ullRsr48MCRCOk++;	        }        DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"48M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr48M, (INT)pStatistic->CustomStat.ullRsr48MCRCOk);    }    else if(byRxRate==108){        pStatistic->CustomStat.ullRsr54M++;        if(BITbIsBitOn(byRSR, RSR_CRCOK)) {            pStatistic->CustomStat.ullRsr54MCRCOk++;	        }        DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"54M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr54M, (INT)pStatistic->CustomStat.ullRsr54MCRCOk);    }    else {    	DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Unknown: Total[%d], CRCOK[%d]\n", (INT)pStatistic->dwRsrRxPacket+1, (INT)pStatistic->dwRsrCRCOk);    }    if (BITbIsBitOn(byRSR, RSR_BSSIDOK))        pStatistic->dwRsrBSSIDOk++;    if (BITbIsBitOn(byRSR, RSR_BCNSSIDOK))        pStatistic->dwRsrBCNSSIDOk++;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -