]> git.karo-electronics.de Git - mv-sheeva.git/blob - drivers/staging/vt6656/iocmd.h
V4L/DVB: tm6000: Add control to the power led
[mv-sheeva.git] / drivers / staging / vt6656 / iocmd.h
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: iocmd.h
20  *
21  * Purpose: Handles the viawget ioctl private interface functions
22  *
23  * Author: Lyndon Chen
24  *
25  * Date: May 8, 2002
26  *
27  */
28
29 #ifndef __IOCMD_H__
30 #define __IOCMD_H__
31
32 #include "ttype.h"
33
34 /*---------------------  Export Definitions -------------------------*/
35
36 #if !defined(DEF)
37 #define DEF
38 #endif
39
40 // ioctl Command code
41 #define MAGIC_CODE                       0x3142
42 #define IOCTL_CMD_TEST              (SIOCDEVPRIVATE + 0)
43 #define IOCTL_CMD_SET                       (SIOCDEVPRIVATE + 1)
44 #define IOCTL_CMD_HOSTAPD           (SIOCDEVPRIVATE + 2)
45 #define IOCTL_CMD_WPA               (SIOCDEVPRIVATE + 3)
46
47 typedef enum tagWMAC_CMD {
48
49     WLAN_CMD_BSS_SCAN,
50     WLAN_CMD_BSS_JOIN,
51     WLAN_CMD_DISASSOC,
52     WLAN_CMD_SET_WEP,
53     WLAN_CMD_GET_LINK,
54     WLAN_CMD_GET_LISTLEN,
55     WLAN_CMD_GET_LIST,
56     WLAN_CMD_GET_MIB,
57     WLAN_CMD_GET_STAT,
58     WLAN_CMD_STOP_MAC,
59     WLAN_CMD_START_MAC,
60     WLAN_CMD_AP_START,
61     WLAN_CMD_SET_HOSTAPD,
62     WLAN_CMD_SET_HOSTAPD_STA,
63     WLAN_CMD_SET_802_1X,
64     WLAN_CMD_SET_HOST_WEP,
65     WLAN_CMD_SET_WPA,
66     WLAN_CMD_GET_NODE_CNT,
67     WLAN_CMD_ZONETYPE_SET,
68     WLAN_CMD_GET_NODE_LIST
69
70 } WMAC_CMD, *PWMAC_CMD;
71
72 typedef enum tagWZONETYPE {
73   ZoneType_USA=0,
74   ZoneType_Japan=1,
75   ZoneType_Europe=2
76 }WZONETYPE;
77
78 #define ADHOC   0
79 #define INFRA   1
80 #define BOTH    2
81 #define AP          3
82
83 #define ADHOC_STARTED      1
84 #define ADHOC_JOINTED      2
85
86 #define PHY80211a           0
87 #define PHY80211b       1
88 #define PHY80211g       2
89
90 #define SSID_ID                0
91 #define SSID_MAXLEN            32
92 #define BSSID_LEN              6
93 #define WEP_NKEYS              4
94 #define WEP_KEYMAXLEN          29
95 #define WEP_40BIT_LEN          5
96 #define WEP_104BIT_LEN         13
97 #define WEP_232BIT_LEN         16
98
99 // Ioctl interface structure
100 // Command structure
101 //
102 #pragma pack(1)
103 typedef struct tagSCmdRequest {
104         u8 name[16];
105         void    *data;
106         u16         wResult;
107         u16     wCmdCode;
108 } SCmdRequest, *PSCmdRequest;
109
110 //
111 // Scan
112 //
113
114 typedef struct tagSCmdScan {
115
116     u8      ssid[SSID_MAXLEN + 2];
117
118 } SCmdScan, *PSCmdScan;
119
120 //
121 // BSS Join
122 //
123
124 typedef struct tagSCmdBSSJoin {
125
126     u16     wBSSType;
127     u16     wBBPType;
128     u8      ssid[SSID_MAXLEN + 2];
129     u32     uChannel;
130     BOOL    bPSEnable;
131     BOOL    bShareKeyAuth;
132
133 } SCmdBSSJoin, *PSCmdBSSJoin;
134
135 //
136 // Zonetype Setting
137 //
138
139 typedef struct tagSCmdZoneTypeSet {
140
141  BOOL       bWrite;
142  WZONETYPE  ZoneType;
143
144 } SCmdZoneTypeSet, *PSCmdZoneTypeSet;
145
146 #ifdef WPA_SM_Transtatus
147 typedef struct tagSWPAResult {
148          char   ifname[100];
149         u8 proto;
150         u8 key_mgmt;
151         u8 eap_type;
152          BOOL authenticated;
153 } SWPAResult, *PSWPAResult;
154 #endif
155
156 typedef struct tagSCmdStartAP {
157
158     u16     wBSSType;
159     u16     wBBPType;
160     u8      ssid[SSID_MAXLEN + 2];
161         u32 uChannel;
162         u32 uBeaconInt;
163     BOOL    bShareKeyAuth;
164     u8      byBasicRate;
165
166 } SCmdStartAP, *PSCmdStartAP;
167
168 typedef struct tagSCmdSetWEP {
169
170     BOOL    bEnableWep;
171     u8      byKeyIndex;
172     u8      abyWepKey[WEP_NKEYS][WEP_KEYMAXLEN];
173     BOOL    bWepKeyAvailable[WEP_NKEYS];
174     u32     auWepKeyLength[WEP_NKEYS];
175
176 } SCmdSetWEP, *PSCmdSetWEP;
177
178 typedef struct tagSBSSIDItem {
179
180         u32         uChannel;
181     u8      abyBSSID[BSSID_LEN];
182     u8      abySSID[SSID_MAXLEN + 1];
183     u16     wBeaconInterval;
184     u16     wCapInfo;
185     u8      byNetType;
186     BOOL    bWEPOn;
187     u32     uRSSI;
188
189 } SBSSIDItem;
190
191
192 typedef struct tagSBSSIDList {
193
194         u32                 uItem;
195         SBSSIDItem      sBSSIDList[0];
196 } SBSSIDList, *PSBSSIDList;
197
198
199 typedef struct tagSNodeItem {
200     // STA info
201     u16            wAID;
202     u8             abyMACAddr[6];
203     u16            wTxDataRate;
204     u16            wInActiveCount;
205     u16            wEnQueueCnt;
206     u16            wFlags;
207     BOOL           bPWBitOn;
208     u8             byKeyIndex;
209     u16            wWepKeyLength;
210     u8            abyWepKey[WEP_KEYMAXLEN];
211     // Auto rate fallback vars
212     BOOL           bIsInFallback;
213     u32            uTxFailures;
214     u32            uTxAttempts;
215     u16            wFailureRatio;
216
217 } SNodeItem;
218
219
220 typedef struct tagSNodeList {
221
222         u32                 uItem;
223         SNodeItem       sNodeList[0];
224
225 } SNodeList, *PSNodeList;
226
227
228 typedef struct tagSCmdLinkStatus {
229
230     BOOL    bLink;
231         u16         wBSSType;
232         u8      byState;
233     u8      abyBSSID[BSSID_LEN];
234     u8      abySSID[SSID_MAXLEN + 2];
235     u32     uChannel;
236     u32     uLinkRate;
237
238 } SCmdLinkStatus, *PSCmdLinkStatus;
239
240 //
241 // 802.11 counter
242 //
243 typedef struct tagSDot11MIBCount {
244     u32 TransmittedFragmentCount;
245     u32 MulticastTransmittedFrameCount;
246     u32 FailedCount;
247     u32 RetryCount;
248     u32 MultipleRetryCount;
249     u32 RTSSuccessCount;
250     u32 RTSFailureCount;
251     u32 ACKFailureCount;
252     u32 FrameDuplicateCount;
253     u32 ReceivedFragmentCount;
254     u32 MulticastReceivedFrameCount;
255     u32 FCSErrorCount;
256 } SDot11MIBCount, *PSDot11MIBCount;
257
258
259
260 //
261 // statistic counter
262 //
263 typedef struct tagSStatMIBCount {
264     //
265     // ISR status count
266     //
267     u32   dwIsrTx0OK;
268     u32   dwIsrTx1OK;
269     u32   dwIsrBeaconTxOK;
270     u32   dwIsrRxOK;
271     u32   dwIsrTBTTInt;
272     u32   dwIsrSTIMERInt;
273     u32   dwIsrUnrecoverableError;
274     u32   dwIsrSoftInterrupt;
275     u32   dwIsrRxNoBuf;
276     /////////////////////////////////////
277
278         u32 dwIsrUnknown; /* unknown interrupt count */
279
280     // RSR status count
281     //
282     u32   dwRsrFrmAlgnErr;
283     u32   dwRsrErr;
284     u32   dwRsrCRCErr;
285     u32   dwRsrCRCOk;
286     u32   dwRsrBSSIDOk;
287     u32   dwRsrADDROk;
288     u32   dwRsrICVOk;
289     u32   dwNewRsrShortPreamble;
290     u32   dwRsrLong;
291     u32   dwRsrRunt;
292
293     u32   dwRsrRxControl;
294     u32   dwRsrRxData;
295     u32   dwRsrRxManage;
296
297     u32   dwRsrRxPacket;
298     u32   dwRsrRxOctet;
299     u32   dwRsrBroadcast;
300     u32   dwRsrMulticast;
301     u32   dwRsrDirected;
302     // 64-bit OID
303     u32   ullRsrOK;
304
305     // for some optional OIDs (64 bits) and DMI support
306     u32   ullRxBroadcastBytes;
307     u32   ullRxMulticastBytes;
308     u32   ullRxDirectedBytes;
309     u32   ullRxBroadcastFrames;
310     u32   ullRxMulticastFrames;
311     u32   ullRxDirectedFrames;
312
313     u32   dwRsrRxFragment;
314     u32   dwRsrRxFrmLen64;
315     u32   dwRsrRxFrmLen65_127;
316     u32   dwRsrRxFrmLen128_255;
317     u32   dwRsrRxFrmLen256_511;
318     u32   dwRsrRxFrmLen512_1023;
319     u32   dwRsrRxFrmLen1024_1518;
320
321     // TSR0,1 status count
322     //
323         u32 dwTsrTotalRetry[2];        /* total collision retry count */
324         u32 dwTsrOnceRetry[2];         /* this packet had one collision */
325         u32 dwTsrMoreThanOnceRetry[2]; /* this packet had many collisions */
326         u32 dwTsrRetry[2];             /* this packet has ever occur collision,
327                                         * that is (dwTsrOnceCollision0 plus
328                                         * dwTsrMoreThanOnceCollision0) */
329     u32   dwTsrACKData[2];
330     u32   dwTsrErr[2];
331     u32   dwAllTsrOK[2];
332     u32   dwTsrRetryTimeout[2];
333     u32   dwTsrTransmitTimeout[2];
334
335     u32   dwTsrTxPacket[2];
336     u32   dwTsrTxOctet[2];
337     u32   dwTsrBroadcast[2];
338     u32   dwTsrMulticast[2];
339     u32   dwTsrDirected[2];
340
341     // RD/TD count
342     u32   dwCntRxFrmLength;
343     u32   dwCntTxBufLength;
344
345     u8    abyCntRxPattern[16];
346     u8    abyCntTxPattern[16];
347
348         /* Software check.... */
349         u32 dwCntRxDataErr;  /* rx buffer data CRC err count */
350         u32 dwCntDecryptErr; /* rx buffer data CRC err count */
351         u32 dwCntRxICVErr;   /* rx buffer data CRC err count */
352         u32 idxRxErrorDesc;  /* index for rx data error RD */
353
354         /* 64-bit OID */
355         u32   ullTsrOK[2];
356
357     // for some optional OIDs (64 bits) and DMI support
358     u32   ullTxBroadcastFrames[2];
359     u32   ullTxMulticastFrames[2];
360     u32   ullTxDirectedFrames[2];
361     u32   ullTxBroadcastBytes[2];
362     u32   ullTxMulticastBytes[2];
363     u32   ullTxDirectedBytes[2];
364 } SStatMIBCount, *PSStatMIBCount;
365
366 typedef struct tagSCmdValue {
367
368     u32     dwValue;
369
370 } SCmdValue,  *PSCmdValue;
371
372 //
373 // hostapd & viawget ioctl related
374 //
375
376 // VIAGWET_IOCTL_HOSTAPD ioctl() cmd:
377 enum {
378         VIAWGET_HOSTAPD_FLUSH = 1,
379         VIAWGET_HOSTAPD_ADD_STA = 2,
380         VIAWGET_HOSTAPD_REMOVE_STA = 3,
381         VIAWGET_HOSTAPD_GET_INFO_STA = 4,
382         VIAWGET_HOSTAPD_SET_ENCRYPTION = 5,
383         VIAWGET_HOSTAPD_GET_ENCRYPTION = 6,
384         VIAWGET_HOSTAPD_SET_FLAGS_STA = 7,
385         VIAWGET_HOSTAPD_SET_ASSOC_AP_ADDR = 8,
386         VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT = 9,
387         VIAWGET_HOSTAPD_MLME = 10,
388         VIAWGET_HOSTAPD_SCAN_REQ = 11,
389         VIAWGET_HOSTAPD_STA_CLEAR_STATS = 12,
390 };
391
392 #define VIAWGET_HOSTAPD_GENERIC_ELEMENT_HDR_LEN \
393 ((int) (&((struct viawget_hostapd_param *) 0)->u.generic_elem.data))
394
395 // Maximum length for algorithm names (-1 for nul termination) used in ioctl()
396
397 struct viawget_hostapd_param {
398         u32 cmd;
399         u8 sta_addr[6];
400         union {
401                 struct {
402                         u16 aid;
403                         u16 capability;
404                         u8 tx_supp_rates;
405                 } add_sta;
406                 struct {
407                         u32 inactive_sec;
408                 } get_info_sta;
409                 struct {
410                         u8 alg;
411                         u32 flags;
412                         u32 err;
413                         u8 idx;
414                         u8 seq[8];
415                         u16 key_len;
416                         u8 key[0];
417                 } crypt;
418                 struct {
419                         u32 flags_and;
420                         u32 flags_or;
421                 } set_flags_sta;
422                 struct {
423                         u16 rid;
424                         u16 len;
425                         u8 data[0];
426                 } rid;
427                 struct {
428                         u8 len;
429                         u8 data[0];
430                 } generic_elem;
431                 struct {
432                         u16 cmd;
433                         u16 reason_code;
434                 } mlme;
435                 struct {
436                         u8 ssid_len;
437                         u8 ssid[32];
438                 } scan_req;
439         } u;
440 };
441
442 /*---------------------  Export Classes  ----------------------------*/
443
444 /*---------------------  Export Variables  --------------------------*/
445
446 /*---------------------  Export Types  ------------------------------*/
447
448 /*---------------------  Export Functions  --------------------------*/
449
450 #endif /* __IOCMD_H__ */