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