ASoC: Remove duplicate ADC/DAC widgets from wm_hubs.c
[linux/fpc-iii.git] / drivers / staging / rt2860 / rtmp.h
blob25c31998d071ebe6444fe7b2b9576aecb60c11ca
1 /*
2 *************************************************************************
3 * Ralink Tech Inc.
4 * 5F., No.36, Taiyuan St., Jhubei City,
5 * Hsinchu County 302,
6 * Taiwan, R.O.C.
8 * (c) Copyright 2002-2007, Ralink Technology, Inc.
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 * This program is distributed in the hope that it will be useful, *
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18 * GNU General Public License for more details. *
19 * *
20 * You should have received a copy of the GNU General Public License *
21 * along with this program; if not, write to the *
22 * Free Software Foundation, Inc., *
23 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
24 * *
25 *************************************************************************
27 Module Name:
28 rtmp.h
30 Abstract:
31 Miniport generic portion header file
33 Revision History:
34 Who When What
35 -------- ---------- ----------------------------------------------
36 Paul Lin 2002-08-01 created
37 James Tan 2002-09-06 modified (Revise NTCRegTable)
38 John Chang 2004-09-06 modified for RT2600
40 #ifndef __RTMP_H__
41 #define __RTMP_H__
43 #include "link_list.h"
44 #include "spectrum_def.h"
46 #include "aironet.h"
48 //#define DBG_DIAGNOSE 1
50 #define VIRTUAL_IF_INC(__pAd) ((__pAd)->VirtualIfCnt++)
51 #define VIRTUAL_IF_DEC(__pAd) ((__pAd)->VirtualIfCnt--)
52 #define VIRTUAL_IF_NUM(__pAd) ((__pAd)->VirtualIfCnt)
54 #ifdef RT2870
55 ////////////////////////////////////////////////////////////////////////////
56 // The TX_BUFFER structure forms the transmitted USB packet to the device
57 ////////////////////////////////////////////////////////////////////////////
58 typedef struct __TX_BUFFER{
59 union {
60 UCHAR WirelessPacket[TX_BUFFER_NORMSIZE];
61 HEADER_802_11 NullFrame;
62 PSPOLL_FRAME PsPollPacket;
63 RTS_FRAME RTSFrame;
64 }field;
65 UCHAR Aggregation[4]; //Buffer for save Aggregation size.
66 } TX_BUFFER, *PTX_BUFFER;
68 typedef struct __HTTX_BUFFER{
69 union {
70 UCHAR WirelessPacket[MAX_TXBULK_SIZE];
71 HEADER_802_11 NullFrame;
72 PSPOLL_FRAME PsPollPacket;
73 RTS_FRAME RTSFrame;
74 }field;
75 UCHAR Aggregation[4]; //Buffer for save Aggregation size.
76 } HTTX_BUFFER, *PHTTX_BUFFER;
79 // used to track driver-generated write irps
80 typedef struct _TX_CONTEXT
82 PVOID pAd; //Initialized in MiniportInitialize
83 PURB pUrb; //Initialized in MiniportInitialize
84 PIRP pIrp; //used to cancel pending bulk out.
85 //Initialized in MiniportInitialize
86 PTX_BUFFER TransferBuffer; //Initialized in MiniportInitialize
87 ULONG BulkOutSize;
88 UCHAR BulkOutPipeId;
89 UCHAR SelfIdx;
90 BOOLEAN InUse;
91 BOOLEAN bWaitingBulkOut; // at least one packet is in this TxContext, ready for making IRP anytime.
92 BOOLEAN bFullForBulkOut; // all tx buffer are full , so waiting for tx bulkout.
93 BOOLEAN IRPPending;
94 BOOLEAN LastOne;
95 BOOLEAN bAggregatible;
96 UCHAR Header_802_3[LENGTH_802_3];
97 UCHAR Rsv[2];
98 ULONG DataOffset;
99 UINT TxRate;
100 dma_addr_t data_dma; // urb dma on linux
102 } TX_CONTEXT, *PTX_CONTEXT, **PPTX_CONTEXT;
105 // used to track driver-generated write irps
106 typedef struct _HT_TX_CONTEXT
108 PVOID pAd; //Initialized in MiniportInitialize
109 PURB pUrb; //Initialized in MiniportInitialize
110 PIRP pIrp; //used to cancel pending bulk out.
111 //Initialized in MiniportInitialize
112 PHTTX_BUFFER TransferBuffer; //Initialized in MiniportInitialize
113 ULONG BulkOutSize; // Indicate the total bulk-out size in bytes in one bulk-transmission
114 UCHAR BulkOutPipeId;
115 BOOLEAN IRPPending;
116 BOOLEAN LastOne;
117 BOOLEAN bCurWriting;
118 BOOLEAN bRingEmpty;
119 BOOLEAN bCopySavePad;
120 UCHAR SavedPad[8];
121 UCHAR Header_802_3[LENGTH_802_3];
122 ULONG CurWritePosition; // Indicate the buffer offset which packet will be inserted start from.
123 ULONG CurWriteRealPos; // Indicate the buffer offset which packet now are writing to.
124 ULONG NextBulkOutPosition; // Indicate the buffer start offset of a bulk-transmission
125 ULONG ENextBulkOutPosition; // Indicate the buffer end offset of a bulk-transmission
126 UINT TxRate;
127 dma_addr_t data_dma; // urb dma on linux
128 } HT_TX_CONTEXT, *PHT_TX_CONTEXT, **PPHT_TX_CONTEXT;
132 // Structure to keep track of receive packets and buffers to indicate
133 // receive data to the protocol.
135 typedef struct _RX_CONTEXT
137 PUCHAR TransferBuffer;
138 PVOID pAd;
139 PIRP pIrp;//used to cancel pending bulk in.
140 PURB pUrb;
141 //These 2 Boolean shouldn't both be 1 at the same time.
142 ULONG BulkInOffset; // number of packets waiting for reordering .
143 BOOLEAN bRxHandling; // Notify this packet is being process now.
144 BOOLEAN InUse; // USB Hardware Occupied. Wait for USB HW to put packet.
145 BOOLEAN Readable; // Receive Complete back. OK for driver to indicate receiving packet.
146 BOOLEAN IRPPending; // TODO: To be removed
147 atomic_t IrpLock;
148 NDIS_SPIN_LOCK RxContextLock;
149 dma_addr_t data_dma; // urb dma on linux
150 } RX_CONTEXT, *PRX_CONTEXT;
151 #endif // RT2870 //
155 // NDIS Version definitions
157 #ifdef NDIS50_MINIPORT
158 #define RTMP_NDIS_MAJOR_VERSION 5
159 #define RTMP_NDIS_MINOR_VERSION 0
160 #endif
162 #ifdef NDIS51_MINIPORT
163 #define RTMP_NDIS_MAJOR_VERSION 5
164 #define RTMP_NDIS_MINOR_VERSION 1
165 #endif
167 extern char NIC_VENDOR_DESC[];
168 extern int NIC_VENDOR_DESC_LEN;
170 extern unsigned char SNAP_AIRONET[];
171 extern unsigned char CipherSuiteCiscoCCKM[];
172 extern unsigned char CipherSuiteCiscoCCKMLen;
173 extern unsigned char CipherSuiteCiscoCCKM24[];
174 extern unsigned char CipherSuiteCiscoCCKM24Len;
175 extern unsigned char CipherSuiteCCXTkip[];
176 extern unsigned char CipherSuiteCCXTkipLen;
177 extern unsigned char CISCO_OUI[];
178 extern UCHAR BaSizeArray[4];
180 extern UCHAR BROADCAST_ADDR[MAC_ADDR_LEN];
181 extern UCHAR MULTICAST_ADDR[MAC_ADDR_LEN];
182 extern UCHAR ZERO_MAC_ADDR[MAC_ADDR_LEN];
183 extern ULONG BIT32[32];
184 extern UCHAR BIT8[8];
185 extern char* CipherName[];
186 extern char* MCSToMbps[];
187 extern UCHAR RxwiMCSToOfdmRate[12];
188 extern UCHAR SNAP_802_1H[6];
189 extern UCHAR SNAP_BRIDGE_TUNNEL[6];
190 extern UCHAR SNAP_AIRONET[8];
191 extern UCHAR CKIP_LLC_SNAP[8];
192 extern UCHAR EAPOL_LLC_SNAP[8];
193 extern UCHAR EAPOL[2];
194 extern UCHAR IPX[2];
195 extern UCHAR APPLE_TALK[2];
196 extern UCHAR RateIdToPlcpSignal[12]; // see IEEE802.11a-1999 p.14
197 extern UCHAR OfdmRateToRxwiMCS[];
198 extern UCHAR OfdmSignalToRateId[16] ;
199 extern UCHAR default_cwmin[4];
200 extern UCHAR default_cwmax[4];
201 extern UCHAR default_sta_aifsn[4];
202 extern UCHAR MapUserPriorityToAccessCategory[8];
204 extern USHORT RateUpPER[];
205 extern USHORT RateDownPER[];
206 extern UCHAR Phy11BNextRateDownward[];
207 extern UCHAR Phy11BNextRateUpward[];
208 extern UCHAR Phy11BGNextRateDownward[];
209 extern UCHAR Phy11BGNextRateUpward[];
210 extern UCHAR Phy11ANextRateDownward[];
211 extern UCHAR Phy11ANextRateUpward[];
212 extern CHAR RssiSafeLevelForTxRate[];
213 extern UCHAR RateIdToMbps[];
214 extern USHORT RateIdTo500Kbps[];
216 extern UCHAR CipherSuiteWpaNoneTkip[];
217 extern UCHAR CipherSuiteWpaNoneTkipLen;
219 extern UCHAR CipherSuiteWpaNoneAes[];
220 extern UCHAR CipherSuiteWpaNoneAesLen;
222 extern UCHAR SsidIe;
223 extern UCHAR SupRateIe;
224 extern UCHAR ExtRateIe;
226 extern UCHAR HtCapIe;
227 extern UCHAR AddHtInfoIe;
228 extern UCHAR NewExtChanIe;
230 extern UCHAR ErpIe;
231 extern UCHAR DsIe;
232 extern UCHAR TimIe;
233 extern UCHAR WpaIe;
234 extern UCHAR Wpa2Ie;
235 extern UCHAR IbssIe;
236 extern UCHAR Ccx2Ie;
237 #ifdef RT30xx
238 extern UCHAR WapiIe;
239 #endif
241 extern UCHAR WPA_OUI[];
242 extern UCHAR RSN_OUI[];
243 #ifdef RT30xx
244 extern UCHAR WAPI_OUI[];
245 #endif
246 extern UCHAR WME_INFO_ELEM[];
247 extern UCHAR WME_PARM_ELEM[];
248 extern UCHAR Ccx2QosInfo[];
249 extern UCHAR Ccx2IeInfo[];
250 extern UCHAR RALINK_OUI[];
251 extern UCHAR PowerConstraintIE[];
254 extern UCHAR RateSwitchTable[];
255 extern UCHAR RateSwitchTable11B[];
256 extern UCHAR RateSwitchTable11G[];
257 extern UCHAR RateSwitchTable11BG[];
259 extern UCHAR RateSwitchTable11BGN1S[];
260 extern UCHAR RateSwitchTable11BGN2S[];
261 extern UCHAR RateSwitchTable11BGN2SForABand[];
262 extern UCHAR RateSwitchTable11N1S[];
263 extern UCHAR RateSwitchTable11N2S[];
264 extern UCHAR RateSwitchTable11N2SForABand[];
266 extern UCHAR PRE_N_HT_OUI[];
268 #define MAXSEQ (0xFFF)
270 struct reordering_mpdu
272 struct reordering_mpdu *next;
273 PNDIS_PACKET pPacket; /* coverted to 802.3 frame */
274 int Sequence; /* sequence number of MPDU */
275 BOOLEAN bAMSDU;
278 struct reordering_list
280 struct reordering_mpdu *next;
281 int qlen;
284 struct reordering_mpdu_pool
286 PVOID mem;
287 NDIS_SPIN_LOCK lock;
288 struct reordering_list freelist;
291 typedef struct _RSSI_SAMPLE {
292 CHAR LastRssi0; // last received RSSI
293 CHAR LastRssi1; // last received RSSI
294 CHAR LastRssi2; // last received RSSI
295 CHAR AvgRssi0;
296 CHAR AvgRssi1;
297 CHAR AvgRssi2;
298 SHORT AvgRssi0X8;
299 SHORT AvgRssi1X8;
300 SHORT AvgRssi2X8;
301 } RSSI_SAMPLE;
304 // Queue structure and macros
306 typedef struct _QUEUE_ENTRY {
307 struct _QUEUE_ENTRY *Next;
308 } QUEUE_ENTRY, *PQUEUE_ENTRY;
310 // Queue structure
311 typedef struct _QUEUE_HEADER {
312 PQUEUE_ENTRY Head;
313 PQUEUE_ENTRY Tail;
314 ULONG Number;
315 } QUEUE_HEADER, *PQUEUE_HEADER;
317 #define InitializeQueueHeader(QueueHeader) \
319 (QueueHeader)->Head = (QueueHeader)->Tail = NULL; \
320 (QueueHeader)->Number = 0; \
323 #define RemoveHeadQueue(QueueHeader) \
324 (QueueHeader)->Head; \
326 PQUEUE_ENTRY pNext; \
327 if ((QueueHeader)->Head != NULL) \
329 pNext = (QueueHeader)->Head->Next; \
330 (QueueHeader)->Head = pNext; \
331 if (pNext == NULL) \
332 (QueueHeader)->Tail = NULL; \
333 (QueueHeader)->Number--; \
337 #define InsertHeadQueue(QueueHeader, QueueEntry) \
339 ((PQUEUE_ENTRY)QueueEntry)->Next = (QueueHeader)->Head; \
340 (QueueHeader)->Head = (PQUEUE_ENTRY)(QueueEntry); \
341 if ((QueueHeader)->Tail == NULL) \
342 (QueueHeader)->Tail = (PQUEUE_ENTRY)(QueueEntry); \
343 (QueueHeader)->Number++; \
346 #define InsertTailQueue(QueueHeader, QueueEntry) \
348 ((PQUEUE_ENTRY)QueueEntry)->Next = NULL; \
349 if ((QueueHeader)->Tail) \
350 (QueueHeader)->Tail->Next = (PQUEUE_ENTRY)(QueueEntry); \
351 else \
352 (QueueHeader)->Head = (PQUEUE_ENTRY)(QueueEntry); \
353 (QueueHeader)->Tail = (PQUEUE_ENTRY)(QueueEntry); \
354 (QueueHeader)->Number++; \
358 // Macros for flag and ref count operations
360 #define RTMP_SET_FLAG(_M, _F) ((_M)->Flags |= (_F))
361 #define RTMP_CLEAR_FLAG(_M, _F) ((_M)->Flags &= ~(_F))
362 #define RTMP_CLEAR_FLAGS(_M) ((_M)->Flags = 0)
363 #define RTMP_TEST_FLAG(_M, _F) (((_M)->Flags & (_F)) != 0)
364 #define RTMP_TEST_FLAGS(_M, _F) (((_M)->Flags & (_F)) == (_F))
366 #ifdef RT2860
367 // Macro for power save flag.
368 #define RTMP_SET_PSFLAG(_M, _F) ((_M)->PSFlags |= (_F))
369 #define RTMP_CLEAR_PSFLAG(_M, _F) ((_M)->PSFlags &= ~(_F))
370 #define RTMP_CLEAR_PSFLAGS(_M) ((_M)->PSFlags = 0)
371 #define RTMP_TEST_PSFLAG(_M, _F) (((_M)->PSFlags & (_F)) != 0)
372 #define RTMP_TEST_PSFLAGS(_M, _F) (((_M)->PSFlags & (_F)) == (_F))
373 #endif
375 #define OPSTATUS_SET_FLAG(_pAd, _F) ((_pAd)->CommonCfg.OpStatusFlags |= (_F))
376 #define OPSTATUS_CLEAR_FLAG(_pAd, _F) ((_pAd)->CommonCfg.OpStatusFlags &= ~(_F))
377 #define OPSTATUS_TEST_FLAG(_pAd, _F) (((_pAd)->CommonCfg.OpStatusFlags & (_F)) != 0)
379 #define CLIENT_STATUS_SET_FLAG(_pEntry,_F) ((_pEntry)->ClientStatusFlags |= (_F))
380 #define CLIENT_STATUS_CLEAR_FLAG(_pEntry,_F) ((_pEntry)->ClientStatusFlags &= ~(_F))
381 #define CLIENT_STATUS_TEST_FLAG(_pEntry,_F) (((_pEntry)->ClientStatusFlags & (_F)) != 0)
383 #define RX_FILTER_SET_FLAG(_pAd, _F) ((_pAd)->CommonCfg.PacketFilter |= (_F))
384 #define RX_FILTER_CLEAR_FLAG(_pAd, _F) ((_pAd)->CommonCfg.PacketFilter &= ~(_F))
385 #define RX_FILTER_TEST_FLAG(_pAd, _F) (((_pAd)->CommonCfg.PacketFilter & (_F)) != 0)
387 #define STA_NO_SECURITY_ON(_p) (_p->StaCfg.WepStatus == Ndis802_11EncryptionDisabled)
388 #define STA_WEP_ON(_p) (_p->StaCfg.WepStatus == Ndis802_11Encryption1Enabled)
389 #define STA_TKIP_ON(_p) (_p->StaCfg.WepStatus == Ndis802_11Encryption2Enabled)
390 #define STA_AES_ON(_p) (_p->StaCfg.WepStatus == Ndis802_11Encryption3Enabled)
392 #define STA_TGN_WIFI_ON(_p) (_p->StaCfg.bTGnWifiTest == TRUE)
394 #define CKIP_KP_ON(_p) ((((_p)->StaCfg.CkipFlag) & 0x10) && ((_p)->StaCfg.bCkipCmicOn == TRUE))
395 #define CKIP_CMIC_ON(_p) ((((_p)->StaCfg.CkipFlag) & 0x08) && ((_p)->StaCfg.bCkipCmicOn == TRUE))
398 #define INC_RING_INDEX(_idx, _RingSize) \
400 (_idx) = (_idx+1) % (_RingSize); \
403 #ifdef RT30xx
404 // We will have a cost down version which mac version is 0x3090xxxx
405 #define IS_RT3090(_pAd) ((((_pAd)->MACVersion & 0xffff0000) == 0x30710000) || (((_pAd)->MACVersion & 0xffff0000) == 0x30900000))
406 #endif
407 #define IS_RT3070(_pAd) (((_pAd)->MACVersion & 0xffff0000) == 0x30700000)
408 #ifdef RT30xx
409 #define IS_RT3071(_pAd) (((_pAd)->MACVersion & 0xffff0000) == 0x30710000)
410 #define IS_RT2070(_pAd) (((_pAd)->RfIcType == RFIC_2020) || ((_pAd)->EFuseTag == 0x27))
412 #define IS_RT30xx(_pAd) (((_pAd)->MACVersion & 0xfff00000) == 0x30700000)
413 #endif
415 #define RING_PACKET_INIT(_TxRing, _idx) \
417 _TxRing->Cell[_idx].pNdisPacket = NULL; \
418 _TxRing->Cell[_idx].pNextNdisPacket = NULL; \
421 #define TXDT_INIT(_TxD) \
423 NdisZeroMemory(_TxD, TXD_SIZE); \
424 _TxD->DMADONE = 1; \
427 //Set last data segment
428 #define RING_SET_LASTDS(_TxD, _IsSD0) \
430 if (_IsSD0) {_TxD->LastSec0 = 1;} \
431 else {_TxD->LastSec1 = 1;} \
434 // Increase TxTsc value for next transmission
435 // TODO:
436 // When i==6, means TSC has done one full cycle, do re-keying stuff follow specs
437 // Should send a special event microsoft defined to request re-key
438 #define INC_TX_TSC(_tsc) \
440 int i=0; \
441 while (++_tsc[i] == 0x0) \
443 i++; \
444 if (i == 6) \
445 break; \
449 // StaActive.SupportedHtPhy.MCSSet is copied from AP beacon. Don't need to update here.
450 #define COPY_HTSETTINGS_FROM_MLME_AUX_TO_ACTIVE_CFG(_pAd) \
452 _pAd->StaActive.SupportedHtPhy.ChannelWidth = _pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth; \
453 _pAd->StaActive.SupportedHtPhy.MimoPs = _pAd->MlmeAux.HtCapability.HtCapInfo.MimoPs; \
454 _pAd->StaActive.SupportedHtPhy.GF = _pAd->MlmeAux.HtCapability.HtCapInfo.GF; \
455 _pAd->StaActive.SupportedHtPhy.ShortGIfor20 = _pAd->MlmeAux.HtCapability.HtCapInfo.ShortGIfor20; \
456 _pAd->StaActive.SupportedHtPhy.ShortGIfor40 = _pAd->MlmeAux.HtCapability.HtCapInfo.ShortGIfor40; \
457 _pAd->StaActive.SupportedHtPhy.TxSTBC = _pAd->MlmeAux.HtCapability.HtCapInfo.TxSTBC; \
458 _pAd->StaActive.SupportedHtPhy.RxSTBC = _pAd->MlmeAux.HtCapability.HtCapInfo.RxSTBC; \
459 _pAd->StaActive.SupportedHtPhy.ExtChanOffset = _pAd->MlmeAux.AddHtInfo.AddHtInfo.ExtChanOffset; \
460 _pAd->StaActive.SupportedHtPhy.RecomWidth = _pAd->MlmeAux.AddHtInfo.AddHtInfo.RecomWidth; \
461 _pAd->StaActive.SupportedHtPhy.OperaionMode = _pAd->MlmeAux.AddHtInfo.AddHtInfo2.OperaionMode; \
462 _pAd->StaActive.SupportedHtPhy.NonGfPresent = _pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent; \
463 NdisMoveMemory((_pAd)->MacTab.Content[BSSID_WCID].HTCapability.MCSSet, (_pAd)->StaActive.SupportedPhyInfo.MCSSet, sizeof(UCHAR) * 16);\
466 #define COPY_AP_HTSETTINGS_FROM_BEACON(_pAd, _pHtCapability) \
468 _pAd->MacTab.Content[BSSID_WCID].AMsduSize = (UCHAR)(_pHtCapability->HtCapInfo.AMsduSize); \
469 _pAd->MacTab.Content[BSSID_WCID].MmpsMode= (UCHAR)(_pHtCapability->HtCapInfo.MimoPs); \
470 _pAd->MacTab.Content[BSSID_WCID].MaxRAmpduFactor = (UCHAR)(_pHtCapability->HtCapParm.MaxRAmpduFactor); \
474 // MACRO for 32-bit PCI register read / write
476 // Usage : RTMP_IO_READ32(
477 // PRTMP_ADAPTER pAd,
478 // ULONG Register_Offset,
479 // PULONG pValue)
481 // RTMP_IO_WRITE32(
482 // PRTMP_ADAPTER pAd,
483 // ULONG Register_Offset,
484 // ULONG Value)
488 // BBP & RF are using indirect access. Before write any value into it.
489 // We have to make sure there is no outstanding command pending via checking busy bit.
491 #define MAX_BUSY_COUNT 100 // Number of retry before failing access BBP & RF indirect register
493 #ifdef RT2860
494 #define RTMP_RF_IO_WRITE32(_A, _V) \
496 PHY_CSR4_STRUC Value; \
497 ULONG BusyCnt = 0; \
498 if ((_A)->bPCIclkOff) \
500 return; \
502 do { \
503 RTMP_IO_READ32(_A, RF_CSR_CFG0, &Value.word); \
504 if (Value.field.Busy == IDLE) \
505 break; \
506 BusyCnt++; \
507 } while (BusyCnt < MAX_BUSY_COUNT); \
508 if (BusyCnt < MAX_BUSY_COUNT) \
510 RTMP_IO_WRITE32(_A, RF_CSR_CFG0, _V); \
514 #define BBP_IO_READ8_BY_REG_ID(_A, _I, _pV) \
516 BBP_CSR_CFG_STRUC BbpCsr; \
517 int i, k; \
518 for (i=0; i<MAX_BUSY_COUNT; i++) \
520 RTMP_IO_READ32(_A, BBP_CSR_CFG, &BbpCsr.word); \
521 if (BbpCsr.field.Busy == BUSY) \
523 continue; \
525 BbpCsr.word = 0; \
526 BbpCsr.field.fRead = 1; \
527 BbpCsr.field.BBP_RW_MODE = 1; \
528 BbpCsr.field.Busy = 1; \
529 BbpCsr.field.RegNum = _I; \
530 RTMP_IO_WRITE32(_A, BBP_CSR_CFG, BbpCsr.word); \
531 for (k=0; k<MAX_BUSY_COUNT; k++) \
533 RTMP_IO_READ32(_A, BBP_CSR_CFG, &BbpCsr.word); \
534 if (BbpCsr.field.Busy == IDLE) \
535 break; \
537 if ((BbpCsr.field.Busy == IDLE) && \
538 (BbpCsr.field.RegNum == _I)) \
540 *(_pV) = (UCHAR)BbpCsr.field.Value; \
541 break; \
544 if (BbpCsr.field.Busy == BUSY) \
546 DBGPRINT_ERR(("DFS BBP read R%d fail\n", _I)); \
547 *(_pV) = (_A)->BbpWriteLatch[_I]; \
551 //#define RTMP_BBP_IO_READ8_BY_REG_ID(_A, _I, _pV) {}
552 // Read BBP register by register's ID. Generate PER to test BA
553 #define RTMP_BBP_IO_READ8_BY_REG_ID(_A, _I, _pV) \
555 BBP_CSR_CFG_STRUC BbpCsr; \
556 int i, k; \
557 if ((_A)->bPCIclkOff == FALSE) \
559 for (i=0; i<MAX_BUSY_COUNT; i++) \
561 RTMP_IO_READ32(_A, H2M_BBP_AGENT, &BbpCsr.word); \
562 if (BbpCsr.field.Busy == BUSY) \
564 continue; \
566 BbpCsr.word = 0; \
567 BbpCsr.field.fRead = 1; \
568 BbpCsr.field.BBP_RW_MODE = 1; \
569 BbpCsr.field.Busy = 1; \
570 BbpCsr.field.RegNum = _I; \
571 RTMP_IO_WRITE32(_A, H2M_BBP_AGENT, BbpCsr.word); \
572 AsicSendCommandToMcu(_A, 0x80, 0xff, 0x0, 0x0); \
573 RTMPusecDelay(1000); \
574 for (k=0; k<MAX_BUSY_COUNT; k++) \
576 RTMP_IO_READ32(_A, H2M_BBP_AGENT, &BbpCsr.word); \
577 if (BbpCsr.field.Busy == IDLE) \
578 break; \
580 if ((BbpCsr.field.Busy == IDLE) && \
581 (BbpCsr.field.RegNum == _I)) \
583 *(_pV) = (UCHAR)BbpCsr.field.Value; \
584 break; \
587 if (BbpCsr.field.Busy == BUSY) \
589 DBGPRINT_ERR(("BBP read R%d=0x%x fail\n", _I, BbpCsr.word)); \
590 *(_pV) = (_A)->BbpWriteLatch[_I]; \
591 RTMP_IO_READ32(_A, H2M_BBP_AGENT, &BbpCsr.word); \
592 BbpCsr.field.Busy = 0; \
593 RTMP_IO_WRITE32(_A, H2M_BBP_AGENT, BbpCsr.word); \
598 #define BBP_IO_WRITE8_BY_REG_ID(_A, _I, _V) \
600 BBP_CSR_CFG_STRUC BbpCsr; \
601 int BusyCnt; \
602 for (BusyCnt=0; BusyCnt<MAX_BUSY_COUNT; BusyCnt++) \
604 RTMP_IO_READ32(_A, BBP_CSR_CFG, &BbpCsr.word); \
605 if (BbpCsr.field.Busy == BUSY) \
606 continue; \
607 BbpCsr.word = 0; \
608 BbpCsr.field.fRead = 0; \
609 BbpCsr.field.BBP_RW_MODE = 1; \
610 BbpCsr.field.Busy = 1; \
611 BbpCsr.field.Value = _V; \
612 BbpCsr.field.RegNum = _I; \
613 RTMP_IO_WRITE32(_A, BBP_CSR_CFG, BbpCsr.word); \
614 (_A)->BbpWriteLatch[_I] = _V; \
615 break; \
617 if (BusyCnt == MAX_BUSY_COUNT) \
619 DBGPRINT_ERR(("BBP write R%d fail\n", _I)); \
623 // Write BBP register by register's ID & value
624 #define RTMP_BBP_IO_WRITE8_BY_REG_ID(_A, _I, _V) \
626 BBP_CSR_CFG_STRUC BbpCsr; \
627 int BusyCnt; \
628 if ((_A)->bPCIclkOff == FALSE) \
630 for (BusyCnt=0; BusyCnt<MAX_BUSY_COUNT; BusyCnt++) \
632 RTMP_IO_READ32(_A, H2M_BBP_AGENT, &BbpCsr.word); \
633 if (BbpCsr.field.Busy == BUSY) \
634 continue; \
635 BbpCsr.word = 0; \
636 BbpCsr.field.fRead = 0; \
637 BbpCsr.field.BBP_RW_MODE = 1; \
638 BbpCsr.field.Busy = 1; \
639 BbpCsr.field.Value = _V; \
640 BbpCsr.field.RegNum = _I; \
641 RTMP_IO_WRITE32(_A, H2M_BBP_AGENT, BbpCsr.word); \
642 AsicSendCommandToMcu(_A, 0x80, 0xff, 0x0, 0x0); \
643 if (_A->OpMode == OPMODE_AP) \
644 RTMPusecDelay(1000); \
645 (_A)->BbpWriteLatch[_I] = _V; \
646 break; \
648 if (BusyCnt == MAX_BUSY_COUNT) \
650 DBGPRINT_ERR(("BBP write R%d=0x%x fail\n", _I, BbpCsr.word)); \
651 RTMP_IO_READ32(_A, H2M_BBP_AGENT, &BbpCsr.word); \
652 BbpCsr.field.Busy = 0; \
653 RTMP_IO_WRITE32(_A, H2M_BBP_AGENT, BbpCsr.word); \
657 #endif /* RT2860 */
658 #ifdef RT2870
659 #define RTMP_RF_IO_WRITE32(_A, _V) RTUSBWriteRFRegister(_A, _V)
660 #define RTMP_BBP_IO_READ8_BY_REG_ID(_A, _I, _pV) RTUSBReadBBPRegister(_A, _I, _pV)
661 #define RTMP_BBP_IO_WRITE8_BY_REG_ID(_A, _I, _V) RTUSBWriteBBPRegister(_A, _I, _V)
663 #define BBP_IO_WRITE8_BY_REG_ID(_A, _I, _V) RTUSBWriteBBPRegister(_A, _I, _V)
664 #define BBP_IO_READ8_BY_REG_ID(_A, _I, _pV) RTUSBReadBBPRegister(_A, _I, _pV)
665 #endif // RT2870 //
667 #ifdef RT30xx
668 #define RTMP_RF_IO_READ8_BY_REG_ID(_A, _I, _pV) RT30xxReadRFRegister(_A, _I, _pV)
669 #define RTMP_RF_IO_WRITE8_BY_REG_ID(_A, _I, _V) RT30xxWriteRFRegister(_A, _I, _V)
670 #endif // RT30xx //
672 #define MAP_CHANNEL_ID_TO_KHZ(ch, khz) { \
673 switch (ch) \
675 case 1: khz = 2412000; break; \
676 case 2: khz = 2417000; break; \
677 case 3: khz = 2422000; break; \
678 case 4: khz = 2427000; break; \
679 case 5: khz = 2432000; break; \
680 case 6: khz = 2437000; break; \
681 case 7: khz = 2442000; break; \
682 case 8: khz = 2447000; break; \
683 case 9: khz = 2452000; break; \
684 case 10: khz = 2457000; break; \
685 case 11: khz = 2462000; break; \
686 case 12: khz = 2467000; break; \
687 case 13: khz = 2472000; break; \
688 case 14: khz = 2484000; break; \
689 case 36: /* UNII */ khz = 5180000; break; \
690 case 40: /* UNII */ khz = 5200000; break; \
691 case 44: /* UNII */ khz = 5220000; break; \
692 case 48: /* UNII */ khz = 5240000; break; \
693 case 52: /* UNII */ khz = 5260000; break; \
694 case 56: /* UNII */ khz = 5280000; break; \
695 case 60: /* UNII */ khz = 5300000; break; \
696 case 64: /* UNII */ khz = 5320000; break; \
697 case 149: /* UNII */ khz = 5745000; break; \
698 case 153: /* UNII */ khz = 5765000; break; \
699 case 157: /* UNII */ khz = 5785000; break; \
700 case 161: /* UNII */ khz = 5805000; break; \
701 case 165: /* UNII */ khz = 5825000; break; \
702 case 100: /* HiperLAN2 */ khz = 5500000; break; \
703 case 104: /* HiperLAN2 */ khz = 5520000; break; \
704 case 108: /* HiperLAN2 */ khz = 5540000; break; \
705 case 112: /* HiperLAN2 */ khz = 5560000; break; \
706 case 116: /* HiperLAN2 */ khz = 5580000; break; \
707 case 120: /* HiperLAN2 */ khz = 5600000; break; \
708 case 124: /* HiperLAN2 */ khz = 5620000; break; \
709 case 128: /* HiperLAN2 */ khz = 5640000; break; \
710 case 132: /* HiperLAN2 */ khz = 5660000; break; \
711 case 136: /* HiperLAN2 */ khz = 5680000; break; \
712 case 140: /* HiperLAN2 */ khz = 5700000; break; \
713 case 34: /* Japan MMAC */ khz = 5170000; break; \
714 case 38: /* Japan MMAC */ khz = 5190000; break; \
715 case 42: /* Japan MMAC */ khz = 5210000; break; \
716 case 46: /* Japan MMAC */ khz = 5230000; break; \
717 case 184: /* Japan */ khz = 4920000; break; \
718 case 188: /* Japan */ khz = 4940000; break; \
719 case 192: /* Japan */ khz = 4960000; break; \
720 case 196: /* Japan */ khz = 4980000; break; \
721 case 208: /* Japan, means J08 */ khz = 5040000; break; \
722 case 212: /* Japan, means J12 */ khz = 5060000; break; \
723 case 216: /* Japan, means J16 */ khz = 5080000; break; \
724 default: khz = 2412000; break; \
728 #define MAP_KHZ_TO_CHANNEL_ID(khz, ch) { \
729 switch (khz) \
731 case 2412000: ch = 1; break; \
732 case 2417000: ch = 2; break; \
733 case 2422000: ch = 3; break; \
734 case 2427000: ch = 4; break; \
735 case 2432000: ch = 5; break; \
736 case 2437000: ch = 6; break; \
737 case 2442000: ch = 7; break; \
738 case 2447000: ch = 8; break; \
739 case 2452000: ch = 9; break; \
740 case 2457000: ch = 10; break; \
741 case 2462000: ch = 11; break; \
742 case 2467000: ch = 12; break; \
743 case 2472000: ch = 13; break; \
744 case 2484000: ch = 14; break; \
745 case 5180000: ch = 36; /* UNII */ break; \
746 case 5200000: ch = 40; /* UNII */ break; \
747 case 5220000: ch = 44; /* UNII */ break; \
748 case 5240000: ch = 48; /* UNII */ break; \
749 case 5260000: ch = 52; /* UNII */ break; \
750 case 5280000: ch = 56; /* UNII */ break; \
751 case 5300000: ch = 60; /* UNII */ break; \
752 case 5320000: ch = 64; /* UNII */ break; \
753 case 5745000: ch = 149; /* UNII */ break; \
754 case 5765000: ch = 153; /* UNII */ break; \
755 case 5785000: ch = 157; /* UNII */ break; \
756 case 5805000: ch = 161; /* UNII */ break; \
757 case 5825000: ch = 165; /* UNII */ break; \
758 case 5500000: ch = 100; /* HiperLAN2 */ break; \
759 case 5520000: ch = 104; /* HiperLAN2 */ break; \
760 case 5540000: ch = 108; /* HiperLAN2 */ break; \
761 case 5560000: ch = 112; /* HiperLAN2 */ break; \
762 case 5580000: ch = 116; /* HiperLAN2 */ break; \
763 case 5600000: ch = 120; /* HiperLAN2 */ break; \
764 case 5620000: ch = 124; /* HiperLAN2 */ break; \
765 case 5640000: ch = 128; /* HiperLAN2 */ break; \
766 case 5660000: ch = 132; /* HiperLAN2 */ break; \
767 case 5680000: ch = 136; /* HiperLAN2 */ break; \
768 case 5700000: ch = 140; /* HiperLAN2 */ break; \
769 case 5170000: ch = 34; /* Japan MMAC */ break; \
770 case 5190000: ch = 38; /* Japan MMAC */ break; \
771 case 5210000: ch = 42; /* Japan MMAC */ break; \
772 case 5230000: ch = 46; /* Japan MMAC */ break; \
773 case 4920000: ch = 184; /* Japan */ break; \
774 case 4940000: ch = 188; /* Japan */ break; \
775 case 4960000: ch = 192; /* Japan */ break; \
776 case 4980000: ch = 196; /* Japan */ break; \
777 case 5040000: ch = 208; /* Japan, means J08 */ break; \
778 case 5060000: ch = 212; /* Japan, means J12 */ break; \
779 case 5080000: ch = 216; /* Japan, means J16 */ break; \
780 default: ch = 1; break; \
785 // Common fragment list structure - Identical to the scatter gather frag list structure
787 #define NIC_MAX_PHYS_BUF_COUNT 8
789 typedef struct _RTMP_SCATTER_GATHER_ELEMENT {
790 PVOID Address;
791 ULONG Length;
792 PULONG Reserved;
793 } RTMP_SCATTER_GATHER_ELEMENT, *PRTMP_SCATTER_GATHER_ELEMENT;
796 typedef struct _RTMP_SCATTER_GATHER_LIST {
797 ULONG NumberOfElements;
798 PULONG Reserved;
799 RTMP_SCATTER_GATHER_ELEMENT Elements[NIC_MAX_PHYS_BUF_COUNT];
800 } RTMP_SCATTER_GATHER_LIST, *PRTMP_SCATTER_GATHER_LIST;
803 // Some utility macros
805 #ifndef min
806 #define min(_a, _b) (((_a) < (_b)) ? (_a) : (_b))
807 #endif
809 #ifndef max
810 #define max(_a, _b) (((_a) > (_b)) ? (_a) : (_b))
811 #endif
813 #define GET_LNA_GAIN(_pAd) ((_pAd->LatchRfRegs.Channel <= 14) ? (_pAd->BLNAGain) : ((_pAd->LatchRfRegs.Channel <= 64) ? (_pAd->ALNAGain0) : ((_pAd->LatchRfRegs.Channel <= 128) ? (_pAd->ALNAGain1) : (_pAd->ALNAGain2))))
815 #define INC_COUNTER64(Val) (Val.QuadPart++)
817 #define INFRA_ON(_p) (OPSTATUS_TEST_FLAG(_p, fOP_STATUS_INFRA_ON))
818 #define ADHOC_ON(_p) (OPSTATUS_TEST_FLAG(_p, fOP_STATUS_ADHOC_ON))
819 #define MONITOR_ON(_p) (((_p)->StaCfg.BssType) == BSS_MONITOR)
820 #define IDLE_ON(_p) (!INFRA_ON(_p) && !ADHOC_ON(_p))
822 // Check LEAP & CCKM flags
823 #define LEAP_ON(_p) (((_p)->StaCfg.LeapAuthMode) == CISCO_AuthModeLEAP)
824 #define LEAP_CCKM_ON(_p) ((((_p)->StaCfg.LeapAuthMode) == CISCO_AuthModeLEAP) && ((_p)->StaCfg.LeapAuthInfo.CCKM == TRUE))
826 // if orginal Ethernet frame contains no LLC/SNAP, then an extra LLC/SNAP encap is required
827 #define EXTRA_LLCSNAP_ENCAP_FROM_PKT_START(_pBufVA, _pExtraLlcSnapEncap) \
829 if (((*(_pBufVA + 12) << 8) + *(_pBufVA + 13)) > 1500) \
831 _pExtraLlcSnapEncap = SNAP_802_1H; \
832 if (NdisEqualMemory(IPX, _pBufVA + 12, 2) || \
833 NdisEqualMemory(APPLE_TALK, _pBufVA + 12, 2)) \
835 _pExtraLlcSnapEncap = SNAP_BRIDGE_TUNNEL; \
838 else \
840 _pExtraLlcSnapEncap = NULL; \
844 // New Define for new Tx Path.
845 #define EXTRA_LLCSNAP_ENCAP_FROM_PKT_OFFSET(_pBufVA, _pExtraLlcSnapEncap) \
847 if (((*(_pBufVA) << 8) + *(_pBufVA + 1)) > 1500) \
849 _pExtraLlcSnapEncap = SNAP_802_1H; \
850 if (NdisEqualMemory(IPX, _pBufVA, 2) || \
851 NdisEqualMemory(APPLE_TALK, _pBufVA, 2)) \
853 _pExtraLlcSnapEncap = SNAP_BRIDGE_TUNNEL; \
856 else \
858 _pExtraLlcSnapEncap = NULL; \
863 #define MAKE_802_3_HEADER(_p, _pMac1, _pMac2, _pType) \
865 NdisMoveMemory(_p, _pMac1, MAC_ADDR_LEN); \
866 NdisMoveMemory((_p + MAC_ADDR_LEN), _pMac2, MAC_ADDR_LEN); \
867 NdisMoveMemory((_p + MAC_ADDR_LEN * 2), _pType, LENGTH_802_3_TYPE); \
870 // if pData has no LLC/SNAP (neither RFC1042 nor Bridge tunnel), keep it that way.
871 // else if the received frame is LLC/SNAP-encaped IPX or APPLETALK, preserve the LLC/SNAP field
872 // else remove the LLC/SNAP field from the result Ethernet frame
873 // Patch for WHQL only, which did not turn on Netbios but use IPX within its payload
874 // Note:
875 // _pData & _DataSize may be altered (remove 8-byte LLC/SNAP) by this MACRO
876 // _pRemovedLLCSNAP: pointer to removed LLC/SNAP; NULL is not removed
877 #define CONVERT_TO_802_3(_p8023hdr, _pDA, _pSA, _pData, _DataSize, _pRemovedLLCSNAP) \
879 char LLC_Len[2]; \
881 _pRemovedLLCSNAP = NULL; \
882 if (NdisEqualMemory(SNAP_802_1H, _pData, 6) || \
883 NdisEqualMemory(SNAP_BRIDGE_TUNNEL, _pData, 6)) \
885 PUCHAR pProto = _pData + 6; \
887 if ((NdisEqualMemory(IPX, pProto, 2) || NdisEqualMemory(APPLE_TALK, pProto, 2)) && \
888 NdisEqualMemory(SNAP_802_1H, _pData, 6)) \
890 LLC_Len[0] = (UCHAR)(_DataSize / 256); \
891 LLC_Len[1] = (UCHAR)(_DataSize % 256); \
892 MAKE_802_3_HEADER(_p8023hdr, _pDA, _pSA, LLC_Len); \
894 else \
896 MAKE_802_3_HEADER(_p8023hdr, _pDA, _pSA, pProto); \
897 _pRemovedLLCSNAP = _pData; \
898 _DataSize -= LENGTH_802_1_H; \
899 _pData += LENGTH_802_1_H; \
902 else \
904 LLC_Len[0] = (UCHAR)(_DataSize / 256); \
905 LLC_Len[1] = (UCHAR)(_DataSize % 256); \
906 MAKE_802_3_HEADER(_p8023hdr, _pDA, _pSA, LLC_Len); \
910 #define SWITCH_AB( _pAA, _pBB) \
912 PVOID pCC; \
913 pCC = _pBB; \
914 _pBB = _pAA; \
915 _pAA = pCC; \
918 // Enqueue this frame to MLME engine
919 // We need to enqueue the whole frame because MLME need to pass data type
920 // information from 802.11 header
921 #ifdef RT2860
922 #define REPORT_MGMT_FRAME_TO_MLME(_pAd, Wcid, _pFrame, _FrameSize, _Rssi0, _Rssi1, _Rssi2, _PlcpSignal) \
924 UINT32 High32TSF, Low32TSF; \
925 RTMP_IO_READ32(_pAd, TSF_TIMER_DW1, &High32TSF); \
926 RTMP_IO_READ32(_pAd, TSF_TIMER_DW0, &Low32TSF); \
927 MlmeEnqueueForRecv(_pAd, Wcid, High32TSF, Low32TSF, (UCHAR)_Rssi0, (UCHAR)_Rssi1,(UCHAR)_Rssi2,_FrameSize, _pFrame, (UCHAR)_PlcpSignal); \
929 #endif
930 #ifdef RT2870
931 #define REPORT_MGMT_FRAME_TO_MLME(_pAd, Wcid, _pFrame, _FrameSize, _Rssi0, _Rssi1, _Rssi2, _PlcpSignal) \
933 UINT32 High32TSF=0, Low32TSF=0; \
934 MlmeEnqueueForRecv(_pAd, Wcid, High32TSF, Low32TSF, (UCHAR)_Rssi0, (UCHAR)_Rssi1,(UCHAR)_Rssi2,_FrameSize, _pFrame, (UCHAR)_PlcpSignal); \
936 #endif // RT2870 //
938 #ifdef RT30xx
939 //Need to collect each ant's rssi concurrently
940 //rssi1 is report to pair2 Ant and rss2 is reprot to pair1 Ant when 4 Ant
941 #define COLLECT_RX_ANTENNA_AVERAGE_RSSI(_pAd, _rssi1, _rssi2) \
943 SHORT AvgRssi; \
944 UCHAR UsedAnt; \
945 if (_pAd->RxAnt.EvaluatePeriod == 0) \
947 UsedAnt = _pAd->RxAnt.Pair1PrimaryRxAnt; \
948 AvgRssi = _pAd->RxAnt.Pair1AvgRssi[UsedAnt]; \
949 if (AvgRssi < 0) \
950 AvgRssi = AvgRssi - (AvgRssi >> 3) + _rssi1; \
951 else \
952 AvgRssi = _rssi1 << 3; \
953 _pAd->RxAnt.Pair1AvgRssi[UsedAnt] = AvgRssi; \
955 else \
957 UsedAnt = _pAd->RxAnt.Pair1SecondaryRxAnt; \
958 AvgRssi = _pAd->RxAnt.Pair1AvgRssi[UsedAnt]; \
959 if ((AvgRssi < 0) && (_pAd->RxAnt.FirstPktArrivedWhenEvaluate)) \
960 AvgRssi = AvgRssi - (AvgRssi >> 3) + _rssi1; \
961 else \
963 _pAd->RxAnt.FirstPktArrivedWhenEvaluate = TRUE; \
964 AvgRssi = _rssi1 << 3; \
966 _pAd->RxAnt.Pair1AvgRssi[UsedAnt] = AvgRssi; \
967 _pAd->RxAnt.RcvPktNumWhenEvaluate++; \
970 #endif // RT30xx //
973 #define NDIS_QUERY_BUFFER(_NdisBuf, _ppVA, _pBufLen) \
974 NdisQueryBuffer(_NdisBuf, _ppVA, _pBufLen)
976 #define MAC_ADDR_EQUAL(pAddr1,pAddr2) RTMPEqualMemory((PVOID)(pAddr1), (PVOID)(pAddr2), MAC_ADDR_LEN)
977 #define SSID_EQUAL(ssid1, len1, ssid2, len2) ((len1==len2) && (RTMPEqualMemory(ssid1, ssid2, len1)))
980 // Check if it is Japan W53(ch52,56,60,64) channel.
982 #define JapanChannelCheck(channel) ((channel == 52) || (channel == 56) || (channel == 60) || (channel == 64))
984 #ifdef RT2860
985 #define STA_PORT_SECURED(_pAd) \
987 _pAd->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; \
988 RTMP_SET_PSFLAG(_pAd, fRTMP_PS_CAN_GO_SLEEP); \
989 NdisAcquireSpinLock(&(_pAd)->MacTabLock); \
990 _pAd->MacTab.Content[BSSID_WCID].PortSecured = _pAd->StaCfg.PortSecured; \
991 NdisReleaseSpinLock(&(_pAd)->MacTabLock); \
993 #endif
994 #ifdef RT2870
995 #define STA_PORT_SECURED(_pAd) \
997 _pAd->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; \
998 NdisAcquireSpinLock(&_pAd->MacTabLock); \
999 _pAd->MacTab.Content[BSSID_WCID].PortSecured = _pAd->StaCfg.PortSecured; \
1000 NdisReleaseSpinLock(&_pAd->MacTabLock); \
1002 #endif
1005 // Register set pair for initialzation register set definition
1007 typedef struct _RTMP_REG_PAIR
1009 ULONG Register;
1010 ULONG Value;
1011 } RTMP_REG_PAIR, *PRTMP_REG_PAIR;
1013 typedef struct _REG_PAIR
1015 UCHAR Register;
1016 UCHAR Value;
1017 } REG_PAIR, *PREG_PAIR;
1020 // Register set pair for initialzation register set definition
1022 typedef struct _RTMP_RF_REGS
1024 UCHAR Channel;
1025 ULONG R1;
1026 ULONG R2;
1027 ULONG R3;
1028 ULONG R4;
1029 } RTMP_RF_REGS, *PRTMP_RF_REGS;
1031 typedef struct _FREQUENCY_ITEM {
1032 UCHAR Channel;
1033 UCHAR N;
1034 UCHAR R;
1035 UCHAR K;
1036 } FREQUENCY_ITEM, *PFREQUENCY_ITEM;
1039 // Data buffer for DMA operation, the buffer must be contiguous physical memory
1040 // Both DMA to / from CPU use the same structure.
1042 typedef struct _RTMP_DMABUF
1044 ULONG AllocSize;
1045 PVOID AllocVa; // TxBuf virtual address
1046 NDIS_PHYSICAL_ADDRESS AllocPa; // TxBuf physical address
1047 } RTMP_DMABUF, *PRTMP_DMABUF;
1050 typedef union _HEADER_802_11_SEQ{
1051 struct {
1052 USHORT Frag:4;
1053 USHORT Sequence:12;
1054 } field;
1055 USHORT value;
1056 } HEADER_802_11_SEQ, *PHEADER_802_11_SEQ;
1059 // Data buffer for DMA operation, the buffer must be contiguous physical memory
1060 // Both DMA to / from CPU use the same structure.
1062 typedef struct _RTMP_REORDERBUF
1064 BOOLEAN IsFull;
1065 PVOID AllocVa; // TxBuf virtual address
1066 UCHAR Header802_3[14];
1067 HEADER_802_11_SEQ Sequence; //support compressed bitmap BA, so no consider fragment in BA
1068 UCHAR DataOffset;
1069 USHORT Datasize;
1070 ULONG AllocSize;
1071 #ifdef RT2860
1072 NDIS_PHYSICAL_ADDRESS AllocPa; // TxBuf physical address
1073 #endif
1074 #ifdef RT2870
1075 PUCHAR AllocPa;
1076 #endif // RT2870 //
1077 } RTMP_REORDERBUF, *PRTMP_REORDERBUF;
1080 // Control block (Descriptor) for all ring descriptor DMA operation, buffer must be
1081 // contiguous physical memory. NDIS_PACKET stored the binding Rx packet descriptor
1082 // which won't be released, driver has to wait until upper layer return the packet
1083 // before giveing up this rx ring descriptor to ASIC. NDIS_BUFFER is assocaited pair
1084 // to describe the packet buffer. For Tx, NDIS_PACKET stored the tx packet descriptor
1085 // which driver should ACK upper layer when the tx is physically done or failed.
1087 typedef struct _RTMP_DMACB
1089 ULONG AllocSize; // Control block size
1090 PVOID AllocVa; // Control block virtual address
1091 NDIS_PHYSICAL_ADDRESS AllocPa; // Control block physical address
1092 PNDIS_PACKET pNdisPacket;
1093 PNDIS_PACKET pNextNdisPacket;
1095 RTMP_DMABUF DmaBuf; // Associated DMA buffer structure
1096 } RTMP_DMACB, *PRTMP_DMACB;
1098 typedef struct _RTMP_TX_BUF
1100 PQUEUE_ENTRY Next;
1101 UCHAR Index;
1102 ULONG AllocSize; // Control block size
1103 PVOID AllocVa; // Control block virtual address
1104 NDIS_PHYSICAL_ADDRESS AllocPa; // Control block physical address
1105 } RTMP_TXBUF, *PRTMP_TXBUF;
1107 typedef struct _RTMP_RX_BUF
1109 BOOLEAN InUse;
1110 ULONG ByBaRecIndex;
1111 RTMP_REORDERBUF MAP_RXBuf[MAX_RX_REORDERBUF];
1112 } RTMP_RXBUF, *PRTMP_RXBUF;
1113 typedef struct _RTMP_TX_RING
1115 RTMP_DMACB Cell[TX_RING_SIZE];
1116 UINT32 TxCpuIdx;
1117 UINT32 TxDmaIdx;
1118 UINT32 TxSwFreeIdx; // software next free tx index
1119 } RTMP_TX_RING, *PRTMP_TX_RING;
1121 typedef struct _RTMP_RX_RING
1123 RTMP_DMACB Cell[RX_RING_SIZE];
1124 UINT32 RxCpuIdx;
1125 UINT32 RxDmaIdx;
1126 INT32 RxSwReadIdx; // software next read index
1127 } RTMP_RX_RING, *PRTMP_RX_RING;
1129 typedef struct _RTMP_MGMT_RING
1131 RTMP_DMACB Cell[MGMT_RING_SIZE];
1132 UINT32 TxCpuIdx;
1133 UINT32 TxDmaIdx;
1134 UINT32 TxSwFreeIdx; // software next free tx index
1135 } RTMP_MGMT_RING, *PRTMP_MGMT_RING;
1138 // Statistic counter structure
1140 typedef struct _COUNTER_802_3
1142 // General Stats
1143 ULONG GoodTransmits;
1144 ULONG GoodReceives;
1145 ULONG TxErrors;
1146 ULONG RxErrors;
1147 ULONG RxNoBuffer;
1149 // Ethernet Stats
1150 ULONG RcvAlignmentErrors;
1151 ULONG OneCollision;
1152 ULONG MoreCollisions;
1154 } COUNTER_802_3, *PCOUNTER_802_3;
1156 typedef struct _COUNTER_802_11 {
1157 ULONG Length;
1158 LARGE_INTEGER LastTransmittedFragmentCount;
1159 LARGE_INTEGER TransmittedFragmentCount;
1160 LARGE_INTEGER MulticastTransmittedFrameCount;
1161 LARGE_INTEGER FailedCount;
1162 LARGE_INTEGER RetryCount;
1163 LARGE_INTEGER MultipleRetryCount;
1164 LARGE_INTEGER RTSSuccessCount;
1165 LARGE_INTEGER RTSFailureCount;
1166 LARGE_INTEGER ACKFailureCount;
1167 LARGE_INTEGER FrameDuplicateCount;
1168 LARGE_INTEGER ReceivedFragmentCount;
1169 LARGE_INTEGER MulticastReceivedFrameCount;
1170 LARGE_INTEGER FCSErrorCount;
1171 } COUNTER_802_11, *PCOUNTER_802_11;
1173 typedef struct _COUNTER_RALINK {
1174 ULONG TransmittedByteCount; // both successful and failure, used to calculate TX throughput
1175 #ifdef RT2860
1176 ULONG LastReceivedByteCount;
1177 #endif
1178 ULONG ReceivedByteCount; // both CRC okay and CRC error, used to calculate RX throughput
1179 ULONG BeenDisassociatedCount;
1180 ULONG BadCQIAutoRecoveryCount;
1181 ULONG PoorCQIRoamingCount;
1182 ULONG MgmtRingFullCount;
1183 ULONG RxCountSinceLastNULL;
1184 ULONG RxCount;
1185 ULONG RxRingErrCount;
1186 ULONG KickTxCount;
1187 ULONG TxRingErrCount;
1188 LARGE_INTEGER RealFcsErrCount;
1189 ULONG PendingNdisPacketCount;
1191 ULONG OneSecOsTxCount[NUM_OF_TX_RING];
1192 ULONG OneSecDmaDoneCount[NUM_OF_TX_RING];
1193 UINT32 OneSecTxDoneCount;
1194 ULONG OneSecRxCount;
1195 UINT32 OneSecTxAggregationCount;
1196 UINT32 OneSecRxAggregationCount;
1198 UINT32 OneSecFrameDuplicateCount;
1200 #ifdef RT2870
1201 ULONG OneSecTransmittedByteCount; // both successful and failure, used to calculate TX throughput
1202 #endif // RT2870 //
1204 UINT32 OneSecTxNoRetryOkCount;
1205 UINT32 OneSecTxRetryOkCount;
1206 UINT32 OneSecTxFailCount;
1207 UINT32 OneSecFalseCCACnt; // CCA error count, for debug purpose, might move to global counter
1208 UINT32 OneSecRxOkCnt; // RX without error
1209 UINT32 OneSecRxOkDataCnt; // unicast-to-me DATA frame count
1210 UINT32 OneSecRxFcsErrCnt; // CRC error
1211 UINT32 OneSecBeaconSentCnt;
1212 UINT32 LastOneSecTotalTxCount; // OneSecTxNoRetryOkCount + OneSecTxRetryOkCount + OneSecTxFailCount
1213 UINT32 LastOneSecRxOkDataCnt; // OneSecRxOkDataCnt
1214 ULONG DuplicateRcv;
1215 ULONG TxAggCount;
1216 ULONG TxNonAggCount;
1217 ULONG TxAgg1MPDUCount;
1218 ULONG TxAgg2MPDUCount;
1219 ULONG TxAgg3MPDUCount;
1220 ULONG TxAgg4MPDUCount;
1221 ULONG TxAgg5MPDUCount;
1222 ULONG TxAgg6MPDUCount;
1223 ULONG TxAgg7MPDUCount;
1224 ULONG TxAgg8MPDUCount;
1225 ULONG TxAgg9MPDUCount;
1226 ULONG TxAgg10MPDUCount;
1227 ULONG TxAgg11MPDUCount;
1228 ULONG TxAgg12MPDUCount;
1229 ULONG TxAgg13MPDUCount;
1230 ULONG TxAgg14MPDUCount;
1231 ULONG TxAgg15MPDUCount;
1232 ULONG TxAgg16MPDUCount;
1234 LARGE_INTEGER TransmittedOctetsInAMSDU;
1235 LARGE_INTEGER TransmittedAMSDUCount;
1236 LARGE_INTEGER ReceivedOctesInAMSDUCount;
1237 LARGE_INTEGER ReceivedAMSDUCount;
1238 LARGE_INTEGER TransmittedAMPDUCount;
1239 LARGE_INTEGER TransmittedMPDUsInAMPDUCount;
1240 LARGE_INTEGER TransmittedOctetsInAMPDUCount;
1241 LARGE_INTEGER MPDUInReceivedAMPDUCount;
1242 } COUNTER_RALINK, *PCOUNTER_RALINK;
1244 typedef struct _PID_COUNTER {
1245 ULONG TxAckRequiredCount; // CRC error
1246 ULONG TxAggreCount;
1247 ULONG TxSuccessCount; // OneSecTxNoRetryOkCount + OneSecTxRetryOkCount + OneSecTxFailCount
1248 ULONG LastSuccessRate;
1249 } PID_COUNTER, *PPID_COUNTER;
1251 typedef struct _COUNTER_DRS {
1252 // to record the each TX rate's quality. 0 is best, the bigger the worse.
1253 USHORT TxQuality[MAX_STEP_OF_TX_RATE_SWITCH];
1254 UCHAR PER[MAX_STEP_OF_TX_RATE_SWITCH];
1255 UCHAR TxRateUpPenalty; // extra # of second penalty due to last unstable condition
1256 ULONG CurrTxRateStableTime; // # of second in current TX rate
1257 BOOLEAN fNoisyEnvironment;
1258 BOOLEAN fLastSecAccordingRSSI;
1259 UCHAR LastSecTxRateChangeAction; // 0: no change, 1:rate UP, 2:rate down
1260 UCHAR LastTimeTxRateChangeAction; //Keep last time value of LastSecTxRateChangeAction
1261 ULONG LastTxOkCount;
1262 } COUNTER_DRS, *PCOUNTER_DRS;
1265 // Arcfour Structure Added by PaulWu
1267 typedef struct _ARCFOUR
1269 UINT X;
1270 UINT Y;
1271 UCHAR STATE[256];
1272 } ARCFOURCONTEXT, *PARCFOURCONTEXT;
1274 // MIMO Tx parameter, ShortGI, MCS, STBC, etc. these are fields in TXWI too. just copy to TXWI.
1275 typedef struct _RECEIVE_SETTING {
1276 USHORT NumOfRX:2; // MIMO. WE HAVE 3R
1277 USHORT Mode:2; //channel bandwidth 20MHz or 40 MHz
1278 USHORT ShortGI:1;
1279 USHORT STBC:2; //SPACE
1280 USHORT rsv:3;
1281 USHORT OFDM:1;
1282 USHORT MIMO:1;
1283 } RECEIVE_SETTING, *PRECEIVE_SETTING;
1285 // Shared key data structure
1286 typedef struct _WEP_KEY {
1287 UCHAR KeyLen; // Key length for each key, 0: entry is invalid
1288 UCHAR Key[MAX_LEN_OF_KEY]; // right now we implement 4 keys, 128 bits max
1289 } WEP_KEY, *PWEP_KEY;
1291 typedef struct _CIPHER_KEY {
1292 UCHAR Key[16]; // right now we implement 4 keys, 128 bits max
1293 UCHAR RxMic[8]; // make alignment
1294 UCHAR TxMic[8];
1295 UCHAR TxTsc[6]; // 48bit TSC value
1296 UCHAR RxTsc[6]; // 48bit TSC value
1297 UCHAR CipherAlg; // 0-none, 1:WEP64, 2:WEP128, 3:TKIP, 4:AES, 5:CKIP64, 6:CKIP128
1298 UCHAR KeyLen;
1299 UCHAR BssId[6];
1300 // Key length for each key, 0: entry is invalid
1301 UCHAR Type; // Indicate Pairwise/Group when reporting MIC error
1302 } CIPHER_KEY, *PCIPHER_KEY;
1304 typedef struct _BBP_TUNING_STRUCT {
1305 BOOLEAN Enable;
1306 UCHAR FalseCcaCountUpperBound; // 100 per sec
1307 UCHAR FalseCcaCountLowerBound; // 10 per sec
1308 UCHAR R17LowerBound; // specified in E2PROM
1309 UCHAR R17UpperBound; // 0x68 according to David Tung
1310 UCHAR CurrentR17Value;
1311 } BBP_TUNING, *PBBP_TUNING;
1313 typedef struct _SOFT_RX_ANT_DIVERSITY_STRUCT {
1314 UCHAR EvaluatePeriod; // 0:not evalute status, 1: evaluate status, 2: switching status
1315 #ifdef RT30xx
1316 UCHAR EvaluateStableCnt;
1317 #endif
1318 UCHAR Pair1PrimaryRxAnt; // 0:Ant-E1, 1:Ant-E2
1319 UCHAR Pair1SecondaryRxAnt; // 0:Ant-E1, 1:Ant-E2
1320 UCHAR Pair2PrimaryRxAnt; // 0:Ant-E3, 1:Ant-E4
1321 UCHAR Pair2SecondaryRxAnt; // 0:Ant-E3, 1:Ant-E4
1322 SHORT Pair1AvgRssi[2]; // AvgRssi[0]:E1, AvgRssi[1]:E2
1323 SHORT Pair2AvgRssi[2]; // AvgRssi[0]:E3, AvgRssi[1]:E4
1324 SHORT Pair1LastAvgRssi; //
1325 SHORT Pair2LastAvgRssi; //
1326 ULONG RcvPktNumWhenEvaluate;
1327 BOOLEAN FirstPktArrivedWhenEvaluate;
1328 RALINK_TIMER_STRUCT RxAntDiversityTimer;
1329 } SOFT_RX_ANT_DIVERSITY, *PSOFT_RX_ANT_DIVERSITY;
1331 typedef struct _LEAP_AUTH_INFO {
1332 BOOLEAN Enabled; //Ture: Enable LEAP Authentication
1333 BOOLEAN CCKM; //Ture: Use Fast Reauthentication with CCKM
1334 UCHAR Reserve[2];
1335 UCHAR UserName[256]; //LEAP, User name
1336 ULONG UserNameLen;
1337 UCHAR Password[256]; //LEAP, User Password
1338 ULONG PasswordLen;
1339 } LEAP_AUTH_INFO, *PLEAP_AUTH_INFO;
1341 typedef struct {
1342 UCHAR Addr[MAC_ADDR_LEN];
1343 UCHAR ErrorCode[2]; //00 01-Invalid authentication type
1344 //00 02-Authentication timeout
1345 //00 03-Challenge from AP failed
1346 //00 04-Challenge to AP failed
1347 BOOLEAN Reported;
1348 } ROGUEAP_ENTRY, *PROGUEAP_ENTRY;
1350 typedef struct {
1351 UCHAR RogueApNr;
1352 ROGUEAP_ENTRY RogueApEntry[MAX_LEN_OF_BSS_TABLE];
1353 } ROGUEAP_TABLE, *PROGUEAP_TABLE;
1355 typedef struct {
1356 BOOLEAN Enable;
1357 UCHAR Delta;
1358 BOOLEAN PlusSign;
1359 } CCK_TX_POWER_CALIBRATE, *PCCK_TX_POWER_CALIBRATE;
1362 // Receive Tuple Cache Format
1364 typedef struct _TUPLE_CACHE {
1365 BOOLEAN Valid;
1366 UCHAR MacAddress[MAC_ADDR_LEN];
1367 USHORT Sequence;
1368 USHORT Frag;
1369 } TUPLE_CACHE, *PTUPLE_CACHE;
1372 // Fragment Frame structure
1374 typedef struct _FRAGMENT_FRAME {
1375 PNDIS_PACKET pFragPacket;
1376 ULONG RxSize;
1377 USHORT Sequence;
1378 USHORT LastFrag;
1379 ULONG Flags; // Some extra frame information. bit 0: LLC presented
1380 } FRAGMENT_FRAME, *PFRAGMENT_FRAME;
1384 // Packet information for NdisQueryPacket
1386 typedef struct _PACKET_INFO {
1387 UINT PhysicalBufferCount; // Physical breaks of buffer descripor chained
1388 UINT BufferCount ; // Number of Buffer descriptor chained
1389 UINT TotalPacketLength ; // Self explained
1390 PNDIS_BUFFER pFirstBuffer; // Pointer to first buffer descriptor
1391 } PACKET_INFO, *PPACKET_INFO;
1394 // Tkip Key structure which RC4 key & MIC calculation
1396 typedef struct _TKIP_KEY_INFO {
1397 UINT nBytesInM; // # bytes in M for MICKEY
1398 ULONG IV16;
1399 ULONG IV32;
1400 ULONG K0; // for MICKEY Low
1401 ULONG K1; // for MICKEY Hig
1402 ULONG L; // Current state for MICKEY
1403 ULONG R; // Current state for MICKEY
1404 ULONG M; // Message accumulator for MICKEY
1405 UCHAR RC4KEY[16];
1406 UCHAR MIC[8];
1407 } TKIP_KEY_INFO, *PTKIP_KEY_INFO;
1410 // Private / Misc data, counters for driver internal use
1412 typedef struct __PRIVATE_STRUC {
1413 UINT SystemResetCnt; // System reset counter
1414 UINT TxRingFullCnt; // Tx ring full occurrance number
1415 UINT PhyRxErrCnt; // PHY Rx error count, for debug purpose, might move to global counter
1416 // Variables for WEP encryption / decryption in rtmp_wep.c
1417 UINT FCSCRC32;
1418 ARCFOURCONTEXT WEPCONTEXT;
1419 // Tkip stuff
1420 TKIP_KEY_INFO Tx;
1421 TKIP_KEY_INFO Rx;
1422 } PRIVATE_STRUC, *PPRIVATE_STRUC;
1424 // structure to tune BBP R66 (BBP TUNING)
1425 typedef struct _BBP_R66_TUNING {
1426 BOOLEAN bEnable;
1427 USHORT FalseCcaLowerThreshold; // default 100
1428 USHORT FalseCcaUpperThreshold; // default 512
1429 UCHAR R66Delta;
1430 UCHAR R66CurrentValue;
1431 BOOLEAN R66LowerUpperSelect; //Before LinkUp, Used LowerBound or UpperBound as R66 value.
1432 } BBP_R66_TUNING, *PBBP_R66_TUNING;
1434 // structure to store channel TX power
1435 typedef struct _CHANNEL_TX_POWER {
1436 USHORT RemainingTimeForUse; //unit: sec
1437 UCHAR Channel;
1438 CHAR Power;
1439 CHAR Power2;
1440 UCHAR MaxTxPwr;
1441 UCHAR DfsReq;
1442 } CHANNEL_TX_POWER, *PCHANNEL_TX_POWER;
1444 // structure to store 802.11j channel TX power
1445 typedef struct _CHANNEL_11J_TX_POWER {
1446 UCHAR Channel;
1447 UCHAR BW; // BW_10 or BW_20
1448 CHAR Power;
1449 CHAR Power2;
1450 USHORT RemainingTimeForUse; //unit: sec
1451 } CHANNEL_11J_TX_POWER, *PCHANNEL_11J_TX_POWER;
1453 typedef enum _ABGBAND_STATE_ {
1454 UNKNOWN_BAND,
1455 BG_BAND,
1456 A_BAND,
1457 } ABGBAND_STATE;
1459 typedef struct _MLME_STRUCT {
1460 // STA state machines
1461 STATE_MACHINE CntlMachine;
1462 STATE_MACHINE AssocMachine;
1463 STATE_MACHINE AuthMachine;
1464 STATE_MACHINE AuthRspMachine;
1465 STATE_MACHINE SyncMachine;
1466 STATE_MACHINE WpaPskMachine;
1467 STATE_MACHINE LeapMachine;
1468 STATE_MACHINE AironetMachine;
1469 STATE_MACHINE_FUNC AssocFunc[ASSOC_FUNC_SIZE];
1470 STATE_MACHINE_FUNC AuthFunc[AUTH_FUNC_SIZE];
1471 STATE_MACHINE_FUNC AuthRspFunc[AUTH_RSP_FUNC_SIZE];
1472 STATE_MACHINE_FUNC SyncFunc[SYNC_FUNC_SIZE];
1473 STATE_MACHINE_FUNC WpaPskFunc[WPA_PSK_FUNC_SIZE];
1474 STATE_MACHINE_FUNC AironetFunc[AIRONET_FUNC_SIZE];
1475 STATE_MACHINE_FUNC ActFunc[ACT_FUNC_SIZE];
1476 // Action
1477 STATE_MACHINE ActMachine;
1479 ULONG ChannelQuality; // 0..100, Channel Quality Indication for Roaming
1480 ULONG Now32; // latch the value of NdisGetSystemUpTime()
1481 ULONG LastSendNULLpsmTime;
1483 BOOLEAN bRunning;
1484 NDIS_SPIN_LOCK TaskLock;
1485 MLME_QUEUE Queue;
1487 UINT ShiftReg;
1489 RALINK_TIMER_STRUCT PeriodicTimer;
1490 RALINK_TIMER_STRUCT APSDPeriodicTimer;
1491 RALINK_TIMER_STRUCT LinkDownTimer;
1492 RALINK_TIMER_STRUCT LinkUpTimer;
1493 #ifdef RT2860
1494 UCHAR bPsPollTimerRunning;
1495 RALINK_TIMER_STRUCT PsPollTimer;
1496 RALINK_TIMER_STRUCT RadioOnOffTimer;
1497 #endif
1498 ULONG PeriodicRound;
1499 ULONG OneSecPeriodicRound;
1501 UCHAR RealRxPath;
1502 BOOLEAN bLowThroughput;
1503 BOOLEAN bEnableAutoAntennaCheck;
1504 RALINK_TIMER_STRUCT RxAntEvalTimer;
1506 #ifdef RT2870
1507 UCHAR CaliBW40RfR24;
1508 UCHAR CaliBW20RfR24;
1509 #endif // RT2870 //
1510 } MLME_STRUCT, *PMLME_STRUCT;
1512 // structure for radar detection and channel switch
1513 typedef struct _RADAR_DETECT_STRUCT {
1514 UCHAR CSCount; //Channel switch counter
1515 UCHAR CSPeriod; //Channel switch period (beacon count)
1516 UCHAR RDCount; //Radar detection counter
1517 UCHAR RDMode; //Radar Detection mode
1518 UCHAR RDDurRegion; //Radar detection duration region
1519 UCHAR BBPR16;
1520 UCHAR BBPR17;
1521 UCHAR BBPR18;
1522 UCHAR BBPR21;
1523 UCHAR BBPR22;
1524 UCHAR BBPR64;
1525 ULONG InServiceMonitorCount; // unit: sec
1526 UINT8 DfsSessionTime;
1527 BOOLEAN bFastDfs;
1528 UINT8 ChMovingTime;
1529 UINT8 LongPulseRadarTh;
1530 } RADAR_DETECT_STRUCT, *PRADAR_DETECT_STRUCT;
1532 typedef enum _REC_BLOCKACK_STATUS
1534 Recipient_NONE=0,
1535 Recipient_USED,
1536 Recipient_HandleRes,
1537 Recipient_Accept
1538 } REC_BLOCKACK_STATUS, *PREC_BLOCKACK_STATUS;
1540 typedef enum _ORI_BLOCKACK_STATUS
1542 Originator_NONE=0,
1543 Originator_USED,
1544 Originator_WaitRes,
1545 Originator_Done
1546 } ORI_BLOCKACK_STATUS, *PORI_BLOCKACK_STATUS;
1548 typedef struct _BA_ORI_ENTRY{
1549 UCHAR Wcid;
1550 UCHAR TID;
1551 UCHAR BAWinSize;
1552 UCHAR Token;
1553 // Sequence is to fill every outgoing QoS DATA frame's sequence field in 802.11 header.
1554 USHORT Sequence;
1555 USHORT TimeOutValue;
1556 ORI_BLOCKACK_STATUS ORI_BA_Status;
1557 RALINK_TIMER_STRUCT ORIBATimer;
1558 PVOID pAdapter;
1559 } BA_ORI_ENTRY, *PBA_ORI_ENTRY;
1561 typedef struct _BA_REC_ENTRY {
1562 UCHAR Wcid;
1563 UCHAR TID;
1564 UCHAR BAWinSize; // 7.3.1.14. each buffer is capable of holding a max AMSDU or MSDU.
1565 USHORT LastIndSeq;
1566 USHORT TimeOutValue;
1567 RALINK_TIMER_STRUCT RECBATimer;
1568 ULONG LastIndSeqAtTimer;
1569 ULONG nDropPacket;
1570 ULONG rcvSeq;
1571 REC_BLOCKACK_STATUS REC_BA_Status;
1572 NDIS_SPIN_LOCK RxReRingLock; // Rx Ring spinlock
1573 PVOID pAdapter;
1574 struct reordering_list list;
1575 } BA_REC_ENTRY, *PBA_REC_ENTRY;
1578 typedef struct {
1579 ULONG numAsRecipient; // I am recipient of numAsRecipient clients. These client are in the BARecEntry[]
1580 ULONG numAsOriginator; // I am originator of numAsOriginator clients. These clients are in the BAOriEntry[]
1581 BA_ORI_ENTRY BAOriEntry[MAX_LEN_OF_BA_ORI_TABLE];
1582 BA_REC_ENTRY BARecEntry[MAX_LEN_OF_BA_REC_TABLE];
1583 } BA_TABLE, *PBA_TABLE;
1585 //For QureyBATableOID use;
1586 typedef struct PACKED _OID_BA_REC_ENTRY{
1587 UCHAR MACAddr[MAC_ADDR_LEN];
1588 UCHAR BaBitmap; // if (BaBitmap&(1<<TID)), this session with{MACAddr, TID}exists, so read BufSize[TID] for BufferSize
1589 UCHAR rsv;
1590 UCHAR BufSize[8];
1591 REC_BLOCKACK_STATUS REC_BA_Status[8];
1592 } OID_BA_REC_ENTRY, *POID_BA_REC_ENTRY;
1594 //For QureyBATableOID use;
1595 typedef struct PACKED _OID_BA_ORI_ENTRY{
1596 UCHAR MACAddr[MAC_ADDR_LEN];
1597 UCHAR BaBitmap; // if (BaBitmap&(1<<TID)), this session with{MACAddr, TID}exists, so read BufSize[TID] for BufferSize, read ORI_BA_Status[TID] for status
1598 UCHAR rsv;
1599 UCHAR BufSize[8];
1600 ORI_BLOCKACK_STATUS ORI_BA_Status[8];
1601 } OID_BA_ORI_ENTRY, *POID_BA_ORI_ENTRY;
1603 typedef struct _QUERYBA_TABLE{
1604 OID_BA_ORI_ENTRY BAOriEntry[32];
1605 OID_BA_REC_ENTRY BARecEntry[32];
1606 UCHAR OriNum;// Number of below BAOriEntry
1607 UCHAR RecNum;// Number of below BARecEntry
1608 } QUERYBA_TABLE, *PQUERYBA_TABLE;
1610 typedef union _BACAP_STRUC {
1611 struct {
1612 UINT32 RxBAWinLimit:8;
1613 UINT32 TxBAWinLimit:8;
1614 UINT32 AutoBA:1; // automatically BA
1615 UINT32 Policy:2; // 0: DELAY_BA 1:IMMED_BA (//BA Policy subfiled value in ADDBA frame) 2:BA-not use
1616 UINT32 MpduDensity:3;
1617 UINT32 AmsduEnable:1; //Enable AMSDU transmisstion
1618 UINT32 AmsduSize:1; // 0:3839, 1:7935 bytes. UINT MSDUSizeToBytes[] = { 3839, 7935};
1619 UINT32 MMPSmode:2; // MIMO power save more, 0:static, 1:dynamic, 2:rsv, 3:mimo enable
1620 UINT32 bHtAdhoc:1; // adhoc can use ht rate.
1621 UINT32 b2040CoexistScanSup:1; //As Sta, support do 2040 coexistence scan for AP. As Ap, support monitor trigger event to check if can use BW 40MHz.
1622 UINT32 :4;
1623 } field;
1624 UINT32 word;
1625 } BACAP_STRUC, *PBACAP_STRUC;
1627 //This structure is for all 802.11n card InterOptibilityTest action. Reset all Num every n second. (Details see MLMEPeriodic)
1628 typedef struct _IOT_STRUC {
1629 UCHAR Threshold[2];
1630 UCHAR ReorderTimeOutNum[MAX_LEN_OF_BA_REC_TABLE]; // compare with threshold[0]
1631 UCHAR RefreshNum[MAX_LEN_OF_BA_REC_TABLE]; // compare with threshold[1]
1632 ULONG OneSecInWindowCount;
1633 ULONG OneSecFrameDuplicateCount;
1634 ULONG OneSecOutWindowCount;
1635 UCHAR DelOriAct;
1636 UCHAR DelRecAct;
1637 UCHAR RTSShortProt;
1638 UCHAR RTSLongProt;
1639 BOOLEAN bRTSLongProtOn;
1640 BOOLEAN bLastAtheros;
1641 BOOLEAN bCurrentAtheros;
1642 BOOLEAN bNowAtherosBurstOn;
1643 BOOLEAN bNextDisableRxBA;
1644 BOOLEAN bToggle;
1645 } IOT_STRUC, *PIOT_STRUC;
1647 // This is the registry setting for 802.11n transmit setting. Used in advanced page.
1648 typedef union _REG_TRANSMIT_SETTING {
1649 struct {
1650 UINT32 rsv0:10;
1651 UINT32 TxBF:1;
1652 UINT32 BW:1; //channel bandwidth 20MHz or 40 MHz
1653 UINT32 ShortGI:1;
1654 UINT32 STBC:1; //SPACE
1655 UINT32 TRANSNO:2;
1656 UINT32 HTMODE:1;
1657 UINT32 EXTCHA:2;
1658 UINT32 rsv:13;
1659 } field;
1660 UINT32 word;
1661 } REG_TRANSMIT_SETTING, *PREG_TRANSMIT_SETTING;
1663 typedef union _DESIRED_TRANSMIT_SETTING {
1664 struct {
1665 USHORT MCS:7; // MCS
1666 USHORT PhyMode:4;
1667 USHORT FixedTxMode:2; // If MCS isn't AUTO, fix rate in CCK, OFDM or HT mode.
1668 USHORT rsv:3;
1669 } field;
1670 USHORT word;
1671 } DESIRED_TRANSMIT_SETTING, *PDESIRED_TRANSMIT_SETTING;
1673 typedef struct {
1674 BOOLEAN IsRecipient;
1675 UCHAR MACAddr[MAC_ADDR_LEN];
1676 UCHAR TID;
1677 UCHAR nMSDU;
1678 USHORT TimeOut;
1679 BOOLEAN bAllTid; // If True, delete all TID for BA sessions with this MACaddr.
1680 } OID_ADD_BA_ENTRY, *POID_ADD_BA_ENTRY;
1683 // Multiple SSID structure
1685 #define WLAN_MAX_NUM_OF_TIM ((MAX_LEN_OF_MAC_TABLE >> 3) + 1) /* /8 + 1 */
1686 #define WLAN_CT_TIM_BCMC_OFFSET 0 /* unit: 32B */
1688 /* clear bcmc TIM bit */
1689 #define WLAN_MR_TIM_BCMC_CLEAR(apidx) \
1690 pAd->ApCfg.MBSSID[apidx].TimBitmaps[WLAN_CT_TIM_BCMC_OFFSET] &= ~BIT8[0];
1692 /* set bcmc TIM bit */
1693 #define WLAN_MR_TIM_BCMC_SET(apidx) \
1694 pAd->ApCfg.MBSSID[apidx].TimBitmaps[WLAN_CT_TIM_BCMC_OFFSET] |= BIT8[0];
1696 /* clear a station PS TIM bit */
1697 #define WLAN_MR_TIM_BIT_CLEAR(ad_p, apidx, wcid) \
1698 { UCHAR tim_offset = wcid >> 3; \
1699 UCHAR bit_offset = wcid & 0x7; \
1700 ad_p->ApCfg.MBSSID[apidx].TimBitmaps[tim_offset] &= (~BIT8[bit_offset]); }
1702 /* set a station PS TIM bit */
1703 #define WLAN_MR_TIM_BIT_SET(ad_p, apidx, wcid) \
1704 { UCHAR tim_offset = wcid >> 3; \
1705 UCHAR bit_offset = wcid & 0x7; \
1706 ad_p->ApCfg.MBSSID[apidx].TimBitmaps[tim_offset] |= BIT8[bit_offset]; }
1708 #ifdef RT2870
1709 #define BEACON_BITMAP_MASK 0xff
1710 typedef struct _BEACON_SYNC_STRUCT_
1712 UCHAR BeaconBuf[HW_BEACON_MAX_COUNT][HW_BEACON_OFFSET];
1713 UCHAR BeaconTxWI[HW_BEACON_MAX_COUNT][TXWI_SIZE];
1714 ULONG TimIELocationInBeacon[HW_BEACON_MAX_COUNT];
1715 ULONG CapabilityInfoLocationInBeacon[HW_BEACON_MAX_COUNT];
1716 BOOLEAN EnableBeacon; // trigger to enable beacon transmission.
1717 UCHAR BeaconBitMap; // NOTE: If the MAX_MBSSID_NUM is larger than 8, this parameter need to change.
1718 UCHAR DtimBitOn; // NOTE: If the MAX_MBSSID_NUM is larger than 8, this parameter need to change.
1719 }BEACON_SYNC_STRUCT;
1720 #endif // RT2870 //
1722 typedef struct _MULTISSID_STRUCT {
1723 UCHAR Bssid[MAC_ADDR_LEN];
1724 UCHAR SsidLen;
1725 CHAR Ssid[MAX_LEN_OF_SSID];
1726 USHORT CapabilityInfo;
1728 PNET_DEV MSSIDDev;
1730 NDIS_802_11_AUTHENTICATION_MODE AuthMode;
1731 NDIS_802_11_WEP_STATUS WepStatus;
1732 NDIS_802_11_WEP_STATUS GroupKeyWepStatus;
1733 WPA_MIX_PAIR_CIPHER WpaMixPairCipher;
1735 ULONG TxCount;
1736 ULONG RxCount;
1737 ULONG ReceivedByteCount;
1738 ULONG TransmittedByteCount;
1739 ULONG RxErrorCount;
1740 ULONG RxDropCount;
1742 HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode;// For transmit phy setting in TXWI.
1743 RT_HT_PHY_INFO DesiredHtPhyInfo;
1744 DESIRED_TRANSMIT_SETTING DesiredTransmitSetting; // Desired transmit setting. this is for reading registry setting only. not useful.
1745 BOOLEAN bAutoTxRateSwitch;
1747 UCHAR DefaultKeyId;
1749 UCHAR TxRate; // RATE_1, RATE_2, RATE_5_5, RATE_11, ...
1750 UCHAR DesiredRates[MAX_LEN_OF_SUPPORTED_RATES];// OID_802_11_DESIRED_RATES
1751 UCHAR DesiredRatesIndex;
1752 UCHAR MaxTxRate; // RATE_1, RATE_2, RATE_5_5, RATE_11
1754 UCHAR TimBitmaps[WLAN_MAX_NUM_OF_TIM];
1756 // WPA
1757 UCHAR GMK[32];
1758 UCHAR PMK[32];
1759 UCHAR GTK[32];
1760 BOOLEAN IEEE8021X;
1761 BOOLEAN PreAuth;
1762 UCHAR GNonce[32];
1763 UCHAR PortSecured;
1764 NDIS_802_11_PRIVACY_FILTER PrivacyFilter;
1765 UCHAR BANClass3Data;
1766 ULONG IsolateInterStaTraffic;
1768 UCHAR RSNIE_Len[2];
1769 UCHAR RSN_IE[2][MAX_LEN_OF_RSNIE];
1772 UCHAR TimIELocationInBeacon;
1773 UCHAR CapabilityInfoLocationInBeacon;
1774 // outgoing BEACON frame buffer and corresponding TXWI
1775 // PTXWI_STRUC BeaconTxWI; //
1776 CHAR BeaconBuf[MAX_BEACON_SIZE]; // NOTE: BeaconBuf should be 4-byte aligned
1778 BOOLEAN bHideSsid;
1779 UINT16 StationKeepAliveTime; // unit: second
1781 USHORT VLAN_VID;
1782 USHORT VLAN_Priority;
1784 RT_802_11_ACL AccessControlList;
1786 // EDCA Qos
1787 BOOLEAN bWmmCapable; // 0:disable WMM, 1:enable WMM
1788 BOOLEAN bDLSCapable; // 0:disable DLS, 1:enable DLS
1790 UCHAR DlsPTK[64]; // Due to windows dirver count on meetinghouse to handle 4-way shake
1792 // For 802.1x daemon setting per BSS
1793 UCHAR radius_srv_num;
1794 RADIUS_SRV_INFO radius_srv_info[MAX_RADIUS_SRV_NUM];
1796 #ifdef RTL865X_SOC
1797 unsigned int mylinkid;
1798 #endif
1801 UINT32 RcvdConflictSsidCount;
1802 UINT32 RcvdSpoofedAssocRespCount;
1803 UINT32 RcvdSpoofedReassocRespCount;
1804 UINT32 RcvdSpoofedProbeRespCount;
1805 UINT32 RcvdSpoofedBeaconCount;
1806 UINT32 RcvdSpoofedDisassocCount;
1807 UINT32 RcvdSpoofedAuthCount;
1808 UINT32 RcvdSpoofedDeauthCount;
1809 UINT32 RcvdSpoofedUnknownMgmtCount;
1810 UINT32 RcvdReplayAttackCount;
1812 CHAR RssiOfRcvdConflictSsid;
1813 CHAR RssiOfRcvdSpoofedAssocResp;
1814 CHAR RssiOfRcvdSpoofedReassocResp;
1815 CHAR RssiOfRcvdSpoofedProbeResp;
1816 CHAR RssiOfRcvdSpoofedBeacon;
1817 CHAR RssiOfRcvdSpoofedDisassoc;
1818 CHAR RssiOfRcvdSpoofedAuth;
1819 CHAR RssiOfRcvdSpoofedDeauth;
1820 CHAR RssiOfRcvdSpoofedUnknownMgmt;
1821 CHAR RssiOfRcvdReplayAttack;
1823 BOOLEAN bBcnSntReq;
1824 UCHAR BcnBufIdx;
1825 } MULTISSID_STRUCT, *PMULTISSID_STRUCT;
1827 // configuration common to OPMODE_AP as well as OPMODE_STA
1828 typedef struct _COMMON_CONFIG {
1830 BOOLEAN bCountryFlag;
1831 UCHAR CountryCode[3];
1832 UCHAR Geography;
1833 UCHAR CountryRegion; // Enum of country region, 0:FCC, 1:IC, 2:ETSI, 3:SPAIN, 4:France, 5:MKK, 6:MKK1, 7:Israel
1834 UCHAR CountryRegionForABand; // Enum of country region for A band
1835 UCHAR PhyMode; // PHY_11A, PHY_11B, PHY_11BG_MIXED, PHY_ABG_MIXED
1836 USHORT Dsifs; // in units of usec
1837 ULONG PacketFilter; // Packet filter for receiving
1839 CHAR Ssid[MAX_LEN_OF_SSID]; // NOT NULL-terminated
1840 UCHAR SsidLen; // the actual ssid length in used
1841 UCHAR LastSsidLen; // the actual ssid length in used
1842 CHAR LastSsid[MAX_LEN_OF_SSID]; // NOT NULL-terminated
1843 UCHAR LastBssid[MAC_ADDR_LEN];
1845 UCHAR Bssid[MAC_ADDR_LEN];
1846 USHORT BeaconPeriod;
1847 UCHAR Channel;
1848 UCHAR CentralChannel; // Central Channel when using 40MHz is indicating. not real channel.
1850 UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES];
1851 UCHAR SupRateLen;
1852 UCHAR ExtRate[MAX_LEN_OF_SUPPORTED_RATES];
1853 UCHAR ExtRateLen;
1854 UCHAR DesireRate[MAX_LEN_OF_SUPPORTED_RATES]; // OID_802_11_DESIRED_RATES
1855 UCHAR MaxDesiredRate;
1856 UCHAR ExpectedACKRate[MAX_LEN_OF_SUPPORTED_RATES];
1858 ULONG BasicRateBitmap; // backup basic ratebitmap
1860 BOOLEAN bAPSDCapable;
1861 BOOLEAN bInServicePeriod;
1862 BOOLEAN bAPSDAC_BE;
1863 BOOLEAN bAPSDAC_BK;
1864 BOOLEAN bAPSDAC_VI;
1865 BOOLEAN bAPSDAC_VO;
1866 BOOLEAN bNeedSendTriggerFrame;
1867 BOOLEAN bAPSDForcePowerSave; // Force power save mode, should only use in APSD-STAUT
1868 ULONG TriggerTimerCount;
1869 UCHAR MaxSPLength;
1870 UCHAR BBPCurrentBW; // BW_10, BW_20, BW_40
1871 REG_TRANSMIT_SETTING RegTransmitSetting; //registry transmit setting. this is for reading registry setting only. not useful.
1872 UCHAR TxRate; // Same value to fill in TXD. TxRate is 6-bit
1873 UCHAR MaxTxRate; // RATE_1, RATE_2, RATE_5_5, RATE_11
1874 UCHAR TxRateIndex; // Tx rate index in RateSwitchTable
1875 UCHAR TxRateTableSize; // Valid Tx rate table size in RateSwitchTable
1876 UCHAR MinTxRate; // RATE_1, RATE_2, RATE_5_5, RATE_11
1877 UCHAR RtsRate; // RATE_xxx
1878 HTTRANSMIT_SETTING MlmeTransmit; // MGMT frame PHY rate setting when operatin at Ht rate.
1879 UCHAR MlmeRate; // RATE_xxx, used to send MLME frames
1880 UCHAR BasicMlmeRate; // Default Rate for sending MLME frames
1882 USHORT RtsThreshold; // in unit of BYTE
1883 USHORT FragmentThreshold; // in unit of BYTE
1885 UCHAR TxPower; // in unit of mW
1886 ULONG TxPowerPercentage; // 0~100 %
1887 ULONG TxPowerDefault; // keep for TxPowerPercentage
1889 BACAP_STRUC BACapability; // NO USE = 0XFF ; IMMED_BA =1 ; DELAY_BA=0
1890 BACAP_STRUC REGBACapability; // NO USE = 0XFF ; IMMED_BA =1 ; DELAY_BA=0
1892 IOT_STRUC IOTestParm; // 802.11n InterOpbility Test Parameter;
1893 ULONG TxPreamble; // Rt802_11PreambleLong, Rt802_11PreambleShort, Rt802_11PreambleAuto
1894 BOOLEAN bUseZeroToDisableFragment; // Microsoft use 0 as disable
1895 ULONG UseBGProtection; // 0: auto, 1: always use, 2: always not use
1896 BOOLEAN bUseShortSlotTime; // 0: disable, 1 - use short slot (9us)
1897 BOOLEAN bEnableTxBurst; // 1: enble TX PACKET BURST, 0: disable TX PACKET BURST
1898 BOOLEAN bAggregationCapable; // 1: enable TX aggregation when the peer supports it
1899 BOOLEAN bPiggyBackCapable; // 1: enable TX piggy-back according MAC's version
1900 BOOLEAN bIEEE80211H; // 1: enable IEEE802.11h spec.
1901 ULONG DisableOLBCDetect; // 0: enable OLBC detect; 1 disable OLBC detect
1903 BOOLEAN bRdg;
1905 BOOLEAN bWmmCapable; // 0:disable WMM, 1:enable WMM
1906 QOS_CAPABILITY_PARM APQosCapability; // QOS capability of the current associated AP
1907 EDCA_PARM APEdcaParm; // EDCA parameters of the current associated AP
1908 QBSS_LOAD_PARM APQbssLoad; // QBSS load of the current associated AP
1909 UCHAR AckPolicy[4]; // ACK policy of the specified AC. see ACK_xxx
1910 BOOLEAN bDLSCapable; // 0:disable DLS, 1:enable DLS
1911 // a bitmap of BOOLEAN flags. each bit represent an operation status of a particular
1912 // BOOLEAN control, either ON or OFF. These flags should always be accessed via
1913 // OPSTATUS_TEST_FLAG(), OPSTATUS_SET_FLAG(), OP_STATUS_CLEAR_FLAG() macros.
1914 // see fOP_STATUS_xxx in RTMP_DEF.C for detail bit definition
1915 ULONG OpStatusFlags;
1917 BOOLEAN NdisRadioStateOff; //For HCT 12.0, set this flag to TRUE instead of called MlmeRadioOff.
1918 ABGBAND_STATE BandState; // For setting BBP used on B/G or A mode.
1919 #ifdef RT30xx
1920 BOOLEAN bRxAntDiversity; // 0:disable, 1:enable Software Rx Antenna Diversity.
1921 #endif
1923 // IEEE802.11H--DFS.
1924 RADAR_DETECT_STRUCT RadarDetect;
1926 // HT
1927 UCHAR BASize; // USer desired BAWindowSize. Should not exceed our max capability
1928 //RT_HT_CAPABILITY SupportedHtPhy;
1929 RT_HT_CAPABILITY DesiredHtPhy;
1930 HT_CAPABILITY_IE HtCapability;
1931 ADD_HT_INFO_IE AddHTInfo; // Useful as AP.
1932 //This IE is used with channel switch announcement element when changing to a new 40MHz.
1933 //This IE is included in channel switch ammouncement frames 7.4.1.5, beacons, probe Rsp.
1934 NEW_EXT_CHAN_IE NewExtChanOffset; //7.3.2.20A, 1 if extension channel is above the control channel, 3 if below, 0 if not present
1936 BOOLEAN bHTProtect;
1937 BOOLEAN bMIMOPSEnable;
1938 BOOLEAN bBADecline;
1939 BOOLEAN bDisableReordering;
1940 BOOLEAN bForty_Mhz_Intolerant;
1941 BOOLEAN bExtChannelSwitchAnnouncement;
1942 BOOLEAN bRcvBSSWidthTriggerEvents;
1943 ULONG LastRcvBSSWidthTriggerEventsTime;
1945 UCHAR TxBASize;
1947 // Enable wireless event
1948 BOOLEAN bWirelessEvent;
1949 BOOLEAN bWiFiTest; // Enable this parameter for WiFi test
1951 // Tx & Rx Stream number selection
1952 UCHAR TxStream;
1953 UCHAR RxStream;
1955 // transmit phy mode, trasmit rate for Multicast.
1956 #ifdef MCAST_RATE_SPECIFIC
1957 UCHAR McastTransmitMcs;
1958 UCHAR McastTransmitPhyMode;
1959 #endif // MCAST_RATE_SPECIFIC //
1961 BOOLEAN bHardwareRadio; // Hardware controlled Radio enabled
1963 #ifdef RT2870
1964 BOOLEAN bMultipleIRP; // Multiple Bulk IN flag
1965 UCHAR NumOfBulkInIRP; // if bMultipleIRP == TRUE, NumOfBulkInIRP will be 4 otherwise be 1
1966 RT_HT_CAPABILITY SupportedHtPhy;
1967 ULONG MaxPktOneTxBulk;
1968 UCHAR TxBulkFactor;
1969 UCHAR RxBulkFactor;
1971 BEACON_SYNC_STRUCT *pBeaconSync;
1972 RALINK_TIMER_STRUCT BeaconUpdateTimer;
1973 UINT32 BeaconAdjust;
1974 UINT32 BeaconFactor;
1975 UINT32 BeaconRemain;
1976 #endif // RT2870 //
1979 NDIS_SPIN_LOCK MeasureReqTabLock;
1980 PMEASURE_REQ_TAB pMeasureReqTab;
1982 NDIS_SPIN_LOCK TpcReqTabLock;
1983 PTPC_REQ_TAB pTpcReqTab;
1985 // transmit phy mode, trasmit rate for Multicast.
1986 #ifdef MCAST_RATE_SPECIFIC
1987 HTTRANSMIT_SETTING MCastPhyMode;
1988 #endif // MCAST_RATE_SPECIFIC //
1989 } COMMON_CONFIG, *PCOMMON_CONFIG;
1991 /* Modified by Wu Xi-Kun 4/21/2006 */
1992 // STA configuration and status
1993 typedef struct _STA_ADMIN_CONFIG {
1994 // GROUP 1 -
1995 // User configuration loaded from Registry, E2PROM or OID_xxx. These settings describe
1996 // the user intended configuration, but not necessary fully equal to the final
1997 // settings in ACTIVE BSS after negotiation/compromize with the BSS holder (either
1998 // AP or IBSS holder).
1999 // Once initialized, user configuration can only be changed via OID_xxx
2000 UCHAR BssType; // BSS_INFRA or BSS_ADHOC
2001 USHORT AtimWin; // used when starting a new IBSS
2003 // GROUP 2 -
2004 // User configuration loaded from Registry, E2PROM or OID_xxx. These settings describe
2005 // the user intended configuration, and should be always applied to the final
2006 // settings in ACTIVE BSS without compromising with the BSS holder.
2007 // Once initialized, user configuration can only be changed via OID_xxx
2008 UCHAR RssiTrigger;
2009 UCHAR RssiTriggerMode; // RSSI_TRIGGERED_UPON_BELOW_THRESHOLD or RSSI_TRIGGERED_UPON_EXCCEED_THRESHOLD
2010 USHORT DefaultListenCount; // default listen count;
2011 ULONG WindowsPowerMode; // Power mode for AC power
2012 ULONG WindowsBatteryPowerMode; // Power mode for battery if exists
2013 BOOLEAN bWindowsACCAMEnable; // Enable CAM power mode when AC on
2014 BOOLEAN bAutoReconnect; // Set to TRUE when setting OID_802_11_SSID with no matching BSSID
2015 ULONG WindowsPowerProfile; // Windows power profile, for NDIS5.1 PnP
2017 // MIB:ieee802dot11.dot11smt(1).dot11StationConfigTable(1)
2018 USHORT Psm; // power management mode (PWR_ACTIVE|PWR_SAVE)
2019 USHORT DisassocReason;
2020 UCHAR DisassocSta[MAC_ADDR_LEN];
2021 USHORT DeauthReason;
2022 UCHAR DeauthSta[MAC_ADDR_LEN];
2023 USHORT AuthFailReason;
2024 UCHAR AuthFailSta[MAC_ADDR_LEN];
2026 NDIS_802_11_PRIVACY_FILTER PrivacyFilter; // PrivacyFilter enum for 802.1X
2027 NDIS_802_11_AUTHENTICATION_MODE AuthMode; // This should match to whatever microsoft defined
2028 NDIS_802_11_WEP_STATUS WepStatus;
2029 NDIS_802_11_WEP_STATUS OrigWepStatus; // Original wep status set from OID
2031 // Add to support different cipher suite for WPA2/WPA mode
2032 NDIS_802_11_ENCRYPTION_STATUS GroupCipher; // Multicast cipher suite
2033 NDIS_802_11_ENCRYPTION_STATUS PairCipher; // Unicast cipher suite
2034 BOOLEAN bMixCipher; // Indicate current Pair & Group use different cipher suites
2035 USHORT RsnCapability;
2037 NDIS_802_11_WEP_STATUS GroupKeyWepStatus;
2039 UCHAR PMK[32]; // WPA PSK mode PMK
2040 UCHAR PTK[64]; // WPA PSK mode PTK
2041 UCHAR GTK[32]; // GTK from authenticator
2042 BSSID_INFO SavedPMK[PMKID_NO];
2043 UINT SavedPMKNum; // Saved PMKID number
2045 UCHAR DefaultKeyId;
2048 // WPA 802.1x port control, WPA_802_1X_PORT_SECURED, WPA_802_1X_PORT_NOT_SECURED
2049 UCHAR PortSecured;
2051 // For WPA countermeasures
2052 ULONG LastMicErrorTime; // record last MIC error time
2053 ULONG MicErrCnt; // Should be 0, 1, 2, then reset to zero (after disassoiciation).
2054 BOOLEAN bBlockAssoc; // Block associate attempt for 60 seconds after counter measure occurred.
2055 // For WPA-PSK supplicant state
2056 WPA_STATE WpaState; // Default is SS_NOTUSE and handled by microsoft 802.1x
2057 UCHAR ReplayCounter[8];
2058 UCHAR ANonce[32]; // ANonce for WPA-PSK from aurhenticator
2059 UCHAR SNonce[32]; // SNonce for WPA-PSK
2061 UCHAR LastSNR0; // last received BEACON's SNR
2062 UCHAR LastSNR1; // last received BEACON's SNR for 2nd antenna
2063 RSSI_SAMPLE RssiSample;
2064 ULONG NumOfAvgRssiSample;
2066 ULONG LastBeaconRxTime; // OS's timestamp of the last BEACON RX time
2067 ULONG Last11bBeaconRxTime; // OS's timestamp of the last 11B BEACON RX time
2068 ULONG Last11gBeaconRxTime; // OS's timestamp of the last 11G BEACON RX time
2069 ULONG Last20NBeaconRxTime; // OS's timestamp of the last 20MHz N BEACON RX time
2071 ULONG LastScanTime; // Record last scan time for issue BSSID_SCAN_LIST
2072 ULONG ScanCnt; // Scan counts since most recent SSID, BSSID, SCAN OID request
2073 BOOLEAN bSwRadio; // Software controlled Radio On/Off, TRUE: On
2074 BOOLEAN bHwRadio; // Hardware controlled Radio On/Off, TRUE: On
2075 BOOLEAN bRadio; // Radio state, And of Sw & Hw radio state
2076 BOOLEAN bHardwareRadio; // Hardware controlled Radio enabled
2077 BOOLEAN bShowHiddenSSID; // Show all known SSID in SSID list get operation
2078 #ifdef RT2860
2079 BOOLEAN AdhocBOnlyJoined; // Indicate Adhoc B Join.
2080 BOOLEAN AdhocBGJoined; // Indicate Adhoc B/G Join.
2081 BOOLEAN Adhoc20NJoined; // Indicate Adhoc 20MHz N Join.
2082 #endif
2083 // New for WPA, windows want us to to keep association information and
2084 // Fixed IEs from last association response
2085 NDIS_802_11_ASSOCIATION_INFORMATION AssocInfo;
2086 USHORT ReqVarIELen; // Length of next VIE include EID & Length
2087 UCHAR ReqVarIEs[MAX_VIE_LEN]; // The content saved here should be little-endian format.
2088 USHORT ResVarIELen; // Length of next VIE include EID & Length
2089 UCHAR ResVarIEs[MAX_VIE_LEN];
2091 UCHAR RSNIE_Len;
2092 UCHAR RSN_IE[MAX_LEN_OF_RSNIE]; // The content saved here should be little-endian format.
2094 // New variables used for CCX 1.0
2095 BOOLEAN bCkipOn;
2096 BOOLEAN bCkipCmicOn;
2097 UCHAR CkipFlag;
2098 UCHAR GIV[3]; //for CCX iv
2099 UCHAR RxSEQ[4];
2100 UCHAR TxSEQ[4];
2101 UCHAR CKIPMIC[4];
2102 UCHAR LeapAuthMode;
2103 LEAP_AUTH_INFO LeapAuthInfo;
2104 UCHAR HashPwd[16];
2105 UCHAR NetworkChallenge[8];
2106 UCHAR NetworkChallengeResponse[24];
2107 UCHAR PeerChallenge[8];
2109 UCHAR PeerChallengeResponse[24];
2110 UCHAR SessionKey[16]; //Network session keys (NSK)
2111 RALINK_TIMER_STRUCT LeapAuthTimer;
2112 ROGUEAP_TABLE RogueApTab; //Cisco CCX1 Rogue AP Detection
2114 // New control flags for CCX
2115 CCX_CONTROL CCXControl; // Master administration state
2116 BOOLEAN CCXEnable; // Actual CCX state
2117 UCHAR CCXScanChannel; // Selected channel for CCX beacon request
2118 USHORT CCXScanTime; // Time out to wait for beacon and probe response
2119 UCHAR CCXReqType; // Current processing CCX request type
2120 BSS_TABLE CCXBssTab; // BSS Table
2121 UCHAR FrameReportBuf[2048]; // Buffer for creating frame report
2122 USHORT FrameReportLen; // Current Frame report length
2123 ULONG CLBusyBytes; // Save the total bytes received durning channel load scan time
2124 USHORT RPIDensity[8]; // Array for RPI density collection
2125 // Start address of each BSS table within FrameReportBuf
2126 // It's important to update the RxPower of the corresponding Bss
2127 USHORT BssReportOffset[MAX_LEN_OF_BSS_TABLE];
2128 USHORT BeaconToken; // Token for beacon report
2129 ULONG LastBssIndex; // Most current reported Bss index
2130 RM_REQUEST_ACTION MeasurementRequest[16]; // Saved measurement request
2131 UCHAR RMReqCnt; // Number of measurement request saved.
2132 UCHAR CurrentRMReqIdx; // Number of measurement request saved.
2133 BOOLEAN ParallelReq; // Parallel measurement, only one request performed,
2134 // It must be the same channel with maximum duration
2135 USHORT ParallelDuration; // Maximum duration for parallel measurement
2136 UCHAR ParallelChannel; // Only one channel with parallel measurement
2137 USHORT IAPPToken; // IAPP dialog token
2138 UCHAR CCXQosECWMin; // Cisco QOS ECWMin for AC 0
2139 UCHAR CCXQosECWMax; // Cisco QOS ECWMax for AC 0
2140 // Hack for channel load and noise histogram parameters
2141 UCHAR NHFactor; // Parameter for Noise histogram
2142 UCHAR CLFactor; // Parameter for channel load
2144 UCHAR KRK[16]; //Key Refresh Key.
2145 UCHAR BTK[32]; //Base Transient Key
2146 BOOLEAN CCKMLinkUpFlag;
2147 ULONG CCKMRN; //(Re)Association request number.
2148 LARGE_INTEGER CCKMBeaconAtJoinTimeStamp; //TSF timer for Re-assocaite to the new AP
2149 UCHAR AironetCellPowerLimit; //in dBm
2150 UCHAR AironetIPAddress[4]; //eg. 192.168.1.1
2151 BOOLEAN CCXAdjacentAPReportFlag; //flag for determining report Assoc Lost time
2152 CHAR CCXAdjacentAPSsid[MAX_LEN_OF_SSID]; //Adjacent AP's SSID report
2153 UCHAR CCXAdjacentAPSsidLen; // the actual ssid length in used
2154 UCHAR CCXAdjacentAPBssid[MAC_ADDR_LEN]; //Adjacent AP's BSSID report
2155 USHORT CCXAdjacentAPChannel;
2156 ULONG CCXAdjacentAPLinkDownTime; //for Spec S32.
2158 RALINK_TIMER_STRUCT StaQuickResponeForRateUpTimer;
2159 BOOLEAN StaQuickResponeForRateUpTimerRunning;
2161 UCHAR DtimCount; // 0.. DtimPeriod-1
2162 UCHAR DtimPeriod; // default = 3
2164 ////////////////////////////////////////////////////////////////////////////////////////
2165 // This is only for WHQL test.
2166 BOOLEAN WhqlTest;
2167 ////////////////////////////////////////////////////////////////////////////////////////
2169 RALINK_TIMER_STRUCT WpaDisassocAndBlockAssocTimer;
2170 // Fast Roaming
2171 BOOLEAN bFastRoaming; // 0:disable fast roaming, 1:enable fast roaming
2172 CHAR dBmToRoam; // the condition to roam when receiving Rssi less than this value. It's negative value.
2174 BOOLEAN IEEE8021X;
2175 BOOLEAN IEEE8021x_required_keys;
2176 CIPHER_KEY DesireSharedKey[4]; // Record user desired WEP keys
2177 UCHAR DesireSharedKeyId;
2179 // 0: driver ignores wpa_supplicant
2180 // 1: wpa_supplicant initiates scanning and AP selection
2181 // 2: driver takes care of scanning, AP selection, and IEEE 802.11 association parameters
2182 UCHAR WpaSupplicantUP;
2183 UCHAR WpaSupplicantScanCount;
2185 CHAR dev_name[16];
2186 USHORT OriDevType;
2188 BOOLEAN bTGnWifiTest;
2189 BOOLEAN bScanReqIsFromWebUI;
2191 HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode;// For transmit phy setting in TXWI.
2192 DESIRED_TRANSMIT_SETTING DesiredTransmitSetting;
2193 RT_HT_PHY_INFO DesiredHtPhyInfo;
2194 BOOLEAN bAutoTxRateSwitch;
2196 #ifdef RT2860
2197 UCHAR BBPR3;
2198 #endif
2199 } STA_ADMIN_CONFIG, *PSTA_ADMIN_CONFIG;
2201 // This data structure keep the current active BSS/IBSS's configuration that this STA
2202 // had agreed upon joining the network. Which means these parameters are usually decided
2203 // by the BSS/IBSS creator instead of user configuration. Data in this data structurre
2204 // is valid only when either ADHOC_ON(pAd) or INFRA_ON(pAd) is TRUE.
2205 // Normally, after SCAN or failed roaming attempts, we need to recover back to
2206 // the current active settings.
2207 typedef struct _STA_ACTIVE_CONFIG {
2208 USHORT Aid;
2209 USHORT AtimWin; // in kusec; IBSS parameter set element
2210 USHORT CapabilityInfo;
2211 USHORT CfpMaxDuration;
2212 USHORT CfpPeriod;
2214 // Copy supported rate from desired AP's beacon. We are trying to match
2215 // AP's supported and extended rate settings.
2216 UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES];
2217 UCHAR ExtRate[MAX_LEN_OF_SUPPORTED_RATES];
2218 UCHAR SupRateLen;
2219 UCHAR ExtRateLen;
2220 // Copy supported ht from desired AP's beacon. We are trying to match
2221 RT_HT_PHY_INFO SupportedPhyInfo;
2222 RT_HT_CAPABILITY SupportedHtPhy;
2223 } STA_ACTIVE_CONFIG, *PSTA_ACTIVE_CONFIG;
2225 #ifdef RT2870
2226 // for USB interface, avoid in interrupt when write key
2227 typedef struct RT_ADD_PAIRWISE_KEY_ENTRY {
2228 NDIS_802_11_MAC_ADDRESS MacAddr;
2229 USHORT MacTabMatchWCID; // ASIC
2230 CIPHER_KEY CipherKey;
2231 } RT_ADD_PAIRWISE_KEY_ENTRY,*PRT_ADD_PAIRWISE_KEY_ENTRY;
2232 #endif // RT2870 //
2234 // ----------- start of AP --------------------------
2235 // AUTH-RSP State Machine Aux data structure
2236 typedef struct _AP_MLME_AUX {
2237 UCHAR Addr[MAC_ADDR_LEN];
2238 USHORT Alg;
2239 CHAR Challenge[CIPHER_TEXT_LEN];
2240 } AP_MLME_AUX, *PAP_MLME_AUX;
2242 // structure to define WPA Group Key Rekey Interval
2243 typedef struct PACKED _RT_802_11_WPA_REKEY {
2244 ULONG ReKeyMethod; // mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based
2245 ULONG ReKeyInterval; // time-based: seconds, packet-based: kilo-packets
2246 } RT_WPA_REKEY,*PRT_WPA_REKEY, RT_802_11_WPA_REKEY, *PRT_802_11_WPA_REKEY;
2248 typedef struct _MAC_TABLE_ENTRY {
2249 //Choose 1 from ValidAsWDS and ValidAsCLI to validize.
2250 BOOLEAN ValidAsCLI; // Sta mode, set this TRUE after Linkup,too.
2251 BOOLEAN ValidAsWDS; // This is WDS Entry. only for AP mode.
2252 BOOLEAN ValidAsApCli; //This is a AP-Client entry, only for AP mode which enable AP-Client functions.
2253 BOOLEAN ValidAsMesh;
2254 BOOLEAN ValidAsDls; // This is DLS Entry. only for STA mode.
2255 BOOLEAN isCached;
2256 BOOLEAN bIAmBadAtheros; // Flag if this is Atheros chip that has IOT problem. We need to turn on RTS/CTS protection.
2258 UCHAR EnqueueEapolStartTimerRunning; // Enqueue EAPoL-Start for triggering EAP SM
2259 //jan for wpa
2260 // record which entry revoke MIC Failure , if it leaves the BSS itself, AP won't update aMICFailTime MIB
2261 UCHAR CMTimerRunning;
2262 UCHAR apidx; // MBSS number
2263 UCHAR RSNIE_Len;
2264 UCHAR RSN_IE[MAX_LEN_OF_RSNIE];
2265 UCHAR ANonce[LEN_KEY_DESC_NONCE];
2266 UCHAR R_Counter[LEN_KEY_DESC_REPLAY];
2267 UCHAR PTK[64];
2268 UCHAR ReTryCounter;
2269 RALINK_TIMER_STRUCT RetryTimer;
2270 RALINK_TIMER_STRUCT EnqueueStartForPSKTimer; // A timer which enqueue EAPoL-Start for triggering PSK SM
2271 NDIS_802_11_AUTHENTICATION_MODE AuthMode; // This should match to whatever microsoft defined
2272 NDIS_802_11_WEP_STATUS WepStatus;
2273 AP_WPA_STATE WpaState;
2274 GTK_STATE GTKState;
2275 USHORT PortSecured;
2276 NDIS_802_11_PRIVACY_FILTER PrivacyFilter; // PrivacyFilter enum for 802.1X
2277 CIPHER_KEY PairwiseKey;
2278 PVOID pAd;
2279 INT PMKID_CacheIdx;
2280 UCHAR PMKID[LEN_PMKID];
2283 UCHAR Addr[MAC_ADDR_LEN];
2284 UCHAR PsMode;
2285 SST Sst;
2286 AUTH_STATE AuthState; // for SHARED KEY authentication state machine used only
2287 BOOLEAN IsReassocSta; // Indicate whether this is a reassociation procedure
2288 USHORT Aid;
2289 USHORT CapabilityInfo;
2290 UCHAR LastRssi;
2291 ULONG NoDataIdleCount;
2292 UINT16 StationKeepAliveCount; // unit: second
2293 ULONG PsQIdleCount;
2294 QUEUE_HEADER PsQueue;
2296 UINT32 StaConnectTime; // the live time of this station since associated with AP
2298 BOOLEAN bSendBAR;
2299 USHORT NoBADataCountDown;
2301 UINT32 CachedBuf[16]; // UINT (4 bytes) for alignment
2302 UINT TxBFCount; // 3*3
2303 UINT FIFOCount;
2304 UINT DebugFIFOCount;
2305 UINT DebugTxCount;
2306 BOOLEAN bDlsInit;
2309 //====================================================
2310 //WDS entry needs these
2311 // rt2860 add this. if ValidAsWDS==TRUE, MatchWDSTabIdx is the index in WdsTab.MacTab
2312 UINT MatchWDSTabIdx;
2313 UCHAR MaxSupportedRate;
2314 UCHAR CurrTxRate;
2315 UCHAR CurrTxRateIndex;
2316 // to record the each TX rate's quality. 0 is best, the bigger the worse.
2317 USHORT TxQuality[MAX_STEP_OF_TX_RATE_SWITCH];
2318 UINT32 OneSecTxNoRetryOkCount;
2319 UINT32 OneSecTxRetryOkCount;
2320 UINT32 OneSecTxFailCount;
2321 UINT32 ContinueTxFailCnt;
2322 UINT32 CurrTxRateStableTime; // # of second in current TX rate
2323 UCHAR TxRateUpPenalty; // extra # of second penalty due to last unstable condition
2324 //====================================================
2326 BOOLEAN fNoisyEnvironment;
2327 BOOLEAN fLastSecAccordingRSSI;
2328 UCHAR LastSecTxRateChangeAction; // 0: no change, 1:rate UP, 2:rate down
2329 CHAR LastTimeTxRateChangeAction; //Keep last time value of LastSecTxRateChangeAction
2330 ULONG LastTxOkCount;
2331 UCHAR PER[MAX_STEP_OF_TX_RATE_SWITCH];
2333 // a bitmap of BOOLEAN flags. each bit represent an operation status of a particular
2334 // BOOLEAN control, either ON or OFF. These flags should always be accessed via
2335 // CLIENT_STATUS_TEST_FLAG(), CLIENT_STATUS_SET_FLAG(), CLIENT_STATUS_CLEAR_FLAG() macros.
2336 // see fOP_STATUS_xxx in RTMP_DEF.C for detail bit definition. fCLIENT_STATUS_AMSDU_INUSED
2337 ULONG ClientStatusFlags;
2339 HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode;// For transmit phy setting in TXWI.
2341 // HT EWC MIMO-N used parameters
2342 USHORT RXBAbitmap; // fill to on-chip RXWI_BA_BITMASK in 8.1.3RX attribute entry format
2343 USHORT TXBAbitmap; // This bitmap as originator, only keep in software used to mark AMPDU bit in TXWI
2344 USHORT TXAutoBAbitmap;
2345 USHORT BADeclineBitmap;
2346 USHORT BARecWcidArray[NUM_OF_TID]; // The mapping wcid of recipient session. if RXBAbitmap bit is masked
2347 USHORT BAOriWcidArray[NUM_OF_TID]; // The mapping wcid of originator session. if TXBAbitmap bit is masked
2348 USHORT BAOriSequence[NUM_OF_TID]; // The mapping wcid of originator session. if TXBAbitmap bit is masked
2350 // 802.11n features.
2351 UCHAR MpduDensity;
2352 UCHAR MaxRAmpduFactor;
2353 UCHAR AMsduSize;
2354 UCHAR MmpsMode; // MIMO power save more.
2356 HT_CAPABILITY_IE HTCapability;
2358 BOOLEAN bAutoTxRateSwitch;
2360 UCHAR RateLen;
2361 struct _MAC_TABLE_ENTRY *pNext;
2362 USHORT TxSeq[NUM_OF_TID];
2363 USHORT NonQosDataSeq;
2365 RSSI_SAMPLE RssiSample;
2367 UINT32 TXMCSExpected[16];
2368 UINT32 TXMCSSuccessful[16];
2369 UINT32 TXMCSFailed[16];
2370 UINT32 TXMCSAutoFallBack[16][16];
2371 #ifdef RT2870
2372 ULONG LastBeaconRxTime;
2373 #endif
2374 } MAC_TABLE_ENTRY, *PMAC_TABLE_ENTRY;
2376 typedef struct _MAC_TABLE {
2377 USHORT Size;
2378 MAC_TABLE_ENTRY *Hash[HASH_TABLE_SIZE];
2379 MAC_TABLE_ENTRY Content[MAX_LEN_OF_MAC_TABLE];
2380 QUEUE_HEADER McastPsQueue;
2381 ULONG PsQIdleCount;
2382 BOOLEAN fAnyStationInPsm;
2383 BOOLEAN fAnyStationBadAtheros; // Check if any Station is atheros 802.11n Chip. We need to use RTS/CTS with Atheros 802,.11n chip.
2384 BOOLEAN fAnyTxOPForceDisable; // Check if it is necessary to disable BE TxOP
2385 #ifdef RT2870
2386 BOOLEAN fAllStationAsRalink; // Check if all stations are ralink-chipset
2387 #endif
2388 BOOLEAN fAnyStationIsLegacy; // Check if I use legacy rate to transmit to my BSS Station/
2389 BOOLEAN fAnyStationNonGF; // Check if any Station can't support GF.
2390 BOOLEAN fAnyStation20Only; // Check if any Station can't support GF.
2391 BOOLEAN fAnyStationMIMOPSDynamic; // Check if any Station is MIMO Dynamic
2392 BOOLEAN fAnyBASession; // Check if there is BA session. Force turn on RTS/CTS
2393 } MAC_TABLE, *PMAC_TABLE;
2395 #define IS_HT_STA(_pMacEntry) \
2396 (_pMacEntry->MaxHTPhyMode.field.MODE >= MODE_HTMIX)
2398 #define IS_HT_RATE(_pMacEntry) \
2399 (_pMacEntry->HTPhyMode.field.MODE >= MODE_HTMIX)
2401 #define PEER_IS_HT_RATE(_pMacEntry) \
2402 (_pMacEntry->HTPhyMode.field.MODE >= MODE_HTMIX)
2404 typedef struct _WDS_ENTRY {
2405 BOOLEAN Valid;
2406 UCHAR Addr[MAC_ADDR_LEN];
2407 ULONG NoDataIdleCount;
2408 struct _WDS_ENTRY *pNext;
2409 } WDS_ENTRY, *PWDS_ENTRY;
2411 typedef struct _WDS_TABLE_ENTRY {
2412 USHORT Size;
2413 UCHAR WdsAddr[MAC_ADDR_LEN];
2414 WDS_ENTRY *Hash[HASH_TABLE_SIZE];
2415 WDS_ENTRY Content[MAX_LEN_OF_MAC_TABLE];
2416 UCHAR MaxSupportedRate;
2417 UCHAR CurrTxRate;
2418 USHORT TxQuality[MAX_LEN_OF_SUPPORTED_RATES];
2419 USHORT OneSecTxOkCount;
2420 USHORT OneSecTxRetryOkCount;
2421 USHORT OneSecTxFailCount;
2422 ULONG CurrTxRateStableTime; // # of second in current TX rate
2423 UCHAR TxRateUpPenalty; // extra # of second penalty due to last unstable condition
2424 } WDS_TABLE_ENTRY, *PWDS_TABLE_ENTRY;
2426 typedef struct _RT_802_11_WDS_ENTRY {
2427 PNET_DEV dev;
2428 UCHAR Valid;
2429 UCHAR PhyMode;
2430 UCHAR PeerWdsAddr[MAC_ADDR_LEN];
2431 UCHAR MacTabMatchWCID; // ASIC
2432 NDIS_802_11_WEP_STATUS WepStatus;
2433 UCHAR KeyIdx;
2434 CIPHER_KEY WdsKey;
2435 HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode;
2436 RT_HT_PHY_INFO DesiredHtPhyInfo;
2437 BOOLEAN bAutoTxRateSwitch;
2438 DESIRED_TRANSMIT_SETTING DesiredTransmitSetting; // Desired transmit setting.
2439 } RT_802_11_WDS_ENTRY, *PRT_802_11_WDS_ENTRY;
2441 typedef struct _WDS_TABLE {
2442 UCHAR Mode;
2443 ULONG Size;
2444 RT_802_11_WDS_ENTRY WdsEntry[MAX_WDS_ENTRY];
2445 } WDS_TABLE, *PWDS_TABLE;
2447 typedef struct _APCLI_STRUCT {
2448 PNET_DEV dev;
2449 #ifdef RTL865X_SOC
2450 unsigned int mylinkid;
2451 #endif
2452 BOOLEAN Enable; // Set it as 1 if the apcli interface was configured to "1" or by iwpriv cmd "ApCliEnable"
2453 BOOLEAN Valid; // Set it as 1 if the apcli interface associated success to remote AP.
2454 UCHAR MacTabWCID; //WCID value, which point to the entry of ASIC Mac table.
2455 UCHAR SsidLen;
2456 CHAR Ssid[MAX_LEN_OF_SSID];
2458 UCHAR CfgSsidLen;
2459 CHAR CfgSsid[MAX_LEN_OF_SSID];
2460 UCHAR CfgApCliBssid[ETH_LENGTH_OF_ADDRESS];
2461 UCHAR CurrentAddress[ETH_LENGTH_OF_ADDRESS];
2463 ULONG ApCliRcvBeaconTime;
2465 ULONG CtrlCurrState;
2466 ULONG SyncCurrState;
2467 ULONG AuthCurrState;
2468 ULONG AssocCurrState;
2469 ULONG WpaPskCurrState;
2471 USHORT AuthReqCnt;
2472 USHORT AssocReqCnt;
2474 ULONG ClientStatusFlags;
2475 UCHAR MpduDensity;
2477 NDIS_802_11_AUTHENTICATION_MODE AuthMode; // This should match to whatever microsoft defined
2478 NDIS_802_11_WEP_STATUS WepStatus;
2480 // Add to support different cipher suite for WPA2/WPA mode
2481 NDIS_802_11_ENCRYPTION_STATUS GroupCipher; // Multicast cipher suite
2482 NDIS_802_11_ENCRYPTION_STATUS PairCipher; // Unicast cipher suite
2483 BOOLEAN bMixCipher; // Indicate current Pair & Group use different cipher suites
2484 USHORT RsnCapability;
2486 UCHAR PSK[100]; // reserve PSK key material
2487 UCHAR PSKLen;
2488 UCHAR PMK[32]; // WPA PSK mode PMK
2489 UCHAR GTK[32]; // GTK from authenticator
2491 CIPHER_KEY SharedKey[SHARE_KEY_NUM];
2492 UCHAR DefaultKeyId;
2494 // store RSN_IE built by driver
2495 UCHAR RSN_IE[MAX_LEN_OF_RSNIE]; // The content saved here should be convert to little-endian format.
2496 UCHAR RSNIE_Len;
2498 // For WPA countermeasures
2499 ULONG LastMicErrorTime; // record last MIC error time
2500 BOOLEAN bBlockAssoc; // Block associate attempt for 60 seconds after counter measure occurred.
2502 // For WPA-PSK supplicant state
2503 UCHAR SNonce[32]; // SNonce for WPA-PSK
2504 UCHAR GNonce[32]; // GNonce for WPA-PSK from authenticator
2506 HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode;
2507 RT_HT_PHY_INFO DesiredHtPhyInfo;
2508 BOOLEAN bAutoTxRateSwitch;
2509 DESIRED_TRANSMIT_SETTING DesiredTransmitSetting; // Desired transmit setting.
2510 } APCLI_STRUCT, *PAPCLI_STRUCT;
2512 // ----------- end of AP ----------------------------
2514 struct wificonf
2516 BOOLEAN bShortGI;
2517 BOOLEAN bGreenField;
2523 typedef struct _INF_PCI_CONFIG
2525 PUCHAR CSRBaseAddress; // PCI MMIO Base Address, all access will use
2526 }INF_PCI_CONFIG;
2528 typedef struct _INF_USB_CONFIG
2530 UINT BulkInEpAddr; // bulk-in endpoint address
2531 UINT BulkOutEpAddr[6]; // bulk-out endpoint address
2533 }INF_USB_CONFIG;
2535 #ifdef IKANOS_VX_1X0
2536 typedef void (*IkanosWlanTxCbFuncP)(void *, void *);
2538 struct IKANOS_TX_INFO
2540 struct net_device *netdev;
2541 IkanosWlanTxCbFuncP *fp;
2543 #endif // IKANOS_VX_1X0 //
2545 #ifdef DBG_DIAGNOSE
2546 #define DIAGNOSE_TIME 10 // 10 sec
2547 typedef struct _RtmpDiagStrcut_
2548 { // Diagnosis Related element
2549 unsigned char inited;
2550 unsigned char qIdx;
2551 unsigned char ArrayStartIdx;
2552 unsigned char ArrayCurIdx;
2553 // Tx Related Count
2554 USHORT TxDataCnt[DIAGNOSE_TIME];
2555 USHORT TxFailCnt[DIAGNOSE_TIME];
2556 USHORT TxDescCnt[DIAGNOSE_TIME][24]; // 3*3 // TxDesc queue length in scale of 0~14, >=15
2557 USHORT TxMcsCnt[DIAGNOSE_TIME][24]; // 3*3
2558 USHORT TxSWQueCnt[DIAGNOSE_TIME][9]; // TxSwQueue length in scale of 0, 1, 2, 3, 4, 5, 6, 7, >=8
2560 USHORT TxAggCnt[DIAGNOSE_TIME];
2561 USHORT TxNonAggCnt[DIAGNOSE_TIME];
2562 USHORT TxAMPDUCnt[DIAGNOSE_TIME][24]; // 3*3 // 10 sec, TxDMA APMDU Aggregation count in range from 0 to 15, in setp of 1.
2563 USHORT TxRalinkCnt[DIAGNOSE_TIME]; // TxRalink Aggregation Count in 1 sec scale.
2564 USHORT TxAMSDUCnt[DIAGNOSE_TIME]; // TxAMSUD Aggregation Count in 1 sec scale.
2566 // Rx Related Count
2567 USHORT RxDataCnt[DIAGNOSE_TIME]; // Rx Total Data count.
2568 USHORT RxCrcErrCnt[DIAGNOSE_TIME];
2569 USHORT RxMcsCnt[DIAGNOSE_TIME][24]; // 3*3
2570 }RtmpDiagStruct;
2571 #endif // DBG_DIAGNOSE //
2575 // The miniport adapter structure
2577 typedef struct _RTMP_ADAPTER
2579 PVOID OS_Cookie; // save specific structure relative to OS
2580 PNET_DEV net_dev;
2581 ULONG VirtualIfCnt;
2583 #ifdef RT2860
2584 USHORT LnkCtrlBitMask;
2585 USHORT RLnkCtrlConfiguration;
2586 USHORT RLnkCtrlOffset;
2587 USHORT HostLnkCtrlConfiguration;
2588 USHORT HostLnkCtrlOffset;
2589 USHORT PCIePowerSaveLevel;
2590 BOOLEAN bPCIclkOff; // flag that indicate if the PICE power status in Configuration SPace..
2591 ULONG CheckDmaBusyCount; // Check Interrupt Status Register Count.
2592 USHORT ThisTbttNumToNextWakeUp;
2593 ULONG SameRxByteCount;
2596 /*****************************************************************************************/
2597 /* PCI related parameters */
2598 /*****************************************************************************************/
2599 PUCHAR CSRBaseAddress; // PCI MMIO Base Address, all access will use
2601 UINT int_enable_reg;
2602 UINT int_disable_mask;
2603 UINT int_pending;
2606 RTMP_DMABUF TxBufSpace[NUM_OF_TX_RING]; // Shared memory of all 1st pre-allocated TxBuf associated with each TXD
2607 RTMP_DMABUF RxDescRing; // Shared memory for RX descriptors
2608 RTMP_DMABUF TxDescRing[NUM_OF_TX_RING]; // Shared memory for Tx descriptors
2609 RTMP_TX_RING TxRing[NUM_OF_TX_RING]; // AC0~4 + HCCA
2610 #endif
2612 NDIS_SPIN_LOCK irq_lock;
2613 UCHAR irq_disabled;
2615 #ifdef RT2870
2616 /*****************************************************************************************/
2617 /* USB related parameters */
2618 /*****************************************************************************************/
2619 struct usb_config_descriptor *config;
2620 UINT BulkInEpAddr; // bulk-in endpoint address
2621 UINT BulkOutEpAddr[6]; // bulk-out endpoint address
2623 UINT NumberOfPipes;
2624 USHORT BulkOutMaxPacketSize;
2625 USHORT BulkInMaxPacketSize;
2627 //======Control Flags
2628 LONG PendingIoCount;
2629 ULONG BulkFlags;
2630 BOOLEAN bUsbTxBulkAggre; // Flags for bulk out data priority
2633 //======Timer Thread
2634 RT2870_TIMER_QUEUE TimerQ;
2635 NDIS_SPIN_LOCK TimerQLock;
2638 //======Cmd Thread
2639 CmdQ CmdQ;
2640 NDIS_SPIN_LOCK CmdQLock; // CmdQLock spinlock
2642 BOOLEAN TimerFunc_kill;
2643 BOOLEAN mlme_kill;
2646 //======Semaphores (event)
2647 struct semaphore mlme_semaphore; /* to sleep thread on */
2648 struct semaphore RTUSBCmd_semaphore; /* to sleep thread on */
2649 struct semaphore RTUSBTimer_semaphore;
2650 struct completion TimerQComplete;
2651 struct completion mlmeComplete;
2652 struct completion CmdQComplete;
2653 wait_queue_head_t *wait;
2654 #endif // RT2870 //
2657 /*****************************************************************************************/
2658 /* Both PCI/USB related parameters */
2659 /*****************************************************************************************/
2662 /*****************************************************************************************/
2663 /* Tx related parameters */
2664 /*****************************************************************************************/
2665 BOOLEAN DeQueueRunning[NUM_OF_TX_RING]; // for ensuring RTUSBDeQueuePacket get call once
2666 NDIS_SPIN_LOCK DeQueueLock[NUM_OF_TX_RING];
2668 #ifdef RT2870
2669 // Data related context and AC specified, 4 AC supported
2670 NDIS_SPIN_LOCK BulkOutLock[6]; // BulkOut spinlock for 4 ACs
2671 NDIS_SPIN_LOCK MLMEBulkOutLock; // MLME BulkOut lock
2673 HT_TX_CONTEXT TxContext[NUM_OF_TX_RING];
2674 NDIS_SPIN_LOCK TxContextQueueLock[NUM_OF_TX_RING]; // TxContextQueue spinlock
2676 // 4 sets of Bulk Out index and pending flag
2677 UCHAR NextBulkOutIndex[4]; // only used for 4 EDCA bulkout pipe
2679 BOOLEAN BulkOutPending[6]; // used for total 6 bulkout pipe
2680 UCHAR bulkResetPipeid;
2681 BOOLEAN MgmtBulkPending;
2682 ULONG bulkResetReq[6];
2683 #endif // RT2870 //
2685 // resource for software backlog queues
2686 QUEUE_HEADER TxSwQueue[NUM_OF_TX_RING]; // 4 AC + 1 HCCA
2687 NDIS_SPIN_LOCK TxSwQueueLock[NUM_OF_TX_RING]; // TxSwQueue spinlock
2689 RTMP_DMABUF MgmtDescRing; // Shared memory for MGMT descriptors
2690 RTMP_MGMT_RING MgmtRing;
2691 NDIS_SPIN_LOCK MgmtRingLock; // Prio Ring spinlock
2694 /*****************************************************************************************/
2695 /* Rx related parameters */
2696 /*****************************************************************************************/
2697 #ifdef RT2860
2698 RTMP_RX_RING RxRing;
2699 NDIS_SPIN_LOCK RxRingLock; // Rx Ring spinlock
2700 #endif
2701 #ifdef RT2870
2702 RX_CONTEXT RxContext[RX_RING_SIZE]; // 1 for redundant multiple IRP bulk in.
2703 NDIS_SPIN_LOCK BulkInLock; // BulkIn spinlock for 4 ACs
2704 UCHAR PendingRx; // The Maxima pending Rx value should be RX_RING_SIZE.
2705 UCHAR NextRxBulkInIndex; // Indicate the current RxContext Index which hold by Host controller.
2706 UCHAR NextRxBulkInReadIndex; // Indicate the current RxContext Index which driver can read & process it.
2707 ULONG NextRxBulkInPosition; // Want to contatenate 2 URB buffer while 1st is bulkin failed URB. This Position is 1st URB TransferLength.
2708 ULONG TransferBufferLength; // current length of the packet buffer
2709 ULONG ReadPosition; // current read position in a packet buffer
2710 #endif // RT2870 //
2713 /*****************************************************************************************/
2714 /* ASIC related parameters */
2715 /*****************************************************************************************/
2716 UINT32 MACVersion; // MAC version. Record rt2860C(0x28600100) or rt2860D (0x28600101)..
2718 // ---------------------------
2719 // E2PROM
2720 // ---------------------------
2721 ULONG EepromVersion; // byte 0: version, byte 1: revision, byte 2~3: unused
2722 UCHAR EEPROMAddressNum; // 93c46=6 93c66=8
2723 USHORT EEPROMDefaultValue[NUM_EEPROM_BBP_PARMS];
2724 #ifdef RT30xx
2725 BOOLEAN EepromAccess;
2726 UCHAR EFuseTag;
2727 #endif
2728 ULONG FirmwareVersion; // byte 0: Minor version, byte 1: Major version, otherwise unused.
2730 // ---------------------------
2731 // BBP Control
2732 // ---------------------------
2733 UCHAR BbpWriteLatch[140]; // record last BBP register value written via BBP_IO_WRITE/BBP_IO_WRITE_VY_REG_ID
2734 UCHAR BbpRssiToDbmDelta;
2735 BBP_R66_TUNING BbpTuning;
2737 // ----------------------------
2738 // RFIC control
2739 // ----------------------------
2740 UCHAR RfIcType; // RFIC_xxx
2741 ULONG RfFreqOffset; // Frequency offset for channel switching
2742 RTMP_RF_REGS LatchRfRegs; // latch th latest RF programming value since RF IC doesn't support READ
2744 EEPROM_ANTENNA_STRUC Antenna; // Since ANtenna definition is different for a & g. We need to save it for future reference.
2745 EEPROM_NIC_CONFIG2_STRUC NicConfig2;
2747 // This soft Rx Antenna Diversity mechanism is used only when user set
2748 // RX Antenna = DIVERSITY ON
2749 SOFT_RX_ANT_DIVERSITY RxAnt;
2751 UCHAR RFProgSeq;
2752 CHANNEL_TX_POWER TxPower[MAX_NUM_OF_CHANNELS]; // Store Tx power value for all channels.
2753 CHANNEL_TX_POWER ChannelList[MAX_NUM_OF_CHANNELS]; // list all supported channels for site survey
2754 CHANNEL_11J_TX_POWER TxPower11J[MAX_NUM_OF_11JCHANNELS]; // 802.11j channel and bw
2755 CHANNEL_11J_TX_POWER ChannelList11J[MAX_NUM_OF_11JCHANNELS]; // list all supported channels for site survey
2757 UCHAR ChannelListNum; // number of channel in ChannelList[]
2758 UCHAR Bbp94;
2759 BOOLEAN BbpForCCK;
2760 ULONG Tx20MPwrCfgABand[5];
2761 ULONG Tx20MPwrCfgGBand[5];
2762 ULONG Tx40MPwrCfgABand[5];
2763 ULONG Tx40MPwrCfgGBand[5];
2765 BOOLEAN bAutoTxAgcA; // Enable driver auto Tx Agc control
2766 UCHAR TssiRefA; // Store Tssi reference value as 25 temperature.
2767 UCHAR TssiPlusBoundaryA[5]; // Tssi boundary for increase Tx power to compensate.
2768 UCHAR TssiMinusBoundaryA[5]; // Tssi boundary for decrease Tx power to compensate.
2769 UCHAR TxAgcStepA; // Store Tx TSSI delta increment / decrement value
2770 CHAR TxAgcCompensateA; // Store the compensation (TxAgcStep * (idx-1))
2772 BOOLEAN bAutoTxAgcG; // Enable driver auto Tx Agc control
2773 UCHAR TssiRefG; // Store Tssi reference value as 25 temperature.
2774 UCHAR TssiPlusBoundaryG[5]; // Tssi boundary for increase Tx power to compensate.
2775 UCHAR TssiMinusBoundaryG[5]; // Tssi boundary for decrease Tx power to compensate.
2776 UCHAR TxAgcStepG; // Store Tx TSSI delta increment / decrement value
2777 CHAR TxAgcCompensateG; // Store the compensation (TxAgcStep * (idx-1))
2779 //+++For RT2870, the parameteres is start from BGRssiOffset1 ~ BGRssiOffset3
2780 CHAR BGRssiOffset0; // Store B/G RSSI#0 Offset value on EEPROM 0x46h
2781 CHAR BGRssiOffset1; // Store B/G RSSI#1 Offset value
2782 CHAR BGRssiOffset2; // Store B/G RSSI#2 Offset value
2783 //---
2785 //+++For RT2870, the parameteres is start from ARssiOffset1 ~ ARssiOffset3
2786 CHAR ARssiOffset0; // Store A RSSI#0 Offset value on EEPROM 0x4Ah
2787 CHAR ARssiOffset1; // Store A RSSI#1 Offset value
2788 CHAR ARssiOffset2; // Store A RSSI#2 Offset value
2789 //---
2791 CHAR BLNAGain; // Store B/G external LNA#0 value on EEPROM 0x44h
2792 CHAR ALNAGain0; // Store A external LNA#0 value for ch36~64
2793 CHAR ALNAGain1; // Store A external LNA#1 value for ch100~128
2794 CHAR ALNAGain2; // Store A external LNA#2 value for ch132~165
2796 // ----------------------------
2797 // LED control
2798 // ----------------------------
2799 MCU_LEDCS_STRUC LedCntl;
2800 USHORT Led1; // read from EEPROM 0x3c
2801 USHORT Led2; // EEPROM 0x3e
2802 USHORT Led3; // EEPROM 0x40
2803 UCHAR LedIndicatorStregth;
2804 UCHAR RssiSingalstrengthOffet;
2805 BOOLEAN bLedOnScanning;
2806 UCHAR LedStatus;
2808 /*****************************************************************************************/
2809 /* 802.11 related parameters */
2810 /*****************************************************************************************/
2811 // outgoing BEACON frame buffer and corresponding TXD
2812 TXWI_STRUC BeaconTxWI;
2813 PUCHAR BeaconBuf;
2814 USHORT BeaconOffset[HW_BEACON_MAX_COUNT];
2816 // pre-build PS-POLL and NULL frame upon link up. for efficiency purpose.
2817 PSPOLL_FRAME PsPollFrame;
2818 HEADER_802_11 NullFrame;
2820 #ifdef RT2870
2821 TX_CONTEXT BeaconContext[BEACON_RING_SIZE];
2822 TX_CONTEXT NullContext;
2823 TX_CONTEXT PsPollContext;
2824 TX_CONTEXT RTSContext;
2825 #endif // RT2870 //
2829 //=========AP===========
2832 //=======STA===========
2833 /* Modified by Wu Xi-Kun 4/21/2006 */
2834 // -----------------------------------------------
2835 // STA specific configuration & operation status
2836 // used only when pAd->OpMode == OPMODE_STA
2837 // -----------------------------------------------
2838 STA_ADMIN_CONFIG StaCfg; // user desired settings
2839 STA_ACTIVE_CONFIG StaActive; // valid only when ADHOC_ON(pAd) || INFRA_ON(pAd)
2840 CHAR nickname[IW_ESSID_MAX_SIZE+1]; // nickname, only used in the iwconfig i/f
2841 NDIS_MEDIA_STATE PreMediaState;
2843 //=======Common===========
2844 // OP mode: either AP or STA
2845 UCHAR OpMode; // OPMODE_STA, OPMODE_AP
2847 NDIS_MEDIA_STATE IndicateMediaState; // Base on Indication state, default is NdisMediaStateDisConnected
2850 // configuration: read from Registry & E2PROM
2851 BOOLEAN bLocalAdminMAC; // Use user changed MAC
2852 UCHAR PermanentAddress[MAC_ADDR_LEN]; // Factory default MAC address
2853 UCHAR CurrentAddress[MAC_ADDR_LEN]; // User changed MAC address
2855 // ------------------------------------------------------
2856 // common configuration to both OPMODE_STA and OPMODE_AP
2857 // ------------------------------------------------------
2858 COMMON_CONFIG CommonCfg;
2859 MLME_STRUCT Mlme;
2861 // AP needs those vaiables for site survey feature.
2862 MLME_AUX MlmeAux; // temporary settings used during MLME state machine
2863 BSS_TABLE ScanTab; // store the latest SCAN result
2865 //About MacTab, the sta driver will use #0 and #1 for multicast and AP.
2866 MAC_TABLE MacTab; // ASIC on-chip WCID entry table. At TX, ASIC always use key according to this on-chip table.
2867 NDIS_SPIN_LOCK MacTabLock;
2869 BA_TABLE BATable;
2871 NDIS_SPIN_LOCK BATabLock;
2872 RALINK_TIMER_STRUCT RECBATimer;
2874 // encryption/decryption KEY tables
2875 CIPHER_KEY SharedKey[MAX_MBSSID_NUM][4]; // STA always use SharedKey[BSS0][0..3]
2877 // RX re-assembly buffer for fragmentation
2878 FRAGMENT_FRAME FragFrame; // Frame storage for fragment frame
2880 // various Counters
2881 COUNTER_802_3 Counters8023; // 802.3 counters
2882 COUNTER_802_11 WlanCounters; // 802.11 MIB counters
2883 COUNTER_RALINK RalinkCounters; // Ralink propriety counters
2884 COUNTER_DRS DrsCounters; // counters for Dynamic TX Rate Switching
2885 PRIVATE_STRUC PrivateInfo; // Private information & counters
2887 // flags, see fRTMP_ADAPTER_xxx flags
2888 ULONG Flags; // Represent current device status
2889 #ifdef RT2860
2890 ULONG PSFlags; // Power Save operation flag.
2891 #endif
2893 // current TX sequence #
2894 USHORT Sequence;
2896 // Control disconnect / connect event generation
2897 //+++Didn't used anymore
2898 ULONG LinkDownTime;
2899 //---
2900 ULONG LastRxRate;
2901 ULONG LastTxRate;
2902 //+++Used only for Station
2903 BOOLEAN bConfigChanged; // Config Change flag for the same SSID setting
2904 //---
2906 ULONG ExtraInfo; // Extra information for displaying status
2907 ULONG SystemErrorBitmap; // b0: E2PROM version error
2909 //+++Didn't used anymore
2910 ULONG MacIcVersion; // MAC/BBP serial interface issue solved after ver.D
2911 //---
2913 // ---------------------------
2914 // System event log
2915 // ---------------------------
2916 RT_802_11_EVENT_TABLE EventTab;
2919 BOOLEAN HTCEnable;
2921 /*****************************************************************************************/
2922 /* Statistic related parameters */
2923 /*****************************************************************************************/
2924 #ifdef RT2870
2925 ULONG BulkOutDataOneSecCount;
2926 ULONG BulkInDataOneSecCount;
2927 ULONG BulkLastOneSecCount; // BulkOutDataOneSecCount + BulkInDataOneSecCount
2928 ULONG watchDogRxCnt;
2929 ULONG watchDogRxOverFlowCnt;
2930 ULONG watchDogTxPendingCnt[NUM_OF_TX_RING];
2931 #endif // RT2870 //
2933 BOOLEAN bUpdateBcnCntDone;
2934 ULONG watchDogMacDeadlock; // prevent MAC/BBP into deadlock condition
2935 // ----------------------------
2936 // DEBUG paramerts
2937 // ----------------------------
2938 BOOLEAN bBanAllBaSetup;
2939 BOOLEAN bPromiscuous;
2941 // ----------------------------
2942 // rt2860c emulation-use Parameters
2943 // ----------------------------
2944 ULONG rtsaccu[30];
2945 ULONG ctsaccu[30];
2946 ULONG cfendaccu[30];
2947 ULONG bacontent[16];
2948 ULONG rxint[RX_RING_SIZE+1];
2949 UCHAR rcvba[60];
2950 BOOLEAN bLinkAdapt;
2951 BOOLEAN bForcePrintTX;
2952 BOOLEAN bForcePrintRX;
2953 BOOLEAN bDisablescanning; //defined in RT2870 USB
2954 BOOLEAN bStaFifoTest;
2955 BOOLEAN bProtectionTest;
2956 BOOLEAN bHCCATest;
2957 BOOLEAN bGenOneHCCA;
2958 BOOLEAN bBroadComHT;
2959 //+++Following add from RT2870 USB.
2960 ULONG BulkOutReq;
2961 ULONG BulkOutComplete;
2962 ULONG BulkOutCompleteOther;
2963 ULONG BulkOutCompleteCancel; // seems not use now?
2964 ULONG BulkInReq;
2965 ULONG BulkInComplete;
2966 ULONG BulkInCompleteFail;
2967 //---
2969 struct wificonf WIFItestbed;
2971 struct reordering_mpdu_pool mpdu_blk_pool;
2973 ULONG OneSecondnonBEpackets; // record non BE packets per second
2975 #if WIRELESS_EXT >= 12
2976 struct iw_statistics iw_stats;
2977 #endif
2979 struct net_device_stats stats;
2981 ULONG TbttTickCount;
2982 #ifdef PCI_MSI_SUPPORT
2983 BOOLEAN HaveMsi;
2984 #endif // PCI_MSI_SUPPORT //
2987 UCHAR is_on;
2989 #define TIME_BASE (1000000/OS_HZ)
2990 #define TIME_ONE_SECOND (1000000/TIME_BASE)
2991 UCHAR flg_be_adjust;
2992 ULONG be_adjust_last_time;
2994 #ifdef IKANOS_VX_1X0
2995 struct IKANOS_TX_INFO IkanosTxInfo;
2996 struct IKANOS_TX_INFO IkanosRxInfo[MAX_MBSSID_NUM + MAX_WDS_ENTRY + MAX_APCLI_NUM + MAX_MESH_NUM];
2997 #endif // IKANOS_VX_1X0 //
3000 #ifdef DBG_DIAGNOSE
3001 RtmpDiagStruct DiagStruct;
3002 #endif // DBG_DIAGNOSE //
3005 UINT8 PM_FlgSuspend;
3007 #ifdef RT30xx
3008 //======efuse
3009 BOOLEAN bUseEfuse;
3010 BOOLEAN bEEPROMFile;
3011 #endif // RT30xx //
3013 } RTMP_ADAPTER, *PRTMP_ADAPTER;
3016 // Cisco IAPP format
3018 typedef struct _CISCO_IAPP_CONTENT_
3020 USHORT Length; //IAPP Length
3021 UCHAR MessageType; //IAPP type
3022 UCHAR FunctionCode; //IAPP function type
3023 UCHAR DestinaionMAC[MAC_ADDR_LEN];
3024 UCHAR SourceMAC[MAC_ADDR_LEN];
3025 USHORT Tag; //Tag(element IE) - Adjacent AP report
3026 USHORT TagLength; //Length of element not including 4 byte header
3027 UCHAR OUI[4]; //0x00, 0x40, 0x96, 0x00
3028 UCHAR PreviousAP[MAC_ADDR_LEN]; //MAC Address of access point
3029 USHORT Channel;
3030 USHORT SsidLen;
3031 UCHAR Ssid[MAX_LEN_OF_SSID];
3032 USHORT Seconds; //Seconds that the client has been disassociated.
3033 } CISCO_IAPP_CONTENT, *PCISCO_IAPP_CONTENT;
3035 #define DELAYINTMASK 0x0003fffb
3036 #define INTMASK 0x0003fffb
3037 #define IndMask 0x0003fffc
3038 #define RxINT 0x00000005 // Delayed Rx or indivi rx
3039 #define TxDataInt 0x000000fa // Delayed Tx or indivi tx
3040 #define TxMgmtInt 0x00000102 // Delayed Tx or indivi tx
3041 #define TxCoherent 0x00020000 // tx coherent
3042 #define RxCoherent 0x00010000 // rx coherent
3043 #define McuCommand 0x00000200 // mcu
3044 #define PreTBTTInt 0x00001000 // Pre-TBTT interrupt
3045 #define TBTTInt 0x00000800 // TBTT interrupt
3046 #define GPTimeOutInt 0x00008000 // GPtimeout interrupt
3047 #define AutoWakeupInt 0x00004000 // AutoWakeupInt interrupt
3048 #define FifoStaFullInt 0x00002000 // fifo statistics full interrupt
3051 typedef struct _RX_BLK_
3053 RT28XX_RXD_STRUC RxD;
3054 PRXWI_STRUC pRxWI;
3055 PHEADER_802_11 pHeader;
3056 PNDIS_PACKET pRxPacket;
3057 UCHAR *pData;
3058 USHORT DataSize;
3059 USHORT Flags;
3060 UCHAR UserPriority; // for calculate TKIP MIC using
3061 } RX_BLK;
3064 #define RX_BLK_SET_FLAG(_pRxBlk, _flag) (_pRxBlk->Flags |= _flag)
3065 #define RX_BLK_TEST_FLAG(_pRxBlk, _flag) (_pRxBlk->Flags & _flag)
3066 #define RX_BLK_CLEAR_FLAG(_pRxBlk, _flag) (_pRxBlk->Flags &= ~(_flag))
3069 #define fRX_WDS 0x0001
3070 #define fRX_AMSDU 0x0002
3071 #define fRX_ARALINK 0x0004
3072 #define fRX_HTC 0x0008
3073 #define fRX_PAD 0x0010
3074 #define fRX_AMPDU 0x0020
3075 #define fRX_QOS 0x0040
3076 #define fRX_INFRA 0x0080
3077 #define fRX_EAP 0x0100
3078 #define fRX_MESH 0x0200
3079 #define fRX_APCLI 0x0400
3080 #define fRX_DLS 0x0800
3081 #define fRX_WPI 0x1000
3083 #define LENGTH_AMSDU_SUBFRAMEHEAD 14
3084 #define LENGTH_ARALINK_SUBFRAMEHEAD 14
3085 #define LENGTH_ARALINK_HEADER_FIELD 2
3087 #define TX_UNKOWN_FRAME 0x00
3088 #define TX_MCAST_FRAME 0x01
3089 #define TX_LEGACY_FRAME 0x02
3090 #define TX_AMPDU_FRAME 0x04
3091 #define TX_AMSDU_FRAME 0x08
3092 #define TX_RALINK_FRAME 0x10
3093 #define TX_FRAG_FRAME 0x20
3096 // Currently the sizeof(TX_BLK) is 148 bytes.
3097 typedef struct _TX_BLK_
3099 UCHAR QueIdx;
3100 UCHAR TxFrameType; // Indicate the Transmission type of the all frames in one batch
3101 UCHAR TotalFrameNum; // Total frame number want to send-out in one batch
3102 USHORT TotalFragNum; // Total frame fragments required in one batch
3103 USHORT TotalFrameLen; // Total length of all frames want to send-out in one batch
3105 QUEUE_HEADER TxPacketList;
3106 MAC_TABLE_ENTRY *pMacEntry; // NULL: packet with 802.11 RA field is multicast/broadcast address
3107 HTTRANSMIT_SETTING *pTransmit;
3109 // Following structure used for the characteristics of a specific packet.
3110 PNDIS_PACKET pPacket;
3111 PUCHAR pSrcBufHeader; // Reference to the head of sk_buff->data
3112 PUCHAR pSrcBufData; // Reference to the sk_buff->data, will changed depends on hanlding progresss
3113 UINT SrcBufLen; // Length of packet payload which not including Layer 2 header
3114 PUCHAR pExtraLlcSnapEncap; // NULL means no extra LLC/SNAP is required
3115 UCHAR HeaderBuf[80]; // TempBuffer for TX_INFO + TX_WI + 802.11 Header + padding + AMSDU SubHeader + LLC/SNAP
3116 UCHAR MpduHeaderLen; // 802.11 header length NOT including the padding
3117 UCHAR HdrPadLen; // recording Header Padding Length;
3118 UCHAR apidx; // The interface associated to this packet
3119 UCHAR Wcid; // The MAC entry associated to this packet
3120 UCHAR UserPriority; // priority class of packet
3121 UCHAR FrameGap; // what kind of IFS this packet use
3122 UCHAR MpduReqNum; // number of fragments of this frame
3123 UCHAR TxRate; // TODO: Obsoleted? Should change to MCS?
3124 UCHAR CipherAlg; // cipher alogrithm
3125 PCIPHER_KEY pKey;
3129 USHORT Flags; //See following definitions for detail.
3131 //YOU SHOULD NOT TOUCH IT! Following parameters are used for hardware-depended layer.
3132 ULONG Priv; // Hardware specific value saved in here.
3133 } TX_BLK, *PTX_BLK;
3136 #define fTX_bRtsRequired 0x0001 // Indicate if need send RTS frame for protection. Not used in RT2860/RT2870.
3137 #define fTX_bAckRequired 0x0002 // the packet need ack response
3138 #define fTX_bPiggyBack 0x0004 // Legacy device use Piggback or not
3139 #define fTX_bHTRate 0x0008 // allow to use HT rate
3140 #define fTX_bForceNonQoS 0x0010 // force to transmit frame without WMM-QoS in HT mode
3141 #define fTX_bAllowFrag 0x0020 // allow to fragment the packet, A-MPDU, A-MSDU, A-Ralink is not allowed to fragment
3142 #define fTX_bMoreData 0x0040 // there are more data packets in PowerSave Queue
3143 #define fTX_bWMM 0x0080 // QOS Data
3145 #define fTX_bClearEAPFrame 0x0100
3147 #define TX_BLK_ASSIGN_FLAG(_pTxBlk, _flag, value) \
3148 do { \
3149 if (value) \
3150 (_pTxBlk->Flags |= _flag) \
3151 else \
3152 (_pTxBlk->Flags &= ~(_flag)) \
3153 }while(0)
3155 #define TX_BLK_SET_FLAG(_pTxBlk, _flag) (_pTxBlk->Flags |= _flag)
3156 #define TX_BLK_TEST_FLAG(_pTxBlk, _flag) (((_pTxBlk->Flags & _flag) == _flag) ? 1 : 0)
3157 #define TX_BLK_CLEAR_FLAG(_pTxBlk, _flag) (_pTxBlk->Flags &= ~(_flag))
3163 //------------------------------------------------------------------------------------------
3165 #ifdef RT2860
3167 // Enable & Disable NIC interrupt via writing interrupt mask register
3168 // Since it use ADAPTER structure, it have to be put after structure definition.
3170 __inline VOID NICDisableInterrupt(
3171 IN PRTMP_ADAPTER pAd)
3173 RTMP_IO_WRITE32(pAd, INT_MASK_CSR, 0x0); // 0: disable
3174 //RTMP_IO_WRITE32(pAd, PBF_INT_ENA, 0x0); // 0x418 is for firmware . SW doesn't handle here.
3175 RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE);
3178 __inline VOID NICEnableInterrupt(
3179 IN PRTMP_ADAPTER pAd)
3182 // Flag "fOP_STATUS_DOZE" On, means ASIC put to sleep, else means ASIC WakeUp
3183 // To prevent System hang, we should enalbe the interrupt when
3184 // ASIC is already Wake Up.
3186 // RT2661 => when ASIC is sleeping, MAC register cannot be read and written.
3187 // RT2860 => when ASIC is sleeping, MAC register can be read and written.
3188 //if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE))
3190 RTMP_IO_WRITE32(pAd, INT_MASK_CSR, pAd->int_enable_reg /*DELAYINTMASK*/); // 1:enable
3192 //else
3193 // DBGPRINT(RT_DEBUG_TRACE, ("fOP_STATUS_DOZE !\n"));
3195 //RTMP_IO_WRITE32(pAd, PBF_INT_ENA, 0x00000030); // 1 : enable
3196 RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE);
3199 static inline VOID ConvertMulticastIP2MAC(
3200 IN PUCHAR pIpAddr,
3201 IN PUCHAR *ppMacAddr,
3202 IN UINT16 ProtoType)
3204 if (pIpAddr == NULL)
3205 return;
3207 if (ppMacAddr == NULL || *ppMacAddr == NULL)
3208 return;
3210 switch (ProtoType)
3212 case ETH_P_IPV6:
3213 // memset(*ppMacAddr, 0, ETH_LENGTH_OF_ADDRESS);
3214 *(*ppMacAddr) = 0x33;
3215 *(*ppMacAddr + 1) = 0x33;
3216 *(*ppMacAddr + 2) = pIpAddr[12];
3217 *(*ppMacAddr + 3) = pIpAddr[13];
3218 *(*ppMacAddr + 4) = pIpAddr[14];
3219 *(*ppMacAddr + 5) = pIpAddr[15];
3220 break;
3222 case ETH_P_IP:
3223 default:
3224 // memset(*ppMacAddr, 0, ETH_LENGTH_OF_ADDRESS);
3225 *(*ppMacAddr) = 0x01;
3226 *(*ppMacAddr + 1) = 0x00;
3227 *(*ppMacAddr + 2) = 0x5e;
3228 *(*ppMacAddr + 3) = pIpAddr[1] & 0x7f;
3229 *(*ppMacAddr + 4) = pIpAddr[2];
3230 *(*ppMacAddr + 5) = pIpAddr[3];
3231 break;
3234 return;
3236 #endif /* RT2860 */
3238 BOOLEAN RTMPCheckForHang(
3239 IN NDIS_HANDLE MiniportAdapterContext
3242 VOID RTMPHalt(
3243 IN NDIS_HANDLE MiniportAdapterContext
3247 // Private routines in rtmp_init.c
3249 NDIS_STATUS RTMPAllocAdapterBlock(
3250 IN PVOID handle,
3251 OUT PRTMP_ADAPTER *ppAdapter
3254 NDIS_STATUS RTMPAllocTxRxRingMemory(
3255 IN PRTMP_ADAPTER pAd
3258 NDIS_STATUS RTMPFindAdapter(
3259 IN PRTMP_ADAPTER pAd,
3260 IN NDIS_HANDLE WrapperConfigurationContext
3263 NDIS_STATUS RTMPReadParametersHook(
3264 IN PRTMP_ADAPTER pAd
3267 VOID RTMPFreeAdapter(
3268 IN PRTMP_ADAPTER pAd
3271 NDIS_STATUS NICReadRegParameters(
3272 IN PRTMP_ADAPTER pAd,
3273 IN NDIS_HANDLE WrapperConfigurationContext
3276 #ifdef RT2870
3277 VOID NICInitRT30xxRFRegisters(
3278 IN PRTMP_ADAPTER pAd);
3279 #endif // RT2870 //
3281 VOID NICReadEEPROMParameters(
3282 IN PRTMP_ADAPTER pAd,
3283 IN PUCHAR mac_addr);
3285 VOID NICInitAsicFromEEPROM(
3286 IN PRTMP_ADAPTER pAd);
3288 VOID NICInitTxRxRingAndBacklogQueue(
3289 IN PRTMP_ADAPTER pAd);
3291 NDIS_STATUS NICInitializeAdapter(
3292 IN PRTMP_ADAPTER pAd,
3293 IN BOOLEAN bHardReset);
3295 NDIS_STATUS NICInitializeAsic(
3296 IN PRTMP_ADAPTER pAd,
3297 IN BOOLEAN bHardReset);
3298 #ifdef RT2860
3299 VOID NICRestoreBBPValue(
3300 IN PRTMP_ADAPTER pAd);
3301 #endif
3302 VOID NICIssueReset(
3303 IN PRTMP_ADAPTER pAd);
3305 VOID RTMPRingCleanUp(
3306 IN PRTMP_ADAPTER pAd,
3307 IN UCHAR RingType);
3309 VOID RxTest(
3310 IN PRTMP_ADAPTER pAd);
3312 NDIS_STATUS DbgSendPacket(
3313 IN PRTMP_ADAPTER pAd,
3314 IN PNDIS_PACKET pPacket);
3316 VOID UserCfgInit(
3317 IN PRTMP_ADAPTER pAd);
3319 VOID NICResetFromError(
3320 IN PRTMP_ADAPTER pAd);
3322 VOID NICEraseFirmware(
3323 IN PRTMP_ADAPTER pAd);
3325 NDIS_STATUS NICLoadFirmware(
3326 IN PRTMP_ADAPTER pAd);
3328 NDIS_STATUS NICLoadRateSwitchingParams(
3329 IN PRTMP_ADAPTER pAd);
3331 BOOLEAN NICCheckForHang(
3332 IN PRTMP_ADAPTER pAd);
3334 VOID NICUpdateFifoStaCounters(
3335 IN PRTMP_ADAPTER pAd);
3337 VOID NICUpdateRawCounters(
3338 IN PRTMP_ADAPTER pAd);
3340 ULONG RTMPNotAllZero(
3341 IN PVOID pSrc1,
3342 IN ULONG Length);
3344 VOID RTMPZeroMemory(
3345 IN PVOID pSrc,
3346 IN ULONG Length);
3348 ULONG RTMPCompareMemory(
3349 IN PVOID pSrc1,
3350 IN PVOID pSrc2,
3351 IN ULONG Length);
3353 VOID RTMPMoveMemory(
3354 OUT PVOID pDest,
3355 IN PVOID pSrc,
3356 IN ULONG Length);
3358 VOID AtoH(
3359 char *src,
3360 UCHAR *dest,
3361 int destlen);
3363 UCHAR BtoH(
3364 char ch);
3366 VOID RTMPPatchMacBbpBug(
3367 IN PRTMP_ADAPTER pAd);
3369 VOID RTMPPatchCardBus(
3370 IN PRTMP_ADAPTER pAdapter);
3372 VOID RTMPPatchRalinkCardBus(
3373 IN PRTMP_ADAPTER pAdapter,
3374 IN ULONG Bus);
3376 ULONG RTMPReadCBConfig(
3377 IN ULONG Bus,
3378 IN ULONG Slot,
3379 IN ULONG Func,
3380 IN ULONG Offset);
3382 VOID RTMPWriteCBConfig(
3383 IN ULONG Bus,
3384 IN ULONG Slot,
3385 IN ULONG Func,
3386 IN ULONG Offset,
3387 IN ULONG Value);
3389 VOID RTMPInitTimer(
3390 IN PRTMP_ADAPTER pAd,
3391 IN PRALINK_TIMER_STRUCT pTimer,
3392 IN PVOID pTimerFunc,
3393 IN PVOID pData,
3394 IN BOOLEAN Repeat);
3396 VOID RTMPSetTimer(
3397 IN PRALINK_TIMER_STRUCT pTimer,
3398 IN ULONG Value);
3401 VOID RTMPModTimer(
3402 IN PRALINK_TIMER_STRUCT pTimer,
3403 IN ULONG Value);
3405 VOID RTMPCancelTimer(
3406 IN PRALINK_TIMER_STRUCT pTimer,
3407 OUT BOOLEAN *pCancelled);
3409 VOID RTMPSetLED(
3410 IN PRTMP_ADAPTER pAd,
3411 IN UCHAR Status);
3413 VOID RTMPSetSignalLED(
3414 IN PRTMP_ADAPTER pAd,
3415 IN NDIS_802_11_RSSI Dbm);
3417 VOID RTMPEnableRxTx(
3418 IN PRTMP_ADAPTER pAd);
3421 // prototype in action.c
3423 VOID ActionStateMachineInit(
3424 IN PRTMP_ADAPTER pAd,
3425 IN STATE_MACHINE *S,
3426 OUT STATE_MACHINE_FUNC Trans[]);
3428 VOID MlmeADDBAAction(
3429 IN PRTMP_ADAPTER pAd,
3430 IN MLME_QUEUE_ELEM *Elem);
3432 VOID MlmeDELBAAction(
3433 IN PRTMP_ADAPTER pAd,
3434 IN MLME_QUEUE_ELEM *Elem);
3436 VOID MlmeDLSAction(
3437 IN PRTMP_ADAPTER pAd,
3438 IN MLME_QUEUE_ELEM *Elem);
3440 VOID MlmeInvalidAction(
3441 IN PRTMP_ADAPTER pAd,
3442 IN MLME_QUEUE_ELEM *Elem);
3444 VOID MlmeQOSAction(
3445 IN PRTMP_ADAPTER pAd,
3446 IN MLME_QUEUE_ELEM *Elem);
3448 VOID PeerAddBAReqAction(
3449 IN PRTMP_ADAPTER pAd,
3450 IN MLME_QUEUE_ELEM *Elem);
3452 VOID PeerAddBARspAction(
3453 IN PRTMP_ADAPTER pAd,
3454 IN MLME_QUEUE_ELEM *Elem);
3456 VOID PeerDelBAAction(
3457 IN PRTMP_ADAPTER pAd,
3458 IN MLME_QUEUE_ELEM *Elem);
3460 VOID PeerBAAction(
3461 IN PRTMP_ADAPTER pAd,
3462 IN MLME_QUEUE_ELEM *Elem);
3464 VOID SendPSMPAction(
3465 IN PRTMP_ADAPTER pAd,
3466 IN UCHAR Wcid,
3467 IN UCHAR Psmp);
3469 VOID PeerRMAction(
3470 IN PRTMP_ADAPTER pAd,
3471 IN MLME_QUEUE_ELEM *Elem);
3473 VOID PeerPublicAction(
3474 IN PRTMP_ADAPTER pAd,
3475 IN MLME_QUEUE_ELEM *Elem);
3477 VOID StaPublicAction(
3478 IN PRTMP_ADAPTER pAd,
3479 IN UCHAR Bss2040Coexist);
3481 VOID PeerBSSTranAction(
3482 IN PRTMP_ADAPTER pAd,
3483 IN MLME_QUEUE_ELEM *Elem);
3485 VOID PeerHTAction(
3486 IN PRTMP_ADAPTER pAd,
3487 IN MLME_QUEUE_ELEM *Elem);
3489 VOID PeerQOSAction(
3490 IN PRTMP_ADAPTER pAd,
3491 IN MLME_QUEUE_ELEM *Elem);
3493 VOID RECBATimerTimeout(
3494 IN PVOID SystemSpecific1,
3495 IN PVOID FunctionContext,
3496 IN PVOID SystemSpecific2,
3497 IN PVOID SystemSpecific3);
3499 VOID ORIBATimerTimeout(
3500 IN PRTMP_ADAPTER pAd);
3502 VOID SendRefreshBAR(
3503 IN PRTMP_ADAPTER pAd,
3504 IN MAC_TABLE_ENTRY *pEntry);
3506 VOID ActHeaderInit(
3507 IN PRTMP_ADAPTER pAd,
3508 IN OUT PHEADER_802_11 pHdr80211,
3509 IN PUCHAR Addr1,
3510 IN PUCHAR Addr2,
3511 IN PUCHAR Addr3);
3513 VOID BarHeaderInit(
3514 IN PRTMP_ADAPTER pAd,
3515 IN OUT PFRAME_BAR pCntlBar,
3516 IN PUCHAR pDA,
3517 IN PUCHAR pSA);
3519 VOID InsertActField(
3520 IN PRTMP_ADAPTER pAd,
3521 OUT PUCHAR pFrameBuf,
3522 OUT PULONG pFrameLen,
3523 IN UINT8 Category,
3524 IN UINT8 ActCode);
3526 BOOLEAN QosBADataParse(
3527 IN PRTMP_ADAPTER pAd,
3528 IN BOOLEAN bAMSDU,
3529 IN PUCHAR p8023Header,
3530 IN UCHAR WCID,
3531 IN UCHAR TID,
3532 IN USHORT Sequence,
3533 IN UCHAR DataOffset,
3534 IN USHORT Datasize,
3535 IN UINT CurRxIndex);
3537 BOOLEAN CntlEnqueueForRecv(
3538 IN PRTMP_ADAPTER pAd,
3539 IN ULONG Wcid,
3540 IN ULONG MsgLen,
3541 IN PFRAME_BA_REQ pMsg);
3543 VOID BaAutoManSwitch(
3544 IN PRTMP_ADAPTER pAd);
3546 VOID HTIOTCheck(
3547 IN PRTMP_ADAPTER pAd,
3548 IN UCHAR BatRecIdx);
3551 // Private routines in rtmp_data.c
3553 BOOLEAN RTMPHandleRxDoneInterrupt(
3554 IN PRTMP_ADAPTER pAd);
3556 VOID RTMPHandleTxDoneInterrupt(
3557 IN PRTMP_ADAPTER pAd);
3559 BOOLEAN RTMPHandleTxRingDmaDoneInterrupt(
3560 IN PRTMP_ADAPTER pAd,
3561 IN INT_SOURCE_CSR_STRUC TxRingBitmap);
3563 VOID RTMPHandleMgmtRingDmaDoneInterrupt(
3564 IN PRTMP_ADAPTER pAd);
3566 VOID RTMPHandleTBTTInterrupt(
3567 IN PRTMP_ADAPTER pAd);
3569 VOID RTMPHandlePreTBTTInterrupt(
3570 IN PRTMP_ADAPTER pAd);
3572 void RTMPHandleTwakeupInterrupt(
3573 IN PRTMP_ADAPTER pAd);
3575 VOID RTMPHandleRxCoherentInterrupt(
3576 IN PRTMP_ADAPTER pAd);
3578 BOOLEAN TxFrameIsAggregatible(
3579 IN PRTMP_ADAPTER pAd,
3580 IN PUCHAR pPrevAddr1,
3581 IN PUCHAR p8023hdr);
3583 BOOLEAN PeerIsAggreOn(
3584 IN PRTMP_ADAPTER pAd,
3585 IN ULONG TxRate,
3586 IN PMAC_TABLE_ENTRY pMacEntry);
3588 NDIS_STATUS Sniff2BytesFromNdisBuffer(
3589 IN PNDIS_BUFFER pFirstBuffer,
3590 IN UCHAR DesiredOffset,
3591 OUT PUCHAR pByte0,
3592 OUT PUCHAR pByte1);
3594 NDIS_STATUS STASendPacket(
3595 IN PRTMP_ADAPTER pAd,
3596 IN PNDIS_PACKET pPacket);
3598 VOID STASendPackets(
3599 IN NDIS_HANDLE MiniportAdapterContext,
3600 IN PPNDIS_PACKET ppPacketArray,
3601 IN UINT NumberOfPackets);
3603 VOID RTMPDeQueuePacket(
3604 IN PRTMP_ADAPTER pAd,
3605 IN BOOLEAN bIntContext,
3606 IN UCHAR QueIdx,
3607 IN UCHAR Max_Tx_Packets);
3609 NDIS_STATUS RTMPHardTransmit(
3610 IN PRTMP_ADAPTER pAd,
3611 IN PNDIS_PACKET pPacket,
3612 IN UCHAR QueIdx,
3613 OUT PULONG pFreeTXDLeft);
3615 NDIS_STATUS STAHardTransmit(
3616 IN PRTMP_ADAPTER pAd,
3617 IN TX_BLK *pTxBlk,
3618 IN UCHAR QueIdx);
3620 VOID STARxEAPOLFrameIndicate(
3621 IN PRTMP_ADAPTER pAd,
3622 IN MAC_TABLE_ENTRY *pEntry,
3623 IN RX_BLK *pRxBlk,
3624 IN UCHAR FromWhichBSSID);
3626 NDIS_STATUS RTMPFreeTXDRequest(
3627 IN PRTMP_ADAPTER pAd,
3628 IN UCHAR RingType,
3629 IN UCHAR NumberRequired,
3630 IN PUCHAR FreeNumberIs);
3632 NDIS_STATUS MlmeHardTransmit(
3633 IN PRTMP_ADAPTER pAd,
3634 IN UCHAR QueIdx,
3635 IN PNDIS_PACKET pPacket);
3637 NDIS_STATUS MlmeHardTransmitMgmtRing(
3638 IN PRTMP_ADAPTER pAd,
3639 IN UCHAR QueIdx,
3640 IN PNDIS_PACKET pPacket);
3642 NDIS_STATUS MlmeHardTransmitTxRing(
3643 IN PRTMP_ADAPTER pAd,
3644 IN UCHAR QueIdx,
3645 IN PNDIS_PACKET pPacket);
3647 USHORT RTMPCalcDuration(
3648 IN PRTMP_ADAPTER pAd,
3649 IN UCHAR Rate,
3650 IN ULONG Size);
3652 VOID RTMPWriteTxWI(
3653 IN PRTMP_ADAPTER pAd,
3654 IN PTXWI_STRUC pTxWI,
3655 IN BOOLEAN FRAG,
3656 IN BOOLEAN CFACK,
3657 IN BOOLEAN InsTimestamp,
3658 IN BOOLEAN AMPDU,
3659 IN BOOLEAN Ack,
3660 IN BOOLEAN NSeq, // HW new a sequence.
3661 IN UCHAR BASize,
3662 IN UCHAR WCID,
3663 IN ULONG Length,
3664 IN UCHAR PID,
3665 IN UCHAR TID,
3666 IN UCHAR TxRate,
3667 IN UCHAR Txopmode,
3668 IN BOOLEAN CfAck,
3669 IN HTTRANSMIT_SETTING *pTransmit);
3672 VOID RTMPWriteTxWI_Data(
3673 IN PRTMP_ADAPTER pAd,
3674 IN OUT PTXWI_STRUC pTxWI,
3675 IN TX_BLK *pTxBlk);
3678 VOID RTMPWriteTxWI_Cache(
3679 IN PRTMP_ADAPTER pAd,
3680 IN OUT PTXWI_STRUC pTxWI,
3681 IN TX_BLK *pTxBlk);
3683 VOID RTMPWriteTxDescriptor(
3684 IN PRTMP_ADAPTER pAd,
3685 IN PTXD_STRUC pTxD,
3686 IN BOOLEAN bWIV,
3687 IN UCHAR QSEL);
3689 VOID RTMPSuspendMsduTransmission(
3690 IN PRTMP_ADAPTER pAd);
3692 VOID RTMPResumeMsduTransmission(
3693 IN PRTMP_ADAPTER pAd);
3695 NDIS_STATUS MiniportMMRequest(
3696 IN PRTMP_ADAPTER pAd,
3697 IN UCHAR QueIdx,
3698 IN PUCHAR pData,
3699 IN UINT Length);
3700 #ifdef RT2870
3701 NDIS_STATUS MiniportDataMMRequest(
3702 IN PRTMP_ADAPTER pAd,
3703 IN UCHAR QueIdx,
3704 IN PUCHAR pData,
3705 IN UINT Length);
3706 #endif
3707 VOID RTMPSendNullFrame(
3708 IN PRTMP_ADAPTER pAd,
3709 IN UCHAR TxRate,
3710 IN BOOLEAN bQosNull);
3712 VOID RTMPSendDisassociationFrame(
3713 IN PRTMP_ADAPTER pAd);
3715 VOID RTMPSendRTSFrame(
3716 IN PRTMP_ADAPTER pAd,
3717 IN PUCHAR pDA,
3718 IN unsigned int NextMpduSize,
3719 IN UCHAR TxRate,
3720 IN UCHAR RTSRate,
3721 IN USHORT AckDuration,
3722 IN UCHAR QueIdx,
3723 IN UCHAR FrameGap);
3726 NDIS_STATUS RTMPApplyPacketFilter(
3727 IN PRTMP_ADAPTER pAd,
3728 IN PRT28XX_RXD_STRUC pRxD,
3729 IN PHEADER_802_11 pHeader);
3731 PQUEUE_HEADER RTMPCheckTxSwQueue(
3732 IN PRTMP_ADAPTER pAd,
3733 OUT UCHAR *QueIdx);
3735 VOID RTMPReportMicError(
3736 IN PRTMP_ADAPTER pAd,
3737 IN PCIPHER_KEY pWpaKey);
3739 VOID WpaMicFailureReportFrame(
3740 IN PRTMP_ADAPTER pAd,
3741 IN MLME_QUEUE_ELEM *Elem);
3743 VOID WpaDisassocApAndBlockAssoc(
3744 IN PVOID SystemSpecific1,
3745 IN PVOID FunctionContext,
3746 IN PVOID SystemSpecific2,
3747 IN PVOID SystemSpecific3);
3749 NDIS_STATUS RTMPCloneNdisPacket(
3750 IN PRTMP_ADAPTER pAd,
3751 IN BOOLEAN pInsAMSDUHdr,
3752 IN PNDIS_PACKET pInPacket,
3753 OUT PNDIS_PACKET *ppOutPacket);
3755 NDIS_STATUS RTMPAllocateNdisPacket(
3756 IN PRTMP_ADAPTER pAd,
3757 IN PNDIS_PACKET *pPacket,
3758 IN PUCHAR pHeader,
3759 IN UINT HeaderLen,
3760 IN PUCHAR pData,
3761 IN UINT DataLen);
3763 VOID RTMPFreeNdisPacket(
3764 IN PRTMP_ADAPTER pAd,
3765 IN PNDIS_PACKET pPacket);
3767 BOOLEAN RTMPFreeTXDUponTxDmaDone(
3768 IN PRTMP_ADAPTER pAd,
3769 IN UCHAR QueIdx);
3771 BOOLEAN RTMPCheckDHCPFrame(
3772 IN PRTMP_ADAPTER pAd,
3773 IN PNDIS_PACKET pPacket);
3776 BOOLEAN RTMPCheckEtherType(
3777 IN PRTMP_ADAPTER pAd,
3778 IN PNDIS_PACKET pPacket);
3781 VOID RTMPCckBbpTuning(
3782 IN PRTMP_ADAPTER pAd,
3783 IN UINT TxRate);
3786 // Private routines in rtmp_wep.c
3788 VOID RTMPInitWepEngine(
3789 IN PRTMP_ADAPTER pAd,
3790 IN PUCHAR pKey,
3791 IN UCHAR KeyId,
3792 IN UCHAR KeyLen,
3793 IN PUCHAR pDest);
3795 VOID RTMPEncryptData(
3796 IN PRTMP_ADAPTER pAd,
3797 IN PUCHAR pSrc,
3798 IN PUCHAR pDest,
3799 IN UINT Len);
3801 BOOLEAN RTMPDecryptData(
3802 IN PRTMP_ADAPTER pAdapter,
3803 IN PUCHAR pSrc,
3804 IN UINT Len,
3805 IN UINT idx);
3807 BOOLEAN RTMPSoftDecryptWEP(
3808 IN PRTMP_ADAPTER pAd,
3809 IN PUCHAR pData,
3810 IN ULONG DataByteCnt,
3811 IN PCIPHER_KEY pGroupKey);
3813 VOID RTMPSetICV(
3814 IN PRTMP_ADAPTER pAd,
3815 IN PUCHAR pDest);
3817 VOID ARCFOUR_INIT(
3818 IN PARCFOURCONTEXT Ctx,
3819 IN PUCHAR pKey,
3820 IN UINT KeyLen);
3822 UCHAR ARCFOUR_BYTE(
3823 IN PARCFOURCONTEXT Ctx);
3825 VOID ARCFOUR_DECRYPT(
3826 IN PARCFOURCONTEXT Ctx,
3827 IN PUCHAR pDest,
3828 IN PUCHAR pSrc,
3829 IN UINT Len);
3831 VOID ARCFOUR_ENCRYPT(
3832 IN PARCFOURCONTEXT Ctx,
3833 IN PUCHAR pDest,
3834 IN PUCHAR pSrc,
3835 IN UINT Len);
3837 VOID WPAARCFOUR_ENCRYPT(
3838 IN PARCFOURCONTEXT Ctx,
3839 IN PUCHAR pDest,
3840 IN PUCHAR pSrc,
3841 IN UINT Len);
3843 UINT RTMP_CALC_FCS32(
3844 IN UINT Fcs,
3845 IN PUCHAR Cp,
3846 IN INT Len);
3849 // MLME routines
3852 // Asic/RF/BBP related functions
3854 VOID AsicAdjustTxPower(
3855 IN PRTMP_ADAPTER pAd);
3857 VOID AsicUpdateProtect(
3858 IN PRTMP_ADAPTER pAd,
3859 IN USHORT OperaionMode,
3860 IN UCHAR SetMask,
3861 IN BOOLEAN bDisableBGProtect,
3862 IN BOOLEAN bNonGFExist);
3864 VOID AsicSwitchChannel(
3865 IN PRTMP_ADAPTER pAd,
3866 IN UCHAR Channel,
3867 IN BOOLEAN bScan);
3869 VOID AsicLockChannel(
3870 IN PRTMP_ADAPTER pAd,
3871 IN UCHAR Channel) ;
3873 VOID AsicAntennaSelect(
3874 IN PRTMP_ADAPTER pAd,
3875 IN UCHAR Channel);
3877 VOID AsicAntennaSetting(
3878 IN PRTMP_ADAPTER pAd,
3879 IN ABGBAND_STATE BandState);
3881 VOID AsicRfTuningExec(
3882 IN PVOID SystemSpecific1,
3883 IN PVOID FunctionContext,
3884 IN PVOID SystemSpecific2,
3885 IN PVOID SystemSpecific3);
3887 VOID AsicSleepThenAutoWakeup(
3888 IN PRTMP_ADAPTER pAd,
3889 IN USHORT TbttNumToNextWakeUp);
3891 VOID AsicForceSleep(
3892 IN PRTMP_ADAPTER pAd);
3894 VOID AsicForceWakeup(
3895 IN PRTMP_ADAPTER pAd,
3896 #ifdef RT2860
3897 IN UCHAR Level);
3898 #endif
3899 #ifdef RT2870
3900 IN BOOLEAN bFromTx);
3901 #endif
3903 VOID AsicSetBssid(
3904 IN PRTMP_ADAPTER pAd,
3905 IN PUCHAR pBssid);
3907 VOID AsicSetMcastWC(
3908 IN PRTMP_ADAPTER pAd);
3910 VOID AsicDelWcidTab(
3911 IN PRTMP_ADAPTER pAd,
3912 IN UCHAR Wcid);
3914 VOID AsicEnableRDG(
3915 IN PRTMP_ADAPTER pAd);
3917 VOID AsicDisableRDG(
3918 IN PRTMP_ADAPTER pAd);
3920 VOID AsicDisableSync(
3921 IN PRTMP_ADAPTER pAd);
3923 VOID AsicEnableBssSync(
3924 IN PRTMP_ADAPTER pAd);
3926 VOID AsicEnableIbssSync(
3927 IN PRTMP_ADAPTER pAd);
3929 VOID AsicSetEdcaParm(
3930 IN PRTMP_ADAPTER pAd,
3931 IN PEDCA_PARM pEdcaParm);
3933 VOID AsicSetSlotTime(
3934 IN PRTMP_ADAPTER pAd,
3935 IN BOOLEAN bUseShortSlotTime);
3937 VOID AsicAddSharedKeyEntry(
3938 IN PRTMP_ADAPTER pAd,
3939 IN UCHAR BssIndex,
3940 IN UCHAR KeyIdx,
3941 IN UCHAR CipherAlg,
3942 IN PUCHAR pKey,
3943 IN PUCHAR pTxMic,
3944 IN PUCHAR pRxMic);
3946 VOID AsicRemoveSharedKeyEntry(
3947 IN PRTMP_ADAPTER pAd,
3948 IN UCHAR BssIndex,
3949 IN UCHAR KeyIdx);
3951 VOID AsicUpdateWCIDAttribute(
3952 IN PRTMP_ADAPTER pAd,
3953 IN USHORT WCID,
3954 IN UCHAR BssIndex,
3955 IN UCHAR CipherAlg,
3956 IN BOOLEAN bUsePairewiseKeyTable);
3958 VOID AsicUpdateWCIDIVEIV(
3959 IN PRTMP_ADAPTER pAd,
3960 IN USHORT WCID,
3961 IN ULONG uIV,
3962 IN ULONG uEIV);
3964 VOID AsicUpdateRxWCIDTable(
3965 IN PRTMP_ADAPTER pAd,
3966 IN USHORT WCID,
3967 IN PUCHAR pAddr);
3969 VOID AsicAddKeyEntry(
3970 IN PRTMP_ADAPTER pAd,
3971 IN USHORT WCID,
3972 IN UCHAR BssIndex,
3973 IN UCHAR KeyIdx,
3974 IN PCIPHER_KEY pCipherKey,
3975 IN BOOLEAN bUsePairewiseKeyTable,
3976 IN BOOLEAN bTxKey);
3978 VOID AsicAddPairwiseKeyEntry(
3979 IN PRTMP_ADAPTER pAd,
3980 IN PUCHAR pAddr,
3981 IN UCHAR WCID,
3982 IN CIPHER_KEY *pCipherKey);
3984 VOID AsicRemovePairwiseKeyEntry(
3985 IN PRTMP_ADAPTER pAd,
3986 IN UCHAR BssIdx,
3987 IN UCHAR Wcid);
3989 BOOLEAN AsicSendCommandToMcu(
3990 IN PRTMP_ADAPTER pAd,
3991 IN UCHAR Command,
3992 IN UCHAR Token,
3993 IN UCHAR Arg0,
3994 IN UCHAR Arg1);
3995 #ifdef RT2860
3996 BOOLEAN AsicCheckCommanOk(
3997 IN PRTMP_ADAPTER pAd,
3998 IN UCHAR Command);
3999 #endif
4000 VOID MacAddrRandomBssid(
4001 IN PRTMP_ADAPTER pAd,
4002 OUT PUCHAR pAddr);
4004 VOID MgtMacHeaderInit(
4005 IN PRTMP_ADAPTER pAd,
4006 IN OUT PHEADER_802_11 pHdr80211,
4007 IN UCHAR SubType,
4008 IN UCHAR ToDs,
4009 IN PUCHAR pDA,
4010 IN PUCHAR pBssid);
4012 VOID MlmeRadioOff(
4013 IN PRTMP_ADAPTER pAd);
4015 VOID MlmeRadioOn(
4016 IN PRTMP_ADAPTER pAd);
4019 VOID BssTableInit(
4020 IN BSS_TABLE *Tab);
4022 VOID BATableInit(
4023 IN PRTMP_ADAPTER pAd,
4024 IN BA_TABLE *Tab);
4026 ULONG BssTableSearch(
4027 IN BSS_TABLE *Tab,
4028 IN PUCHAR pBssid,
4029 IN UCHAR Channel);
4031 ULONG BssSsidTableSearch(
4032 IN BSS_TABLE *Tab,
4033 IN PUCHAR pBssid,
4034 IN PUCHAR pSsid,
4035 IN UCHAR SsidLen,
4036 IN UCHAR Channel);
4038 ULONG BssTableSearchWithSSID(
4039 IN BSS_TABLE *Tab,
4040 IN PUCHAR Bssid,
4041 IN PUCHAR pSsid,
4042 IN UCHAR SsidLen,
4043 IN UCHAR Channel);
4045 VOID BssTableDeleteEntry(
4046 IN OUT PBSS_TABLE pTab,
4047 IN PUCHAR pBssid,
4048 IN UCHAR Channel);
4050 VOID BATableDeleteORIEntry(
4051 IN OUT PRTMP_ADAPTER pAd,
4052 IN BA_ORI_ENTRY *pBAORIEntry);
4054 VOID BATableDeleteRECEntry(
4055 IN OUT PRTMP_ADAPTER pAd,
4056 IN BA_REC_ENTRY *pBARECEntry);
4058 VOID BATableTearORIEntry(
4059 IN OUT PRTMP_ADAPTER pAd,
4060 IN UCHAR TID,
4061 IN UCHAR Wcid,
4062 IN BOOLEAN bForceDelete,
4063 IN BOOLEAN ALL);
4065 VOID BATableTearRECEntry(
4066 IN OUT PRTMP_ADAPTER pAd,
4067 IN UCHAR TID,
4068 IN UCHAR WCID,
4069 IN BOOLEAN ALL);
4071 VOID BssEntrySet(
4072 IN PRTMP_ADAPTER pAd,
4073 OUT PBSS_ENTRY pBss,
4074 IN PUCHAR pBssid,
4075 IN CHAR Ssid[],
4076 IN UCHAR SsidLen,
4077 IN UCHAR BssType,
4078 IN USHORT BeaconPeriod,
4079 IN PCF_PARM CfParm,
4080 IN USHORT AtimWin,
4081 IN USHORT CapabilityInfo,
4082 IN UCHAR SupRate[],
4083 IN UCHAR SupRateLen,
4084 IN UCHAR ExtRate[],
4085 IN UCHAR ExtRateLen,
4086 IN HT_CAPABILITY_IE *pHtCapability,
4087 IN ADD_HT_INFO_IE *pAddHtInfo, // AP might use this additional ht info IE
4088 IN UCHAR HtCapabilityLen,
4089 IN UCHAR AddHtInfoLen,
4090 IN UCHAR NewExtChanOffset,
4091 IN UCHAR Channel,
4092 IN CHAR Rssi,
4093 IN LARGE_INTEGER TimeStamp,
4094 IN UCHAR CkipFlag,
4095 IN PEDCA_PARM pEdcaParm,
4096 IN PQOS_CAPABILITY_PARM pQosCapability,
4097 IN PQBSS_LOAD_PARM pQbssLoad,
4098 IN USHORT LengthVIE,
4099 IN PNDIS_802_11_VARIABLE_IEs pVIE);
4101 ULONG BssTableSetEntry(
4102 IN PRTMP_ADAPTER pAd,
4103 OUT PBSS_TABLE pTab,
4104 IN PUCHAR pBssid,
4105 IN CHAR Ssid[],
4106 IN UCHAR SsidLen,
4107 IN UCHAR BssType,
4108 IN USHORT BeaconPeriod,
4109 IN CF_PARM *CfParm,
4110 IN USHORT AtimWin,
4111 IN USHORT CapabilityInfo,
4112 IN UCHAR SupRate[],
4113 IN UCHAR SupRateLen,
4114 IN UCHAR ExtRate[],
4115 IN UCHAR ExtRateLen,
4116 IN HT_CAPABILITY_IE *pHtCapability,
4117 IN ADD_HT_INFO_IE *pAddHtInfo, // AP might use this additional ht info IE
4118 IN UCHAR HtCapabilityLen,
4119 IN UCHAR AddHtInfoLen,
4120 IN UCHAR NewExtChanOffset,
4121 IN UCHAR Channel,
4122 IN CHAR Rssi,
4123 IN LARGE_INTEGER TimeStamp,
4124 IN UCHAR CkipFlag,
4125 IN PEDCA_PARM pEdcaParm,
4126 IN PQOS_CAPABILITY_PARM pQosCapability,
4127 IN PQBSS_LOAD_PARM pQbssLoad,
4128 IN USHORT LengthVIE,
4129 IN PNDIS_802_11_VARIABLE_IEs pVIE);
4131 VOID BATableInsertEntry(
4132 IN PRTMP_ADAPTER pAd,
4133 IN USHORT Aid,
4134 IN USHORT TimeOutValue,
4135 IN USHORT StartingSeq,
4136 IN UCHAR TID,
4137 IN UCHAR BAWinSize,
4138 IN UCHAR OriginatorStatus,
4139 IN BOOLEAN IsRecipient);
4141 VOID BssTableSsidSort(
4142 IN PRTMP_ADAPTER pAd,
4143 OUT BSS_TABLE *OutTab,
4144 IN CHAR Ssid[],
4145 IN UCHAR SsidLen);
4147 VOID BssTableSortByRssi(
4148 IN OUT BSS_TABLE *OutTab);
4150 VOID BssCipherParse(
4151 IN OUT PBSS_ENTRY pBss);
4153 NDIS_STATUS MlmeQueueInit(
4154 IN MLME_QUEUE *Queue);
4156 VOID MlmeQueueDestroy(
4157 IN MLME_QUEUE *Queue);
4159 BOOLEAN MlmeEnqueue(
4160 IN PRTMP_ADAPTER pAd,
4161 IN ULONG Machine,
4162 IN ULONG MsgType,
4163 IN ULONG MsgLen,
4164 IN VOID *Msg);
4166 BOOLEAN MlmeEnqueueForRecv(
4167 IN PRTMP_ADAPTER pAd,
4168 IN ULONG Wcid,
4169 IN ULONG TimeStampHigh,
4170 IN ULONG TimeStampLow,
4171 IN UCHAR Rssi0,
4172 IN UCHAR Rssi1,
4173 IN UCHAR Rssi2,
4174 IN ULONG MsgLen,
4175 IN PVOID Msg,
4176 IN UCHAR Signal);
4179 BOOLEAN MlmeDequeue(
4180 IN MLME_QUEUE *Queue,
4181 OUT MLME_QUEUE_ELEM **Elem);
4183 VOID MlmeRestartStateMachine(
4184 IN PRTMP_ADAPTER pAd);
4186 BOOLEAN MlmeQueueEmpty(
4187 IN MLME_QUEUE *Queue);
4189 BOOLEAN MlmeQueueFull(
4190 IN MLME_QUEUE *Queue);
4192 BOOLEAN MsgTypeSubst(
4193 IN PRTMP_ADAPTER pAd,
4194 IN PFRAME_802_11 pFrame,
4195 OUT INT *Machine,
4196 OUT INT *MsgType);
4198 VOID StateMachineInit(
4199 IN STATE_MACHINE *Sm,
4200 IN STATE_MACHINE_FUNC Trans[],
4201 IN ULONG StNr,
4202 IN ULONG MsgNr,
4203 IN STATE_MACHINE_FUNC DefFunc,
4204 IN ULONG InitState,
4205 IN ULONG Base);
4207 VOID StateMachineSetAction(
4208 IN STATE_MACHINE *S,
4209 IN ULONG St,
4210 ULONG Msg,
4211 IN STATE_MACHINE_FUNC F);
4213 VOID StateMachinePerformAction(
4214 IN PRTMP_ADAPTER pAd,
4215 IN STATE_MACHINE *S,
4216 IN MLME_QUEUE_ELEM *Elem);
4218 VOID Drop(
4219 IN PRTMP_ADAPTER pAd,
4220 IN MLME_QUEUE_ELEM *Elem);
4222 VOID AssocStateMachineInit(
4223 IN PRTMP_ADAPTER pAd,
4224 IN STATE_MACHINE *Sm,
4225 OUT STATE_MACHINE_FUNC Trans[]);
4227 VOID ReassocTimeout(
4228 IN PVOID SystemSpecific1,
4229 IN PVOID FunctionContext,
4230 IN PVOID SystemSpecific2,
4231 IN PVOID SystemSpecific3);
4233 VOID AssocTimeout(
4234 IN PVOID SystemSpecific1,
4235 IN PVOID FunctionContext,
4236 IN PVOID SystemSpecific2,
4237 IN PVOID SystemSpecific3);
4239 VOID DisassocTimeout(
4240 IN PVOID SystemSpecific1,
4241 IN PVOID FunctionContext,
4242 IN PVOID SystemSpecific2,
4243 IN PVOID SystemSpecific3);
4245 //----------------------------------------------
4246 VOID MlmeDisassocReqAction(
4247 IN PRTMP_ADAPTER pAd,
4248 IN MLME_QUEUE_ELEM *Elem);
4250 VOID MlmeAssocReqAction(
4251 IN PRTMP_ADAPTER pAd,
4252 IN MLME_QUEUE_ELEM *Elem);
4254 VOID MlmeReassocReqAction(
4255 IN PRTMP_ADAPTER pAd,
4256 IN MLME_QUEUE_ELEM *Elem);
4258 VOID MlmeDisassocReqAction(
4259 IN PRTMP_ADAPTER pAd,
4260 IN MLME_QUEUE_ELEM *Elem);
4262 VOID PeerAssocRspAction(
4263 IN PRTMP_ADAPTER pAd,
4264 IN MLME_QUEUE_ELEM *Elem);
4266 VOID PeerReassocRspAction(
4267 IN PRTMP_ADAPTER pAd,
4268 IN MLME_QUEUE_ELEM *Elem);
4270 VOID PeerDisassocAction(
4271 IN PRTMP_ADAPTER pAd,
4272 IN MLME_QUEUE_ELEM *Elem);
4274 VOID DisassocTimeoutAction(
4275 IN PRTMP_ADAPTER pAd,
4276 IN MLME_QUEUE_ELEM *Elem);
4278 VOID AssocTimeoutAction(
4279 IN PRTMP_ADAPTER pAd,
4280 IN MLME_QUEUE_ELEM *Elem);
4282 VOID ReassocTimeoutAction(
4283 IN PRTMP_ADAPTER pAd,
4284 IN MLME_QUEUE_ELEM *Elem);
4286 VOID Cls3errAction(
4287 IN PRTMP_ADAPTER pAd,
4288 IN PUCHAR pAddr);
4290 VOID SwitchBetweenWepAndCkip(
4291 IN PRTMP_ADAPTER pAd);
4293 VOID InvalidStateWhenAssoc(
4294 IN PRTMP_ADAPTER pAd,
4295 IN MLME_QUEUE_ELEM *Elem);
4297 VOID InvalidStateWhenReassoc(
4298 IN PRTMP_ADAPTER pAd,
4299 IN MLME_QUEUE_ELEM *Elem);
4301 VOID InvalidStateWhenDisassociate(
4302 IN PRTMP_ADAPTER pAd,
4303 IN MLME_QUEUE_ELEM *Elem);
4305 #ifdef RT2870
4306 VOID MlmeCntlConfirm(
4307 IN PRTMP_ADAPTER pAd,
4308 IN ULONG MsgType,
4309 IN USHORT Msg);
4310 #endif // RT2870 //
4312 VOID ComposePsPoll(
4313 IN PRTMP_ADAPTER pAd);
4315 VOID ComposeNullFrame(
4316 IN PRTMP_ADAPTER pAd);
4318 VOID AssocPostProc(
4319 IN PRTMP_ADAPTER pAd,
4320 IN PUCHAR pAddr2,
4321 IN USHORT CapabilityInfo,
4322 IN USHORT Aid,
4323 IN UCHAR SupRate[],
4324 IN UCHAR SupRateLen,
4325 IN UCHAR ExtRate[],
4326 IN UCHAR ExtRateLen,
4327 IN PEDCA_PARM pEdcaParm,
4328 IN HT_CAPABILITY_IE *pHtCapability,
4329 IN UCHAR HtCapabilityLen,
4330 IN ADD_HT_INFO_IE *pAddHtInfo);
4332 VOID AuthStateMachineInit(
4333 IN PRTMP_ADAPTER pAd,
4334 IN PSTATE_MACHINE sm,
4335 OUT STATE_MACHINE_FUNC Trans[]);
4337 VOID AuthTimeout(
4338 IN PVOID SystemSpecific1,
4339 IN PVOID FunctionContext,
4340 IN PVOID SystemSpecific2,
4341 IN PVOID SystemSpecific3);
4343 VOID MlmeAuthReqAction(
4344 IN PRTMP_ADAPTER pAd,
4345 IN MLME_QUEUE_ELEM *Elem);
4347 VOID PeerAuthRspAtSeq2Action(
4348 IN PRTMP_ADAPTER pAd,
4349 IN MLME_QUEUE_ELEM *Elem);
4351 VOID PeerAuthRspAtSeq4Action(
4352 IN PRTMP_ADAPTER pAd,
4353 IN MLME_QUEUE_ELEM *Elem);
4355 VOID AuthTimeoutAction(
4356 IN PRTMP_ADAPTER pAd,
4357 IN MLME_QUEUE_ELEM *Elem);
4359 VOID Cls2errAction(
4360 IN PRTMP_ADAPTER pAd,
4361 IN PUCHAR pAddr);
4363 VOID MlmeDeauthReqAction(
4364 IN PRTMP_ADAPTER pAd,
4365 IN MLME_QUEUE_ELEM *Elem);
4367 VOID InvalidStateWhenAuth(
4368 IN PRTMP_ADAPTER pAd,
4369 IN MLME_QUEUE_ELEM *Elem);
4371 //=============================================
4373 VOID AuthRspStateMachineInit(
4374 IN PRTMP_ADAPTER pAd,
4375 IN PSTATE_MACHINE Sm,
4376 IN STATE_MACHINE_FUNC Trans[]);
4378 VOID PeerDeauthAction(
4379 IN PRTMP_ADAPTER pAd,
4380 IN MLME_QUEUE_ELEM *Elem);
4382 VOID PeerAuthSimpleRspGenAndSend(
4383 IN PRTMP_ADAPTER pAd,
4384 IN PHEADER_802_11 pHdr80211,
4385 IN USHORT Alg,
4386 IN USHORT Seq,
4387 IN USHORT Reason,
4388 IN USHORT Status);
4391 // Private routines in dls.c
4394 //========================================
4396 VOID SyncStateMachineInit(
4397 IN PRTMP_ADAPTER pAd,
4398 IN STATE_MACHINE *Sm,
4399 OUT STATE_MACHINE_FUNC Trans[]);
4401 VOID BeaconTimeout(
4402 IN PVOID SystemSpecific1,
4403 IN PVOID FunctionContext,
4404 IN PVOID SystemSpecific2,
4405 IN PVOID SystemSpecific3);
4407 VOID ScanTimeout(
4408 IN PVOID SystemSpecific1,
4409 IN PVOID FunctionContext,
4410 IN PVOID SystemSpecific2,
4411 IN PVOID SystemSpecific3);
4413 VOID MlmeScanReqAction(
4414 IN PRTMP_ADAPTER pAd,
4415 IN MLME_QUEUE_ELEM *Elem);
4417 VOID InvalidStateWhenScan(
4418 IN PRTMP_ADAPTER pAd,
4419 IN MLME_QUEUE_ELEM *Elem);
4421 VOID InvalidStateWhenJoin(
4422 IN PRTMP_ADAPTER pAd,
4423 IN MLME_QUEUE_ELEM *Elem);
4425 VOID InvalidStateWhenStart(
4426 IN PRTMP_ADAPTER pAd,
4427 IN MLME_QUEUE_ELEM *Elem);
4429 VOID PeerBeacon(
4430 IN PRTMP_ADAPTER pAd,
4431 IN MLME_QUEUE_ELEM *Elem);
4433 VOID EnqueueProbeRequest(
4434 IN PRTMP_ADAPTER pAd);
4436 BOOLEAN ScanRunning(
4437 IN PRTMP_ADAPTER pAd);
4438 //=========================================
4440 VOID MlmeCntlInit(
4441 IN PRTMP_ADAPTER pAd,
4442 IN STATE_MACHINE *S,
4443 OUT STATE_MACHINE_FUNC Trans[]);
4445 VOID MlmeCntlMachinePerformAction(
4446 IN PRTMP_ADAPTER pAd,
4447 IN STATE_MACHINE *S,
4448 IN MLME_QUEUE_ELEM *Elem);
4450 VOID CntlIdleProc(
4451 IN PRTMP_ADAPTER pAd,
4452 IN MLME_QUEUE_ELEM *Elem);
4454 VOID CntlOidScanProc(
4455 IN PRTMP_ADAPTER pAd,
4456 IN MLME_QUEUE_ELEM *Elem);
4458 VOID CntlOidSsidProc(
4459 IN PRTMP_ADAPTER pAd,
4460 IN MLME_QUEUE_ELEM * Elem);
4462 VOID CntlOidRTBssidProc(
4463 IN PRTMP_ADAPTER pAd,
4464 IN MLME_QUEUE_ELEM * Elem);
4466 VOID CntlMlmeRoamingProc(
4467 IN PRTMP_ADAPTER pAd,
4468 IN MLME_QUEUE_ELEM * Elem);
4470 VOID CntlWaitDisassocProc(
4471 IN PRTMP_ADAPTER pAd,
4472 IN MLME_QUEUE_ELEM *Elem);
4474 VOID CntlWaitJoinProc(
4475 IN PRTMP_ADAPTER pAd,
4476 IN MLME_QUEUE_ELEM *Elem);
4478 VOID CntlWaitReassocProc(
4479 IN PRTMP_ADAPTER pAd,
4480 IN MLME_QUEUE_ELEM *Elem);
4482 VOID CntlWaitStartProc(
4483 IN PRTMP_ADAPTER pAd,
4484 IN MLME_QUEUE_ELEM *Elem);
4486 VOID CntlWaitAuthProc(
4487 IN PRTMP_ADAPTER pAd,
4488 IN MLME_QUEUE_ELEM *Elem);
4490 VOID CntlWaitAuthProc2(
4491 IN PRTMP_ADAPTER pAd,
4492 IN MLME_QUEUE_ELEM *Elem);
4494 VOID CntlWaitAssocProc(
4495 IN PRTMP_ADAPTER pAd,
4496 IN MLME_QUEUE_ELEM *Elem);
4498 VOID LinkUp(
4499 IN PRTMP_ADAPTER pAd,
4500 IN UCHAR BssType);
4502 VOID LinkDown(
4503 IN PRTMP_ADAPTER pAd,
4504 IN BOOLEAN IsReqFromAP);
4506 VOID IterateOnBssTab(
4507 IN PRTMP_ADAPTER pAd);
4509 VOID IterateOnBssTab2(
4510 IN PRTMP_ADAPTER pAd);;
4512 VOID JoinParmFill(
4513 IN PRTMP_ADAPTER pAd,
4514 IN OUT MLME_JOIN_REQ_STRUCT *JoinReq,
4515 IN ULONG BssIdx);
4517 VOID AssocParmFill(
4518 IN PRTMP_ADAPTER pAd,
4519 IN OUT MLME_ASSOC_REQ_STRUCT *AssocReq,
4520 IN PUCHAR pAddr,
4521 IN USHORT CapabilityInfo,
4522 IN ULONG Timeout,
4523 IN USHORT ListenIntv);
4525 VOID ScanParmFill(
4526 IN PRTMP_ADAPTER pAd,
4527 IN OUT MLME_SCAN_REQ_STRUCT *ScanReq,
4528 IN CHAR Ssid[],
4529 IN UCHAR SsidLen,
4530 IN UCHAR BssType,
4531 IN UCHAR ScanType);
4533 VOID DisassocParmFill(
4534 IN PRTMP_ADAPTER pAd,
4535 IN OUT MLME_DISASSOC_REQ_STRUCT *DisassocReq,
4536 IN PUCHAR pAddr,
4537 IN USHORT Reason);
4539 VOID StartParmFill(
4540 IN PRTMP_ADAPTER pAd,
4541 IN OUT MLME_START_REQ_STRUCT *StartReq,
4542 IN CHAR Ssid[],
4543 IN UCHAR SsidLen);
4545 VOID AuthParmFill(
4546 IN PRTMP_ADAPTER pAd,
4547 IN OUT MLME_AUTH_REQ_STRUCT *AuthReq,
4548 IN PUCHAR pAddr,
4549 IN USHORT Alg);
4551 VOID EnqueuePsPoll(
4552 IN PRTMP_ADAPTER pAd);
4554 VOID EnqueueBeaconFrame(
4555 IN PRTMP_ADAPTER pAd);
4557 VOID MlmeJoinReqAction(
4558 IN PRTMP_ADAPTER pAd,
4559 IN MLME_QUEUE_ELEM *Elem);
4561 VOID MlmeScanReqAction(
4562 IN PRTMP_ADAPTER pAd,
4563 IN MLME_QUEUE_ELEM *Elem);
4565 VOID MlmeStartReqAction(
4566 IN PRTMP_ADAPTER pAd,
4567 IN MLME_QUEUE_ELEM *Elem);
4569 VOID ScanTimeoutAction(
4570 IN PRTMP_ADAPTER pAd,
4571 IN MLME_QUEUE_ELEM *Elem);
4573 VOID BeaconTimeoutAtJoinAction(
4574 IN PRTMP_ADAPTER pAd,
4575 IN MLME_QUEUE_ELEM *Elem);
4577 VOID PeerBeaconAtScanAction(
4578 IN PRTMP_ADAPTER pAd,
4579 IN MLME_QUEUE_ELEM *Elem);
4581 VOID PeerBeaconAtJoinAction(
4582 IN PRTMP_ADAPTER pAd,
4583 IN MLME_QUEUE_ELEM *Elem);
4585 VOID PeerBeacon(
4586 IN PRTMP_ADAPTER pAd,
4587 IN MLME_QUEUE_ELEM *Elem);
4589 VOID PeerProbeReqAction(
4590 IN PRTMP_ADAPTER pAd,
4591 IN MLME_QUEUE_ELEM *Elem);
4593 VOID ScanNextChannel(
4594 IN PRTMP_ADAPTER pAd);
4596 ULONG MakeIbssBeacon(
4597 IN PRTMP_ADAPTER pAd);
4599 VOID CCXAdjacentAPReport(
4600 IN PRTMP_ADAPTER pAd);
4602 BOOLEAN MlmeScanReqSanity(
4603 IN PRTMP_ADAPTER pAd,
4604 IN VOID *Msg,
4605 IN ULONG MsgLen,
4606 OUT UCHAR *BssType,
4607 OUT CHAR ssid[],
4608 OUT UCHAR *SsidLen,
4609 OUT UCHAR *ScanType);
4611 BOOLEAN PeerBeaconAndProbeRspSanity(
4612 IN PRTMP_ADAPTER pAd,
4613 IN VOID *Msg,
4614 IN ULONG MsgLen,
4615 IN UCHAR MsgChannel,
4616 OUT PUCHAR pAddr2,
4617 OUT PUCHAR pBssid,
4618 OUT CHAR Ssid[],
4619 OUT UCHAR *pSsidLen,
4620 OUT UCHAR *pBssType,
4621 OUT USHORT *pBeaconPeriod,
4622 OUT UCHAR *pChannel,
4623 OUT UCHAR *pNewChannel,
4624 OUT LARGE_INTEGER *pTimestamp,
4625 OUT CF_PARM *pCfParm,
4626 OUT USHORT *pAtimWin,
4627 OUT USHORT *pCapabilityInfo,
4628 OUT UCHAR *pErp,
4629 OUT UCHAR *pDtimCount,
4630 OUT UCHAR *pDtimPeriod,
4631 OUT UCHAR *pBcastFlag,
4632 OUT UCHAR *pMessageToMe,
4633 OUT UCHAR SupRate[],
4634 OUT UCHAR *pSupRateLen,
4635 OUT UCHAR ExtRate[],
4636 OUT UCHAR *pExtRateLen,
4637 OUT UCHAR *pCkipFlag,
4638 OUT UCHAR *pAironetCellPowerLimit,
4639 OUT PEDCA_PARM pEdcaParm,
4640 OUT PQBSS_LOAD_PARM pQbssLoad,
4641 OUT PQOS_CAPABILITY_PARM pQosCapability,
4642 OUT ULONG *pRalinkIe,
4643 OUT UCHAR *pHtCapabilityLen,
4644 OUT UCHAR *pPreNHtCapabilityLen,
4645 OUT HT_CAPABILITY_IE *pHtCapability,
4646 OUT UCHAR *AddHtInfoLen,
4647 OUT ADD_HT_INFO_IE *AddHtInfo,
4648 OUT UCHAR *NewExtChannel,
4649 OUT USHORT *LengthVIE,
4650 OUT PNDIS_802_11_VARIABLE_IEs pVIE);
4652 BOOLEAN PeerAddBAReqActionSanity(
4653 IN PRTMP_ADAPTER pAd,
4654 IN VOID *pMsg,
4655 IN ULONG MsgLen,
4656 OUT PUCHAR pAddr2);
4658 BOOLEAN PeerAddBARspActionSanity(
4659 IN PRTMP_ADAPTER pAd,
4660 IN VOID *pMsg,
4661 IN ULONG MsgLen);
4663 BOOLEAN PeerDelBAActionSanity(
4664 IN PRTMP_ADAPTER pAd,
4665 IN UCHAR Wcid,
4666 IN VOID *pMsg,
4667 IN ULONG MsgLen);
4669 BOOLEAN MlmeAssocReqSanity(
4670 IN PRTMP_ADAPTER pAd,
4671 IN VOID *Msg,
4672 IN ULONG MsgLen,
4673 OUT PUCHAR pApAddr,
4674 OUT USHORT *CapabilityInfo,
4675 OUT ULONG *Timeout,
4676 OUT USHORT *ListenIntv);
4678 BOOLEAN MlmeAuthReqSanity(
4679 IN PRTMP_ADAPTER pAd,
4680 IN VOID *Msg,
4681 IN ULONG MsgLen,
4682 OUT PUCHAR pAddr,
4683 OUT ULONG *Timeout,
4684 OUT USHORT *Alg);
4686 BOOLEAN MlmeStartReqSanity(
4687 IN PRTMP_ADAPTER pAd,
4688 IN VOID *Msg,
4689 IN ULONG MsgLen,
4690 OUT CHAR Ssid[],
4691 OUT UCHAR *Ssidlen);
4693 BOOLEAN PeerAuthSanity(
4694 IN PRTMP_ADAPTER pAd,
4695 IN VOID *Msg,
4696 IN ULONG MsgLen,
4697 OUT PUCHAR pAddr,
4698 OUT USHORT *Alg,
4699 OUT USHORT *Seq,
4700 OUT USHORT *Status,
4701 OUT CHAR ChlgText[]);
4703 BOOLEAN PeerAssocRspSanity(
4704 IN PRTMP_ADAPTER pAd,
4705 IN VOID *pMsg,
4706 IN ULONG MsgLen,
4707 OUT PUCHAR pAddr2,
4708 OUT USHORT *pCapabilityInfo,
4709 OUT USHORT *pStatus,
4710 OUT USHORT *pAid,
4711 OUT UCHAR SupRate[],
4712 OUT UCHAR *pSupRateLen,
4713 OUT UCHAR ExtRate[],
4714 OUT UCHAR *pExtRateLen,
4715 OUT HT_CAPABILITY_IE *pHtCapability,
4716 OUT ADD_HT_INFO_IE *pAddHtInfo, // AP might use this additional ht info IE
4717 OUT UCHAR *pHtCapabilityLen,
4718 OUT UCHAR *pAddHtInfoLen,
4719 OUT UCHAR *pNewExtChannelOffset,
4720 OUT PEDCA_PARM pEdcaParm,
4721 OUT UCHAR *pCkipFlag);
4723 BOOLEAN PeerDisassocSanity(
4724 IN PRTMP_ADAPTER pAd,
4725 IN VOID *Msg,
4726 IN ULONG MsgLen,
4727 OUT PUCHAR pAddr2,
4728 OUT USHORT *Reason);
4730 BOOLEAN PeerWpaMessageSanity(
4731 IN PRTMP_ADAPTER pAd,
4732 IN PEAPOL_PACKET pMsg,
4733 IN ULONG MsgLen,
4734 IN UCHAR MsgType,
4735 IN MAC_TABLE_ENTRY *pEntry);
4737 BOOLEAN PeerDeauthSanity(
4738 IN PRTMP_ADAPTER pAd,
4739 IN VOID *Msg,
4740 IN ULONG MsgLen,
4741 OUT PUCHAR pAddr2,
4742 OUT USHORT *Reason);
4744 BOOLEAN PeerProbeReqSanity(
4745 IN PRTMP_ADAPTER pAd,
4746 IN VOID *Msg,
4747 IN ULONG MsgLen,
4748 OUT PUCHAR pAddr2,
4749 OUT CHAR Ssid[],
4750 OUT UCHAR *pSsidLen);
4752 BOOLEAN GetTimBit(
4753 IN CHAR *Ptr,
4754 IN USHORT Aid,
4755 OUT UCHAR *TimLen,
4756 OUT UCHAR *BcastFlag,
4757 OUT UCHAR *DtimCount,
4758 OUT UCHAR *DtimPeriod,
4759 OUT UCHAR *MessageToMe);
4761 UCHAR ChannelSanity(
4762 IN PRTMP_ADAPTER pAd,
4763 IN UCHAR channel);
4765 NDIS_802_11_NETWORK_TYPE NetworkTypeInUseSanity(
4766 IN PBSS_ENTRY pBss);
4768 BOOLEAN MlmeDelBAReqSanity(
4769 IN PRTMP_ADAPTER pAd,
4770 IN VOID *Msg,
4771 IN ULONG MsgLen);
4773 BOOLEAN MlmeAddBAReqSanity(
4774 IN PRTMP_ADAPTER pAd,
4775 IN VOID *Msg,
4776 IN ULONG MsgLen,
4777 OUT PUCHAR pAddr2);
4779 ULONG MakeOutgoingFrame(
4780 OUT CHAR *Buffer,
4781 OUT ULONG *Length, ...);
4783 VOID LfsrInit(
4784 IN PRTMP_ADAPTER pAd,
4785 IN ULONG Seed);
4787 UCHAR RandomByte(
4788 IN PRTMP_ADAPTER pAd);
4790 VOID AsicUpdateAutoFallBackTable(
4791 IN PRTMP_ADAPTER pAd,
4792 IN PUCHAR pTxRate);
4794 VOID MlmePeriodicExec(
4795 IN PVOID SystemSpecific1,
4796 IN PVOID FunctionContext,
4797 IN PVOID SystemSpecific2,
4798 IN PVOID SystemSpecific3);
4800 VOID LinkDownExec(
4801 IN PVOID SystemSpecific1,
4802 IN PVOID FunctionContext,
4803 IN PVOID SystemSpecific2,
4804 IN PVOID SystemSpecific3);
4806 VOID LinkUpExec(
4807 IN PVOID SystemSpecific1,
4808 IN PVOID FunctionContext,
4809 IN PVOID SystemSpecific2,
4810 IN PVOID SystemSpecific3);
4812 VOID STAMlmePeriodicExec(
4813 PRTMP_ADAPTER pAd);
4815 VOID MlmeAutoScan(
4816 IN PRTMP_ADAPTER pAd);
4818 VOID MlmeAutoReconnectLastSSID(
4819 IN PRTMP_ADAPTER pAd);
4821 BOOLEAN MlmeValidateSSID(
4822 IN PUCHAR pSsid,
4823 IN UCHAR SsidLen);
4825 VOID MlmeCheckForRoaming(
4826 IN PRTMP_ADAPTER pAd,
4827 IN ULONG Now32);
4829 VOID MlmeCheckForFastRoaming(
4830 IN PRTMP_ADAPTER pAd,
4831 IN ULONG Now);
4833 VOID MlmeDynamicTxRateSwitching(
4834 IN PRTMP_ADAPTER pAd);
4836 VOID MlmeSetTxRate(
4837 IN PRTMP_ADAPTER pAd,
4838 IN PMAC_TABLE_ENTRY pEntry,
4839 IN PRTMP_TX_RATE_SWITCH pTxRate);
4841 VOID MlmeSelectTxRateTable(
4842 IN PRTMP_ADAPTER pAd,
4843 IN PMAC_TABLE_ENTRY pEntry,
4844 IN PUCHAR *ppTable,
4845 IN PUCHAR pTableSize,
4846 IN PUCHAR pInitTxRateIdx);
4848 VOID MlmeCalculateChannelQuality(
4849 IN PRTMP_ADAPTER pAd,
4850 IN ULONG Now);
4852 VOID MlmeCheckPsmChange(
4853 IN PRTMP_ADAPTER pAd,
4854 IN ULONG Now32);
4856 VOID MlmeSetPsmBit(
4857 IN PRTMP_ADAPTER pAd,
4858 IN USHORT psm);
4860 VOID MlmeSetTxPreamble(
4861 IN PRTMP_ADAPTER pAd,
4862 IN USHORT TxPreamble);
4864 VOID UpdateBasicRateBitmap(
4865 IN PRTMP_ADAPTER pAd);
4867 VOID MlmeUpdateTxRates(
4868 IN PRTMP_ADAPTER pAd,
4869 IN BOOLEAN bLinkUp,
4870 IN UCHAR apidx);
4872 VOID MlmeUpdateHtTxRates(
4873 IN PRTMP_ADAPTER pAd,
4874 IN UCHAR apidx);
4876 VOID RTMPCheckRates(
4877 IN PRTMP_ADAPTER pAd,
4878 IN OUT UCHAR SupRate[],
4879 IN OUT UCHAR *SupRateLen);
4881 BOOLEAN RTMPCheckChannel(
4882 IN PRTMP_ADAPTER pAd,
4883 IN UCHAR CentralChannel,
4884 IN UCHAR Channel);
4886 BOOLEAN RTMPCheckHt(
4887 IN PRTMP_ADAPTER pAd,
4888 IN UCHAR Wcid,
4889 IN OUT HT_CAPABILITY_IE *pHtCapability,
4890 IN OUT ADD_HT_INFO_IE *pAddHtInfo);
4892 VOID StaQuickResponeForRateUpExec(
4893 IN PVOID SystemSpecific1,
4894 IN PVOID FunctionContext,
4895 IN PVOID SystemSpecific2,
4896 IN PVOID SystemSpecific3);
4898 VOID AsicBbpTuning1(
4899 IN PRTMP_ADAPTER pAd);
4901 VOID AsicBbpTuning2(
4902 IN PRTMP_ADAPTER pAd);
4904 VOID RTMPUpdateMlmeRate(
4905 IN PRTMP_ADAPTER pAd);
4907 CHAR RTMPMaxRssi(
4908 IN PRTMP_ADAPTER pAd,
4909 IN CHAR Rssi0,
4910 IN CHAR Rssi1,
4911 IN CHAR Rssi2);
4913 #ifdef RT30xx
4914 VOID AsicSetRxAnt(
4915 IN PRTMP_ADAPTER pAd,
4916 IN UCHAR Ant);
4917 #endif
4919 VOID AsicEvaluateRxAnt(
4920 IN PRTMP_ADAPTER pAd);
4922 VOID AsicRxAntEvalTimeout(
4923 IN PVOID SystemSpecific1,
4924 IN PVOID FunctionContext,
4925 IN PVOID SystemSpecific2,
4926 IN PVOID SystemSpecific3);
4928 VOID APSDPeriodicExec(
4929 IN PVOID SystemSpecific1,
4930 IN PVOID FunctionContext,
4931 IN PVOID SystemSpecific2,
4932 IN PVOID SystemSpecific3);
4934 BOOLEAN RTMPCheckEntryEnableAutoRateSwitch(
4935 IN PRTMP_ADAPTER pAd,
4936 IN PMAC_TABLE_ENTRY pEntry);
4938 UCHAR RTMPStaFixedTxMode(
4939 IN PRTMP_ADAPTER pAd,
4940 IN PMAC_TABLE_ENTRY pEntry);
4942 VOID RTMPUpdateLegacyTxSetting(
4943 UCHAR fixed_tx_mode,
4944 PMAC_TABLE_ENTRY pEntry);
4946 BOOLEAN RTMPAutoRateSwitchCheck(
4947 IN PRTMP_ADAPTER pAd);
4949 NDIS_STATUS MlmeInit(
4950 IN PRTMP_ADAPTER pAd);
4952 VOID MlmeHandler(
4953 IN PRTMP_ADAPTER pAd);
4955 VOID MlmeHalt(
4956 IN PRTMP_ADAPTER pAd);
4958 VOID MlmeResetRalinkCounters(
4959 IN PRTMP_ADAPTER pAd);
4961 VOID BuildChannelList(
4962 IN PRTMP_ADAPTER pAd);
4964 UCHAR FirstChannel(
4965 IN PRTMP_ADAPTER pAd);
4967 UCHAR NextChannel(
4968 IN PRTMP_ADAPTER pAd,
4969 IN UCHAR channel);
4971 VOID ChangeToCellPowerLimit(
4972 IN PRTMP_ADAPTER pAd,
4973 IN UCHAR AironetCellPowerLimit);
4975 VOID RaiseClock(
4976 IN PRTMP_ADAPTER pAd,
4977 IN UINT32 *x);
4979 VOID LowerClock(
4980 IN PRTMP_ADAPTER pAd,
4981 IN UINT32 *x);
4983 USHORT ShiftInBits(
4984 IN PRTMP_ADAPTER pAd);
4986 VOID ShiftOutBits(
4987 IN PRTMP_ADAPTER pAd,
4988 IN USHORT data,
4989 IN USHORT count);
4991 VOID EEpromCleanup(
4992 IN PRTMP_ADAPTER pAd);
4994 VOID EWDS(
4995 IN PRTMP_ADAPTER pAd);
4997 VOID EWEN(
4998 IN PRTMP_ADAPTER pAd);
5000 USHORT RTMP_EEPROM_READ16(
5001 IN PRTMP_ADAPTER pAd,
5002 IN USHORT Offset);
5004 VOID RTMP_EEPROM_WRITE16(
5005 IN PRTMP_ADAPTER pAd,
5006 IN USHORT Offset,
5007 IN USHORT Data);
5010 // Prototypes of function definition in rtmp_tkip.c
5012 VOID RTMPInitTkipEngine(
5013 IN PRTMP_ADAPTER pAd,
5014 IN PUCHAR pTKey,
5015 IN UCHAR KeyId,
5016 IN PUCHAR pTA,
5017 IN PUCHAR pMICKey,
5018 IN PUCHAR pTSC,
5019 OUT PULONG pIV16,
5020 OUT PULONG pIV32);
5022 VOID RTMPInitMICEngine(
5023 IN PRTMP_ADAPTER pAd,
5024 IN PUCHAR pKey,
5025 IN PUCHAR pDA,
5026 IN PUCHAR pSA,
5027 IN UCHAR UserPriority,
5028 IN PUCHAR pMICKey);
5030 BOOLEAN RTMPTkipCompareMICValue(
5031 IN PRTMP_ADAPTER pAd,
5032 IN PUCHAR pSrc,
5033 IN PUCHAR pDA,
5034 IN PUCHAR pSA,
5035 IN PUCHAR pMICKey,
5036 IN UCHAR UserPriority,
5037 IN UINT Len);
5039 VOID RTMPCalculateMICValue(
5040 IN PRTMP_ADAPTER pAd,
5041 IN PNDIS_PACKET pPacket,
5042 IN PUCHAR pEncap,
5043 IN PCIPHER_KEY pKey,
5044 IN UCHAR apidx);
5046 BOOLEAN RTMPTkipCompareMICValueWithLLC(
5047 IN PRTMP_ADAPTER pAd,
5048 IN PUCHAR pLLC,
5049 IN PUCHAR pSrc,
5050 IN PUCHAR pDA,
5051 IN PUCHAR pSA,
5052 IN PUCHAR pMICKey,
5053 IN UINT Len);
5055 VOID RTMPTkipAppendByte(
5056 IN PTKIP_KEY_INFO pTkip,
5057 IN UCHAR uChar);
5059 VOID RTMPTkipAppend(
5060 IN PTKIP_KEY_INFO pTkip,
5061 IN PUCHAR pSrc,
5062 IN UINT nBytes);
5064 VOID RTMPTkipGetMIC(
5065 IN PTKIP_KEY_INFO pTkip);
5067 BOOLEAN RTMPSoftDecryptTKIP(
5068 IN PRTMP_ADAPTER pAd,
5069 IN PUCHAR pData,
5070 IN ULONG DataByteCnt,
5071 IN UCHAR UserPriority,
5072 IN PCIPHER_KEY pWpaKey);
5074 BOOLEAN RTMPSoftDecryptAES(
5075 IN PRTMP_ADAPTER pAd,
5076 IN PUCHAR pData,
5077 IN ULONG DataByteCnt,
5078 IN PCIPHER_KEY pWpaKey);
5081 // Prototypes of function definition in cmm_info.c
5083 NDIS_STATUS RTMPWPARemoveKeyProc(
5084 IN PRTMP_ADAPTER pAd,
5085 IN PVOID pBuf);
5087 VOID RTMPWPARemoveAllKeys(
5088 IN PRTMP_ADAPTER pAd);
5090 BOOLEAN RTMPCheckStrPrintAble(
5091 IN CHAR *pInPutStr,
5092 IN UCHAR strLen);
5094 VOID RTMPSetPhyMode(
5095 IN PRTMP_ADAPTER pAd,
5096 IN ULONG phymode);
5098 VOID RTMPUpdateHTIE(
5099 IN RT_HT_CAPABILITY *pRtHt,
5100 IN UCHAR *pMcsSet,
5101 OUT HT_CAPABILITY_IE *pHtCapability,
5102 OUT ADD_HT_INFO_IE *pAddHtInfo);
5104 VOID RTMPAddWcidAttributeEntry(
5105 IN PRTMP_ADAPTER pAd,
5106 IN UCHAR BssIdx,
5107 IN UCHAR KeyIdx,
5108 IN UCHAR CipherAlg,
5109 IN MAC_TABLE_ENTRY *pEntry);
5111 CHAR *GetEncryptType(
5112 CHAR enc);
5114 CHAR *GetAuthMode(
5115 CHAR auth);
5117 VOID RTMPIoctlGetSiteSurvey(
5118 IN PRTMP_ADAPTER pAdapter,
5119 IN struct iwreq *wrq);
5121 VOID RTMPIoctlGetMacTable(
5122 IN PRTMP_ADAPTER pAd,
5123 IN struct iwreq *wrq);
5125 VOID RTMPIndicateWPA2Status(
5126 IN PRTMP_ADAPTER pAdapter);
5128 VOID RTMPOPModeSwitching(
5129 IN PRTMP_ADAPTER pAd);
5131 VOID RTMPAddBSSIDCipher(
5132 IN PRTMP_ADAPTER pAd,
5133 IN UCHAR Aid,
5134 IN PNDIS_802_11_KEY pKey,
5135 IN UCHAR CipherAlg);
5137 VOID RTMPSetHT(
5138 IN PRTMP_ADAPTER pAd,
5139 IN OID_SET_HT_PHYMODE *pHTPhyMode);
5141 VOID RTMPSetIndividualHT(
5142 IN PRTMP_ADAPTER pAd,
5143 IN UCHAR apidx);
5145 VOID RTMPSendWirelessEvent(
5146 IN PRTMP_ADAPTER pAd,
5147 IN USHORT Event_flag,
5148 IN PUCHAR pAddr,
5149 IN UCHAR BssIdx,
5150 IN CHAR Rssi);
5152 VOID NICUpdateCntlCounters(
5153 IN PRTMP_ADAPTER pAd,
5154 IN PHEADER_802_11 pHeader,
5155 IN UCHAR SubType,
5156 IN PRXWI_STRUC pRxWI);
5158 // prototype in wpa.c
5160 BOOLEAN WpaMsgTypeSubst(
5161 IN UCHAR EAPType,
5162 OUT INT *MsgType);
5164 VOID WpaPskStateMachineInit(
5165 IN PRTMP_ADAPTER pAd,
5166 IN STATE_MACHINE *S,
5167 OUT STATE_MACHINE_FUNC Trans[]);
5169 VOID WpaEAPOLKeyAction(
5170 IN PRTMP_ADAPTER pAd,
5171 IN MLME_QUEUE_ELEM *Elem);
5173 VOID WpaPairMsg1Action(
5174 IN PRTMP_ADAPTER pAd,
5175 IN MLME_QUEUE_ELEM *Elem);
5177 VOID WpaPairMsg3Action(
5178 IN PRTMP_ADAPTER pAd,
5179 IN MLME_QUEUE_ELEM *Elem);
5181 VOID WpaGroupMsg1Action(
5182 IN PRTMP_ADAPTER pAd,
5183 IN MLME_QUEUE_ELEM *Elem);
5185 VOID WpaMacHeaderInit(
5186 IN PRTMP_ADAPTER pAd,
5187 IN OUT PHEADER_802_11 pHdr80211,
5188 IN UCHAR wep,
5189 IN PUCHAR pAddr1);
5191 VOID Wpa2PairMsg1Action(
5192 IN PRTMP_ADAPTER pAd,
5193 IN MLME_QUEUE_ELEM *Elem);
5195 VOID Wpa2PairMsg3Action(
5196 IN PRTMP_ADAPTER pAd,
5197 IN MLME_QUEUE_ELEM *Elem);
5199 BOOLEAN ParseKeyData(
5200 IN PRTMP_ADAPTER pAd,
5201 IN PUCHAR pKeyData,
5202 IN UCHAR KeyDataLen,
5203 IN UCHAR bPairewise);
5205 VOID RTMPToWirelessSta(
5206 IN PRTMP_ADAPTER pAd,
5207 IN PUCHAR pHeader802_3,
5208 IN UINT HdrLen,
5209 IN PUCHAR pData,
5210 IN UINT DataLen,
5211 IN BOOLEAN is4wayFrame);
5213 VOID HMAC_SHA1(
5214 IN UCHAR *text,
5215 IN UINT text_len,
5216 IN UCHAR *key,
5217 IN UINT key_len,
5218 IN UCHAR *digest);
5220 VOID PRF(
5221 IN UCHAR *key,
5222 IN INT key_len,
5223 IN UCHAR *prefix,
5224 IN INT prefix_len,
5225 IN UCHAR *data,
5226 IN INT data_len,
5227 OUT UCHAR *output,
5228 IN INT len);
5230 VOID CCKMPRF(
5231 IN UCHAR *key,
5232 IN INT key_len,
5233 IN UCHAR *data,
5234 IN INT data_len,
5235 OUT UCHAR *output,
5236 IN INT len);
5238 VOID WpaCountPTK(
5239 IN PRTMP_ADAPTER pAd,
5240 IN UCHAR *PMK,
5241 IN UCHAR *ANonce,
5242 IN UCHAR *AA,
5243 IN UCHAR *SNonce,
5244 IN UCHAR *SA,
5245 OUT UCHAR *output,
5246 IN UINT len);
5248 VOID GenRandom(
5249 IN PRTMP_ADAPTER pAd,
5250 IN UCHAR *macAddr,
5251 OUT UCHAR *random);
5254 // prototype in aironet.c
5256 VOID AironetStateMachineInit(
5257 IN PRTMP_ADAPTER pAd,
5258 IN STATE_MACHINE *S,
5259 OUT STATE_MACHINE_FUNC Trans[]);
5261 VOID AironetMsgAction(
5262 IN PRTMP_ADAPTER pAd,
5263 IN MLME_QUEUE_ELEM *Elem);
5265 VOID AironetRequestAction(
5266 IN PRTMP_ADAPTER pAd,
5267 IN MLME_QUEUE_ELEM *Elem);
5269 VOID ChannelLoadRequestAction(
5270 IN PRTMP_ADAPTER pAd,
5271 IN UCHAR Index);
5273 VOID NoiseHistRequestAction(
5274 IN PRTMP_ADAPTER pAd,
5275 IN UCHAR Index);
5277 VOID BeaconRequestAction(
5278 IN PRTMP_ADAPTER pAd,
5279 IN UCHAR Index);
5281 VOID AironetReportAction(
5282 IN PRTMP_ADAPTER pAd,
5283 IN MLME_QUEUE_ELEM *Elem);
5285 VOID ChannelLoadReportAction(
5286 IN PRTMP_ADAPTER pAd,
5287 IN UCHAR Index);
5289 VOID NoiseHistReportAction(
5290 IN PRTMP_ADAPTER pAd,
5291 IN UCHAR Index);
5293 VOID AironetFinalReportAction(
5294 IN PRTMP_ADAPTER pAd);
5296 VOID BeaconReportAction(
5297 IN PRTMP_ADAPTER pAd,
5298 IN UCHAR Index);
5300 VOID AironetAddBeaconReport(
5301 IN PRTMP_ADAPTER pAd,
5302 IN ULONG Index,
5303 IN PMLME_QUEUE_ELEM pElem);
5305 VOID AironetCreateBeaconReportFromBssTable(
5306 IN PRTMP_ADAPTER pAd);
5308 VOID DBGPRINT_TX_RING(
5309 IN PRTMP_ADAPTER pAd,
5310 IN UCHAR QueIdx);
5312 VOID DBGPRINT_RX_RING(
5313 IN PRTMP_ADAPTER pAd);
5315 CHAR ConvertToRssi(
5316 IN PRTMP_ADAPTER pAd,
5317 IN CHAR Rssi,
5318 IN UCHAR RssiNumber);
5320 VOID APAsicEvaluateRxAnt(
5321 IN PRTMP_ADAPTER pAd);
5324 VOID APAsicRxAntEvalTimeout(
5325 IN PRTMP_ADAPTER pAd);
5328 // function prototype in cmm_wpa.c
5330 BOOLEAN RTMPCheckWPAframe(
5331 IN PRTMP_ADAPTER pAd,
5332 IN PMAC_TABLE_ENTRY pEntry,
5333 IN PUCHAR pData,
5334 IN ULONG DataByteCount,
5335 IN UCHAR FromWhichBSSID);
5337 VOID AES_GTK_KEY_UNWRAP(
5338 IN UCHAR *key,
5339 OUT UCHAR *plaintext,
5340 IN UCHAR c_len,
5341 IN UCHAR *ciphertext);
5343 BOOLEAN RTMPCheckRSNIE(
5344 IN PRTMP_ADAPTER pAd,
5345 IN PUCHAR pData,
5346 IN UCHAR DataLen,
5347 IN MAC_TABLE_ENTRY *pEntry,
5348 OUT UCHAR *Offset);
5350 BOOLEAN RTMPParseEapolKeyData(
5351 IN PRTMP_ADAPTER pAd,
5352 IN PUCHAR pKeyData,
5353 IN UCHAR KeyDataLen,
5354 IN UCHAR GroupKeyIndex,
5355 IN UCHAR MsgType,
5356 IN BOOLEAN bWPA2,
5357 IN MAC_TABLE_ENTRY *pEntry);
5359 VOID ConstructEapolMsg(
5360 IN PRTMP_ADAPTER pAd,
5361 IN UCHAR PeerAuthMode,
5362 IN UCHAR PeerWepStatus,
5363 IN UCHAR MyGroupKeyWepStatus,
5364 IN UCHAR MsgType,
5365 IN UCHAR DefaultKeyIdx,
5366 IN UCHAR *ReplayCounter,
5367 IN UCHAR *KeyNonce,
5368 IN UCHAR *TxRSC,
5369 IN UCHAR *PTK,
5370 IN UCHAR *GTK,
5371 IN UCHAR *RSNIE,
5372 IN UCHAR RSNIE_Len,
5373 OUT PEAPOL_PACKET pMsg);
5375 VOID CalculateMIC(
5376 IN PRTMP_ADAPTER pAd,
5377 IN UCHAR PeerWepStatus,
5378 IN UCHAR *PTK,
5379 OUT PEAPOL_PACKET pMsg);
5381 NDIS_STATUS RTMPSoftDecryptBroadCastData(
5382 IN PRTMP_ADAPTER pAd,
5383 IN RX_BLK *pRxBlk,
5384 IN NDIS_802_11_ENCRYPTION_STATUS GroupCipher,
5385 IN PCIPHER_KEY pShard_key);
5387 VOID ConstructEapolKeyData(
5388 IN PRTMP_ADAPTER pAd,
5389 IN UCHAR PeerAuthMode,
5390 IN UCHAR PeerWepStatus,
5391 IN UCHAR GroupKeyWepStatus,
5392 IN UCHAR MsgType,
5393 IN UCHAR DefaultKeyIdx,
5394 IN BOOLEAN bWPA2Capable,
5395 IN UCHAR *PTK,
5396 IN UCHAR *GTK,
5397 IN UCHAR *RSNIE,
5398 IN UCHAR RSNIE_LEN,
5399 OUT PEAPOL_PACKET pMsg);
5401 VOID RTMPMakeRSNIE(
5402 IN PRTMP_ADAPTER pAd,
5403 IN UINT AuthMode,
5404 IN UINT WepStatus,
5405 IN UCHAR apidx);
5408 // function prototype in ap_wpa.c
5411 BOOLEAN APWpaMsgTypeSubst(
5412 IN UCHAR EAPType,
5413 OUT INT *MsgType) ;
5415 MAC_TABLE_ENTRY *PACInquiry(
5416 IN PRTMP_ADAPTER pAd,
5417 IN ULONG Wcid);
5419 BOOLEAN RTMPCheckMcast(
5420 IN PRTMP_ADAPTER pAd,
5421 IN PEID_STRUCT eid_ptr,
5422 IN MAC_TABLE_ENTRY *pEntry);
5424 BOOLEAN RTMPCheckUcast(
5425 IN PRTMP_ADAPTER pAd,
5426 IN PEID_STRUCT eid_ptr,
5427 IN MAC_TABLE_ENTRY *pEntry);
5429 BOOLEAN RTMPCheckAUTH(
5430 IN PRTMP_ADAPTER pAd,
5431 IN PEID_STRUCT eid_ptr,
5432 IN MAC_TABLE_ENTRY *pEntry);
5434 VOID WPAStart4WayHS(
5435 IN PRTMP_ADAPTER pAd,
5436 IN MAC_TABLE_ENTRY *pEntry,
5437 IN ULONG TimeInterval);
5439 VOID WPAStart2WayGroupHS(
5440 IN PRTMP_ADAPTER pAd,
5441 IN MAC_TABLE_ENTRY *pEntry);
5443 VOID APWpaEAPPacketAction(
5444 IN PRTMP_ADAPTER pAd,
5445 IN MLME_QUEUE_ELEM *Elem);
5447 VOID APWpaEAPOLStartAction(
5448 IN PRTMP_ADAPTER pAd,
5449 IN MLME_QUEUE_ELEM *Elem);
5451 VOID APWpaEAPOLLogoffAction(
5452 IN PRTMP_ADAPTER pAd,
5453 IN MLME_QUEUE_ELEM *Elem);
5455 VOID APWpaEAPOLKeyAction(
5456 IN PRTMP_ADAPTER pAd,
5457 IN MLME_QUEUE_ELEM *Elem);
5459 VOID APWpaEAPOLASFAlertAction(
5460 IN PRTMP_ADAPTER pAd,
5461 IN MLME_QUEUE_ELEM *Elem);
5463 VOID HandleCounterMeasure(
5464 IN PRTMP_ADAPTER pAd,
5465 IN MAC_TABLE_ENTRY *pEntry);
5467 VOID PeerPairMsg2Action(
5468 IN PRTMP_ADAPTER pAd,
5469 IN MAC_TABLE_ENTRY *pEntry,
5470 IN MLME_QUEUE_ELEM *Elem);
5472 VOID PeerPairMsg4Action(
5473 IN PRTMP_ADAPTER pAd,
5474 IN MAC_TABLE_ENTRY *pEntry,
5475 IN MLME_QUEUE_ELEM *Elem);
5477 VOID CMTimerExec(
5478 IN PVOID SystemSpecific1,
5479 IN PVOID FunctionContext,
5480 IN PVOID SystemSpecific2,
5481 IN PVOID SystemSpecific3);
5483 VOID WPARetryExec(
5484 IN PVOID SystemSpecific1,
5485 IN PVOID FunctionContext,
5486 IN PVOID SystemSpecific2,
5487 IN PVOID SystemSpecific3);
5489 VOID EnqueueStartForPSKExec(
5490 IN PVOID SystemSpecific1,
5491 IN PVOID FunctionContext,
5492 IN PVOID SystemSpecific2,
5493 IN PVOID SystemSpecific3);
5495 VOID RTMPHandleSTAKey(
5496 IN PRTMP_ADAPTER pAdapter,
5497 IN MAC_TABLE_ENTRY *pEntry,
5498 IN MLME_QUEUE_ELEM *Elem);
5500 VOID PeerGroupMsg2Action(
5501 IN PRTMP_ADAPTER pAd,
5502 IN PMAC_TABLE_ENTRY pEntry,
5503 IN VOID *Msg,
5504 IN UINT MsgLen);
5506 VOID PairDisAssocAction(
5507 IN PRTMP_ADAPTER pAd,
5508 IN PMAC_TABLE_ENTRY pEntry,
5509 IN USHORT Reason);
5511 VOID MlmeDeAuthAction(
5512 IN PRTMP_ADAPTER pAd,
5513 IN PMAC_TABLE_ENTRY pEntry,
5514 IN USHORT Reason);
5516 VOID GREKEYPeriodicExec(
5517 IN PVOID SystemSpecific1,
5518 IN PVOID FunctionContext,
5519 IN PVOID SystemSpecific2,
5520 IN PVOID SystemSpecific3);
5522 VOID CountGTK(
5523 IN UCHAR *PMK,
5524 IN UCHAR *GNonce,
5525 IN UCHAR *AA,
5526 OUT UCHAR *output,
5527 IN UINT len);
5529 VOID GetSmall(
5530 IN PVOID pSrc1,
5531 IN PVOID pSrc2,
5532 OUT PUCHAR out,
5533 IN ULONG Length);
5535 VOID GetLarge(
5536 IN PVOID pSrc1,
5537 IN PVOID pSrc2,
5538 OUT PUCHAR out,
5539 IN ULONG Length);
5541 VOID APGenRandom(
5542 IN PRTMP_ADAPTER pAd,
5543 OUT UCHAR *random);
5545 VOID AES_GTK_KEY_WRAP(
5546 IN UCHAR *key,
5547 IN UCHAR *plaintext,
5548 IN UCHAR p_len,
5549 OUT UCHAR *ciphertext);
5551 VOID WpaSend(
5552 IN PRTMP_ADAPTER pAdapter,
5553 IN PUCHAR pPacket,
5554 IN ULONG Len);
5556 VOID APToWirelessSta(
5557 IN PRTMP_ADAPTER pAd,
5558 IN MAC_TABLE_ENTRY *pEntry,
5559 IN PUCHAR pHeader802_3,
5560 IN UINT HdrLen,
5561 IN PUCHAR pData,
5562 IN UINT DataLen,
5563 IN BOOLEAN bClearFrame);
5565 VOID RTMPAddPMKIDCache(
5566 IN PRTMP_ADAPTER pAd,
5567 IN INT apidx,
5568 IN PUCHAR pAddr,
5569 IN UCHAR *PMKID,
5570 IN UCHAR *PMK);
5572 INT RTMPSearchPMKIDCache(
5573 IN PRTMP_ADAPTER pAd,
5574 IN INT apidx,
5575 IN PUCHAR pAddr);
5577 VOID RTMPDeletePMKIDCache(
5578 IN PRTMP_ADAPTER pAd,
5579 IN INT apidx,
5580 IN INT idx);
5582 VOID RTMPMaintainPMKIDCache(
5583 IN PRTMP_ADAPTER pAd);
5585 VOID RTMPSendTriggerFrame(
5586 IN PRTMP_ADAPTER pAd,
5587 IN PVOID pBuffer,
5588 IN ULONG Length,
5589 IN UCHAR TxRate,
5590 IN BOOLEAN bQosNull);
5592 #ifdef RT30xx
5593 VOID RTMPFilterCalibration(
5594 IN PRTMP_ADAPTER pAd);
5595 #endif // RT30xx //
5597 /* timeout -- ms */
5598 VOID RTMP_SetPeriodicTimer(
5599 IN NDIS_MINIPORT_TIMER *pTimer,
5600 IN unsigned long timeout);
5602 VOID RTMP_OS_Init_Timer(
5603 IN PRTMP_ADAPTER pAd,
5604 IN NDIS_MINIPORT_TIMER *pTimer,
5605 IN TIMER_FUNCTION function,
5606 IN PVOID data);
5608 VOID RTMP_OS_Add_Timer(
5609 IN NDIS_MINIPORT_TIMER *pTimer,
5610 IN unsigned long timeout);
5612 VOID RTMP_OS_Mod_Timer(
5613 IN NDIS_MINIPORT_TIMER *pTimer,
5614 IN unsigned long timeout);
5617 VOID RTMP_OS_Del_Timer(
5618 IN NDIS_MINIPORT_TIMER *pTimer,
5619 OUT BOOLEAN *pCancelled);
5622 VOID RTMP_OS_Release_Packet(
5623 IN PRTMP_ADAPTER pAd,
5624 IN PQUEUE_ENTRY pEntry);
5626 VOID RTMPusecDelay(
5627 IN ULONG usec);
5629 NDIS_STATUS os_alloc_mem(
5630 IN PRTMP_ADAPTER pAd,
5631 OUT PUCHAR *mem,
5632 IN ULONG size);
5634 NDIS_STATUS os_free_mem(
5635 IN PRTMP_ADAPTER pAd,
5636 IN PUCHAR mem);
5639 void RTMP_AllocateSharedMemory(
5640 IN PRTMP_ADAPTER pAd,
5641 IN ULONG Length,
5642 IN BOOLEAN Cached,
5643 OUT PVOID *VirtualAddress,
5644 OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress);
5646 VOID RTMPFreeTxRxRingMemory(
5647 IN PRTMP_ADAPTER pAd);
5649 NDIS_STATUS AdapterBlockAllocateMemory(
5650 IN PVOID handle,
5651 OUT PVOID *ppAd);
5653 void RTMP_AllocateTxDescMemory(
5654 IN PRTMP_ADAPTER pAd,
5655 IN UINT Index,
5656 IN ULONG Length,
5657 IN BOOLEAN Cached,
5658 OUT PVOID *VirtualAddress,
5659 OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress);
5661 void RTMP_AllocateFirstTxBuffer(
5662 IN PRTMP_ADAPTER pAd,
5663 IN UINT Index,
5664 IN ULONG Length,
5665 IN BOOLEAN Cached,
5666 OUT PVOID *VirtualAddress,
5667 OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress);
5669 void RTMP_AllocateMgmtDescMemory(
5670 IN PRTMP_ADAPTER pAd,
5671 IN ULONG Length,
5672 IN BOOLEAN Cached,
5673 OUT PVOID *VirtualAddress,
5674 OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress);
5676 void RTMP_AllocateRxDescMemory(
5677 IN PRTMP_ADAPTER pAd,
5678 IN ULONG Length,
5679 IN BOOLEAN Cached,
5680 OUT PVOID *VirtualAddress,
5681 OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress);
5683 PNDIS_PACKET RTMP_AllocateRxPacketBuffer(
5684 IN PRTMP_ADAPTER pAd,
5685 IN ULONG Length,
5686 IN BOOLEAN Cached,
5687 OUT PVOID *VirtualAddress,
5688 OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress);
5690 PNDIS_PACKET RTMP_AllocateTxPacketBuffer(
5691 IN PRTMP_ADAPTER pAd,
5692 IN ULONG Length,
5693 IN BOOLEAN Cached,
5694 OUT PVOID *VirtualAddress);
5696 PNDIS_PACKET RTMP_AllocateFragPacketBuffer(
5697 IN PRTMP_ADAPTER pAd,
5698 IN ULONG Length);
5700 void RTMP_QueryPacketInfo(
5701 IN PNDIS_PACKET pPacket,
5702 OUT PACKET_INFO *pPacketInfo,
5703 OUT PUCHAR *pSrcBufVA,
5704 OUT UINT *pSrcBufLen);
5706 void RTMP_QueryNextPacketInfo(
5707 IN PNDIS_PACKET *ppPacket,
5708 OUT PACKET_INFO *pPacketInfo,
5709 OUT PUCHAR *pSrcBufVA,
5710 OUT UINT *pSrcBufLen);
5713 BOOLEAN RTMP_FillTxBlkInfo(
5714 IN RTMP_ADAPTER *pAd,
5715 IN TX_BLK *pTxBlk);
5718 PRTMP_SCATTER_GATHER_LIST
5719 rt_get_sg_list_from_packet(PNDIS_PACKET pPacket, RTMP_SCATTER_GATHER_LIST *sg);
5722 void announce_802_3_packet(
5723 IN PRTMP_ADAPTER pAd,
5724 IN PNDIS_PACKET pPacket);
5727 UINT BA_Reorder_AMSDU_Annnounce(
5728 IN PRTMP_ADAPTER pAd,
5729 IN PNDIS_PACKET pPacket);
5732 UINT Handle_AMSDU_Packet(
5733 IN PRTMP_ADAPTER pAd,
5734 IN PUCHAR pData,
5735 IN ULONG DataSize,
5736 IN UCHAR FromWhichBSSID);
5739 void convert_802_11_to_802_3_packet(
5740 IN PRTMP_ADAPTER pAd,
5741 IN PNDIS_PACKET pPacket,
5742 IN PUCHAR p8023hdr,
5743 IN PUCHAR pData,
5744 IN ULONG DataSize,
5745 IN UCHAR FromWhichBSSID);
5748 PNET_DEV get_netdev_from_bssid(
5749 IN PRTMP_ADAPTER pAd,
5750 IN UCHAR FromWhichBSSID);
5753 PNDIS_PACKET duplicate_pkt(
5754 IN PRTMP_ADAPTER pAd,
5755 IN PUCHAR pHeader802_3,
5756 IN UINT HdrLen,
5757 IN PUCHAR pData,
5758 IN ULONG DataSize,
5759 IN UCHAR FromWhichBSSID);
5762 PNDIS_PACKET duplicate_pkt_with_TKIP_MIC(
5763 IN PRTMP_ADAPTER pAd,
5764 IN PNDIS_PACKET pOldPkt);
5766 PNDIS_PACKET duplicate_pkt_with_VLAN(
5767 IN PRTMP_ADAPTER pAd,
5768 IN PUCHAR pHeader802_3,
5769 IN UINT HdrLen,
5770 IN PUCHAR pData,
5771 IN ULONG DataSize,
5772 IN UCHAR FromWhichBSSID);
5774 PNDIS_PACKET duplicate_pkt_with_WPI(
5775 IN PRTMP_ADAPTER pAd,
5776 IN PNDIS_PACKET pPacket,
5777 IN UINT32 ext_head_len,
5778 IN UINT32 ext_tail_len);
5780 UCHAR VLAN_8023_Header_Copy(
5781 IN PRTMP_ADAPTER pAd,
5782 IN PUCHAR pHeader802_3,
5783 IN UINT HdrLen,
5784 OUT PUCHAR pData,
5785 IN UCHAR FromWhichBSSID);
5787 void ba_flush_reordering_timeout_mpdus(
5788 IN PRTMP_ADAPTER pAd,
5789 IN PBA_REC_ENTRY pBAEntry,
5790 IN ULONG Now32);
5793 VOID BAOriSessionSetUp(
5794 IN PRTMP_ADAPTER pAd,
5795 IN MAC_TABLE_ENTRY *pEntry,
5796 IN UCHAR TID,
5797 IN USHORT TimeOut,
5798 IN ULONG DelayTime,
5799 IN BOOLEAN isForced);
5801 VOID BASessionTearDownALL(
5802 IN OUT PRTMP_ADAPTER pAd,
5803 IN UCHAR Wcid);
5805 BOOLEAN OS_Need_Clone_Packet(void);
5808 VOID build_tx_packet(
5809 IN PRTMP_ADAPTER pAd,
5810 IN PNDIS_PACKET pPacket,
5811 IN PUCHAR pFrame,
5812 IN ULONG FrameLen);
5815 VOID BAOriSessionTearDown(
5816 IN OUT PRTMP_ADAPTER pAd,
5817 IN UCHAR Wcid,
5818 IN UCHAR TID,
5819 IN BOOLEAN bPassive,
5820 IN BOOLEAN bForceSend);
5822 VOID BARecSessionTearDown(
5823 IN OUT PRTMP_ADAPTER pAd,
5824 IN UCHAR Wcid,
5825 IN UCHAR TID,
5826 IN BOOLEAN bPassive);
5828 BOOLEAN ba_reordering_resource_init(PRTMP_ADAPTER pAd, int num);
5829 void ba_reordering_resource_release(PRTMP_ADAPTER pAd);
5831 ULONG AutoChBssInsertEntry(
5832 IN PRTMP_ADAPTER pAd,
5833 IN PUCHAR pBssid,
5834 IN CHAR Ssid[],
5835 IN UCHAR SsidLen,
5836 IN UCHAR ChannelNo,
5837 IN CHAR Rssi);
5839 void AutoChBssTableInit(
5840 IN PRTMP_ADAPTER pAd);
5842 void ChannelInfoInit(
5843 IN PRTMP_ADAPTER pAd);
5845 void AutoChBssTableDestroy(
5846 IN PRTMP_ADAPTER pAd);
5848 void ChannelInfoDestroy(
5849 IN PRTMP_ADAPTER pAd);
5851 UCHAR New_ApAutoSelectChannel(
5852 IN PRTMP_ADAPTER pAd);
5854 BOOLEAN rtstrmactohex(
5855 IN char *s1,
5856 IN char *s2);
5858 BOOLEAN rtstrcasecmp(
5859 IN char *s1,
5860 IN char *s2);
5862 char *rtstrstruncasecmp(
5863 IN char *s1,
5864 IN char *s2);
5866 char *rtstrstr(
5867 IN const char * s1,
5868 IN const char * s2);
5870 char *rstrtok(
5871 IN char * s,
5872 IN const char * ct);
5874 int rtinet_aton(
5875 const char *cp,
5876 unsigned int *addr);
5878 ////////// common ioctl functions //////////
5879 INT Set_DriverVersion_Proc(
5880 IN PRTMP_ADAPTER pAd,
5881 IN PUCHAR arg);
5883 INT Set_CountryRegion_Proc(
5884 IN PRTMP_ADAPTER pAd,
5885 IN PUCHAR arg);
5887 INT Set_CountryRegionABand_Proc(
5888 IN PRTMP_ADAPTER pAd,
5889 IN PUCHAR arg);
5891 INT Set_WirelessMode_Proc(
5892 IN PRTMP_ADAPTER pAd,
5893 IN PUCHAR arg);
5895 INT Set_Channel_Proc(
5896 IN PRTMP_ADAPTER pAd,
5897 IN PUCHAR arg);
5899 INT Set_ShortSlot_Proc(
5900 IN PRTMP_ADAPTER pAd,
5901 IN PUCHAR arg);
5903 INT Set_TxPower_Proc(
5904 IN PRTMP_ADAPTER pAd,
5905 IN PUCHAR arg);
5907 INT Set_BGProtection_Proc(
5908 IN PRTMP_ADAPTER pAd,
5909 IN PUCHAR arg);
5911 INT Set_TxPreamble_Proc(
5912 IN PRTMP_ADAPTER pAd,
5913 IN PUCHAR arg);
5915 INT Set_RTSThreshold_Proc(
5916 IN PRTMP_ADAPTER pAd,
5917 IN PUCHAR arg);
5919 INT Set_FragThreshold_Proc(
5920 IN PRTMP_ADAPTER pAd,
5921 IN PUCHAR arg);
5923 INT Set_TxBurst_Proc(
5924 IN PRTMP_ADAPTER pAd,
5925 IN PUCHAR arg);
5927 #ifdef AGGREGATION_SUPPORT
5928 INT Set_PktAggregate_Proc(
5929 IN PRTMP_ADAPTER pAd,
5930 IN PUCHAR arg);
5931 #endif
5933 INT Set_IEEE80211H_Proc(
5934 IN PRTMP_ADAPTER pAd,
5935 IN PUCHAR arg);
5937 #ifdef DBG
5938 INT Set_Debug_Proc(
5939 IN PRTMP_ADAPTER pAd,
5940 IN PUCHAR arg);
5941 #endif
5943 INT Show_DescInfo_Proc(
5944 IN PRTMP_ADAPTER pAd,
5945 IN PUCHAR arg);
5947 INT Set_ResetStatCounter_Proc(
5948 IN PRTMP_ADAPTER pAd,
5949 IN PUCHAR arg);
5951 INT Set_BASetup_Proc(
5952 IN PRTMP_ADAPTER pAd,
5953 IN PUCHAR arg);
5955 INT Set_BADecline_Proc(
5956 IN PRTMP_ADAPTER pAd,
5957 IN PUCHAR arg);
5959 INT Set_BAOriTearDown_Proc(
5960 IN PRTMP_ADAPTER pAd,
5961 IN PUCHAR arg);
5963 INT Set_BARecTearDown_Proc(
5964 IN PRTMP_ADAPTER pAd,
5965 IN PUCHAR arg);
5967 INT Set_HtBw_Proc(
5968 IN PRTMP_ADAPTER pAd,
5969 IN PUCHAR arg);
5971 INT Set_HtMcs_Proc(
5972 IN PRTMP_ADAPTER pAd,
5973 IN PUCHAR arg);
5975 INT Set_HtGi_Proc(
5976 IN PRTMP_ADAPTER pAd,
5977 IN PUCHAR arg);
5979 INT Set_HtOpMode_Proc(
5980 IN PRTMP_ADAPTER pAd,
5981 IN PUCHAR arg);
5983 INT Set_HtStbc_Proc(
5984 IN PRTMP_ADAPTER pAd,
5985 IN PUCHAR arg);
5987 INT Set_HtHtc_Proc(
5988 IN PRTMP_ADAPTER pAd,
5989 IN PUCHAR arg);
5991 INT Set_HtExtcha_Proc(
5992 IN PRTMP_ADAPTER pAd,
5993 IN PUCHAR arg);
5995 INT Set_HtMpduDensity_Proc(
5996 IN PRTMP_ADAPTER pAd,
5997 IN PUCHAR arg);
5999 INT Set_HtBaWinSize_Proc(
6000 IN PRTMP_ADAPTER pAd,
6001 IN PUCHAR arg);
6003 INT Set_HtRdg_Proc(
6004 IN PRTMP_ADAPTER pAd,
6005 IN PUCHAR arg);
6007 INT Set_HtLinkAdapt_Proc(
6008 IN PRTMP_ADAPTER pAd,
6009 IN PUCHAR arg);
6011 INT Set_HtAmsdu_Proc(
6012 IN PRTMP_ADAPTER pAd,
6013 IN PUCHAR arg);
6015 INT Set_HtAutoBa_Proc(
6016 IN PRTMP_ADAPTER pAd,
6017 IN PUCHAR arg);
6019 INT Set_HtProtect_Proc(
6020 IN PRTMP_ADAPTER pAd,
6021 IN PUCHAR arg);
6023 INT Set_HtMimoPs_Proc(
6024 IN PRTMP_ADAPTER pAd,
6025 IN PUCHAR arg);
6028 INT Set_ForceShortGI_Proc(
6029 IN PRTMP_ADAPTER pAd,
6030 IN PUCHAR arg);
6032 INT Set_ForceGF_Proc(
6033 IN PRTMP_ADAPTER pAd,
6034 IN PUCHAR arg);
6036 INT SetCommonHT(
6037 IN PRTMP_ADAPTER pAd);
6039 INT Set_SendPSMPAction_Proc(
6040 IN PRTMP_ADAPTER pAd,
6041 IN PUCHAR arg);
6043 INT Set_HtMIMOPSmode_Proc(
6044 IN PRTMP_ADAPTER pAd,
6045 IN PUCHAR arg);
6048 INT Set_HtTxBASize_Proc(
6049 IN PRTMP_ADAPTER pAd,
6050 IN PUCHAR arg);
6052 //Dls , kathy
6053 VOID RTMPSendDLSTearDownFrame(
6054 IN PRTMP_ADAPTER pAd,
6055 IN PUCHAR pDA);
6057 //Block ACK
6058 VOID QueryBATABLE(
6059 IN PRTMP_ADAPTER pAd,
6060 OUT PQUERYBA_TABLE pBAT);
6062 INT WpaCheckEapCode(
6063 IN PRTMP_ADAPTER pAd,
6064 IN PUCHAR pFrame,
6065 IN USHORT FrameLen,
6066 IN USHORT OffSet);
6068 VOID WpaSendMicFailureToWpaSupplicant(
6069 IN PRTMP_ADAPTER pAd,
6070 IN BOOLEAN bUnicast);
6072 VOID SendAssocIEsToWpaSupplicant(
6073 IN PRTMP_ADAPTER pAd);
6075 int wext_notify_event_assoc(
6076 IN RTMP_ADAPTER *pAd);
6078 VOID Handle_BSS_Width_Trigger_Events(
6079 IN PRTMP_ADAPTER pAd);
6081 void build_ext_channel_switch_ie(
6082 IN PRTMP_ADAPTER pAd,
6083 IN HT_EXT_CHANNEL_SWITCH_ANNOUNCEMENT_IE *pIE);
6085 BOOLEAN APRxDoneInterruptHandle(
6086 IN PRTMP_ADAPTER pAd);
6088 BOOLEAN STARxDoneInterruptHandle(
6089 IN PRTMP_ADAPTER pAd,
6090 IN BOOLEAN argc);
6092 // AMPDU packet indication
6093 VOID Indicate_AMPDU_Packet(
6094 IN PRTMP_ADAPTER pAd,
6095 IN RX_BLK *pRxBlk,
6096 IN UCHAR FromWhichBSSID);
6098 // AMSDU packet indication
6099 VOID Indicate_AMSDU_Packet(
6100 IN PRTMP_ADAPTER pAd,
6101 IN RX_BLK *pRxBlk,
6102 IN UCHAR FromWhichBSSID);
6104 // Normal legacy Rx packet indication
6105 VOID Indicate_Legacy_Packet(
6106 IN PRTMP_ADAPTER pAd,
6107 IN RX_BLK *pRxBlk,
6108 IN UCHAR FromWhichBSSID);
6110 VOID Indicate_EAPOL_Packet(
6111 IN PRTMP_ADAPTER pAd,
6112 IN RX_BLK *pRxBlk,
6113 IN UCHAR FromWhichBSSID);
6115 void update_os_packet_info(
6116 IN PRTMP_ADAPTER pAd,
6117 IN RX_BLK *pRxBlk,
6118 IN UCHAR FromWhichBSSID);
6120 void wlan_802_11_to_802_3_packet(
6121 IN PRTMP_ADAPTER pAd,
6122 IN RX_BLK *pRxBlk,
6123 IN PUCHAR pHeader802_3,
6124 IN UCHAR FromWhichBSSID);
6126 UINT deaggregate_AMSDU_announce(
6127 IN PRTMP_ADAPTER pAd,
6128 PNDIS_PACKET pPacket,
6129 IN PUCHAR pData,
6130 IN ULONG DataSize);
6132 // remove LLC and get 802_3 Header
6133 #define RTMP_802_11_REMOVE_LLC_AND_CONVERT_TO_802_3(_pRxBlk, _pHeader802_3) \
6135 PUCHAR _pRemovedLLCSNAP = NULL, _pDA, _pSA; \
6137 if (RX_BLK_TEST_FLAG(_pRxBlk, fRX_MESH)) \
6139 _pDA = _pRxBlk->pHeader->Addr3; \
6140 _pSA = (PUCHAR)_pRxBlk->pHeader + sizeof(HEADER_802_11); \
6142 else \
6144 if (RX_BLK_TEST_FLAG(_pRxBlk, fRX_INFRA)) \
6146 _pDA = _pRxBlk->pHeader->Addr1; \
6147 if (RX_BLK_TEST_FLAG(_pRxBlk, fRX_DLS)) \
6148 _pSA = _pRxBlk->pHeader->Addr2; \
6149 else \
6150 _pSA = _pRxBlk->pHeader->Addr3; \
6152 else \
6154 _pDA = _pRxBlk->pHeader->Addr1; \
6155 _pSA = _pRxBlk->pHeader->Addr2; \
6159 CONVERT_TO_802_3(_pHeader802_3, _pDA, _pSA, _pRxBlk->pData, \
6160 _pRxBlk->DataSize, _pRemovedLLCSNAP); \
6163 BOOLEAN APFowardWirelessStaToWirelessSta(
6164 IN PRTMP_ADAPTER pAd,
6165 IN PNDIS_PACKET pPacket,
6166 IN ULONG FromWhichBSSID);
6168 VOID Announce_or_Forward_802_3_Packet(
6169 IN PRTMP_ADAPTER pAd,
6170 IN PNDIS_PACKET pPacket,
6171 IN UCHAR FromWhichBSSID);
6173 VOID Sta_Announce_or_Forward_802_3_Packet(
6174 IN PRTMP_ADAPTER pAd,
6175 IN PNDIS_PACKET pPacket,
6176 IN UCHAR FromWhichBSSID);
6178 #define ANNOUNCE_OR_FORWARD_802_3_PACKET(_pAd, _pPacket, _FromWhichBSS)\
6179 Sta_Announce_or_Forward_802_3_Packet(_pAd, _pPacket, _FromWhichBSS);
6180 //announce_802_3_packet(_pAd, _pPacket);
6182 PNDIS_PACKET DuplicatePacket(
6183 IN PRTMP_ADAPTER pAd,
6184 IN PNDIS_PACKET pPacket,
6185 IN UCHAR FromWhichBSSID);
6188 PNDIS_PACKET ClonePacket(
6189 IN PRTMP_ADAPTER pAd,
6190 IN PNDIS_PACKET pPacket,
6191 IN PUCHAR pData,
6192 IN ULONG DataSize);
6195 // Normal, AMPDU or AMSDU
6196 VOID CmmRxnonRalinkFrameIndicate(
6197 IN PRTMP_ADAPTER pAd,
6198 IN RX_BLK *pRxBlk,
6199 IN UCHAR FromWhichBSSID);
6201 VOID CmmRxRalinkFrameIndicate(
6202 IN PRTMP_ADAPTER pAd,
6203 IN MAC_TABLE_ENTRY *pEntry,
6204 IN RX_BLK *pRxBlk,
6205 IN UCHAR FromWhichBSSID);
6207 VOID Update_Rssi_Sample(
6208 IN PRTMP_ADAPTER pAd,
6209 IN RSSI_SAMPLE *pRssi,
6210 IN PRXWI_STRUC pRxWI);
6212 PNDIS_PACKET GetPacketFromRxRing(
6213 IN PRTMP_ADAPTER pAd,
6214 OUT PRT28XX_RXD_STRUC pSaveRxD,
6215 OUT BOOLEAN *pbReschedule,
6216 IN OUT UINT32 *pRxPending);
6218 PNDIS_PACKET RTMPDeFragmentDataFrame(
6219 IN PRTMP_ADAPTER pAd,
6220 IN RX_BLK *pRxBlk);
6222 ////////////////////////////////////////
6223 enum {
6224 DIDmsg_lnxind_wlansniffrm = 0x00000044,
6225 DIDmsg_lnxind_wlansniffrm_hosttime = 0x00010044,
6226 DIDmsg_lnxind_wlansniffrm_mactime = 0x00020044,
6227 DIDmsg_lnxind_wlansniffrm_channel = 0x00030044,
6228 DIDmsg_lnxind_wlansniffrm_rssi = 0x00040044,
6229 DIDmsg_lnxind_wlansniffrm_sq = 0x00050044,
6230 DIDmsg_lnxind_wlansniffrm_signal = 0x00060044,
6231 DIDmsg_lnxind_wlansniffrm_noise = 0x00070044,
6232 DIDmsg_lnxind_wlansniffrm_rate = 0x00080044,
6233 DIDmsg_lnxind_wlansniffrm_istx = 0x00090044,
6234 DIDmsg_lnxind_wlansniffrm_frmlen = 0x000A0044
6236 enum {
6237 P80211ENUM_msgitem_status_no_value = 0x00
6239 enum {
6240 P80211ENUM_truth_false = 0x00,
6241 P80211ENUM_truth_true = 0x01
6244 /* Definition from madwifi */
6245 typedef struct {
6246 UINT32 did;
6247 UINT16 status;
6248 UINT16 len;
6249 UINT32 data;
6250 } p80211item_uint32_t;
6252 typedef struct {
6253 UINT32 msgcode;
6254 UINT32 msglen;
6255 #define WLAN_DEVNAMELEN_MAX 16
6256 UINT8 devname[WLAN_DEVNAMELEN_MAX];
6257 p80211item_uint32_t hosttime;
6258 p80211item_uint32_t mactime;
6259 p80211item_uint32_t channel;
6260 p80211item_uint32_t rssi;
6261 p80211item_uint32_t sq;
6262 p80211item_uint32_t signal;
6263 p80211item_uint32_t noise;
6264 p80211item_uint32_t rate;
6265 p80211item_uint32_t istx;
6266 p80211item_uint32_t frmlen;
6267 } wlan_ng_prism2_header;
6269 /* The radio capture header precedes the 802.11 header. */
6270 typedef struct PACKED _ieee80211_radiotap_header {
6271 UINT8 it_version; /* Version 0. Only increases
6272 * for drastic changes,
6273 * introduction of compatible
6274 * new fields does not count.
6276 UINT8 it_pad;
6277 UINT16 it_len; /* length of the whole
6278 * header in bytes, including
6279 * it_version, it_pad,
6280 * it_len, and data fields.
6282 UINT32 it_present; /* A bitmap telling which
6283 * fields are present. Set bit 31
6284 * (0x80000000) to extend the
6285 * bitmap by another 32 bits.
6286 * Additional extensions are made
6287 * by setting bit 31.
6289 }ieee80211_radiotap_header ;
6291 enum ieee80211_radiotap_type {
6292 IEEE80211_RADIOTAP_TSFT = 0,
6293 IEEE80211_RADIOTAP_FLAGS = 1,
6294 IEEE80211_RADIOTAP_RATE = 2,
6295 IEEE80211_RADIOTAP_CHANNEL = 3,
6296 IEEE80211_RADIOTAP_FHSS = 4,
6297 IEEE80211_RADIOTAP_DBM_ANTSIGNAL = 5,
6298 IEEE80211_RADIOTAP_DBM_ANTNOISE = 6,
6299 IEEE80211_RADIOTAP_LOCK_QUALITY = 7,
6300 IEEE80211_RADIOTAP_TX_ATTENUATION = 8,
6301 IEEE80211_RADIOTAP_DB_TX_ATTENUATION = 9,
6302 IEEE80211_RADIOTAP_DBM_TX_POWER = 10,
6303 IEEE80211_RADIOTAP_ANTENNA = 11,
6304 IEEE80211_RADIOTAP_DB_ANTSIGNAL = 12,
6305 IEEE80211_RADIOTAP_DB_ANTNOISE = 13
6308 #define WLAN_RADIOTAP_PRESENT ( \
6309 (1 << IEEE80211_RADIOTAP_TSFT) | \
6310 (1 << IEEE80211_RADIOTAP_FLAGS) | \
6311 (1 << IEEE80211_RADIOTAP_RATE) | \
6314 typedef struct _wlan_radiotap_header {
6315 ieee80211_radiotap_header wt_ihdr;
6316 INT64 wt_tsft;
6317 UINT8 wt_flags;
6318 UINT8 wt_rate;
6319 } wlan_radiotap_header;
6320 /* Definition from madwifi */
6322 void send_monitor_packets(
6323 IN PRTMP_ADAPTER pAd,
6324 IN RX_BLK *pRxBlk);
6326 #if WIRELESS_EXT >= 12
6327 // This function will be called when query /proc
6328 struct iw_statistics *rt28xx_get_wireless_stats(
6329 IN struct net_device *net_dev);
6330 #endif
6332 VOID RTMPSetDesiredRates(
6333 IN PRTMP_ADAPTER pAdapter,
6334 IN LONG Rates);
6336 INT Set_FixedTxMode_Proc(
6337 IN PRTMP_ADAPTER pAd,
6338 IN PUCHAR arg);
6340 static inline char* GetPhyMode(
6341 int Mode)
6343 switch(Mode)
6345 case MODE_CCK:
6346 return "CCK";
6348 case MODE_OFDM:
6349 return "OFDM";
6350 case MODE_HTMIX:
6351 return "HTMIX";
6353 case MODE_HTGREENFIELD:
6354 return "GREEN";
6355 default:
6356 return "N/A";
6361 static inline char* GetBW(
6362 int BW)
6364 switch(BW)
6366 case BW_10:
6367 return "10M";
6369 case BW_20:
6370 return "20M";
6371 case BW_40:
6372 return "40M";
6373 default:
6374 return "N/A";
6379 VOID RT28xxThreadTerminate(
6380 IN RTMP_ADAPTER *pAd);
6382 BOOLEAN RT28XXChipsetCheck(
6383 IN void *_dev_p);
6385 BOOLEAN RT28XXNetDevInit(
6386 IN void *_dev_p,
6387 IN struct net_device *net_dev,
6388 IN RTMP_ADAPTER *pAd);
6390 BOOLEAN RT28XXProbePostConfig(
6391 IN void *_dev_p,
6392 IN RTMP_ADAPTER *pAd,
6393 IN INT32 argc);
6395 VOID RT28XXDMADisable(
6396 IN RTMP_ADAPTER *pAd);
6398 VOID RT28XXDMAEnable(
6399 IN RTMP_ADAPTER *pAd);
6401 VOID RT28xx_UpdateBeaconToAsic(
6402 IN RTMP_ADAPTER * pAd,
6403 IN INT apidx,
6404 IN ULONG BeaconLen,
6405 IN ULONG UpdatePos);
6407 INT rt28xx_ioctl(
6408 IN struct net_device *net_dev,
6409 IN OUT struct ifreq *rq,
6410 IN INT cmd);
6412 INT rt28xx_sta_ioctl(
6413 IN struct net_device *net_dev,
6414 IN OUT struct ifreq *rq,
6415 IN INT cmd);
6417 BOOLEAN RT28XXSecurityKeyAdd(
6418 IN PRTMP_ADAPTER pAd,
6419 IN ULONG apidx,
6420 IN ULONG KeyIdx,
6421 IN MAC_TABLE_ENTRY *pEntry);
6423 ////////////////////////////////////////
6424 PNDIS_PACKET GetPacketFromRxRing(
6425 IN PRTMP_ADAPTER pAd,
6426 OUT PRT28XX_RXD_STRUC pSaveRxD,
6427 OUT BOOLEAN *pbReschedule,
6428 IN OUT UINT32 *pRxPending);
6431 void kill_thread_task(PRTMP_ADAPTER pAd);
6433 void tbtt_tasklet(unsigned long data);
6435 #ifdef RT2860
6437 // Function Prototype in cmm_data_2860.c
6439 USHORT RtmpPCI_WriteTxResource(
6440 IN PRTMP_ADAPTER pAd,
6441 IN TX_BLK *pTxBlk,
6442 IN BOOLEAN bIsLast,
6443 OUT USHORT *FreeNumber);
6445 USHORT RtmpPCI_WriteSingleTxResource(
6446 IN PRTMP_ADAPTER pAd,
6447 IN TX_BLK *pTxBlk,
6448 IN BOOLEAN bIsLast,
6449 OUT USHORT *FreeNumber);
6451 USHORT RtmpPCI_WriteMultiTxResource(
6452 IN PRTMP_ADAPTER pAd,
6453 IN TX_BLK *pTxBlk,
6454 IN UCHAR frameNum,
6455 OUT USHORT *FreeNumber);
6457 USHORT RtmpPCI_WriteFragTxResource(
6458 IN PRTMP_ADAPTER pAd,
6459 IN TX_BLK *pTxBlk,
6460 IN UCHAR fragNum,
6461 OUT USHORT *FreeNumber);
6463 USHORT RtmpPCI_WriteSubTxResource(
6464 IN PRTMP_ADAPTER pAd,
6465 IN TX_BLK *pTxBlk,
6466 IN BOOLEAN bIsLast,
6467 OUT USHORT *FreeNumber);
6469 VOID RtmpPCI_FinalWriteTxResource(
6470 IN PRTMP_ADAPTER pAd,
6471 IN TX_BLK *pTxBlk,
6472 IN USHORT totalMPDUSize,
6473 IN USHORT FirstTxIdx);
6475 VOID RtmpPCIDataLastTxIdx(
6476 IN PRTMP_ADAPTER pAd,
6477 IN UCHAR QueIdx,
6478 IN USHORT LastTxIdx);
6480 VOID RtmpPCIDataKickOut(
6481 IN PRTMP_ADAPTER pAd,
6482 IN TX_BLK *pTxBlk,
6483 IN UCHAR QueIdx);
6486 int RtmpPCIMgmtKickOut(
6487 IN RTMP_ADAPTER *pAd,
6488 IN UCHAR QueIdx,
6489 IN PNDIS_PACKET pPacket,
6490 IN PUCHAR pSrcBufVA,
6491 IN UINT SrcBufLen);
6494 NDIS_STATUS RTMPCheckRxError(
6495 IN PRTMP_ADAPTER pAd,
6496 IN PHEADER_802_11 pHeader,
6497 IN PRXWI_STRUC pRxWI,
6498 IN PRT28XX_RXD_STRUC pRxD);
6500 VOID RTMPInitPCIeLinkCtrlValue(
6501 IN PRTMP_ADAPTER pAd);
6503 VOID RTMPFindHostPCIDev(
6504 IN PRTMP_ADAPTER pAd);
6506 VOID RTMPPCIeLinkCtrlValueRestore(
6507 IN PRTMP_ADAPTER pAd,
6508 IN UCHAR Level);
6510 VOID RTMPPCIeLinkCtrlSetting(
6511 IN PRTMP_ADAPTER pAd,
6512 IN USHORT Max);
6514 VOID RT28xxPciAsicRadioOff(
6515 IN PRTMP_ADAPTER pAd,
6516 IN UCHAR Level,
6517 IN USHORT TbttNumToNextWakeUp);
6519 BOOLEAN RT28xxPciAsicRadioOn(
6520 IN PRTMP_ADAPTER pAd,
6521 IN UCHAR Level);
6523 VOID RT28xxPciStaAsicForceWakeup(
6524 IN PRTMP_ADAPTER pAd,
6525 IN UCHAR Level);
6527 VOID RT28xxPciStaAsicSleepThenAutoWakeup(
6528 IN PRTMP_ADAPTER pAd,
6529 IN USHORT TbttNumToNextWakeUp);
6531 VOID PsPollWakeExec(
6532 IN PVOID SystemSpecific1,
6533 IN PVOID FunctionContext,
6534 IN PVOID SystemSpecific2,
6535 IN PVOID SystemSpecific3);
6537 VOID RadioOnExec(
6538 IN PVOID SystemSpecific1,
6539 IN PVOID FunctionContext,
6540 IN PVOID SystemSpecific2,
6541 IN PVOID SystemSpecific3);
6543 VOID RT28xxPciMlmeRadioOn(
6544 IN PRTMP_ADAPTER pAd);
6546 VOID RT28xxPciMlmeRadioOFF(
6547 IN PRTMP_ADAPTER pAd);
6548 #endif /* RT2860 */
6550 VOID AsicTurnOffRFClk(
6551 IN PRTMP_ADAPTER pAd,
6552 IN UCHAR Channel);
6554 VOID AsicTurnOnRFClk(
6555 IN PRTMP_ADAPTER pAd,
6556 IN UCHAR Channel);
6558 #ifdef RT30xx
6559 NTSTATUS RT30xxWriteRFRegister(
6560 IN PRTMP_ADAPTER pAd,
6561 IN UCHAR RegID,
6562 IN UCHAR Value);
6564 NTSTATUS RT30xxReadRFRegister(
6565 IN PRTMP_ADAPTER pAd,
6566 IN UCHAR RegID,
6567 IN PUCHAR pValue);
6569 //2008/09/11:KH add to support efuse<--
6570 UCHAR eFuseReadRegisters(
6571 IN PRTMP_ADAPTER pAd,
6572 IN USHORT Offset,
6573 IN USHORT Length,
6574 OUT USHORT* pData);
6576 VOID eFuseReadPhysical(
6577 IN PRTMP_ADAPTER pAd,
6578 IN PUSHORT lpInBuffer,
6579 IN ULONG nInBufferSize,
6580 OUT PUSHORT lpOutBuffer,
6581 IN ULONG nOutBufferSize
6584 NTSTATUS eFuseRead(
6585 IN PRTMP_ADAPTER pAd,
6586 IN USHORT Offset,
6587 OUT PUCHAR pData,
6588 IN USHORT Length);
6590 VOID eFusePhysicalWriteRegisters(
6591 IN PRTMP_ADAPTER pAd,
6592 IN USHORT Offset,
6593 IN USHORT Length,
6594 OUT USHORT* pData);
6596 NTSTATUS eFuseWriteRegisters(
6597 IN PRTMP_ADAPTER pAd,
6598 IN USHORT Offset,
6599 IN USHORT Length,
6600 IN USHORT* pData);
6602 VOID eFuseWritePhysical(
6603 IN PRTMP_ADAPTER pAd,
6604 PUSHORT lpInBuffer,
6605 ULONG nInBufferSize,
6606 PUCHAR lpOutBuffer,
6607 ULONG nOutBufferSize
6610 NTSTATUS eFuseWrite(
6611 IN PRTMP_ADAPTER pAd,
6612 IN USHORT Offset,
6613 IN PUCHAR pData,
6614 IN USHORT length);
6616 INT set_eFuseGetFreeBlockCount_Proc(
6617 IN PRTMP_ADAPTER pAd,
6618 IN PUCHAR arg);
6620 INT set_eFusedump_Proc(
6621 IN PRTMP_ADAPTER pAd,
6622 IN PUCHAR arg);
6624 INT set_eFuseLoadFromBin_Proc(
6625 IN PRTMP_ADAPTER pAd,
6626 IN PUCHAR arg);
6628 NTSTATUS eFuseWriteRegistersFromBin(
6629 IN PRTMP_ADAPTER pAd,
6630 IN USHORT Offset,
6631 IN USHORT Length,
6632 IN USHORT* pData);
6634 VOID eFusePhysicalReadRegisters(
6635 IN PRTMP_ADAPTER pAd,
6636 IN USHORT Offset,
6637 IN USHORT Length,
6638 OUT USHORT* pData);
6640 NDIS_STATUS NICLoadEEPROM(
6641 IN PRTMP_ADAPTER pAd);
6643 BOOLEAN bNeedLoadEEPROM(
6644 IN PRTMP_ADAPTER pAd);
6645 //2008/09/11:KH add to support efuse-->
6646 #endif // RT30xx //
6648 #ifdef RT30xx
6649 // add by johnli, RF power sequence setup
6650 VOID RT30xxLoadRFNormalModeSetup(
6651 IN PRTMP_ADAPTER pAd);
6653 VOID RT30xxLoadRFSleepModeSetup(
6654 IN PRTMP_ADAPTER pAd);
6656 VOID RT30xxReverseRFSleepModeSetup(
6657 IN PRTMP_ADAPTER pAd);
6658 // end johnli
6659 #endif // RT30xx //
6661 #ifdef RT2870
6663 // Function Prototype in rtusb_bulk.c
6665 VOID RTUSBInitTxDesc(
6666 IN PRTMP_ADAPTER pAd,
6667 IN PTX_CONTEXT pTxContext,
6668 IN UCHAR BulkOutPipeId,
6669 IN usb_complete_t Func);
6671 VOID RTUSBInitHTTxDesc(
6672 IN PRTMP_ADAPTER pAd,
6673 IN PHT_TX_CONTEXT pTxContext,
6674 IN UCHAR BulkOutPipeId,
6675 IN ULONG BulkOutSize,
6676 IN usb_complete_t Func);
6678 VOID RTUSBInitRxDesc(
6679 IN PRTMP_ADAPTER pAd,
6680 IN PRX_CONTEXT pRxContext);
6682 VOID RTUSBCleanUpDataBulkOutQueue(
6683 IN PRTMP_ADAPTER pAd);
6685 VOID RTUSBCancelPendingBulkOutIRP(
6686 IN PRTMP_ADAPTER pAd);
6688 VOID RTUSBBulkOutDataPacket(
6689 IN PRTMP_ADAPTER pAd,
6690 IN UCHAR BulkOutPipeId,
6691 IN UCHAR Index);
6693 VOID RTUSBBulkOutNullFrame(
6694 IN PRTMP_ADAPTER pAd);
6696 VOID RTUSBBulkOutRTSFrame(
6697 IN PRTMP_ADAPTER pAd);
6699 VOID RTUSBCancelPendingBulkInIRP(
6700 IN PRTMP_ADAPTER pAd);
6702 VOID RTUSBCancelPendingIRPs(
6703 IN PRTMP_ADAPTER pAd);
6705 VOID RTUSBBulkOutMLMEPacket(
6706 IN PRTMP_ADAPTER pAd,
6707 IN UCHAR Index);
6709 VOID RTUSBBulkOutPsPoll(
6710 IN PRTMP_ADAPTER pAd);
6712 VOID RTUSBCleanUpMLMEBulkOutQueue(
6713 IN PRTMP_ADAPTER pAd);
6715 VOID RTUSBKickBulkOut(
6716 IN PRTMP_ADAPTER pAd);
6718 VOID RTUSBBulkReceive(
6719 IN PRTMP_ADAPTER pAd);
6721 VOID DoBulkIn(
6722 IN RTMP_ADAPTER *pAd);
6724 VOID RTUSBInitRxDesc(
6725 IN PRTMP_ADAPTER pAd,
6726 IN PRX_CONTEXT pRxContext);
6728 VOID RTUSBBulkRxHandle(
6729 IN unsigned long data);
6732 // Function Prototype in rtusb_io.c
6734 NTSTATUS RTUSBMultiRead(
6735 IN PRTMP_ADAPTER pAd,
6736 IN USHORT Offset,
6737 OUT PUCHAR pData,
6738 IN USHORT length);
6740 NTSTATUS RTUSBMultiWrite(
6741 IN PRTMP_ADAPTER pAd,
6742 IN USHORT Offset,
6743 IN PUCHAR pData,
6744 IN USHORT length);
6746 NTSTATUS RTUSBMultiWrite_OneByte(
6747 IN PRTMP_ADAPTER pAd,
6748 IN USHORT Offset,
6749 IN PUCHAR pData);
6751 NTSTATUS RTUSBReadBBPRegister(
6752 IN PRTMP_ADAPTER pAd,
6753 IN UCHAR Id,
6754 IN PUCHAR pValue);
6756 NTSTATUS RTUSBWriteBBPRegister(
6757 IN PRTMP_ADAPTER pAd,
6758 IN UCHAR Id,
6759 IN UCHAR Value);
6761 NTSTATUS RTUSBWriteRFRegister(
6762 IN PRTMP_ADAPTER pAd,
6763 IN UINT32 Value);
6765 #ifndef RT30xx
6766 NTSTATUS RT30xxWriteRFRegister(
6767 IN PRTMP_ADAPTER pAd,
6768 IN UCHAR RegID,
6769 IN UCHAR Value);
6771 NTSTATUS RT30xxReadRFRegister(
6772 IN PRTMP_ADAPTER pAd,
6773 IN UCHAR RegID,
6774 IN PUCHAR pValue);
6775 #endif
6777 NTSTATUS RTUSB_VendorRequest(
6778 IN PRTMP_ADAPTER pAd,
6779 IN UINT32 TransferFlags,
6780 IN UCHAR ReservedBits,
6781 IN UCHAR Request,
6782 IN USHORT Value,
6783 IN USHORT Index,
6784 IN PVOID TransferBuffer,
6785 IN UINT32 TransferBufferLength);
6787 NTSTATUS RTUSBReadEEPROM(
6788 IN PRTMP_ADAPTER pAd,
6789 IN USHORT Offset,
6790 OUT PUCHAR pData,
6791 IN USHORT length);
6793 NTSTATUS RTUSBWriteEEPROM(
6794 IN PRTMP_ADAPTER pAd,
6795 IN USHORT Offset,
6796 IN PUCHAR pData,
6797 IN USHORT length);
6799 VOID RTUSBPutToSleep(
6800 IN PRTMP_ADAPTER pAd);
6802 NTSTATUS RTUSBWakeUp(
6803 IN PRTMP_ADAPTER pAd);
6805 VOID RTUSBInitializeCmdQ(
6806 IN PCmdQ cmdq);
6808 NDIS_STATUS RTUSBEnqueueCmdFromNdis(
6809 IN PRTMP_ADAPTER pAd,
6810 IN NDIS_OID Oid,
6811 IN BOOLEAN SetInformation,
6812 IN PVOID pInformationBuffer,
6813 IN UINT32 InformationBufferLength);
6815 NDIS_STATUS RTUSBEnqueueInternalCmd(
6816 IN PRTMP_ADAPTER pAd,
6817 IN NDIS_OID Oid,
6818 IN PVOID pInformationBuffer,
6819 IN UINT32 InformationBufferLength);
6821 VOID RTUSBDequeueCmd(
6822 IN PCmdQ cmdq,
6823 OUT PCmdQElmt *pcmdqelmt);
6825 INT RTUSBCmdThread(
6826 IN OUT PVOID Context);
6828 INT TimerQThread(
6829 IN OUT PVOID Context);
6831 RT2870_TIMER_ENTRY *RT2870_TimerQ_Insert(
6832 IN RTMP_ADAPTER *pAd,
6833 IN RALINK_TIMER_STRUCT *pTimer);
6835 BOOLEAN RT2870_TimerQ_Remove(
6836 IN RTMP_ADAPTER *pAd,
6837 IN RALINK_TIMER_STRUCT *pTimer);
6839 void RT2870_TimerQ_Exit(
6840 IN RTMP_ADAPTER *pAd);
6842 void RT2870_TimerQ_Init(
6843 IN RTMP_ADAPTER *pAd);
6845 VOID RT2870_BssBeaconExit(
6846 IN RTMP_ADAPTER *pAd);
6848 VOID RT2870_BssBeaconStop(
6849 IN RTMP_ADAPTER *pAd);
6851 VOID RT2870_BssBeaconStart(
6852 IN RTMP_ADAPTER * pAd);
6854 VOID RT2870_BssBeaconInit(
6855 IN RTMP_ADAPTER *pAd);
6857 VOID RT2870_WatchDog(
6858 IN RTMP_ADAPTER *pAd);
6860 NTSTATUS RTUSBWriteMACRegister(
6861 IN PRTMP_ADAPTER pAd,
6862 IN USHORT Offset,
6863 IN UINT32 Value);
6865 NTSTATUS RTUSBReadMACRegister(
6866 IN PRTMP_ADAPTER pAd,
6867 IN USHORT Offset,
6868 OUT PUINT32 pValue);
6870 NTSTATUS RTUSBSingleWrite(
6871 IN RTMP_ADAPTER *pAd,
6872 IN USHORT Offset,
6873 IN USHORT Value);
6875 NTSTATUS RTUSBFirmwareRun(
6876 IN PRTMP_ADAPTER pAd);
6878 NTSTATUS RTUSBFirmwareWrite(
6879 IN PRTMP_ADAPTER pAd,
6880 IN PUCHAR pFwImage,
6881 IN ULONG FwLen);
6883 NTSTATUS RTUSBFirmwareOpmode(
6884 IN PRTMP_ADAPTER pAd,
6885 OUT PUINT32 pValue);
6887 NTSTATUS RTUSBVenderReset(
6888 IN PRTMP_ADAPTER pAd);
6890 NDIS_STATUS RTUSBSetHardWareRegister(
6891 IN PRTMP_ADAPTER pAdapter,
6892 IN PVOID pBuf);
6894 NDIS_STATUS RTUSBQueryHardWareRegister(
6895 IN PRTMP_ADAPTER pAdapter,
6896 IN PVOID pBuf);
6898 VOID CMDHandler(
6899 IN PRTMP_ADAPTER pAd);
6902 NDIS_STATUS CreateThreads(
6903 IN struct net_device *net_dev );
6906 VOID MacTableInitialize(
6907 IN PRTMP_ADAPTER pAd);
6909 VOID MlmeSetPsm(
6910 IN PRTMP_ADAPTER pAd,
6911 IN USHORT psm);
6913 NDIS_STATUS RTMPWPAAddKeyProc(
6914 IN PRTMP_ADAPTER pAd,
6915 IN PVOID pBuf);
6917 VOID AsicRxAntEvalAction(
6918 IN PRTMP_ADAPTER pAd);
6920 void append_pkt(
6921 IN PRTMP_ADAPTER pAd,
6922 IN PUCHAR pHeader802_3,
6923 IN UINT HdrLen,
6924 IN PUCHAR pData,
6925 IN ULONG DataSize,
6926 OUT PNDIS_PACKET *ppPacket);
6928 UINT deaggregate_AMSDU_announce(
6929 IN PRTMP_ADAPTER pAd,
6930 PNDIS_PACKET pPacket,
6931 IN PUCHAR pData,
6932 IN ULONG DataSize);
6934 NDIS_STATUS RTMPCheckRxError(
6935 IN PRTMP_ADAPTER pAd,
6936 IN PHEADER_802_11 pHeader,
6937 IN PRXWI_STRUC pRxWI,
6938 IN PRT28XX_RXD_STRUC pRxINFO);
6941 VOID RTUSBMlmeHardTransmit(
6942 IN PRTMP_ADAPTER pAd,
6943 IN PMGMT_STRUC pMgmt);
6945 INT MlmeThread(
6946 IN PVOID Context);
6949 // Function Prototype in rtusb_data.c
6951 NDIS_STATUS RTUSBFreeDescriptorRequest(
6952 IN PRTMP_ADAPTER pAd,
6953 IN UCHAR BulkOutPipeId,
6954 IN UINT32 NumberRequired);
6957 BOOLEAN RTUSBNeedQueueBackForAgg(
6958 IN RTMP_ADAPTER *pAd,
6959 IN UCHAR BulkOutPipeId);
6962 VOID RTMPWriteTxInfo(
6963 IN PRTMP_ADAPTER pAd,
6964 IN PTXINFO_STRUC pTxInfo,
6965 IN USHORT USBDMApktLen,
6966 IN BOOLEAN bWiv,
6967 IN UCHAR QueueSel,
6968 IN UCHAR NextValid,
6969 IN UCHAR TxBurst);
6972 // Function Prototype in cmm_data_2870.c
6974 USHORT RtmpUSB_WriteSubTxResource(
6975 IN PRTMP_ADAPTER pAd,
6976 IN TX_BLK *pTxBlk,
6977 IN BOOLEAN bIsLast,
6978 OUT USHORT *FreeNumber);
6980 USHORT RtmpUSB_WriteSingleTxResource(
6981 IN PRTMP_ADAPTER pAd,
6982 IN TX_BLK *pTxBlk,
6983 IN BOOLEAN bIsLast,
6984 OUT USHORT *FreeNumber);
6986 USHORT RtmpUSB_WriteFragTxResource(
6987 IN PRTMP_ADAPTER pAd,
6988 IN TX_BLK *pTxBlk,
6989 IN UCHAR fragNum,
6990 OUT USHORT *FreeNumber);
6992 USHORT RtmpUSB_WriteMultiTxResource(
6993 IN PRTMP_ADAPTER pAd,
6994 IN TX_BLK *pTxBlk,
6995 IN UCHAR frameNum,
6996 OUT USHORT *FreeNumber);
6998 VOID RtmpUSB_FinalWriteTxResource(
6999 IN PRTMP_ADAPTER pAd,
7000 IN TX_BLK *pTxBlk,
7001 IN USHORT totalMPDUSize,
7002 #ifdef RT2860
7003 IN USHORT FirstTxIdx);
7004 #endif
7005 IN USHORT TxIdx);
7007 VOID RtmpUSBDataLastTxIdx(
7008 IN PRTMP_ADAPTER pAd,
7009 IN UCHAR QueIdx,
7010 IN USHORT TxIdx);
7012 VOID RtmpUSBDataKickOut(
7013 IN PRTMP_ADAPTER pAd,
7014 IN TX_BLK *pTxBlk,
7015 IN UCHAR QueIdx);
7018 int RtmpUSBMgmtKickOut(
7019 IN RTMP_ADAPTER *pAd,
7020 IN UCHAR QueIdx,
7021 IN PNDIS_PACKET pPacket,
7022 IN PUCHAR pSrcBufVA,
7023 IN UINT SrcBufLen);
7025 VOID RtmpUSBNullFrameKickOut(
7026 IN RTMP_ADAPTER *pAd,
7027 IN UCHAR QueIdx,
7028 IN UCHAR *pNullFrame,
7029 IN UINT32 frameLen);
7031 VOID RT28xxUsbStaAsicForceWakeup(
7032 IN PRTMP_ADAPTER pAd,
7033 IN BOOLEAN bFromTx);
7035 VOID RT28xxUsbStaAsicSleepThenAutoWakeup(
7036 IN PRTMP_ADAPTER pAd,
7037 IN USHORT TbttNumToNextWakeUp);
7039 VOID RT28xxUsbMlmeRadioOn(
7040 IN PRTMP_ADAPTER pAd);
7042 VOID RT28xxUsbMlmeRadioOFF(
7043 IN PRTMP_ADAPTER pAd);
7044 #endif // RT2870 //
7046 ////////////////////////////////////////
7048 VOID QBSS_LoadInit(
7049 IN RTMP_ADAPTER *pAd);
7051 UINT32 QBSS_LoadElementAppend(
7052 IN RTMP_ADAPTER *pAd,
7053 OUT UINT8 *buf_p);
7055 VOID QBSS_LoadUpdate(
7056 IN RTMP_ADAPTER *pAd);
7058 ///////////////////////////////////////
7059 INT RTMPShowCfgValue(
7060 IN PRTMP_ADAPTER pAd,
7061 IN PUCHAR pName,
7062 IN PUCHAR pBuf);
7064 PCHAR RTMPGetRalinkAuthModeStr(
7065 IN NDIS_802_11_AUTHENTICATION_MODE authMode);
7067 PCHAR RTMPGetRalinkEncryModeStr(
7068 IN USHORT encryMode);
7069 //////////////////////////////////////
7071 VOID AsicStaBbpTuning(
7072 IN PRTMP_ADAPTER pAd);
7074 #ifdef RT2860
7075 VOID AsicResetFromDMABusy(
7076 IN PRTMP_ADAPTER pAd);
7078 VOID AsicResetBBP(
7079 IN PRTMP_ADAPTER pAd);
7081 VOID AsicResetMAC(
7082 IN PRTMP_ADAPTER pAd);
7084 VOID AsicResetPBF(
7085 IN PRTMP_ADAPTER pAd);
7086 #endif
7087 #ifdef RT2870
7088 BOOLEAN StaAddMacTableEntry(
7089 IN PRTMP_ADAPTER pAd,
7090 IN PMAC_TABLE_ENTRY pEntry,
7091 IN UCHAR MaxSupportedRateIn500Kbps,
7092 IN HT_CAPABILITY_IE *pHtCapability,
7093 IN UCHAR HtCapabilityLen,
7094 IN USHORT CapabilityInfo);
7095 #endif
7097 void RTMP_IndicateMediaState(
7098 IN PRTMP_ADAPTER pAd);
7100 VOID ReSyncBeaconTime(
7101 IN PRTMP_ADAPTER pAd);
7103 VOID RTMPSetAGCInitValue(
7104 IN PRTMP_ADAPTER pAd,
7105 IN UCHAR BandWidth);
7107 int rt28xx_close(IN PNET_DEV dev);
7108 int rt28xx_open(IN PNET_DEV dev);
7110 __inline INT VIRTUAL_IF_UP(PRTMP_ADAPTER pAd)
7112 extern VOID MeshMakeBeacon(IN PRTMP_ADAPTER pAd, IN UCHAR idx);
7113 extern VOID MeshUpdateBeaconFrame(IN PRTMP_ADAPTER pAd, IN UCHAR idx);
7115 if (VIRTUAL_IF_NUM(pAd) == 0)
7117 if (rt28xx_open(pAd->net_dev) != 0)
7118 return -1;
7120 else
7123 VIRTUAL_IF_INC(pAd);
7124 return 0;
7127 __inline VOID VIRTUAL_IF_DOWN(PRTMP_ADAPTER pAd)
7129 VIRTUAL_IF_DEC(pAd);
7130 if (VIRTUAL_IF_NUM(pAd) == 0)
7131 rt28xx_close(pAd->net_dev);
7132 return;
7136 #endif // __RTMP_H__