drivers: power: report battery voltage in AOSP compatible format
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / staging / vt6656 / mib.h
CommitLineData
92b96797
FB
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.h
20 *
21 * Purpose: Implement MIB Data Structure
22 *
23 * Author: Tevin Chen
24 *
25 * Date: May 21, 1996
26 *
27 */
28
29#ifndef __MIB_H__
30#define __MIB_H__
31
92b96797 32#include "tether.h"
92b96797 33#include "desc.h"
92b96797 34
92b96797
FB
35//
36// USB counter
37//
38typedef struct tagSUSBCounter {
52a7e64b 39 u32 dwCrc;
92b96797 40
193a823c 41} SUSBCounter, *PSUSBCounter;
92b96797 42
92b96797
FB
43//
44// 802.11 counter
45//
46
92b96797 47typedef struct tagSDot11Counters {
cc856e61
AM
48 /* unsigned long Length; // Length of structure */
49 unsigned long long TransmittedFragmentCount;
50 unsigned long long MulticastTransmittedFrameCount;
51 unsigned long long FailedCount;
52 unsigned long long RetryCount;
53 unsigned long long MultipleRetryCount;
54 unsigned long long RTSSuccessCount;
55 unsigned long long RTSFailureCount;
56 unsigned long long ACKFailureCount;
57 unsigned long long FrameDuplicateCount;
58 unsigned long long ReceivedFragmentCount;
59 unsigned long long MulticastReceivedFrameCount;
60 unsigned long long FCSErrorCount;
61 unsigned long long TKIPLocalMICFailures;
62 unsigned long long TKIPRemoteMICFailures;
63 unsigned long long TKIPICVErrors;
cc856e61
AM
64 unsigned long long TKIPReplays;
65 unsigned long long CCMPFormatErrors;
66 unsigned long long CCMPReplays;
67 unsigned long long CCMPDecryptErrors;
68 unsigned long long FourWayHandshakeFailures;
69 /*
70 * unsigned long long WEPUndecryptableCount;
71 * unsigned long long WEPICVErrorCount;
72 * unsigned long long DecryptSuccessCount;
73 * unsigned long long DecryptFailureCount;
74 */
193a823c 75} SDot11Counters, *PSDot11Counters;
92b96797 76
92b96797
FB
77//
78// MIB2 counter
79//
80typedef struct tagSMib2Counter {
213d2e93 81 signed long ifIndex;
193a823c 82 char ifDescr[256]; // max size 255 plus zero ending
92b96797 83 // e.g. "interface 1"
213d2e93
AM
84 signed long ifType;
85 signed long ifMtu;
52a7e64b 86 u32 ifSpeed;
b902fbfe 87 u8 ifPhysAddress[ETH_ALEN];
213d2e93
AM
88 signed long ifAdminStatus;
89 signed long ifOperStatus;
52a7e64b
AM
90 u32 ifLastChange;
91 u32 ifInOctets;
92 u32 ifInUcastPkts;
93 u32 ifInNUcastPkts;
94 u32 ifInDiscards;
95 u32 ifInErrors;
96 u32 ifInUnknownProtos;
97 u32 ifOutOctets;
98 u32 ifOutUcastPkts;
99 u32 ifOutNUcastPkts;
100 u32 ifOutDiscards;
101 u32 ifOutErrors;
102 u32 ifOutQLen;
103 u32 ifSpecific;
193a823c 104} SMib2Counter, *PSMib2Counter;
92b96797
FB
105
106// Value in the ifType entry
92b96797
FB
107#define WIRELESSLANIEEE80211b 6 //
108
109// Value in the ifAdminStatus/ifOperStatus entry
110#define UP 1 //
111#define DOWN 2 //
112#define TESTING 3 //
113
92b96797
FB
114//
115// RMON counter
116//
117typedef struct tagSRmonCounter {
213d2e93 118 signed long etherStatsIndex;
52a7e64b
AM
119 u32 etherStatsDataSource;
120 u32 etherStatsDropEvents;
121 u32 etherStatsOctets;
122 u32 etherStatsPkts;
123 u32 etherStatsBroadcastPkts;
124 u32 etherStatsMulticastPkts;
125 u32 etherStatsCRCAlignErrors;
126 u32 etherStatsUndersizePkts;
127 u32 etherStatsOversizePkts;
128 u32 etherStatsFragments;
129 u32 etherStatsJabbers;
130 u32 etherStatsCollisions;
131 u32 etherStatsPkt64Octets;
132 u32 etherStatsPkt65to127Octets;
133 u32 etherStatsPkt128to255Octets;
134 u32 etherStatsPkt256to511Octets;
135 u32 etherStatsPkt512to1023Octets;
136 u32 etherStatsPkt1024to1518Octets;
137 u32 etherStatsOwners;
138 u32 etherStatsStatus;
193a823c 139} SRmonCounter, *PSRmonCounter;
92b96797
FB
140
141//
142// Custom counter
143//
144typedef struct tagSCustomCounters {
cc856e61
AM
145 unsigned long Length;
146
147 unsigned long long ullTsrAllOK;
148
149 unsigned long long ullRsr11M;
150 unsigned long long ullRsr5M;
151 unsigned long long ullRsr2M;
152 unsigned long long ullRsr1M;
153
154 unsigned long long ullRsr11MCRCOk;
155 unsigned long long ullRsr5MCRCOk;
156 unsigned long long ullRsr2MCRCOk;
157 unsigned long long ullRsr1MCRCOk;
158
159 unsigned long long ullRsr54M;
160 unsigned long long ullRsr48M;
161 unsigned long long ullRsr36M;
162 unsigned long long ullRsr24M;
163 unsigned long long ullRsr18M;
164 unsigned long long ullRsr12M;
165 unsigned long long ullRsr9M;
166 unsigned long long ullRsr6M;
167
168 unsigned long long ullRsr54MCRCOk;
169 unsigned long long ullRsr48MCRCOk;
170 unsigned long long ullRsr36MCRCOk;
171 unsigned long long ullRsr24MCRCOk;
172 unsigned long long ullRsr18MCRCOk;
173 unsigned long long ullRsr12MCRCOk;
174 unsigned long long ullRsr9MCRCOk;
175 unsigned long long ullRsr6MCRCOk;
92b96797 176
193a823c 177} SCustomCounters, *PSCustomCounters;
92b96797 178
92b96797
FB
179//
180// Custom counter
181//
182typedef struct tagSISRCounters {
cc856e61 183 unsigned long Length;
92b96797 184
52a7e64b
AM
185 u32 dwIsrTx0OK;
186 u32 dwIsrAC0TxOK;
187 u32 dwIsrBeaconTxOK;
188 u32 dwIsrRx0OK;
189 u32 dwIsrTBTTInt;
190 u32 dwIsrSTIMERInt;
191 u32 dwIsrWatchDog;
192 u32 dwIsrUnrecoverableError;
193 u32 dwIsrSoftInterrupt;
194 u32 dwIsrMIBNearfull;
195 u32 dwIsrRxNoBuf;
196
197 u32 dwIsrUnknown; // unknown interrupt count
198
199 u32 dwIsrRx1OK;
200 u32 dwIsrATIMTxOK;
201 u32 dwIsrSYNCTxOK;
202 u32 dwIsrCFPEnd;
203 u32 dwIsrATIMEnd;
204 u32 dwIsrSYNCFlushOK;
205 u32 dwIsrSTIMER1Int;
92b96797 206 /////////////////////////////////////
193a823c 207} SISRCounters, *PSISRCounters;
92b96797 208
92b96797
FB
209// Value in the etherStatsStatus entry
210#define VALID 1 //
211#define CREATE_REQUEST 2 //
212#define UNDER_CREATION 3 //
213#define INVALID 4 //
214
92b96797
FB
215//
216// Tx packet information
217//
218typedef struct tagSTxPktInfo {
b902fbfe 219 u8 byBroadMultiUni;
3eaca0d2
AM
220 u16 wLength;
221 u16 wFIFOCtl;
b902fbfe 222 u8 abyDestAddr[ETH_ALEN];
193a823c 223} STxPktInfo, *PSTxPktInfo;
92b96797 224
92b96797
FB
225#define MAX_RATE 12
226//
227// statistic counter
228//
229typedef struct tagSStatCounter {
230 //
231 // ISR status count
232 //
233
234 SISRCounters ISRStat;
235
236 // RSR status count
237 //
52a7e64b
AM
238 u32 dwRsrFrmAlgnErr;
239 u32 dwRsrErr;
240 u32 dwRsrCRCErr;
241 u32 dwRsrCRCOk;
242 u32 dwRsrBSSIDOk;
243 u32 dwRsrADDROk;
244 u32 dwRsrBCNSSIDOk;
245 u32 dwRsrLENErr;
246 u32 dwRsrTYPErr;
247
248 u32 dwNewRsrDECRYPTOK;
249 u32 dwNewRsrCFP;
250 u32 dwNewRsrUTSF;
251 u32 dwNewRsrHITAID;
252 u32 dwNewRsrHITAID0;
253
254 u32 dwRsrLong;
255 u32 dwRsrRunt;
256
257 u32 dwRsrRxControl;
258 u32 dwRsrRxData;
259 u32 dwRsrRxManage;
260
261 u32 dwRsrRxPacket;
262 u32 dwRsrRxOctet;
263 u32 dwRsrBroadcast;
264 u32 dwRsrMulticast;
265 u32 dwRsrDirected;
92b96797 266 // 64-bit OID
cc856e61 267 unsigned long long ullRsrOK;
92b96797
FB
268
269 // for some optional OIDs (64 bits) and DMI support
cc856e61
AM
270 unsigned long long ullRxBroadcastBytes;
271 unsigned long long ullRxMulticastBytes;
272 unsigned long long ullRxDirectedBytes;
273 unsigned long long ullRxBroadcastFrames;
274 unsigned long long ullRxMulticastFrames;
275 unsigned long long ullRxDirectedFrames;
92b96797 276
52a7e64b
AM
277 u32 dwRsrRxFragment;
278 u32 dwRsrRxFrmLen64;
279 u32 dwRsrRxFrmLen65_127;
280 u32 dwRsrRxFrmLen128_255;
281 u32 dwRsrRxFrmLen256_511;
282 u32 dwRsrRxFrmLen512_1023;
283 u32 dwRsrRxFrmLen1024_1518;
92b96797
FB
284
285 // TSR status count
286 //
52a7e64b
AM
287 u32 dwTsrTotalRetry; // total collision retry count
288 u32 dwTsrOnceRetry; // this packet only occur one collision
289 u32 dwTsrMoreThanOnceRetry; // this packet occur more than one collision
290 u32 dwTsrRetry; // this packet has ever occur collision,
92b96797 291 // that is (dwTsrOnceCollision0 + dwTsrMoreThanOnceCollision0)
52a7e64b
AM
292 u32 dwTsrACKData;
293 u32 dwTsrErr;
294 u32 dwAllTsrOK;
295 u32 dwTsrRetryTimeout;
296 u32 dwTsrTransmitTimeout;
297
298 u32 dwTsrTxPacket;
299 u32 dwTsrTxOctet;
300 u32 dwTsrBroadcast;
301 u32 dwTsrMulticast;
302 u32 dwTsrDirected;
92b96797
FB
303
304 // RD/TD count
52a7e64b
AM
305 u32 dwCntRxFrmLength;
306 u32 dwCntTxBufLength;
92b96797 307
b902fbfe
AM
308 u8 abyCntRxPattern[16];
309 u8 abyCntTxPattern[16];
92b96797 310
92b96797 311 // Software check....
52a7e64b
AM
312 u32 dwCntRxDataErr; // rx buffer data software compare CRC err count
313 u32 dwCntDecryptErr; // rx buffer data software compare CRC err count
314 u32 dwCntRxICVErr; // rx buffer data software compare CRC err count
92b96797 315
92b96797 316 // 64-bit OID
cc856e61 317 unsigned long long ullTsrOK;
92b96797
FB
318
319 // for some optional OIDs (64 bits) and DMI support
cc856e61
AM
320 unsigned long long ullTxBroadcastFrames;
321 unsigned long long ullTxMulticastFrames;
322 unsigned long long ullTxDirectedFrames;
323 unsigned long long ullTxBroadcastBytes;
324 unsigned long long ullTxMulticastBytes;
325 unsigned long long ullTxDirectedBytes;
92b96797
FB
326
327 // for autorate
52a7e64b
AM
328 u32 dwTxOk[MAX_RATE+1];
329 u32 dwTxFail[MAX_RATE+1];
330 u32 dwTxRetryCount[8];
92b96797
FB
331
332 STxPktInfo abyTxPktInfo[16];
333
334 SUSBCounter USB_EP0Stat;
335 SUSBCounter USB_BulkInStat;
336 SUSBCounter USB_BulkOutStat;
337 SUSBCounter USB_InterruptStat;
338
339 SCustomCounters CustomStat;
340
92b96797 341 //Tx count:
cc856e61
AM
342 unsigned long TxNoRetryOkCount; /* success tx no retry ! */
343 unsigned long TxRetryOkCount; /* success tx but retry ! */
344 unsigned long TxFailCount; /* fail tx ? */
92b96797 345 //Rx count:
cc856e61
AM
346 unsigned long RxOkCnt; /* success rx ! */
347 unsigned long RxFcsErrCnt; /* fail rx ? */
92b96797 348 //statistic
cc856e61
AM
349 unsigned long SignalStren;
350 unsigned long LinkQuality;
92b96797 351
193a823c 352} SStatCounter, *PSStatCounter;
92b96797 353
d9d1ccb5 354void STAvUpdateIsrStatCounter(PSStatCounter pStatistic,
b902fbfe
AM
355 u8 byIsr0,
356 u8 byIsr1);
92b96797
FB
357
358void STAvUpdateRDStatCounter(PSStatCounter pStatistic,
b902fbfe
AM
359 u8 byRSR, u8 byNewRSR, u8 byRxSts,
360 u8 byRxRate, u8 * pbyBuffer,
cc856e61 361 unsigned int cbFrameLength);
92b96797 362
b902fbfe
AM
363void STAvUpdateTDStatCounter(PSStatCounter pStatistic, u8 byPktNum,
364 u8 byRate, u8 byTSR);
92b96797
FB
365
366void
367STAvUpdate802_11Counter(
368 PSDot11Counters p802_11Counter,
369 PSStatCounter pStatistic,
b902fbfe
AM
370 u8 byRTSSuccess,
371 u8 byRTSFail,
372 u8 byACKFail,
373 u8 byFCSErr
92b96797
FB
374 );
375
6487c49e 376void STAvUpdateUSBCounter(PSUSBCounter pUsbCounter, int ntStatus);
92b96797 377
e7b07d1d 378#endif /* __MIB_H__ */