1 /****************************************************************************** 2 * 3 * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. 4 * 5 * This program is free software; you can redistribute it and/or modify it 6 * under the terms of version 2 of the GNU General Public License as 7 * published by the Free Software Foundation. 8 * 9 * This program is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 * more details. 13 * 14 * You should have received a copy of the GNU General Public License along with 15 * this program; if not, write to the Free Software Foundation, Inc., 16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA 17 * 18 * 19 ******************************************************************************/ 20 #ifndef _RTW_MP_H_ 21 #define _RTW_MP_H_ 22 23 #define RTWPRIV_VER_INFO 1 24 25 #define MAX_MP_XMITBUF_SZ 2048 26 #define NR_MP_XMITFRAME 8 27 28 struct mp_xmit_frame { 29 _list list; 30 31 struct pkt_attrib attrib; 32 33 _pkt *pkt; 34 35 int frame_tag; 36 37 _adapter *padapter; 38 39 #ifdef CONFIG_USB_HCI 40 41 /* insert urb, irp, and irpcnt info below... */ 42 /* max frag_cnt = 8 */ 43 44 u8 *mem_addr; 45 u32 sz[8]; 46 47 #if defined(PLATFORM_OS_XP) || defined(PLATFORM_LINUX) 48 PURB pxmit_urb[8]; 49 #endif 50 51 #ifdef PLATFORM_OS_XP 52 PIRP pxmit_irp[8]; 53 #endif 54 55 u8 bpending[8]; 56 sint ac_tag[8]; 57 sint last[8]; 58 uint irpcnt; 59 uint fragcnt; 60 #endif /* CONFIG_USB_HCI */ 61 62 uint mem[(MAX_MP_XMITBUF_SZ >> 2)]; 63 }; 64 65 struct mp_wiparam { 66 u32 bcompleted; 67 u32 act_type; 68 u32 io_offset; 69 u32 io_value; 70 }; 71 72 typedef void(*wi_act_func)(void *padapter); 73 74 #ifdef PLATFORM_WINDOWS 75 struct mp_wi_cntx { 76 u8 bmpdrv_unload; 77 78 /* Work Item */ 79 NDIS_WORK_ITEM mp_wi; 80 NDIS_EVENT mp_wi_evt; 81 _lock mp_wi_lock; 82 u8 bmp_wi_progress; 83 wi_act_func curractfunc; 84 /* Variable needed in each implementation of CurrActFunc. */ 85 struct mp_wiparam param; 86 }; 87 #endif 88 89 struct mp_tx { 90 u8 stop; 91 u32 count, sended; 92 u8 payload; 93 struct pkt_attrib attrib; 94 /* struct tx_desc desc; */ 95 /* u8 resvdtx[7]; */ 96 u8 desc[TXDESC_SIZE]; 97 u8 *pallocated_buf; 98 u8 *buf; 99 u32 buf_size, write_size; 100 _thread_hdl_ PktTxThread; 101 }; 102 103 #define MP_MAX_LINES 1000 104 #define MP_MAX_LINES_BYTES 256 105 #define u1Byte u8 106 #define s1Byte s8 107 #define u4Byte u32 108 #define s4Byte s32 109 #define u1Byte u8 110 #define pu1Byte u8* 111 112 #define u2Byte u16 113 #define pu2Byte u16* 114 115 #define u4Byte u32 116 #define pu4Byte u32* 117 118 #define u8Byte u64 119 #define pu8Byte u64* 120 121 #define s1Byte s8 122 #define ps1Byte s8* 123 124 #define s2Byte s16 125 #define ps2Byte s16* 126 127 #define s4Byte s32 128 #define ps4Byte s32* 129 130 #define s8Byte s64 131 #define ps8Byte s64* 132 133 #define UCHAR u8 134 #define USHORT u16 135 #define UINT u32 136 #define ULONG u32 137 #define PULONG u32* 138 139 typedef struct _RT_PMAC_PKT_INFO { 140 UCHAR MCS; 141 UCHAR Nss; 142 UCHAR Nsts; 143 UINT N_sym; 144 UCHAR SIGA2B3; 145 } RT_PMAC_PKT_INFO, *PRT_PMAC_PKT_INFO; 146 147 typedef struct _RT_PMAC_TX_INFO { 148 u8 bEnPMacTx:1; /* 0: Disable PMac 1: Enable PMac */ 149 u8 Mode:3; /* 0: Packet TX 3:Continuous TX */ 150 u8 Ntx:4; /* 0-7 */ 151 u8 TX_RATE; /* MPT_RATE_E */ 152 u8 TX_RATE_HEX; 153 u8 TX_SC; 154 u8 bSGI:1; 155 u8 bSPreamble:1; 156 u8 bSTBC:1; 157 u8 bLDPC:1; 158 u8 NDP_sound:1; 159 u8 BandWidth:3; /* 0: 20 1:40 2:80Mhz */ 160 u8 m_STBC; /* bSTBC + 1 */ 161 USHORT PacketPeriod; 162 UINT PacketCount; 163 UINT PacketLength; 164 u8 PacketPattern; 165 USHORT SFD; 166 u8 SignalField; 167 u8 ServiceField; 168 USHORT LENGTH; 169 u8 CRC16[2]; 170 u8 LSIG[3]; 171 u8 HT_SIG[6]; 172 u8 VHT_SIG_A[6]; 173 u8 VHT_SIG_B[4]; 174 u8 VHT_SIG_B_CRC; 175 u8 VHT_Delimiter[4]; 176 u8 MacAddress[6]; 177 } RT_PMAC_TX_INFO, *PRT_PMAC_TX_INFO; 178 179 180 typedef VOID (*MPT_WORK_ITEM_HANDLER)(IN PVOID Adapter); 181 typedef struct _MPT_CONTEXT { 182 /* Indicate if we have started Mass Production Test. */ 183 BOOLEAN bMassProdTest; 184 185 /* Indicate if the driver is unloading or unloaded. */ 186 BOOLEAN bMptDrvUnload; 187 188 _sema MPh2c_Sema; 189 _timer MPh2c_timeout_timer; 190 /* Event used to sync H2c for BT control */ 191 192 BOOLEAN MptH2cRspEvent; 193 BOOLEAN MptBtC2hEvent; 194 BOOLEAN bMPh2c_timeout; 195 196 /* 8190 PCI does not support NDIS_WORK_ITEM. */ 197 /* Work Item for Mass Production Test. */ 198 /* NDIS_WORK_ITEM MptWorkItem; 199 * RT_WORK_ITEM MptWorkItem; */ 200 /* Event used to sync the case unloading driver and MptWorkItem is still in progress. 201 * NDIS_EVENT MptWorkItemEvent; */ 202 /* To protect the following variables. 203 * NDIS_SPIN_LOCK MptWorkItemSpinLock; */ 204 /* Indicate a MptWorkItem is scheduled and not yet finished. */ 205 BOOLEAN bMptWorkItemInProgress; 206 /* An instance which implements function and context of MptWorkItem. */ 207 MPT_WORK_ITEM_HANDLER CurrMptAct; 208 209 /* 1=Start, 0=Stop from UI. */ 210 ULONG MptTestStart; 211 /* _TEST_MODE, defined in MPT_Req2.h */ 212 ULONG MptTestItem; 213 /* Variable needed in each implementation of CurrMptAct. */ 214 ULONG MptActType; /* Type of action performed in CurrMptAct. */ 215 /* The Offset of IO operation is depend of MptActType. */ 216 ULONG MptIoOffset; 217 /* The Value of IO operation is depend of MptActType. */ 218 ULONG MptIoValue; 219 /* The RfPath of IO operation is depend of MptActType. */ 220 ULONG MptRfPath; 221 222 WIRELESS_MODE MptWirelessModeToSw; /* Wireless mode to switch. */ 223 u8 MptChannelToSw; /* Channel to switch. */ 224 u8 MptInitGainToSet; /* Initial gain to set. */ 225 /* ULONG bMptAntennaA; */ /* TRUE if we want to use antenna A. */ 226 ULONG MptBandWidth; /* bandwidth to switch. */ 227 ULONG MptRateIndex; /* rate index. */ 228 /* Register value kept for Single Carrier Tx test. */ 229 u8 btMpCckTxPower; 230 /* Register value kept for Single Carrier Tx test. */ 231 u8 btMpOfdmTxPower; 232 /* For MP Tx Power index */ 233 u8 TxPwrLevel[4]; /* rf-A, rf-B*/ 234 u32 RegTxPwrLimit; 235 /* Content of RCR Regsiter for Mass Production Test. */ 236 ULONG MptRCR; 237 /* TRUE if we only receive packets with specific pattern. */ 238 BOOLEAN bMptFilterPattern; 239 /* Rx OK count, statistics used in Mass Production Test. */ 240 ULONG MptRxOkCnt; 241 /* Rx CRC32 error count, statistics used in Mass Production Test. */ 242 ULONG MptRxCrcErrCnt; 243 244 BOOLEAN bCckContTx; /* TRUE if we are in CCK Continuous Tx test. */ 245 BOOLEAN bOfdmContTx; /* TRUE if we are in OFDM Continuous Tx test. */ 246 BOOLEAN bStartContTx; /* TRUE if we have start Continuous Tx test. */ 247 /* TRUE if we are in Single Carrier Tx test. */ 248 BOOLEAN bSingleCarrier; 249 /* TRUE if we are in Carrier Suppression Tx Test. */ 250 BOOLEAN bCarrierSuppression; 251 /* TRUE if we are in Single Tone Tx test. */ 252 BOOLEAN bSingleTone; 253 254 /* ACK counter asked by K.Y.. */ 255 BOOLEAN bMptEnableAckCounter; 256 ULONG MptAckCounter; 257 258 /* SD3 Willis For 8192S to save 1T/2T RF table for ACUT Only fro ACUT delete later ~~~! */ 259 /* s1Byte BufOfLines[2][MAX_LINES_HWCONFIG_TXT][MAX_BYTES_LINE_HWCONFIG_TXT]; */ 260 /* s1Byte BufOfLines[2][MP_MAX_LINES][MP_MAX_LINES_BYTES]; */ 261 /* s4Byte RfReadLine[2]; */ 262 263 u8 APK_bound[2]; /* for APK path A/path B */ 264 BOOLEAN bMptIndexEven; 265 266 u8 backup0xc50; 267 u8 backup0xc58; 268 u8 backup0xc30; 269 u8 backup0x52_RF_A; 270 u8 backup0x52_RF_B; 271 272 u4Byte backup0x58_RF_A; 273 u4Byte backup0x58_RF_B; 274 275 u1Byte h2cReqNum; 276 u1Byte c2hBuf[32]; 277 278 u1Byte btInBuf[100]; 279 ULONG mptOutLen; 280 u1Byte mptOutBuf[100]; 281 RT_PMAC_TX_INFO PMacTxInfo; 282 RT_PMAC_PKT_INFO PMacPktInfo; 283 u8 HWTxmode; 284 285 BOOLEAN bldpc; 286 BOOLEAN bstbc; 287 } MPT_CONTEXT, *PMPT_CONTEXT; 288 /* #endif */ 289 290 /* E-Fuse */ 291 #ifdef CONFIG_RTL8188E 292 #define EFUSE_MAP_SIZE 512 293 #endif 294 #if defined(CONFIG_RTL8812A) || defined(CONFIG_RTL8821A) || defined(CONFIG_RTL8814A) 295 #define EFUSE_MAP_SIZE 512 296 #endif 297 #ifdef CONFIG_RTL8192E 298 #define EFUSE_MAP_SIZE 512 299 #endif 300 #ifdef CONFIG_RTL8723B 301 #define EFUSE_MAP_SIZE 512 302 #endif 303 #ifdef CONFIG_RTL8814A 304 #define EFUSE_MAP_SIZE 512 305 #endif 306 #ifdef CONFIG_RTL8703B 307 #define EFUSE_MAP_SIZE 512 308 #endif 309 #ifdef CONFIG_RTL8723D 310 #define EFUSE_MAP_SIZE 512 311 #endif 312 #ifdef CONFIG_RTL8188F 313 #define EFUSE_MAP_SIZE 512 314 #endif 315 316 #if defined(CONFIG_RTL8814A) || defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8821C) 317 #define EFUSE_MAX_SIZE 1024 318 #elif defined(CONFIG_RTL8188E) || defined(CONFIG_RTL8188F) ||\ 319 defined(CONFIG_RTL8703B) || defined(CONFIG_RTL8723D) 320 #define EFUSE_MAX_SIZE 256 321 #else 322 #define EFUSE_MAX_SIZE 512 323 #endif 324 /* end of E-Fuse */ 325 326 /* #define RTPRIV_IOCTL_MP ( SIOCIWFIRSTPRIV + 0x17) */ 327 enum { 328 WRITE_REG = 1, 329 READ_REG, 330 WRITE_RF, 331 READ_RF, 332 MP_START, 333 MP_STOP, 334 MP_RATE, 335 MP_CHANNEL, 336 MP_BANDWIDTH, 337 MP_TXPOWER, 338 MP_ANT_TX, 339 MP_ANT_RX, 340 MP_CTX, 341 MP_QUERY, 342 MP_ARX, 343 MP_PSD, 344 MP_PWRTRK, 345 MP_THER, 346 MP_IOCTL, 347 EFUSE_GET, 348 EFUSE_SET, 349 MP_RESET_STATS, 350 MP_DUMP, 351 MP_PHYPARA, 352 MP_SetRFPathSwh, 353 MP_QueryDrvStats, 354 CTA_TEST, 355 MP_DISABLE_BT_COEXIST, 356 MP_PwrCtlDM, 357 MP_GETVER, 358 MP_MON, 359 EFUSE_MASK, 360 EFUSE_FILE, 361 MP_TX, 362 MP_RX, 363 MP_HW_TX_MODE, 364 MP_GET_TXPOWER_INX, 365 MP_NULL, 366 MP_SetBT, 367 #ifdef CONFIG_APPEND_VENDOR_IE_ENABLE 368 VENDOR_IE_SET , 369 VENDOR_IE_GET , 370 #endif 371 #ifdef CONFIG_WOWLAN 372 MP_WOW_ENABLE, 373 MP_WOW_SET_PATTERN, 374 #endif 375 #ifdef CONFIG_AP_WOWLAN 376 MP_AP_WOW_ENABLE, 377 #endif 378 MP_SD_IREAD, 379 MP_SD_IWRITE, 380 }; 381 382 struct mp_priv { 383 _adapter *papdater; 384 385 /* Testing Flag */ 386 u32 mode;/* 0 for normal type packet, 1 for loopback packet (16bytes TXCMD) */ 387 388 u32 prev_fw_state; 389 390 /* OID cmd handler */ 391 struct mp_wiparam workparam; 392 /* u8 act_in_progress; */ 393 394 /* Tx Section */ 395 u8 TID; 396 u32 tx_pktcount; 397 u32 pktInterval; 398 u32 pktLength; 399 struct mp_tx tx; 400 401 /* Rx Section */ 402 u32 rx_bssidpktcount; 403 u32 rx_pktcount; 404 u32 rx_pktcount_filter_out; 405 u32 rx_crcerrpktcount; 406 u32 rx_pktloss; 407 BOOLEAN rx_bindicatePkt; 408 struct recv_stat rxstat; 409 410 /* RF/BB relative */ 411 u8 channel; 412 u8 bandwidth; 413 u8 prime_channel_offset; 414 u8 txpoweridx; 415 u8 rateidx; 416 u32 preamble; 417 /* u8 modem; */ 418 u32 CrystalCap; 419 /* u32 curr_crystalcap; */ 420 421 u16 antenna_tx; 422 u16 antenna_rx; 423 /* u8 curr_rfpath; */ 424 425 u8 check_mp_pkt; 426 427 u8 bSetTxPower; 428 /* uint ForcedDataRate; */ 429 u8 mp_dm; 430 u8 mac_filter[ETH_ALEN]; 431 u8 bmac_filter; 432 433 struct wlan_network mp_network; 434 NDIS_802_11_MAC_ADDRESS network_macaddr; 435 436 #ifdef PLATFORM_WINDOWS 437 u32 rx_testcnt; 438 u32 rx_testcnt1; 439 u32 rx_testcnt2; 440 u32 tx_testcnt; 441 u32 tx_testcnt1; 442 443 struct mp_wi_cntx wi_cntx; 444 445 u8 h2c_result; 446 u8 h2c_seqnum; 447 u16 h2c_cmdcode; 448 u8 h2c_resp_parambuf[512]; 449 _lock h2c_lock; 450 _lock wkitm_lock; 451 u32 h2c_cmdcnt; 452 NDIS_EVENT h2c_cmd_evt; 453 NDIS_EVENT c2h_set; 454 NDIS_EVENT h2c_clr; 455 NDIS_EVENT cpwm_int; 456 457 NDIS_EVENT scsir_full_evt; 458 NDIS_EVENT scsiw_empty_evt; 459 #endif 460 461 u8 *pallocated_mp_xmitframe_buf; 462 u8 *pmp_xmtframe_buf; 463 _queue free_mp_xmitqueue; 464 u32 free_mp_xmitframe_cnt; 465 BOOLEAN bSetRxBssid; 466 BOOLEAN bTxBufCkFail; 467 BOOLEAN bRTWSmbCfg; 468 BOOLEAN bloopback; 469 MPT_CONTEXT MptCtx; 470 471 u8 *TXradomBuffer; 472 }; 473 474 typedef struct _IOCMD_STRUCT_ { 475 u8 cmdclass; 476 u16 value; 477 u8 index; 478 } IOCMD_STRUCT; 479 480 struct rf_reg_param { 481 u32 path; 482 u32 offset; 483 u32 value; 484 }; 485 486 struct bb_reg_param { 487 u32 offset; 488 u32 value; 489 }; 490 491 typedef struct _MP_FIRMWARE { 492 FIRMWARE_SOURCE eFWSource; 493 #ifdef CONFIG_EMBEDDED_FWIMG 494 u8 *szFwBuffer; 495 #else 496 u8 szFwBuffer[0x8000]; 497 #endif 498 u32 ulFwLength; 499 } RT_MP_FIRMWARE, *PRT_MP_FIRMWARE; 500 501 502 503 504 /* *********************************************************************** */ 505 506 #define LOWER _TRUE 507 #define RAISE _FALSE 508 509 /* Hardware Registers */ 510 #if 0 511 #if 0 512 #define IOCMD_CTRL_REG 0x102502C0 513 #define IOCMD_DATA_REG 0x102502C4 514 #else 515 #define IOCMD_CTRL_REG 0x10250370 516 #define IOCMD_DATA_REG 0x10250374 517 #endif 518 519 #define IOCMD_GET_THERMAL_METER 0xFD000028 520 521 #define IOCMD_CLASS_BB_RF 0xF0 522 #define IOCMD_BB_READ_IDX 0x00 523 #define IOCMD_BB_WRITE_IDX 0x01 524 #define IOCMD_RF_READ_IDX 0x02 525 #define IOCMD_RF_WRIT_IDX 0x03 526 #endif 527 #define BB_REG_BASE_ADDR 0x800 528 529 /* MP variables */ 530 #if 0 531 #define _2MAC_MODE_ 0 532 #define _LOOPBOOK_MODE_ 1 533 #endif 534 typedef enum _MP_MODE_ { 535 MP_OFF, 536 MP_ON, 537 MP_ERR, 538 MP_CONTINUOUS_TX, 539 MP_SINGLE_CARRIER_TX, 540 MP_CARRIER_SUPPRISSION_TX, 541 MP_SINGLE_TONE_TX, 542 MP_PACKET_TX, 543 MP_PACKET_RX 544 } MP_MODE; 545 546 typedef enum _TEST_MODE { 547 TEST_NONE , 548 PACKETS_TX , 549 PACKETS_RX , 550 CONTINUOUS_TX , 551 OFDM_Single_Tone_TX , 552 CCK_Carrier_Suppression_TX 553 } TEST_MODE; 554 555 556 typedef enum _MPT_BANDWIDTH { 557 MPT_BW_20MHZ = 0, 558 MPT_BW_40MHZ_DUPLICATE = 1, 559 MPT_BW_40MHZ_ABOVE = 2, 560 MPT_BW_40MHZ_BELOW = 3, 561 MPT_BW_40MHZ = 4, 562 MPT_BW_80MHZ = 5, 563 MPT_BW_80MHZ_20_ABOVE = 6, 564 MPT_BW_80MHZ_20_BELOW = 7, 565 MPT_BW_80MHZ_20_BOTTOM = 8, 566 MPT_BW_80MHZ_20_TOP = 9, 567 MPT_BW_80MHZ_40_ABOVE = 10, 568 MPT_BW_80MHZ_40_BELOW = 11, 569 } MPT_BANDWIDTHE, *PMPT_BANDWIDTH; 570 571 #define MAX_RF_PATH_NUMS RF_PATH_MAX 572 573 574 extern u8 mpdatarate[NumRates]; 575 576 /* MP set force data rate base on the definition. */ 577 typedef enum _MPT_RATE_INDEX { 578 /* CCK rate. */ 579 MPT_RATE_1M = 1 , /* 0 */ 580 MPT_RATE_2M, 581 MPT_RATE_55M, 582 MPT_RATE_11M, /* 3 */ 583 584 /* OFDM rate. */ 585 MPT_RATE_6M, /* 4 */ 586 MPT_RATE_9M, 587 MPT_RATE_12M, 588 MPT_RATE_18M, 589 MPT_RATE_24M, 590 MPT_RATE_36M, 591 MPT_RATE_48M, 592 MPT_RATE_54M, /* 11 */ 593 594 /* HT rate. */ 595 MPT_RATE_MCS0, /* 12 */ 596 MPT_RATE_MCS1, 597 MPT_RATE_MCS2, 598 MPT_RATE_MCS3, 599 MPT_RATE_MCS4, 600 MPT_RATE_MCS5, 601 MPT_RATE_MCS6, 602 MPT_RATE_MCS7, /* 19 */ 603 MPT_RATE_MCS8, 604 MPT_RATE_MCS9, 605 MPT_RATE_MCS10, 606 MPT_RATE_MCS11, 607 MPT_RATE_MCS12, 608 MPT_RATE_MCS13, 609 MPT_RATE_MCS14, 610 MPT_RATE_MCS15, /* 27 */ 611 MPT_RATE_MCS16, 612 MPT_RATE_MCS17, /* #29 */ 613 MPT_RATE_MCS18, 614 MPT_RATE_MCS19, 615 MPT_RATE_MCS20, 616 MPT_RATE_MCS21, 617 MPT_RATE_MCS22, /* #34 */ 618 MPT_RATE_MCS23, 619 MPT_RATE_MCS24, 620 MPT_RATE_MCS25, 621 MPT_RATE_MCS26, 622 MPT_RATE_MCS27, /* #39 */ 623 MPT_RATE_MCS28, /* #40 */ 624 MPT_RATE_MCS29, /* #41 */ 625 MPT_RATE_MCS30, /* #42 */ 626 MPT_RATE_MCS31, /* #43 */ 627 /* VHT rate. Total: 20*/ 628 MPT_RATE_VHT1SS_MCS0 = 100,/* #44*/ 629 MPT_RATE_VHT1SS_MCS1, /* # */ 630 MPT_RATE_VHT1SS_MCS2, 631 MPT_RATE_VHT1SS_MCS3, 632 MPT_RATE_VHT1SS_MCS4, 633 MPT_RATE_VHT1SS_MCS5, 634 MPT_RATE_VHT1SS_MCS6, /* # */ 635 MPT_RATE_VHT1SS_MCS7, 636 MPT_RATE_VHT1SS_MCS8, 637 MPT_RATE_VHT1SS_MCS9, /* #53 */ 638 MPT_RATE_VHT2SS_MCS0, /* #54 */ 639 MPT_RATE_VHT2SS_MCS1, 640 MPT_RATE_VHT2SS_MCS2, 641 MPT_RATE_VHT2SS_MCS3, 642 MPT_RATE_VHT2SS_MCS4, 643 MPT_RATE_VHT2SS_MCS5, 644 MPT_RATE_VHT2SS_MCS6, 645 MPT_RATE_VHT2SS_MCS7, 646 MPT_RATE_VHT2SS_MCS8, 647 MPT_RATE_VHT2SS_MCS9, /* #63 */ 648 MPT_RATE_VHT3SS_MCS0, 649 MPT_RATE_VHT3SS_MCS1, 650 MPT_RATE_VHT3SS_MCS2, 651 MPT_RATE_VHT3SS_MCS3, 652 MPT_RATE_VHT3SS_MCS4, 653 MPT_RATE_VHT3SS_MCS5, 654 MPT_RATE_VHT3SS_MCS6, /* #126 */ 655 MPT_RATE_VHT3SS_MCS7, 656 MPT_RATE_VHT3SS_MCS8, 657 MPT_RATE_VHT3SS_MCS9, 658 MPT_RATE_VHT4SS_MCS0, 659 MPT_RATE_VHT4SS_MCS1, /* #131 */ 660 MPT_RATE_VHT4SS_MCS2, 661 MPT_RATE_VHT4SS_MCS3, 662 MPT_RATE_VHT4SS_MCS4, 663 MPT_RATE_VHT4SS_MCS5, 664 MPT_RATE_VHT4SS_MCS6, /* #136 */ 665 MPT_RATE_VHT4SS_MCS7, 666 MPT_RATE_VHT4SS_MCS8, 667 MPT_RATE_VHT4SS_MCS9, 668 MPT_RATE_LAST 669 } MPT_RATE_E, *PMPT_RATE_E; 670 671 #define MAX_TX_PWR_INDEX_N_MODE 64 /* 0x3F */ 672 673 #define MPT_IS_CCK_RATE(_value) (MPT_RATE_1M <= _value && _value <= MPT_RATE_11M) 674 #define MPT_IS_OFDM_RATE(_value) (MPT_RATE_6M <= _value && _value <= MPT_RATE_54M) 675 #define MPT_IS_HT_RATE(_value) (MPT_RATE_MCS0 <= _value && _value <= MPT_RATE_MCS31) 676 #define MPT_IS_HT_1S_RATE(_value) (MPT_RATE_MCS0 <= _value && _value <= MPT_RATE_MCS7) 677 #define MPT_IS_HT_2S_RATE(_value) (MPT_RATE_MCS8 <= _value && _value <= MPT_RATE_MCS15) 678 #define MPT_IS_HT_3S_RATE(_value) (MPT_RATE_MCS16 <= _value && _value <= MPT_RATE_MCS23) 679 #define MPT_IS_HT_4S_RATE(_value) (MPT_RATE_MCS24 <= _value && _value <= MPT_RATE_MCS31) 680 681 #define MPT_IS_VHT_RATE(_value) (MPT_RATE_VHT1SS_MCS0 <= _value && _value <= MPT_RATE_VHT4SS_MCS9) 682 #define MPT_IS_VHT_1S_RATE(_value) (MPT_RATE_VHT1SS_MCS0 <= _value && _value <= MPT_RATE_VHT1SS_MCS9) 683 #define MPT_IS_VHT_2S_RATE(_value) (MPT_RATE_VHT2SS_MCS0 <= _value && _value <= MPT_RATE_VHT2SS_MCS9) 684 #define MPT_IS_VHT_3S_RATE(_value) (MPT_RATE_VHT3SS_MCS0 <= _value && _value <= MPT_RATE_VHT3SS_MCS9) 685 #define MPT_IS_VHT_4S_RATE(_value) (MPT_RATE_VHT4SS_MCS0 <= _value && _value <= MPT_RATE_VHT4SS_MCS9) 686 687 #define MPT_IS_2SS_RATE(_rate) ((MPT_RATE_MCS8 <= _rate && _rate <= MPT_RATE_MCS15) || \ 688 (MPT_RATE_VHT2SS_MCS0 <= _rate && _rate <= MPT_RATE_VHT2SS_MCS9)) 689 #define MPT_IS_3SS_RATE(_rate) ((MPT_RATE_MCS16 <= _rate && _rate <= MPT_RATE_MCS23) || \ 690 (MPT_RATE_VHT3SS_MCS0 <= _rate && _rate <= MPT_RATE_VHT3SS_MCS9)) 691 #define MPT_IS_4SS_RATE(_rate) ((MPT_RATE_MCS24 <= _rate && _rate <= MPT_RATE_MCS31) || \ 692 (MPT_RATE_VHT4SS_MCS0 <= _rate && _rate <= MPT_RATE_VHT4SS_MCS9)) 693 694 typedef enum _POWER_MODE_ { 695 POWER_LOW = 0, 696 POWER_NORMAL 697 } POWER_MODE; 698 699 /* The following enumeration is used to define the value of Reg0xD00[30:28] or JaguarReg0x914[18:16]. */ 700 typedef enum _OFDM_TX_MODE { 701 OFDM_ALL_OFF = 0, 702 OFDM_ContinuousTx = 1, 703 OFDM_SingleCarrier = 2, 704 OFDM_SingleTone = 4, 705 } OFDM_TX_MODE; 706 707 708 #define RX_PKT_BROADCAST 1 709 #define RX_PKT_DEST_ADDR 2 710 #define RX_PKT_PHY_MATCH 3 711 712 #define Mac_OFDM_OK 0x00000000 713 #define Mac_OFDM_Fail 0x10000000 714 #define Mac_OFDM_FasleAlarm 0x20000000 715 #define Mac_CCK_OK 0x30000000 716 #define Mac_CCK_Fail 0x40000000 717 #define Mac_CCK_FasleAlarm 0x50000000 718 #define Mac_HT_OK 0x60000000 719 #define Mac_HT_Fail 0x70000000 720 #define Mac_HT_FasleAlarm 0x90000000 721 #define Mac_DropPacket 0xA0000000 722 723 typedef enum _ENCRY_CTRL_STATE_ { 724 HW_CONTROL, /* hw encryption& decryption */ 725 SW_CONTROL, /* sw encryption& decryption */ 726 HW_ENCRY_SW_DECRY, /* hw encryption & sw decryption */ 727 SW_ENCRY_HW_DECRY /* sw encryption & hw decryption */ 728 } ENCRY_CTRL_STATE; 729 730 typedef enum _MPT_TXPWR_DEF { 731 MPT_CCK, 732 MPT_OFDM, /* L and HT OFDM */ 733 MPT_OFDM_AND_HT, 734 MPT_HT, 735 MPT_VHT 736 } MPT_TXPWR_DEF; 737 738 #ifdef CONFIG_RF_POWER_TRIM 739 740 #if defined(CONFIG_RTL8723B) 741 #define REG_RF_BB_GAIN_OFFSET 0x7f 742 #define RF_GAIN_OFFSET_MASK 0xfffff 743 #elif defined(CONFIG_RTL8188E) 744 #define REG_RF_BB_GAIN_OFFSET 0x55 745 #define RF_GAIN_OFFSET_MASK 0xfffff 746 #else 747 #define REG_RF_BB_GAIN_OFFSET 0x55 748 #define RF_GAIN_OFFSET_MASK 0xfffff 749 #endif /* CONFIG_RTL8723B */ 750 751 #endif /*CONFIG_RF_POWER_TRIM*/ 752 753 #define IS_MPT_HT_RATE(_rate) (_rate >= MPT_RATE_MCS0 && _rate <= MPT_RATE_MCS31) 754 #define IS_MPT_VHT_RATE(_rate) (_rate >= MPT_RATE_VHT1SS_MCS0 && _rate <= MPT_RATE_VHT4SS_MCS9) 755 #define IS_MPT_CCK_RATE(_rate) (_rate >= MPT_RATE_1M && _rate <= MPT_RATE_11M) 756 #define IS_MPT_OFDM_RATE(_rate) (_rate >= MPT_RATE_6M && _rate <= MPT_RATE_54M) 757 /* *********************************************************************** 758 * extern struct mp_xmit_frame *alloc_mp_xmitframe(struct mp_priv *pmp_priv); 759 * extern int free_mp_xmitframe(struct xmit_priv *pxmitpriv, struct mp_xmit_frame *pmp_xmitframe); */ 760 761 extern s32 init_mp_priv(PADAPTER padapter); 762 extern void free_mp_priv(struct mp_priv *pmp_priv); 763 extern s32 MPT_InitializeAdapter(PADAPTER padapter, u8 Channel); 764 extern void MPT_DeInitAdapter(PADAPTER padapter); 765 extern s32 mp_start_test(PADAPTER padapter); 766 extern void mp_stop_test(PADAPTER padapter); 767 768 extern u32 _read_rfreg(PADAPTER padapter, u8 rfpath, u32 addr, u32 bitmask); 769 extern void _write_rfreg(PADAPTER padapter, u8 rfpath, u32 addr, u32 bitmask, u32 val); 770 771 extern u32 read_macreg(_adapter *padapter, u32 addr, u32 sz); 772 extern void write_macreg(_adapter *padapter, u32 addr, u32 val, u32 sz); 773 extern u32 read_bbreg(_adapter *padapter, u32 addr, u32 bitmask); 774 extern void write_bbreg(_adapter *padapter, u32 addr, u32 bitmask, u32 val); 775 extern u32 read_rfreg(PADAPTER padapter, u8 rfpath, u32 addr); 776 extern void write_rfreg(PADAPTER padapter, u8 rfpath, u32 addr, u32 val); 777 778 void SetChannel(PADAPTER pAdapter); 779 void SetBandwidth(PADAPTER pAdapter); 780 int SetTxPower(PADAPTER pAdapter); 781 void SetAntenna(PADAPTER pAdapter); 782 void SetDataRate(PADAPTER pAdapter); 783 void SetAntenna(PADAPTER pAdapter); 784 s32 SetThermalMeter(PADAPTER pAdapter, u8 target_ther); 785 void GetThermalMeter(PADAPTER pAdapter, u8 *value); 786 void SetContinuousTx(PADAPTER pAdapter, u8 bStart); 787 void SetSingleCarrierTx(PADAPTER pAdapter, u8 bStart); 788 void SetSingleToneTx(PADAPTER pAdapter, u8 bStart); 789 void SetCarrierSuppressionTx(PADAPTER pAdapter, u8 bStart); 790 void PhySetTxPowerLevel(PADAPTER pAdapter); 791 void fill_txdesc_for_mp(PADAPTER padapter, u8 *ptxdesc); 792 void SetPacketTx(PADAPTER padapter); 793 void SetPacketRx(PADAPTER pAdapter, u8 bStartRx, u8 bAB); 794 void ResetPhyRxPktCount(PADAPTER pAdapter); 795 u32 GetPhyRxPktReceived(PADAPTER pAdapter); 796 u32 GetPhyRxPktCRC32Error(PADAPTER pAdapter); 797 s32 SetPowerTracking(PADAPTER padapter, u8 enable); 798 void GetPowerTracking(PADAPTER padapter, u8 *enable); 799 u32 mp_query_psd(PADAPTER pAdapter, u8 *data); 800 801 802 803 void hal_mpt_SwitchRfSetting(PADAPTER pAdapter); 804 s32 hal_mpt_SetPowerTracking(PADAPTER padapter, u8 enable); 805 void hal_mpt_GetPowerTracking(PADAPTER padapter, u8 *enable); 806 void hal_mpt_CCKTxPowerAdjust(PADAPTER Adapter, BOOLEAN bInCH14); 807 void hal_mpt_SetChannel(PADAPTER pAdapter); 808 void hal_mpt_SetBandwidth(PADAPTER pAdapter); 809 void hal_mpt_SetTxPower(PADAPTER pAdapter); 810 void hal_mpt_SetDataRate(PADAPTER pAdapter); 811 void hal_mpt_SetAntenna(PADAPTER pAdapter); 812 s32 hal_mpt_SetThermalMeter(PADAPTER pAdapter, u8 target_ther); 813 void hal_mpt_TriggerRFThermalMeter(PADAPTER pAdapter); 814 u8 hal_mpt_ReadRFThermalMeter(PADAPTER pAdapter); 815 void hal_mpt_GetThermalMeter(PADAPTER pAdapter, u8 *value); 816 void hal_mpt_CCKTxPowerAdjustbyIndex(PADAPTER pAdapter, BOOLEAN beven); 817 void hal_mpt_SetContinuousTx(PADAPTER pAdapter, u8 bStart); 818 void hal_mpt_SetSingleCarrierTx(PADAPTER pAdapter, u8 bStart); 819 void hal_mpt_SetSingleToneTx(PADAPTER pAdapter, u8 bStart); 820 void hal_mpt_SetCarrierSuppressionTx(PADAPTER pAdapter, u8 bStart); 821 void hal_mpt_SetCCKContinuousTx(PADAPTER pAdapter, u8 bStart); 822 void hal_mpt_SetOFDMContinuousTx(PADAPTER pAdapter, u8 bStart); 823 void mpt_ProSetPMacTx(PADAPTER Adapter); 824 825 void MP_PHY_SetRFPathSwitch(PADAPTER pAdapter , BOOLEAN bMain); 826 ULONG mpt_ProQueryCalTxPower(PADAPTER pAdapter, u8 RfPath); 827 void MPT_PwrCtlDM(PADAPTER padapter, u32 bstart); 828 u8 MptToMgntRate(u32 MptRateIdx); 829 u8 rtw_mpRateParseFunc(PADAPTER pAdapter, u8 *targetStr); 830 u32 mp_join(PADAPTER padapter, u8 mode); 831 u32 hal_mpt_query_phytxok(PADAPTER pAdapter); 832 833 void 834 PMAC_Get_Pkt_Param( 835 PRT_PMAC_TX_INFO pPMacTxInfo, 836 PRT_PMAC_PKT_INFO pPMacPktInfo 837 ); 838 void 839 CCK_generator( 840 PRT_PMAC_TX_INFO pPMacTxInfo, 841 PRT_PMAC_PKT_INFO pPMacPktInfo 842 ); 843 void 844 PMAC_Nsym_generator( 845 PRT_PMAC_TX_INFO pPMacTxInfo, 846 PRT_PMAC_PKT_INFO pPMacPktInfo 847 ); 848 void 849 L_SIG_generator( 850 UINT N_SYM, /* Max: 750*/ 851 PRT_PMAC_TX_INFO pPMacTxInfo, 852 PRT_PMAC_PKT_INFO pPMacPktInfo 853 ); 854 855 void HT_SIG_generator( 856 PRT_PMAC_TX_INFO pPMacTxInfo, 857 PRT_PMAC_PKT_INFO pPMacPktInfo); 858 859 void VHT_SIG_A_generator( 860 PRT_PMAC_TX_INFO pPMacTxInfo, 861 PRT_PMAC_PKT_INFO pPMacPktInfo); 862 863 void VHT_SIG_B_generator( 864 PRT_PMAC_TX_INFO pPMacTxInfo); 865 866 void VHT_Delimiter_generator( 867 PRT_PMAC_TX_INFO pPMacTxInfo); 868 869 870 int rtw_mp_write_reg(struct net_device *dev, 871 struct iw_request_info *info, 872 struct iw_point *wrqu, char *extra); 873 int rtw_mp_read_reg(struct net_device *dev, 874 struct iw_request_info *info, 875 struct iw_point *wrqu, char *extra); 876 int rtw_mp_write_rf(struct net_device *dev, 877 struct iw_request_info *info, 878 struct iw_point *wrqu, char *extra); 879 int rtw_mp_read_rf(struct net_device *dev, 880 struct iw_request_info *info, 881 struct iw_point *wrqu, char *extra); 882 int rtw_mp_start(struct net_device *dev, 883 struct iw_request_info *info, 884 struct iw_point *wrqu, char *extra); 885 int rtw_mp_stop(struct net_device *dev, 886 struct iw_request_info *info, 887 struct iw_point *wrqu, char *extra); 888 int rtw_mp_rate(struct net_device *dev, 889 struct iw_request_info *info, 890 struct iw_point *wrqu, char *extra); 891 int rtw_mp_channel(struct net_device *dev, 892 struct iw_request_info *info, 893 struct iw_point *wrqu, char *extra); 894 int rtw_mp_bandwidth(struct net_device *dev, 895 struct iw_request_info *info, 896 struct iw_point *wrqu, char *extra); 897 int rtw_mp_txpower_index(struct net_device *dev, 898 struct iw_request_info *info, 899 struct iw_point *wrqu, char *extra); 900 int rtw_mp_txpower(struct net_device *dev, 901 struct iw_request_info *info, 902 struct iw_point *wrqu, char *extra); 903 int rtw_mp_txpower(struct net_device *dev, 904 struct iw_request_info *info, 905 struct iw_point *wrqu, char *extra); 906 int rtw_mp_ant_tx(struct net_device *dev, 907 struct iw_request_info *info, 908 struct iw_point *wrqu, char *extra); 909 int rtw_mp_ant_rx(struct net_device *dev, 910 struct iw_request_info *info, 911 struct iw_point *wrqu, char *extra); 912 int rtw_set_ctx_destAddr(struct net_device *dev, 913 struct iw_request_info *info, 914 struct iw_point *wrqu, char *extra); 915 int rtw_mp_ctx(struct net_device *dev, 916 struct iw_request_info *info, 917 struct iw_point *wrqu, char *extra); 918 int rtw_mp_disable_bt_coexist(struct net_device *dev, 919 struct iw_request_info *info, 920 union iwreq_data *wrqu, char *extra); 921 int rtw_mp_disable_bt_coexist(struct net_device *dev, 922 struct iw_request_info *info, 923 union iwreq_data *wrqu, char *extra); 924 int rtw_mp_arx(struct net_device *dev, 925 struct iw_request_info *info, 926 struct iw_point *wrqu, char *extra); 927 int rtw_mp_trx_query(struct net_device *dev, 928 struct iw_request_info *info, 929 struct iw_point *wrqu, char *extra); 930 int rtw_mp_pwrtrk(struct net_device *dev, 931 struct iw_request_info *info, 932 struct iw_point *wrqu, char *extra); 933 int rtw_mp_psd(struct net_device *dev, 934 struct iw_request_info *info, 935 struct iw_point *wrqu, char *extra); 936 int rtw_mp_thermal(struct net_device *dev, 937 struct iw_request_info *info, 938 struct iw_point *wrqu, char *extra); 939 int rtw_mp_reset_stats(struct net_device *dev, 940 struct iw_request_info *info, 941 struct iw_point *wrqu, char *extra); 942 int rtw_mp_dump(struct net_device *dev, 943 struct iw_request_info *info, 944 struct iw_point *wrqu, char *extra); 945 int rtw_mp_phypara(struct net_device *dev, 946 struct iw_request_info *info, 947 struct iw_point *wrqu, char *extra); 948 int rtw_mp_SetRFPath(struct net_device *dev, 949 struct iw_request_info *info, 950 union iwreq_data *wrqu, char *extra); 951 int rtw_mp_QueryDrv(struct net_device *dev, 952 struct iw_request_info *info, 953 union iwreq_data *wrqu, char *extra); 954 int rtw_mp_PwrCtlDM(struct net_device *dev, 955 struct iw_request_info *info, 956 struct iw_point *wrqu, char *extra); 957 int rtw_mp_getver(struct net_device *dev, 958 struct iw_request_info *info, 959 union iwreq_data *wrqu, char *extra); 960 int rtw_mp_mon(struct net_device *dev, 961 struct iw_request_info *info, 962 union iwreq_data *wrqu, char *extra); 963 int rtw_efuse_mask_file(struct net_device *dev, 964 struct iw_request_info *info, 965 union iwreq_data *wrqu, char *extra); 966 int rtw_efuse_file_map(struct net_device *dev, 967 struct iw_request_info *info, 968 union iwreq_data *wrqu, char *extra); 969 int rtw_mp_SetBT(struct net_device *dev, 970 struct iw_request_info *info, 971 union iwreq_data *wrqu, char *extra); 972 int rtw_mp_pretx_proc(PADAPTER padapter, u8 bStartTest, char *extra); 973 int rtw_mp_tx(struct net_device *dev, 974 struct iw_request_info *info, 975 union iwreq_data *wrqu, char *extra); 976 int rtw_mp_rx(struct net_device *dev, 977 struct iw_request_info *info, 978 union iwreq_data *wrqu, char *extra); 979 int rtw_mp_hwtx(struct net_device *dev, 980 struct iw_request_info *info, 981 union iwreq_data *wrqu, char *extra); 982 u8 HwRateToMPTRate(u8 rate); 983 984 #endif /* _RTW_MP_H_ */ 985