rtw_cmd.h 24 KB

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