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