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