2 *************************************************************************
4 * 5F., No.36, Taiyuan St., Jhubei City,
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. *
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. *
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. *
25 *************************************************************************
31 RT28xx ASIC related definition & structures
35 -------- ---------- ----------------------------------------------
36 Jan Lee Jan-3-2006 created for RT2860c
44 // PCI registers - base address 0x0000
46 #define PCI_CFG 0x0000
47 #define PCI_EECTRL 0x0004
48 #define PCI_MCUCTRL 0x0008
53 #define RETRY_LIMIT 10
54 #define STATUS_SUCCESS 0x00
55 #define STATUS_UNSUCCESSFUL 0x01
58 // SCH/DMA registers - base address 0x0200
60 // INT_SOURCE_CSR: Interrupt source register. Write one to clear corresponding bit
62 #define DMA_CSR0 0x200
63 #define INT_SOURCE_CSR 0x200
65 typedef union _INT_SOURCE_CSR_STRUC {
71 UINT32 AutoWakeup:1;//bit14
72 UINT32 TXFifoStatusInt:1;//FIFO Statistics is full, sw should read 0x171c
75 UINT32 RxTxCoherent:1;
76 UINT32 MCUCommandINT:1;
84 UINT32 TxDelayINT:1; //delayed interrupt, not interrupt until several int or time limit hit
85 UINT32 RxDelayINT:1; //dealyed interrupt
88 } INT_SOURCE_CSR_STRUC, *PINT_SOURCE_CSR_STRUC;
90 typedef union _INT_SOURCE_CSR_STRUC {
95 UINT32 Ac0DmaDone:1;//4
99 UINT32 HccaDmaDone:1; // bit7
100 UINT32 MgmtDmaDone:1;
101 UINT32 MCUCommandINT:1;//bit 9
102 UINT32 RxTxCoherent:1;
105 UINT32 TXFifoStatusInt:1;//FIFO Statistics is full, sw should read 0x171c
106 UINT32 AutoWakeup:1;//bit14
108 UINT32 RxCoherent:1;//bit16
113 } INT_SOURCE_CSR_STRUC, *PINT_SOURCE_CSR_STRUC;
117 // INT_MASK_CSR: Interrupt MASK register. 1: the interrupt is mask OFF
119 #define INT_MASK_CSR 0x204
121 typedef union _INT_MASK_CSR_STRUC {
126 UINT32 MCUCommandINT:1;
127 UINT32 MgmtDmaDone:1;
128 UINT32 HccaDmaDone:1;
135 UINT32 RXDelay_INT_MSK:1;
138 }INT_MASK_CSR_STRUC, *PINT_MASK_CSR_STRUC;
140 typedef union _INT_MASK_CSR_STRUC {
142 UINT32 RXDelay_INT_MSK:1;
149 UINT32 HccaDmaDone:1;
150 UINT32 MgmtDmaDone:1;
151 UINT32 MCUCommandINT:1;
157 } INT_MASK_CSR_STRUC, *PINT_MASK_CSR_STRUC;
159 #define WPDMA_GLO_CFG 0x208
161 typedef union _WPDMA_GLO_CFG_STRUC {
163 UINT32 HDR_SEG_LEN:16;
164 UINT32 RXHdrScater:8;
166 UINT32 EnTXWriteBackDDONE:1;
167 UINT32 WPDMABurstSIZE:2;
169 UINT32 EnableRxDMA:1;
171 UINT32 EnableTxDMA:1;
174 }WPDMA_GLO_CFG_STRUC, *PWPDMA_GLO_CFG_STRUC;
176 typedef union _WPDMA_GLO_CFG_STRUC {
178 UINT32 EnableTxDMA:1;
180 UINT32 EnableRxDMA:1;
182 UINT32 WPDMABurstSIZE:2;
183 UINT32 EnTXWriteBackDDONE:1;
185 UINT32 RXHdrScater:8;
186 UINT32 HDR_SEG_LEN:16;
189 } WPDMA_GLO_CFG_STRUC, *PWPDMA_GLO_CFG_STRUC;
191 #define WPDMA_RST_IDX 0x20c
193 typedef union _WPDMA_RST_IDX_STRUC {
196 UINT32 RST_DRX_IDX0:1;
198 UINT32 RST_DTX_IDX5:1;
199 UINT32 RST_DTX_IDX4:1;
200 UINT32 RST_DTX_IDX3:1;
201 UINT32 RST_DTX_IDX2:1;
202 UINT32 RST_DTX_IDX1:1;
203 UINT32 RST_DTX_IDX0:1;
206 }WPDMA_RST_IDX_STRUC, *PWPDMA_RST_IDX_STRUC;
208 typedef union _WPDMA_RST_IDX_STRUC {
210 UINT32 RST_DTX_IDX0:1;
211 UINT32 RST_DTX_IDX1:1;
212 UINT32 RST_DTX_IDX2:1;
213 UINT32 RST_DTX_IDX3:1;
214 UINT32 RST_DTX_IDX4:1;
215 UINT32 RST_DTX_IDX5:1;
217 UINT32 RST_DRX_IDX0:1;
221 } WPDMA_RST_IDX_STRUC, *PWPDMA_RST_IDX_STRUC;
223 #define DELAY_INT_CFG 0x0210
225 typedef union _DELAY_INT_CFG_STRUC {
227 UINT32 TXDLY_INT_EN:1;
229 UINT32 TXMAX_PTIME:8;
230 UINT32 RXDLY_INT_EN:1;
232 UINT32 RXMAX_PTIME:8;
235 }DELAY_INT_CFG_STRUC, *PDELAY_INT_CFG_STRUC;
237 typedef union _DELAY_INT_CFG_STRUC {
239 UINT32 RXMAX_PTIME:8;
241 UINT32 RXDLY_INT_EN:1;
242 UINT32 TXMAX_PTIME:8;
244 UINT32 TXDLY_INT_EN:1;
247 } DELAY_INT_CFG_STRUC, *PDELAY_INT_CFG_STRUC;
249 #define WMM_AIFSN_CFG 0x0214
251 typedef union _AIFSN_CSR_STRUC {
254 UINT32 Aifsn3:4; // for AC_VO
255 UINT32 Aifsn2:4; // for AC_VI
256 UINT32 Aifsn1:4; // for AC_BK
257 UINT32 Aifsn0:4; // for AC_BE
260 } AIFSN_CSR_STRUC, *PAIFSN_CSR_STRUC;
262 typedef union _AIFSN_CSR_STRUC {
264 UINT32 Aifsn0:4; // for AC_BE
265 UINT32 Aifsn1:4; // for AC_BK
266 UINT32 Aifsn2:4; // for AC_VI
267 UINT32 Aifsn3:4; // for AC_VO
271 } AIFSN_CSR_STRUC, *PAIFSN_CSR_STRUC;
274 // CWMIN_CSR: CWmin for each EDCA AC
276 #define WMM_CWMIN_CFG 0x0218
278 typedef union _CWMIN_CSR_STRUC {
281 UINT32 Cwmin3:4; // for AC_VO
282 UINT32 Cwmin2:4; // for AC_VI
283 UINT32 Cwmin1:4; // for AC_BK
284 UINT32 Cwmin0:4; // for AC_BE
287 } CWMIN_CSR_STRUC, *PCWMIN_CSR_STRUC;
289 typedef union _CWMIN_CSR_STRUC {
291 UINT32 Cwmin0:4; // for AC_BE
292 UINT32 Cwmin1:4; // for AC_BK
293 UINT32 Cwmin2:4; // for AC_VI
294 UINT32 Cwmin3:4; // for AC_VO
298 } CWMIN_CSR_STRUC, *PCWMIN_CSR_STRUC;
302 // CWMAX_CSR: CWmin for each EDCA AC
304 #define WMM_CWMAX_CFG 0x021c
306 typedef union _CWMAX_CSR_STRUC {
309 UINT32 Cwmax3:4; // for AC_VO
310 UINT32 Cwmax2:4; // for AC_VI
311 UINT32 Cwmax1:4; // for AC_BK
312 UINT32 Cwmax0:4; // for AC_BE
315 } CWMAX_CSR_STRUC, *PCWMAX_CSR_STRUC;
317 typedef union _CWMAX_CSR_STRUC {
319 UINT32 Cwmax0:4; // for AC_BE
320 UINT32 Cwmax1:4; // for AC_BK
321 UINT32 Cwmax2:4; // for AC_VI
322 UINT32 Cwmax3:4; // for AC_VO
326 } CWMAX_CSR_STRUC, *PCWMAX_CSR_STRUC;
331 // AC_TXOP_CSR0: AC_BK/AC_BE TXOP register
333 #define WMM_TXOP0_CFG 0x0220
335 typedef union _AC_TXOP_CSR0_STRUC {
337 USHORT Ac1Txop; // for AC_BE, in unit of 32us
338 USHORT Ac0Txop; // for AC_BK, in unit of 32us
341 } AC_TXOP_CSR0_STRUC, *PAC_TXOP_CSR0_STRUC;
343 typedef union _AC_TXOP_CSR0_STRUC {
345 USHORT Ac0Txop; // for AC_BK, in unit of 32us
346 USHORT Ac1Txop; // for AC_BE, in unit of 32us
349 } AC_TXOP_CSR0_STRUC, *PAC_TXOP_CSR0_STRUC;
353 // AC_TXOP_CSR1: AC_VO/AC_VI TXOP register
355 #define WMM_TXOP1_CFG 0x0224
357 typedef union _AC_TXOP_CSR1_STRUC {
359 USHORT Ac3Txop; // for AC_VO, in unit of 32us
360 USHORT Ac2Txop; // for AC_VI, in unit of 32us
363 } AC_TXOP_CSR1_STRUC, *PAC_TXOP_CSR1_STRUC;
365 typedef union _AC_TXOP_CSR1_STRUC {
367 USHORT Ac2Txop; // for AC_VI, in unit of 32us
368 USHORT Ac3Txop; // for AC_VO, in unit of 32us
371 } AC_TXOP_CSR1_STRUC, *PAC_TXOP_CSR1_STRUC;
373 #define RINGREG_DIFF 0x10
374 #define GPIO_CTRL_CFG 0x0228 //MAC_CSR13
375 #define MCU_CMD_CFG 0x022c
376 #define TX_BASE_PTR0 0x0230 //AC_BK base address
377 #define TX_MAX_CNT0 0x0234
378 #define TX_CTX_IDX0 0x0238
379 #define TX_DTX_IDX0 0x023c
380 #define TX_BASE_PTR1 0x0240 //AC_BE base address
381 #define TX_MAX_CNT1 0x0244
382 #define TX_CTX_IDX1 0x0248
383 #define TX_DTX_IDX1 0x024c
384 #define TX_BASE_PTR2 0x0250 //AC_VI base address
385 #define TX_MAX_CNT2 0x0254
386 #define TX_CTX_IDX2 0x0258
387 #define TX_DTX_IDX2 0x025c
388 #define TX_BASE_PTR3 0x0260 //AC_VO base address
389 #define TX_MAX_CNT3 0x0264
390 #define TX_CTX_IDX3 0x0268
391 #define TX_DTX_IDX3 0x026c
392 #define TX_BASE_PTR4 0x0270 //HCCA base address
393 #define TX_MAX_CNT4 0x0274
394 #define TX_CTX_IDX4 0x0278
395 #define TX_DTX_IDX4 0x027c
396 #define TX_BASE_PTR5 0x0280 //MGMT base address
397 #define TX_MAX_CNT5 0x0284
398 #define TX_CTX_IDX5 0x0288
399 #define TX_DTX_IDX5 0x028c
400 #define TX_MGMTMAX_CNT TX_MAX_CNT5
401 #define TX_MGMTCTX_IDX TX_CTX_IDX5
402 #define TX_MGMTDTX_IDX TX_DTX_IDX5
403 #define RX_BASE_PTR 0x0290 //RX base address
404 #define RX_MAX_CNT 0x0294
405 #define RX_CRX_IDX 0x0298
406 #define RX_DRX_IDX 0x029c
407 #define USB_DMA_CFG 0x02a0
409 typedef union _USB_DMA_CFG_STRUC {
411 UINT32 TxBusy:1; //USB DMA TX FSM busy . debug only
412 UINT32 RxBusy:1; //USB DMA RX FSM busy . debug only
413 UINT32 EpoutValid:6; //OUT endpoint data valid. debug only
414 UINT32 TxBulkEn:1; //Enable USB DMA Tx
415 UINT32 RxBulkEn:1; //Enable USB DMA Rx
416 UINT32 RxBulkAggEn:1; //Enable Rx Bulk Aggregation
417 UINT32 TxopHalt:1; //Halt TXOP count down when TX buffer is full.
418 UINT32 TxClear:1; //Clear USB DMA TX path
420 UINT32 phyclear:1; //phy watch dog enable. write 1
421 UINT32 RxBulkAggLmt:8; //Rx Bulk Aggregation Limit in unit of 1024 bytes
422 UINT32 RxBulkAggTOut:8; //Rx Bulk Aggregation TimeOut in unit of 33ns
425 } USB_DMA_CFG_STRUC, *PUSB_DMA_CFG_STRUC;
427 typedef union _USB_DMA_CFG_STRUC {
429 UINT32 RxBulkAggTOut:8; //Rx Bulk Aggregation TimeOut in unit of 33ns
430 UINT32 RxBulkAggLmt:8; //Rx Bulk Aggregation Limit in unit of 256 bytes
431 UINT32 phyclear:1; //phy watch dog enable. write 1
433 UINT32 TxClear:1; //Clear USB DMA TX path
434 UINT32 TxopHalt:1; //Halt TXOP count down when TX buffer is full.
435 UINT32 RxBulkAggEn:1; //Enable Rx Bulk Aggregation
436 UINT32 RxBulkEn:1; //Enable USB DMA Rx
437 UINT32 TxBulkEn:1; //Enable USB DMA Tx
438 UINT32 EpoutValid:6; //OUT endpoint data valid
439 UINT32 RxBusy:1; //USB DMA RX FSM busy
440 UINT32 TxBusy:1; //USB DMA TX FSM busy
443 } USB_DMA_CFG_STRUC, *PUSB_DMA_CFG_STRUC;
450 // Most are for debug. Driver doesn't touch PBF register.
451 #define PBF_SYS_CTRL 0x0400
452 #define PBF_CFG 0x0408
453 #define PBF_MAX_PCNT 0x040C
454 #define PBF_CTRL 0x0410
455 #define PBF_INT_STA 0x0414
456 #define PBF_INT_ENA 0x0418
457 #define TXRXQ_PCNT 0x0438
458 #define PBF_DBG 0x043c
459 #define PBF_CAP_CTRL 0x0440
463 #define EFUSE_CTRL 0x0580
464 #define EFUSE_DATA0 0x0590
465 #define EFUSE_DATA1 0x0594
466 #define EFUSE_DATA2 0x0598
467 #define EFUSE_DATA3 0x059c
468 #define EFUSE_USAGE_MAP_START 0x2d0
469 #define EFUSE_USAGE_MAP_END 0x2fc
470 #define EFUSE_TAG 0x2fe
471 #define EFUSE_USAGE_MAP_SIZE 45
474 typedef union _EFUSE_CTRL_STRUC {
477 UINT32 EFSROM_KICK:1;
479 UINT32 EFSROM_AIN:10;
480 UINT32 EFSROM_LDO_ON_TIME:2;
481 UINT32 EFSROM_LDO_OFF_TIME:6;
482 UINT32 EFSROM_MODE:2;
483 UINT32 EFSROM_AOUT:6;
486 } EFUSE_CTRL_STRUC, *PEFUSE_CTRL_STRUC;
488 typedef union _EFUSE_CTRL_STRUC {
490 UINT32 EFSROM_AOUT:6;
491 UINT32 EFSROM_MODE:2;
492 UINT32 EFSROM_LDO_OFF_TIME:6;
493 UINT32 EFSROM_LDO_ON_TIME:2;
494 UINT32 EFSROM_AIN:10;
496 UINT32 EFSROM_KICK:1;
500 } EFUSE_CTRL_STRUC, *PEFUSE_CTRL_STRUC;
501 #endif // RT_BIG_ENDIAN //
503 #define LDO_CFG0 0x05d4
504 #define GPIO_SWITCH 0x05dc
510 // 4.1 MAC SYSTEM configuration registers (offset:0x1000)
512 #define MAC_CSR0 0x1000
514 typedef union _ASIC_VER_ID_STRUC {
516 USHORT ASICVer; // version : 2860
517 USHORT ASICRev; // reversion : 0
520 } ASIC_VER_ID_STRUC, *PASIC_VER_ID_STRUC;
522 typedef union _ASIC_VER_ID_STRUC {
524 USHORT ASICRev; // reversion : 0
525 USHORT ASICVer; // version : 2860
528 } ASIC_VER_ID_STRUC, *PASIC_VER_ID_STRUC;
530 #define MAC_SYS_CTRL 0x1004 //MAC_CSR1
531 #define MAC_ADDR_DW0 0x1008 // MAC ADDR DW0
532 #define MAC_ADDR_DW1 0x100c // MAC ADDR DW1
534 // MAC_CSR2: STA MAC register 0
537 typedef union _MAC_DW0_STRUC {
539 UCHAR Byte3; // MAC address byte 3
540 UCHAR Byte2; // MAC address byte 2
541 UCHAR Byte1; // MAC address byte 1
542 UCHAR Byte0; // MAC address byte 0
545 } MAC_DW0_STRUC, *PMAC_DW0_STRUC;
547 typedef union _MAC_DW0_STRUC {
549 UCHAR Byte0; // MAC address byte 0
550 UCHAR Byte1; // MAC address byte 1
551 UCHAR Byte2; // MAC address byte 2
552 UCHAR Byte3; // MAC address byte 3
555 } MAC_DW0_STRUC, *PMAC_DW0_STRUC;
559 // MAC_CSR3: STA MAC register 1
562 typedef union _MAC_DW1_STRUC {
566 UCHAR Byte5; // MAC address byte 5
567 UCHAR Byte4; // MAC address byte 4
570 } MAC_DW1_STRUC, *PMAC_DW1_STRUC;
572 typedef union _MAC_DW1_STRUC {
574 UCHAR Byte4; // MAC address byte 4
575 UCHAR Byte5; // MAC address byte 5
580 } MAC_DW1_STRUC, *PMAC_DW1_STRUC;
583 #define MAC_BSSID_DW0 0x1010 // MAC BSSID DW0
584 #define MAC_BSSID_DW1 0x1014 // MAC BSSID DW1
587 // MAC_CSR5: BSSID register 1
590 typedef union _MAC_CSR5_STRUC {
594 USHORT BssIdMode:2; // 0: one BSSID, 10: 4 BSSID, 01: 2 BSSID , 11: 8BSSID
595 UCHAR Byte5; // BSSID byte 5
596 UCHAR Byte4; // BSSID byte 4
599 } MAC_CSR5_STRUC, *PMAC_CSR5_STRUC;
601 typedef union _MAC_CSR5_STRUC {
603 UCHAR Byte4; // BSSID byte 4
604 UCHAR Byte5; // BSSID byte 5
605 USHORT BssIdMask:2; // 0: one BSSID, 10: 4 BSSID, 01: 2 BSSID , 11: 8BSSID
610 } MAC_CSR5_STRUC, *PMAC_CSR5_STRUC;
613 #define MAX_LEN_CFG 0x1018 // rt2860b max 16k bytes. bit12:13 Maximum PSDU length (power factor) 0:2^13, 1:2^14, 2:2^15, 3:2^16
614 #define BBP_CSR_CFG 0x101c //
616 // BBP_CSR_CFG: BBP serial control register
619 typedef union _BBP_CSR_CFG_STRUC {
622 UINT32 BBP_RW_MODE:1; // 0: use serial mode 1:parallel
623 UINT32 BBP_PAR_DUR:1; // 0: 4 MAC clock cycles 1: 8 MAC clock cycles
624 UINT32 Busy:1; // 1: ASIC is busy execute BBP programming.
625 UINT32 fRead:1; // 0: Write BBP, 1: Read BBP
626 UINT32 RegNum:8; // Selected BBP register
627 UINT32 Value:8; // Register value to program into BBP
630 } BBP_CSR_CFG_STRUC, *PBBP_CSR_CFG_STRUC;
632 typedef union _BBP_CSR_CFG_STRUC {
634 UINT32 Value:8; // Register value to program into BBP
635 UINT32 RegNum:8; // Selected BBP register
636 UINT32 fRead:1; // 0: Write BBP, 1: Read BBP
637 UINT32 Busy:1; // 1: ASIC is busy execute BBP programming.
638 UINT32 BBP_PAR_DUR:1; // 0: 4 MAC clock cycles 1: 8 MAC clock cycles
639 UINT32 BBP_RW_MODE:1; // 0: use serial mode 1:parallel
643 } BBP_CSR_CFG_STRUC, *PBBP_CSR_CFG_STRUC;
645 #define RF_CSR_CFG0 0x1020
647 // RF_CSR_CFG: RF control register
650 typedef union _RF_CSR_CFG0_STRUC {
652 UINT32 Busy:1; // 0: idle 1: 8busy
653 UINT32 Sel:1; // 0:RF_LE0 activate 1:RF_LE1 activate
654 UINT32 StandbyMode:1; // 0: high when stand by 1: low when standby
655 UINT32 bitwidth:5; // Selected BBP register
656 UINT32 RegIdAndContent:24; // Register value to program into BBP
659 } RF_CSR_CFG0_STRUC, *PRF_CSR_CFG0_STRUC;
661 typedef union _RF_CSR_CFG0_STRUC {
663 UINT32 RegIdAndContent:24; // Register value to program into BBP
664 UINT32 bitwidth:5; // Selected BBP register
665 UINT32 StandbyMode:1; // 0: high when stand by 1: low when standby
666 UINT32 Sel:1; // 0:RF_LE0 activate 1:RF_LE1 activate
667 UINT32 Busy:1; // 0: idle 1: 8busy
670 } RF_CSR_CFG0_STRUC, *PRF_CSR_CFG0_STRUC;
672 #define RF_CSR_CFG1 0x1024
674 typedef union _RF_CSR_CFG1_STRUC {
676 UINT32 rsv:7; // 0: idle 1: 8busy
677 UINT32 RFGap:5; // Gap between BB_CONTROL_RF and RF_LE. 0: 3 system clock cycle (37.5usec) 1: 5 system clock cycle (62.5usec)
678 UINT32 RegIdAndContent:24; // Register value to program into BBP
681 } RF_CSR_CFG1_STRUC, *PRF_CSR_CFG1_STRUC;
683 typedef union _RF_CSR_CFG1_STRUC {
685 UINT32 RegIdAndContent:24; // Register value to program into BBP
686 UINT32 RFGap:5; // Gap between BB_CONTROL_RF and RF_LE. 0: 3 system clock cycle (37.5usec) 1: 5 system clock cycle (62.5usec)
687 UINT32 rsv:7; // 0: idle 1: 8busy
690 } RF_CSR_CFG1_STRUC, *PRF_CSR_CFG1_STRUC;
692 #define RF_CSR_CFG2 0x1028 //
694 typedef union _RF_CSR_CFG2_STRUC {
696 UINT32 rsv:8; // 0: idle 1: 8busy
697 UINT32 RegIdAndContent:24; // Register value to program into BBP
700 } RF_CSR_CFG2_STRUC, *PRF_CSR_CFG2_STRUC;
702 typedef union _RF_CSR_CFG2_STRUC {
704 UINT32 RegIdAndContent:24; // Register value to program into BBP
705 UINT32 rsv:8; // 0: idle 1: 8busy
708 } RF_CSR_CFG2_STRUC, *PRF_CSR_CFG2_STRUC;
710 #define LED_CFG 0x102c // MAC_CSR14
712 typedef union _LED_CFG_STRUC {
715 UINT32 LedPolar:1; // Led Polarity. 0: active low1: active high
716 UINT32 YLedMode:2; // yellow Led Mode
717 UINT32 GLedMode:2; // green Led Mode
718 UINT32 RLedMode:2; // red Led Mode 0: off1: blinking upon TX2: periodic slow blinking3: always on
720 UINT32 SlowBlinkPeriod:6; // slow blinking period. unit:1ms
721 UINT32 OffPeriod:8; // blinking off period unit 1ms
722 UINT32 OnPeriod:8; // blinking on period unit 1ms
725 } LED_CFG_STRUC, *PLED_CFG_STRUC;
727 typedef union _LED_CFG_STRUC {
729 UINT32 OnPeriod:8; // blinking on period unit 1ms
730 UINT32 OffPeriod:8; // blinking off period unit 1ms
731 UINT32 SlowBlinkPeriod:6; // slow blinking period. unit:1ms
733 UINT32 RLedMode:2; // red Led Mode 0: off1: blinking upon TX2: periodic slow blinking3: always on
734 UINT32 GLedMode:2; // green Led Mode
735 UINT32 YLedMode:2; // yellow Led Mode
736 UINT32 LedPolar:1; // Led Polarity. 0: active low1: active high
740 } LED_CFG_STRUC, *PLED_CFG_STRUC;
743 // 4.2 MAC TIMING configuration registers (offset:0x1100)
745 #define XIFS_TIME_CFG 0x1100 // MAC_CSR8 MAC_CSR9
747 typedef union _IFS_SLOT_CFG_STRUC {
750 UINT32 BBRxendEnable:1; // reference RXEND signal to begin XIFS defer
751 UINT32 EIFS:9; // unit 1us
752 UINT32 OfdmXifsTime:4; //OFDM SIFS. unit 1us. Applied after OFDM RX when MAC doesn't reference BBP signal BBRXEND
753 UINT32 OfdmSifsTime:8; // unit 1us. Applied after OFDM RX/TX
754 UINT32 CckmSifsTime:8; // unit 1us. Applied after CCK RX/TX
757 } IFS_SLOT_CFG_STRUC, *PIFS_SLOT_CFG_STRUC;
759 typedef union _IFS_SLOT_CFG_STRUC {
761 UINT32 CckmSifsTime:8; // unit 1us. Applied after CCK RX/TX
762 UINT32 OfdmSifsTime:8; // unit 1us. Applied after OFDM RX/TX
763 UINT32 OfdmXifsTime:4; //OFDM SIFS. unit 1us. Applied after OFDM RX when MAC doesn't reference BBP signal BBRXEND
764 UINT32 EIFS:9; // unit 1us
765 UINT32 BBRxendEnable:1; // reference RXEND signal to begin XIFS defer
769 } IFS_SLOT_CFG_STRUC, *PIFS_SLOT_CFG_STRUC;
772 #define BKOFF_SLOT_CFG 0x1104 // mac_csr9 last 8 bits
773 #define NAV_TIME_CFG 0x1108 // NAV (MAC_CSR15)
774 #define CH_TIME_CFG 0x110C // Count as channel busy
775 #define PBF_LIFE_TIMER 0x1110 //TX/RX MPDU timestamp timer (free run)Unit: 1us
776 #define BCN_TIME_CFG 0x1114 // TXRX_CSR9
778 #define BCN_OFFSET0 0x042C
779 #define BCN_OFFSET1 0x0430
782 // BCN_TIME_CFG : Synchronization control register
785 typedef union _BCN_TIME_CFG_STRUC {
787 UINT32 TxTimestampCompensate:8;
789 UINT32 bBeaconGen:1; // Enable beacon generator
790 UINT32 bTBTTEnable:1;
791 UINT32 TsfSyncMode:2; // Enable TSF sync, 00: disable, 01: infra mode, 10: ad-hoc mode
792 UINT32 bTsfTicking:1; // Enable TSF auto counting
793 UINT32 BeaconInterval:16; // in unit of 1/16 TU
796 } BCN_TIME_CFG_STRUC, *PBCN_TIME_CFG_STRUC;
798 typedef union _BCN_TIME_CFG_STRUC {
800 UINT32 BeaconInterval:16; // in unit of 1/16 TU
801 UINT32 bTsfTicking:1; // Enable TSF auto counting
802 UINT32 TsfSyncMode:2; // Enable TSF sync, 00: disable, 01: infra mode, 10: ad-hoc mode
803 UINT32 bTBTTEnable:1;
804 UINT32 bBeaconGen:1; // Enable beacon generator
806 UINT32 TxTimestampCompensate:8;
809 } BCN_TIME_CFG_STRUC, *PBCN_TIME_CFG_STRUC;
811 #define TBTT_SYNC_CFG 0x1118 // txrx_csr10
812 #define TSF_TIMER_DW0 0x111C // Local TSF timer lsb 32 bits. Read-only
813 #define TSF_TIMER_DW1 0x1120 // msb 32 bits. Read-only.
814 #define TBTT_TIMER 0x1124 // TImer remains till next TBTT. Read-only. TXRX_CSR14
815 #define INT_TIMER_CFG 0x1128 //
816 #define INT_TIMER_EN 0x112c // GP-timer and pre-tbtt Int enable
817 #define CH_IDLE_STA 0x1130 // channel idle time
818 #define CH_BUSY_STA 0x1134 // channle busy time
820 // 4.2 MAC POWER configuration registers (offset:0x1200)
822 #define MAC_STATUS_CFG 0x1200 // old MAC_CSR12
823 #define PWR_PIN_CFG 0x1204 // old MAC_CSR12
824 #define AUTO_WAKEUP_CFG 0x1208 // old MAC_CSR10
826 // AUTO_WAKEUP_CFG: Manual power control / status register
829 typedef union _AUTO_WAKEUP_STRUC {
832 UINT32 EnableAutoWakeup:1; // 0:sleep, 1:awake
833 UINT32 NumofSleepingTbtt:7; // ForceWake has high privilege than PutToSleep when both set
834 UINT32 AutoLeadTime:8;
837 } AUTO_WAKEUP_STRUC, *PAUTO_WAKEUP_STRUC;
839 typedef union _AUTO_WAKEUP_STRUC {
841 UINT32 AutoLeadTime:8;
842 UINT32 NumofSleepingTbtt:7; // ForceWake has high privilege than PutToSleep when both set
843 UINT32 EnableAutoWakeup:1; // 0:sleep, 1:awake
847 } AUTO_WAKEUP_STRUC, *PAUTO_WAKEUP_STRUC;
850 // 4.3 MAC TX configuration registers (offset:0x1300)
853 #define EDCA_AC0_CFG 0x1300 //AC_TXOP_CSR0 0x3474
854 #define EDCA_AC1_CFG 0x1304
855 #define EDCA_AC2_CFG 0x1308
856 #define EDCA_AC3_CFG 0x130c
858 typedef union _EDCA_AC_CFG_STRUC {
861 UINT32 Cwmax:4; //unit power of 2
863 UINT32 Aifsn:4; // # of slot time
864 UINT32 AcTxop:8; // in unit of 32us
867 } EDCA_AC_CFG_STRUC, *PEDCA_AC_CFG_STRUC;
869 typedef union _EDCA_AC_CFG_STRUC {
871 UINT32 AcTxop:8; // in unit of 32us
872 UINT32 Aifsn:4; // # of slot time
874 UINT32 Cwmax:4; //unit power of 2
878 } EDCA_AC_CFG_STRUC, *PEDCA_AC_CFG_STRUC;
881 #define EDCA_TID_AC_MAP 0x1310
882 #define TX_PWR_CFG_0 0x1314
883 #define TX_PWR_CFG_1 0x1318
884 #define TX_PWR_CFG_2 0x131C
885 #define TX_PWR_CFG_3 0x1320
886 #define TX_PWR_CFG_4 0x1324
887 #define TX_PIN_CFG 0x1328
888 #define TX_BAND_CFG 0x132c // 0x1 use upper 20MHz. 0 juse lower 20MHz
889 #define TX_SW_CFG0 0x1330
890 #define TX_SW_CFG1 0x1334
891 #define TX_SW_CFG2 0x1338
892 #define TXOP_THRES_CFG 0x133c
893 #define TXOP_CTRL_CFG 0x1340
894 #define TX_RTS_CFG 0x1344
897 typedef union _TX_RTS_CFG_STRUC {
900 UINT32 RtsFbkEn:1; // enable rts rate fallback
901 UINT32 RtsThres:16; // unit:byte
902 UINT32 AutoRtsRetryLimit:8;
905 } TX_RTS_CFG_STRUC, *PTX_RTS_CFG_STRUC;
907 typedef union _TX_RTS_CFG_STRUC {
909 UINT32 AutoRtsRetryLimit:8;
910 UINT32 RtsThres:16; // unit:byte
911 UINT32 RtsFbkEn:1; // enable rts rate fallback
912 UINT32 rsv:7; // 1: HT non-STBC control frame enable
915 } TX_RTS_CFG_STRUC, *PTX_RTS_CFG_STRUC;
917 #define TX_TIMEOUT_CFG 0x1348
919 typedef union _TX_TIMEOUT_CFG_STRUC {
922 UINT32 TxopTimeout:8; //TXOP timeout value for TXOP truncation. It is recommended that (SLOT_TIME) > (TX_OP_TIMEOUT) > (RX_ACK_TIMEOUT)
923 UINT32 RxAckTimeout:8; // unit:slot. Used for TX precedure
924 UINT32 MpduLifeTime:4; // expiration time = 2^(9+MPDU LIFE TIME) us
928 } TX_TIMEOUT_CFG_STRUC, *PTX_TIMEOUT_CFG_STRUC;
930 typedef union _TX_TIMEOUT_CFG_STRUC {
933 UINT32 MpduLifeTime:4; // expiration time = 2^(9+MPDU LIFE TIME) us
934 UINT32 RxAckTimeout:8; // unit:slot. Used for TX precedure
935 UINT32 TxopTimeout:8; //TXOP timeout value for TXOP truncation. It is recommended that (SLOT_TIME) > (TX_OP_TIMEOUT) > (RX_ACK_TIMEOUT)
936 UINT32 rsv2:8; // 1: HT non-STBC control frame enable
939 } TX_TIMEOUT_CFG_STRUC, *PTX_TIMEOUT_CFG_STRUC;
941 #define TX_RTY_CFG 0x134c
943 typedef union PACKED _TX_RTY_CFG_STRUC {
946 UINT32 TxautoFBEnable:1; // Tx retry PHY rate auto fallback enable
947 UINT32 AggRtyMode:1; // Aggregate MPDU retry mode. 0:expired by retry limit, 1: expired by mpdu life timer
948 UINT32 NonAggRtyMode:1; // Non-Aggregate MPDU retry mode. 0:expired by retry limit, 1: expired by mpdu life timer
949 UINT32 LongRtyThre:12; // Long retry threshoold
950 UINT32 LongRtyLimit:8; //long retry limit
951 UINT32 ShortRtyLimit:8; // short retry limit
955 } TX_RTY_CFG_STRUC, *PTX_RTY_CFG_STRUC;
957 typedef union PACKED _TX_RTY_CFG_STRUC {
959 UINT32 ShortRtyLimit:8; // short retry limit
960 UINT32 LongRtyLimit:8; //long retry limit
961 UINT32 LongRtyThre:12; // Long retry threshoold
962 UINT32 NonAggRtyMode:1; // Non-Aggregate MPDU retry mode. 0:expired by retry limit, 1: expired by mpdu life timer
963 UINT32 AggRtyMode:1; // Aggregate MPDU retry mode. 0:expired by retry limit, 1: expired by mpdu life timer
964 UINT32 TxautoFBEnable:1; // Tx retry PHY rate auto fallback enable
965 UINT32 rsv:1; // 1: HT non-STBC control frame enable
968 } TX_RTY_CFG_STRUC, *PTX_RTY_CFG_STRUC;
970 #define TX_LINK_CFG 0x1350
972 typedef union PACKED _TX_LINK_CFG_STRUC {
974 UINT32 RemotMFS:8; //remote MCS feedback sequence number
975 UINT32 RemotMFB:8; // remote MCS feedback
977 UINT32 TxCFAckEn:1; // Piggyback CF-ACK enable
978 UINT32 TxRDGEn:1; // RDG TX enable
979 UINT32 TxMRQEn:1; // MCS request TX enable
980 UINT32 RemoteUMFSEnable:1; // remote unsolicit MFB enable. 0: not apply remote remote unsolicit (MFS=7)
981 UINT32 MFBEnable:1; // TX apply remote MFB 1:enable
982 UINT32 RemoteMFBLifeTime:8; //remote MFB life time. unit : 32us
985 } TX_LINK_CFG_STRUC, *PTX_LINK_CFG_STRUC;
987 typedef union PACKED _TX_LINK_CFG_STRUC {
989 UINT32 RemoteMFBLifeTime:8; //remote MFB life time. unit : 32us
990 UINT32 MFBEnable:1; // TX apply remote MFB 1:enable
991 UINT32 RemoteUMFSEnable:1; // remote unsolicit MFB enable. 0: not apply remote remote unsolicit (MFS=7)
992 UINT32 TxMRQEn:1; // MCS request TX enable
993 UINT32 TxRDGEn:1; // RDG TX enable
994 UINT32 TxCFAckEn:1; // Piggyback CF-ACK enable
996 UINT32 RemotMFB:8; // remote MCS feedback
997 UINT32 RemotMFS:8; //remote MCS feedback sequence number
1000 } TX_LINK_CFG_STRUC, *PTX_LINK_CFG_STRUC;
1002 #define HT_FBK_CFG0 0x1354
1003 #ifdef RT_BIG_ENDIAN
1004 typedef union PACKED _HT_FBK_CFG0_STRUC {
1016 } HT_FBK_CFG0_STRUC, *PHT_FBK_CFG0_STRUC;
1018 typedef union PACKED _HT_FBK_CFG0_STRUC {
1030 } HT_FBK_CFG0_STRUC, *PHT_FBK_CFG0_STRUC;
1032 #define HT_FBK_CFG1 0x1358
1033 #ifdef RT_BIG_ENDIAN
1034 typedef union _HT_FBK_CFG1_STRUC {
1036 UINT32 HTMCS15FBK:4;
1037 UINT32 HTMCS14FBK:4;
1038 UINT32 HTMCS13FBK:4;
1039 UINT32 HTMCS12FBK:4;
1040 UINT32 HTMCS11FBK:4;
1041 UINT32 HTMCS10FBK:4;
1046 } HT_FBK_CFG1_STRUC, *PHT_FBK_CFG1_STRUC;
1048 typedef union _HT_FBK_CFG1_STRUC {
1052 UINT32 HTMCS10FBK:4;
1053 UINT32 HTMCS11FBK:4;
1054 UINT32 HTMCS12FBK:4;
1055 UINT32 HTMCS13FBK:4;
1056 UINT32 HTMCS14FBK:4;
1057 UINT32 HTMCS15FBK:4;
1060 } HT_FBK_CFG1_STRUC, *PHT_FBK_CFG1_STRUC;
1062 #define LG_FBK_CFG0 0x135c
1063 #ifdef RT_BIG_ENDIAN
1064 typedef union _LG_FBK_CFG0_STRUC {
1066 UINT32 OFDMMCS7FBK:4; //initial value is 6
1067 UINT32 OFDMMCS6FBK:4; //initial value is 5
1068 UINT32 OFDMMCS5FBK:4; //initial value is 4
1069 UINT32 OFDMMCS4FBK:4; //initial value is 3
1070 UINT32 OFDMMCS3FBK:4; //initial value is 2
1071 UINT32 OFDMMCS2FBK:4; //initial value is 1
1072 UINT32 OFDMMCS1FBK:4; //initial value is 0
1073 UINT32 OFDMMCS0FBK:4; //initial value is 0
1076 } LG_FBK_CFG0_STRUC, *PLG_FBK_CFG0_STRUC;
1078 typedef union _LG_FBK_CFG0_STRUC {
1080 UINT32 OFDMMCS0FBK:4; //initial value is 0
1081 UINT32 OFDMMCS1FBK:4; //initial value is 0
1082 UINT32 OFDMMCS2FBK:4; //initial value is 1
1083 UINT32 OFDMMCS3FBK:4; //initial value is 2
1084 UINT32 OFDMMCS4FBK:4; //initial value is 3
1085 UINT32 OFDMMCS5FBK:4; //initial value is 4
1086 UINT32 OFDMMCS6FBK:4; //initial value is 5
1087 UINT32 OFDMMCS7FBK:4; //initial value is 6
1090 } LG_FBK_CFG0_STRUC, *PLG_FBK_CFG0_STRUC;
1092 #define LG_FBK_CFG1 0x1360
1093 #ifdef RT_BIG_ENDIAN
1094 typedef union _LG_FBK_CFG1_STRUC {
1097 UINT32 CCKMCS3FBK:4; //initial value is 2
1098 UINT32 CCKMCS2FBK:4; //initial value is 1
1099 UINT32 CCKMCS1FBK:4; //initial value is 0
1100 UINT32 CCKMCS0FBK:4; //initial value is 0
1103 } LG_FBK_CFG1_STRUC, *PLG_FBK_CFG1_STRUC;
1105 typedef union _LG_FBK_CFG1_STRUC {
1107 UINT32 CCKMCS0FBK:4; //initial value is 0
1108 UINT32 CCKMCS1FBK:4; //initial value is 0
1109 UINT32 CCKMCS2FBK:4; //initial value is 1
1110 UINT32 CCKMCS3FBK:4; //initial value is 2
1114 } LG_FBK_CFG1_STRUC, *PLG_FBK_CFG1_STRUC;
1117 //=======================================================
1118 //================ Protection Paramater================================
1119 //=======================================================
1120 #define CCK_PROT_CFG 0x1364 //CCK Protection
1121 #define ASIC_SHORTNAV 1
1122 #define ASIC_LONGNAV 2
1125 #ifdef RT_BIG_ENDIAN
1126 typedef union _PROT_CFG_STRUC {
1129 UINT32 RTSThEn:1; //RTS threshold enable on CCK TX
1130 UINT32 TxopAllowGF40:1; //CCK TXOP allowance.0:disallow.
1131 UINT32 TxopAllowGF20:1; //CCK TXOP allowance.0:disallow.
1132 UINT32 TxopAllowMM40:1; //CCK TXOP allowance.0:disallow.
1133 UINT32 TxopAllowMM20:1; //CCK TXOP allowance. 0:disallow.
1134 UINT32 TxopAllowOfdm:1; //CCK TXOP allowance.0:disallow.
1135 UINT32 TxopAllowCck:1; //CCK TXOP allowance.0:disallow.
1136 UINT32 ProtectNav:2; //TXOP protection type for CCK TX. 0:None, 1:ShortNAVprotect, 2:LongNAVProtect, 3:rsv
1137 UINT32 ProtectCtrl:2; //Protection control frame type for CCK TX. 1:RTS/CTS, 2:CTS-to-self, 0:None, 3:rsv
1138 UINT32 ProtectRate:16; //Protection control frame rate for CCK TX(RTS/CTS/CFEnd).
1141 } PROT_CFG_STRUC, *PPROT_CFG_STRUC;
1143 typedef union _PROT_CFG_STRUC {
1145 UINT32 ProtectRate:16; //Protection control frame rate for CCK TX(RTS/CTS/CFEnd).
1146 UINT32 ProtectCtrl:2; //Protection control frame type for CCK TX. 1:RTS/CTS, 2:CTS-to-self, 0:None, 3:rsv
1147 UINT32 ProtectNav:2; //TXOP protection type for CCK TX. 0:None, 1:ShortNAVprotect, 2:LongNAVProtect, 3:rsv
1148 UINT32 TxopAllowCck:1; //CCK TXOP allowance.0:disallow.
1149 UINT32 TxopAllowOfdm:1; //CCK TXOP allowance.0:disallow.
1150 UINT32 TxopAllowMM20:1; //CCK TXOP allowance. 0:disallow.
1151 UINT32 TxopAllowMM40:1; //CCK TXOP allowance.0:disallow.
1152 UINT32 TxopAllowGF20:1; //CCK TXOP allowance.0:disallow.
1153 UINT32 TxopAllowGF40:1; //CCK TXOP allowance.0:disallow.
1154 UINT32 RTSThEn:1; //RTS threshold enable on CCK TX
1158 } PROT_CFG_STRUC, *PPROT_CFG_STRUC;
1161 #define OFDM_PROT_CFG 0x1368 //OFDM Protection
1162 #define MM20_PROT_CFG 0x136C //MM20 Protection
1163 #define MM40_PROT_CFG 0x1370 //MM40 Protection
1164 #define GF20_PROT_CFG 0x1374 //GF20 Protection
1165 #define GF40_PROT_CFG 0x1378 //GR40 Protection
1166 #define EXP_CTS_TIME 0x137C //
1167 #define EXP_ACK_TIME 0x1380 //
1170 // 4.4 MAC RX configuration registers (offset:0x1400)
1172 #define RX_FILTR_CFG 0x1400 //TXRX_CSR0
1173 #define AUTO_RSP_CFG 0x1404 //TXRX_CSR4
1175 // TXRX_CSR4: Auto-Responder/
1177 #ifdef RT_BIG_ENDIAN
1178 typedef union _AUTO_RSP_CFG_STRUC {
1181 UINT32 AckCtsPsmBit:1; // Power bit value in conrtrol frame
1182 UINT32 DualCTSEn:1; // Power bit value in conrtrol frame
1183 UINT32 rsv:1; // Power bit value in conrtrol frame
1184 UINT32 AutoResponderPreamble:1; // 0:long, 1:short preamble
1185 UINT32 CTS40MRef:1; // Response CTS 40MHz duplicate mode
1186 UINT32 CTS40MMode:1; // Response CTS 40MHz duplicate mode
1187 UINT32 BACAckPolicyEnable:1; // 0:long, 1:short preamble
1188 UINT32 AutoResponderEnable:1;
1191 } AUTO_RSP_CFG_STRUC, *PAUTO_RSP_CFG_STRUC;
1193 typedef union _AUTO_RSP_CFG_STRUC {
1195 UINT32 AutoResponderEnable:1;
1196 UINT32 BACAckPolicyEnable:1; // 0:long, 1:short preamble
1197 UINT32 CTS40MMode:1; // Response CTS 40MHz duplicate mode
1198 UINT32 CTS40MRef:1; // Response CTS 40MHz duplicate mode
1199 UINT32 AutoResponderPreamble:1; // 0:long, 1:short preamble
1200 UINT32 rsv:1; // Power bit value in conrtrol frame
1201 UINT32 DualCTSEn:1; // Power bit value in conrtrol frame
1202 UINT32 AckCtsPsmBit:1; // Power bit value in conrtrol frame
1206 } AUTO_RSP_CFG_STRUC, *PAUTO_RSP_CFG_STRUC;
1209 #define LEGACY_BASIC_RATE 0x1408 // TXRX_CSR5 0x3054
1210 #define HT_BASIC_RATE 0x140c
1211 #define HT_CTRL_CFG 0x1410
1212 #define SIFS_COST_CFG 0x1414
1213 #define RX_PARSER_CFG 0x1418 //Set NAV for all received frames
1216 // 4.5 MAC Security configuration (offset:0x1500)
1218 #define TX_SEC_CNT0 0x1500 //
1219 #define RX_SEC_CNT0 0x1504 //
1220 #define CCMP_FC_MUTE 0x1508 //
1222 // 4.6 HCCA/PSMP (offset:0x1600)
1224 #define TXOP_HLDR_ADDR0 0x1600
1225 #define TXOP_HLDR_ADDR1 0x1604
1226 #define TXOP_HLDR_ET 0x1608
1227 #define QOS_CFPOLL_RA_DW0 0x160c
1228 #define QOS_CFPOLL_A1_DW1 0x1610
1229 #define QOS_CFPOLL_QC 0x1614
1231 // 4.7 MAC Statistis registers (offset:0x1700)
1233 #define RX_STA_CNT0 0x1700 //
1234 #define RX_STA_CNT1 0x1704 //
1235 #define RX_STA_CNT2 0x1708 //
1238 // RX_STA_CNT0_STRUC: RX PLCP error count & RX CRC error count
1240 #ifdef RT_BIG_ENDIAN
1241 typedef union _RX_STA_CNT0_STRUC {
1247 } RX_STA_CNT0_STRUC, *PRX_STA_CNT0_STRUC;
1249 typedef union _RX_STA_CNT0_STRUC {
1255 } RX_STA_CNT0_STRUC, *PRX_STA_CNT0_STRUC;
1259 // RX_STA_CNT1_STRUC: RX False CCA count & RX LONG frame count
1261 #ifdef RT_BIG_ENDIAN
1262 typedef union _RX_STA_CNT1_STRUC {
1268 } RX_STA_CNT1_STRUC, *PRX_STA_CNT1_STRUC;
1270 typedef union _RX_STA_CNT1_STRUC {
1276 } RX_STA_CNT1_STRUC, *PRX_STA_CNT1_STRUC;
1280 // RX_STA_CNT2_STRUC:
1282 #ifdef RT_BIG_ENDIAN
1283 typedef union _RX_STA_CNT2_STRUC {
1285 USHORT RxFifoOverflowCount;
1286 USHORT RxDupliCount;
1289 } RX_STA_CNT2_STRUC, *PRX_STA_CNT2_STRUC;
1291 typedef union _RX_STA_CNT2_STRUC {
1293 USHORT RxDupliCount;
1294 USHORT RxFifoOverflowCount;
1297 } RX_STA_CNT2_STRUC, *PRX_STA_CNT2_STRUC;
1299 #define TX_STA_CNT0 0x170C //
1301 // STA_CSR3: TX Beacon count
1303 #ifdef RT_BIG_ENDIAN
1304 typedef union _TX_STA_CNT0_STRUC {
1306 USHORT TxBeaconCount;
1310 } TX_STA_CNT0_STRUC, *PTX_STA_CNT0_STRUC;
1312 typedef union _TX_STA_CNT0_STRUC {
1315 USHORT TxBeaconCount;
1318 } TX_STA_CNT0_STRUC, *PTX_STA_CNT0_STRUC;
1320 #define TX_STA_CNT1 0x1710 //
1322 // TX_STA_CNT1: TX tx count
1324 #ifdef RT_BIG_ENDIAN
1325 typedef union _TX_STA_CNT1_STRUC {
1327 USHORT TxRetransmit;
1331 } TX_STA_CNT1_STRUC, *PTX_STA_CNT1_STRUC;
1333 typedef union _TX_STA_CNT1_STRUC {
1336 USHORT TxRetransmit;
1339 } TX_STA_CNT1_STRUC, *PTX_STA_CNT1_STRUC;
1341 #define TX_STA_CNT2 0x1714 //
1343 // TX_STA_CNT2: TX tx count
1345 #ifdef RT_BIG_ENDIAN
1346 typedef union _TX_STA_CNT2_STRUC {
1348 USHORT TxUnderFlowCount;
1349 USHORT TxZeroLenCount;
1352 } TX_STA_CNT2_STRUC, *PTX_STA_CNT2_STRUC;
1354 typedef union _TX_STA_CNT2_STRUC {
1356 USHORT TxZeroLenCount;
1357 USHORT TxUnderFlowCount;
1360 } TX_STA_CNT2_STRUC, *PTX_STA_CNT2_STRUC;
1362 #define TX_STA_FIFO 0x1718 //
1364 // TX_STA_FIFO_STRUC: TX Result for specific PID status fifo register
1366 #ifdef RT_BIG_ENDIAN
1367 typedef union PACKED _TX_STA_FIFO_STRUC {
1370 UINT32 TxBF:1; // 3*3
1371 UINT32 SuccessRate:13; //include MCS, mode ,shortGI, BW settingSame format as TXWI Word 0 Bit 31-16.
1372 // UINT32 SuccessRate:16; //include MCS, mode ,shortGI, BW settingSame format as TXWI Word 0 Bit 31-16.
1373 UINT32 wcid:8; //wireless client index
1374 UINT32 TxAckRequired:1; // ack required
1375 UINT32 TxAggre:1; // Tx is aggregated
1376 UINT32 TxSuccess:1; // Tx success. whether success or not
1378 UINT32 bValid:1; // 1:This register contains a valid TX result
1381 } TX_STA_FIFO_STRUC, *PTX_STA_FIFO_STRUC;
1383 typedef union PACKED _TX_STA_FIFO_STRUC {
1385 UINT32 bValid:1; // 1:This register contains a valid TX result
1387 UINT32 TxSuccess:1; // Tx No retry success
1388 UINT32 TxAggre:1; // Tx Retry Success
1389 UINT32 TxAckRequired:1; // Tx fail
1390 UINT32 wcid:8; //wireless client index
1391 // UINT32 SuccessRate:16; //include MCS, mode ,shortGI, BW settingSame format as TXWI Word 0 Bit 31-16.
1392 UINT32 SuccessRate:13; //include MCS, mode ,shortGI, BW settingSame format as TXWI Word 0 Bit 31-16.
1397 } TX_STA_FIFO_STRUC, *PTX_STA_FIFO_STRUC;
1400 #define TX_AGG_CNT 0x171c
1401 #ifdef RT_BIG_ENDIAN
1402 typedef union _TX_AGG_CNT_STRUC {
1405 USHORT NonAggTxCount;
1408 } TX_AGG_CNT_STRUC, *PTX_AGG_CNT_STRUC;
1410 typedef union _TX_AGG_CNT_STRUC {
1412 USHORT NonAggTxCount;
1416 } TX_AGG_CNT_STRUC, *PTX_AGG_CNT_STRUC;
1419 #define TX_AGG_CNT0 0x1720
1420 #ifdef RT_BIG_ENDIAN
1421 typedef union _TX_AGG_CNT0_STRUC {
1423 USHORT AggSize2Count;
1424 USHORT AggSize1Count;
1427 } TX_AGG_CNT0_STRUC, *PTX_AGG_CNT0_STRUC;
1429 typedef union _TX_AGG_CNT0_STRUC {
1431 USHORT AggSize1Count;
1432 USHORT AggSize2Count;
1435 } TX_AGG_CNT0_STRUC, *PTX_AGG_CNT0_STRUC;
1438 #define TX_AGG_CNT1 0x1724
1439 #ifdef RT_BIG_ENDIAN
1440 typedef union _TX_AGG_CNT1_STRUC {
1442 USHORT AggSize4Count;
1443 USHORT AggSize3Count;
1446 } TX_AGG_CNT1_STRUC, *PTX_AGG_CNT1_STRUC;
1448 typedef union _TX_AGG_CNT1_STRUC {
1450 USHORT AggSize3Count;
1451 USHORT AggSize4Count;
1454 } TX_AGG_CNT1_STRUC, *PTX_AGG_CNT1_STRUC;
1456 #define TX_AGG_CNT2 0x1728
1457 #ifdef RT_BIG_ENDIAN
1458 typedef union _TX_AGG_CNT2_STRUC {
1460 USHORT AggSize6Count;
1461 USHORT AggSize5Count;
1464 } TX_AGG_CNT2_STRUC, *PTX_AGG_CNT2_STRUC;
1466 typedef union _TX_AGG_CNT2_STRUC {
1468 USHORT AggSize5Count;
1469 USHORT AggSize6Count;
1472 } TX_AGG_CNT2_STRUC, *PTX_AGG_CNT2_STRUC;
1475 #define TX_AGG_CNT3 0x172c
1476 #ifdef RT_BIG_ENDIAN
1477 typedef union _TX_AGG_CNT3_STRUC {
1479 USHORT AggSize8Count;
1480 USHORT AggSize7Count;
1483 } TX_AGG_CNT3_STRUC, *PTX_AGG_CNT3_STRUC;
1485 typedef union _TX_AGG_CNT3_STRUC {
1487 USHORT AggSize7Count;
1488 USHORT AggSize8Count;
1491 } TX_AGG_CNT3_STRUC, *PTX_AGG_CNT3_STRUC;
1494 #define TX_AGG_CNT4 0x1730
1495 #ifdef RT_BIG_ENDIAN
1496 typedef union _TX_AGG_CNT4_STRUC {
1498 USHORT AggSize10Count;
1499 USHORT AggSize9Count;
1502 } TX_AGG_CNT4_STRUC, *PTX_AGG_CNT4_STRUC;
1504 typedef union _TX_AGG_CNT4_STRUC {
1506 USHORT AggSize9Count;
1507 USHORT AggSize10Count;
1510 } TX_AGG_CNT4_STRUC, *PTX_AGG_CNT4_STRUC;
1512 #define TX_AGG_CNT5 0x1734
1513 #ifdef RT_BIG_ENDIAN
1514 typedef union _TX_AGG_CNT5_STRUC {
1516 USHORT AggSize12Count;
1517 USHORT AggSize11Count;
1520 } TX_AGG_CNT5_STRUC, *PTX_AGG_CNT5_STRUC;
1522 typedef union _TX_AGG_CNT5_STRUC {
1524 USHORT AggSize11Count;
1525 USHORT AggSize12Count;
1528 } TX_AGG_CNT5_STRUC, *PTX_AGG_CNT5_STRUC;
1530 #define TX_AGG_CNT6 0x1738
1531 #ifdef RT_BIG_ENDIAN
1532 typedef union _TX_AGG_CNT6_STRUC {
1534 USHORT AggSize14Count;
1535 USHORT AggSize13Count;
1538 } TX_AGG_CNT6_STRUC, *PTX_AGG_CNT6_STRUC;
1540 typedef union _TX_AGG_CNT6_STRUC {
1542 USHORT AggSize13Count;
1543 USHORT AggSize14Count;
1546 } TX_AGG_CNT6_STRUC, *PTX_AGG_CNT6_STRUC;
1548 #define TX_AGG_CNT7 0x173c
1549 #ifdef RT_BIG_ENDIAN
1550 typedef union _TX_AGG_CNT7_STRUC {
1552 USHORT AggSize16Count;
1553 USHORT AggSize15Count;
1556 } TX_AGG_CNT7_STRUC, *PTX_AGG_CNT7_STRUC;
1558 typedef union _TX_AGG_CNT7_STRUC {
1560 USHORT AggSize15Count;
1561 USHORT AggSize16Count;
1564 } TX_AGG_CNT7_STRUC, *PTX_AGG_CNT7_STRUC;
1566 #define MPDU_DENSITY_CNT 0x1740
1567 #ifdef RT_BIG_ENDIAN
1568 typedef union _MPDU_DEN_CNT_STRUC {
1570 USHORT RXZeroDelCount; //RX zero length delimiter count
1571 USHORT TXZeroDelCount; //TX zero length delimiter count
1574 } MPDU_DEN_CNT_STRUC, *PMPDU_DEN_CNT_STRUC;
1576 typedef union _MPDU_DEN_CNT_STRUC {
1578 USHORT TXZeroDelCount; //TX zero length delimiter count
1579 USHORT RXZeroDelCount; //RX zero length delimiter count
1582 } MPDU_DEN_CNT_STRUC, *PMPDU_DEN_CNT_STRUC;
1585 // TXRX control registers - base address 0x3000
1587 // rt2860b UNKNOWN reg use R/O Reg Addr 0x77d0 first..
1588 #define TXRX_CSR1 0x77d0
1591 // Security key table memory, base address = 0x1000
1593 #define MAC_WCID_BASE 0x1800 //8-bytes(use only 6-bytes) * 256 entry =
1594 #define HW_WCID_ENTRY_SIZE 8
1595 #define PAIRWISE_KEY_TABLE_BASE 0x4000 // 32-byte * 256-entry = -byte
1596 #define HW_KEY_ENTRY_SIZE 0x20
1597 #define PAIRWISE_IVEIV_TABLE_BASE 0x6000 // 8-byte * 256-entry = -byte
1598 #define MAC_IVEIV_TABLE_BASE 0x6000 // 8-byte * 256-entry = -byte
1599 #define HW_IVEIV_ENTRY_SIZE 8
1600 #define MAC_WCID_ATTRIBUTE_BASE 0x6800 // 4-byte * 256-entry = -byte
1601 #define HW_WCID_ATTRI_SIZE 4
1602 #define WCID_RESERVED 0x6bfc
1603 #define SHARED_KEY_TABLE_BASE 0x6c00 // 32-byte * 16-entry = 512-byte
1604 #define SHARED_KEY_MODE_BASE 0x7000 // 32-byte * 16-entry = 512-byte
1605 #define HW_SHARED_KEY_MODE_SIZE 4
1606 #define SHAREDKEYTABLE 0
1607 #define PAIRWISEKEYTABLE 1
1610 #ifdef RT_BIG_ENDIAN
1611 typedef union _SHAREDKEY_MODE_STRUC {
1614 UINT32 Bss1Key3CipherAlg:3;
1616 UINT32 Bss1Key2CipherAlg:3;
1618 UINT32 Bss1Key1CipherAlg:3;
1620 UINT32 Bss1Key0CipherAlg:3;
1622 UINT32 Bss0Key3CipherAlg:3;
1624 UINT32 Bss0Key2CipherAlg:3;
1626 UINT32 Bss0Key1CipherAlg:3;
1628 UINT32 Bss0Key0CipherAlg:3;
1631 } SHAREDKEY_MODE_STRUC, *PSHAREDKEY_MODE_STRUC;
1633 typedef union _SHAREDKEY_MODE_STRUC {
1635 UINT32 Bss0Key0CipherAlg:3;
1637 UINT32 Bss0Key1CipherAlg:3;
1639 UINT32 Bss0Key2CipherAlg:3;
1641 UINT32 Bss0Key3CipherAlg:3;
1643 UINT32 Bss1Key0CipherAlg:3;
1645 UINT32 Bss1Key1CipherAlg:3;
1647 UINT32 Bss1Key2CipherAlg:3;
1649 UINT32 Bss1Key3CipherAlg:3;
1653 } SHAREDKEY_MODE_STRUC, *PSHAREDKEY_MODE_STRUC;
1655 // 64-entry for pairwise key table
1656 typedef struct _HW_WCID_ENTRY { // 8-byte per entry
1659 } HW_WCID_ENTRY, PHW_WCID_ENTRY;
1664 // Other on-chip shared memory space, base = 0x2000
1667 // CIS space - base address = 0x2000
1668 #define HW_CIS_BASE 0x2000
1670 // Carrier-sense CTS frame base address. It's where mac stores carrier-sense frame for carrier-sense function.
1671 #define HW_CS_CTS_BASE 0x7700
1672 // DFS CTS frame base address. It's where mac stores CTS frame for DFS.
1673 #define HW_DFS_CTS_BASE 0x7780
1674 #define HW_CTS_FRAME_SIZE 0x80
1676 // 2004-11-08 john - since NULL frame won't be that long (256 byte). We steal 16 tail bytes
1677 // to save debugging settings
1678 #define HW_DEBUG_SETTING_BASE 0x77f0 // 0x77f0~0x77ff total 16 bytes
1679 #define HW_DEBUG_SETTING_BASE2 0x7770 // 0x77f0~0x77ff total 16 bytes
1681 // In order to support maximum 8 MBSS and its maximum length is 512 for each beacon
1682 // Three section discontinue memory segments will be used.
1683 // 1. The original region for BCN 0~3
1684 // 2. Extract memory from FCE table for BCN 4~5
1685 // 3. Extract memory from Pair-wise key table for BCN 6~7
1686 // It occupied those memory of wcid 238~253 for BCN 6
1687 // and wcid 222~237 for BCN 7
1688 #define HW_BEACON_MAX_SIZE 0x1000 /* unit: byte */
1689 #define HW_BEACON_BASE0 0x7800
1690 #define HW_BEACON_BASE1 0x7A00
1691 #define HW_BEACON_BASE2 0x7C00
1692 #define HW_BEACON_BASE3 0x7E00
1693 #define HW_BEACON_BASE4 0x7200
1694 #define HW_BEACON_BASE5 0x7400
1695 #define HW_BEACON_BASE6 0x5DC0
1696 #define HW_BEACON_BASE7 0x5BC0
1698 #define HW_BEACON_MAX_COUNT 8
1699 #define HW_BEACON_OFFSET 0x0200
1700 #define HW_BEACON_CONTENT_LEN (HW_BEACON_OFFSET - TXWI_SIZE)
1702 // HOST-MCU shared memory - base address = 0x2100
1703 #define HOST_CMD_CSR 0x404
1704 #define H2M_MAILBOX_CSR 0x7010
1705 #define H2M_MAILBOX_CID 0x7014
1706 #define H2M_MAILBOX_STATUS 0x701c
1707 #define H2M_INT_SRC 0x7024
1708 #define H2M_BBP_AGENT 0x7028
1709 #define M2H_CMD_DONE_CSR 0x000c
1710 #define MCU_TXOP_ARRAY_BASE 0x000c // TODO: to be provided by Albert
1711 #define MCU_TXOP_ENTRY_SIZE 32 // TODO: to be provided by Albert
1712 #define MAX_NUM_OF_TXOP_ENTRY 16 // TODO: must be same with 8051 firmware
1713 #define MCU_MBOX_VERSION 0x01 // TODO: to be confirmed by Albert
1714 #define MCU_MBOX_VERSION_OFFSET 5 // TODO: to be provided by Albert
1717 // Host DMA registers - base address 0x200 . TX0-3=EDCAQid0-3, TX4=HCCA, TX5=MGMT,
1720 // DMA RING DESCRIPTOR
1722 #define E2PROM_CSR 0x0004
1723 #define IO_CNTL_CSR 0x77d0
1726 // 8051 firmware image for usb - use last-half base address = 0x3000
1727 #define FIRMWARE_IMAGE_BASE 0x3000
1728 #define MAX_FIRMWARE_IMAGE_SIZE 0x1000 // 4kbyte
1731 // TODO: ????? old RT2560 registers. to keep them or remove them?
1732 //#define MCAST0 0x0178 // multicast filter register 0
1733 //#define MCAST1 0x017c // multicast filter register 1
1736 // ================================================================
1737 // Tx / Rx / Mgmt ring descriptor definition
1738 // ================================================================
1740 // the following PID values are used to mark outgoing frame type in TXD->PID so that
1741 // proper TX statistics can be collected based on these categories
1742 // b3-2 of PID field -
1743 #define PID_MGMT 0x05
1744 #define PID_BEACON 0x0c
1745 #define PID_DATA_NORMALUCAST 0x02
1746 #define PID_DATA_AMPDU 0x04
1747 #define PID_DATA_NO_ACK 0x08
1748 #define PID_DATA_NOT_NORM_ACK 0x03
1749 // value domain of pTxD->HostQId (4-bit: 0~15)
1750 #define QID_AC_BK 1 // meet ACI definition in 802.11e
1751 #define QID_AC_BE 0 // meet ACI definition in 802.11e
1755 #define NUM_OF_TX_RING 5
1758 #define QID_OTHER 15
1761 // ------------------------------------------------------
1762 // BBP & RF definition
1763 // ------------------------------------------------------
1800 #define BBP_R0 0 // version
1801 #define BBP_R1 1 // TSSI
1802 #define BBP_R2 2 // TX configure
1807 #define BBP_R14 14 // RX configure
1809 #define BBP_R17 17 // RX sensibility
1816 #define BBP_R49 49 //TSSI
1821 #define BBP_R62 62 // Rx SQ0 Threshold HIGH
1829 #define BBP_R70 70 // Rx AGC SQ CCK Xcorr threshold
1842 #define BBP_R94 94 // Tx Gain Control
1843 #define BBP_R103 103
1844 #define BBP_R105 105
1845 #define BBP_R113 113
1846 #define BBP_R114 114
1847 #define BBP_R115 115
1848 #define BBP_R116 116
1849 #define BBP_R117 117
1850 #define BBP_R118 118
1851 #define BBP_R119 119
1852 #define BBP_R120 120
1853 #define BBP_R121 121
1854 #define BBP_R122 122
1855 #define BBP_R123 123
1857 #define BBP_R138 138 // add by johnli, RF power sequence setup, ADC dynamic on/off control
1861 #define BBPR94_DEFAULT 0x06 // Add 1 value will gain 1db
1863 //#define PHY_TR_SWITCH_TIME 5 // usec
1865 //#define BBP_R17_LOW_SENSIBILITY 0x50
1866 //#define BBP_R17_MID_SENSIBILITY 0x41
1867 //#define BBP_R17_DYNAMIC_UP_BOUND 0x40
1868 #define RSSI_FOR_VERY_LOW_SENSIBILITY -35
1869 #define RSSI_FOR_LOW_SENSIBILITY -58
1870 #define RSSI_FOR_MID_LOW_SENSIBILITY -80
1871 #define RSSI_FOR_MID_SENSIBILITY -90
1873 //-------------------------------------------------------------------------
1874 // EEPROM definition
1875 //-------------------------------------------------------------------------
1882 #define EEPROM_WRITE_OPCODE 0x05
1883 #define EEPROM_READ_OPCODE 0x06
1884 #define EEPROM_EWDS_OPCODE 0x10
1885 #define EEPROM_EWEN_OPCODE 0x13
1887 #define NUM_EEPROM_BBP_PARMS 19 // Include NIC Config 0, 1, CR, TX ALC step, BBPs
1888 #define NUM_EEPROM_TX_G_PARMS 7
1889 #define EEPROM_NIC1_OFFSET 0x34 // The address is from NIC config 0, not BBP register ID
1890 #define EEPROM_NIC2_OFFSET 0x36 // The address is from NIC config 0, not BBP register ID
1891 #define EEPROM_BBP_BASE_OFFSET 0xf0 // The address is from NIC config 0, not BBP register ID
1892 #define EEPROM_G_TX_PWR_OFFSET 0x52
1893 #define EEPROM_G_TX2_PWR_OFFSET 0x60
1894 #define EEPROM_LED1_OFFSET 0x3c
1895 #define EEPROM_LED2_OFFSET 0x3e
1896 #define EEPROM_LED3_OFFSET 0x40
1897 #define EEPROM_LNA_OFFSET 0x44
1898 #define EEPROM_RSSI_BG_OFFSET 0x46
1899 #define EEPROM_RSSI_A_OFFSET 0x4a
1900 #define EEPROM_DEFINE_MAX_TXPWR 0x4e
1901 #define EEPROM_TXPOWER_BYRATE_20MHZ_2_4G 0xde // 20MHZ 2.4G tx power.
1902 #define EEPROM_TXPOWER_BYRATE_40MHZ_2_4G 0xee // 40MHZ 2.4G tx power.
1903 #define EEPROM_TXPOWER_BYRATE_20MHZ_5G 0xfa // 20MHZ 5G tx power.
1904 #define EEPROM_TXPOWER_BYRATE_40MHZ_5G 0x10a // 40MHZ 5G tx power.
1905 #define EEPROM_A_TX_PWR_OFFSET 0x78
1906 #define EEPROM_A_TX2_PWR_OFFSET 0xa6
1907 //#define EEPROM_Japan_TX_PWR_OFFSET 0x90 // 802.11j
1908 //#define EEPROM_Japan_TX2_PWR_OFFSET 0xbe
1909 //#define EEPROM_TSSI_REF_OFFSET 0x54
1910 //#define EEPROM_TSSI_DELTA_OFFSET 0x24
1911 //#define EEPROM_CCK_TX_PWR_OFFSET 0x62
1912 //#define EEPROM_CALIBRATE_OFFSET 0x7c
1913 #define EEPROM_VERSION_OFFSET 0x02
1914 #define EEPROM_FREQ_OFFSET 0x3a
1915 #define EEPROM_TXPOWER_BYRATE 0xde // 20MHZ power.
1916 #define EEPROM_TXPOWER_DELTA 0x50 // 20MHZ AND 40 MHZ use different power. This is delta in 40MHZ.
1917 #define VALID_EEPROM_VERSION 1
1919 // PairKeyMode definition
1920 #define PKMODE_NONE 0
1921 #define PKMODE_WEP64 1
1922 #define PKMODE_WEP128 2
1923 #define PKMODE_TKIP 3
1924 #define PKMODE_AES 4
1925 #define PKMODE_CKIP64 5
1926 #define PKMODE_CKIP128 6
1927 #define PKMODE_TKIP_NO_MIC 7 // MIC appended by driver: not a valid value in hardware key table
1929 // =================================================================================
1931 // =================================================================================
1932 //7.1 WCID ENTRY format : 8bytes
1933 typedef struct _WCID_ENTRY_STRUC {
1934 UCHAR RXBABitmap7; // bit0 for TID8, bit7 for TID 15
1935 UCHAR RXBABitmap0; // bit0 for TID0, bit7 for TID 7
1936 UCHAR MAC[6]; // 0 for shared key table. 1 for pairwise key table
1937 } WCID_ENTRY_STRUC, *PWCID_ENTRY_STRUC;
1939 //8.1.1 SECURITY KEY format : 8DW
1940 // 32-byte per entry, total 16-entry for shared key table, 64-entry for pairwise key table
1941 typedef struct _HW_KEY_ENTRY { // 32-byte per entry
1945 } HW_KEY_ENTRY, *PHW_KEY_ENTRY;
1947 //8.1.2 IV/EIV format : 2DW
1949 //8.1.3 RX attribute entry format : 1DW
1950 #ifdef RT_BIG_ENDIAN
1951 typedef struct _MAC_ATTRIBUTE_STRUC {
1954 UINT32 BSSIDIdx:3; //multipleBSS index for the WCID
1955 UINT32 PairKeyMode:3;
1956 UINT32 KeyTab:1; // 0 for shared key table. 1 for pairwise key table
1957 } MAC_ATTRIBUTE_STRUC, *PMAC_ATTRIBUTE_STRUC;
1959 typedef struct _MAC_ATTRIBUTE_STRUC {
1960 UINT32 KeyTab:1; // 0 for shared key table. 1 for pairwise key table
1961 UINT32 PairKeyMode:3;
1962 UINT32 BSSIDIdx:3; //multipleBSS index for the WCID
1965 } MAC_ATTRIBUTE_STRUC, *PMAC_ATTRIBUTE_STRUC;
1969 // =================================================================================
1970 // TX / RX ring descriptor format
1971 // =================================================================================
1973 // the first 24-byte in TXD is called TXINFO and will be DMAed to MAC block through TXFIFO.
1974 // MAC block use this TXINFO to control the transmission behavior of this frame.
1980 // TX descriptor format, Tx ring, Mgmt Ring
1982 #ifdef RT_BIG_ENDIAN
1983 typedef struct PACKED _TXD_STRUC {
2000 UINT32 QSEL:2; // select on-chip FIFO ID for 2nd-stage output scheduler.0:MGMT, 1:HCCA 2:EDCA
2001 UINT32 WIV:1; // Wireless Info Valid. 1 if Driver already fill WI, o if DMA needs to copy WI to correctposition
2003 } TXD_STRUC, *PTXD_STRUC;
2005 typedef struct PACKED _TXD_STRUC {
2019 UINT32 WIV:1; // Wireless Info Valid. 1 if Driver already fill WI, o if DMA needs to copy WI to correctposition
2020 UINT32 QSEL:2; // select on-chip FIFO ID for 2nd-stage output scheduler.0:MGMT, 1:HCCA 2:EDCA
2025 } TXD_STRUC, *PTXD_STRUC;
2030 // TXD Wireless Information format for Tx ring and Mgmt Ring
2032 //txop : for txop mode
2033 // 0:txop for the MPDU frame will be handles by ASIC by register
2034 // 1/2/3:the MPDU frame is send after PIFS/backoff/SIFS
2035 #ifdef RT_BIG_ENDIAN
2036 typedef struct PACKED _TXWI_STRUC {
2039 UINT32 TxBF:1; // 3*3
2043 UINT32 STBC:2; //channel bandwidth 20MHz or 40 MHz
2045 UINT32 BW:1; //channel bandwidth 20MHz or 40 MHz
2049 UINT32 txop:2; //tx back off mode 0:HT TXOP rule , 1:PIFS TX ,2:Backoff, 3:sifs only when previous frame exchange is successful.
2050 UINT32 MpduDensity:3;
2055 UINT32 MIMOps:1; // the remote peer is in dynamic MIMO-PS mode
2056 UINT32 FRAG:1; // 1 to inform TKIP engine this is a fragment.
2059 UINT32 MPDUtotalByteCount:12;
2060 UINT32 WirelessCliID:8;
2068 } TXWI_STRUC, *PTXWI_STRUC;
2070 typedef struct PACKED _TXWI_STRUC {
2072 UINT32 FRAG:1; // 1 to inform TKIP engine this is a fragment.
2073 UINT32 MIMOps:1; // the remote peer is in dynamic MIMO-PS mode
2078 UINT32 MpduDensity:3;
2079 UINT32 txop:2; //FOR "THIS" frame. 0:HT TXOP rule , 1:PIFS TX ,2:Backoff, 3:sifs only when previous frame exchange is successful.
2083 UINT32 BW:1; //channel bandwidth 20MHz or 40 MHz
2085 UINT32 STBC:2; // 1: STBC support MCS =0-7, 2,3 : RESERVE
2087 // UINT32 rsv2:2; //channel bandwidth 20MHz or 40 MHz
2089 UINT32 TxBF:1; // 3*3
2095 UINT32 WirelessCliID:8;
2096 UINT32 MPDUtotalByteCount:12;
2102 } TXWI_STRUC, *PTXWI_STRUC;
2105 // Rx descriptor format, Rx Ring
2108 // RXWI wireless information format, in PBF. invisible in driver.
2110 #ifdef RT_BIG_ENDIAN
2111 typedef struct PACKED _RXWI_STRUC {
2114 UINT32 MPDUtotalByteCount:12;
2118 UINT32 WirelessCliID:8;
2120 UINT32 PHYMODE:2; // 1: this RX frame is unicast to me
2137 } RXWI_STRUC, *PRXWI_STRUC;
2139 typedef struct PACKED _RXWI_STRUC {
2141 UINT32 WirelessCliID:8;
2145 UINT32 MPDUtotalByteCount:12;
2155 UINT32 PHYMODE:2; // 1: this RX frame is unicast to me
2165 } RXWI_STRUC, *PRXWI_STRUC;
2169 // =================================================================================
2170 // HOST-MCU communication data structure
2171 // =================================================================================
2174 // H2M_MAILBOX_CSR: Host-to-MCU Mailbox
2176 #ifdef RT_BIG_ENDIAN
2177 typedef union _H2M_MAILBOX_STRUC {
2180 UINT32 CmdToken:8; // 0xff tells MCU not to report CmdDoneInt after excuting the command
2185 } H2M_MAILBOX_STRUC, *PH2M_MAILBOX_STRUC;
2187 typedef union _H2M_MAILBOX_STRUC {
2195 } H2M_MAILBOX_STRUC, *PH2M_MAILBOX_STRUC;
2199 // M2H_CMD_DONE_CSR: MCU-to-Host command complete indication
2201 #ifdef RT_BIG_ENDIAN
2202 typedef union _M2H_CMD_DONE_STRUC {
2210 } M2H_CMD_DONE_STRUC, *PM2H_CMD_DONE_STRUC;
2212 typedef union _M2H_CMD_DONE_STRUC {
2220 } M2H_CMD_DONE_STRUC, *PM2H_CMD_DONE_STRUC;
2226 // MCU_LEDCS: MCU LED Control Setting.
2228 #ifdef RT_BIG_ENDIAN
2229 typedef union _MCU_LEDCS_STRUC {
2235 } MCU_LEDCS_STRUC, *PMCU_LEDCS_STRUC;
2237 typedef union _MCU_LEDCS_STRUC {
2243 } MCU_LEDCS_STRUC, *PMCU_LEDCS_STRUC;
2245 // =================================================================================
2247 // =================================================================================
2252 #ifdef RT_BIG_ENDIAN
2253 typedef union _NAV_TIME_CFG_STRUC {
2256 USHORT ZeroSifs:1; // Applied zero SIFS timer after OFDM RX 0: disable
2257 USHORT Eifs:9; // in unit of 1-us
2258 UCHAR SlotTime; // in unit of 1-us
2259 UCHAR Sifs; // in unit of 1-us
2262 } NAV_TIME_CFG_STRUC, *PNAV_TIME_CFG_STRUC;
2264 typedef union _NAV_TIME_CFG_STRUC {
2266 UCHAR Sifs; // in unit of 1-us
2267 UCHAR SlotTime; // in unit of 1-us
2268 USHORT Eifs:9; // in unit of 1-us
2269 USHORT ZeroSifs:1; // Applied zero SIFS timer after OFDM RX 0: disable
2273 } NAV_TIME_CFG_STRUC, *PNAV_TIME_CFG_STRUC;
2281 // RX_FILTR_CFG: /RX configuration register
2283 #ifdef RT_BIG_ENDIAN
2284 typedef union RX_FILTR_CFG_STRUC {
2287 UINT32 DropRsvCntlType:1;
2289 UINT32 DropBAR:1; //
2291 UINT32 DropPsPoll:1; // Drop Ps-Poll
2292 UINT32 DropRts:1; // Drop Ps-Poll
2294 UINT32 DropCts:1; // Drop Ps-Poll
2295 UINT32 DropAck:1; // Drop Ps-Poll
2296 UINT32 DropCFEnd:1; // Drop Ps-Poll
2297 UINT32 DropCFEndAck:1; // Drop Ps-Poll
2299 UINT32 DropDuplicate:1; // Drop duplicate frame
2300 UINT32 DropBcast:1; // Drop broadcast frames
2301 UINT32 DropMcast:1; // Drop multicast frames
2302 UINT32 DropVerErr:1; // Drop version error frame
2304 UINT32 DropNotMyBSSID:1; // Drop fram ToDs bit is true
2305 UINT32 DropNotToMe:1; // Drop not to me unicast frame
2306 UINT32 DropPhyErr:1; // Drop physical error
2307 UINT32 DropCRCErr:1; // Drop CRC error
2310 } RX_FILTR_CFG_STRUC, *PRX_FILTR_CFG_STRUC;
2312 typedef union _RX_FILTR_CFG_STRUC {
2314 UINT32 DropCRCErr:1; // Drop CRC error
2315 UINT32 DropPhyErr:1; // Drop physical error
2316 UINT32 DropNotToMe:1; // Drop not to me unicast frame
2317 UINT32 DropNotMyBSSID:1; // Drop fram ToDs bit is true
2319 UINT32 DropVerErr:1; // Drop version error frame
2320 UINT32 DropMcast:1; // Drop multicast frames
2321 UINT32 DropBcast:1; // Drop broadcast frames
2322 UINT32 DropDuplicate:1; // Drop duplicate frame
2324 UINT32 DropCFEndAck:1; // Drop Ps-Poll
2325 UINT32 DropCFEnd:1; // Drop Ps-Poll
2326 UINT32 DropAck:1; // Drop Ps-Poll
2327 UINT32 DropCts:1; // Drop Ps-Poll
2329 UINT32 DropRts:1; // Drop Ps-Poll
2330 UINT32 DropPsPoll:1; // Drop Ps-Poll
2332 UINT32 DropBAR:1; //
2334 UINT32 DropRsvCntlType:1;
2338 } RX_FILTR_CFG_STRUC, *PRX_FILTR_CFG_STRUC;
2345 // PHY_CSR4: RF serial control register
2347 #ifdef RT_BIG_ENDIAN
2348 typedef union _PHY_CSR4_STRUC {
2350 UINT32 Busy:1; // 1: ASIC is busy execute RF programming.
2351 UINT32 PLL_LD:1; // RF PLL_LD status
2352 UINT32 IFSelect:1; // 1: select IF to program, 0: select RF to program
2353 UINT32 NumberOfBits:5; // Number of bits used in RFRegValue (I:20, RFMD:22)
2354 UINT32 RFRegValue:24; // Register value (include register id) serial out to RF/IF chip.
2357 } PHY_CSR4_STRUC, *PPHY_CSR4_STRUC;
2359 typedef union _PHY_CSR4_STRUC {
2361 UINT32 RFRegValue:24; // Register value (include register id) serial out to RF/IF chip.
2362 UINT32 NumberOfBits:5; // Number of bits used in RFRegValue (I:20, RFMD:22)
2363 UINT32 IFSelect:1; // 1: select IF to program, 0: select RF to program
2364 UINT32 PLL_LD:1; // RF PLL_LD status
2365 UINT32 Busy:1; // 1: ASIC is busy execute RF programming.
2368 } PHY_CSR4_STRUC, *PPHY_CSR4_STRUC;
2373 // SEC_CSR5: shared key table security mode register
2375 #ifdef RT_BIG_ENDIAN
2376 typedef union _SEC_CSR5_STRUC {
2379 UINT32 Bss3Key3CipherAlg:3;
2381 UINT32 Bss3Key2CipherAlg:3;
2383 UINT32 Bss3Key1CipherAlg:3;
2385 UINT32 Bss3Key0CipherAlg:3;
2387 UINT32 Bss2Key3CipherAlg:3;
2389 UINT32 Bss2Key2CipherAlg:3;
2391 UINT32 Bss2Key1CipherAlg:3;
2393 UINT32 Bss2Key0CipherAlg:3;
2396 } SEC_CSR5_STRUC, *PSEC_CSR5_STRUC;
2398 typedef union _SEC_CSR5_STRUC {
2400 UINT32 Bss2Key0CipherAlg:3;
2402 UINT32 Bss2Key1CipherAlg:3;
2404 UINT32 Bss2Key2CipherAlg:3;
2406 UINT32 Bss2Key3CipherAlg:3;
2408 UINT32 Bss3Key0CipherAlg:3;
2410 UINT32 Bss3Key1CipherAlg:3;
2412 UINT32 Bss3Key2CipherAlg:3;
2414 UINT32 Bss3Key3CipherAlg:3;
2418 } SEC_CSR5_STRUC, *PSEC_CSR5_STRUC;
2423 // HOST_CMD_CSR: For HOST to interrupt embedded processor
2425 #ifdef RT_BIG_ENDIAN
2426 typedef union _HOST_CMD_CSR_STRUC {
2429 UINT32 HostCommand:8;
2432 } HOST_CMD_CSR_STRUC, *PHOST_CMD_CSR_STRUC;
2434 typedef union _HOST_CMD_CSR_STRUC {
2436 UINT32 HostCommand:8;
2440 } HOST_CMD_CSR_STRUC, *PHOST_CMD_CSR_STRUC;
2445 // AIFSN_CSR: AIFSN for each EDCA AC
2451 // E2PROM_CSR: EEPROM control register
2453 #ifdef RT_BIG_ENDIAN
2454 typedef union _E2PROM_CSR_STRUC {
2457 UINT32 LoadStatus:1; // 1:loading, 0:done
2458 UINT32 Type:1; // 1: 93C46, 0:93C66
2463 UINT32 Reload:1; // Reload EEPROM content, write one to reload, self-cleared.
2466 } E2PROM_CSR_STRUC, *PE2PROM_CSR_STRUC;
2468 typedef union _E2PROM_CSR_STRUC {
2470 UINT32 Reload:1; // Reload EEPROM content, write one to reload, self-cleared.
2475 UINT32 Type:1; // 1: 93C46, 0:93C66
2476 UINT32 LoadStatus:1; // 1:loading, 0:done
2480 } E2PROM_CSR_STRUC, *PE2PROM_CSR_STRUC;
2484 // -------------------------------------------------------------------
2485 // E2PROM data layout
2486 // -------------------------------------------------------------------
2489 // EEPROM antenna select format
2491 #ifdef RT_BIG_ENDIAN
2492 typedef union _EEPROM_ANTENNA_STRUC {
2495 USHORT RfIcType:4; // see E2PROM document
2496 USHORT TxPath:4; // 1: 1T, 2: 2T
2497 USHORT RxPath:4; // 1: 1R, 2: 2R, 3: 3R
2500 } EEPROM_ANTENNA_STRUC, *PEEPROM_ANTENNA_STRUC;
2502 typedef union _EEPROM_ANTENNA_STRUC {
2504 USHORT RxPath:4; // 1: 1R, 2: 2R, 3: 3R
2505 USHORT TxPath:4; // 1: 1T, 2: 2T
2506 USHORT RfIcType:4; // see E2PROM document
2510 } EEPROM_ANTENNA_STRUC, *PEEPROM_ANTENNA_STRUC;
2513 #ifdef RT_BIG_ENDIAN
2514 typedef union _EEPROM_NIC_CINFIG2_STRUC {
2516 USHORT DACTestBit:1; // control if driver should patch the DAC issue
2517 USHORT Rsv2:3; // must be 0
2518 USHORT AntDiversity:1; // Antenna diversity
2519 USHORT Rsv1:1; // must be 0
2520 USHORT BW40MAvailForA:1; // 0:enable, 1:disable
2521 USHORT BW40MAvailForG:1; // 0:enable, 1:disable
2522 USHORT EnableWPSPBC:1; // WPS PBC Control bit
2523 USHORT BW40MSidebandForA:1;
2524 USHORT BW40MSidebandForG:1;
2525 USHORT CardbusAcceleration:1; // !!! NOTE: 0 - enable, 1 - disable
2526 USHORT ExternalLNAForA:1; // external LNA enable for 5G
2527 USHORT ExternalLNAForG:1; // external LNA enable for 2.4G
2528 USHORT DynamicTxAgcControl:1; //
2529 USHORT HardwareRadioControl:1; // Whether RF is controlled by driver or HW. 1:enable hw control, 0:disable
2532 } EEPROM_NIC_CONFIG2_STRUC, *PEEPROM_NIC_CONFIG2_STRUC;
2534 typedef union _EEPROM_NIC_CINFIG2_STRUC {
2536 USHORT HardwareRadioControl:1; // 1:enable, 0:disable
2537 USHORT DynamicTxAgcControl:1; //
2538 USHORT ExternalLNAForG:1; //
2539 USHORT ExternalLNAForA:1; // external LNA enable for 2.4G
2540 USHORT CardbusAcceleration:1; // !!! NOTE: 0 - enable, 1 - disable
2541 USHORT BW40MSidebandForG:1;
2542 USHORT BW40MSidebandForA:1;
2543 USHORT EnableWPSPBC:1; // WPS PBC Control bit
2544 USHORT BW40MAvailForG:1; // 0:enable, 1:disable
2545 USHORT BW40MAvailForA:1; // 0:enable, 1:disable
2546 USHORT Rsv1:1; // must be 0
2547 USHORT AntDiversity:1; // Antenna diversity
2548 USHORT Rsv2:3; // must be 0
2549 USHORT DACTestBit:1; // control if driver should patch the DAC issue
2552 } EEPROM_NIC_CONFIG2_STRUC, *PEEPROM_NIC_CONFIG2_STRUC;
2556 // TX_PWR Value valid range 0xFA(-6) ~ 0x24(36)
2558 #ifdef RT_BIG_ENDIAN
2559 typedef union _EEPROM_TX_PWR_STRUC {
2561 CHAR Byte1; // High Byte
2562 CHAR Byte0; // Low Byte
2565 } EEPROM_TX_PWR_STRUC, *PEEPROM_TX_PWR_STRUC;
2567 typedef union _EEPROM_TX_PWR_STRUC {
2569 CHAR Byte0; // Low Byte
2570 CHAR Byte1; // High Byte
2573 } EEPROM_TX_PWR_STRUC, *PEEPROM_TX_PWR_STRUC;
2576 #ifdef RT_BIG_ENDIAN
2577 typedef union _EEPROM_VERSION_STRUC {
2579 UCHAR Version; // High Byte
2580 UCHAR FaeReleaseNumber; // Low Byte
2583 } EEPROM_VERSION_STRUC, *PEEPROM_VERSION_STRUC;
2585 typedef union _EEPROM_VERSION_STRUC {
2587 UCHAR FaeReleaseNumber; // Low Byte
2588 UCHAR Version; // High Byte
2591 } EEPROM_VERSION_STRUC, *PEEPROM_VERSION_STRUC;
2594 #ifdef RT_BIG_ENDIAN
2595 typedef union _EEPROM_LED_STRUC {
2597 USHORT Rsvd:3; // Reserved
2598 USHORT LedMode:5; // Led mode.
2599 USHORT PolarityGPIO_4:1; // Polarity GPIO#4 setting.
2600 USHORT PolarityGPIO_3:1; // Polarity GPIO#3 setting.
2601 USHORT PolarityGPIO_2:1; // Polarity GPIO#2 setting.
2602 USHORT PolarityGPIO_1:1; // Polarity GPIO#1 setting.
2603 USHORT PolarityGPIO_0:1; // Polarity GPIO#0 setting.
2604 USHORT PolarityACT:1; // Polarity ACT setting.
2605 USHORT PolarityRDY_A:1; // Polarity RDY_A setting.
2606 USHORT PolarityRDY_G:1; // Polarity RDY_G setting.
2609 } EEPROM_LED_STRUC, *PEEPROM_LED_STRUC;
2611 typedef union _EEPROM_LED_STRUC {
2613 USHORT PolarityRDY_G:1; // Polarity RDY_G setting.
2614 USHORT PolarityRDY_A:1; // Polarity RDY_A setting.
2615 USHORT PolarityACT:1; // Polarity ACT setting.
2616 USHORT PolarityGPIO_0:1; // Polarity GPIO#0 setting.
2617 USHORT PolarityGPIO_1:1; // Polarity GPIO#1 setting.
2618 USHORT PolarityGPIO_2:1; // Polarity GPIO#2 setting.
2619 USHORT PolarityGPIO_3:1; // Polarity GPIO#3 setting.
2620 USHORT PolarityGPIO_4:1; // Polarity GPIO#4 setting.
2621 USHORT LedMode:5; // Led mode.
2622 USHORT Rsvd:3; // Reserved
2625 } EEPROM_LED_STRUC, *PEEPROM_LED_STRUC;
2628 #ifdef RT_BIG_ENDIAN
2629 typedef union _EEPROM_TXPOWER_DELTA_STRUC {
2631 UCHAR TxPowerEnable:1;// Enable
2632 UCHAR Type:1; // 1: plus the delta value, 0: minus the delta value
2633 UCHAR DeltaValue:6; // Tx Power dalta value (MAX=4)
2636 } EEPROM_TXPOWER_DELTA_STRUC, *PEEPROM_TXPOWER_DELTA_STRUC;
2638 typedef union _EEPROM_TXPOWER_DELTA_STRUC {
2640 UCHAR DeltaValue:6; // Tx Power dalta value (MAX=4)
2641 UCHAR Type:1; // 1: plus the delta value, 0: minus the delta value
2642 UCHAR TxPowerEnable:1;// Enable
2645 } EEPROM_TXPOWER_DELTA_STRUC, *PEEPROM_TXPOWER_DELTA_STRUC;
2649 // QOS_CSR0: TXOP holder address0 register
2651 #ifdef RT_BIG_ENDIAN
2652 typedef union _QOS_CSR0_STRUC {
2654 UCHAR Byte3; // MAC address byte 3
2655 UCHAR Byte2; // MAC address byte 2
2656 UCHAR Byte1; // MAC address byte 1
2657 UCHAR Byte0; // MAC address byte 0
2660 } QOS_CSR0_STRUC, *PQOS_CSR0_STRUC;
2662 typedef union _QOS_CSR0_STRUC {
2664 UCHAR Byte0; // MAC address byte 0
2665 UCHAR Byte1; // MAC address byte 1
2666 UCHAR Byte2; // MAC address byte 2
2667 UCHAR Byte3; // MAC address byte 3
2670 } QOS_CSR0_STRUC, *PQOS_CSR0_STRUC;
2674 // QOS_CSR1: TXOP holder address1 register
2676 #ifdef RT_BIG_ENDIAN
2677 typedef union _QOS_CSR1_STRUC {
2681 UCHAR Byte5; // MAC address byte 5
2682 UCHAR Byte4; // MAC address byte 4
2685 } QOS_CSR1_STRUC, *PQOS_CSR1_STRUC;
2687 typedef union _QOS_CSR1_STRUC {
2689 UCHAR Byte4; // MAC address byte 4
2690 UCHAR Byte5; // MAC address byte 5
2695 } QOS_CSR1_STRUC, *PQOS_CSR1_STRUC;
2698 #define RF_CSR_CFG 0x500
2699 #ifdef RT_BIG_ENDIAN
2700 typedef union _RF_CSR_CFG_STRUC {
2702 UINT Rsvd1:14; // Reserved
2703 UINT RF_CSR_KICK:1; // kick RF register read/write
2704 UINT RF_CSR_WR:1; // 0: read 1: write
2705 UINT Rsvd2:3; // Reserved
2706 UINT TESTCSR_RFACC_REGNUM:5; // RF register ID
2707 UINT RF_CSR_DATA:8; // DATA
2710 } RF_CSR_CFG_STRUC, *PRF_CSR_CFG_STRUC;
2712 typedef union _RF_CSR_CFG_STRUC {
2714 UINT RF_CSR_DATA:8; // DATA
2715 UINT TESTCSR_RFACC_REGNUM:5; // RF register ID
2716 UINT Rsvd2:3; // Reserved
2717 UINT RF_CSR_WR:1; // 0: read 1: write
2718 UINT RF_CSR_KICK:1; // kick RF register read/write
2719 UINT Rsvd1:14; // Reserved
2722 } RF_CSR_CFG_STRUC, *PRF_CSR_CFG_STRUC;
2725 #endif // __RT28XX_H__