Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc. |
| 3 | * All rights reserved. |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 2 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License along |
| 16 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 18 | * |
| 19 | * File: mib.c |
| 20 | * |
| 21 | * Purpose: Implement MIB Data Structure |
| 22 | * |
| 23 | * Author: Tevin Chen |
| 24 | * |
| 25 | * Date: May 21, 1996 |
| 26 | * |
| 27 | * Functions: |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 28 | * STAvUpdateIstStatCounter - Update ISR statistic counter |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 29 | * STAvUpdate802_11Counter - Update 802.11 mib counter |
| 30 | * |
| 31 | * Revision History: |
| 32 | * |
| 33 | */ |
| 34 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 35 | #include "mac.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 36 | #include "mib.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 37 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 38 | /*--------------------- Static Classes ----------------------------*/ |
| 39 | |
| 40 | /*--------------------- Static Variables --------------------------*/ |
| 41 | |
| 42 | /*--------------------- Static Functions --------------------------*/ |
| 43 | |
| 44 | /*--------------------- Export Variables --------------------------*/ |
| 45 | |
| 46 | /*--------------------- Export Functions --------------------------*/ |
| 47 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 48 | /* |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 49 | * Description: Update Isr Statistic Counter |
| 50 | * |
| 51 | * Parameters: |
| 52 | * In: |
| 53 | * pStatistic - Pointer to Statistic Counter Data Structure |
| 54 | * wisr - Interrupt status |
| 55 | * Out: |
| 56 | * none |
| 57 | * |
| 58 | * Return Value: none |
| 59 | * |
| 60 | */ |
Joe Perches | fd0badb | 2013-03-18 10:44:56 -0700 | [diff] [blame] | 61 | void STAvUpdateIsrStatCounter(PSStatCounter pStatistic, unsigned long dwIsr) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 62 | { |
Joe Perches | fd0badb | 2013-03-18 10:44:56 -0700 | [diff] [blame] | 63 | /**********************/ |
| 64 | /* ABNORMAL interrupt */ |
| 65 | /**********************/ |
| 66 | // not any IMR bit invoke irq |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 67 | |
Joe Perches | fd0badb | 2013-03-18 10:44:56 -0700 | [diff] [blame] | 68 | if (dwIsr == 0) { |
| 69 | pStatistic->ISRStat.dwIsrUnknown++; |
| 70 | return; |
| 71 | } |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 72 | |
| 73 | //Added by Kyle |
Joe Perches | fd0badb | 2013-03-18 10:44:56 -0700 | [diff] [blame] | 74 | if (dwIsr & ISR_TXDMA0) // ISR, bit0 |
| 75 | pStatistic->ISRStat.dwIsrTx0OK++; // TXDMA0 successful |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 76 | |
Joe Perches | fd0badb | 2013-03-18 10:44:56 -0700 | [diff] [blame] | 77 | if (dwIsr & ISR_AC0DMA) // ISR, bit1 |
| 78 | pStatistic->ISRStat.dwIsrAC0TxOK++; // AC0DMA successful |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 79 | |
Joe Perches | fd0badb | 2013-03-18 10:44:56 -0700 | [diff] [blame] | 80 | if (dwIsr & ISR_BNTX) // ISR, bit2 |
| 81 | pStatistic->ISRStat.dwIsrBeaconTxOK++; // BeaconTx successful |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 82 | |
Joe Perches | fd0badb | 2013-03-18 10:44:56 -0700 | [diff] [blame] | 83 | if (dwIsr & ISR_RXDMA0) // ISR, bit3 |
| 84 | pStatistic->ISRStat.dwIsrRx0OK++; // Rx0 successful |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 85 | |
Joe Perches | fd0badb | 2013-03-18 10:44:56 -0700 | [diff] [blame] | 86 | if (dwIsr & ISR_TBTT) // ISR, bit4 |
| 87 | pStatistic->ISRStat.dwIsrTBTTInt++; // TBTT successful |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 88 | |
Joe Perches | fd0badb | 2013-03-18 10:44:56 -0700 | [diff] [blame] | 89 | if (dwIsr & ISR_SOFTTIMER) // ISR, bit6 |
| 90 | pStatistic->ISRStat.dwIsrSTIMERInt++; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 91 | |
Joe Perches | fd0badb | 2013-03-18 10:44:56 -0700 | [diff] [blame] | 92 | if (dwIsr & ISR_WATCHDOG) // ISR, bit7 |
| 93 | pStatistic->ISRStat.dwIsrWatchDog++; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 94 | |
Joe Perches | fd0badb | 2013-03-18 10:44:56 -0700 | [diff] [blame] | 95 | if (dwIsr & ISR_FETALERR) // ISR, bit8 |
| 96 | pStatistic->ISRStat.dwIsrUnrecoverableError++; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 97 | |
Joe Perches | fd0badb | 2013-03-18 10:44:56 -0700 | [diff] [blame] | 98 | if (dwIsr & ISR_SOFTINT) // ISR, bit9 |
| 99 | pStatistic->ISRStat.dwIsrSoftInterrupt++; // software interrupt |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 100 | |
Joe Perches | fd0badb | 2013-03-18 10:44:56 -0700 | [diff] [blame] | 101 | if (dwIsr & ISR_MIBNEARFULL) // ISR, bit10 |
| 102 | pStatistic->ISRStat.dwIsrMIBNearfull++; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 103 | |
Joe Perches | fd0badb | 2013-03-18 10:44:56 -0700 | [diff] [blame] | 104 | if (dwIsr & ISR_RXNOBUF) // ISR, bit11 |
| 105 | pStatistic->ISRStat.dwIsrRxNoBuf++; // Rx No Buff |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 106 | |
Joe Perches | fd0badb | 2013-03-18 10:44:56 -0700 | [diff] [blame] | 107 | if (dwIsr & ISR_RXDMA1) // ISR, bit12 |
| 108 | pStatistic->ISRStat.dwIsrRx1OK++; // Rx1 successful |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 109 | |
Joe Perches | fd0badb | 2013-03-18 10:44:56 -0700 | [diff] [blame] | 110 | if (dwIsr & ISR_SOFTTIMER1) // ISR, bit21 |
| 111 | pStatistic->ISRStat.dwIsrSTIMER1Int++; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 112 | } |
| 113 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 114 | /* |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 115 | * Description: Update 802.11 mib counter |
| 116 | * |
| 117 | * Parameters: |
| 118 | * In: |
| 119 | * p802_11Counter - Pointer to 802.11 mib counter |
| 120 | * pStatistic - Pointer to Statistic Counter Data Structure |
| 121 | * dwCounter - hardware counter for 802.11 mib |
| 122 | * Out: |
| 123 | * none |
| 124 | * |
| 125 | * Return Value: none |
| 126 | * |
| 127 | */ |
| 128 | void |
| 129 | STAvUpdate802_11Counter( |
Joe Perches | fd0badb | 2013-03-18 10:44:56 -0700 | [diff] [blame] | 130 | PSDot11Counters p802_11Counter, |
| 131 | PSStatCounter pStatistic, |
| 132 | unsigned long dwCounter |
| 133 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 134 | { |
Joe Perches | fd0badb | 2013-03-18 10:44:56 -0700 | [diff] [blame] | 135 | p802_11Counter->RTSSuccessCount += (unsigned long long) (dwCounter & 0x000000ff); |
| 136 | p802_11Counter->RTSFailureCount += (unsigned long long) ((dwCounter & 0x0000ff00) >> 8); |
| 137 | p802_11Counter->ACKFailureCount += (unsigned long long) ((dwCounter & 0x00ff0000) >> 16); |
| 138 | p802_11Counter->FCSErrorCount += (unsigned long long) ((dwCounter & 0xff000000) >> 24); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 139 | } |