Staging: rt2870: add eFuse support
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / drivers / staging / rt2870 / rt2870.h
blob131f3329ac9c35029ec39650442b5b1828f78642
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 *************************************************************************
28 #ifndef __RT2870_H__
29 #define __RT2870_H__
31 //usb header files
32 #include <linux/usb.h>
34 /* rtmp_def.h */
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)
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 #define RETRY_LIMIT 10
50 #define BUFFER_SIZE 2400 //2048
51 #define TX_RING 0xa
52 #define PRIO_RING 0xc
55 // Flags for Bulkflags control for bulk out data
57 #define fRTUSB_BULK_OUT_DATA_NULL 0x00000001
58 #define fRTUSB_BULK_OUT_RTS 0x00000002
59 #define fRTUSB_BULK_OUT_MLME 0x00000004
61 #define fRTUSB_BULK_OUT_DATA_NORMAL 0x00010000
62 #define fRTUSB_BULK_OUT_DATA_NORMAL_2 0x00020000
63 #define fRTUSB_BULK_OUT_DATA_NORMAL_3 0x00040000
64 #define fRTUSB_BULK_OUT_DATA_NORMAL_4 0x00080000
65 #define fRTUSB_BULK_OUT_DATA_NORMAL_5 0x00100000
67 #define fRTUSB_BULK_OUT_PSPOLL 0x00000020
68 #define fRTUSB_BULK_OUT_DATA_FRAG 0x00000040
69 #define fRTUSB_BULK_OUT_DATA_FRAG_2 0x00000080
70 #define fRTUSB_BULK_OUT_DATA_FRAG_3 0x00000100
71 #define fRTUSB_BULK_OUT_DATA_FRAG_4 0x00000200
73 #define FREE_HTTX_RING(_p, _b, _t) \
74 { \
75 if ((_t)->ENextBulkOutPosition == (_t)->CurWritePosition) \
76 { \
77 (_t)->bRingEmpty = TRUE; \
78 } \
79 /*NdisInterlockedDecrement(&(_p)->TxCount); */\
83 // RXINFO appends at the end of each rx packet.
85 typedef struct PACKED _RXINFO_STRUC {
86 UINT32 BA:1;
87 UINT32 DATA:1;
88 UINT32 NULLDATA:1;
89 UINT32 FRAG:1;
90 UINT32 U2M:1; // 1: this RX frame is unicast to me
91 UINT32 Mcast:1; // 1: this is a multicast frame
92 UINT32 Bcast:1; // 1: this is a broadcast frame
93 UINT32 MyBss:1; // 1: this frame belongs to the same BSSID
94 UINT32 Crc:1; // 1: CRC error
95 UINT32 CipherErr:2; // 0: decryption okay, 1:ICV error, 2:MIC error, 3:KEY not valid
96 UINT32 AMSDU:1; // rx with 802.3 header, not 802.11 header.
97 UINT32 HTC:1;
98 UINT32 RSSI:1;
99 UINT32 L2PAD:1;
100 UINT32 AMPDU:1; // To be moved
101 UINT32 Decrypted:1;
102 UINT32 PlcpRssil:1;
103 UINT32 CipherAlg:1;
104 UINT32 LastAMSDU:1;
105 UINT32 PlcpSignal:12;
106 } RXINFO_STRUC, *PRXINFO_STRUC, RT28XX_RXD_STRUC, *PRT28XX_RXD_STRUC;
109 // TXINFO
111 typedef struct _TXINFO_STRUC {
112 // Word 0
113 UINT32 USBDMATxPktLen:16; //used ONLY in USB bulk Aggregation, Total byte counts of all sub-frame.
114 UINT32 rsv:8;
115 UINT32 WIV:1; // Wireless Info Valid. 1 if Driver already fill WI, o if DMA needs to copy WI to correctposition
116 UINT32 QSEL:2; // select on-chip FIFO ID for 2nd-stage output scheduler.0:MGMT, 1:HCCA 2:EDCA
117 UINT32 SwUseLastRound:1; // Software use.
118 UINT32 rsv2:2; // Software use.
119 UINT32 USBDMANextVLD:1; //used ONLY in USB bulk Aggregation, NextValid
120 UINT32 USBDMATxburst:1;//used ONLY in USB bulk Aggre. Force USB DMA transmit frame from current selected endpoint
121 } TXINFO_STRUC, *PTXINFO_STRUC;
123 #define TXINFO_SIZE 4
124 #define RXINFO_SIZE 4
125 #define TXPADDING_SIZE 11
128 // Management ring buffer format
130 typedef struct _MGMT_STRUC {
131 BOOLEAN Valid;
132 PUCHAR pBuffer;
133 ULONG Length;
134 } MGMT_STRUC, *PMGMT_STRUC;
137 /* ----------------- EEPROM Related MACRO ----------------- */
138 #define RT28xx_EEPROM_READ16(pAd, offset, var) \
139 do { \
140 RTUSBReadEEPROM(pAd, offset, (PUCHAR)&(var), 2); \
141 if(!pAd->bUseEfuse) \
142 var = le2cpu16(var); \
143 }while(0)
145 #define RT28xx_EEPROM_WRITE16(pAd, offset, var) \
146 do{ \
147 USHORT _tmpVar=var; \
148 if(!pAd->bUseEfuse) \
149 _tmpVar = cpu2le16(var); \
150 RTUSBWriteEEPROM(pAd, offset, (PUCHAR)&(_tmpVar), 2); \
151 }while(0)
153 /* ----------------- TASK/THREAD Related MACRO ----------------- */
154 #define RT28XX_TASK_THREAD_INIT(pAd, Status) \
155 Status = CreateThreads(net_dev);
158 /* ----------------- Frimware Related MACRO ----------------- */
159 #define RT28XX_WRITE_FIRMWARE(_pAd, _pFwImage, _FwLen) \
160 RTUSBFirmwareWrite(_pAd, _pFwImage, _FwLen)
162 /* ----------------- TX Related MACRO ----------------- */
163 #define RT28XX_START_DEQUEUE(pAd, QueIdx, irqFlags) \
165 RTMP_IRQ_LOCK(&pAd->DeQueueLock[QueIdx], irqFlags); \
166 if (pAd->DeQueueRunning[QueIdx]) \
168 RTMP_IRQ_UNLOCK(&pAd->DeQueueLock[QueIdx], irqFlags);\
169 printk("DeQueueRunning[%d]= TRUE!\n", QueIdx); \
170 continue; \
172 else \
174 pAd->DeQueueRunning[QueIdx] = TRUE; \
175 RTMP_IRQ_UNLOCK(&pAd->DeQueueLock[QueIdx], irqFlags);\
178 #define RT28XX_STOP_DEQUEUE(pAd, QueIdx, irqFlags) \
179 do{ \
180 RTMP_IRQ_LOCK(&pAd->DeQueueLock[QueIdx], irqFlags); \
181 pAd->DeQueueRunning[QueIdx] = FALSE; \
182 RTMP_IRQ_UNLOCK(&pAd->DeQueueLock[QueIdx], irqFlags); \
183 }while(0)
186 #define RT28XX_HAS_ENOUGH_FREE_DESC(pAd, pTxBlk, freeNum, pPacket) \
187 (RTUSBFreeDescriptorRequest(pAd, pTxBlk->QueIdx, (pTxBlk->TotalFrameLen + GET_OS_PKT_LEN(pPacket))) == NDIS_STATUS_SUCCESS)
189 #define RT28XX_RELEASE_DESC_RESOURCE(pAd, QueIdx) \
190 do{}while(0)
192 #define NEED_QUEUE_BACK_FOR_AGG(_pAd, _QueIdx, _freeNum, _TxFrameType) \
193 ((_TxFrameType == TX_RALINK_FRAME) && (RTUSBNeedQueueBackForAgg(_pAd, _QueIdx)))
197 #define fRTMP_ADAPTER_NEED_STOP_TX \
198 (fRTMP_ADAPTER_NIC_NOT_EXIST | fRTMP_ADAPTER_HALT_IN_PROGRESS | \
199 fRTMP_ADAPTER_RESET_IN_PROGRESS | fRTMP_ADAPTER_BULKOUT_RESET | \
200 fRTMP_ADAPTER_RADIO_OFF | fRTMP_ADAPTER_REMOVE_IN_PROGRESS)
203 #define HAL_WriteSubTxResource(pAd, pTxBlk, bIsLast, pFreeNumber) \
204 RtmpUSB_WriteSubTxResource(pAd, pTxBlk, bIsLast, pFreeNumber)
206 #define HAL_WriteTxResource(pAd, pTxBlk,bIsLast, pFreeNumber) \
207 RtmpUSB_WriteSingleTxResource(pAd, pTxBlk,bIsLast, pFreeNumber)
209 #define HAL_WriteFragTxResource(pAd, pTxBlk, fragNum, pFreeNumber) \
210 RtmpUSB_WriteFragTxResource(pAd, pTxBlk, fragNum, pFreeNumber)
212 #define HAL_WriteMultiTxResource(pAd, pTxBlk,frameNum, pFreeNumber) \
213 RtmpUSB_WriteMultiTxResource(pAd, pTxBlk,frameNum, pFreeNumber)
215 #define HAL_FinalWriteTxResource(pAd, pTxBlk, totalMPDUSize, TxIdx) \
216 RtmpUSB_FinalWriteTxResource(pAd, pTxBlk, totalMPDUSize, TxIdx)
218 #define HAL_LastTxIdx(pAd, QueIdx,TxIdx) \
219 /*RtmpUSBDataLastTxIdx(pAd, QueIdx,TxIdx)*/
221 #define HAL_KickOutTx(pAd, pTxBlk, QueIdx) \
222 RtmpUSBDataKickOut(pAd, pTxBlk, QueIdx)
225 #define HAL_KickOutMgmtTx(pAd, QueIdx, pPacket, pSrcBufVA, SrcBufLen) \
226 RtmpUSBMgmtKickOut(pAd, QueIdx, pPacket, pSrcBufVA, SrcBufLen)
228 #define HAL_KickOutNullFrameTx(_pAd, _QueIdx, _pNullFrame, _frameLen) \
229 RtmpUSBNullFrameKickOut(_pAd, _QueIdx, _pNullFrame, _frameLen)
231 #define RTMP_PKT_TAIL_PADDING 11 // 3(max 4 byte padding) + 4 (last packet padding) + 4 (MaxBulkOutsize align padding)
233 extern UCHAR EpToQueue[6];
236 #ifdef RT2870
237 #define GET_TXRING_FREENO(_pAd, _QueIdx) (_QueIdx) //(_pAd->TxRing[_QueIdx].TxSwFreeIdx)
238 #define GET_MGMTRING_FREENO(_pAd) (_pAd->MgmtRing.TxSwFreeIdx)
239 #endif // RT2870 //
242 /* ----------------- RX Related MACRO ----------------- */
243 //#define RT28XX_RX_ERROR_CHECK RTMPCheckRxWI
245 #define RT28XX_RV_ALL_BUF_END(bBulkReceive) \
246 /* We return STATUS_MORE_PROCESSING_REQUIRED so that the completion */ \
247 /* routine (IofCompleteRequest) will stop working on the irp. */ \
248 if (bBulkReceive == TRUE) RTUSBBulkReceive(pAd);
251 /* ----------------- ASIC Related MACRO ----------------- */
253 // reset MAC of a station entry to 0xFFFFFFFFFFFF
254 #define RT28XX_STA_ENTRY_MAC_RESET(pAd, Wcid) \
255 { RT_SET_ASIC_WCID SetAsicWcid; \
256 SetAsicWcid.WCID = Wcid; \
257 SetAsicWcid.SetTid = 0xffffffff; \
258 SetAsicWcid.DeleteTid = 0xffffffff; \
259 RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_SET_ASIC_WCID, \
260 &SetAsicWcid, sizeof(RT_SET_ASIC_WCID)); }
262 // add this entry into ASIC RX WCID search table
263 #define RT28XX_STA_ENTRY_ADD(pAd, pEntry) \
264 RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_SET_CLIENT_MAC_ENTRY, \
265 pEntry, sizeof(MAC_TABLE_ENTRY));
267 // remove Pair-wise key material from ASIC
268 // yet implement
269 #define RT28XX_STA_ENTRY_KEY_DEL(pAd, BssIdx, Wcid)
271 // add Client security information into ASIC WCID table and IVEIV table
272 #define RT28XX_STA_SECURITY_INFO_ADD(pAd, apidx, KeyID, pEntry) \
273 { RT28XX_STA_ENTRY_MAC_RESET(pAd, pEntry->Aid); \
274 if (pEntry->Aid >= 1) { \
275 RT_SET_ASIC_WCID_ATTRI SetAsicWcidAttri; \
276 SetAsicWcidAttri.WCID = pEntry->Aid; \
277 if ((pEntry->AuthMode <= Ndis802_11AuthModeAutoSwitch) && \
278 (pEntry->WepStatus == Ndis802_11Encryption1Enabled)) \
280 SetAsicWcidAttri.Cipher = pAd->SharedKey[apidx][KeyID].CipherAlg; \
282 else if (pEntry->AuthMode == Ndis802_11AuthModeWPANone) \
284 SetAsicWcidAttri.Cipher = pAd->SharedKey[apidx][KeyID].CipherAlg; \
286 else SetAsicWcidAttri.Cipher = 0; \
287 DBGPRINT(RT_DEBUG_TRACE, ("aid cipher = %ld\n",SetAsicWcidAttri.Cipher)); \
288 RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_SET_ASIC_WCID_CIPHER, \
289 &SetAsicWcidAttri, sizeof(RT_SET_ASIC_WCID_ATTRI)); } }
291 // Insert the BA bitmap to ASIC for the Wcid entry
292 #define RT28XX_ADD_BA_SESSION_TO_ASIC(_pAd, _Aid, _TID) \
293 do{ \
294 RT_SET_ASIC_WCID SetAsicWcid; \
295 SetAsicWcid.WCID = (_Aid); \
296 SetAsicWcid.SetTid = (0x10000<<(_TID)); \
297 SetAsicWcid.DeleteTid = 0xffffffff; \
298 RTUSBEnqueueInternalCmd((_pAd), CMDTHREAD_SET_ASIC_WCID, &SetAsicWcid, sizeof(RT_SET_ASIC_WCID)); \
299 }while(0)
301 // Remove the BA bitmap from ASIC for the Wcid entry
302 #define RT28XX_DEL_BA_SESSION_FROM_ASIC(_pAd, _Wcid, _TID) \
303 do{ \
304 RT_SET_ASIC_WCID SetAsicWcid; \
305 SetAsicWcid.WCID = (_Wcid); \
306 SetAsicWcid.SetTid = (0xffffffff); \
307 SetAsicWcid.DeleteTid = (0x10000<<(_TID) ); \
308 RTUSBEnqueueInternalCmd((_pAd), CMDTHREAD_SET_ASIC_WCID, &SetAsicWcid, sizeof(RT_SET_ASIC_WCID)); \
309 }while(0)
312 /* ----------------- PCI/USB Related MACRO ----------------- */
313 #define RT28XX_HANDLE_DEV_ASSIGN(handle, dev_p) \
314 ((POS_COOKIE)handle)->pUsb_Dev = dev_p;
316 // no use
317 #define RT28XX_UNMAP()
318 #define RT28XX_IRQ_REQUEST(net_dev)
319 #define RT28XX_IRQ_RELEASE(net_dev)
320 #define RT28XX_IRQ_INIT(pAd)
321 #define RT28XX_IRQ_ENABLE(pAd)
324 /* ----------------- MLME Related MACRO ----------------- */
325 #define RT28XX_MLME_HANDLER(pAd) RTUSBMlmeUp(pAd)
327 #define RT28XX_MLME_PRE_SANITY_CHECK(pAd) \
328 { if ((pAd->CommonCfg.bHardwareRadio == TRUE) && \
329 (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) && \
330 (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS))) { \
331 RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_CHECK_GPIO, NULL, 0); } }
333 #define RT28XX_MLME_STA_QUICK_RSP_WAKE_UP(pAd) \
334 { RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_QKERIODIC_EXECUT, NULL, 0); \
335 RTUSBMlmeUp(pAd); }
337 #define RT28XX_MLME_RESET_STATE_MACHINE(pAd) \
338 MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_RESET_CONF, 0, NULL); \
339 RTUSBMlmeUp(pAd);
341 #define RT28XX_HANDLE_COUNTER_MEASURE(_pAd, _pEntry) \
342 { RTUSBEnqueueInternalCmd(_pAd, CMDTHREAD_802_11_COUNTER_MEASURE, _pEntry, sizeof(MAC_TABLE_ENTRY)); \
343 RTUSBMlmeUp(_pAd); \
347 /* ----------------- Power Save Related MACRO ----------------- */
348 #define RT28XX_PS_POLL_ENQUEUE(pAd) \
349 { RTUSB_SET_BULK_FLAG(pAd, fRTUSB_BULK_OUT_PSPOLL); \
350 RTUSBKickBulkOut(pAd); }
352 #ifdef RT30xx
353 #define RT28xx_CHIP_NAME "RT3070"
354 #else
355 #define RT28xx_CHIP_NAME "RT2870"
356 #endif
357 #define USB_CYC_CFG 0x02a4
358 #define STATUS_SUCCESS 0x00
359 #define STATUS_UNSUCCESSFUL 0x01
360 #define NT_SUCCESS(status) (((status) > 0) ? (1):(0))
361 #define InterlockedIncrement atomic_inc
362 #define NdisInterlockedIncrement atomic_inc
363 #define InterlockedDecrement atomic_dec
364 #define NdisInterlockedDecrement atomic_dec
365 #define InterlockedExchange atomic_set
366 //#define NdisMSendComplete RTMP_SendComplete
367 #define NdisMCancelTimer RTMPCancelTimer
368 #define NdisAllocMemory(_ptr, _size, _flag) \
369 do{_ptr = kmalloc((_size),(_flag));}while(0)
370 #define NdisFreeMemory(a, b, c) kfree((a))
371 #define NdisMSleep RTMPusecDelay /* unit: microsecond */
374 #define USBD_TRANSFER_DIRECTION_OUT 0
375 #define USBD_TRANSFER_DIRECTION_IN 0
376 #define USBD_SHORT_TRANSFER_OK 0
377 #define PURB purbb_t
379 #define RTUSB_FREE_URB(pUrb) usb_free_urb(pUrb)
381 //#undef MlmeAllocateMemory
382 //#undef MlmeFreeMemory
384 typedef struct usb_device * PUSB_DEV;
386 /* MACRO for linux usb */
387 typedef struct urb *purbb_t;
388 typedef struct usb_ctrlrequest devctrlrequest;
389 #define PIRP PVOID
390 #define PMDL PVOID
391 #define NDIS_OID UINT
392 #ifndef USB_ST_NOERROR
393 #define USB_ST_NOERROR 0
394 #endif
396 // vendor-specific control operations
397 #define CONTROL_TIMEOUT_JIFFIES ( (100 * HZ) / 1000)
398 #define UNLINK_TIMEOUT_MS 3
400 /* unlink urb */
401 #define RTUSB_UNLINK_URB(pUrb) usb_kill_urb(pUrb)
403 // Prototypes of completion funuc.
404 VOID RTUSBBulkOutDataPacketComplete(purbb_t purb, struct pt_regs *pt_regs);
405 VOID RTUSBBulkOutMLMEPacketComplete(purbb_t pUrb, struct pt_regs *pt_regs);
406 VOID RTUSBBulkOutNullFrameComplete(purbb_t pUrb, struct pt_regs *pt_regs);
407 VOID RTUSBBulkOutRTSFrameComplete(purbb_t pUrb, struct pt_regs *pt_regs);
408 VOID RTUSBBulkOutPsPollComplete(purbb_t pUrb, struct pt_regs *pt_regs);
409 VOID RTUSBBulkRxComplete(purbb_t pUrb, struct pt_regs *pt_regs);
411 #define RTUSBMlmeUp(pAd) \
413 POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; \
414 if (pid_nr(pObj->MLMEThr_pid) > 0) \
415 up(&(pAd->mlme_semaphore)); \
418 #define RTUSBCMDUp(pAd) \
420 POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; \
421 if (pid_nr(pObj->RTUSBCmdThr_pid) > 0) \
422 up(&(pAd->RTUSBCmd_semaphore)); \
425 static inline NDIS_STATUS RTMPAllocateMemory(
426 OUT PVOID *ptr,
427 IN size_t size)
429 *ptr = kmalloc(size, GFP_ATOMIC);
430 if(*ptr)
431 return NDIS_STATUS_SUCCESS;
432 else
433 return NDIS_STATUS_RESOURCES;
436 /* rtmp.h */
437 #define BEACON_RING_SIZE 2
438 #define DEVICE_VENDOR_REQUEST_OUT 0x40
439 #define DEVICE_VENDOR_REQUEST_IN 0xc0
440 #define INTERFACE_VENDOR_REQUEST_OUT 0x41
441 #define INTERFACE_VENDOR_REQUEST_IN 0xc1
442 #define MGMTPIPEIDX 0 // EP6 is highest priority
444 #define BULKOUT_MGMT_RESET_FLAG 0x80
446 #define RTUSB_SET_BULK_FLAG(_M, _F) ((_M)->BulkFlags |= (_F))
447 #define RTUSB_CLEAR_BULK_FLAG(_M, _F) ((_M)->BulkFlags &= ~(_F))
448 #define RTUSB_TEST_BULK_FLAG(_M, _F) (((_M)->BulkFlags & (_F)) != 0)
450 #define EnqueueCmd(cmdq, cmdqelmt) \
452 if (cmdq->size == 0) \
453 cmdq->head = cmdqelmt; \
454 else \
455 cmdq->tail->next = cmdqelmt; \
456 cmdq->tail = cmdqelmt; \
457 cmdqelmt->next = NULL; \
458 cmdq->size++; \
461 typedef struct _RT_SET_ASIC_WCID {
462 ULONG WCID; // mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based
463 ULONG SetTid; // time-based: seconds, packet-based: kilo-packets
464 ULONG DeleteTid; // time-based: seconds, packet-based: kilo-packets
465 #ifndef RT30xx
466 UCHAR Addr[MAC_ADDR_LEN]; // avoid in interrupt when write key
467 #endif
468 } RT_SET_ASIC_WCID,*PRT_SET_ASIC_WCID;
470 typedef struct _RT_SET_ASIC_WCID_ATTRI {
471 ULONG WCID; // mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based
472 ULONG Cipher; // ASIC Cipher definition
473 UCHAR Addr[ETH_LENGTH_OF_ADDRESS];
474 } RT_SET_ASIC_WCID_ATTRI,*PRT_SET_ASIC_WCID_ATTRI;
476 typedef struct _MLME_MEMORY_STRUCT {
477 PVOID AllocVa; //Pointer to the base virtual address of the allocated memory
478 struct _MLME_MEMORY_STRUCT *Next; //Pointer to the next virtual address of the allocated memory
479 } MLME_MEMORY_STRUCT, *PMLME_MEMORY_STRUCT;
481 typedef struct _MLME_MEMORY_HANDLER {
482 BOOLEAN MemRunning; //The flag of the Mlme memory handler's status
483 UINT MemoryCount; //Total nonpaged system-space memory not size
484 UINT InUseCount; //Nonpaged system-space memory in used counts
485 UINT UnUseCount; //Nonpaged system-space memory available counts
486 INT PendingCount; //Nonpaged system-space memory for free counts
487 PMLME_MEMORY_STRUCT pInUseHead; //Pointer to the first nonpaed memory not used
488 PMLME_MEMORY_STRUCT pInUseTail; //Pointer to the last nonpaged memory not used
489 PMLME_MEMORY_STRUCT pUnUseHead; //Pointer to the first nonpaged memory in used
490 PMLME_MEMORY_STRUCT pUnUseTail; //Pointer to the last nonpaged memory in used
491 PULONG MemFreePending[MAX_MLME_HANDLER_MEMORY]; //an array to keep pending free-memory's pointer (32bits)
492 } MLME_MEMORY_HANDLER, *PMLME_MEMORY_HANDLER;
494 typedef struct _CmdQElmt {
495 UINT command;
496 PVOID buffer;
497 ULONG bufferlength;
498 BOOLEAN CmdFromNdis;
499 BOOLEAN SetOperation;
500 struct _CmdQElmt *next;
501 } CmdQElmt, *PCmdQElmt;
503 typedef struct _CmdQ {
504 UINT size;
505 CmdQElmt *head;
506 CmdQElmt *tail;
507 UINT32 CmdQState;
508 }CmdQ, *PCmdQ;
510 /* oid.h */
511 // Cipher suite type for mixed mode group cipher, P802.11i-2004
512 typedef enum _RT_802_11_CIPHER_SUITE_TYPE {
513 Cipher_Type_NONE,
514 Cipher_Type_WEP40,
515 Cipher_Type_TKIP,
516 Cipher_Type_RSVD,
517 Cipher_Type_CCMP,
518 Cipher_Type_WEP104
519 } RT_802_11_CIPHER_SUITE_TYPE, *PRT_802_11_CIPHER_SUITE_TYPE;
521 //CMDTHREAD_MULTI_READ_MAC
522 //CMDTHREAD_MULTI_WRITE_MAC
523 //CMDTHREAD_VENDOR_EEPROM_READ
524 //CMDTHREAD_VENDOR_EEPROM_WRITE
525 typedef struct _CMDHandler_TLV {
526 USHORT Offset;
527 USHORT Length;
528 UCHAR DataFirst;
529 } CMDHandler_TLV, *PCMDHandler_TLV;
531 // New for MeetingHouse Api support
532 #define CMDTHREAD_VENDOR_RESET 0x0D730101 // cmd
533 #define CMDTHREAD_VENDOR_UNPLUG 0x0D730102 // cmd
534 #define CMDTHREAD_VENDOR_SWITCH_FUNCTION 0x0D730103 // cmd
535 #define CMDTHREAD_MULTI_WRITE_MAC 0x0D730107 // cmd
536 #define CMDTHREAD_MULTI_READ_MAC 0x0D730108 // cmd
537 #define CMDTHREAD_VENDOR_EEPROM_WRITE 0x0D73010A // cmd
538 #define CMDTHREAD_VENDOR_EEPROM_READ 0x0D73010B // cmd
539 #define CMDTHREAD_VENDOR_ENTER_TESTMODE 0x0D73010C // cmd
540 #define CMDTHREAD_VENDOR_EXIT_TESTMODE 0x0D73010D // cmd
541 #define CMDTHREAD_VENDOR_WRITE_BBP 0x0D730119 // cmd
542 #define CMDTHREAD_VENDOR_READ_BBP 0x0D730118 // cmd
543 #define CMDTHREAD_VENDOR_WRITE_RF 0x0D73011A // cmd
544 #define CMDTHREAD_VENDOR_FLIP_IQ 0x0D73011D // cmd
545 #define CMDTHREAD_RESET_BULK_OUT 0x0D730210 // cmd
546 #define CMDTHREAD_RESET_BULK_IN 0x0D730211 // cmd
547 #define CMDTHREAD_SET_PSM_BIT_SAVE 0x0D730212 // cmd
548 #define CMDTHREAD_SET_RADIO 0x0D730214 // cmd
549 #define CMDTHREAD_UPDATE_TX_RATE 0x0D730216 // cmd
550 #define CMDTHREAD_802_11_ADD_KEY_WEP 0x0D730218 // cmd
551 #define CMDTHREAD_RESET_FROM_ERROR 0x0D73021A // cmd
552 #define CMDTHREAD_LINK_DOWN 0x0D73021B // cmd
553 #define CMDTHREAD_RESET_FROM_NDIS 0x0D73021C // cmd
554 #define CMDTHREAD_CHECK_GPIO 0x0D730215 // cmd
555 #define CMDTHREAD_FORCE_WAKE_UP 0x0D730222 // cmd
556 #define CMDTHREAD_SET_BW 0x0D730225 // cmd
557 #define CMDTHREAD_SET_ASIC_WCID 0x0D730226 // cmd
558 #define CMDTHREAD_SET_ASIC_WCID_CIPHER 0x0D730227 // cmd
559 #define CMDTHREAD_QKERIODIC_EXECUT 0x0D73023D // cmd
560 #define CMDTHREAD_SET_CLIENT_MAC_ENTRY 0x0D73023E // cmd
561 #define CMDTHREAD_802_11_QUERY_HARDWARE_REGISTER 0x0D710105 // cmd
562 #define CMDTHREAD_802_11_SET_PHY_MODE 0x0D79010C // cmd
563 #define CMDTHREAD_802_11_SET_STA_CONFIG 0x0D790111 // cmd
564 #define CMDTHREAD_802_11_SET_PREAMBLE 0x0D790101 // cmd
565 #define CMDTHREAD_802_11_COUNTER_MEASURE 0x0D790102 // cmd
566 #define CMDTHREAD_UPDATE_PROTECT 0x0D790103 // cmd
568 #define WPA1AKMBIT 0x01
569 #define WPA2AKMBIT 0x02
570 #define WPA1PSKAKMBIT 0x04
571 #define WPA2PSKAKMBIT 0x08
572 #define TKIPBIT 0x01
573 #define CCMPBIT 0x02
576 #define RT28XX_STA_FORCE_WAKEUP(pAd, bFromTx) \
577 RT28xxUsbStaAsicForceWakeup(pAd, bFromTx);
579 #define RT28XX_STA_SLEEP_THEN_AUTO_WAKEUP(pAd, TbttNumToNextWakeUp) \
580 RT28xxUsbStaAsicSleepThenAutoWakeup(pAd, TbttNumToNextWakeUp);
582 #define RT28XX_MLME_RADIO_ON(pAd) \
583 RT28xxUsbMlmeRadioOn(pAd);
585 #define RT28XX_MLME_RADIO_OFF(pAd) \
586 RT28xxUsbMlmeRadioOFF(pAd);
588 #endif //__RT2870_H__