Staging: rt2870: Revert d44ca7 Removal of kernel_thread() API
[linux-2.6.git] / drivers / staging / rt2870 / rt2870.h
1 /*
2  *************************************************************************
3  * Ralink Tech Inc.
4  * 5F., No.36, Taiyuan St., Jhubei City,
5  * Hsinchu County 302,
6  * Taiwan, R.O.C.
7  *
8  * (c) Copyright 2002-2007, Ralink Technology, Inc.
9  *
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  *************************************************************************
26  */
27
28 #ifndef __RT2870_H__
29 #define __RT2870_H__
30
31 //usb header files
32 #include <linux/usb.h>
33
34 /* rtmp_def.h */
35 //
36 #define BULKAGGRE_ZISE          100
37 #define RT28XX_DRVDATA_SET(_a)                                             usb_set_intfdata(_a, pAd);
38 #define RT28XX_PUT_DEVICE                                                  usb_put_dev
39 #define RTUSB_ALLOC_URB(iso)                                               usb_alloc_urb(iso, GFP_ATOMIC)
40 #define RTUSB_SUBMIT_URB(pUrb)                                             usb_submit_urb(pUrb, GFP_ATOMIC)
41 #define RTUSB_URB_ALLOC_BUFFER(pUsb_Dev, BufSize, pDma_addr)               usb_buffer_alloc(pUsb_Dev, BufSize, GFP_ATOMIC, pDma_addr)
42 #define RTUSB_URB_FREE_BUFFER(pUsb_Dev, BufSize, pTransferBuf, Dma_addr)   usb_buffer_free(pUsb_Dev, BufSize, pTransferBuf, Dma_addr)
43
44 #define RXBULKAGGRE_ZISE        12
45 #define MAX_TXBULK_LIMIT        (LOCAL_TXBUF_SIZE*(BULKAGGRE_ZISE-1))
46 #define MAX_TXBULK_SIZE         (LOCAL_TXBUF_SIZE*BULKAGGRE_ZISE)
47 #define MAX_RXBULK_SIZE         (LOCAL_TXBUF_SIZE*RXBULKAGGRE_ZISE)
48 #define MAX_MLME_HANDLER_MEMORY 20
49 #ifndef RT30xx
50 #define RETRY_LIMIT             10
51 #endif
52 #define BUFFER_SIZE                             2400    //2048
53 #define TX_RING                                 0xa
54 #define PRIO_RING                               0xc
55
56
57 // Flags for Bulkflags control for bulk out data
58 //
59 #define fRTUSB_BULK_OUT_DATA_NULL                               0x00000001
60 #define fRTUSB_BULK_OUT_RTS                                             0x00000002
61 #define fRTUSB_BULK_OUT_MLME                                    0x00000004
62
63 #define fRTUSB_BULK_OUT_DATA_NORMAL                             0x00010000
64 #define fRTUSB_BULK_OUT_DATA_NORMAL_2                   0x00020000
65 #define fRTUSB_BULK_OUT_DATA_NORMAL_3                   0x00040000
66 #define fRTUSB_BULK_OUT_DATA_NORMAL_4                   0x00080000
67 #ifdef RT30xx
68 #define fRTUSB_BULK_OUT_DATA_NORMAL_5                   0x00100000
69 #endif
70
71 #define fRTUSB_BULK_OUT_PSPOLL                                  0x00000020
72 #define fRTUSB_BULK_OUT_DATA_FRAG                               0x00000040
73 #define fRTUSB_BULK_OUT_DATA_FRAG_2                             0x00000080
74 #define fRTUSB_BULK_OUT_DATA_FRAG_3                             0x00000100
75 #define fRTUSB_BULK_OUT_DATA_FRAG_4                             0x00000200
76
77 #ifndef RT30xx
78 #define RT2870_USB_DEVICES      \
79 {       \
80         {USB_DEVICE(0x148F,0x2770)}, /* Ralink */               \
81         {USB_DEVICE(0x1737,0x0071)}, /* Linksys WUSB600N */     \
82         {USB_DEVICE(0x1737,0x0070)}, /* Linksys */      \
83         {USB_DEVICE(0x148F,0x2870)}, /* Ralink */               \
84         {USB_DEVICE(0x148F,0x3070)}, /* Ralink */               \
85         {USB_DEVICE(0x0B05,0x1731)}, /* Asus */                 \
86         {USB_DEVICE(0x0B05,0x1732)}, /* Asus */                 \
87         {USB_DEVICE(0x0B05,0x1742)}, /* Asus */                 \
88         {USB_DEVICE(0x0DF6,0x0017)}, /* Sitecom */              \
89         {USB_DEVICE(0x0DF6,0x002B)}, /* Sitecom */              \
90         {USB_DEVICE(0x0DF6,0x002C)}, /* Sitecom */              \
91         {USB_DEVICE(0x0DF6,0x002D)}, /* Sitecom */              \
92         {USB_DEVICE(0x0DF6,0x0039)}, /* Sitecom */              \
93         {USB_DEVICE(0x0DF6,0x003F)}, /* Sitecom WL-608 */       \
94         {USB_DEVICE(0x14B2,0x3C06)}, /* Conceptronic */         \
95         {USB_DEVICE(0x14B2,0x3C28)}, /* Conceptronic */         \
96         {USB_DEVICE(0x2019,0xED06)}, /* Planex Communications, Inc. */          \
97         {USB_DEVICE(0x2019,0xED14)}, /* Planex Communications, Inc. */          \
98         {USB_DEVICE(0x2019,0xAB25)}, /* Planex Communications, Inc. RT3070 */           \
99         {USB_DEVICE(0x07D1,0x3C09)}, /* D-Link */               \
100         {USB_DEVICE(0x07D1,0x3C11)}, /* D-Link */               \
101         {USB_DEVICE(0x14B2,0x3C07)}, /* AL */                   \
102         {USB_DEVICE(0x14B2,0x3C12)}, /* AL */           \
103         {USB_DEVICE(0x050D,0x8053)}, /* Belkin */               \
104         {USB_DEVICE(0x050D,0x815C)}, /* Belkin */               \
105         {USB_DEVICE(0x14B2,0x3C23)}, /* Airlink */              \
106         {USB_DEVICE(0x14B2,0x3C27)}, /* Airlink */              \
107         {USB_DEVICE(0x07AA,0x002F)}, /* Corega */               \
108         {USB_DEVICE(0x07AA,0x003C)}, /* Corega */               \
109         {USB_DEVICE(0x07AA,0x003F)}, /* Corega */               \
110         {USB_DEVICE(0x18C5,0x0012)}, /* Corega */               \
111         {USB_DEVICE(0x1044,0x800B)}, /* Gigabyte */             \
112         {USB_DEVICE(0x15A9,0x0006)}, /* Sparklan */             \
113         {USB_DEVICE(0x083A,0xB522)}, /* SMC */                  \
114         {USB_DEVICE(0x083A,0xA618)}, /* SMC */                  \
115         {USB_DEVICE(0x083A,0x7522)}, /* Arcadyan */             \
116         {USB_DEVICE(0x0CDE,0x0022)}, /* ZCOM */                 \
117         {USB_DEVICE(0x0586,0x3416)}, /* Zyxel */                \
118         {USB_DEVICE(0x0CDE,0x0025)}, /* Zyxel */                \
119         {USB_DEVICE(0x1740,0x9701)}, /* EnGenius */             \
120         {USB_DEVICE(0x1740,0x9702)}, /* EnGenius */             \
121         {USB_DEVICE(0x0471,0x200f)}, /* Philips */              \
122         {USB_DEVICE(0x14B2,0x3C25)}, /* Draytek */              \
123         {USB_DEVICE(0x13D3,0x3247)}, /* AzureWave */    \
124         {USB_DEVICE(0x083A,0x6618)}, /* Accton */               \
125         {USB_DEVICE(0x15c5,0x0008)}, /* Amit */                 \
126         {USB_DEVICE(0x0E66,0x0001)}, /* Hawking */              \
127         {USB_DEVICE(0x0E66,0x0003)}, /* Hawking */              \
128         {USB_DEVICE(0x129B,0x1828)}, /* Siemens */              \
129         {USB_DEVICE(0x157E,0x300E)},    /* U-Media */   \
130         {USB_DEVICE(0x050d,0x805c)},                                    \
131         {USB_DEVICE(0x1482,0x3C09)}, /* Abocom*/                \
132         {USB_DEVICE(0x14B2,0x3C09)}, /* Alpha */                \
133         {USB_DEVICE(0x04E8,0x2018)}, /* samsung */      \
134         {USB_DEVICE(0x07B8,0x3070)}, /* AboCom */               \
135         {USB_DEVICE(0x07B8,0x3071)}, /* AboCom */               \
136         {USB_DEVICE(0x07B8,0x2870)}, /* AboCom */               \
137         {USB_DEVICE(0x07B8,0x2770)}, /* AboCom */               \
138         {USB_DEVICE(0x7392,0x7711)}, /* Edimax */               \
139         {USB_DEVICE(0x5A57,0x0280)}, /* Zinwell */              \
140         {USB_DEVICE(0x5A57,0x0282)}, /* Zinwell */              \
141         {USB_DEVICE(0x0789,0x0162)}, /* Logitec */              \
142         {USB_DEVICE(0x0789,0x0163)}, /* Logitec */              \
143         {USB_DEVICE(0x0789,0x0164)}, /* Logitec */              \
144         {USB_DEVICE(0x7392,0x7717)}, /* Edimax */               \
145         { }/* Terminating entry */                      \
146 }
147 #endif
148 #ifdef RT30xx
149 #define RT2870_USB_DEVICES      \
150 {       \
151         {USB_DEVICE(0x148F,0x2770)}, /* Ralink */               \
152         {USB_DEVICE(0x148F,0x2870)}, /* Ralink */               \
153         {USB_DEVICE(0x148F,0x3070)}, /* Ralink 3070 */  \
154         {USB_DEVICE(0x148F,0x3071)}, /* Ralink 3071 */  \
155         {USB_DEVICE(0x148F,0x3072)}, /* Ralink 3072 */  \
156         {USB_DEVICE(0x0B05,0x1731)}, /* Asus */                 \
157         {USB_DEVICE(0x0B05,0x1732)}, /* Asus */                 \
158         {USB_DEVICE(0x0B05,0x1742)}, /* Asus */                 \
159         {USB_DEVICE(0x0DF6,0x0017)}, /* Sitecom */              \
160         {USB_DEVICE(0x0DF6,0x002B)}, /* Sitecom */              \
161         {USB_DEVICE(0x0DF6,0x002C)}, /* Sitecom */              \
162         {USB_DEVICE(0x0DF6,0x003E)}, /* Sitecom 3070 */ \
163         {USB_DEVICE(0x0DF6,0x002D)}, /* Sitecom */              \
164         {USB_DEVICE(0x0DF6,0x0039)}, /* Sitecom 2770 */ \
165         {USB_DEVICE(0x14B2,0x3C06)}, /* Conceptronic */         \
166         {USB_DEVICE(0x14B2,0x3C28)}, /* Conceptronic */         \
167         {USB_DEVICE(0x2019,0xED06)}, /* Planex Communications, Inc. */          \
168         {USB_DEVICE(0x2019,0xAB25)}, /* Planex Communications, Inc. RT3070 */           \
169         {USB_DEVICE(0x07D1,0x3C09)}, /* D-Link */               \
170         {USB_DEVICE(0x07D1,0x3C11)}, /* D-Link */               \
171         {USB_DEVICE(0x2001,0x3C09)}, /* D-Link */               \
172         {USB_DEVICE(0x2001,0x3C0A)}, /* D-Link 3072*/   \
173         {USB_DEVICE(0x14B2,0x3C07)}, /* AL */                   \
174         {USB_DEVICE(0x14B2,0x3C12)}, /* AL 3070 */              \
175         {USB_DEVICE(0x050D,0x8053)}, /* Belkin */               \
176         {USB_DEVICE(0x14B2,0x3C23)}, /* Airlink */              \
177         {USB_DEVICE(0x14B2,0x3C27)}, /* Airlink */              \
178         {USB_DEVICE(0x07AA,0x002F)}, /* Corega */               \
179         {USB_DEVICE(0x07AA,0x003C)}, /* Corega */               \
180         {USB_DEVICE(0x07AA,0x003F)}, /* Corega */               \
181         {USB_DEVICE(0x18C5,0x0012)}, /* Corega 3070 */  \
182         {USB_DEVICE(0x1044,0x800B)}, /* Gigabyte */             \
183         {USB_DEVICE(0x1044,0x800D)}, /* Gigabyte GN-WB32L 3070 */               \
184         {USB_DEVICE(0x15A9,0x0006)}, /* Sparklan */             \
185         {USB_DEVICE(0x083A,0xB522)}, /* SMC */                  \
186         {USB_DEVICE(0x083A,0xA618)}, /* SMC */                  \
187         {USB_DEVICE(0x083A,0x8522)}, /* Arcadyan */             \
188         {USB_DEVICE(0x083A,0x7512)}, /* Arcadyan 2770 */                \
189         {USB_DEVICE(0x083A,0x7522)}, /* Arcadyan */             \
190         {USB_DEVICE(0x083A,0x7511)}, /* Arcadyan 3070 */ \
191         {USB_DEVICE(0x0CDE,0x0022)}, /* ZCOM */                 \
192         {USB_DEVICE(0x0586,0x3416)}, /* Zyxel */                \
193         {USB_DEVICE(0x0CDE,0x0025)}, /* Zyxel */                \
194         {USB_DEVICE(0x1740,0x9701)}, /* EnGenius */             \
195         {USB_DEVICE(0x1740,0x9702)}, /* EnGenius */             \
196         {USB_DEVICE(0x1740,0x9703)}, /* EnGenius 3070 */                \
197         {USB_DEVICE(0x0471,0x200f)}, /* Philips */              \
198         {USB_DEVICE(0x14B2,0x3C25)}, /* Draytek */              \
199         {USB_DEVICE(0x13D3,0x3247)}, /* AzureWave */    \
200         {USB_DEVICE(0x13D3,0x3273)}, /* AzureWave 3070*/        \
201         {USB_DEVICE(0x083A,0x6618)}, /* Accton */               \
202         {USB_DEVICE(0x15c5,0x0008)}, /* Amit */                 \
203         {USB_DEVICE(0x0E66,0x0001)}, /* Hawking */              \
204         {USB_DEVICE(0x0E66,0x0003)}, /* Hawking */              \
205         {USB_DEVICE(0x129B,0x1828)}, /* Siemens */              \
206         {USB_DEVICE(0x157E,0x300E)},    /* U-Media */   \
207         {USB_DEVICE(0x050d,0x805c)},                                    \
208         {USB_DEVICE(0x1482,0x3C09)}, /* Abocom*/                \
209         {USB_DEVICE(0x14B2,0x3C09)}, /* Alpha */                \
210         {USB_DEVICE(0x04E8,0x2018)}, /* samsung */      \
211         {USB_DEVICE(0x07B8,0x3070)}, /* AboCom 3070 */  \
212         {USB_DEVICE(0x07B8,0x3071)}, /* AboCom 3071 */  \
213         {USB_DEVICE(0x07B8,0x3072)}, /* Abocom 3072 */  \
214         {USB_DEVICE(0x7392,0x7711)}, /* Edimax 3070 */  \
215         {USB_DEVICE(0x5A57,0x0280)}, /* Zinwell */              \
216         {USB_DEVICE(0x5A57,0x0282)}, /* Zinwell */              \
217         {USB_DEVICE(0x1A32,0x0304)}, /* Quanta 3070 */          \
218         {USB_DEVICE(0x0789,0x0162)}, /* Logitec 2870 */         \
219         {USB_DEVICE(0x0789,0x0163)}, /* Logitec 2870 */         \
220         {USB_DEVICE(0x0789,0x0164)}, /* Logitec 2870 */         \
221         {USB_DEVICE(0x1EDA,0x2310)}, /* AirTies 3070 */         \
222         { }/* Terminating entry */                      \
223 }
224 #endif
225
226 #define FREE_HTTX_RING(_p, _b, _t)                      \
227 {                                                                               \
228         if ((_t)->ENextBulkOutPosition == (_t)->CurWritePosition)                               \
229         {                                                                                                                                       \
230                 (_t)->bRingEmpty = TRUE;                        \
231         }                                                                                                                                       \
232         /*NdisInterlockedDecrement(&(_p)->TxCount); */\
233 }
234
235 //
236 // RXINFO appends at the end of each rx packet.
237 //
238 typedef struct  PACKED _RXINFO_STRUC {
239         UINT32          BA:1;
240         UINT32          DATA:1;
241         UINT32          NULLDATA:1;
242         UINT32          FRAG:1;
243         UINT32          U2M:1;              // 1: this RX frame is unicast to me
244         UINT32          Mcast:1;            // 1: this is a multicast frame
245         UINT32          Bcast:1;            // 1: this is a broadcast frame
246         UINT32          MyBss:1;        // 1: this frame belongs to the same BSSID
247         UINT32          Crc:1;              // 1: CRC error
248         UINT32          CipherErr:2;        // 0: decryption okay, 1:ICV error, 2:MIC error, 3:KEY not valid
249         UINT32          AMSDU:1;                // rx with 802.3 header, not 802.11 header.
250         UINT32          HTC:1;
251         UINT32          RSSI:1;
252         UINT32          L2PAD:1;
253         UINT32          AMPDU:1;                // To be moved
254         UINT32          Decrypted:1;
255         UINT32          PlcpRssil:1;
256         UINT32          CipherAlg:1;
257         UINT32          LastAMSDU:1;
258         UINT32          PlcpSignal:12;
259 }       RXINFO_STRUC, *PRXINFO_STRUC, RT28XX_RXD_STRUC, *PRT28XX_RXD_STRUC;
260
261 //
262 // TXINFO
263 //
264 typedef struct  _TXINFO_STRUC {
265         // Word 0
266         UINT32          USBDMATxPktLen:16;      //used ONLY in USB bulk Aggregation,  Total byte counts of all sub-frame.
267         UINT32          rsv:8;
268         UINT32          WIV:1;  // Wireless Info Valid. 1 if Driver already fill WI,  o if DMA needs to copy WI to correctposition
269         UINT32          QSEL:2; // select on-chip FIFO ID for 2nd-stage output scheduler.0:MGMT, 1:HCCA 2:EDCA
270         UINT32          SwUseLastRound:1; // Software use.
271         UINT32          rsv2:2;  // Software use.
272         UINT32          USBDMANextVLD:1;        //used ONLY in USB bulk Aggregation, NextValid
273         UINT32          USBDMATxburst:1;//used ONLY in USB bulk Aggre. Force USB DMA transmit frame from current selected endpoint
274 }       TXINFO_STRUC, *PTXINFO_STRUC;
275
276 #define TXINFO_SIZE                             4
277 #define RXINFO_SIZE                             4
278 #define TXPADDING_SIZE                  11
279
280 //
281 // Management ring buffer format
282 //
283 typedef struct  _MGMT_STRUC     {
284         BOOLEAN         Valid;
285         PUCHAR          pBuffer;
286         ULONG           Length;
287 }       MGMT_STRUC, *PMGMT_STRUC;
288
289
290 /* ----------------- EEPROM Related MACRO ----------------- */
291 #ifdef RT30xx
292 #define RT28xx_EEPROM_READ16(pAd, offset, var)                                  \
293         do {                                                                                                            \
294                 RTUSBReadEEPROM(pAd, offset, (PUCHAR)&(var), 2);                \
295                 if(!pAd->bUseEfuse)                                                                             \
296                 var = le2cpu16(var);                                                                    \
297         }while(0)
298
299 #define RT28xx_EEPROM_WRITE16(pAd, offset, var)                                 \
300         do{                                                                                                                     \
301                 USHORT _tmpVar=var;                                                                             \
302                 if(!pAd->bUseEfuse)                                                                     \
303                 _tmpVar = cpu2le16(var);                                                                \
304                 RTUSBWriteEEPROM(pAd, offset, (PUCHAR)&(_tmpVar), 2);   \
305         }while(0)
306 #endif // RT30xx //
307 #ifndef RT30xx
308 #define RT28xx_EEPROM_READ16(pAd, offset, var)                                  \
309         do {                                                                                                            \
310                 RTUSBReadEEPROM(pAd, offset, (PUCHAR)&(var), 2);                \
311                 var = le2cpu16(var);                                                                    \
312         }while(0)
313
314 #define RT28xx_EEPROM_WRITE16(pAd, offset, var)                                 \
315         do{                                                                                                                     \
316                 USHORT _tmpVar;                                                                                 \
317                 _tmpVar = cpu2le16(var);                                                                \
318                 RTUSBWriteEEPROM(pAd, offset, (PUCHAR)&(_tmpVar), 2);   \
319         }while(0)
320 #endif // RT30xx //
321
322 /* ----------------- TASK/THREAD Related MACRO ----------------- */
323 #define RT28XX_TASK_THREAD_INIT(pAd, Status)            \
324         Status = CreateThreads(net_dev);
325
326
327 /* ----------------- Frimware Related MACRO ----------------- */
328 #define RT28XX_WRITE_FIRMWARE(_pAd, _pFwImage, _FwLen)          \
329         RTUSBFirmwareWrite(_pAd, _pFwImage, _FwLen)
330
331 /* ----------------- TX Related MACRO ----------------- */
332 #define RT28XX_START_DEQUEUE(pAd, QueIdx, irqFlags)                             \
333                         {                                                                                                       \
334                                 RTMP_IRQ_LOCK(&pAd->DeQueueLock[QueIdx], irqFlags);             \
335                                 if (pAd->DeQueueRunning[QueIdx])                                                \
336                                 {                                                                                                               \
337                                         RTMP_IRQ_UNLOCK(&pAd->DeQueueLock[QueIdx], irqFlags);\
338                                         printk("DeQueueRunning[%d]= TRUE!\n", QueIdx);          \
339                                         continue;                                                                                       \
340                                 }                                                                                                               \
341                                 else                                                                                                    \
342                                 {                                                                                                               \
343                                         pAd->DeQueueRunning[QueIdx] = TRUE;                                     \
344                                         RTMP_IRQ_UNLOCK(&pAd->DeQueueLock[QueIdx], irqFlags);\
345                                 }                                                                                                               \
346                         }
347 #define RT28XX_STOP_DEQUEUE(pAd, QueIdx, irqFlags)                                              \
348                         do{                                                                                                                     \
349                                 RTMP_IRQ_LOCK(&pAd->DeQueueLock[QueIdx], irqFlags);             \
350                                 pAd->DeQueueRunning[QueIdx] = FALSE;                                    \
351                                 RTMP_IRQ_UNLOCK(&pAd->DeQueueLock[QueIdx], irqFlags);   \
352                         }while(0)
353
354
355 #define RT28XX_HAS_ENOUGH_FREE_DESC(pAd, pTxBlk, freeNum, pPacket) \
356                 (RTUSBFreeDescriptorRequest(pAd, pTxBlk->QueIdx, (pTxBlk->TotalFrameLen + GET_OS_PKT_LEN(pPacket))) == NDIS_STATUS_SUCCESS)
357
358 #define RT28XX_RELEASE_DESC_RESOURCE(pAd, QueIdx)                       \
359                 do{}while(0)
360
361 #define NEED_QUEUE_BACK_FOR_AGG(_pAd, _QueIdx, _freeNum, _TxFrameType)          \
362                 ((_TxFrameType == TX_RALINK_FRAME) && (RTUSBNeedQueueBackForAgg(_pAd, _QueIdx)))
363
364
365
366 #define fRTMP_ADAPTER_NEED_STOP_TX              \
367                 (fRTMP_ADAPTER_NIC_NOT_EXIST | fRTMP_ADAPTER_HALT_IN_PROGRESS | \
368                  fRTMP_ADAPTER_RESET_IN_PROGRESS | fRTMP_ADAPTER_BULKOUT_RESET | \
369                  fRTMP_ADAPTER_RADIO_OFF | fRTMP_ADAPTER_REMOVE_IN_PROGRESS)
370
371
372 #define HAL_WriteSubTxResource(pAd, pTxBlk, bIsLast, pFreeNumber)       \
373                         RtmpUSB_WriteSubTxResource(pAd, pTxBlk, bIsLast, pFreeNumber)
374
375 #define HAL_WriteTxResource(pAd, pTxBlk,bIsLast, pFreeNumber)   \
376                         RtmpUSB_WriteSingleTxResource(pAd, pTxBlk,bIsLast, pFreeNumber)
377
378 #define HAL_WriteFragTxResource(pAd, pTxBlk, fragNum, pFreeNumber) \
379                         RtmpUSB_WriteFragTxResource(pAd, pTxBlk, fragNum, pFreeNumber)
380
381 #define HAL_WriteMultiTxResource(pAd, pTxBlk,frameNum, pFreeNumber)     \
382                         RtmpUSB_WriteMultiTxResource(pAd, pTxBlk,frameNum, pFreeNumber)
383
384 #define HAL_FinalWriteTxResource(pAd, pTxBlk, totalMPDUSize, TxIdx)     \
385                         RtmpUSB_FinalWriteTxResource(pAd, pTxBlk, totalMPDUSize, TxIdx)
386
387 #define HAL_LastTxIdx(pAd, QueIdx,TxIdx) \
388                         /*RtmpUSBDataLastTxIdx(pAd, QueIdx,TxIdx)*/
389
390 #define HAL_KickOutTx(pAd, pTxBlk, QueIdx)      \
391                         RtmpUSBDataKickOut(pAd, pTxBlk, QueIdx)
392
393
394 #define HAL_KickOutMgmtTx(pAd, QueIdx, pPacket, pSrcBufVA, SrcBufLen)   \
395                         RtmpUSBMgmtKickOut(pAd, QueIdx, pPacket, pSrcBufVA, SrcBufLen)
396
397 #define HAL_KickOutNullFrameTx(_pAd, _QueIdx, _pNullFrame, _frameLen)   \
398                         RtmpUSBNullFrameKickOut(_pAd, _QueIdx, _pNullFrame, _frameLen)
399
400 #define RTMP_PKT_TAIL_PADDING   11 // 3(max 4 byte padding) + 4 (last packet padding) + 4 (MaxBulkOutsize align padding)
401
402 extern UCHAR EpToQueue[6];
403
404
405 #ifdef RT2870
406 #define GET_TXRING_FREENO(_pAd, _QueIdx)        (_QueIdx) //(_pAd->TxRing[_QueIdx].TxSwFreeIdx)
407 #define GET_MGMTRING_FREENO(_pAd)                       (_pAd->MgmtRing.TxSwFreeIdx)
408 #endif // RT2870 //
409
410
411 /* ----------------- RX Related MACRO ----------------- */
412 //#define RT28XX_RX_ERROR_CHECK                         RTMPCheckRxWI
413
414 #define RT28XX_RV_ALL_BUF_END(bBulkReceive)             \
415         /* We return STATUS_MORE_PROCESSING_REQUIRED so that the completion */  \
416         /* routine (IofCompleteRequest) will stop working on the irp. */                \
417         if (bBulkReceive == TRUE)       RTUSBBulkReceive(pAd);
418
419
420 /* ----------------- ASIC Related MACRO ----------------- */
421
422 // reset MAC of a station entry to 0xFFFFFFFFFFFF
423 #define RT28XX_STA_ENTRY_MAC_RESET(pAd, Wcid)                                   \
424         {       RT_SET_ASIC_WCID        SetAsicWcid;                                            \
425                 SetAsicWcid.WCID = Wcid;                                                                \
426                 SetAsicWcid.SetTid = 0xffffffff;                                                \
427                 SetAsicWcid.DeleteTid = 0xffffffff;                                             \
428                 RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_SET_ASIC_WCID,   \
429                                 &SetAsicWcid, sizeof(RT_SET_ASIC_WCID));        }
430
431 // add this entry into ASIC RX WCID search table
432 #define RT28XX_STA_ENTRY_ADD(pAd, pEntry)                                                       \
433         RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_SET_CLIENT_MAC_ENTRY,    \
434                                                         pEntry, sizeof(MAC_TABLE_ENTRY));
435
436 #ifdef RT30xx
437 // add by johnli, fix "in_interrupt" error when call "MacTableDeleteEntry" in Rx tasklet
438 // Set MAC register value according operation mode
439 #define RT28XX_UPDATE_PROTECT(pAd)      \
440         RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_UPDATE_PROTECT, NULL, 0);
441 // end johnli
442 #endif
443
444 // remove Pair-wise key material from ASIC
445 // yet implement
446 #define RT28XX_STA_ENTRY_KEY_DEL(pAd, BssIdx, Wcid)
447
448 // add Client security information into ASIC WCID table and IVEIV table
449 #define RT28XX_STA_SECURITY_INFO_ADD(pAd, apidx, KeyID, pEntry)                                         \
450         {       RT28XX_STA_ENTRY_MAC_RESET(pAd, pEntry->Aid);                                                           \
451                 if (pEntry->Aid >= 1) {                                                                                                         \
452                         RT_SET_ASIC_WCID_ATTRI  SetAsicWcidAttri;                                                               \
453                         SetAsicWcidAttri.WCID = pEntry->Aid;                                                                    \
454                         if ((pEntry->AuthMode <= Ndis802_11AuthModeAutoSwitch) &&                               \
455                                 (pEntry->WepStatus == Ndis802_11Encryption1Enabled))                            \
456                         {                                                                                                                                               \
457                                 SetAsicWcidAttri.Cipher = pAd->SharedKey[apidx][KeyID].CipherAlg;       \
458                         }                                                                                                                                               \
459                         else if (pEntry->AuthMode == Ndis802_11AuthModeWPANone)                                 \
460                         {                                                                                                                                               \
461                                 SetAsicWcidAttri.Cipher = pAd->SharedKey[apidx][KeyID].CipherAlg;       \
462                         }                                                                                                                                               \
463                         else SetAsicWcidAttri.Cipher = 0;                                                                               \
464             DBGPRINT(RT_DEBUG_TRACE, ("aid cipher = %ld\n",SetAsicWcidAttri.Cipher));       \
465                         RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_SET_ASIC_WCID_CIPHER,                    \
466                                                         &SetAsicWcidAttri, sizeof(RT_SET_ASIC_WCID_ATTRI)); } }
467
468 // Insert the BA bitmap to ASIC for the Wcid entry
469 #define RT28XX_ADD_BA_SESSION_TO_ASIC(_pAd, _Aid, _TID)                                 \
470                 do{                                                                                                                             \
471                         RT_SET_ASIC_WCID        SetAsicWcid;                                                    \
472                         SetAsicWcid.WCID = (_Aid);                                                                      \
473                         SetAsicWcid.SetTid = (0x10000<<(_TID));                                         \
474                         SetAsicWcid.DeleteTid = 0xffffffff;                                                     \
475                         RTUSBEnqueueInternalCmd((_pAd), CMDTHREAD_SET_ASIC_WCID, &SetAsicWcid, sizeof(RT_SET_ASIC_WCID));       \
476                 }while(0)
477
478 // Remove the BA bitmap from ASIC for the Wcid entry
479 #define RT28XX_DEL_BA_SESSION_FROM_ASIC(_pAd, _Wcid, _TID)                              \
480                 do{                                                                                                                             \
481                         RT_SET_ASIC_WCID        SetAsicWcid;                                                    \
482                         SetAsicWcid.WCID = (_Wcid);                                                                     \
483                         SetAsicWcid.SetTid = (0xffffffff);                                                      \
484                         SetAsicWcid.DeleteTid = (0x10000<<(_TID) );                                     \
485                         RTUSBEnqueueInternalCmd((_pAd), CMDTHREAD_SET_ASIC_WCID, &SetAsicWcid, sizeof(RT_SET_ASIC_WCID));       \
486                 }while(0)
487
488
489 /* ----------------- PCI/USB Related MACRO ----------------- */
490 #define RT28XX_HANDLE_DEV_ASSIGN(handle, dev_p)                 \
491         ((POS_COOKIE)handle)->pUsb_Dev = dev_p;
492
493 // no use
494 #define RT28XX_UNMAP()
495 #define RT28XX_IRQ_REQUEST(net_dev)
496 #define RT28XX_IRQ_RELEASE(net_dev)
497 #define RT28XX_IRQ_INIT(pAd)
498 #define RT28XX_IRQ_ENABLE(pAd)
499
500
501 /* ----------------- MLME Related MACRO ----------------- */
502 #define RT28XX_MLME_HANDLER(pAd)                        RTUSBMlmeUp(pAd)
503
504 #define RT28XX_MLME_PRE_SANITY_CHECK(pAd)                                                               \
505         {       if ((pAd->CommonCfg.bHardwareRadio == TRUE) &&                                  \
506                         (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) &&          \
507                         (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS))) {       \
508                         RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_CHECK_GPIO, NULL, 0); } }
509
510 #define RT28XX_MLME_STA_QUICK_RSP_WAKE_UP(pAd)  \
511         {       RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_QKERIODIC_EXECUT, NULL, 0);      \
512                 RTUSBMlmeUp(pAd); }
513
514 #define RT28XX_MLME_RESET_STATE_MACHINE(pAd)    \
515                         MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_RESET_CONF, 0, NULL);     \
516                         RTUSBMlmeUp(pAd);
517
518 #define RT28XX_HANDLE_COUNTER_MEASURE(_pAd, _pEntry)            \
519         {       RTUSBEnqueueInternalCmd(_pAd, CMDTHREAD_802_11_COUNTER_MEASURE, _pEntry, sizeof(MAC_TABLE_ENTRY));      \
520                 RTUSBMlmeUp(_pAd);                                                                      \
521         }
522
523
524 /* ----------------- Power Save Related MACRO ----------------- */
525 #define RT28XX_PS_POLL_ENQUEUE(pAd)                                             \
526         {       RTUSB_SET_BULK_FLAG(pAd, fRTUSB_BULK_OUT_PSPOLL);       \
527                 RTUSBKickBulkOut(pAd); }
528
529 #define RT28xx_CHIP_NAME            "RT2870"
530 #define USB_CYC_CFG                 0x02a4
531 #ifndef RT30xx
532 #define STATUS_SUCCESS                          0x00
533 #define STATUS_UNSUCCESSFUL             0x01
534 #endif
535 #define NT_SUCCESS(status)                      (((status) > 0) ? (1):(0))
536 #define InterlockedIncrement            atomic_inc
537 #define NdisInterlockedIncrement        atomic_inc
538 #define InterlockedDecrement            atomic_dec
539 #define NdisInterlockedDecrement        atomic_dec
540 #define InterlockedExchange                     atomic_set
541 //#define NdisMSendComplete                     RTMP_SendComplete
542 #define NdisMCancelTimer                        RTMPCancelTimer
543 #define NdisAllocMemory(_ptr, _size, _flag)     \
544                                                                         do{_ptr = kmalloc((_size),(_flag));}while(0)
545 #define NdisFreeMemory(a, b, c)         kfree((a))
546 #define NdisMSleep                                      RTMPusecDelay           /* unit: microsecond */
547
548
549 #define USBD_TRANSFER_DIRECTION_OUT             0
550 #define USBD_TRANSFER_DIRECTION_IN              0
551 #define USBD_SHORT_TRANSFER_OK                  0
552 #define PURB                    purbb_t
553
554 #define RTUSB_FREE_URB(pUrb)    usb_free_urb(pUrb)
555
556 //#undef MlmeAllocateMemory
557 //#undef MlmeFreeMemory
558
559 #ifndef RT30xx
560 typedef int                             NTSTATUS;
561 #endif
562 typedef struct usb_device       * PUSB_DEV;
563
564 /* MACRO for linux usb */
565 typedef struct urb *purbb_t;
566 typedef struct usb_ctrlrequest devctrlrequest;
567 #define PIRP            PVOID
568 #define PMDL            PVOID
569 #define NDIS_OID        UINT
570 #ifndef USB_ST_NOERROR
571 #define USB_ST_NOERROR     0
572 #endif
573
574 // vendor-specific control operations
575 #define CONTROL_TIMEOUT_JIFFIES ( (100 * HZ) / 1000)
576 #define UNLINK_TIMEOUT_MS               3
577
578 /* unlink urb   */
579 #define RTUSB_UNLINK_URB(pUrb)          usb_kill_urb(pUrb)
580
581 // Prototypes of completion funuc.
582 VOID RTUSBBulkOutDataPacketComplete(purbb_t purb, struct pt_regs *pt_regs);
583 VOID RTUSBBulkOutMLMEPacketComplete(purbb_t pUrb, struct pt_regs *pt_regs);
584 VOID RTUSBBulkOutNullFrameComplete(purbb_t pUrb, struct pt_regs *pt_regs);
585 VOID RTUSBBulkOutRTSFrameComplete(purbb_t pUrb, struct pt_regs *pt_regs);
586 VOID RTUSBBulkOutPsPollComplete(purbb_t pUrb, struct pt_regs *pt_regs);
587 VOID RTUSBBulkRxComplete(purbb_t pUrb, struct pt_regs *pt_regs);
588
589 #ifndef RT30xx
590 #define RTUSBMlmeUp(pAd)                \
591 {                                                                   \
592         POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;  \
593         CHECK_PID_LEGALITY(pObj->MLMEThr_pid)               \
594         up(&(pAd->mlme_semaphore)); \
595 }
596
597 #define RTUSBCMDUp(pAd)                 \
598 {                                                                           \
599         POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;  \
600         CHECK_PID_LEGALITY(pObj->RTUSBCmdThr_pid)           \
601             up(&(pAd->RTUSBCmd_semaphore)); \
602 }
603 #endif
604 #ifdef RT30xx
605 #define RTUSBMlmeUp(pAd)                \
606 {                                                                   \
607         POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;  \
608         if(pObj->MLMEThr_pid>0)             \
609         up(&(pAd->mlme_semaphore)); \
610 }
611
612 #define RTUSBCMDUp(pAd)                 \
613 {                                                                           \
614         POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;  \
615         if(pObj->RTUSBCmdThr_pid>0)                 \
616             up(&(pAd->RTUSBCmd_semaphore)); \
617 }
618 #endif
619
620 static inline NDIS_STATUS RTMPAllocateMemory(
621         OUT PVOID *ptr,
622         IN size_t size)
623 {
624         *ptr = kmalloc(size, GFP_ATOMIC);
625         if(*ptr)
626                 return NDIS_STATUS_SUCCESS;
627         else
628                 return NDIS_STATUS_RESOURCES;
629 }
630
631 /* rtmp.h */
632 #define BEACON_RING_SIZE                2
633 #define DEVICE_VENDOR_REQUEST_OUT       0x40
634 #define DEVICE_VENDOR_REQUEST_IN        0xc0
635 #define INTERFACE_VENDOR_REQUEST_OUT    0x41
636 #define INTERFACE_VENDOR_REQUEST_IN     0xc1
637 #define MGMTPIPEIDX                                             0       // EP6 is highest priority
638
639 #define BULKOUT_MGMT_RESET_FLAG                         0x80
640
641 #define RTUSB_SET_BULK_FLAG(_M, _F)                             ((_M)->BulkFlags |= (_F))
642 #define RTUSB_CLEAR_BULK_FLAG(_M, _F)                   ((_M)->BulkFlags &= ~(_F))
643 #define RTUSB_TEST_BULK_FLAG(_M, _F)                    (((_M)->BulkFlags & (_F)) != 0)
644
645 #define EnqueueCmd(cmdq, cmdqelmt)              \
646 {                                                                               \
647         if (cmdq->size == 0)                            \
648                 cmdq->head = cmdqelmt;                  \
649         else                                                            \
650                 cmdq->tail->next = cmdqelmt;    \
651         cmdq->tail = cmdqelmt;                          \
652         cmdqelmt->next = NULL;                          \
653         cmdq->size++;                                           \
654 }
655
656 typedef struct   _RT_SET_ASIC_WCID {
657         ULONG WCID;          // mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based
658         ULONG SetTid;        // time-based: seconds, packet-based: kilo-packets
659         ULONG DeleteTid;        // time-based: seconds, packet-based: kilo-packets
660 #ifndef RT30xx
661         UCHAR Addr[MAC_ADDR_LEN];       // avoid in interrupt when write key
662 #endif
663 } RT_SET_ASIC_WCID,*PRT_SET_ASIC_WCID;
664
665 typedef struct   _RT_SET_ASIC_WCID_ATTRI {
666         ULONG   WCID;          // mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based
667         ULONG   Cipher;        // ASIC Cipher definition
668         UCHAR   Addr[ETH_LENGTH_OF_ADDRESS];
669 } RT_SET_ASIC_WCID_ATTRI,*PRT_SET_ASIC_WCID_ATTRI;
670
671 typedef struct _MLME_MEMORY_STRUCT {
672         PVOID                           AllocVa;    //Pointer to the base virtual address of the allocated memory
673         struct _MLME_MEMORY_STRUCT      *Next;      //Pointer to the next virtual address of the allocated memory
674 }   MLME_MEMORY_STRUCT, *PMLME_MEMORY_STRUCT;
675
676 typedef struct  _MLME_MEMORY_HANDLER {
677         BOOLEAN                 MemRunning;         //The flag of the Mlme memory handler's status
678         UINT                    MemoryCount;        //Total nonpaged system-space memory not size
679         UINT                    InUseCount;         //Nonpaged system-space memory in used counts
680         UINT                    UnUseCount;         //Nonpaged system-space memory available counts
681         INT                    PendingCount;       //Nonpaged system-space memory for free counts
682         PMLME_MEMORY_STRUCT     pInUseHead;         //Pointer to the first nonpaed memory not used
683         PMLME_MEMORY_STRUCT     pInUseTail;         //Pointer to the last nonpaged memory not used
684         PMLME_MEMORY_STRUCT     pUnUseHead;         //Pointer to the first nonpaged memory in used
685         PMLME_MEMORY_STRUCT     pUnUseTail;         //Pointer to the last nonpaged memory in used
686         PULONG                  MemFreePending[MAX_MLME_HANDLER_MEMORY];   //an array to keep pending free-memory's pointer (32bits)
687 }   MLME_MEMORY_HANDLER, *PMLME_MEMORY_HANDLER;
688
689 typedef struct _CmdQElmt        {
690         UINT                            command;
691         PVOID                           buffer;
692         ULONG                           bufferlength;
693         BOOLEAN                         CmdFromNdis;
694         BOOLEAN                         SetOperation;
695         struct _CmdQElmt        *next;
696 }       CmdQElmt, *PCmdQElmt;
697
698 typedef struct  _CmdQ   {
699         UINT            size;
700         CmdQElmt        *head;
701         CmdQElmt        *tail;
702         UINT32          CmdQState;
703 }CmdQ, *PCmdQ;
704
705 /* oid.h */
706 // Cipher suite type for mixed mode group cipher, P802.11i-2004
707 typedef enum _RT_802_11_CIPHER_SUITE_TYPE {
708         Cipher_Type_NONE,
709         Cipher_Type_WEP40,
710         Cipher_Type_TKIP,
711         Cipher_Type_RSVD,
712         Cipher_Type_CCMP,
713         Cipher_Type_WEP104
714 } RT_802_11_CIPHER_SUITE_TYPE, *PRT_802_11_CIPHER_SUITE_TYPE;
715
716 //CMDTHREAD_MULTI_READ_MAC
717 //CMDTHREAD_MULTI_WRITE_MAC
718 //CMDTHREAD_VENDOR_EEPROM_READ
719 //CMDTHREAD_VENDOR_EEPROM_WRITE
720 typedef struct  _CMDHandler_TLV {
721         USHORT          Offset;
722         USHORT          Length;
723         UCHAR           DataFirst;
724 }       CMDHandler_TLV, *PCMDHandler_TLV;
725
726 // New for MeetingHouse Api support
727 #define CMDTHREAD_VENDOR_RESET                      0x0D730101  // cmd
728 #define CMDTHREAD_VENDOR_UNPLUG                     0x0D730102  // cmd
729 #define CMDTHREAD_VENDOR_SWITCH_FUNCTION            0x0D730103  // cmd
730 #define CMDTHREAD_MULTI_WRITE_MAC                   0x0D730107  // cmd
731 #define CMDTHREAD_MULTI_READ_MAC                    0x0D730108  // cmd
732 #define CMDTHREAD_VENDOR_EEPROM_WRITE               0x0D73010A  // cmd
733 #define CMDTHREAD_VENDOR_EEPROM_READ                0x0D73010B  // cmd
734 #define CMDTHREAD_VENDOR_ENTER_TESTMODE             0x0D73010C  // cmd
735 #define CMDTHREAD_VENDOR_EXIT_TESTMODE              0x0D73010D  // cmd
736 #define CMDTHREAD_VENDOR_WRITE_BBP                  0x0D730119  // cmd
737 #define CMDTHREAD_VENDOR_READ_BBP                   0x0D730118  // cmd
738 #define CMDTHREAD_VENDOR_WRITE_RF                   0x0D73011A  // cmd
739 #define CMDTHREAD_VENDOR_FLIP_IQ                    0x0D73011D  // cmd
740 #define CMDTHREAD_RESET_BULK_OUT                    0x0D730210  // cmd
741 #define CMDTHREAD_RESET_BULK_IN                     0x0D730211  // cmd
742 #define CMDTHREAD_SET_PSM_BIT_SAVE                  0x0D730212  // cmd
743 #define CMDTHREAD_SET_RADIO                         0x0D730214  // cmd
744 #define CMDTHREAD_UPDATE_TX_RATE                    0x0D730216  // cmd
745 #define CMDTHREAD_802_11_ADD_KEY_WEP                0x0D730218  // cmd
746 #define CMDTHREAD_RESET_FROM_ERROR                  0x0D73021A  // cmd
747 #define CMDTHREAD_LINK_DOWN                         0x0D73021B  // cmd
748 #define CMDTHREAD_RESET_FROM_NDIS                   0x0D73021C  // cmd
749 #define CMDTHREAD_CHECK_GPIO                        0x0D730215  // cmd
750 #define CMDTHREAD_FORCE_WAKE_UP                     0x0D730222  // cmd
751 #define CMDTHREAD_SET_BW                            0x0D730225  // cmd
752 #define CMDTHREAD_SET_ASIC_WCID                     0x0D730226  // cmd
753 #define CMDTHREAD_SET_ASIC_WCID_CIPHER              0x0D730227  // cmd
754 #define CMDTHREAD_QKERIODIC_EXECUT                  0x0D73023D  // cmd
755 #define RT_CMD_SET_KEY_TABLE                        0x0D730228  // cmd
756 #define RT_CMD_SET_RX_WCID_TABLE                    0x0D730229  // cmd
757 #define CMDTHREAD_SET_CLIENT_MAC_ENTRY              0x0D73023E  // cmd
758 #define CMDTHREAD_802_11_QUERY_HARDWARE_REGISTER    0x0D710105  // cmd
759 #define CMDTHREAD_802_11_SET_PHY_MODE               0x0D79010C  // cmd
760 #define CMDTHREAD_802_11_SET_STA_CONFIG             0x0D790111  // cmd
761 #define CMDTHREAD_802_11_SET_PREAMBLE               0x0D790101  // cmd
762 #define CMDTHREAD_802_11_COUNTER_MEASURE                        0x0D790102      // cmd
763
764 #ifdef RT30xx
765 // add by johnli, fix "in_interrupt" error when call "MacTableDeleteEntry" in Rx tasklet
766 #define CMDTHREAD_UPDATE_PROTECT                                        0x0D790103      // cmd
767 // end johnli
768 #endif
769
770 #define WPA1AKMBIT          0x01
771 #define WPA2AKMBIT          0x02
772 #define WPA1PSKAKMBIT   0x04
773 #define WPA2PSKAKMBIT   0x08
774 #define TKIPBIT         0x01
775 #define CCMPBIT         0x02
776
777
778 #define RT28XX_STA_FORCE_WAKEUP(pAd, bFromTx) \
779     RT28xxUsbStaAsicForceWakeup(pAd, bFromTx);
780
781 #define RT28XX_STA_SLEEP_THEN_AUTO_WAKEUP(pAd, TbttNumToNextWakeUp) \
782     RT28xxUsbStaAsicSleepThenAutoWakeup(pAd, TbttNumToNextWakeUp);
783
784 #define RT28XX_MLME_RADIO_ON(pAd) \
785     RT28xxUsbMlmeRadioOn(pAd);
786
787 #define RT28XX_MLME_RADIO_OFF(pAd) \
788     RT28xxUsbMlmeRadioOFF(pAd);
789
790 #endif //__RT2870_H__