rtw_mp.h 25 KB

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