2 ***************************************************************************
4 * 4F, No. 2 Technology 5th Rd.
5 * Science-based Industrial Park
6 * Hsin-chu, Taiwan, R.O.C.
8 * (c) Copyright 2002, Ralink Technology, Inc.
10 * All rights reserved. Ralink's source code is an unpublished work and the
11 * use of a copyright notice does not imply otherwise. This source code
12 * contains confidential trade secret material of Ralink Tech. Any attemp
13 * or participation in deciphering, decoding, reverse engineering or in any
14 * way altering the source code is stricitly prohibited, unless the prior
15 * written consent of Ralink Technology, Inc. is obtained.
16 ***************************************************************************/
21 #if WIRELESS_EXT <= 11
22 #ifndef SIOCDEVPRIVATE
23 #define SIOCDEVPRIVATE 0x8BE0
25 #define SIOCIWFIRSTPRIV SIOCDEVPRIVATE
28 #define RT_PRIV_IOCTL SIOCIWFIRSTPRIV + 0x01
29 #define RTPRIV_IOCTL_SET SIOCIWFIRSTPRIV + 0x02
35 // Ralink defined OIDs
36 #define RT_PRIV_IOCTL SIOCIWFIRSTPRIV + 0x01
37 #define RTPRIV_IOCTL_SET SIOCIWFIRSTPRIV + 0x02
39 #define RTPRIV_IOCTL_BBP SIOCIWFIRSTPRIV + 0x03
40 #define RTPRIV_IOCTL_MAC SIOCIWFIRSTPRIV + 0x05
41 #define RTPRIV_IOCTL_E2P SIOCIWFIRSTPRIV + 0x07
43 #define OID_GET_SET_TOGGLE 0x8000
45 #define OID_802_11_BSSID 0x0101
46 #define OID_802_11_SSID 0x0102
47 #define OID_802_11_NETWORK_TYPES_SUPPORTED 0x0103
48 #define OID_802_11_NETWORK_TYPE_IN_USE 0x0104
49 #define OID_802_11_TX_POWER_LEVEL 0x0105
50 #define OID_802_11_RSSI 0x0106
51 #define OID_802_11_RSSI_TRIGGER 0x0107
52 #define OID_802_11_INFRASTRUCTURE_MODE 0x0108
53 #define OID_802_11_FRAGMENTATION_THRESHOLD 0x0109
54 #define OID_802_11_RTS_THRESHOLD 0x010A
55 #define OID_802_11_NUMBER_OF_ANTENNAS 0x010B
56 #define OID_802_11_RX_ANTENNA_SELECTED 0x010C
57 #define OID_802_11_TX_ANTENNA_SELECTED 0x010D
58 #define OID_802_11_SUPPORTED_RATES 0x010E
59 #define OID_802_11_DESIRED_RATES 0x010F
60 #define OID_802_11_CONFIGURATION 0x0110
61 #define OID_802_11_STATISTICS 0x0111
62 #define OID_802_11_ADD_WEP 0x0112
63 #define OID_802_11_REMOVE_WEP 0x0113
64 #define OID_802_11_DISASSOCIATE 0x0114
65 #define OID_802_11_POWER_MODE 0x0115
66 #define OID_802_11_BSSID_LIST 0x0116
67 #define OID_802_11_AUTHENTICATION_MODE 0x0117
68 #define OID_802_11_PRIVACY_FILTER 0x0118
69 #define OID_802_11_BSSID_LIST_SCAN 0x0119
70 #define OID_802_11_WEP_STATUS 0x011A
71 // Renamed to reflect better the extended set of encryption status
72 #define OID_802_11_ENCRYPTION_STATUS OID_802_11_WEP_STATUS
73 #define OID_802_11_RELOAD_DEFAULTS 0x011B
74 // Added to allow key mapping and default keys
75 #define OID_802_11_ADD_KEY 0x011C
76 #define OID_802_11_REMOVE_KEY 0x011D
77 #define OID_802_11_ASSOCIATION_INFORMATION 0x011E
78 #define OID_802_11_TEST 0x011F
80 #define OID_802_3_CURRENT_ADDRESS 0x0120
81 #define OID_GEN_RCV_OK 0x0121
82 #define OID_GEN_RCV_NO_BUFFER 0x0122
83 #define OID_GEN_MEDIA_CONNECT_STATUS 0x0123
85 #define RT_OID_DEVICE_NAME 0x0200
86 #define RT_OID_802_11_PREAMBLE 0x0201
87 #define RT_OID_802_11_LINK_STATUS 0x0202
88 #define RT_OID_802_11_RESET_COUNTERS 0x0203
89 #define RT_OID_802_11_AC_CAM 0x0204
91 #define RT_OID_802_11_HARDWARE_REGISTER 0x0205
93 #define RT_OID_802_11_RACONFIG 0x0206
94 #define RT_OID_802_11_COUNTRY_REGION 0x0207
95 #define RT_OID_802_11_RADIO 0x0208
96 #define RT_OID_802_11_RX_AGC_VGC_TUNING 0x0209
97 #define RT_OID_802_11_EVENT_TABLE 0x0210
98 #define RT_OID_802_11_MAC_TABLE 0x0211
99 #define RT_OID_802_11_PHY_MODE 0x0212
100 #define RT_OID_802_11_TX_PACKET_BURST 0x0213
101 #define RT_OID_802_11_TURBO_MODE 0x0214
102 #define RT_OID_802_11_AP_CONFIG 0x0215
103 #define RT_OID_802_11_ACL 0x0216
104 #define RT_OID_802_11_STA_CONFIG 0x0217
105 #define RT_OID_VERSION_INFO 0x0218
107 #define RT_OID_802_11_WDS 0x0219
108 #define RT_OID_802_11_RADIUS_DATA 0x0220
109 #define RT_OID_802_11_WPA_REKEY 0x0221
111 #define RT_OID_802_11_ADD_WPA 0x0222
113 #define RT_OID_802_11_QUERY_EEPROM_VERSION 0x0223
116 // IEEE 802.11 Structures and definitions
118 // new types for Media Specific Indications
120 #define NDIS_802_11_LENGTH_SSID 32
121 #define NDIS_802_11_LENGTH_RATES 8
122 #define NDIS_802_11_LENGTH_RATES_EX 16
124 typedef enum _NDIS_802_11_STATUS_TYPE
126 Ndis802_11StatusType_Authentication
,
127 Ndis802_11StatusTypeMax
// not a real type, defined as an upper bound
128 } NDIS_802_11_STATUS_TYPE
, *PNDIS_802_11_STATUS_TYPE
;
130 typedef UCHAR NDIS_802_11_MAC_ADDRESS
[6];
132 typedef struct _NDIS_802_11_STATUS_INDICATION
134 NDIS_802_11_STATUS_TYPE StatusType
;
135 } NDIS_802_11_STATUS_INDICATION
, *PNDIS_802_11_STATUS_INDICATION
;
137 // mask for authentication/integrity fields
138 #define NDIS_802_11_AUTH_REQUEST_AUTH_FIELDS 0x0f
140 #define NDIS_802_11_AUTH_REQUEST_REAUTH 0x01
141 #define NDIS_802_11_AUTH_REQUEST_KEYUPDATE 0x02
142 #define NDIS_802_11_AUTH_REQUEST_PAIRWISE_ERROR 0x06
143 #define NDIS_802_11_AUTH_REQUEST_GROUP_ERROR 0x0E
145 typedef struct _NDIS_802_11_AUTHENTICATION_REQUEST
147 ULONG Length
; // Length of structure
148 NDIS_802_11_MAC_ADDRESS Bssid
;
150 } NDIS_802_11_AUTHENTICATION_REQUEST
, *PNDIS_802_11_AUTHENTICATION_REQUEST
;
152 // Added new types for OFDM 5G and 2.4G
153 typedef enum _NDIS_802_11_NETWORK_TYPE
159 Ndis802_11NetworkTypeMax
// not a real type, defined as an upper bound
160 } NDIS_802_11_NETWORK_TYPE
, *PNDIS_802_11_NETWORK_TYPE
;
162 typedef struct PACKED _NDIS_802_11_NETWORK_TYPE_LIST
164 ULONG NumberOfItems
; // in list below, at least 1
165 NDIS_802_11_NETWORK_TYPE NetworkType
[1];
166 } NDIS_802_11_NETWORK_TYPE_LIST
, *PNDIS_802_11_NETWORK_TYPE_LIST
;
168 typedef enum _NDIS_802_11_POWER_MODE
170 Ndis802_11PowerModeCAM
,
171 Ndis802_11PowerModeMAX_PSP
,
172 Ndis802_11PowerModeFast_PSP
,
173 Ndis802_11PowerModeMax
// not a real mode, defined as an upper bound
174 } NDIS_802_11_POWER_MODE
, *PNDIS_802_11_POWER_MODE
;
176 typedef ULONG NDIS_802_11_TX_POWER_LEVEL
; // in milliwatts
179 // Received Signal Strength Indication
181 typedef LONG NDIS_802_11_RSSI
; // in dBm
183 typedef struct _NDIS_802_11_CONFIGURATION_FH
185 ULONG Length
; // Length of structure
186 ULONG HopPattern
; // As defined by 802.11, MSB set
187 ULONG HopSet
; // to one if non-802.11
188 ULONG DwellTime
; // units are Kusec
189 } NDIS_802_11_CONFIGURATION_FH
, *PNDIS_802_11_CONFIGURATION_FH
;
191 typedef struct _NDIS_802_11_CONFIGURATION
193 ULONG Length
; // Length of structure
194 ULONG BeaconPeriod
; // units are Kusec
195 ULONG ATIMWindow
; // units are Kusec
196 ULONG DSConfig
; // Frequency, units are kHz
197 NDIS_802_11_CONFIGURATION_FH FHConfig
;
198 } NDIS_802_11_CONFIGURATION
, *PNDIS_802_11_CONFIGURATION
;
200 typedef struct _NDIS_802_11_STATISTICS
202 ULONG Length
; // Length of structure
203 LARGE_INTEGER TransmittedFragmentCount
;
204 LARGE_INTEGER MulticastTransmittedFrameCount
;
205 LARGE_INTEGER FailedCount
;
206 LARGE_INTEGER RetryCount
;
207 LARGE_INTEGER MultipleRetryCount
;
208 LARGE_INTEGER RTSSuccessCount
;
209 LARGE_INTEGER RTSFailureCount
;
210 LARGE_INTEGER ACKFailureCount
;
211 LARGE_INTEGER FrameDuplicateCount
;
212 LARGE_INTEGER ReceivedFragmentCount
;
213 LARGE_INTEGER MulticastReceivedFrameCount
;
214 LARGE_INTEGER FCSErrorCount
;
215 } NDIS_802_11_STATISTICS
, *PNDIS_802_11_STATISTICS
;
217 typedef ULONG NDIS_802_11_KEY_INDEX
;
218 typedef ULONGLONG NDIS_802_11_KEY_RSC
;
220 // Key mapping keys require a BSSID
221 typedef struct _NDIS_802_11_KEY
223 ULONG Length
; // Length of this structure
225 ULONG KeyLength
; // length of key in bytes
226 NDIS_802_11_MAC_ADDRESS BSSID
;
227 NDIS_802_11_KEY_RSC KeyRSC
;
228 UCHAR KeyMaterial
[1]; // variable length depending on above field
229 } NDIS_802_11_KEY
, *PNDIS_802_11_KEY
;
231 typedef struct _NDIS_802_11_REMOVE_KEY
233 ULONG Length
; // Length of this structure
235 NDIS_802_11_MAC_ADDRESS BSSID
;
236 } NDIS_802_11_REMOVE_KEY
, *PNDIS_802_11_REMOVE_KEY
;
238 typedef struct PACKED _NDIS_802_11_WEP
240 ULONG Length
; // Length of this structure
241 ULONG KeyIndex
; // 0 is the per-client key, 1-N are the
243 ULONG KeyLength
; // length of key in bytes
244 UCHAR KeyMaterial
[1];// variable length depending on above field
245 } NDIS_802_11_WEP
, *PNDIS_802_11_WEP
;
248 typedef enum _NDIS_802_11_NETWORK_INFRASTRUCTURE
251 Ndis802_11Infrastructure
,
252 Ndis802_11AutoUnknown
,
253 Ndis802_11InfrastructureMax
// Not a real value, defined as upper bound
254 } NDIS_802_11_NETWORK_INFRASTRUCTURE
, *PNDIS_802_11_NETWORK_INFRASTRUCTURE
;
256 // Add new authentication modes
257 typedef enum _NDIS_802_11_AUTHENTICATION_MODE
259 Ndis802_11AuthModeOpen
,
260 Ndis802_11AuthModeShared
,
261 Ndis802_11AuthModeAutoSwitch
,
262 Ndis802_11AuthModeWPA
,
263 Ndis802_11AuthModeWPAPSK
,
264 Ndis802_11AuthModeWPANone
,
265 Ndis802_11AuthModeMax
// Not a real mode, defined as upper bound
266 } NDIS_802_11_AUTHENTICATION_MODE
, *PNDIS_802_11_AUTHENTICATION_MODE
;
268 typedef UCHAR PACKED NDIS_802_11_RATES
[NDIS_802_11_LENGTH_RATES
]; // Set of 8 data rates
269 typedef UCHAR PACKED NDIS_802_11_RATES_EX
[NDIS_802_11_LENGTH_RATES_EX
]; // Set of 16 data rates
271 typedef struct PACKED _NDIS_802_11_SSID
273 ULONG SsidLength
; // length of SSID field below, in bytes;
275 UCHAR Ssid
[NDIS_802_11_LENGTH_SSID
]; // SSID information field
276 } NDIS_802_11_SSID
, *PNDIS_802_11_SSID
;
279 typedef struct PACKED _NDIS_WLAN_BSSID
281 ULONG Length
; // Length of this structure
282 NDIS_802_11_MAC_ADDRESS MacAddress
; // BSSID
284 NDIS_802_11_SSID Ssid
; // SSID
285 ULONG Privacy
; // WEP encryption requirement
286 NDIS_802_11_RSSI Rssi
; // receive signal
288 NDIS_802_11_NETWORK_TYPE NetworkTypeInUse
;
289 NDIS_802_11_CONFIGURATION Configuration
;
290 NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode
;
291 NDIS_802_11_RATES SupportedRates
;
292 } NDIS_WLAN_BSSID
, *PNDIS_WLAN_BSSID
;
294 typedef struct PACKED _NDIS_802_11_BSSID_LIST
296 ULONG NumberOfItems
; // in list below, at least 1
297 NDIS_WLAN_BSSID Bssid
[1];
298 } NDIS_802_11_BSSID_LIST
, *PNDIS_802_11_BSSID_LIST
;
300 // Added Capabilities, IELength and IEs for each BSSID
301 typedef struct _NDIS_WLAN_BSSID_EX
303 ULONG Length
; // Length of this structure
304 NDIS_802_11_MAC_ADDRESS MacAddress
; // BSSID
306 NDIS_802_11_SSID Ssid
; // SSID
307 ULONG Privacy
; // WEP encryption requirement
308 NDIS_802_11_RSSI Rssi
; // receive signal
310 NDIS_802_11_NETWORK_TYPE NetworkTypeInUse
;
311 NDIS_802_11_CONFIGURATION Configuration
;
312 NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode
;
313 NDIS_802_11_RATES_EX SupportedRates
;
316 } NDIS_WLAN_BSSID_EX
, *PNDIS_WLAN_BSSID_EX
;
318 typedef struct _NDIS_802_11_BSSID_LIST_EX
320 ULONG NumberOfItems
; // in list below, at least 1
321 NDIS_WLAN_BSSID_EX Bssid
[1];
322 } NDIS_802_11_BSSID_LIST_EX
, *PNDIS_802_11_BSSID_LIST_EX
;
324 typedef struct _NDIS_802_11_FIXED_IEs
327 USHORT BeaconInterval
;
329 } NDIS_802_11_FIXED_IEs
, *PNDIS_802_11_FIXED_IEs
;
331 typedef struct _NDIS_802_11_VARIABLE_IEs
334 UCHAR Length
; // Number of bytes in data field
336 } NDIS_802_11_VARIABLE_IEs
, *PNDIS_802_11_VARIABLE_IEs
;
338 typedef ULONG NDIS_802_11_FRAGMENTATION_THRESHOLD
;
340 typedef ULONG NDIS_802_11_RTS_THRESHOLD
;
342 typedef ULONG NDIS_802_11_ANTENNA
;
344 typedef enum _NDIS_802_11_PRIVACY_FILTER
346 Ndis802_11PrivFilterAcceptAll
,
347 Ndis802_11PrivFilter8021xWEP
348 } NDIS_802_11_PRIVACY_FILTER
, *PNDIS_802_11_PRIVACY_FILTER
;
350 // Added new encryption types
351 // Also aliased typedef to new name
352 typedef enum _NDIS_802_11_WEP_STATUS
354 Ndis802_11WEPEnabled
,
355 Ndis802_11Encryption1Enabled
= Ndis802_11WEPEnabled
,
356 Ndis802_11WEPDisabled
,
357 Ndis802_11EncryptionDisabled
= Ndis802_11WEPDisabled
,
358 Ndis802_11WEPKeyAbsent
,
359 Ndis802_11Encryption1KeyAbsent
= Ndis802_11WEPKeyAbsent
,
360 Ndis802_11WEPNotSupported
,
361 Ndis802_11EncryptionNotSupported
= Ndis802_11WEPNotSupported
,
362 Ndis802_11Encryption2Enabled
,
363 Ndis802_11Encryption2KeyAbsent
,
364 Ndis802_11Encryption3Enabled
,
365 Ndis802_11Encryption3KeyAbsent
366 } NDIS_802_11_WEP_STATUS
, *PNDIS_802_11_WEP_STATUS
,
367 NDIS_802_11_ENCRYPTION_STATUS
, *PNDIS_802_11_ENCRYPTION_STATUS
;
369 typedef enum _NDIS_802_11_RELOAD_DEFAULTS
371 Ndis802_11ReloadWEPKeys
372 } NDIS_802_11_RELOAD_DEFAULTS
, *PNDIS_802_11_RELOAD_DEFAULTS
;
374 #define NDIS_802_11_AI_REQFI_CAPABILITIES 1
375 #define NDIS_802_11_AI_REQFI_LISTENINTERVAL 2
376 #define NDIS_802_11_AI_REQFI_CURRENTAPADDRESS 4
378 #define NDIS_802_11_AI_RESFI_CAPABILITIES 1
379 #define NDIS_802_11_AI_RESFI_STATUSCODE 2
380 #define NDIS_802_11_AI_RESFI_ASSOCIATIONID 4
382 typedef struct _NDIS_802_11_AI_REQFI
385 USHORT ListenInterval
;
386 NDIS_802_11_MAC_ADDRESS CurrentAPAddress
;
387 } NDIS_802_11_AI_REQFI
, *PNDIS_802_11_AI_REQFI
;
389 typedef struct _NDIS_802_11_AI_RESFI
393 USHORT AssociationId
;
394 } NDIS_802_11_AI_RESFI
, *PNDIS_802_11_AI_RESFI
;
396 typedef struct _NDIS_802_11_ASSOCIATION_INFORMATION
399 USHORT AvailableRequestFixedIEs
;
400 NDIS_802_11_AI_REQFI RequestFixedIEs
;
401 ULONG RequestIELength
;
402 ULONG OffsetRequestIEs
;
403 USHORT AvailableResponseFixedIEs
;
404 NDIS_802_11_AI_RESFI ResponseFixedIEs
;
405 ULONG ResponseIELength
;
406 ULONG OffsetResponseIEs
;
407 } NDIS_802_11_ASSOCIATION_INFORMATION
, *PNDIS_802_11_ASSOCIATION_INFORMATION
;
409 typedef struct _NDIS_802_11_AUTHENTICATION_EVENT
411 NDIS_802_11_STATUS_INDICATION Status
;
412 NDIS_802_11_AUTHENTICATION_REQUEST Request
[1];
413 } NDIS_802_11_AUTHENTICATION_EVENT
, *PNDIS_802_11_AUTHENTICATION_EVENT
;
415 typedef struct _NDIS_802_11_TEST
421 NDIS_802_11_AUTHENTICATION_EVENT AuthenticationEvent
;
422 NDIS_802_11_RSSI RssiTrigger
;
424 } NDIS_802_11_TEST
, *PNDIS_802_11_TEST
;
426 typedef enum _RT_802_11_PREAMBLE
{
427 Rt802_11PreambleLong
,
428 Rt802_11PreambleShort
,
430 } RT_802_11_PREAMBLE
, *PRT_802_11_PREAMBLE
;
432 typedef enum _RT_802_11_PHY_MODE
{
437 } RT_802_11_PHY_MODE
;
439 // put all proprietery for-query objects here to reduce # of Query_OID
440 typedef struct _RT_802_11_LINK_STATUS
{
441 ULONG CurrTxRate
; // in units of 0.5Mbps
442 ULONG ChannelQuality
; // 0..100 %
443 ULONG TxByteCount
; // both ok and fail
444 ULONG RxByteCount
; // both ok and fail
445 } RT_802_11_LINK_STATUS
, *PRT_802_11_LINK_STATUS
;
447 // structure for query/set hardware register - MAC, BBP, RF register
448 typedef struct _RT_802_11_HARDWARE_REGISTER
{
449 ULONG HardwareType
; // 0:MAC, 1:BBP, 2:RF register
450 ULONG Offset
; // Q/S register offset addr
451 ULONG Data
; // R/W data buffer
452 } RT_802_11_HARDWARE_REGISTER
, *PRT_802_11_HARDWARE_REGISTER
;
454 // structure to tune BBP R17 "RX AGC VGC init"
455 typedef struct _RT_802_11_RX_AGC_VGC_TUNING
{
456 UCHAR FalseCcaLowerThreshold
; // 0-255, def 10
457 UCHAR FalseCcaUpperThreshold
; // 0-255, def 100
458 UCHAR VgcDelta
; // R17 +-= VgcDelta whenever flase CCA over UpprThreshold
459 // or lower than LowerThresholdupper threshold
460 UCHAR VgcUpperBound
; // max value of R17
461 } RT_802_11_RX_AGC_VGC_TUNING
, *PRT_802_11_RX_AGC_VGC_TUNING
;
463 // structure to query/set STA_CONFIG
464 typedef struct _RT_802_11_STA_CONFIG
{
465 ULONG EnableTxBurst
; // 0-disable, 1-enable
466 ULONG EnableTurboRate
; // 0-disable, 1-enable 72/100mbps turbo rate
467 ULONG UseBGProtection
; // 0-AUTO, 1-always ON, 2-always OFF
468 ULONG UseShortSlotTime
; // 0-no use, 1-use 9-us short slot time when applicable
469 ULONG AdhocMode
; // 0-11b rates only (WIFI spec), 1 - allow OFDM rates
470 ULONG HwRadioStatus
; // 0-OFF, 1-ON, default is 1, Read-Only
471 ULONG Rsv1
; // must be 0
472 ULONG SystemErrorBitmap
; // ignore upon SET, return system error upon QUERY
473 } RT_802_11_STA_CONFIG
, *PRT_802_11_STA_CONFIG
;
475 typedef struct PACKED _RT_VERSION_INFO
{
476 UCHAR DriverVersionW
;
477 UCHAR DriverVersionX
;
478 UCHAR DriverVersionY
;
479 UCHAR DriverVersionZ
;
480 UINT DriverBuildYear
;
481 UINT DriverBuildMonth
;
483 } RT_VERSION_INFO
, *PRT_VERSION_INFO
;