rtw_mp.h 25 KB

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