[ARM] pxa: Gumstix Verdex PCMCIA support
[linux-2.6/verdex.git] / drivers / staging / vt6655 / iocmd.h
blob60c0a362361364158b411c063e57e7aa3c036aec
1 /*
2 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
3 * All rights reserved.
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.
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.
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.
19 * File: iocmd.h
21 * Purpose: Handles the viawget ioctl private interface functions
23 * Author: Lyndon Chen
25 * Date: May 8, 2002
29 #ifndef __IOCMD_H__
30 #define __IOCMD_H__
32 #include "ttype.h"
34 /*--------------------- Export Definitions -------------------------*/
36 #if !defined(DEF)
37 #define DEF
38 #endif
40 //typedef int BOOL;
41 //typedef uint32_t u32;
42 //typedef uint16_t u16;
43 //typedef uint8_t u8;
46 // ioctl Command code
47 #define MAGIC_CODE 0x3142
48 #define IOCTL_CMD_TEST (SIOCDEVPRIVATE + 0)
49 #define IOCTL_CMD_SET (SIOCDEVPRIVATE + 1)
50 #define IOCTL_CMD_HOSTAPD (SIOCDEVPRIVATE + 2)
51 #define IOCTL_CMD_WPA (SIOCDEVPRIVATE + 3)
54 typedef enum tagWMAC_CMD {
56 WLAN_CMD_BSS_SCAN,
57 WLAN_CMD_BSS_JOIN,
58 WLAN_CMD_DISASSOC,
59 WLAN_CMD_SET_WEP,
60 WLAN_CMD_GET_LINK,
61 WLAN_CMD_GET_LISTLEN,
62 WLAN_CMD_GET_LIST,
63 WLAN_CMD_GET_MIB,
64 WLAN_CMD_GET_STAT,
65 WLAN_CMD_STOP_MAC,
66 WLAN_CMD_START_MAC,
67 WLAN_CMD_AP_START,
68 WLAN_CMD_SET_HOSTAPD,
69 WLAN_CMD_SET_HOSTAPD_STA,
70 WLAN_CMD_SET_802_1X,
71 WLAN_CMD_SET_HOST_WEP,
72 WLAN_CMD_SET_WPA,
73 WLAN_CMD_GET_NODE_CNT,
74 WLAN_CMD_ZONETYPE_SET,
75 WLAN_CMD_GET_NODE_LIST
77 } WMAC_CMD, *PWMAC_CMD;
79 typedef enum tagWZONETYPE {
80 ZoneType_USA=0,
81 ZoneType_Japan=1,
82 ZoneType_Europe=2
83 }WZONETYPE;
85 #define ADHOC 0
86 #define INFRA 1
87 #define BOTH 2
88 #define AP 3
90 #define ADHOC_STARTED 1
91 #define ADHOC_JOINTED 2
94 #define PHY80211a 0
95 #define PHY80211b 1
96 #define PHY80211g 2
98 #define SSID_ID 0
99 #define SSID_MAXLEN 32
100 #define BSSID_LEN 6
101 #define WEP_NKEYS 4
102 #define WEP_KEYMAXLEN 29
103 #define WEP_40BIT_LEN 5
104 #define WEP_104BIT_LEN 13
105 #define WEP_232BIT_LEN 16
107 // Ioctl interface structure
108 // Command structure
110 #pragma pack(1)
111 typedef struct tagSCmdRequest {
112 U8 name[16];
113 void *data;
114 U16 wResult;
115 U16 wCmdCode;
116 } SCmdRequest, *PSCmdRequest;
119 // Scan
122 typedef struct tagSCmdScan {
124 U8 ssid[SSID_MAXLEN + 2];
126 } SCmdScan, *PSCmdScan;
130 // BSS Join
133 typedef struct tagSCmdBSSJoin {
135 U16 wBSSType;
136 U16 wBBPType;
137 U8 ssid[SSID_MAXLEN + 2];
138 U32 uChannel;
139 BOOL bPSEnable;
140 BOOL bShareKeyAuth;
142 } SCmdBSSJoin, *PSCmdBSSJoin;
145 // Zonetype Setting
148 typedef struct tagSCmdZoneTypeSet {
150 BOOL bWrite;
151 WZONETYPE ZoneType;
153 } SCmdZoneTypeSet, *PSCmdZoneTypeSet;
155 #ifdef WPA_SM_Transtatus
156 typedef struct tagSWPAResult {
157 char ifname[100];
158 U8 proto;
159 U8 key_mgmt;
160 U8 eap_type;
161 BOOL authenticated;
162 } SWPAResult, *PSWPAResult;
163 #endif
165 typedef struct tagSCmdStartAP {
167 U16 wBSSType;
168 U16 wBBPType;
169 U8 ssid[SSID_MAXLEN + 2];
170 U32 uChannel;
171 U32 uBeaconInt;
172 BOOL bShareKeyAuth;
173 U8 byBasicRate;
175 } SCmdStartAP, *PSCmdStartAP;
178 typedef struct tagSCmdSetWEP {
180 BOOL bEnableWep;
181 U8 byKeyIndex;
182 U8 abyWepKey[WEP_NKEYS][WEP_KEYMAXLEN];
183 BOOL bWepKeyAvailable[WEP_NKEYS];
184 U32 auWepKeyLength[WEP_NKEYS];
186 } SCmdSetWEP, *PSCmdSetWEP;
190 typedef struct tagSBSSIDItem {
192 U32 uChannel;
193 U8 abyBSSID[BSSID_LEN];
194 U8 abySSID[SSID_MAXLEN + 1];
195 //2006-1116-01,<Modify> by NomadZhao
196 //U16 wBeaconInterval;
197 //U16 wCapInfo;
198 //U8 byNetType;
199 U8 byNetType;
200 U16 wBeaconInterval;
201 U16 wCapInfo; // for address of byNetType at align 4
203 BOOL bWEPOn;
204 U32 uRSSI;
206 } SBSSIDItem;
209 typedef struct tagSBSSIDList {
211 U32 uItem;
212 SBSSIDItem sBSSIDList[0];
213 } SBSSIDList, *PSBSSIDList;
216 typedef struct tagSCmdLinkStatus {
218 BOOL bLink;
219 U16 wBSSType;
220 U8 byState;
221 U8 abyBSSID[BSSID_LEN];
222 U8 abySSID[SSID_MAXLEN + 2];
223 U32 uChannel;
224 U32 uLinkRate;
226 } SCmdLinkStatus, *PSCmdLinkStatus;
229 // 802.11 counter
231 typedef struct tagSDot11MIBCount {
232 U32 TransmittedFragmentCount;
233 U32 MulticastTransmittedFrameCount;
234 U32 FailedCount;
235 U32 RetryCount;
236 U32 MultipleRetryCount;
237 U32 RTSSuccessCount;
238 U32 RTSFailureCount;
239 U32 ACKFailureCount;
240 U32 FrameDuplicateCount;
241 U32 ReceivedFragmentCount;
242 U32 MulticastReceivedFrameCount;
243 U32 FCSErrorCount;
244 } SDot11MIBCount, *PSDot11MIBCount;
249 // statistic counter
251 typedef struct tagSStatMIBCount {
253 // ISR status count
255 U32 dwIsrTx0OK;
256 U32 dwIsrTx1OK;
257 U32 dwIsrBeaconTxOK;
258 U32 dwIsrRxOK;
259 U32 dwIsrTBTTInt;
260 U32 dwIsrSTIMERInt;
261 U32 dwIsrUnrecoverableError;
262 U32 dwIsrSoftInterrupt;
263 U32 dwIsrRxNoBuf;
264 /////////////////////////////////////
266 U32 dwIsrUnknown; // unknown interrupt count
268 // RSR status count
270 U32 dwRsrFrmAlgnErr;
271 U32 dwRsrErr;
272 U32 dwRsrCRCErr;
273 U32 dwRsrCRCOk;
274 U32 dwRsrBSSIDOk;
275 U32 dwRsrADDROk;
276 U32 dwRsrICVOk;
277 U32 dwNewRsrShortPreamble;
278 U32 dwRsrLong;
279 U32 dwRsrRunt;
281 U32 dwRsrRxControl;
282 U32 dwRsrRxData;
283 U32 dwRsrRxManage;
285 U32 dwRsrRxPacket;
286 U32 dwRsrRxOctet;
287 U32 dwRsrBroadcast;
288 U32 dwRsrMulticast;
289 U32 dwRsrDirected;
290 // 64-bit OID
291 U32 ullRsrOK;
293 // for some optional OIDs (64 bits) and DMI support
294 U32 ullRxBroadcastBytes;
295 U32 ullRxMulticastBytes;
296 U32 ullRxDirectedBytes;
297 U32 ullRxBroadcastFrames;
298 U32 ullRxMulticastFrames;
299 U32 ullRxDirectedFrames;
301 U32 dwRsrRxFragment;
302 U32 dwRsrRxFrmLen64;
303 U32 dwRsrRxFrmLen65_127;
304 U32 dwRsrRxFrmLen128_255;
305 U32 dwRsrRxFrmLen256_511;
306 U32 dwRsrRxFrmLen512_1023;
307 U32 dwRsrRxFrmLen1024_1518;
309 // TSR0,1 status count
311 U32 dwTsrTotalRetry[2]; // total collision retry count
312 U32 dwTsrOnceRetry[2]; // this packet only occur one collision
313 U32 dwTsrMoreThanOnceRetry[2]; // this packet occur more than one collision
314 U32 dwTsrRetry[2]; // this packet has ever occur collision,
315 // that is (dwTsrOnceCollision0 + dwTsrMoreThanOnceCollision0)
316 U32 dwTsrACKData[2];
317 U32 dwTsrErr[2];
318 U32 dwAllTsrOK[2];
319 U32 dwTsrRetryTimeout[2];
320 U32 dwTsrTransmitTimeout[2];
322 U32 dwTsrTxPacket[2];
323 U32 dwTsrTxOctet[2];
324 U32 dwTsrBroadcast[2];
325 U32 dwTsrMulticast[2];
326 U32 dwTsrDirected[2];
328 // RD/TD count
329 U32 dwCntRxFrmLength;
330 U32 dwCntTxBufLength;
332 U8 abyCntRxPattern[16];
333 U8 abyCntTxPattern[16];
335 // Software check....
336 U32 dwCntRxDataErr; // rx buffer data software compare CRC err count
337 U32 dwCntDecryptErr; // rx buffer data software compare CRC err count
338 U32 dwCntRxICVErr; // rx buffer data software compare CRC err count
339 U32 idxRxErrorDesc; // index for rx data error RD
341 // 64-bit OID
342 U32 ullTsrOK[2];
344 // for some optional OIDs (64 bits) and DMI support
345 U32 ullTxBroadcastFrames[2];
346 U32 ullTxMulticastFrames[2];
347 U32 ullTxDirectedFrames[2];
348 U32 ullTxBroadcastBytes[2];
349 U32 ullTxMulticastBytes[2];
350 U32 ullTxDirectedBytes[2];
351 } SStatMIBCount, *PSStatMIBCount;
354 typedef struct tagSNodeItem {
355 // STA info
356 U16 wAID;
357 U8 abyMACAddr[6];
358 U16 wTxDataRate;
359 U16 wInActiveCount;
360 U16 wEnQueueCnt;
361 U16 wFlags;
362 BOOL bPWBitOn;
363 U8 byKeyIndex;
364 U16 wWepKeyLength;
365 U8 abyWepKey[WEP_KEYMAXLEN];
366 // Auto rate fallback vars
367 BOOL bIsInFallback;
368 U32 uTxFailures;
369 U32 uTxAttempts;
370 U16 wFailureRatio;
372 } SNodeItem;
375 typedef struct tagSNodeList {
377 U32 uItem;
378 SNodeItem sNodeList[0];
380 } SNodeList, *PSNodeList;
384 typedef struct tagSCmdValue {
386 U32 dwValue;
388 } SCmdValue, *PSCmdValue;
392 // hostapd & viawget ioctl related
396 // VIAGWET_IOCTL_HOSTAPD ioctl() cmd:
397 enum {
398 VIAWGET_HOSTAPD_FLUSH = 1,
399 VIAWGET_HOSTAPD_ADD_STA = 2,
400 VIAWGET_HOSTAPD_REMOVE_STA = 3,
401 VIAWGET_HOSTAPD_GET_INFO_STA = 4,
402 VIAWGET_HOSTAPD_SET_ENCRYPTION = 5,
403 VIAWGET_HOSTAPD_GET_ENCRYPTION = 6,
404 VIAWGET_HOSTAPD_SET_FLAGS_STA = 7,
405 VIAWGET_HOSTAPD_SET_ASSOC_AP_ADDR = 8,
406 VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT = 9,
407 VIAWGET_HOSTAPD_MLME = 10,
408 VIAWGET_HOSTAPD_SCAN_REQ = 11,
409 VIAWGET_HOSTAPD_STA_CLEAR_STATS = 12,
413 #define VIAWGET_HOSTAPD_GENERIC_ELEMENT_HDR_LEN \
414 ((int) (&((struct viawget_hostapd_param *) 0)->u.generic_elem.data))
416 // Maximum length for algorithm names (-1 for nul termination) used in ioctl()
420 struct viawget_hostapd_param {
421 U32 cmd;
422 U8 sta_addr[6];
423 union {
424 struct {
425 U16 aid;
426 U16 capability;
427 U8 tx_supp_rates;
428 } add_sta;
429 struct {
430 U32 inactive_sec;
431 } get_info_sta;
432 struct {
433 U8 alg;
434 U32 flags;
435 U32 err;
436 U8 idx;
437 U8 seq[8];
438 U16 key_len;
439 U8 key[0];
440 } crypt;
441 struct {
442 U32 flags_and;
443 U32 flags_or;
444 } set_flags_sta;
445 struct {
446 U16 rid;
447 U16 len;
448 U8 data[0];
449 } rid;
450 struct {
451 U8 len;
452 U8 data[0];
453 } generic_elem;
454 struct {
455 U16 cmd;
456 U16 reason_code;
457 } mlme;
458 struct {
459 U8 ssid_len;
460 U8 ssid[32];
461 } scan_req;
462 } u;
465 //2006-1116-01,<Add> by NomadZhao
466 #pragma pack()
468 /*--------------------- Export Classes ----------------------------*/
470 /*--------------------- Export Variables --------------------------*/
473 /*--------------------- Export Types ------------------------------*/
476 /*--------------------- Export Functions --------------------------*/
480 #endif //__IOCMD_H__