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