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