Ali Bahar | cf3e688 | 2011-09-04 03:14:04 +0800 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
| 3 | * Copyright(c) 2007 - 2010 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 | * Modifications for inclusion into the Linux staging tree are |
| 19 | * Copyright(c) 2010 Larry Finger. All rights reserved. |
| 20 | * |
| 21 | * Contact information: |
| 22 | * WLAN FAE <wlanfae@realtek.com> |
| 23 | * Larry Finger <Larry.Finger@lwfinger.net> |
| 24 | * |
| 25 | ******************************************************************************/ |
Larry Finger | 2865d42 | 2010-08-20 10:15:30 -0500 | [diff] [blame] | 26 | #ifndef __RTL871X_CMD_H_ |
| 27 | #define __RTL871X_CMD_H_ |
| 28 | |
| 29 | #include "wlan_bssdef.h" |
| 30 | #include "rtl871x_rf.h" |
| 31 | #define C2H_MEM_SZ (16*1024) |
| 32 | |
| 33 | #include "osdep_service.h" |
| 34 | #include "ieee80211.h" |
| 35 | |
| 36 | #define FREE_CMDOBJ_SZ 128 |
| 37 | #define MAX_CMDSZ 512 |
| 38 | #define MAX_RSPSZ 512 |
| 39 | #define MAX_EVTSZ 1024 |
| 40 | #define CMDBUFF_ALIGN_SZ 512 |
| 41 | |
| 42 | struct cmd_obj { |
| 43 | u16 cmdcode; |
| 44 | u8 res; |
| 45 | u8 *parmbuf; |
| 46 | u32 cmdsz; |
| 47 | u8 *rsp; |
| 48 | u32 rspsz; |
| 49 | struct list_head list; |
| 50 | }; |
| 51 | |
| 52 | struct cmd_priv { |
| 53 | struct semaphore cmd_queue_sema; |
| 54 | struct semaphore terminate_cmdthread_sema; |
| 55 | struct __queue cmd_queue; |
| 56 | u8 cmd_seq; |
| 57 | u8 *cmd_buf; /*shall be non-paged, and 4 bytes aligned*/ |
| 58 | u8 *cmd_allocated_buf; |
| 59 | u8 *rsp_buf; /*shall be non-paged, and 4 bytes aligned*/ |
| 60 | u8 *rsp_allocated_buf; |
| 61 | u32 cmd_issued_cnt; |
| 62 | u32 cmd_done_cnt; |
| 63 | u32 rsp_cnt; |
| 64 | struct _adapter *padapter; |
| 65 | }; |
| 66 | |
| 67 | struct evt_obj { |
| 68 | u16 evtcode; |
| 69 | u8 res; |
| 70 | u8 *parmbuf; |
| 71 | u32 evtsz; |
| 72 | struct list_head list; |
| 73 | }; |
| 74 | |
| 75 | struct evt_priv { |
| 76 | struct __queue evt_queue; |
| 77 | u8 event_seq; |
| 78 | u8 *evt_buf; /*shall be non-paged, and 4 bytes aligned*/ |
| 79 | u8 *evt_allocated_buf; |
| 80 | u32 evt_done_cnt; |
| 81 | struct tasklet_struct event_tasklet; |
| 82 | }; |
| 83 | |
| 84 | #define init_h2fwcmd_w_parm_no_rsp(pcmd, pparm, code) \ |
| 85 | do {\ |
| 86 | _init_listhead(&pcmd->list);\ |
| 87 | pcmd->cmdcode = code;\ |
| 88 | pcmd->parmbuf = (u8 *)(pparm);\ |
| 89 | pcmd->cmdsz = sizeof(*pparm);\ |
| 90 | pcmd->rsp = NULL;\ |
| 91 | pcmd->rspsz = 0;\ |
| 92 | } while (0) |
| 93 | |
| 94 | u32 r8712_enqueue_cmd(struct cmd_priv *pcmdpriv, struct cmd_obj *obj); |
| 95 | u32 r8712_enqueue_cmd_ex(struct cmd_priv *pcmdpriv, struct cmd_obj *obj); |
| 96 | struct cmd_obj *r8712_dequeue_cmd(struct __queue *queue); |
| 97 | void r8712_free_cmd_obj(struct cmd_obj *pcmd); |
| 98 | int r8712_cmd_thread(void *context); |
| 99 | u32 r8712_init_cmd_priv(struct cmd_priv *pcmdpriv); |
| 100 | void r8712_free_cmd_priv(struct cmd_priv *pcmdpriv); |
| 101 | u32 r8712_init_evt_priv(struct evt_priv *pevtpriv); |
| 102 | void r8712_free_evt_priv(struct evt_priv *pevtpriv); |
| 103 | |
| 104 | enum rtl871x_drvint_cid { |
| 105 | NONE_WK_CID, |
| 106 | WDG_WK_CID, |
| 107 | MAX_WK_CID |
| 108 | }; |
| 109 | |
| 110 | enum RFINTFS { |
| 111 | SWSI, |
| 112 | HWSI, |
| 113 | HWPI, |
| 114 | }; |
| 115 | |
| 116 | /* |
| 117 | * Caller Mode: Infra, Ad-HoC(C) |
| 118 | * Notes: To enter USB suspend mode |
| 119 | * Command Mode |
| 120 | */ |
| 121 | struct usb_suspend_parm { |
| 122 | u32 action; /* 1: sleep, 0:resume */ |
| 123 | }; |
| 124 | |
| 125 | /* |
| 126 | * Caller Mode: Infra, Ad-Hoc |
| 127 | * Notes: To join the specified bss |
| 128 | * Command Event Mode |
| 129 | */ |
| 130 | struct joinbss_parm { |
| 131 | struct ndis_wlan_bssid_ex network; |
| 132 | }; |
| 133 | |
| 134 | /* |
| 135 | * Caller Mode: Infra, Ad-HoC(C) |
| 136 | * Notes: To disconnect the current associated BSS |
| 137 | * Command Mode |
| 138 | */ |
| 139 | struct disconnect_parm { |
| 140 | u32 rsvd; |
| 141 | }; |
| 142 | |
| 143 | /* |
| 144 | * Caller Mode: AP, Ad-HoC(M) |
| 145 | * Notes: To create a BSS |
| 146 | * Command Mode |
| 147 | */ |
| 148 | struct createbss_parm { |
| 149 | struct ndis_wlan_bssid_ex network; |
| 150 | }; |
| 151 | |
| 152 | /* |
| 153 | * Caller Mode: AP, Ad-HoC, Infra |
| 154 | * Notes: To set the NIC mode of RTL8711 |
| 155 | * Command Mode |
| 156 | * The definition of mode: |
| 157 | * |
| 158 | * #define IW_MODE_AUTO 0 // Let the driver decides which AP to join |
| 159 | * #define IW_MODE_ADHOC 1 // Single cell network (Ad-Hoc Clients) |
| 160 | * #define IW_MODE_INFRA 2 // Multi cell network, roaming, .. |
| 161 | * #define IW_MODE_MASTER 3 // Synchronisation master or AP |
| 162 | * #define IW_MODE_REPEAT 4 // Wireless Repeater (forwarder) |
| 163 | * #define IW_MODE_SECOND 5 // Secondary master/repeater (backup) |
| 164 | * #define IW_MODE_MONITOR 6 // Passive monitor (listen only) |
| 165 | */ |
| 166 | struct setopmode_parm { |
| 167 | u8 mode; |
| 168 | u8 rsvd[3]; |
| 169 | }; |
| 170 | |
| 171 | /* |
| 172 | * Caller Mode: AP, Ad-HoC, Infra |
| 173 | * Notes: To ask RTL8711 performing site-survey |
| 174 | * Command-Event Mode |
| 175 | */ |
| 176 | struct sitesurvey_parm { |
| 177 | sint passive_mode; /*active: 1, passive: 0 */ |
| 178 | sint bsslimit; /* 1 ~ 48 */ |
| 179 | sint ss_ssidlen; |
| 180 | u8 ss_ssid[IW_ESSID_MAX_SIZE + 1]; |
| 181 | }; |
| 182 | |
| 183 | /* |
| 184 | * Caller Mode: Any |
| 185 | * Notes: To set the auth type of RTL8711. open/shared/802.1x |
| 186 | * Command Mode |
| 187 | */ |
| 188 | struct setauth_parm { |
| 189 | u8 mode; /*0: legacy open, 1: legacy shared 2: 802.1x*/ |
| 190 | u8 _1x; /*0: PSK, 1: TLS*/ |
| 191 | u8 rsvd[2]; |
| 192 | }; |
| 193 | |
| 194 | /* |
| 195 | * Caller Mode: Infra |
| 196 | * a. algorithm: wep40, wep104, tkip & aes |
| 197 | * b. keytype: grp key/unicast key |
| 198 | * c. key contents |
| 199 | * |
| 200 | * when shared key ==> keyid is the camid |
| 201 | * when 802.1x ==> keyid [0:1] ==> grp key |
| 202 | * when 802.1x ==> keyid > 2 ==> unicast key |
| 203 | */ |
| 204 | struct setkey_parm { |
| 205 | u8 algorithm; /* encryption algorithm, could be none, wep40, |
| 206 | * TKIP, CCMP, wep104 */ |
| 207 | u8 keyid; |
| 208 | u8 grpkey; /* 1: this is the grpkey for 802.1x. |
| 209 | * 0: this is the unicast key for 802.1x */ |
| 210 | u8 key[16]; /* this could be 40 or 104 */ |
| 211 | }; |
| 212 | |
| 213 | /* |
| 214 | * When in AP or Ad-Hoc mode, this is used to |
| 215 | * allocate an sw/hw entry for a newly associated sta. |
| 216 | * Command |
| 217 | * when shared key ==> algorithm/keyid |
| 218 | */ |
| 219 | struct set_stakey_parm { |
| 220 | u8 addr[ETH_ALEN]; |
| 221 | u8 algorithm; |
| 222 | u8 key[16]; |
| 223 | }; |
| 224 | |
| 225 | struct set_stakey_rsp { |
| 226 | u8 addr[ETH_ALEN]; |
| 227 | u8 keyid; |
| 228 | u8 rsvd; |
| 229 | }; |
| 230 | |
| 231 | struct SetMacAddr_param { |
| 232 | u8 MacAddr[ETH_ALEN]; |
| 233 | }; |
| 234 | |
| 235 | /* |
| 236 | Caller Ad-Hoc/AP |
| 237 | |
| 238 | Command -Rsp(AID == CAMID) mode |
| 239 | |
| 240 | This is to force fw to add an sta_data entry per driver's request. |
| 241 | |
| 242 | FW will write an cam entry associated with it. |
| 243 | |
| 244 | */ |
| 245 | struct set_assocsta_parm { |
| 246 | u8 addr[ETH_ALEN]; |
| 247 | }; |
| 248 | |
| 249 | struct set_assocsta_rsp { |
| 250 | u8 cam_id; |
| 251 | u8 rsvd[3]; |
| 252 | }; |
| 253 | |
| 254 | /* |
| 255 | Caller Ad-Hoc/AP |
| 256 | |
| 257 | Command mode |
| 258 | |
| 259 | This is to force fw to del an sta_data entry per driver's request |
| 260 | |
| 261 | FW will invalidate the cam entry associated with it. |
| 262 | |
| 263 | */ |
| 264 | struct del_assocsta_parm { |
| 265 | u8 addr[ETH_ALEN]; |
| 266 | }; |
| 267 | |
| 268 | /* |
| 269 | Caller Mode: AP/Ad-HoC(M) |
| 270 | |
| 271 | Notes: To notify fw that given staid has changed its power state |
| 272 | |
| 273 | Command Mode |
| 274 | |
| 275 | */ |
| 276 | struct setstapwrstate_parm { |
| 277 | u8 staid; |
| 278 | u8 status; |
| 279 | u8 hwaddr[6]; |
| 280 | }; |
| 281 | |
| 282 | /* |
| 283 | Caller Mode: Any |
| 284 | |
| 285 | Notes: To setup the basic rate of RTL8711 |
| 286 | |
| 287 | Command Mode |
| 288 | |
| 289 | */ |
| 290 | struct setbasicrate_parm { |
| 291 | u8 basicrates[NumRates]; |
| 292 | }; |
| 293 | |
| 294 | /* |
| 295 | Caller Mode: Any |
| 296 | |
| 297 | Notes: To read the current basic rate |
| 298 | |
| 299 | Command-Rsp Mode |
| 300 | |
| 301 | */ |
| 302 | struct getbasicrate_parm { |
| 303 | u32 rsvd; |
| 304 | }; |
| 305 | |
| 306 | struct getbasicrate_rsp { |
| 307 | u8 basicrates[NumRates]; |
| 308 | }; |
| 309 | |
| 310 | /* |
| 311 | Caller Mode: Any |
| 312 | |
| 313 | Notes: To setup the data rate of RTL8711 |
| 314 | |
| 315 | Command Mode |
| 316 | |
| 317 | */ |
| 318 | struct setdatarate_parm { |
| 319 | u8 mac_id; |
| 320 | u8 datarates[NumRates]; |
| 321 | }; |
| 322 | |
Ali Bahar | c6dc001 | 2011-09-04 03:14:20 +0800 | [diff] [blame] | 323 | enum _RT_CHANNEL_DOMAIN { |
| 324 | RT_CHANNEL_DOMAIN_FCC = 0, |
| 325 | RT_CHANNEL_DOMAIN_IC = 1, |
| 326 | RT_CHANNEL_DOMAIN_ETSI = 2, |
| 327 | RT_CHANNEL_DOMAIN_SPAIN = 3, |
| 328 | RT_CHANNEL_DOMAIN_FRANCE = 4, |
| 329 | RT_CHANNEL_DOMAIN_MKK = 5, |
| 330 | RT_CHANNEL_DOMAIN_MKK1 = 6, |
| 331 | RT_CHANNEL_DOMAIN_ISRAEL = 7, |
| 332 | RT_CHANNEL_DOMAIN_TELEC = 8, |
| 333 | |
| 334 | /* Be compatible with old channel plan. No good! */ |
| 335 | RT_CHANNEL_DOMAIN_MIC = 9, |
| 336 | RT_CHANNEL_DOMAIN_GLOBAL_DOAMIN = 10, |
| 337 | RT_CHANNEL_DOMAIN_WORLD_WIDE_13 = 11, |
| 338 | RT_CHANNEL_DOMAIN_TELEC_NETGEAR = 12, |
| 339 | |
| 340 | RT_CHANNEL_DOMAIN_NCC = 13, |
| 341 | RT_CHANNEL_DOMAIN_5G = 14, |
| 342 | RT_CHANNEL_DOMAIN_5G_40M = 15, |
| 343 | /*===== Add new channel plan above this line===============*/ |
| 344 | RT_CHANNEL_DOMAIN_MAX, |
| 345 | }; |
| 346 | |
| 347 | |
| 348 | struct SetChannelPlan_param { |
| 349 | enum _RT_CHANNEL_DOMAIN ChannelPlan; |
| 350 | }; |
| 351 | |
Larry Finger | 2865d42 | 2010-08-20 10:15:30 -0500 | [diff] [blame] | 352 | /* |
| 353 | Caller Mode: Any |
| 354 | |
| 355 | Notes: To read the current data rate |
| 356 | |
| 357 | Command-Rsp Mode |
| 358 | |
| 359 | */ |
| 360 | struct getdatarate_parm { |
| 361 | u32 rsvd; |
| 362 | |
| 363 | }; |
| 364 | struct getdatarate_rsp { |
| 365 | u8 datarates[NumRates]; |
| 366 | }; |
| 367 | |
| 368 | |
| 369 | /* |
| 370 | Caller Mode: Any |
| 371 | AP: AP can use the info for the contents of beacon frame |
| 372 | Infra: STA can use the info when sitesurveying |
| 373 | Ad-HoC(M): Like AP |
| 374 | Ad-HoC(C): Like STA |
| 375 | |
| 376 | |
| 377 | Notes: To set the phy capability of the NIC |
| 378 | |
| 379 | Command Mode |
| 380 | |
| 381 | */ |
| 382 | |
| 383 | /* |
| 384 | Caller Mode: Any |
| 385 | |
| 386 | Notes: To set the channel/modem/band |
| 387 | This command will be used when channel/modem/band is changed. |
| 388 | |
| 389 | Command Mode |
| 390 | |
| 391 | */ |
| 392 | /* |
| 393 | Caller Mode: Any |
| 394 | |
| 395 | Notes: To get the current setting of channel/modem/band |
| 396 | |
| 397 | Command-Rsp Mode |
| 398 | |
| 399 | */ |
| 400 | struct getphy_rsp { |
| 401 | u8 rfchannel; |
| 402 | u8 modem; |
| 403 | }; |
| 404 | |
| 405 | struct readBB_parm { |
| 406 | u8 offset; |
| 407 | }; |
| 408 | struct readBB_rsp { |
| 409 | u8 value; |
| 410 | }; |
| 411 | |
| 412 | struct readTSSI_parm { |
| 413 | u8 offset; |
| 414 | }; |
| 415 | struct readTSSI_rsp { |
| 416 | u8 value; |
| 417 | }; |
| 418 | |
| 419 | struct writeBB_parm { |
| 420 | u8 offset; |
| 421 | u8 value; |
| 422 | }; |
| 423 | |
Ali Bahar | c6dc001 | 2011-09-04 03:14:20 +0800 | [diff] [blame] | 424 | struct writePTM_parm { |
| 425 | u8 type; |
| 426 | }; |
| 427 | |
Larry Finger | 2865d42 | 2010-08-20 10:15:30 -0500 | [diff] [blame] | 428 | struct readRF_parm { |
| 429 | u8 offset; |
| 430 | }; |
| 431 | struct readRF_rsp { |
| 432 | u32 value; |
| 433 | }; |
| 434 | |
| 435 | struct writeRF_parm { |
| 436 | u32 offset; |
| 437 | u32 value; |
| 438 | }; |
| 439 | |
| 440 | struct setrfintfs_parm { |
| 441 | u8 rfintfs; |
| 442 | }; |
| 443 | |
| 444 | struct getrfintfs_parm { |
| 445 | u8 rfintfs; |
| 446 | }; |
| 447 | |
| 448 | /* |
| 449 | Notes: This command is used for H2C/C2H loopback testing |
| 450 | |
| 451 | mac[0] == 0 |
| 452 | ==> CMD mode, return H2C_SUCCESS. |
| 453 | The following condition must be ture under CMD mode |
| 454 | mac[1] == mac[4], mac[2] == mac[3], mac[0]=mac[5]= 0; |
| 455 | s0 == 0x1234, s1 == 0xabcd, w0 == 0x78563412, w1 == 0x5aa5def7; |
| 456 | s2 == (b1 << 8 | b0); |
| 457 | |
| 458 | mac[0] == 1 |
| 459 | ==> CMD_RSP mode, return H2C_SUCCESS_RSP |
| 460 | |
| 461 | The rsp layout shall be: |
| 462 | rsp: parm: |
| 463 | mac[0] = mac[5]; |
| 464 | mac[1] = mac[4]; |
| 465 | mac[2] = mac[3]; |
| 466 | mac[3] = mac[2]; |
| 467 | mac[4] = mac[1]; |
| 468 | mac[5] = mac[0]; |
| 469 | s0 = s1; |
| 470 | s1 = swap16(s0); |
| 471 | w0 = swap32(w1); |
| 472 | b0 = b1 |
| 473 | s2 = s0 + s1 |
| 474 | b1 = b0 |
| 475 | w1 = w0 |
| 476 | |
| 477 | mac[0] == 2 |
| 478 | ==> CMD_EVENT mode, return H2C_SUCCESS |
| 479 | The event layout shall be: |
| 480 | event: parm: |
| 481 | mac[0] = mac[5]; |
| 482 | mac[1] = mac[4]; |
| 483 | mac[2] = event's sequence number, starting from 1 to parm's marc[3] |
| 484 | mac[3] = mac[2]; |
| 485 | mac[4] = mac[1]; |
| 486 | mac[5] = mac[0]; |
| 487 | s0 = swap16(s0) - event.mac[2]; |
| 488 | s1 = s1 + event.mac[2]; |
| 489 | w0 = swap32(w0); |
| 490 | b0 = b1 |
| 491 | s2 = s0 + event.mac[2] |
| 492 | b1 = b0 |
| 493 | w1 = swap32(w1) - event.mac[2]; |
| 494 | |
| 495 | parm->mac[3] is the total event counts that host requested. |
| 496 | |
| 497 | |
| 498 | event will be the same with the cmd's param. |
| 499 | |
| 500 | */ |
| 501 | |
| 502 | /* CMD param Formart for DRV INTERNAL CMD HDL*/ |
| 503 | struct drvint_cmd_parm { |
| 504 | int i_cid; /*internal cmd id*/ |
| 505 | int sz; /* buf sz*/ |
| 506 | unsigned char *pbuf; |
| 507 | }; |
| 508 | |
| 509 | /*------------------- Below are used for RF/BB tunning ---------------------*/ |
| 510 | |
| 511 | struct setantenna_parm { |
| 512 | u8 tx_antset; |
| 513 | u8 rx_antset; |
| 514 | u8 tx_antenna; |
| 515 | u8 rx_antenna; |
| 516 | }; |
| 517 | |
| 518 | struct enrateadaptive_parm { |
| 519 | u32 en; |
| 520 | }; |
| 521 | |
| 522 | struct settxagctbl_parm { |
| 523 | u32 txagc[MAX_RATES_LENGTH]; |
| 524 | }; |
| 525 | |
| 526 | struct gettxagctbl_parm { |
| 527 | u32 rsvd; |
| 528 | }; |
| 529 | struct gettxagctbl_rsp { |
| 530 | u32 txagc[MAX_RATES_LENGTH]; |
| 531 | }; |
| 532 | |
| 533 | struct setagcctrl_parm { |
| 534 | u32 agcctrl; /* 0: pure hw, 1: fw */ |
| 535 | }; |
| 536 | |
| 537 | struct setssup_parm { |
| 538 | u32 ss_ForceUp[MAX_RATES_LENGTH]; |
| 539 | }; |
| 540 | |
| 541 | struct getssup_parm { |
| 542 | u32 rsvd; |
| 543 | }; |
| 544 | struct getssup_rsp { |
| 545 | u8 ss_ForceUp[MAX_RATES_LENGTH]; |
| 546 | }; |
| 547 | |
| 548 | struct setssdlevel_parm { |
| 549 | u8 ss_DLevel[MAX_RATES_LENGTH]; |
| 550 | }; |
| 551 | |
| 552 | struct getssdlevel_parm { |
| 553 | u32 rsvd; |
| 554 | }; |
| 555 | struct getssdlevel_rsp { |
| 556 | u8 ss_DLevel[MAX_RATES_LENGTH]; |
| 557 | }; |
| 558 | |
| 559 | struct setssulevel_parm { |
| 560 | u8 ss_ULevel[MAX_RATES_LENGTH]; |
| 561 | }; |
| 562 | |
| 563 | struct getssulevel_parm { |
| 564 | u32 rsvd; |
| 565 | }; |
| 566 | struct getssulevel_rsp { |
| 567 | u8 ss_ULevel[MAX_RATES_LENGTH]; |
| 568 | }; |
| 569 | |
| 570 | struct setcountjudge_parm { |
| 571 | u8 count_judge[MAX_RATES_LENGTH]; |
| 572 | }; |
| 573 | |
| 574 | struct getcountjudge_parm { |
| 575 | u32 rsvd; |
| 576 | }; |
| 577 | |
| 578 | struct getcountjudge_rsp { |
| 579 | u8 count_judge[MAX_RATES_LENGTH]; |
| 580 | }; |
| 581 | |
| 582 | struct setpwrmode_parm { |
| 583 | u8 mode; |
| 584 | u8 flag_low_traffic_en; |
| 585 | u8 flag_lpnav_en; |
| 586 | u8 flag_rf_low_snr_en; |
| 587 | u8 flag_dps_en; /* 1: dps, 0: 32k */ |
| 588 | u8 bcn_rx_en; |
| 589 | u8 bcn_pass_cnt; /* fw report one beacon information to |
| 590 | * driver when it receives bcn_pass_cnt |
| 591 | * beacons. */ |
| 592 | u8 bcn_to; /* beacon TO (ms). ¡§=0¡¨ no limit.*/ |
| 593 | u16 bcn_itv; |
| 594 | u8 app_itv; /* only for VOIP mode. */ |
| 595 | u8 awake_bcn_itv; |
| 596 | u8 smart_ps; |
| 597 | u8 bcn_pass_time; /* unit: 100ms */ |
| 598 | }; |
| 599 | |
| 600 | struct setatim_parm { |
| 601 | u8 op; /*0: add, 1:del*/ |
| 602 | u8 txid; /* id of dest station.*/ |
| 603 | }; |
| 604 | |
| 605 | struct setratable_parm { |
| 606 | u8 ss_ForceUp[NumRates]; |
| 607 | u8 ss_ULevel[NumRates]; |
| 608 | u8 ss_DLevel[NumRates]; |
| 609 | u8 count_judge[NumRates]; |
| 610 | }; |
| 611 | |
| 612 | struct getratable_parm { |
| 613 | uint rsvd; |
| 614 | }; |
| 615 | struct 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*/ |
Javier M. Mellid | 0593758 | 2011-04-02 03:01:49 +0200 | [diff] [blame] | 623 | struct gettxretrycnt_parm { |
Larry Finger | 2865d42 | 2010-08-20 10:15:30 -0500 | [diff] [blame] | 624 | unsigned int rsvd; |
| 625 | }; |
| 626 | |
Javier M. Mellid | 0593758 | 2011-04-02 03:01:49 +0200 | [diff] [blame] | 627 | struct gettxretrycnt_rsp { |
Larry Finger | 2865d42 | 2010-08-20 10:15:30 -0500 | [diff] [blame] | 628 | unsigned long tx_retrycnt; |
| 629 | }; |
| 630 | |
Javier M. Mellid | 0593758 | 2011-04-02 03:01:49 +0200 | [diff] [blame] | 631 | struct getrxretrycnt_parm { |
Larry Finger | 2865d42 | 2010-08-20 10:15:30 -0500 | [diff] [blame] | 632 | unsigned int rsvd; |
| 633 | }; |
| 634 | |
Javier M. Mellid | 0593758 | 2011-04-02 03:01:49 +0200 | [diff] [blame] | 635 | struct getrxretrycnt_rsp { |
Larry Finger | 2865d42 | 2010-08-20 10:15:30 -0500 | [diff] [blame] | 636 | unsigned long rx_retrycnt; |
| 637 | }; |
| 638 | |
| 639 | /*to get BCNOK,BCNERR count*/ |
Javier M. Mellid | 0593758 | 2011-04-02 03:01:49 +0200 | [diff] [blame] | 640 | struct getbcnokcnt_parm { |
Larry Finger | 2865d42 | 2010-08-20 10:15:30 -0500 | [diff] [blame] | 641 | unsigned int rsvd; |
| 642 | }; |
| 643 | |
Javier M. Mellid | 0593758 | 2011-04-02 03:01:49 +0200 | [diff] [blame] | 644 | struct getbcnokcnt_rsp { |
| 645 | unsigned long bcnokcnt; |
Larry Finger | 2865d42 | 2010-08-20 10:15:30 -0500 | [diff] [blame] | 646 | }; |
| 647 | |
Javier M. Mellid | 0593758 | 2011-04-02 03:01:49 +0200 | [diff] [blame] | 648 | struct getbcnerrcnt_parm { |
Larry Finger | 2865d42 | 2010-08-20 10:15:30 -0500 | [diff] [blame] | 649 | unsigned int rsvd; |
| 650 | }; |
Javier M. Mellid | 0593758 | 2011-04-02 03:01:49 +0200 | [diff] [blame] | 651 | struct getbcnerrcnt_rsp { |
Larry Finger | 2865d42 | 2010-08-20 10:15:30 -0500 | [diff] [blame] | 652 | unsigned long bcnerrcnt; |
| 653 | }; |
| 654 | |
| 655 | /* to get current TX power level*/ |
Javier M. Mellid | 0593758 | 2011-04-02 03:01:49 +0200 | [diff] [blame] | 656 | struct getcurtxpwrlevel_parm { |
Larry Finger | 2865d42 | 2010-08-20 10:15:30 -0500 | [diff] [blame] | 657 | unsigned int rsvd; |
| 658 | }; |
| 659 | |
Javier M. Mellid | 0593758 | 2011-04-02 03:01:49 +0200 | [diff] [blame] | 660 | struct getcurtxpwrlevel_rsp { |
Larry Finger | 2865d42 | 2010-08-20 10:15:30 -0500 | [diff] [blame] | 661 | unsigned short tx_power; |
| 662 | }; |
| 663 | |
| 664 | /*dynamic on/off DIG*/ |
Javier M. Mellid | 0593758 | 2011-04-02 03:01:49 +0200 | [diff] [blame] | 665 | struct setdig_parm { |
Larry Finger | 2865d42 | 2010-08-20 10:15:30 -0500 | [diff] [blame] | 666 | unsigned char dig_on; /* 1:on , 0:off */ |
| 667 | }; |
| 668 | |
| 669 | /*dynamic on/off RA*/ |
Javier M. Mellid | 0593758 | 2011-04-02 03:01:49 +0200 | [diff] [blame] | 670 | struct setra_parm { |
Larry Finger | 2865d42 | 2010-08-20 10:15:30 -0500 | [diff] [blame] | 671 | unsigned char ra_on; /* 1:on , 0:off */ |
| 672 | }; |
| 673 | |
| 674 | struct setprobereqextraie_parm { |
| 675 | unsigned char e_id; |
| 676 | unsigned char ie_len; |
| 677 | unsigned char ie[0]; |
| 678 | }; |
| 679 | |
| 680 | struct setassocreqextraie_parm { |
| 681 | unsigned char e_id; |
| 682 | unsigned char ie_len; |
| 683 | unsigned char ie[0]; |
| 684 | }; |
| 685 | |
| 686 | struct setproberspextraie_parm { |
| 687 | unsigned char e_id; |
| 688 | unsigned char ie_len; |
| 689 | unsigned char ie[0]; |
| 690 | }; |
| 691 | |
| 692 | struct setassocrspextraie_parm { |
| 693 | unsigned char e_id; |
| 694 | unsigned char ie_len; |
| 695 | unsigned char ie[0]; |
| 696 | }; |
| 697 | |
| 698 | struct addBaReq_parm { |
| 699 | unsigned int tid; |
| 700 | }; |
| 701 | |
| 702 | /*H2C Handler index: 46 */ |
| 703 | struct SetChannel_parm { |
| 704 | u32 curr_ch; |
| 705 | }; |
| 706 | |
Ali Bahar | c6dc001 | 2011-09-04 03:14:20 +0800 | [diff] [blame] | 707 | /*H2C Handler index: 61 */ |
| 708 | struct DisconnectCtrlEx_param { |
| 709 | /* MAXTIME = (2 * FirstStageTO) + (TryPktCnt * TryPktInterval) */ |
| 710 | unsigned char EnableDrvCtrl; |
| 711 | unsigned char TryPktCnt; |
| 712 | unsigned char TryPktInterval; /* Unit: ms */ |
| 713 | unsigned char rsvd; |
| 714 | unsigned int FirstStageTO; /* Unit: ms */ |
Larry Finger | 2865d42 | 2010-08-20 10:15:30 -0500 | [diff] [blame] | 715 | }; |
| 716 | |
| 717 | #define GEN_CMD_CODE(cmd) cmd ## _CMD_ |
| 718 | |
| 719 | /* |
| 720 | * Result: |
| 721 | * 0x00: success |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 722 | * 0x01: success, and check Response. |
Larry Finger | 2865d42 | 2010-08-20 10:15:30 -0500 | [diff] [blame] | 723 | * 0x02: cmd ignored due to duplicated sequcne number |
| 724 | * 0x03: cmd dropped due to invalid cmd code |
| 725 | * 0x04: reserved. |
| 726 | */ |
| 727 | |
| 728 | #define H2C_RSP_OFFSET 512 |
| 729 | #define H2C_SUCCESS 0x00 |
| 730 | #define H2C_SUCCESS_RSP 0x01 |
| 731 | #define H2C_DUPLICATED 0x02 |
| 732 | #define H2C_DROPPED 0x03 |
| 733 | #define H2C_PARAMETERS_ERROR 0x04 |
| 734 | #define H2C_REJECTED 0x05 |
| 735 | #define H2C_CMD_OVERFLOW 0x06 |
| 736 | #define H2C_RESERVED 0x07 |
| 737 | |
| 738 | u8 r8712_setMacAddr_cmd(struct _adapter *padapter, u8 *mac_addr); |
| 739 | u8 r8712_setassocsta_cmd(struct _adapter *padapter, u8 *mac_addr); |
| 740 | u8 r8712_sitesurvey_cmd(struct _adapter *padapter, |
| 741 | struct ndis_802_11_ssid *pssid); |
| 742 | u8 r8712_createbss_cmd(struct _adapter *padapter); |
| 743 | u8 r8712_setstakey_cmd(struct _adapter *padapter, u8 *psta, u8 unicast_key); |
| 744 | u8 r8712_joinbss_cmd(struct _adapter *padapter, |
| 745 | struct wlan_network *pnetwork); |
| 746 | u8 r8712_disassoc_cmd(struct _adapter *padapter); |
| 747 | u8 r8712_setopmode_cmd(struct _adapter *padapter, |
| 748 | enum NDIS_802_11_NETWORK_INFRASTRUCTURE networktype); |
| 749 | u8 r8712_setdatarate_cmd(struct _adapter *padapter, u8 *rateset); |
Ali Bahar | c6dc001 | 2011-09-04 03:14:20 +0800 | [diff] [blame] | 750 | u8 r8712_set_chplan_cmd(struct _adapter *padapter, int chplan); |
Larry Finger | 2865d42 | 2010-08-20 10:15:30 -0500 | [diff] [blame] | 751 | u8 r8712_setbasicrate_cmd(struct _adapter *padapter, u8 *rateset); |
| 752 | u8 r8712_getrfreg_cmd(struct _adapter *padapter, u8 offset, u8 * pval); |
| 753 | u8 r8712_setrfintfs_cmd(struct _adapter *padapter, u8 mode); |
| 754 | u8 r8712_setrfreg_cmd(struct _adapter *padapter, u8 offset, u32 val); |
| 755 | u8 r8712_setrttbl_cmd(struct _adapter *padapter, |
| 756 | struct setratable_parm *prate_table); |
Ali Bahar | c6dc001 | 2011-09-04 03:14:20 +0800 | [diff] [blame] | 757 | u8 r8712_gettssi_cmd(struct _adapter *padapter, u8 offset, u8 *pval); |
Larry Finger | 2865d42 | 2010-08-20 10:15:30 -0500 | [diff] [blame] | 758 | u8 r8712_setptm_cmd(struct _adapter *padapter, u8 type); |
Ali Bahar | c6dc001 | 2011-09-04 03:14:20 +0800 | [diff] [blame] | 759 | u8 r8712_setfwdig_cmd(struct _adapter *padapter, u8 type); |
| 760 | u8 r8712_setfwra_cmd(struct _adapter *padapter, u8 type); |
Larry Finger | 2865d42 | 2010-08-20 10:15:30 -0500 | [diff] [blame] | 761 | u8 r8712_addbareq_cmd(struct _adapter *padapter, u8 tid); |
| 762 | u8 r8712_wdg_wk_cmd(struct _adapter *padapter); |
| 763 | void r8712_survey_cmd_callback(struct _adapter *padapter, |
| 764 | struct cmd_obj *pcmd); |
| 765 | void r8712_disassoc_cmd_callback(struct _adapter *padapter, |
| 766 | struct cmd_obj *pcmd); |
| 767 | void r8712_joinbss_cmd_callback(struct _adapter *padapter, |
| 768 | struct cmd_obj *pcmd); |
| 769 | void r8712_createbss_cmd_callback(struct _adapter *padapter, |
| 770 | struct cmd_obj *pcmd); |
| 771 | void r8712_getbbrfreg_cmdrsp_callback(struct _adapter *padapter, |
| 772 | struct cmd_obj *pcmd); |
Ali Bahar | f15abb8 | 2011-09-04 03:14:19 +0800 | [diff] [blame] | 773 | void r8712_readtssi_cmdrsp_callback(struct _adapter *padapter, |
| 774 | struct cmd_obj *pcmd); |
Larry Finger | 2865d42 | 2010-08-20 10:15:30 -0500 | [diff] [blame] | 775 | void r8712_setstaKey_cmdrsp_callback(struct _adapter *padapter, |
| 776 | struct cmd_obj *pcmd); |
| 777 | void r8712_setassocsta_cmdrsp_callback(struct _adapter *padapter, |
| 778 | struct cmd_obj *pcmd); |
Ali Bahar | f15abb8 | 2011-09-04 03:14:19 +0800 | [diff] [blame] | 779 | u8 r8712_disconnectCtrlEx_cmd(struct _adapter *adapter, u32 enableDrvCtrl, |
| 780 | u32 tryPktCnt, u32 tryPktInterval, u32 firstStageTO); |
Larry Finger | 2865d42 | 2010-08-20 10:15:30 -0500 | [diff] [blame] | 781 | |
| 782 | struct _cmd_callback { |
| 783 | u32 cmd_code; |
| 784 | void (*callback)(struct _adapter *padapter, struct cmd_obj *cmd); |
| 785 | }; |
| 786 | |
| 787 | #include "rtl8712_cmd.h" |
| 788 | |
| 789 | #endif /* _CMD_H_ */ |
| 790 | |