rtw_cmd.h 29 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328
  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_CMD_H_
  16. #define __RTW_CMD_H_
  17. #define C2H_MEM_SZ (16*1024)
  18. #ifndef CONFIG_RTL8711FW
  19. #define FREE_CMDOBJ_SZ 128
  20. #define MAX_CMDSZ 1024
  21. #define MAX_RSPSZ 512
  22. #define MAX_EVTSZ 1024
  23. #ifdef PLATFORM_OS_CE
  24. #define CMDBUFF_ALIGN_SZ 4
  25. #else
  26. #define CMDBUFF_ALIGN_SZ 512
  27. #endif
  28. struct cmd_obj {
  29. _adapter *padapter;
  30. u16 cmdcode;
  31. u8 res;
  32. u8 *parmbuf;
  33. u32 cmdsz;
  34. u8 *rsp;
  35. u32 rspsz;
  36. struct submit_ctx *sctx;
  37. u8 no_io;
  38. /* _sema cmd_sem; */
  39. _list list;
  40. };
  41. /* cmd flags */
  42. enum {
  43. RTW_CMDF_DIRECTLY = BIT0,
  44. RTW_CMDF_WAIT_ACK = BIT1,
  45. };
  46. struct cmd_priv {
  47. _sema cmd_queue_sema;
  48. /* _sema cmd_done_sema; */
  49. _sema start_cmdthread_sema;
  50. _queue cmd_queue;
  51. u8 cmd_seq;
  52. u8 *cmd_buf; /* shall be non-paged, and 4 bytes aligned */
  53. u8 *cmd_allocated_buf;
  54. u8 *rsp_buf; /* shall be non-paged, and 4 bytes aligned */
  55. u8 *rsp_allocated_buf;
  56. u32 cmd_issued_cnt;
  57. u32 cmd_done_cnt;
  58. u32 rsp_cnt;
  59. ATOMIC_T cmdthd_running;
  60. /* u8 cmdthd_running; */
  61. _adapter *padapter;
  62. _mutex sctx_mutex;
  63. };
  64. #ifdef CONFIG_EVENT_THREAD_MODE
  65. struct evt_obj {
  66. u16 evtcode;
  67. u8 res;
  68. u8 *parmbuf;
  69. u32 evtsz;
  70. _list list;
  71. };
  72. #endif
  73. struct evt_priv {
  74. #ifdef CONFIG_EVENT_THREAD_MODE
  75. _sema evt_notify;
  76. _queue evt_queue;
  77. #endif
  78. #ifdef CONFIG_FW_C2H_REG
  79. #define CONFIG_C2H_WK
  80. #endif
  81. #ifdef CONFIG_C2H_WK
  82. _workitem c2h_wk;
  83. bool c2h_wk_alive;
  84. struct rtw_cbuf *c2h_queue;
  85. #define C2H_QUEUE_MAX_LEN 10
  86. #endif
  87. #ifdef CONFIG_H2CLBK
  88. _sema lbkevt_done;
  89. u8 lbkevt_limit;
  90. u8 lbkevt_num;
  91. u8 *cmdevt_parm;
  92. #endif
  93. ATOMIC_T event_seq;
  94. u8 *evt_buf; /* shall be non-paged, and 4 bytes aligned */
  95. u8 *evt_allocated_buf;
  96. u32 evt_done_cnt;
  97. #if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
  98. u8 *c2h_mem;
  99. u8 *allocated_c2h_mem;
  100. #ifdef PLATFORM_OS_XP
  101. PMDL pc2h_mdl;
  102. #endif
  103. #endif
  104. };
  105. #define init_h2fwcmd_w_parm_no_rsp(pcmd, pparm, code) \
  106. do {\
  107. _rtw_init_listhead(&pcmd->list);\
  108. pcmd->cmdcode = code;\
  109. pcmd->parmbuf = (u8 *)(pparm);\
  110. pcmd->cmdsz = sizeof (*pparm);\
  111. pcmd->rsp = NULL;\
  112. pcmd->rspsz = 0;\
  113. } while (0)
  114. #define init_h2fwcmd_w_parm_no_parm_rsp(pcmd, code) \
  115. do {\
  116. _rtw_init_listhead(&pcmd->list);\
  117. pcmd->cmdcode = code;\
  118. pcmd->parmbuf = NULL;\
  119. pcmd->cmdsz = 0;\
  120. pcmd->rsp = NULL;\
  121. pcmd->rspsz = 0;\
  122. } while (0)
  123. struct P2P_PS_Offload_t {
  124. u8 Offload_En:1;
  125. u8 role:1; /* 1: Owner, 0: Client */
  126. u8 CTWindow_En:1;
  127. u8 NoA0_En:1;
  128. u8 NoA1_En:1;
  129. u8 AllStaSleep:1; /* Only valid in Owner */
  130. u8 discovery:1;
  131. u8 rsvd:1;
  132. };
  133. struct P2P_PS_CTWPeriod_t {
  134. u8 CTWPeriod; /* TU */
  135. };
  136. #ifdef CONFIG_P2P_WOWLAN
  137. struct P2P_WoWlan_Offload_t {
  138. u8 Disconnect_Wkup_Drv:1;
  139. u8 role:2;
  140. u8 Wps_Config[2];
  141. };
  142. #endif /* CONFIG_P2P_WOWLAN */
  143. extern u32 rtw_enqueue_cmd(struct cmd_priv *pcmdpriv, struct cmd_obj *obj);
  144. extern struct cmd_obj *rtw_dequeue_cmd(struct cmd_priv *pcmdpriv);
  145. extern void rtw_free_cmd_obj(struct cmd_obj *pcmd);
  146. #ifdef CONFIG_EVENT_THREAD_MODE
  147. extern u32 rtw_enqueue_evt(struct evt_priv *pevtpriv, struct evt_obj *obj);
  148. extern struct evt_obj *rtw_dequeue_evt(_queue *queue);
  149. extern void rtw_free_evt_obj(struct evt_obj *pcmd);
  150. #endif
  151. void rtw_stop_cmd_thread(_adapter *adapter);
  152. thread_return rtw_cmd_thread(thread_context context);
  153. extern u32 rtw_init_cmd_priv(struct cmd_priv *pcmdpriv);
  154. extern void rtw_free_cmd_priv(struct cmd_priv *pcmdpriv);
  155. extern u32 rtw_init_evt_priv(struct evt_priv *pevtpriv);
  156. extern void rtw_free_evt_priv(struct evt_priv *pevtpriv);
  157. extern void rtw_cmd_clr_isr(struct cmd_priv *pcmdpriv);
  158. extern void rtw_evt_notify_isr(struct evt_priv *pevtpriv);
  159. #ifdef CONFIG_P2P
  160. u8 p2p_protocol_wk_cmd(_adapter *padapter, int intCmdType);
  161. #ifdef CONFIG_IOCTL_CFG80211
  162. struct p2p_roch_parm {
  163. u64 cookie;
  164. struct wireless_dev *wdev;
  165. struct ieee80211_channel ch;
  166. enum nl80211_channel_type ch_type;
  167. unsigned int duration;
  168. };
  169. u8 p2p_roch_cmd(_adapter *adapter
  170. , u64 cookie, struct wireless_dev *wdev
  171. , struct ieee80211_channel *ch, enum nl80211_channel_type ch_type
  172. , unsigned int duration
  173. , u8 flags
  174. );
  175. u8 p2p_cancel_roch_cmd(_adapter *adapter, u64 cookie, struct wireless_dev *wdev, u8 flags);
  176. #endif /* CONFIG_IOCTL_CFG80211 */
  177. #endif /* CONFIG_P2P */
  178. #ifdef CONFIG_IOCTL_CFG80211
  179. u8 rtw_mgnt_tx_cmd(_adapter *adapter, u8 tx_ch, u8 no_cck, const u8 *buf, size_t len, int wait_ack, u8 flags);
  180. struct mgnt_tx_parm {
  181. u8 tx_ch;
  182. u8 no_cck;
  183. const u8 *buf;
  184. size_t len;
  185. int wait_ack;
  186. };
  187. #endif
  188. #else
  189. /* #include <ieee80211.h> */
  190. #endif /* CONFIG_RTL8711FW */
  191. enum rtw_drvextra_cmd_id {
  192. NONE_WK_CID,
  193. STA_MSTATUS_RPT_WK_CID,
  194. DYNAMIC_CHK_WK_CID,
  195. DM_CTRL_WK_CID,
  196. PBC_POLLING_WK_CID,
  197. POWER_SAVING_CTRL_WK_CID,/* IPS,AUTOSuspend */
  198. LPS_CTRL_WK_CID,
  199. ANT_SELECT_WK_CID,
  200. P2P_PS_WK_CID,
  201. P2P_PROTO_WK_CID,
  202. CHECK_HIQ_WK_CID,/* for softap mode, check hi queue if empty */
  203. INTEl_WIDI_WK_CID,
  204. C2H_WK_CID,
  205. RTP_TIMER_CFG_WK_CID,
  206. RESET_SECURITYPRIV, /* add for CONFIG_IEEE80211W, none 11w also can use */
  207. FREE_ASSOC_RESOURCES, /* add for CONFIG_IEEE80211W, none 11w also can use */
  208. DM_IN_LPS_WK_CID,
  209. DM_RA_MSK_WK_CID, /* add for STA update RAMask when bandwith change. */
  210. BEAMFORMING_WK_CID,
  211. LPS_CHANGE_DTIM_CID,
  212. BTINFO_WK_CID,
  213. DFS_RADAR_DETECT_WK_CID,
  214. DFS_RADAR_DETECT_EN_DEC_WK_CID,
  215. SESSION_TRACKER_WK_CID,
  216. EN_HW_UPDATE_TSF_WK_CID,
  217. PERIOD_TSF_UPDATE_END_WK_CID,
  218. TEST_H2C_CID,
  219. MP_CMD_WK_CID,
  220. CUSTOMER_STR_WK_CID,
  221. #ifdef CONFIG_RTW_REPEATER_SON
  222. RSON_SCAN_WK_CID,
  223. #endif
  224. MGNT_TX_WK_CID,
  225. #ifdef CONFIG_MCC_MODE
  226. MCC_SET_DURATION_WK_CID,
  227. #endif /* CONFIG_MCC_MODE */
  228. REQ_PER_CMD_WK_CID,
  229. MAX_WK_CID
  230. };
  231. enum LPS_CTRL_TYPE {
  232. LPS_CTRL_SCAN = 0,
  233. LPS_CTRL_JOINBSS = 1,
  234. LPS_CTRL_CONNECT = 2,
  235. LPS_CTRL_DISCONNECT = 3,
  236. LPS_CTRL_SPECIAL_PACKET = 4,
  237. LPS_CTRL_LEAVE = 5,
  238. LPS_CTRL_TRAFFIC_BUSY = 6,
  239. LPS_CTRL_TX_TRAFFIC_LEAVE = 7,
  240. LPS_CTRL_RX_TRAFFIC_LEAVE = 8,
  241. LPS_CTRL_ENTER = 9,
  242. LPS_CTRL_LEAVE_CFG80211_PWRMGMT = 10,
  243. };
  244. enum STAKEY_TYPE {
  245. GROUP_KEY = 0,
  246. UNICAST_KEY = 1,
  247. TDLS_KEY = 2,
  248. };
  249. enum RFINTFS {
  250. SWSI,
  251. HWSI,
  252. HWPI,
  253. };
  254. /*
  255. Caller Mode: Infra, Ad-HoC(C)
  256. Notes: To enter USB suspend mode
  257. Command Mode
  258. */
  259. struct usb_suspend_parm {
  260. u32 action;/* 1: sleep, 0:resume */
  261. };
  262. /*
  263. Caller Mode: Infra, Ad-HoC
  264. Notes: To join a known BSS.
  265. Command-Event Mode
  266. */
  267. /*
  268. Caller Mode: Infra, Ad-Hoc
  269. Notes: To join the specified bss
  270. Command Event Mode
  271. */
  272. struct joinbss_parm {
  273. WLAN_BSSID_EX network;
  274. };
  275. /*
  276. Caller Mode: Infra, Ad-HoC(C)
  277. Notes: To disconnect the current associated BSS
  278. Command Mode
  279. */
  280. struct disconnect_parm {
  281. u32 deauth_timeout_ms;
  282. };
  283. /*
  284. Caller Mode: AP, Ad-HoC(M)
  285. Notes: To create a BSS
  286. Command Mode
  287. */
  288. struct createbss_parm {
  289. bool adhoc;
  290. /* used by AP/Mesh mode now */
  291. u8 ifbmp;
  292. u8 excl_ifbmp;
  293. s16 req_ch;
  294. s8 req_bw;
  295. s8 req_offset;
  296. };
  297. #if 0
  298. /* Caller Mode: AP, Ad-HoC, Infra */
  299. /* Notes: To set the NIC mode of RTL8711 */
  300. /* Command Mode */
  301. /* The definition of mode: */
  302. #define IW_MODE_AUTO 0 /* Let the driver decides which AP to join */
  303. #define IW_MODE_ADHOC 1 /* Single cell network (Ad-Hoc Clients) */
  304. #define IW_MODE_INFRA 2 /* Multi cell network, roaming, .. */
  305. #define IW_MODE_MASTER 3 /* Synchronisation master or Access Point */
  306. #define IW_MODE_REPEAT 4 /* Wireless Repeater (forwarder) */
  307. #define IW_MODE_SECOND 5 /* Secondary master/repeater (backup) */
  308. #define IW_MODE_MONITOR 6 /* Passive monitor (listen only) */
  309. #endif
  310. struct setopmode_parm {
  311. u8 mode;
  312. u8 rsvd[3];
  313. };
  314. /*
  315. Caller Mode: AP, Ad-HoC, Infra
  316. Notes: To ask RTL8711 performing site-survey
  317. Command-Event Mode
  318. */
  319. #define RTW_SSID_SCAN_AMOUNT 9 /* for WEXT_CSCAN_AMOUNT 9 */
  320. #define RTW_CHANNEL_SCAN_AMOUNT (14+37)
  321. struct sitesurvey_parm {
  322. sint scan_mode; /* active: 1, passive: 0 */
  323. /* sint bsslimit; // 1 ~ 48 */
  324. u8 ssid_num;
  325. u8 ch_num;
  326. NDIS_802_11_SSID ssid[RTW_SSID_SCAN_AMOUNT];
  327. struct rtw_ieee80211_channel ch[RTW_CHANNEL_SCAN_AMOUNT];
  328. u32 token; /* 80211k use it to identify caller */
  329. u16 duration; /* 0: use default, otherwise: channel scan time */
  330. u8 igi; /* 0: use defalut */
  331. u8 bw; /* 0: use default */
  332. };
  333. /*
  334. Caller Mode: Any
  335. Notes: To set the auth type of RTL8711. open/shared/802.1x
  336. Command Mode
  337. */
  338. struct setauth_parm {
  339. u8 mode; /* 0: legacy open, 1: legacy shared 2: 802.1x */
  340. u8 _1x; /* 0: PSK, 1: TLS */
  341. u8 rsvd[2];
  342. };
  343. /*
  344. Caller Mode: Infra
  345. a. algorithm: wep40, wep104, tkip & aes
  346. b. keytype: grp key/unicast key
  347. c. key contents
  348. when shared key ==> keyid is the camid
  349. when 802.1x ==> keyid [0:1] ==> grp key
  350. when 802.1x ==> keyid > 2 ==> unicast key
  351. */
  352. struct setkey_parm {
  353. u8 algorithm; /* encryption algorithm, could be none, wep40, TKIP, CCMP, wep104 */
  354. u8 keyid;
  355. u8 set_tx; /* 1: main tx key for wep. 0: other key. */
  356. u8 key[16]; /* this could be 40 or 104 */
  357. };
  358. /*
  359. When in AP or Ad-Hoc mode, this is used to
  360. allocate an sw/hw entry for a newly associated sta.
  361. Command
  362. when shared key ==> algorithm/keyid
  363. */
  364. struct set_stakey_parm {
  365. u8 addr[ETH_ALEN];
  366. u8 algorithm;
  367. u8 keyid;
  368. u8 key[16];
  369. u8 gk;
  370. };
  371. struct set_stakey_rsp {
  372. u8 addr[ETH_ALEN];
  373. u8 keyid;
  374. u8 rsvd;
  375. };
  376. /*
  377. Caller Ad-Hoc/AP
  378. Command -Rsp(AID == CAMID) mode
  379. This is to force fw to add an sta_data entry per driver's request.
  380. FW will write an cam entry associated with it.
  381. */
  382. struct set_assocsta_parm {
  383. u8 addr[ETH_ALEN];
  384. };
  385. struct set_assocsta_rsp {
  386. u8 cam_id;
  387. u8 rsvd[3];
  388. };
  389. /*
  390. Caller Ad-Hoc/AP
  391. Command mode
  392. This is to force fw to del an sta_data entry per driver's request
  393. FW will invalidate the cam entry associated with it.
  394. */
  395. struct del_assocsta_parm {
  396. u8 addr[ETH_ALEN];
  397. };
  398. /*
  399. Caller Mode: AP/Ad-HoC(M)
  400. Notes: To notify fw that given staid has changed its power state
  401. Command Mode
  402. */
  403. struct setstapwrstate_parm {
  404. u8 staid;
  405. u8 status;
  406. u8 hwaddr[6];
  407. };
  408. /*
  409. Caller Mode: Any
  410. Notes: To setup the basic rate of RTL8711
  411. Command Mode
  412. */
  413. struct setbasicrate_parm {
  414. u8 basicrates[NumRates];
  415. };
  416. /*
  417. Caller Mode: Any
  418. Notes: To read the current basic rate
  419. Command-Rsp Mode
  420. */
  421. struct getbasicrate_parm {
  422. u32 rsvd;
  423. };
  424. struct getbasicrate_rsp {
  425. u8 basicrates[NumRates];
  426. };
  427. /*
  428. Caller Mode: Any
  429. Notes: To setup the data rate of RTL8711
  430. Command Mode
  431. */
  432. struct setdatarate_parm {
  433. #ifdef MP_FIRMWARE_OFFLOAD
  434. u32 curr_rateidx;
  435. #else
  436. u8 mac_id;
  437. u8 datarates[NumRates];
  438. #endif
  439. };
  440. /*
  441. Caller Mode: Any
  442. Notes: To read the current data rate
  443. Command-Rsp Mode
  444. */
  445. struct getdatarate_parm {
  446. u32 rsvd;
  447. };
  448. struct getdatarate_rsp {
  449. u8 datarates[NumRates];
  450. };
  451. /*
  452. Caller Mode: Any
  453. Notes: To set the channel/modem/band
  454. This command will be used when channel/modem/band is changed.
  455. Command Mode
  456. */
  457. struct setphy_parm {
  458. u8 rfchannel;
  459. u8 modem;
  460. };
  461. /*
  462. Caller Mode: Any
  463. Notes: To get the current setting of channel/modem/band
  464. Command-Rsp Mode
  465. */
  466. struct getphy_parm {
  467. u32 rsvd;
  468. };
  469. struct getphy_rsp {
  470. u8 rfchannel;
  471. u8 modem;
  472. };
  473. struct readBB_parm {
  474. u8 offset;
  475. };
  476. struct readBB_rsp {
  477. u8 value;
  478. };
  479. struct readTSSI_parm {
  480. u8 offset;
  481. };
  482. struct readTSSI_rsp {
  483. u8 value;
  484. };
  485. struct readMAC_parm {
  486. u8 len;
  487. u32 addr;
  488. };
  489. struct writeBB_parm {
  490. u8 offset;
  491. u8 value;
  492. };
  493. struct readRF_parm {
  494. u8 offset;
  495. };
  496. struct readRF_rsp {
  497. u32 value;
  498. };
  499. struct writeRF_parm {
  500. u32 offset;
  501. u32 value;
  502. };
  503. struct getrfintfs_parm {
  504. u8 rfintfs;
  505. };
  506. struct Tx_Beacon_param {
  507. WLAN_BSSID_EX network;
  508. };
  509. /*
  510. Notes: This command is used for H2C/C2H loopback testing
  511. mac[0] == 0
  512. ==> CMD mode, return H2C_SUCCESS.
  513. The following condition must be ture under CMD mode
  514. mac[1] == mac[4], mac[2] == mac[3], mac[0]=mac[5]= 0;
  515. s0 == 0x1234, s1 == 0xabcd, w0 == 0x78563412, w1 == 0x5aa5def7;
  516. s2 == (b1 << 8 | b0);
  517. mac[0] == 1
  518. ==> CMD_RSP mode, return H2C_SUCCESS_RSP
  519. The rsp layout shall be:
  520. rsp: parm:
  521. mac[0] = mac[5];
  522. mac[1] = mac[4];
  523. mac[2] = mac[3];
  524. mac[3] = mac[2];
  525. mac[4] = mac[1];
  526. mac[5] = mac[0];
  527. s0 = s1;
  528. s1 = swap16(s0);
  529. w0 = swap32(w1);
  530. b0 = b1
  531. s2 = s0 + s1
  532. b1 = b0
  533. w1 = w0
  534. mac[0] == 2
  535. ==> CMD_EVENT mode, return H2C_SUCCESS
  536. The event layout shall be:
  537. event: parm:
  538. mac[0] = mac[5];
  539. mac[1] = mac[4];
  540. mac[2] = event's sequence number, starting from 1 to parm's marc[3]
  541. mac[3] = mac[2];
  542. mac[4] = mac[1];
  543. mac[5] = mac[0];
  544. s0 = swap16(s0) - event.mac[2];
  545. s1 = s1 + event.mac[2];
  546. w0 = swap32(w0);
  547. b0 = b1
  548. s2 = s0 + event.mac[2]
  549. b1 = b0
  550. w1 = swap32(w1) - event.mac[2];
  551. parm->mac[3] is the total event counts that host requested.
  552. event will be the same with the cmd's param.
  553. */
  554. #ifdef CONFIG_H2CLBK
  555. struct seth2clbk_parm {
  556. u8 mac[6];
  557. u16 s0;
  558. u16 s1;
  559. u32 w0;
  560. u8 b0;
  561. u16 s2;
  562. u8 b1;
  563. u32 w1;
  564. };
  565. struct geth2clbk_parm {
  566. u32 rsv;
  567. };
  568. struct geth2clbk_rsp {
  569. u8 mac[6];
  570. u16 s0;
  571. u16 s1;
  572. u32 w0;
  573. u8 b0;
  574. u16 s2;
  575. u8 b1;
  576. u32 w1;
  577. };
  578. #endif /* CONFIG_H2CLBK */
  579. /* CMD param Formart for driver extra cmd handler */
  580. struct drvextra_cmd_parm {
  581. int ec_id; /* extra cmd id */
  582. int type; /* Can use this field as the type id or command size */
  583. int size; /* buffer size */
  584. unsigned char *pbuf;
  585. };
  586. /*------------------- Below are used for RF/BB tunning ---------------------*/
  587. struct setantenna_parm {
  588. u8 tx_antset;
  589. u8 rx_antset;
  590. u8 tx_antenna;
  591. u8 rx_antenna;
  592. };
  593. struct enrateadaptive_parm {
  594. u32 en;
  595. };
  596. struct settxagctbl_parm {
  597. u32 txagc[MAX_RATES_LENGTH];
  598. };
  599. struct gettxagctbl_parm {
  600. u32 rsvd;
  601. };
  602. struct gettxagctbl_rsp {
  603. u32 txagc[MAX_RATES_LENGTH];
  604. };
  605. struct setagcctrl_parm {
  606. u32 agcctrl; /* 0: pure hw, 1: fw */
  607. };
  608. struct setssup_parm {
  609. u32 ss_ForceUp[MAX_RATES_LENGTH];
  610. };
  611. struct getssup_parm {
  612. u32 rsvd;
  613. };
  614. struct getssup_rsp {
  615. u8 ss_ForceUp[MAX_RATES_LENGTH];
  616. };
  617. struct setssdlevel_parm {
  618. u8 ss_DLevel[MAX_RATES_LENGTH];
  619. };
  620. struct getssdlevel_parm {
  621. u32 rsvd;
  622. };
  623. struct getssdlevel_rsp {
  624. u8 ss_DLevel[MAX_RATES_LENGTH];
  625. };
  626. struct setssulevel_parm {
  627. u8 ss_ULevel[MAX_RATES_LENGTH];
  628. };
  629. struct getssulevel_parm {
  630. u32 rsvd;
  631. };
  632. struct getssulevel_rsp {
  633. u8 ss_ULevel[MAX_RATES_LENGTH];
  634. };
  635. struct setcountjudge_parm {
  636. u8 count_judge[MAX_RATES_LENGTH];
  637. };
  638. struct getcountjudge_parm {
  639. u32 rsvd;
  640. };
  641. struct getcountjudge_rsp {
  642. u8 count_judge[MAX_RATES_LENGTH];
  643. };
  644. struct setratable_parm {
  645. u8 ss_ForceUp[NumRates];
  646. u8 ss_ULevel[NumRates];
  647. u8 ss_DLevel[NumRates];
  648. u8 count_judge[NumRates];
  649. };
  650. struct getratable_parm {
  651. uint rsvd;
  652. };
  653. struct getratable_rsp {
  654. u8 ss_ForceUp[NumRates];
  655. u8 ss_ULevel[NumRates];
  656. u8 ss_DLevel[NumRates];
  657. u8 count_judge[NumRates];
  658. };
  659. /* to get TX,RX retry count */
  660. struct gettxretrycnt_parm {
  661. unsigned int rsvd;
  662. };
  663. struct gettxretrycnt_rsp {
  664. unsigned long tx_retrycnt;
  665. };
  666. struct getrxretrycnt_parm {
  667. unsigned int rsvd;
  668. };
  669. struct getrxretrycnt_rsp {
  670. unsigned long rx_retrycnt;
  671. };
  672. /* to get BCNOK,BCNERR count */
  673. struct getbcnokcnt_parm {
  674. unsigned int rsvd;
  675. };
  676. struct getbcnokcnt_rsp {
  677. unsigned long bcnokcnt;
  678. };
  679. struct getbcnerrcnt_parm {
  680. unsigned int rsvd;
  681. };
  682. struct getbcnerrcnt_rsp {
  683. unsigned long bcnerrcnt;
  684. };
  685. /* to get current TX power level */
  686. struct getcurtxpwrlevel_parm {
  687. unsigned int rsvd;
  688. };
  689. struct getcurtxpwrlevel_rsp {
  690. unsigned short tx_power;
  691. };
  692. struct setprobereqextraie_parm {
  693. unsigned char e_id;
  694. unsigned char ie_len;
  695. unsigned char ie[0];
  696. };
  697. struct setassocreqextraie_parm {
  698. unsigned char e_id;
  699. unsigned char ie_len;
  700. unsigned char ie[0];
  701. };
  702. struct setproberspextraie_parm {
  703. unsigned char e_id;
  704. unsigned char ie_len;
  705. unsigned char ie[0];
  706. };
  707. struct setassocrspextraie_parm {
  708. unsigned char e_id;
  709. unsigned char ie_len;
  710. unsigned char ie[0];
  711. };
  712. struct addBaReq_parm {
  713. unsigned int tid;
  714. u8 addr[ETH_ALEN];
  715. };
  716. struct addBaRsp_parm {
  717. unsigned int tid;
  718. unsigned int start_seq;
  719. u8 addr[ETH_ALEN];
  720. u8 status;
  721. u8 size;
  722. };
  723. /*H2C Handler index: 46 */
  724. struct set_ch_parm {
  725. u8 ch;
  726. u8 bw;
  727. u8 ch_offset;
  728. };
  729. #ifdef MP_FIRMWARE_OFFLOAD
  730. /*H2C Handler index: 47 */
  731. struct SetTxPower_parm {
  732. u8 TxPower;
  733. };
  734. /*H2C Handler index: 48 */
  735. struct SwitchAntenna_parm {
  736. u16 antenna_tx;
  737. u16 antenna_rx;
  738. /* R_ANTENNA_SELECT_CCK cck_txrx; */
  739. u8 cck_txrx;
  740. };
  741. /*H2C Handler index: 49 */
  742. struct SetCrystalCap_parm {
  743. u32 curr_crystalcap;
  744. };
  745. /*H2C Handler index: 50 */
  746. struct SetSingleCarrierTx_parm {
  747. u8 bStart;
  748. };
  749. /*H2C Handler index: 51 */
  750. struct SetSingleToneTx_parm {
  751. u8 bStart;
  752. u8 curr_rfpath;
  753. };
  754. /*H2C Handler index: 52 */
  755. struct SetCarrierSuppressionTx_parm {
  756. u8 bStart;
  757. u32 curr_rateidx;
  758. };
  759. /*H2C Handler index: 53 */
  760. struct SetContinuousTx_parm {
  761. u8 bStart;
  762. u8 CCK_flag; /*1:CCK 2:OFDM*/
  763. u32 curr_rateidx;
  764. };
  765. /*H2C Handler index: 54 */
  766. struct SwitchBandwidth_parm {
  767. u8 curr_bandwidth;
  768. };
  769. #endif /* MP_FIRMWARE_OFFLOAD */
  770. /*H2C Handler index: 59 */
  771. struct SetChannelPlan_param {
  772. const struct country_chplan *country_ent;
  773. u8 channel_plan;
  774. };
  775. /*H2C Handler index: 60 */
  776. struct LedBlink_param {
  777. PVOID pLed;
  778. };
  779. /*H2C Handler index: 62 */
  780. struct TDLSoption_param {
  781. u8 addr[ETH_ALEN];
  782. u8 option;
  783. };
  784. /*H2C Handler index: 64 */
  785. struct RunInThread_param {
  786. void (*func)(void *);
  787. void *context;
  788. };
  789. #define GEN_CMD_CODE(cmd) cmd ## _CMD_
  790. /*
  791. Result:
  792. 0x00: success
  793. 0x01: sucess, and check Response.
  794. 0x02: cmd ignored due to duplicated sequcne number
  795. 0x03: cmd dropped due to invalid cmd code
  796. 0x04: reserved.
  797. */
  798. #define H2C_RSP_OFFSET 512
  799. #define H2C_SUCCESS 0x00
  800. #define H2C_SUCCESS_RSP 0x01
  801. #define H2C_DUPLICATED 0x02
  802. #define H2C_DROPPED 0x03
  803. #define H2C_PARAMETERS_ERROR 0x04
  804. #define H2C_REJECTED 0x05
  805. #define H2C_CMD_OVERFLOW 0x06
  806. #define H2C_RESERVED 0x07
  807. #define H2C_ENQ_HEAD 0x08
  808. #define H2C_ENQ_HEAD_FAIL 0x09
  809. #define H2C_CMD_FAIL 0x0A
  810. extern u8 rtw_setassocsta_cmd(_adapter *padapter, u8 *mac_addr);
  811. extern u8 rtw_setstandby_cmd(_adapter *padapter, uint action);
  812. void rtw_init_sitesurvey_parm(_adapter *padapter, struct sitesurvey_parm *pparm);
  813. u8 rtw_sitesurvey_cmd(_adapter *padapter, struct sitesurvey_parm *pparm);
  814. u8 rtw_create_ibss_cmd(_adapter *adapter, int flags);
  815. u8 rtw_startbss_cmd(_adapter *adapter, int flags);
  816. #define REQ_CH_NONE -1
  817. #define REQ_BW_NONE -1
  818. #define REQ_BW_ORI -2
  819. #define REQ_OFFSET_NONE -1
  820. u8 rtw_change_bss_chbw_cmd(_adapter *adapter, int flags
  821. , u8 ifbmp, u8 excl_ifbmp, s16 req_ch, s8 req_bw, s8 req_offset);
  822. extern u8 rtw_setphy_cmd(_adapter *padapter, u8 modem, u8 ch);
  823. struct sta_info;
  824. extern u8 rtw_setstakey_cmd(_adapter *padapter, struct sta_info *sta, u8 key_type, bool enqueue);
  825. extern u8 rtw_clearstakey_cmd(_adapter *padapter, struct sta_info *sta, u8 enqueue);
  826. extern u8 rtw_joinbss_cmd(_adapter *padapter, struct wlan_network *pnetwork);
  827. u8 rtw_disassoc_cmd(_adapter *padapter, u32 deauth_timeout_ms, int flags);
  828. extern u8 rtw_setopmode_cmd(_adapter *padapter, NDIS_802_11_NETWORK_INFRASTRUCTURE networktype, u8 flags);
  829. extern u8 rtw_setdatarate_cmd(_adapter *padapter, u8 *rateset);
  830. extern u8 rtw_setbasicrate_cmd(_adapter *padapter, u8 *rateset);
  831. extern u8 rtw_getmacreg_cmd(_adapter *padapter, u8 len, u32 addr);
  832. extern void rtw_usb_catc_trigger_cmd(_adapter *padapter, const char *caller);
  833. extern u8 rtw_setbbreg_cmd(_adapter *padapter, u8 offset, u8 val);
  834. extern u8 rtw_setrfreg_cmd(_adapter *padapter, u8 offset, u32 val);
  835. extern u8 rtw_getbbreg_cmd(_adapter *padapter, u8 offset, u8 *pval);
  836. extern u8 rtw_getrfreg_cmd(_adapter *padapter, u8 offset, u8 *pval);
  837. extern u8 rtw_setrfintfs_cmd(_adapter *padapter, u8 mode);
  838. extern u8 rtw_setrttbl_cmd(_adapter *padapter, struct setratable_parm *prate_table);
  839. extern u8 rtw_getrttbl_cmd(_adapter *padapter, struct getratable_rsp *pval);
  840. extern u8 rtw_gettssi_cmd(_adapter *padapter, u8 offset, u8 *pval);
  841. extern u8 rtw_setfwdig_cmd(_adapter *padapter, u8 type);
  842. extern u8 rtw_setfwra_cmd(_adapter *padapter, u8 type);
  843. extern u8 rtw_addbareq_cmd(_adapter *padapter, u8 tid, u8 *addr);
  844. extern u8 rtw_addbarsp_cmd(_adapter *padapter, u8 *addr, u16 tid, u8 status, u8 size, u16 start_seq);
  845. /* add for CONFIG_IEEE80211W, none 11w also can use */
  846. extern u8 rtw_reset_securitypriv_cmd(_adapter *padapter);
  847. extern u8 rtw_free_assoc_resources_cmd(_adapter *padapter, u8 lock_scanned_queue, int flags);
  848. extern u8 rtw_dynamic_chk_wk_cmd(_adapter *adapter);
  849. u8 rtw_lps_ctrl_wk_cmd(_adapter *padapter, u8 lps_ctrl_type, u8 enqueue);
  850. u8 rtw_dm_in_lps_wk_cmd(_adapter *padapter);
  851. u8 rtw_lps_change_dtim_cmd(_adapter *padapter, u8 dtim);
  852. #if (RATE_ADAPTIVE_SUPPORT == 1)
  853. u8 rtw_rpt_timer_cfg_cmd(_adapter *padapter, u16 minRptTime);
  854. #endif
  855. #ifdef CONFIG_ANTENNA_DIVERSITY
  856. extern u8 rtw_antenna_select_cmd(_adapter *padapter, u8 antenna, u8 enqueue);
  857. #endif
  858. u8 rtw_dm_ra_mask_wk_cmd(_adapter *padapter, u8 *psta);
  859. extern u8 rtw_ps_cmd(_adapter *padapter);
  860. #ifdef CONFIG_DFS
  861. void rtw_dfs_ch_switch_hdl(struct dvobj_priv *dvobj);
  862. #endif
  863. #ifdef CONFIG_AP_MODE
  864. u8 rtw_chk_hi_queue_cmd(_adapter *padapter);
  865. #ifdef CONFIG_DFS_MASTER
  866. u8 rtw_dfs_rd_cmd(_adapter *adapter, bool enqueue);
  867. void rtw_dfs_rd_timer_hdl(void *ctx);
  868. void rtw_dfs_rd_en_decision(_adapter *adapter, u8 mlme_act, u8 excl_ifbmp);
  869. u8 rtw_dfs_rd_en_decision_cmd(_adapter *adapter);
  870. #endif /* CONFIG_DFS_MASTER */
  871. #endif /* CONFIG_AP_MODE */
  872. #ifdef CONFIG_BT_COEXIST
  873. u8 rtw_btinfo_cmd(PADAPTER padapter, u8 *pbuf, u16 length);
  874. #endif
  875. u8 rtw_test_h2c_cmd(_adapter *adapter, u8 *buf, u8 len);
  876. u8 rtw_enable_hw_update_tsf_cmd(_adapter *padapter);
  877. u8 rtw_periodic_tsf_update_end_cmd(_adapter *adapter);
  878. u8 rtw_set_chbw_cmd(_adapter *padapter, u8 ch, u8 bw, u8 ch_offset, u8 flags);
  879. u8 rtw_set_chplan_cmd(_adapter *adapter, int flags, u8 chplan, u8 swconfig);
  880. u8 rtw_set_country_cmd(_adapter *adapter, int flags, const char *country_code, u8 swconfig);
  881. extern u8 rtw_led_blink_cmd(_adapter *padapter, PVOID pLed);
  882. extern u8 rtw_set_csa_cmd(_adapter *adapter);
  883. extern u8 rtw_tdls_cmd(_adapter *padapter, u8 *addr, u8 option);
  884. u8 rtw_mp_cmd(_adapter *adapter, u8 mp_cmd_id, u8 flags);
  885. #ifdef CONFIG_RTW_CUSTOMER_STR
  886. u8 rtw_customer_str_req_cmd(_adapter *adapter);
  887. u8 rtw_customer_str_write_cmd(_adapter *adapter, const u8 *cstr);
  888. #endif
  889. #ifdef CONFIG_FW_C2H_REG
  890. u8 rtw_c2h_reg_wk_cmd(_adapter *adapter, u8 *c2h_evt);
  891. #endif
  892. #ifdef CONFIG_FW_C2H_PKT
  893. u8 rtw_c2h_packet_wk_cmd(_adapter *adapter, u8 *c2h_evt, u16 length);
  894. #endif
  895. #ifdef CONFIG_RTW_REPEATER_SON
  896. #define RSON_SCAN_PROCESS 10
  897. #define RSON_SCAN_DISABLE 11
  898. u8 rtw_rson_scan_wk_cmd(_adapter *adapter, int op);
  899. #endif
  900. u8 rtw_run_in_thread_cmd(PADAPTER padapter, void (*func)(void *), void *context);
  901. u8 session_tracker_chk_cmd(_adapter *adapter, struct sta_info *sta);
  902. u8 session_tracker_add_cmd(_adapter *adapter, struct sta_info *sta, u8 *local_naddr, u8 *local_port, u8 *remote_naddr, u8 *remote_port);
  903. u8 session_tracker_del_cmd(_adapter *adapter, struct sta_info *sta, u8 *local_naddr, u8 *local_port, u8 *remote_naddr, u8 *remote_port);
  904. #if defined(CONFIG_RTW_MESH) && defined(RTW_PER_CMD_SUPPORT_FW)
  905. u8 rtw_req_per_cmd(_adapter * adapter);
  906. #endif
  907. u8 rtw_drvextra_cmd_hdl(_adapter *padapter, unsigned char *pbuf);
  908. extern void rtw_survey_cmd_callback(_adapter *padapter, struct cmd_obj *pcmd);
  909. extern void rtw_disassoc_cmd_callback(_adapter *padapter, struct cmd_obj *pcmd);
  910. extern void rtw_joinbss_cmd_callback(_adapter *padapter, struct cmd_obj *pcmd);
  911. void rtw_create_ibss_post_hdl(_adapter *padapter, int status);
  912. extern void rtw_getbbrfreg_cmdrsp_callback(_adapter *padapter, struct cmd_obj *pcmd);
  913. extern void rtw_readtssi_cmdrsp_callback(_adapter *padapter, struct cmd_obj *pcmd);
  914. extern void rtw_setstaKey_cmdrsp_callback(_adapter *padapter, struct cmd_obj *pcmd);
  915. extern void rtw_setassocsta_cmdrsp_callback(_adapter *padapter, struct cmd_obj *pcmd);
  916. extern void rtw_getrttbl_cmdrsp_callback(_adapter *padapter, struct cmd_obj *pcmd);
  917. extern void rtw_getmacreg_cmdrsp_callback(_adapter *padapter, struct cmd_obj *pcmd);
  918. struct _cmd_callback {
  919. u32 cmd_code;
  920. void (*callback)(_adapter *padapter, struct cmd_obj *cmd);
  921. };
  922. enum rtw_h2c_cmd {
  923. GEN_CMD_CODE(_Read_MACREG) , /*0*/
  924. GEN_CMD_CODE(_Write_MACREG) ,
  925. GEN_CMD_CODE(_Read_BBREG) ,
  926. GEN_CMD_CODE(_Write_BBREG) ,
  927. GEN_CMD_CODE(_Read_RFREG) ,
  928. GEN_CMD_CODE(_Write_RFREG) , /*5*/
  929. GEN_CMD_CODE(_Read_EEPROM) ,
  930. GEN_CMD_CODE(_Write_EEPROM) ,
  931. GEN_CMD_CODE(_Read_EFUSE) ,
  932. GEN_CMD_CODE(_Write_EFUSE) ,
  933. GEN_CMD_CODE(_Read_CAM) , /*10*/
  934. GEN_CMD_CODE(_Write_CAM) ,
  935. GEN_CMD_CODE(_setBCNITV),
  936. GEN_CMD_CODE(_setMBIDCFG),
  937. GEN_CMD_CODE(_JoinBss), /*14*/
  938. GEN_CMD_CODE(_DisConnect) , /*15*/
  939. GEN_CMD_CODE(_CreateBss) ,
  940. GEN_CMD_CODE(_SetOpMode) ,
  941. GEN_CMD_CODE(_SiteSurvey), /*18*/
  942. GEN_CMD_CODE(_SetAuth) ,
  943. GEN_CMD_CODE(_SetKey) , /*20*/
  944. GEN_CMD_CODE(_SetStaKey) ,
  945. GEN_CMD_CODE(_SetAssocSta) ,
  946. GEN_CMD_CODE(_DelAssocSta) ,
  947. GEN_CMD_CODE(_SetStaPwrState) ,
  948. GEN_CMD_CODE(_SetBasicRate) , /*25*/
  949. GEN_CMD_CODE(_GetBasicRate) ,
  950. GEN_CMD_CODE(_SetDataRate) ,
  951. GEN_CMD_CODE(_GetDataRate) ,
  952. GEN_CMD_CODE(_SetPhyInfo) ,
  953. GEN_CMD_CODE(_GetPhyInfo) , /*30*/
  954. GEN_CMD_CODE(_SetPhy) ,
  955. GEN_CMD_CODE(_GetPhy) ,
  956. GEN_CMD_CODE(_readRssi) ,
  957. GEN_CMD_CODE(_readGain) ,
  958. GEN_CMD_CODE(_SetAtim) , /*35*/
  959. GEN_CMD_CODE(_SetPwrMode) ,
  960. GEN_CMD_CODE(_JoinbssRpt),
  961. GEN_CMD_CODE(_SetRaTable) ,
  962. GEN_CMD_CODE(_GetRaTable) ,
  963. GEN_CMD_CODE(_GetCCXReport), /*40*/
  964. GEN_CMD_CODE(_GetDTMReport),
  965. GEN_CMD_CODE(_GetTXRateStatistics),
  966. GEN_CMD_CODE(_SetUsbSuspend),
  967. GEN_CMD_CODE(_SetH2cLbk),
  968. GEN_CMD_CODE(_AddBAReq) , /*45*/
  969. GEN_CMD_CODE(_SetChannel), /*46*/
  970. GEN_CMD_CODE(_SetTxPower),
  971. GEN_CMD_CODE(_SwitchAntenna),
  972. GEN_CMD_CODE(_SetCrystalCap),
  973. GEN_CMD_CODE(_SetSingleCarrierTx), /*50*/
  974. GEN_CMD_CODE(_SetSingleToneTx),/*51*/
  975. GEN_CMD_CODE(_SetCarrierSuppressionTx),
  976. GEN_CMD_CODE(_SetContinuousTx),
  977. GEN_CMD_CODE(_SwitchBandwidth), /*54*/
  978. GEN_CMD_CODE(_TX_Beacon), /*55*/
  979. GEN_CMD_CODE(_Set_MLME_EVT), /*56*/
  980. GEN_CMD_CODE(_Set_Drv_Extra), /*57*/
  981. GEN_CMD_CODE(_Set_H2C_MSG), /*58*/
  982. GEN_CMD_CODE(_SetChannelPlan), /*59*/
  983. GEN_CMD_CODE(_LedBlink), /*60*/
  984. GEN_CMD_CODE(_SetChannelSwitch), /*61*/
  985. GEN_CMD_CODE(_TDLS), /*62*/
  986. GEN_CMD_CODE(_ChkBMCSleepq), /*63*/
  987. GEN_CMD_CODE(_RunInThreadCMD), /*64*/
  988. GEN_CMD_CODE(_AddBARsp) , /*65*/
  989. GEN_CMD_CODE(_RM_POST_EVENT), /*66*/
  990. MAX_H2CCMD
  991. };
  992. #define _GetMACReg_CMD_ _Read_MACREG_CMD_
  993. #define _SetMACReg_CMD_ _Write_MACREG_CMD_
  994. #define _GetBBReg_CMD_ _Read_BBREG_CMD_
  995. #define _SetBBReg_CMD_ _Write_BBREG_CMD_
  996. #define _GetRFReg_CMD_ _Read_RFREG_CMD_
  997. #define _SetRFReg_CMD_ _Write_RFREG_CMD_
  998. #ifdef _RTW_CMD_C_
  999. struct _cmd_callback rtw_cmd_callback[] = {
  1000. {GEN_CMD_CODE(_Read_MACREG), &rtw_getmacreg_cmdrsp_callback}, /*0*/
  1001. {GEN_CMD_CODE(_Write_MACREG), NULL},
  1002. {GEN_CMD_CODE(_Read_BBREG), &rtw_getbbrfreg_cmdrsp_callback},
  1003. {GEN_CMD_CODE(_Write_BBREG), NULL},
  1004. {GEN_CMD_CODE(_Read_RFREG), &rtw_getbbrfreg_cmdrsp_callback},
  1005. {GEN_CMD_CODE(_Write_RFREG), NULL}, /*5*/
  1006. {GEN_CMD_CODE(_Read_EEPROM), NULL},
  1007. {GEN_CMD_CODE(_Write_EEPROM), NULL},
  1008. {GEN_CMD_CODE(_Read_EFUSE), NULL},
  1009. {GEN_CMD_CODE(_Write_EFUSE), NULL},
  1010. {GEN_CMD_CODE(_Read_CAM), NULL}, /*10*/
  1011. {GEN_CMD_CODE(_Write_CAM), NULL},
  1012. {GEN_CMD_CODE(_setBCNITV), NULL},
  1013. {GEN_CMD_CODE(_setMBIDCFG), NULL},
  1014. {GEN_CMD_CODE(_JoinBss), &rtw_joinbss_cmd_callback}, /*14*/
  1015. {GEN_CMD_CODE(_DisConnect), &rtw_disassoc_cmd_callback}, /*15*/
  1016. {GEN_CMD_CODE(_CreateBss), NULL},
  1017. {GEN_CMD_CODE(_SetOpMode), NULL},
  1018. {GEN_CMD_CODE(_SiteSurvey), &rtw_survey_cmd_callback}, /*18*/
  1019. {GEN_CMD_CODE(_SetAuth), NULL},
  1020. {GEN_CMD_CODE(_SetKey), NULL}, /*20*/
  1021. {GEN_CMD_CODE(_SetStaKey), &rtw_setstaKey_cmdrsp_callback},
  1022. {GEN_CMD_CODE(_SetAssocSta), &rtw_setassocsta_cmdrsp_callback},
  1023. {GEN_CMD_CODE(_DelAssocSta), NULL},
  1024. {GEN_CMD_CODE(_SetStaPwrState), NULL},
  1025. {GEN_CMD_CODE(_SetBasicRate), NULL}, /*25*/
  1026. {GEN_CMD_CODE(_GetBasicRate), NULL},
  1027. {GEN_CMD_CODE(_SetDataRate), NULL},
  1028. {GEN_CMD_CODE(_GetDataRate), NULL},
  1029. {GEN_CMD_CODE(_SetPhyInfo), NULL},
  1030. {GEN_CMD_CODE(_GetPhyInfo), NULL}, /*30*/
  1031. {GEN_CMD_CODE(_SetPhy), NULL},
  1032. {GEN_CMD_CODE(_GetPhy), NULL},
  1033. {GEN_CMD_CODE(_readRssi), NULL},
  1034. {GEN_CMD_CODE(_readGain), NULL},
  1035. {GEN_CMD_CODE(_SetAtim), NULL}, /*35*/
  1036. {GEN_CMD_CODE(_SetPwrMode), NULL},
  1037. {GEN_CMD_CODE(_JoinbssRpt), NULL},
  1038. {GEN_CMD_CODE(_SetRaTable), NULL},
  1039. {GEN_CMD_CODE(_GetRaTable) , NULL},
  1040. {GEN_CMD_CODE(_GetCCXReport), NULL}, /*40*/
  1041. {GEN_CMD_CODE(_GetDTMReport), NULL},
  1042. {GEN_CMD_CODE(_GetTXRateStatistics), NULL},
  1043. {GEN_CMD_CODE(_SetUsbSuspend), NULL},
  1044. {GEN_CMD_CODE(_SetH2cLbk), NULL},
  1045. {GEN_CMD_CODE(_AddBAReq), NULL}, /*45*/
  1046. {GEN_CMD_CODE(_SetChannel), NULL}, /*46*/
  1047. {GEN_CMD_CODE(_SetTxPower), NULL},
  1048. {GEN_CMD_CODE(_SwitchAntenna), NULL},
  1049. {GEN_CMD_CODE(_SetCrystalCap), NULL},
  1050. {GEN_CMD_CODE(_SetSingleCarrierTx), NULL}, /*50*/
  1051. {GEN_CMD_CODE(_SetSingleToneTx), NULL}, /*51*/
  1052. {GEN_CMD_CODE(_SetCarrierSuppressionTx), NULL},
  1053. {GEN_CMD_CODE(_SetContinuousTx), NULL},
  1054. {GEN_CMD_CODE(_SwitchBandwidth), NULL}, /*54*/
  1055. {GEN_CMD_CODE(_TX_Beacon), NULL},/*55*/
  1056. {GEN_CMD_CODE(_Set_MLME_EVT), NULL},/*56*/
  1057. {GEN_CMD_CODE(_Set_Drv_Extra), NULL},/*57*/
  1058. {GEN_CMD_CODE(_Set_H2C_MSG), NULL},/*58*/
  1059. {GEN_CMD_CODE(_SetChannelPlan), NULL},/*59*/
  1060. {GEN_CMD_CODE(_LedBlink), NULL},/*60*/
  1061. {GEN_CMD_CODE(_SetChannelSwitch), NULL},/*61*/
  1062. {GEN_CMD_CODE(_TDLS), NULL},/*62*/
  1063. {GEN_CMD_CODE(_ChkBMCSleepq), NULL}, /*63*/
  1064. {GEN_CMD_CODE(_RunInThreadCMD), NULL},/*64*/
  1065. {GEN_CMD_CODE(_AddBARsp), NULL}, /*65*/
  1066. {GEN_CMD_CODE(_RM_POST_EVENT), NULL}, /*66*/
  1067. };
  1068. #endif
  1069. #define CMD_FMT "cmd=%d,%d,%d"
  1070. #define CMD_ARG(cmd) \
  1071. (cmd)->cmdcode, \
  1072. (cmd)->cmdcode == GEN_CMD_CODE(_Set_Drv_Extra) ? ((struct drvextra_cmd_parm *)(cmd)->parmbuf)->ec_id : ((cmd)->cmdcode == GEN_CMD_CODE(_Set_MLME_EVT) ? ((struct C2HEvent_Header *)(cmd)->parmbuf)->ID : 0), \
  1073. (cmd)->cmdcode == GEN_CMD_CODE(_Set_Drv_Extra) ? ((struct drvextra_cmd_parm *)(cmd)->parmbuf)->type : 0
  1074. #endif /* _CMD_H_ */