]> git.karo-electronics.de Git - karo-tx-linux.git/blob - drivers/staging/rtl8723au/include/wifi.h
Merge remote-tracking branches 'asoc/fix/audmux', 'asoc/fix/cs42l52', 'asoc/fix/fsl...
[karo-tx-linux.git] / drivers / staging / rtl8723au / include / wifi.h
1 /******************************************************************************
2  *
3  * Copyright(c) 2007 - 2012 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  ******************************************************************************/
15 #ifndef _WIFI_H_
16 #define _WIFI_H_
17
18 #define P80211CAPTURE_VERSION   0x80211001
19
20 /*  This value is tested by WiFi 11n Test Plan 5.2.3.
21  *  This test verifies the WLAN NIC can update the NAV through sending
22  *  the CTS with large duration.
23  */
24 #define WiFiNavUpperUs          30000   /*  30 ms */
25
26 enum WIFI_FRAME_TYPE {
27         WIFI_MGT_TYPE  =        (0),
28         WIFI_CTRL_TYPE =        (BIT(2)),
29         WIFI_DATA_TYPE =        (BIT(3)),
30         WIFI_QOS_DATA_TYPE      = (BIT(7)|BIT(3)),      /*  QoS Data */
31 };
32
33 enum WIFI_FRAME_SUBTYPE {
34         /*  below is for mgt frame */
35         WIFI_ASSOCREQ = (0 | WIFI_MGT_TYPE),
36         WIFI_ASSOCRSP = (BIT(4) | WIFI_MGT_TYPE),
37         WIFI_REASSOCREQ = (BIT(5) | WIFI_MGT_TYPE),
38         WIFI_REASSOCRSP = (BIT(5) | BIT(4) | WIFI_MGT_TYPE),
39         WIFI_PROBEREQ = (BIT(6) | WIFI_MGT_TYPE),
40         WIFI_PROBERSP = (BIT(6) | BIT(4) | WIFI_MGT_TYPE),
41         WIFI_BEACON = (BIT(7) | WIFI_MGT_TYPE),
42         WIFI_ATIM = (BIT(7) | BIT(4) | WIFI_MGT_TYPE),
43         WIFI_DISASSOC = (BIT(7) | BIT(5) | WIFI_MGT_TYPE),
44         WIFI_AUTH = (BIT(7) | BIT(5) | BIT(4) | WIFI_MGT_TYPE),
45         WIFI_DEAUTH = (BIT(7) | BIT(6) | WIFI_MGT_TYPE),
46         WIFI_ACTION = (BIT(7) | BIT(6) | BIT(4) | WIFI_MGT_TYPE),
47
48         /*  below is for control frame */
49         WIFI_PSPOLL = (BIT(7) | BIT(5) | WIFI_CTRL_TYPE),
50         WIFI_RTS = (BIT(7) | BIT(5) | BIT(4) | WIFI_CTRL_TYPE),
51         WIFI_CTS = (BIT(7) | BIT(6) | WIFI_CTRL_TYPE),
52         WIFI_ACK = (BIT(7) | BIT(6) | BIT(4) | WIFI_CTRL_TYPE),
53         WIFI_CFEND = (BIT(7) | BIT(6) | BIT(5) | WIFI_CTRL_TYPE),
54         WIFI_CFEND_CFACK = (BIT(7) | BIT(6) | BIT(5) | BIT(4) | WIFI_CTRL_TYPE),
55
56         /*  below is for data frame */
57         WIFI_DATA = (0 | WIFI_DATA_TYPE),
58         WIFI_DATA_CFACK = (BIT(4) | WIFI_DATA_TYPE),
59         WIFI_DATA_CFPOLL = (BIT(5) | WIFI_DATA_TYPE),
60         WIFI_DATA_CFACKPOLL = (BIT(5) | BIT(4) | WIFI_DATA_TYPE),
61         WIFI_DATA_NULL = (BIT(6) | WIFI_DATA_TYPE),
62         WIFI_CF_ACK = (BIT(6) | BIT(4) | WIFI_DATA_TYPE),
63         WIFI_CF_POLL = (BIT(6) | BIT(5) | WIFI_DATA_TYPE),
64         WIFI_CF_ACKPOLL = (BIT(6) | BIT(5) | BIT(4) | WIFI_DATA_TYPE),
65         WIFI_QOS_DATA_NULL = (BIT(6) | WIFI_QOS_DATA_TYPE),
66 };
67
68
69 enum WIFI_REG_DOMAIN {
70         DOMAIN_FCC              = 1,
71         DOMAIN_IC               = 2,
72         DOMAIN_ETSI             = 3,
73         DOMAIN_SPAIN            = 4,
74         DOMAIN_FRANCE           = 5,
75         DOMAIN_MKK              = 6,
76         DOMAIN_ISRAEL           = 7,
77         DOMAIN_MKK1             = 8,
78         DOMAIN_MKK2             = 9,
79         DOMAIN_MKK3             = 10,
80         DOMAIN_MAX
81 };
82
83
84 #define SetToDs(pbuf)   \
85         (*(unsigned short *)(pbuf) |= cpu_to_le16(IEEE80211_FCTL_TODS))
86
87 #define SetFrDs(pbuf)   \
88         (*(unsigned short *)(pbuf) |= cpu_to_le16(IEEE80211_FCTL_FROMDS))
89
90 #define get_tofr_ds(pframe)     ((ieee80211_has_tods(pframe) << 1) | \
91                                  ieee80211_has_fromds(pframe))
92
93 #define SetMFrag(pbuf)  \
94         (*(unsigned short *)(pbuf) |= cpu_to_le16(IEEE80211_FCTL_MOREFRAGS))
95
96 #define ClearMFrag(pbuf)        \
97         (*(unsigned short *)(pbuf) &= (~cpu_to_le16(IEEE80211_FCTL_MOREFRAGS)))
98
99 #define SetRetry(pbuf)  \
100         (*(unsigned short *)(pbuf) |= cpu_to_le16(IEEE80211_FCTL_RETRY))
101
102 #define SetPwrMgt(pbuf) \
103         (*(unsigned short *)(pbuf) |= cpu_to_le16(IEEE80211_FCTL_PM))
104
105 #define SetMData(pbuf)  \
106         (*(unsigned short *)(pbuf) |= cpu_to_le16(IEEE80211_FCTL_MOREDATA))
107
108 #define SetPrivacy(pbuf)        \
109         (*(unsigned short *)(pbuf) |= cpu_to_le16(IEEE80211_FCTL_PROTECTED))
110
111 #define SetFrameType(pbuf, type)        \
112         do {    \
113                 *(unsigned short *)(pbuf) &= __constant_cpu_to_le16(~(BIT(3) | BIT(2))); \
114                 *(unsigned short *)(pbuf) |= __constant_cpu_to_le16(type); \
115         } while (0)
116
117 #define SetFrameSubType(pbuf, type) \
118         do {    \
119                 *(unsigned short *)(pbuf) &= cpu_to_le16(~(BIT(7) | BIT(6) | BIT(5) | BIT(4) | BIT(3) | BIT(2))); \
120                 *(unsigned short *)(pbuf) |= cpu_to_le16(type); \
121         } while (0)
122
123 #define GetTupleCache(pbuf)     (cpu_to_le16(*(unsigned short *)((unsigned long)(pbuf) + 22)))
124
125 #define SetFragNum(pbuf, num) \
126         do {    \
127                 *(unsigned short *)((unsigned long)(pbuf) + 22) = \
128                         ((*(unsigned short *)((unsigned long)(pbuf) + 22)) & le16_to_cpu(~(0x000f))) | \
129                         cpu_to_le16(0x0f & (num));     \
130         } while (0)
131
132 #define SetSeqNum(pbuf, num) \
133         do {    \
134                 *(unsigned short *)((unsigned long)(pbuf) + 22) = \
135                         ((*(unsigned short *)((unsigned long)(pbuf) + 22)) & le16_to_cpu((unsigned short)0x000f)) | \
136                         le16_to_cpu((unsigned short)(0xfff0 & (num << 4))); \
137         } while (0)
138
139 #define SetDuration(pbuf, dur) \
140         (*(unsigned short *)((unsigned long)(pbuf) + 2) =               \
141          cpu_to_le16(0xffff & (dur)))
142
143 #define SetPriority(pbuf, tid)  \
144         (*(unsigned short *)(pbuf) |= cpu_to_le16(tid & 0xf))
145
146 #define SetEOSP(pbuf, eosp)     \
147         (*(unsigned short *)(pbuf) |= cpu_to_le16((eosp & 1) << 4))
148
149 #define SetAckpolicy(pbuf, ack) \
150         (*(unsigned short *)(pbuf) |= cpu_to_le16((ack & 3) << 5))
151
152 #define SetAMsdu(pbuf, amsdu)   \
153         (*(unsigned short *)(pbuf) |= cpu_to_le16((amsdu & 1) << 7))
154
155 #define GetAid(pbuf)                                                    \
156         (cpu_to_le16(*(unsigned short *)((unsigned long)(pbuf) + 2)) &  \
157          0x3fff)
158
159 #define GetTid(pbuf)                                                    \
160         (cpu_to_le16(*(unsigned short *)((unsigned long)(pbuf) +        \
161          (((ieee80211_has_tods(pbuf)<<1) |                              \
162          ieee80211_has_fromds(pbuf)) == 3 ? 30 : 24))) & 0x000f)
163
164 static inline unsigned char *get_hdr_bssid(unsigned char *pframe)
165 {
166         unsigned char   *sa;
167         unsigned int    to_fr_ds;
168         struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) pframe;
169
170         to_fr_ds = (ieee80211_has_tods(hdr->frame_control) << 1) |
171                     ieee80211_has_fromds(hdr->frame_control);
172
173         switch (to_fr_ds) {
174         case 0x00:      /*  ToDs=0, FromDs=0 */
175                 sa = hdr->addr3;
176                 break;
177         case 0x01:      /*  ToDs=0, FromDs=1 */
178                 sa = hdr->addr2;
179                 break;
180         case 0x02:      /*  ToDs=1, FromDs=0 */
181                 sa = hdr->addr1;
182                 break;
183         case 0x03:      /*  ToDs=1, FromDs=1 */
184                 sa = hdr->addr1;
185                 break;
186         default:
187                 sa = NULL; /*  */
188                 break;
189         }
190         return sa;
191 }
192
193 /*-----------------------------------------------------------------------------
194                         Below is for the security related definition
195 ------------------------------------------------------------------------------*/
196 #define _RESERVED_FRAME_TYPE_           0
197 #define _SKB_FRAME_TYPE_                2
198 #define _PRE_ALLOCMEM_                  1
199 #define _PRE_ALLOCHDR_                  3
200 #define _PRE_ALLOCLLCHDR_               4
201 #define _PRE_ALLOCICVHDR_               5
202 #define _PRE_ALLOCMICHDR_               6
203
204 #define _SIFSTIME_                                      \
205         ((priv->pmib->dot11BssType.net_work_type & WIRELESS_11A) ? 16 : 10)
206 #define _ACKCTSLNG_                     14      /* 14 bytes long, including crclng */
207 #define _CRCLNG_                        4
208
209 #define _ASOCREQ_IE_OFFSET_             4       /*  excluding wlan_hdr */
210 #define _ASOCRSP_IE_OFFSET_             6
211 #define _REASOCREQ_IE_OFFSET_           10
212 #define _REASOCRSP_IE_OFFSET_           6
213 #define _PROBEREQ_IE_OFFSET_            0
214 #define _PROBERSP_IE_OFFSET_            12
215 #define _AUTH_IE_OFFSET_                6
216 #define _DEAUTH_IE_OFFSET_              0
217 #define _BEACON_IE_OFFSET_              12
218 #define _PUBLIC_ACTION_IE_OFFSET_       8
219
220 #define _FIXED_IE_LENGTH_               _BEACON_IE_OFFSET_
221
222 #define _SSID_IE_                       0
223 #define _SUPPORTEDRATES_IE_             1
224 #define _DSSET_IE_                      3
225 #define _TIM_IE_                        5
226 #define _IBSS_PARA_IE_                  6
227 #define _COUNTRY_IE_                    7
228 #define _CHLGETXT_IE_                   16
229 #define _SUPPORTED_CH_IE_               36
230 #define _CH_SWTICH_ANNOUNCE_    37      /* Secondary Channel Offset */
231 #define _RSN_IE_2_                      48
232 #define _SSN_IE_1_                      221
233 #define _ERPINFO_IE_                    42
234 #define _EXT_SUPPORTEDRATES_IE_         50
235
236 #define _HT_CAPABILITY_IE_              45
237 #define _FTIE_                          55
238 #define _TIMEOUT_ITVL_IE_               56
239 #define _SRC_IE_                        59
240 #define _HT_EXTRA_INFO_IE_              61
241 #define _HT_ADD_INFO_IE_                61 /* _HT_EXTRA_INFO_IE_ */
242
243
244 #define EID_BSSCoexistence              72 /*  20/40 BSS Coexistence */
245 #define EID_BSSIntolerantChlReport      73
246 #define _RIC_Descriptor_IE_             75
247
248 #define _LINK_ID_IE_            101
249 #define _CH_SWITCH_TIMING_      104
250 #define _PTI_BUFFER_STATUS_     106
251 #define _EXT_CAP_IE_            127
252 #define _VENDOR_SPECIFIC_IE_    221
253
254 #define _RESERVED47_            47
255
256 /* ---------------------------------------------------------------------------
257                                         Below is the fixed elements...
258 -----------------------------------------------------------------------------*/
259 #define _AUTH_ALGM_NUM_         2
260 #define _AUTH_SEQ_NUM_          2
261 #define _BEACON_ITERVAL_        2
262 #define _CAPABILITY_            2
263 #define _CURRENT_APADDR_        6
264 #define _LISTEN_INTERVAL_       2
265 #define _ASOC_ID_               2
266 #define _STATUS_CODE_           2
267 #define _TIMESTAMP_             8
268
269 #define AUTH_ODD_TO             0
270 #define AUTH_EVEN_TO            1
271
272 #define WLAN_ETHCONV_ENCAP      1
273 #define WLAN_ETHCONV_RFC1042    2
274 #define WLAN_ETHCONV_8021h      3
275
276 #define cap_ESS         BIT(0)
277 #define cap_IBSS        BIT(1)
278 #define cap_CFPollable  BIT(2)
279 #define cap_CFRequest   BIT(3)
280 #define cap_Privacy     BIT(4)
281 #define cap_ShortPremble BIT(5)
282 #define cap_PBCC        BIT(6)
283 #define cap_ChAgility   BIT(7)
284 #define cap_SpecMgmt    BIT(8)
285 #define cap_QoS         BIT(9)
286 #define cap_ShortSlot   BIT(10)
287
288 /*-----------------------------------------------------------------------------
289                                 Below is the definition for 802.11i / 802.1x
290 ------------------------------------------------------------------------------*/
291 #define _IEEE8021X_MGT_                 1       /*  WPA */
292 #define _IEEE8021X_PSK_                 2       /*  WPA with pre-shared key */
293
294 /*
295 #define _NO_PRIVACY_                    0
296 #define _WEP_40_PRIVACY_                1
297 #define _TKIP_PRIVACY_                  2
298 #define _WRAP_PRIVACY_                  3
299 #define _CCMP_PRIVACY_                  4
300 #define _WEP_104_PRIVACY_               5
301 #define _WEP_WPA_MIXED_PRIVACY_ 6       WEP + WPA
302 */
303
304 /*-----------------------------------------------------------------------------
305                                 Below is the definition for WMM
306 ------------------------------------------------------------------------------*/
307 #define _WMM_IE_Length_                         7  /*  for WMM STA */
308 #define _WMM_Para_Element_Length_               24
309
310
311 /*-----------------------------------------------------------------------------
312                                 Below is the definition for 802.11n
313 ------------------------------------------------------------------------------*/
314
315 #define SetOrderBit(pbuf)                                               \
316         (*(unsigned short *)(pbuf) |= cpu_to_le16(_ORDER_))
317
318 #define GetOrderBit(pbuf)               \
319         (((*(unsigned short *)(pbuf)) & le16_to_cpu(_ORDER_)) != 0)
320
321
322 /* struct rtw_ieee80211_ht_cap - HT additional information
323  *
324  * This structure refers to "HT information element" as
325  * described in 802.11n draft section 7.3.2.53
326  */
327 struct ieee80211_ht_addt_info {
328         unsigned char   control_chan;
329         unsigned char   ht_param;
330         unsigned short  operation_mode;
331         unsigned short  stbc_param;
332         unsigned char   basic_set[16];
333 } __packed;
334
335 struct HT_caps_element {
336         union {
337                 struct {
338                         unsigned short  HT_caps_info;
339                         unsigned char   AMPDU_para;
340                         unsigned char   MCS_rate[16];
341                         unsigned short  HT_ext_caps;
342                         unsigned int    Beamforming_caps;
343                         unsigned char   ASEL_caps;
344                 } HT_cap_element;
345                 unsigned char HT_cap[26];
346         } u;
347 } __packed;
348
349 struct HT_info_element {
350         unsigned char   primary_channel;
351         unsigned char   infos[5];
352         unsigned char   MCS_rate[16];
353 }  __packed;
354
355 struct AC_param {
356         unsigned char           ACI_AIFSN;
357         unsigned char           CW;
358         unsigned short  TXOP_limit;
359 }  __packed;
360
361 struct WMM_para_element {
362         unsigned char           QoS_info;
363         unsigned char           reserved;
364         struct AC_param ac_param[4];
365 }  __packed;
366
367 struct ADDBA_request {
368         unsigned char           dialog_token;
369         unsigned short  BA_para_set;
370         unsigned short  BA_timeout_value;
371         unsigned short  BA_starting_seqctrl;
372 }  __packed;
373
374
375 #define OP_MODE_PURE                    0
376 #define OP_MODE_MAY_BE_LEGACY_STAS      1
377 #define OP_MODE_20MHZ_HT_STA_ASSOCED    2
378 #define OP_MODE_MIXED                   3
379
380 #define HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK        ((u8) BIT(0) | BIT(1))
381 #define HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE           ((u8) BIT(0))
382 #define HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW           ((u8) BIT(0) | BIT(1))
383 #define HT_INFO_HT_PARAM_REC_TRANS_CHNL_WIDTH           ((u8) BIT(2))
384 #define HT_INFO_HT_PARAM_RIFS_MODE                      ((u8) BIT(3))
385 #define HT_INFO_HT_PARAM_CTRL_ACCESS_ONLY               ((u8) BIT(4))
386 #define HT_INFO_HT_PARAM_SRV_INTERVAL_GRANULARITY       ((u8) BIT(5))
387
388 #define HT_INFO_OPERATION_MODE_OP_MODE_MASK     \
389                 ((u16) (0x0001 | 0x0002))
390 #define HT_INFO_OPERATION_MODE_OP_MODE_OFFSET           0
391 #define HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT      ((u8) BIT(2))
392 #define HT_INFO_OPERATION_MODE_TRANSMIT_BURST_LIMIT     ((u8) BIT(3))
393 #define HT_INFO_OPERATION_MODE_NON_HT_STA_PRESENT       ((u8) BIT(4))
394
395 #define HT_INFO_STBC_PARAM_DUAL_BEACON          ((u16) BIT(6))
396 #define HT_INFO_STBC_PARAM_DUAL_STBC_PROTECT    ((u16) BIT(7))
397 #define HT_INFO_STBC_PARAM_SECONDARY_BCN        ((u16) BIT(8))
398 #define HT_INFO_STBC_PARAM_LSIG_TXOP_PROTECT_ALLOWED    ((u16) BIT(9))
399 #define HT_INFO_STBC_PARAM_PCO_ACTIVE           ((u16) BIT(10))
400 #define HT_INFO_STBC_PARAM_PCO_PHASE            ((u16) BIT(11))
401
402
403
404 /*      ===============WPS Section=============== */
405 /*      For WPSv1.0 */
406 #define WPSOUI                                  0x0050f204
407 /*      WPS attribute ID */
408 #define WPS_ATTR_VER1                           0x104A
409 #define WPS_ATTR_SIMPLE_CONF_STATE              0x1044
410 #define WPS_ATTR_RESP_TYPE                      0x103B
411 #define WPS_ATTR_UUID_E                         0x1047
412 #define WPS_ATTR_MANUFACTURER                   0x1021
413 #define WPS_ATTR_MODEL_NAME                     0x1023
414 #define WPS_ATTR_MODEL_NUMBER                   0x1024
415 #define WPS_ATTR_SERIAL_NUMBER                  0x1042
416 #define WPS_ATTR_PRIMARY_DEV_TYPE               0x1054
417 #define WPS_ATTR_SEC_DEV_TYPE_LIST              0x1055
418 #define WPS_ATTR_DEVICE_NAME                    0x1011
419 #define WPS_ATTR_CONF_METHOD                    0x1008
420 #define WPS_ATTR_RF_BANDS                       0x103C
421 #define WPS_ATTR_DEVICE_PWID                    0x1012
422 #define WPS_ATTR_REQUEST_TYPE                   0x103A
423 #define WPS_ATTR_ASSOCIATION_STATE              0x1002
424 #define WPS_ATTR_CONFIG_ERROR                   0x1009
425 #define WPS_ATTR_VENDOR_EXT                     0x1049
426 #define WPS_ATTR_SELECTED_REGISTRAR             0x1041
427
428 /*      Value of WPS attribute "WPS_ATTR_DEVICE_NAME */
429 #define WPS_MAX_DEVICE_NAME_LEN                 32
430
431 /*      Value of WPS Request Type Attribute */
432 #define WPS_REQ_TYPE_ENROLLEE_INFO_ONLY         0x00
433 #define WPS_REQ_TYPE_ENROLLEE_OPEN_8021X        0x01
434 #define WPS_REQ_TYPE_REGISTRAR                  0x02
435 #define WPS_REQ_TYPE_WLAN_MANAGER_REGISTRAR     0x03
436
437 /*      Value of WPS Response Type Attribute */
438 #define WPS_RESPONSE_TYPE_INFO_ONLY             0x00
439 #define WPS_RESPONSE_TYPE_8021X                 0x01
440 #define WPS_RESPONSE_TYPE_REGISTRAR             0x02
441 #define WPS_RESPONSE_TYPE_AP                    0x03
442
443 /*      Value of WPS WiFi Simple Configuration State Attribute */
444 #define WPS_WSC_STATE_NOT_CONFIG                0x01
445 #define WPS_WSC_STATE_CONFIG                    0x02
446
447 /*      Value of WPS Version Attribute */
448 #define WPS_VERSION_1                           0x10
449
450 /*      Value of WPS Configuration Method Attribute */
451 #define WPS_CONFIG_METHOD_FLASH                 0x0001
452 #define WPS_CONFIG_METHOD_ETHERNET              0x0002
453 #define WPS_CONFIG_METHOD_LABEL                 0x0004
454 #define WPS_CONFIG_METHOD_DISPLAY               0x0008
455 #define WPS_CONFIG_METHOD_E_NFC                 0x0010
456 #define WPS_CONFIG_METHOD_I_NFC                 0x0020
457 #define WPS_CONFIG_METHOD_NFC                   0x0040
458 #define WPS_CONFIG_METHOD_PBC                   0x0080
459 #define WPS_CONFIG_METHOD_KEYPAD                0x0100
460 #define WPS_CONFIG_METHOD_VPBC                  0x0280
461 #define WPS_CONFIG_METHOD_PPBC                  0x0480
462 #define WPS_CONFIG_METHOD_VDISPLAY              0x2008
463 #define WPS_CONFIG_METHOD_PDISPLAY              0x4008
464
465 /*      Value of Category ID of WPS Primary Device Type Attribute */
466 #define WPS_PDT_CID_DISPLAYS                    0x0007
467 #define WPS_PDT_CID_MULIT_MEDIA                 0x0008
468 #define WPS_PDT_CID_RTK_WIDI                    WPS_PDT_CID_MULIT_MEDIA
469
470 /*      Value of Sub Category ID of WPS Primary Device Type Attribute */
471 #define WPS_PDT_SCID_MEDIA_SERVER               0x0005
472 #define WPS_PDT_SCID_RTK_DMP                    WPS_PDT_SCID_MEDIA_SERVER
473
474 /*      Value of Device Password ID */
475 #define WPS_DPID_PIN                            0x0000
476 #define WPS_DPID_USER_SPEC                      0x0001
477 #define WPS_DPID_MACHINE_SPEC                   0x0002
478 #define WPS_DPID_REKEY                          0x0003
479 #define WPS_DPID_PBC                            0x0004
480 #define WPS_DPID_REGISTRAR_SPEC                 0x0005
481
482 /*      Value of WPS RF Bands Attribute */
483 #define WPS_RF_BANDS_2_4_GHZ                    0x01
484 #define WPS_RF_BANDS_5_GHZ                      0x02
485
486 /*      Value of WPS Association State Attribute */
487 #define WPS_ASSOC_STATE_NOT_ASSOCIATED          0x00
488 #define WPS_ASSOC_STATE_CONNECTION_SUCCESS      0x01
489 #define WPS_ASSOC_STATE_CONFIGURATION_FAILURE   0x02
490 #define WPS_ASSOC_STATE_ASSOCIATION_FAILURE     0x03
491 #define WPS_ASSOC_STATE_IP_FAILURE              0x04
492
493 /*      =====================P2P Section===================== */
494 /*      For P2P */
495 #define P2POUI                                  0x506F9A09
496
497 /*      P2P Attribute ID */
498 #define P2P_ATTR_STATUS                         0x00
499 #define P2P_ATTR_MINOR_REASON_CODE              0x01
500 #define P2P_ATTR_CAPABILITY                     0x02
501 #define P2P_ATTR_DEVICE_ID                      0x03
502 #define P2P_ATTR_GO_INTENT                      0x04
503 #define P2P_ATTR_CONF_TIMEOUT                   0x05
504 #define P2P_ATTR_LISTEN_CH                      0x06
505 #define P2P_ATTR_GROUP_BSSID                    0x07
506 #define P2P_ATTR_EX_LISTEN_TIMING               0x08
507 #define P2P_ATTR_INTENTED_IF_ADDR               0x09
508 #define P2P_ATTR_MANAGEABILITY                  0x0A
509 #define P2P_ATTR_CH_LIST                        0x0B
510 #define P2P_ATTR_NOA                            0x0C
511 #define P2P_ATTR_DEVICE_INFO                    0x0D
512 #define P2P_ATTR_GROUP_INFO                     0x0E
513 #define P2P_ATTR_GROUP_ID                       0x0F
514 #define P2P_ATTR_INTERFACE                      0x10
515 #define P2P_ATTR_OPERATING_CH                   0x11
516 #define P2P_ATTR_INVITATION_FLAGS               0x12
517
518 /*      Value of Status Attribute */
519 #define P2P_STATUS_SUCCESS                      0x00
520 #define P2P_STATUS_FAIL_INFO_UNAVAILABLE        0x01
521 #define P2P_STATUS_FAIL_INCOMPATIBLE_PARAM      0x02
522 #define P2P_STATUS_FAIL_LIMIT_REACHED           0x03
523 #define P2P_STATUS_FAIL_INVALID_PARAM           0x04
524 #define P2P_STATUS_FAIL_REQUEST_UNABLE          0x05
525 #define P2P_STATUS_FAIL_PREVOUS_PROTO_ERR       0x06
526 #define P2P_STATUS_FAIL_NO_COMMON_CH            0x07
527 #define P2P_STATUS_FAIL_UNKNOWN_P2PGROUP        0x08
528 #define P2P_STATUS_FAIL_BOTH_GOINTENT_15        0x09
529 #define P2P_STATUS_FAIL_INCOMPATIBLE_PROVSION   0x0A
530 #define P2P_STATUS_FAIL_USER_REJECT             0x0B
531
532 /*      Value of Inviation Flags Attribute */
533 #define P2P_INVITATION_FLAGS_PERSISTENT         BIT(0)
534
535 #define DMP_P2P_DEVCAP_SUPPORT  (P2P_DEVCAP_SERVICE_DISCOVERY | \
536                                  P2P_DEVCAP_CLIENT_DISCOVERABILITY | \
537                                  P2P_DEVCAP_CONCURRENT_OPERATION | \
538                                  P2P_DEVCAP_INVITATION_PROC)
539
540 #define DMP_P2P_GRPCAP_SUPPORT  (P2P_GRPCAP_INTRABSS)
541
542 /*      Value of Device Capability Bitmap */
543 #define P2P_DEVCAP_SERVICE_DISCOVERY            BIT(0)
544 #define P2P_DEVCAP_CLIENT_DISCOVERABILITY       BIT(1)
545 #define P2P_DEVCAP_CONCURRENT_OPERATION         BIT(2)
546 #define P2P_DEVCAP_INFRA_MANAGED                BIT(3)
547 #define P2P_DEVCAP_DEVICE_LIMIT                 BIT(4)
548 #define P2P_DEVCAP_INVITATION_PROC              BIT(5)
549
550 /*      Value of Group Capability Bitmap */
551 #define P2P_GRPCAP_GO                           BIT(0)
552 #define P2P_GRPCAP_PERSISTENT_GROUP             BIT(1)
553 #define P2P_GRPCAP_GROUP_LIMIT                  BIT(2)
554 #define P2P_GRPCAP_INTRABSS                     BIT(3)
555 #define P2P_GRPCAP_CROSS_CONN                   BIT(4)
556 #define P2P_GRPCAP_PERSISTENT_RECONN            BIT(5)
557 #define P2P_GRPCAP_GROUP_FORMATION              BIT(6)
558
559 /*      P2P Public Action Frame ( Management Frame ) */
560 #define P2P_PUB_ACTION_ACTION                   0x09
561
562 /*      P2P Public Action Frame Type */
563 #define P2P_GO_NEGO_REQ                         0
564 #define P2P_GO_NEGO_RESP                        1
565 #define P2P_GO_NEGO_CONF                        2
566 #define P2P_INVIT_REQ                           3
567 #define P2P_INVIT_RESP                          4
568 #define P2P_DEVDISC_REQ                         5
569 #define P2P_DEVDISC_RESP                        6
570 #define P2P_PROVISION_DISC_REQ                  7
571 #define P2P_PROVISION_DISC_RESP                 8
572
573 /*      P2P Action Frame Type */
574 #define P2P_NOTICE_OF_ABSENCE                   0
575 #define P2P_PRESENCE_REQUEST                    1
576 #define P2P_PRESENCE_RESPONSE                   2
577 #define P2P_GO_DISC_REQUEST                     3
578
579
580 #define P2P_MAX_PERSISTENT_GROUP_NUM            10
581
582 #define P2P_PROVISIONING_SCAN_CNT               3
583
584 #define P2P_WILDCARD_SSID_LEN                   7
585
586 #define P2P_FINDPHASE_EX_NONE                   0       /*  default value, used when: (1)p2p disabed or (2)p2p enabled but only do 1 scan phase */
587 #define P2P_FINDPHASE_EX_FULL                   1       /*  used when p2p enabled and want to do 1 scan phase and P2P_FINDPHASE_EX_MAX-1 find phase */
588 #define P2P_FINDPHASE_EX_SOCIAL_FIRST           (P2P_FINDPHASE_EX_FULL+1)
589 #define P2P_FINDPHASE_EX_MAX                                    4
590 #define P2P_FINDPHASE_EX_SOCIAL_LAST            P2P_FINDPHASE_EX_MAX
591
592 #define P2P_PROVISION_TIMEOUT                   5000    /*5 sec timeout for sending the provision discovery request */
593 #define P2P_CONCURRENT_PROVISION_TIMEOUT        3000    /*3 sec timeout for sending the provision discovery request under concurrent mode */
594 #define P2P_GO_NEGO_TIMEOUT                     5000    /*5 sec timeout for receiving the group negotation response */
595 #define P2P_CONCURRENT_GO_NEGO_TIMEOUT          3000    /*3 sec timeout for sending the negotiation request under concurrent mode */
596 #define P2P_TX_PRESCAN_TIMEOUT                  100     /*100ms */
597 #define P2P_INVITE_TIMEOUT                      5000    /*5 sec timeout for sending the invitation request */
598 #define P2P_CONCURRENT_INVITE_TIMEOUT           3000    /*3 sec timeout for sending the invitation request under concurrent mode */
599 #define P2P_RESET_SCAN_CH                       25000   /*25 sec t/o to reset the scan channel ( based on channel plan ) */
600 #define P2P_MAX_INTENT                          15
601
602 #define P2P_MAX_NOA_NUM                         2
603
604 /*      WPS Configuration Method */
605 #define WPS_CM_NONE                                     0x0000
606 #define WPS_CM_LABEL                                    0x0004
607 #define WPS_CM_DISPLYA                                  0x0008
608 #define WPS_CM_EXTERNAL_NFC_TOKEN                       0x0010
609 #define WPS_CM_INTEGRATED_NFC_TOKEN                     0x0020
610 #define WPS_CM_NFC_INTERFACE                            0x0040
611 #define WPS_CM_PUSH_BUTTON                              0x0080
612 #define WPS_CM_KEYPAD                                   0x0100
613 #define WPS_CM_SW_PUHS_BUTTON                           0x0280
614 #define WPS_CM_HW_PUHS_BUTTON                           0x0480
615 #define WPS_CM_SW_DISPLAY_PIN                           0x2008
616 #define WPS_CM_LCD_DISPLAY_PIN                          0x4008
617
618 enum P2P_ROLE {
619         P2P_ROLE_DISABLE = 0,
620         P2P_ROLE_DEVICE = 1,
621         P2P_ROLE_CLIENT = 2,
622         P2P_ROLE_GO = 3
623 };
624
625 enum P2P_STATE {
626         P2P_STATE_NONE = 0,                     /*P2P disable */
627         P2P_STATE_IDLE = 1,                     /*P2P had enabled and do nothing */
628         P2P_STATE_LISTEN = 2,                   /*In pure listen state */
629         P2P_STATE_SCAN = 3,                     /*In scan phase */
630         P2P_STATE_FIND_PHASE_LISTEN = 4,        /*In the listen state of find phase */
631         P2P_STATE_FIND_PHASE_SEARCH = 5,        /*In the search state of find phase */
632         P2P_STATE_TX_PROVISION_DIS_REQ = 6,     /*In P2P provisioning discovery */
633         P2P_STATE_RX_PROVISION_DIS_RSP = 7,
634         P2P_STATE_RX_PROVISION_DIS_REQ = 8,
635         P2P_STATE_GONEGO_ING = 9,               /*Doing the group owner negoitation handshake */
636         P2P_STATE_GONEGO_OK = 10,               /*finish the group negoitation handshake with success */
637         P2P_STATE_GONEGO_FAIL = 11,             /*finish the group negoitation handshake with failure */
638         P2P_STATE_RECV_INVITE_REQ_MATCH = 12,   /*receiving the P2P Inviation request and match with the profile. */
639         P2P_STATE_PROVISIONING_ING = 13,        /*Doing the P2P WPS */
640         P2P_STATE_PROVISIONING_DONE = 14,       /*Finish the P2P WPS */
641         P2P_STATE_TX_INVITE_REQ = 15,           /*Transmit the P2P Invitation request */
642         P2P_STATE_RX_INVITE_RESP_OK = 16,       /*Receiving the P2P Invitation response */
643         P2P_STATE_RECV_INVITE_REQ_DISMATCH = 17,/*receiving the P2P Inviation request and dismatch with the profile. */
644         P2P_STATE_RECV_INVITE_REQ_GO = 18,      /*receiving the P2P Inviation request and this wifi is GO. */
645         P2P_STATE_RECV_INVITE_REQ_JOIN = 19,    /*receiving the P2P Inviation request to join an existing P2P Group. */
646         P2P_STATE_RX_INVITE_RESP_FAIL = 20,     /*receiving the P2P Inviation response with failure */
647         P2P_STATE_RX_INFOR_NOREADY = 21,        /*receiving p2p negotiation response with information is not available */
648         P2P_STATE_TX_INFOR_NOREADY = 22,        /*sending p2p negotiation response with information is not available */
649 };
650
651 enum P2P_WPSINFO {
652         P2P_NO_WPSINFO                          = 0,
653         P2P_GOT_WPSINFO_PEER_DISPLAY_PIN        = 1,
654         P2P_GOT_WPSINFO_SELF_DISPLAY_PIN        = 2,
655         P2P_GOT_WPSINFO_PBC                     = 3,
656 };
657
658 #define P2P_PRIVATE_IOCTL_SET_LEN               64
659
660 enum P2P_PROTO_WK_ID {
661         P2P_FIND_PHASE_WK = 0,
662         P2P_RESTORE_STATE_WK = 1,
663         P2P_PRE_TX_PROVDISC_PROCESS_WK = 2,
664         P2P_PRE_TX_NEGOREQ_PROCESS_WK = 3,
665         P2P_PRE_TX_INVITEREQ_PROCESS_WK = 4,
666         P2P_AP_P2P_CH_SWITCH_PROCESS_WK = 5,
667         P2P_RO_CH_WK = 6,
668 };
669
670 #ifdef CONFIG_8723AU_P2P
671 enum P2P_PS_STATE {
672         P2P_PS_DISABLE = 0,
673         P2P_PS_ENABLE = 1,
674         P2P_PS_SCAN = 2,
675         P2P_PS_SCAN_DONE = 3,
676         P2P_PS_ALLSTASLEEP = 4, /*  for P2P GO */
677 };
678
679 enum P2P_PS_MODE {
680         P2P_PS_NONE = 0,
681         P2P_PS_CTWINDOW = 1,
682         P2P_PS_NOA       = 2,
683         P2P_PS_MIX = 3, /*  CTWindow and NoA */
684 };
685 #endif /*  CONFIG_8723AU_P2P */
686
687 /*      =====================WFD Section===================== */
688 /*      For Wi-Fi Display */
689 #define WFD_ATTR_DEVICE_INFO                    0x00
690 #define WFD_ATTR_ASSOC_BSSID                    0x01
691 #define WFD_ATTR_COUPLED_SINK_INFO      0x06
692 #define WFD_ATTR_LOCAL_IP_ADDR          0x08
693 #define WFD_ATTR_SESSION_INFO           0x09
694 #define WFD_ATTR_ALTER_MAC                      0x0a
695
696 /*      For WFD Device Information Attribute */
697 #define WFD_DEVINFO_SOURCE                                      0x0000
698 #define WFD_DEVINFO_PSINK                                       0x0001
699 #define WFD_DEVINFO_SSINK                                       0x0002
700 #define WFD_DEVINFO_DUAL                                        0x0003
701
702 #define WFD_DEVINFO_SESSION_AVAIL                       0x0010
703 #define WFD_DEVINFO_WSD                                         0x0040
704 #define WFD_DEVINFO_PC_TDLS                                     0x0080
705 #define WFD_DEVINFO_HDCP_SUPPORT                        0x0100
706
707 #endif /*  _WIFI_H_ */