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