1 /*
2  * Copyright 2022, Cypress Semiconductor Corporation (an Infineon company)
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 /** @file whd_types.h
19  *  Defines common data types used with WHD
20  *
21  */
22 
23 #include <stdint.h>
24 
25 #include "cybsp.h"
26 #include "cy_result.h"
27 #include "cyhal_hw_types.h"
28 
29 #ifndef INCLUDED_WHD_TYPES_H_
30 #define INCLUDED_WHD_TYPES_H_
31 
32 #ifdef __cplusplus
33 extern "C"
34 {
35 #endif
36 
37 /******************************************************
38 *                      Macros
39 ******************************************************/
40 #define SSID_NAME_SIZE           (32)  /**< SSID Length */
41 
42 #define WEP_ENABLED            0x0001  /**< Flag to enable WEP Security        */
43 #define TKIP_ENABLED           0x0002  /**< Flag to enable TKIP Encryption     */
44 #define AES_ENABLED            0x0004  /**< Flag to enable AES Encryption      */
45 #define SHARED_ENABLED     0x00008000  /**< Flag to enable Shared key Security */
46 #define WPA_SECURITY       0x00200000  /**< Flag to enable WPA Security        */
47 #define WPA2_SECURITY      0x00400000  /**< Flag to enable WPA2 Security       */
48 #define WPA3_SECURITY      0x01000000  /**< Flag to enable WPA3 PSK Security   */
49 #define SECURITY_MASK      (WEP_ENABLED | TKIP_ENABLED | AES_ENABLED) /**< Flag to Security mask */
50 
51 #define ENTERPRISE_ENABLED 0x02000000  /**< Flag to enable Enterprise Security */
52 #define WPS_ENABLED        0x10000000  /**< Flag to enable WPS Security        */
53 #define IBSS_ENABLED       0x20000000  /**< Flag to enable IBSS mode           */
54 #define FBT_ENABLED        0x40000000  /**< Flag to enable FBT                 */
55 
56 #define PM1_POWERSAVE_MODE          (1) /**< Powersave mode on specified interface without regard for throughput reduction */
57 #define PM2_POWERSAVE_MODE          (2) /**< Powersave mode on specified interface with High throughput */
58 #define NO_POWERSAVE_MODE           (0) /**< No Powersave mode */
59 
60 #define PMKID_LEN                   (16) /**< PMKID LENGTH */
61 
62 /**
63  * Suppress unused parameter warning
64  */
65 #ifndef UNUSED_PARAMETER
66 #define UNUSED_PARAMETER(x) ( (void)(x) )
67 #endif
68 
69 /**
70  * Suppress unused variable warning
71  */
72 #ifndef UNUSED_VARIABLE
73 #define UNUSED_VARIABLE(x) ( (void)(x) )
74 #endif
75 
76 /**
77  * Suppress unused variable warning occurring due to an assert which is disabled in release mode
78  */
79 #ifndef REFERENCE_DEBUG_ONLY_VARIABLE
80 #define REFERENCE_DEBUG_ONLY_VARIABLE(x) ( (void)(x) )
81 #endif
82 
83 /******************************************************
84 *@cond               Type Definitions
85 ******************************************************/
86 typedef void *whd_buffer_t;
87 typedef struct wl_bss_info_struct whd_bss_info_t;
88 typedef struct edcf_acparam whd_edcf_ac_param_t;
89 typedef struct wl_af_params whd_af_params_t;
90 typedef struct whd_arp_stats_s whd_arp_stats_t;
91 typedef struct wl_pkt_filter_stats whd_pkt_filter_stats_t;
92 typedef struct whd_tko_retry whd_tko_retry_t;
93 typedef struct whd_tko_connect whd_tko_connect_t;
94 typedef struct whd_tko_status whd_tko_status_t;
95 /** @endcond */
96 /******************************************************
97 *                    Constants
98 ******************************************************/
99 
100 #define WIFI_IE_OUI_LENGTH    (3)    /**< OUI length for Information Element */
101 #define VNDR_IE_MAX_LEN       255    /**< vendor IE max length, without ID and len */
102 
103 /* Below constants are used to allocate the buffer pool by the application */
104 
105 #define BDC_HEADER_WITH_PAD 6  /**< BDC Header with padding 4 + 2 */
106 
107 /** From bdc header, Ethernet data starts after an offset of (bdc_header->data_offset<<2).
108  * It is variable, but usually 4.
109  */
110 #define BDC_HEADER_OFFSET_TO_DATA 4
111 
112 #define SDPCM_HEADER (8 + 4)  /**< SDPCM SW header + Frame tag */
113 
114 #if (CYBSP_WIFI_INTERFACE_TYPE == CYBSP_SDIO_INTERFACE)
115 #define MAX_BUS_HEADER_SIZE 4 /**< Max bus header size for all bus types (sdio) */
116 #elif (CYBSP_WIFI_INTERFACE_TYPE == CYBSP_SPI_INTERFACE)
117 #define MAX_BUS_HEADER_SIZE 4 /**< Max bus header size for all bus types (spi) */
118 #elif (CYBSP_WIFI_INTERFACE_TYPE == CYBSP_M2M_INTERFACE)
119 #define MAX_BUS_HEADER_SIZE 8 /**< Max bus header size for all bus types (m2m) */
120 #else
121 #error "CYBSP_WIFI_INTERFACE_TYPE is not defined"
122 #endif
123 
124 #define BUFFER_OVERHEAD 4 /**< Buffer overhead, sizeof(void *) */
125 
126 /**
127  * The maximum space in bytes required for headers in front of the Ethernet header.
128  * 6 + (8 + 4) + 4 + 4 + 4 = 30 bytes
129  */
130 #define WHD_LINK_HEADER (BDC_HEADER_WITH_PAD + BDC_HEADER_OFFSET_TO_DATA + \
131                          SDPCM_HEADER + MAX_BUS_HEADER_SIZE + BUFFER_OVERHEAD)
132 
133 /**
134  * The size of an Ethernet header
135  */
136 #define WHD_ETHERNET_SIZE         (14)
137 
138 /**
139  * The size in bytes of the Link layer header i.e. the whd specific headers and the Ethernet header
140  */
141 #define WHD_PHYSICAL_HEADER       (WHD_LINK_HEADER + WHD_ETHERNET_SIZE)
142 
143 /**
144  * The maximum size in bytes of the data part of an Ethernet frame
145  */
146 #ifndef WHD_PAYLOAD_MTU
147 #define WHD_PAYLOAD_MTU           (1500)
148 #endif
149 
150 /**
151  * The maximum size in bytes of a packet used within whd.
152  * Pool should be atleast of this size.
153  * Usually buffer pools needs implementation specific headers like pbuf header etc, that should be
154  * taken into account along with this during buffer pool creation. Also buffer pools needs alignment with
155  * cache size of the platform for better performance
156  */
157 #define WHD_LINK_MTU            (WHD_PAYLOAD_MTU + WHD_PHYSICAL_HEADER)
158 
159 /** @cond */
160 #ifdef __x86_64__
161 typedef uint64_t whd_thread_arg_t;
162 #else
163 typedef uint32_t whd_thread_arg_t;
164 #endif
165 /** @endcond */
166 /******************************************************
167 *               Structures and  Enumerations
168 ******************************************************/
169 /**
170  * Enumeration of Dot11 Reason Codes
171  */
172 typedef enum
173 {
174     WHD_DOT11_RC_RESERVED = 0,   /**< Reserved     */
175     WHD_DOT11_RC_UNSPECIFIED = 1 /**< Unspecified  */
176 } whd_dot11_reason_code_t;
177 
178 /**
179  * Boolean values
180  */
181 typedef enum
182 {
183     WHD_FALSE = 0, /**< Boolean True */
184     WHD_TRUE = 1   /**< Boolean False */
185 } whd_bool_t;
186 
187 
188 /**
189  * Transfer direction for the WHD platform bus interface
190  */
191 typedef enum
192 {
193     /* If updating this enum, the bus_direction_mapping variable will also need to be updated */
194     BUS_READ, /**< Specifies bus type and read direction */
195     BUS_WRITE /**< Specifies bus type and write direction */
196 } whd_bus_transfer_direction_t;
197 
198 /**
199  * Enumeration of Wi-Fi security modes
200  */
201 typedef enum
202 {
203     WHD_SECURITY_OPEN             = 0,                                                                 /**< Open security                                         */
204     WHD_SECURITY_WEP_PSK          = WEP_ENABLED,                                                       /**< WEP PSK Security with open authentication             */
205     WHD_SECURITY_WEP_SHARED       = (WEP_ENABLED | SHARED_ENABLED),                                    /**< WEP PSK Security with shared authentication           */
206     WHD_SECURITY_WPA_TKIP_PSK     = (WPA_SECURITY | TKIP_ENABLED),                                     /**< WPA PSK Security with TKIP                            */
207     WHD_SECURITY_WPA_AES_PSK      = (WPA_SECURITY | AES_ENABLED),                                      /**< WPA PSK Security with AES                             */
208     WHD_SECURITY_WPA_MIXED_PSK    = (WPA_SECURITY | AES_ENABLED | TKIP_ENABLED),                       /**< WPA PSK Security with AES & TKIP                      */
209     WHD_SECURITY_WPA2_AES_PSK     = (WPA2_SECURITY | AES_ENABLED),                                     /**< WPA2 PSK Security with AES                            */
210     WHD_SECURITY_WPA2_TKIP_PSK    = (WPA2_SECURITY | TKIP_ENABLED),                                    /**< WPA2 PSK Security with TKIP                           */
211     WHD_SECURITY_WPA2_MIXED_PSK   = (WPA2_SECURITY | AES_ENABLED | TKIP_ENABLED),                      /**< WPA2 PSK Security with AES & TKIP                     */
212     WHD_SECURITY_WPA2_FBT_PSK     = (WPA2_SECURITY | AES_ENABLED | FBT_ENABLED),                       /**< WPA2 FBT PSK Security with AES & TKIP */
213     WHD_SECURITY_WPA3_SAE         = (WPA3_SECURITY | AES_ENABLED),                                     /**< WPA3 Security with AES */
214     WHD_SECURITY_WPA2_WPA_AES_PSK  = (WPA2_SECURITY | WPA_SECURITY | AES_ENABLED),                     /**< WPA2 WPA PSK Security with AES                        */
215     WHD_SECURITY_WPA2_WPA_MIXED_PSK = (WPA2_SECURITY | WPA_SECURITY | AES_ENABLED | TKIP_ENABLED),      /**< WPA2 WPA PSK Security with AES & TKIP                 */
216 
217     WHD_SECURITY_WPA3_WPA2_PSK    = (WPA3_SECURITY | WPA2_SECURITY | AES_ENABLED),                     /**< WPA3 WPA2 PSK Security with AES */
218 
219     WHD_SECURITY_WPA_TKIP_ENT     = (ENTERPRISE_ENABLED | WPA_SECURITY | TKIP_ENABLED),                /**< WPA Enterprise Security with TKIP                     */
220     WHD_SECURITY_WPA_AES_ENT      = (ENTERPRISE_ENABLED | WPA_SECURITY | AES_ENABLED),                 /**< WPA Enterprise Security with AES                      */
221     WHD_SECURITY_WPA_MIXED_ENT    = (ENTERPRISE_ENABLED | WPA_SECURITY | AES_ENABLED | TKIP_ENABLED),  /**< WPA Enterprise Security with AES & TKIP               */
222     WHD_SECURITY_WPA2_TKIP_ENT    = (ENTERPRISE_ENABLED | WPA2_SECURITY | TKIP_ENABLED),               /**< WPA2 Enterprise Security with TKIP                    */
223     WHD_SECURITY_WPA2_AES_ENT     = (ENTERPRISE_ENABLED | WPA2_SECURITY | AES_ENABLED),                /**< WPA2 Enterprise Security with AES                     */
224     WHD_SECURITY_WPA2_MIXED_ENT   = (ENTERPRISE_ENABLED | WPA2_SECURITY | AES_ENABLED | TKIP_ENABLED), /**< WPA2 Enterprise Security with AES & TKIP              */
225     WHD_SECURITY_WPA2_FBT_ENT     = (ENTERPRISE_ENABLED | WPA2_SECURITY | AES_ENABLED | FBT_ENABLED),  /**< WPA2 Enterprise Security with AES & FBT               */
226 
227     WHD_SECURITY_IBSS_OPEN        = (IBSS_ENABLED),                                                    /**< Open security on IBSS ad-hoc network                  */
228     WHD_SECURITY_WPS_SECURE       = AES_ENABLED,                                                       /**< WPS with AES security                                 */
229 
230     WHD_SECURITY_UNKNOWN          = -1,                                                                /**< May be returned by scan function if security is unknown. Do not pass this to the join function! */
231 
232     WHD_SECURITY_FORCE_32_BIT     = 0x7fffffff                                                         /**< Exists only to force whd_security_t type to 32 bits */
233 } whd_security_t;
234 
235 /**
236  * Enumeration of methods of scanning
237  */
238 typedef enum
239 {
240     WHD_SCAN_TYPE_ACTIVE              = 0x00, /**< Actively scan a network by sending 802.11 probe(s)                              */
241     WHD_SCAN_TYPE_PASSIVE             = 0x01, /**< Passively scan a network by listening for beacons from APs                      */
242     WHD_SCAN_TYPE_PNO                 = 0x02, /**< Use preferred network offload to detect an AP                                   */
243     WHD_SCAN_TYPE_PROHIBITED_CHANNELS = 0x04, /**< Permit (passively) scanning a channel that isn't valid for the current country  */
244     WHD_SCAN_TYPE_NO_BSSID_FILTER     = 0x08  /**< Return a scan record for each beacon or probe response RX'ed                    */
245 } whd_scan_type_t;
246 
247 /**
248  * Enumeration of network types
249  */
250 typedef enum
251 {
252     WHD_BSS_TYPE_INFRASTRUCTURE = 0, /**< Denotes infrastructure network                  */
253     WHD_BSS_TYPE_ADHOC          = 1, /**< Denotes an 802.11 ad-hoc IBSS network           */
254     WHD_BSS_TYPE_ANY            = 2, /**< Denotes either infrastructure or ad-hoc network */
255     WHD_BSS_TYPE_MESH           = 3, /**< Denotes 802.11 mesh network                     */
256 
257     WHD_BSS_TYPE_UNKNOWN = -1 /**< May be returned by scan function if BSS type is unknown. Do not pass this to the Join function */
258 } whd_bss_type_t;
259 
260 /**
261  * Enumeration of 802.11 radio bands
262  */
263 typedef enum
264 {
265     WHD_802_11_BAND_5GHZ   = 0, /**< Denotes 5GHz radio band   */
266     WHD_802_11_BAND_2_4GHZ = 1  /**< Denotes 2.4GHz radio band */
267 } whd_802_11_band_t;
268 
269 /**
270  * Enumeration of custom IE(Information Element) management actions
271  */
272 typedef enum
273 {
274     WHD_ADD_CUSTOM_IE,   /**< Add a custom IE(Information Element)    */
275     WHD_REMOVE_CUSTOM_IE /**< Remove a custom IE(Information Element) */
276 } whd_custom_ie_action_t;
277 
278 
279 /**
280  * Enumeration of listen interval time unit types
281  */
282 typedef enum
283 {
284     WHD_LISTEN_INTERVAL_TIME_UNIT_BEACON, /**< Time units specified in beacon periods */
285     WHD_LISTEN_INTERVAL_TIME_UNIT_DTIM    /**< Time units specified in DTIM periods   */
286 } whd_listen_interval_time_unit_t;
287 
288 /**
289  * Structure for storing scan status
290  */
291 typedef enum
292 {
293     WHD_SCAN_INCOMPLETE,                /**< Denotes that scan is not finished */
294     WHD_SCAN_COMPLETED_SUCCESSFULLY,    /**< Successful completion of scan */
295     WHD_SCAN_ABORTED,                   /**< Scan is aborted */
296 } whd_scan_status_t;
297 
298 /**
299  * Structure for storing status of auth event
300  */
301 typedef enum
302 {
303     WHD_AUTH_EXT_REQ,           /**< Request authentication received */
304     WHD_AUTH_EXT_FRAME_RX,      /**< Authentication frame received */
305 } whd_auth_status_t;
306 
307 /**
308  * Structure for storing radio band list information
309  */
310 typedef struct
311 {
312     int32_t number_of_bands; /**< Number of bands supported, currently 1 or 2      */
313     int32_t current_band;    /**< Current band type: WLC_BAND_2G or WLC_BAND_5G   */
314     int32_t other_band;      /**< If value of number_of_bands parameter is 2, then this member specifies the 2nd band */
315 } whd_band_list_t;
316 
317 /**
318  * Enumeration of scan result flags
319  */
320 typedef enum
321 {
322     WHD_SCAN_RESULT_FLAG_RSSI_OFF_CHANNEL = 0x01, /**< RSSI came from an off channel DSSS (1 or 1 Mb) Rx */
323     WHD_SCAN_RESULT_FLAG_BEACON = 0x02,           /**< Beacon (vs probe response)                        */
324     WHD_SCAN_RESULT_FLAG_SAE_H2E = 0x04,          /**< BSS is H2E(Hash-to-Element)                       */
325 } whd_scan_result_flag_t;
326 
327 /**
328  * Protected Management Frame Capability
329  */
330 enum
331 {
332     WL_MFP_NONE = 0,  /**< Disables the client support for MFP. */
333     WL_MFP_CAPABLE,   /**< Allows both MFP-capable and clients that do not support MFP to join the network. */
334     WL_MFP_REQUIRED   /**< Clients are allowed to associate only if MFP is negotiated. */
335 };
336 
337 
338 /**
339  * Enumeration of ioctl get
340  */
341 typedef enum
342 {
343     WHD_IOCTL_GET_RATE = 12,
344     WHD_IOCTL_GET_COUNTRY = 83,
345     WHD_IOCTL_GET_CLK = 160,
346     WHD_IOCTL_GET_WSEC = 133,
347     WHD_IOCTL_GET_AUTH = 21,
348     WHD_IOCTL_GET_WPA_AUTH = 164,
349     WHD_IOCTL_GET_PM = 85,
350     WHD_IOCTL_GET_BSSID = 23,
351     WHD_IOCTL_GET_ASSOCLIST = 159,
352     WHD_IOCTL_GET_BSS_INFO = 136,
353     WHD_IOCTL_GET_CHANNEL = 29
354 
355 } whd_usr_ioctl_get_list_t;
356 
357 /**
358  * Enumeration of ioctl set
359  */
360 typedef enum
361 {
362     WHD_IOCTL_SET_CHANNEL = 30,
363     WHD_IOCTL_SET_WSEC_PMK = 268,
364     WHD_IOCTL_SET_KEY = 45,
365     WHD_IOCTL_SET_WPA_AUTH = 165,
366     WHD_IOCTL_SCB_DEAUTHENTICATE_FOR_REASON = 201,
367     WHD_IOCTL_SET_PM = 86,
368     WHD_IOCTL_SET_SSID = 26,
369     WHD_IOCTL_SET_BCNPRD = 76,
370     WHD_IOCTL_SET_DTIMPRD = 78,
371     WHD_IOCTL_SET_WSEC = 134,
372     WHD_IOCTL_SET_INFRA = 20,
373     WHD_IOCTL_SET_AUTH = 22
374 
375 } whd_usr_ioctl_set_list_t;
376 
377 /**
378  * IOVAR set list
379  */
380 typedef enum
381 {
382     WHD_IOVAR_SET_MFP = 0,
383     WHD_IOVAR_SET_MPC,
384     WHD_IOVAR_SET_AMPDU_BA_WINDOW_SIZE,
385     WHD_IOVAR_SET_AMPDU_MPDU,
386     WHD_IOVAR_SET_LISTEN_INTERVAL_BEACON,
387     WHD_IOVAR_SET_LISTEN_INTERVAL_DTIM,
388     WHD_IOVAR_SET_LISTEN_INTERVAL_ASSOC,
389 } whd_usr_iovar_set_list_t;
390 
391 /**
392  * IOVAR get list
393  */
394 typedef enum
395 {
396     WHD_IOVAR_GET_MFP = 0,
397     WHD_IOVAR_GET_MPC,
398     WHD_IOVAR_GET_AMPDU_BA_WINDOW_SIZE,
399     WHD_IOVAR_GET_AMPDU_MPDU,
400     WHD_IOVAR_GET_LISTEN_INTERVAL,          /**< Get Listen Interval value */
401     WHD_IOVAR_GET_MAC_ADDRESS,              /**< Get mac address */
402 } whd_usr_iovar_get_list_t;
403 
404 /**
405  * Enumeration of bus type
406  */
407 typedef enum
408 {
409     WHD_BUS_SDIO = 0,
410     WHD_BUS_SPI,
411     WHD_BUS_M2M,
412     WHD_BUS_NO_DEFINE = 0xff,
413 } whd_bus_type_t;
414 
415 /**
416  * Expand fw capabilities list to enumeration
417  */
418 typedef enum
419 {
420     WHD_FWCAP_SAE = 0,     /**< Internal SAE */
421     WHD_FWCAP_SAE_EXT = 1, /**< External SAE */
422 } whd_fwcap_id_t;
423 
424 /******************************************************
425 *                 Type Definitions
426 ******************************************************/
427 /** @cond */
428 typedef struct whd_event_msg whd_event_header_t;
429 /** @endcond */
430 
431 /**
432  * Structure for storing a MAC address (Wi-Fi Media Access Control address).
433  */
434 typedef struct
435 {
436     uint8_t octet[6]; /**< Unique 6-byte MAC address */
437 } whd_mac_t;
438 
439 /**
440  * Structure for storing the supported channels.
441  */
442 typedef struct
443 {
444     uint32_t count;
445     uint32_t element[1];
446 } whd_list_t;
447 
448 /**
449  * Structure for storing a Service Set Identifier (i.e. Name of Access Point)
450  */
451 typedef struct
452 {
453     uint8_t length;                /**< SSID length */
454     uint8_t value[SSID_NAME_SIZE]; /**< SSID name (AP name)  */
455 } whd_ssid_t;
456 
457 /**<
458    The received packet formats are different when EXT_STA is enabled. In case
459    of EXT_STA the received packets are in 802.11 format, where as in other
460    case the received packets have Ethernet II format
461 
462    1. 802.11 frames
463    ----------------------------------------------------------------------------
464  | FC (2) | DID (2) |A1 (6) |A2 (6)|A3 (6) |SID (2) |SNAP (6) |type (2) |data (46 - 1500) |
465    ----------------------------------------------------------------------------
466 
467    2. Ethernet II frames
468    -------------------------------------------------
469  | DA (6) | SA (6) | type (2) | data (46 - 1500) |
470    -------------------------------------------------
471  */
472 
473 
474 /**
475  * Macro for creating country codes according to endianness
476  * @cond !ADDTHIS
477  */
478 #ifdef IL_BIGENDIAN
479 #define MK_CNTRY(a, b, \
480                  rev)  ( ( (unsigned char)(b) ) + ( ( (unsigned char)(a) ) << 8 ) + \
481                          ( ( (unsigned short)(rev) ) << 16 ) )
482 #else /* ifdef IL_BIGENDIAN */
483 #define MK_CNTRY(a, b, \
484                  rev)  ( ( (unsigned char)(a) ) + ( ( (unsigned char)(b) ) << 8 ) + \
485                          ( ( (unsigned short)(rev) ) << 16 ) )
486 #endif /* ifdef IL_BIGENDIAN */
487 /** @endcond */
488 
489 /**
490  * Enumerated list of country codes
491  */
492 typedef enum
493 {
494     WHD_COUNTRY_AFGHANISTAN                           = MK_CNTRY('A', 'F', 0),   /**< AF Afghanistan */
495     WHD_COUNTRY_ALBANIA                               = MK_CNTRY('A', 'L', 0),   /**< AL Albania */
496     WHD_COUNTRY_ALGERIA                               = MK_CNTRY('D', 'Z', 0),   /**< DZ Algeria */
497     WHD_COUNTRY_AMERICAN_SAMOA                        = MK_CNTRY('A', 'S', 0),   /**< AS American_Samoa */
498     WHD_COUNTRY_ANGOLA                                = MK_CNTRY('A', 'O', 0),   /**< AO Angola */
499     WHD_COUNTRY_ANGUILLA                              = MK_CNTRY('A', 'I', 0),   /**< AI Anguilla */
500     WHD_COUNTRY_ANTIGUA_AND_BARBUDA                   = MK_CNTRY('A', 'G', 0),   /**< AG Antigua_and_Barbuda */
501     WHD_COUNTRY_ARGENTINA                             = MK_CNTRY('A', 'R', 0),   /**< AR Argentina */
502     WHD_COUNTRY_ARMENIA                               = MK_CNTRY('A', 'M', 0),   /**< AM Armenia */
503     WHD_COUNTRY_ARUBA                                 = MK_CNTRY('A', 'W', 0),   /**< AW Aruba */
504     WHD_COUNTRY_AUSTRALIA                             = MK_CNTRY('A', 'U', 0),   /**< AU Australia */
505     WHD_COUNTRY_AUSTRIA                               = MK_CNTRY('A', 'T', 0),   /**< AT Austria */
506     WHD_COUNTRY_AZERBAIJAN                            = MK_CNTRY('A', 'Z', 0),   /**< AZ Azerbaijan */
507     WHD_COUNTRY_BAHAMAS                               = MK_CNTRY('B', 'S', 0),   /**< BS Bahamas */
508     WHD_COUNTRY_BAHRAIN                               = MK_CNTRY('B', 'H', 0),   /**< BH Bahrain */
509     WHD_COUNTRY_BAKER_ISLAND                          = MK_CNTRY('0', 'B', 0),   /**< 0B Baker_Island */
510     WHD_COUNTRY_BANGLADESH                            = MK_CNTRY('B', 'D', 0),   /**< BD Bangladesh */
511     WHD_COUNTRY_BARBADOS                              = MK_CNTRY('B', 'B', 0),   /**< BB Barbados */
512     WHD_COUNTRY_BELARUS                               = MK_CNTRY('B', 'Y', 0),   /**< BY Belarus */
513     WHD_COUNTRY_BELGIUM                               = MK_CNTRY('B', 'E', 0),   /**< BE Belgium */
514     WHD_COUNTRY_BELIZE                                = MK_CNTRY('B', 'Z', 0),   /**< BZ Belize */
515     WHD_COUNTRY_BENIN                                 = MK_CNTRY('B', 'J', 0),   /**< BJ Benin */
516     WHD_COUNTRY_BERMUDA                               = MK_CNTRY('B', 'M', 0),   /**< BM Bermuda */
517     WHD_COUNTRY_BHUTAN                                = MK_CNTRY('B', 'T', 0),   /**< BT Bhutan */
518     WHD_COUNTRY_BOLIVIA                               = MK_CNTRY('B', 'O', 0),   /**< BO Bolivia */
519     WHD_COUNTRY_BOSNIA_AND_HERZEGOVINA                = MK_CNTRY('B', 'A', 0),   /**< BA Bosnia_and_Herzegovina */
520     WHD_COUNTRY_BOTSWANA                              = MK_CNTRY('B', 'W', 0),   /**< BW Botswana */
521     WHD_COUNTRY_BRAZIL                                = MK_CNTRY('B', 'R', 0),   /**< BR Brazil */
522     WHD_COUNTRY_BRITISH_INDIAN_OCEAN_TERRITORY        = MK_CNTRY('I', 'O', 0),   /**< IO British_Indian_Ocean_Territory */
523     WHD_COUNTRY_BRUNEI_DARUSSALAM                     = MK_CNTRY('B', 'N', 0),   /**< BN Brunei_Darussalam */
524     WHD_COUNTRY_BULGARIA                              = MK_CNTRY('B', 'G', 0),   /**< BG Bulgaria */
525     WHD_COUNTRY_BURKINA_FASO                          = MK_CNTRY('B', 'F', 0),   /**< BF Burkina_Faso */
526     WHD_COUNTRY_BURUNDI                               = MK_CNTRY('B', 'I', 0),   /**< BI Burundi */
527     WHD_COUNTRY_CAMBODIA                              = MK_CNTRY('K', 'H', 0),   /**< KH Cambodia */
528     WHD_COUNTRY_CAMEROON                              = MK_CNTRY('C', 'M', 0),   /**< CM Cameroon */
529     WHD_COUNTRY_CANADA                                = MK_CNTRY('C', 'A', 0),   /**< CA Canada */
530     WHD_COUNTRY_CANADA_REV950                         = MK_CNTRY('C', 'A', 950), /**< CA Canada Revision 950 */
531     WHD_COUNTRY_CAPE_VERDE                            = MK_CNTRY('C', 'V', 0),   /**< CV Cape_Verde */
532     WHD_COUNTRY_CAYMAN_ISLANDS                        = MK_CNTRY('K', 'Y', 0),   /**< KY Cayman_Islands */
533     WHD_COUNTRY_CENTRAL_AFRICAN_REPUBLIC              = MK_CNTRY('C', 'F', 0),   /**< CF Central_African_Republic */
534     WHD_COUNTRY_CHAD                                  = MK_CNTRY('T', 'D', 0),   /**< TD Chad */
535     WHD_COUNTRY_CHILE                                 = MK_CNTRY('C', 'L', 0),   /**< CL Chile */
536     WHD_COUNTRY_CHINA                                 = MK_CNTRY('C', 'N', 0),   /**< CN China */
537     WHD_COUNTRY_CHRISTMAS_ISLAND                      = MK_CNTRY('C', 'X', 0),   /**< CX Christmas_Island */
538     WHD_COUNTRY_COLOMBIA                              = MK_CNTRY('C', 'O', 0),   /**< CO Colombia */
539     WHD_COUNTRY_COMOROS                               = MK_CNTRY('K', 'M', 0),   /**< KM Comoros */
540     WHD_COUNTRY_CONGO                                 = MK_CNTRY('C', 'G', 0),   /**< CG Congo */
541     WHD_COUNTRY_CONGO_THE_DEMOCRATIC_REPUBLIC_OF_THE  = MK_CNTRY('C', 'D', 0),   /**< CD Congo,_The_Democratic_Republic_Of_The */
542     WHD_COUNTRY_COSTA_RICA                            = MK_CNTRY('C', 'R', 0),   /**< CR Costa_Rica */
543     WHD_COUNTRY_COTE_DIVOIRE                          = MK_CNTRY('C', 'I', 0),   /**< CI Cote_D'ivoire */
544     WHD_COUNTRY_CROATIA                               = MK_CNTRY('H', 'R', 0),   /**< HR Croatia */
545     WHD_COUNTRY_CUBA                                  = MK_CNTRY('C', 'U', 0),   /**< CU Cuba */
546     WHD_COUNTRY_CYPRUS                                = MK_CNTRY('C', 'Y', 0),   /**< CY Cyprus */
547     WHD_COUNTRY_CZECH_REPUBLIC                        = MK_CNTRY('C', 'Z', 0),   /**< CZ Czech_Republic */
548     WHD_COUNTRY_DENMARK                               = MK_CNTRY('D', 'K', 0),   /**< DK Denmark */
549     WHD_COUNTRY_DJIBOUTI                              = MK_CNTRY('D', 'J', 0),   /**< DJ Djibouti */
550     WHD_COUNTRY_DOMINICA                              = MK_CNTRY('D', 'M', 0),   /**< DM Dominica */
551     WHD_COUNTRY_DOMINICAN_REPUBLIC                    = MK_CNTRY('D', 'O', 0),   /**< DO Dominican_Republic */
552     WHD_COUNTRY_DOWN_UNDER                            = MK_CNTRY('A', 'U', 0),   /**< AU G'Day mate! */
553     WHD_COUNTRY_ECUADOR                               = MK_CNTRY('E', 'C', 0),   /**< EC Ecuador */
554     WHD_COUNTRY_EGYPT                                 = MK_CNTRY('E', 'G', 0),   /**< EG Egypt */
555     WHD_COUNTRY_EL_SALVADOR                           = MK_CNTRY('S', 'V', 0),   /**< SV El_Salvador */
556     WHD_COUNTRY_EQUATORIAL_GUINEA                     = MK_CNTRY('G', 'Q', 0),   /**< GQ Equatorial_Guinea */
557     WHD_COUNTRY_ERITREA                               = MK_CNTRY('E', 'R', 0),   /**< ER Eritrea */
558     WHD_COUNTRY_ESTONIA                               = MK_CNTRY('E', 'E', 0),   /**< EE Estonia */
559     WHD_COUNTRY_ETHIOPIA                              = MK_CNTRY('E', 'T', 0),   /**< ET Ethiopia */
560     WHD_COUNTRY_FALKLAND_ISLANDS_MALVINAS             = MK_CNTRY('F', 'K', 0),   /**< FK Falkland_Islands_(Malvinas) */
561     WHD_COUNTRY_FAROE_ISLANDS                         = MK_CNTRY('F', 'O', 0),   /**< FO Faroe_Islands */
562     WHD_COUNTRY_FIJI                                  = MK_CNTRY('F', 'J', 0),   /**< FJ Fiji */
563     WHD_COUNTRY_FINLAND                               = MK_CNTRY('F', 'I', 0),   /**< FI Finland */
564     WHD_COUNTRY_FRANCE                                = MK_CNTRY('F', 'R', 0),   /**< FR France */
565     WHD_COUNTRY_FRENCH_GUINA                          = MK_CNTRY('G', 'F', 0),   /**< GF French_Guina */
566     WHD_COUNTRY_FRENCH_POLYNESIA                      = MK_CNTRY('P', 'F', 0),   /**< PF French_Polynesia */
567     WHD_COUNTRY_FRENCH_SOUTHERN_TERRITORIES           = MK_CNTRY('T', 'F', 0),   /**< TF French_Southern_Territories */
568     WHD_COUNTRY_GABON                                 = MK_CNTRY('G', 'A', 0),   /**< GA Gabon */
569     WHD_COUNTRY_GAMBIA                                = MK_CNTRY('G', 'M', 0),   /**< GM Gambia */
570     WHD_COUNTRY_GEORGIA                               = MK_CNTRY('G', 'E', 0),   /**< GE Georgia */
571     WHD_COUNTRY_GERMANY                               = MK_CNTRY('D', 'E', 0),   /**< DE Germany */
572     WHD_COUNTRY_EUROPEAN_WIDE_REV895                  = MK_CNTRY('E', '0', 895), /**< E0 European_Wide Revision 895 */
573     WHD_COUNTRY_GHANA                                 = MK_CNTRY('G', 'H', 0),   /**< GH Ghana */
574     WHD_COUNTRY_GIBRALTAR                             = MK_CNTRY('G', 'I', 0),   /**< GI Gibraltar */
575     WHD_COUNTRY_GREECE                                = MK_CNTRY('G', 'R', 0),   /**< GR Greece */
576     WHD_COUNTRY_GRENADA                               = MK_CNTRY('G', 'D', 0),   /**< GD Grenada */
577     WHD_COUNTRY_GUADELOUPE                            = MK_CNTRY('G', 'P', 0),   /**< GP Guadeloupe */
578     WHD_COUNTRY_GUAM                                  = MK_CNTRY('G', 'U', 0),   /**< GU Guam */
579     WHD_COUNTRY_GUATEMALA                             = MK_CNTRY('G', 'T', 0),   /**< GT Guatemala */
580     WHD_COUNTRY_GUERNSEY                              = MK_CNTRY('G', 'G', 0),   /**< GG Guernsey */
581     WHD_COUNTRY_GUINEA                                = MK_CNTRY('G', 'N', 0),   /**< GN Guinea */
582     WHD_COUNTRY_GUINEA_BISSAU                         = MK_CNTRY('G', 'W', 0),   /**< GW Guinea-bissau */
583     WHD_COUNTRY_GUYANA                                = MK_CNTRY('G', 'Y', 0),   /**< GY Guyana */
584     WHD_COUNTRY_HAITI                                 = MK_CNTRY('H', 'T', 0),   /**< HT Haiti */
585     WHD_COUNTRY_HOLY_SEE_VATICAN_CITY_STATE           = MK_CNTRY('V', 'A', 0),   /**< VA Holy_See_(Vatican_City_State) */
586     WHD_COUNTRY_HONDURAS                              = MK_CNTRY('H', 'N', 0),   /**< HN Honduras */
587     WHD_COUNTRY_HONG_KONG                             = MK_CNTRY('H', 'K', 0),   /**< HK Hong_Kong */
588     WHD_COUNTRY_HUNGARY                               = MK_CNTRY('H', 'U', 0),   /**< HU Hungary */
589     WHD_COUNTRY_ICELAND                               = MK_CNTRY('I', 'S', 0),   /**< IS Iceland */
590     WHD_COUNTRY_INDIA                                 = MK_CNTRY('I', 'N', 0),   /**< IN India */
591     WHD_COUNTRY_INDONESIA                             = MK_CNTRY('I', 'D', 0),   /**< ID Indonesia */
592     WHD_COUNTRY_IRAN_ISLAMIC_REPUBLIC_OF              = MK_CNTRY('I', 'R', 0),   /**< IR Iran,_Islamic_Republic_Of */
593     WHD_COUNTRY_IRAQ                                  = MK_CNTRY('I', 'Q', 0),   /**< IQ Iraq */
594     WHD_COUNTRY_IRELAND                               = MK_CNTRY('I', 'E', 0),   /**< IE Ireland */
595     WHD_COUNTRY_ISRAEL                                = MK_CNTRY('I', 'L', 0),   /**< IL Israel */
596     WHD_COUNTRY_ITALY                                 = MK_CNTRY('I', 'T', 0),   /**< IT Italy */
597     WHD_COUNTRY_JAMAICA                               = MK_CNTRY('J', 'M', 0),   /**< JM Jamaica */
598     WHD_COUNTRY_JAPAN                                 = MK_CNTRY('J', 'P', 0),   /**< JP Japan */
599     WHD_COUNTRY_JERSEY                                = MK_CNTRY('J', 'E', 0),   /**< JE Jersey */
600     WHD_COUNTRY_JORDAN                                = MK_CNTRY('J', 'O', 0),   /**< JO Jordan */
601     WHD_COUNTRY_KAZAKHSTAN                            = MK_CNTRY('K', 'Z', 0),   /**< KZ Kazakhstan */
602     WHD_COUNTRY_KENYA                                 = MK_CNTRY('K', 'E', 0),   /**< KE Kenya */
603     WHD_COUNTRY_KIRIBATI                              = MK_CNTRY('K', 'I', 0),   /**< KI Kiribati */
604     WHD_COUNTRY_KOREA_REPUBLIC_OF                     = MK_CNTRY('K', 'R', 1),   /**< KR Korea,_Republic_Of */
605     WHD_COUNTRY_KOSOVO                                = MK_CNTRY('0', 'A', 0),   /**< 0A Kosovo */
606     WHD_COUNTRY_KUWAIT                                = MK_CNTRY('K', 'W', 0),   /**< KW Kuwait */
607     WHD_COUNTRY_KYRGYZSTAN                            = MK_CNTRY('K', 'G', 0),   /**< KG Kyrgyzstan */
608     WHD_COUNTRY_LAO_PEOPLES_DEMOCRATIC_REPUBIC        = MK_CNTRY('L', 'A', 0),   /**< LA Lao_People's_Democratic_Repubic */
609     WHD_COUNTRY_LATVIA                                = MK_CNTRY('L', 'V', 0),   /**< LV Latvia */
610     WHD_COUNTRY_LEBANON                               = MK_CNTRY('L', 'B', 0),   /**< LB Lebanon */
611     WHD_COUNTRY_LESOTHO                               = MK_CNTRY('L', 'S', 0),   /**< LS Lesotho */
612     WHD_COUNTRY_LIBERIA                               = MK_CNTRY('L', 'R', 0),   /**< LR Liberia */
613     WHD_COUNTRY_LIBYAN_ARAB_JAMAHIRIYA                = MK_CNTRY('L', 'Y', 0),   /**< LY Libyan_Arab_Jamahiriya */
614     WHD_COUNTRY_LIECHTENSTEIN                         = MK_CNTRY('L', 'I', 0),   /**< LI Liechtenstein */
615     WHD_COUNTRY_LITHUANIA                             = MK_CNTRY('L', 'T', 0),   /**< LT Lithuania */
616     WHD_COUNTRY_LUXEMBOURG                            = MK_CNTRY('L', 'U', 0),   /**< LU Luxembourg */
617     WHD_COUNTRY_MACAO                                 = MK_CNTRY('M', 'O', 0),   /**< MO Macao */
618     WHD_COUNTRY_MACEDONIA_FORMER_YUGOSLAV_REPUBLIC_OF = MK_CNTRY('M', 'K', 0),   /**< MK Macedonia,_Former_Yugoslav_Republic_Of */
619     WHD_COUNTRY_MADAGASCAR                            = MK_CNTRY('M', 'G', 0),   /**< MG Madagascar */
620     WHD_COUNTRY_MALAWI                                = MK_CNTRY('M', 'W', 0),   /**< MW Malawi */
621     WHD_COUNTRY_MALAYSIA                              = MK_CNTRY('M', 'Y', 0),   /**< MY Malaysia */
622     WHD_COUNTRY_MALDIVES                              = MK_CNTRY('M', 'V', 0),   /**< MV Maldives */
623     WHD_COUNTRY_MALI                                  = MK_CNTRY('M', 'L', 0),   /**< ML Mali */
624     WHD_COUNTRY_MALTA                                 = MK_CNTRY('M', 'T', 0),   /**< MT Malta */
625     WHD_COUNTRY_MAN_ISLE_OF                           = MK_CNTRY('I', 'M', 0),   /**< IM Man,_Isle_Of */
626     WHD_COUNTRY_MARTINIQUE                            = MK_CNTRY('M', 'Q', 0),   /**< MQ Martinique */
627     WHD_COUNTRY_MAURITANIA                            = MK_CNTRY('M', 'R', 0),   /**< MR Mauritania */
628     WHD_COUNTRY_MAURITIUS                             = MK_CNTRY('M', 'U', 0),   /**< MU Mauritius */
629     WHD_COUNTRY_MAYOTTE                               = MK_CNTRY('Y', 'T', 0),   /**< YT Mayotte */
630     WHD_COUNTRY_MEXICO                                = MK_CNTRY('M', 'X', 0),   /**< MX Mexico */
631     WHD_COUNTRY_MICRONESIA_FEDERATED_STATES_OF        = MK_CNTRY('F', 'M', 0),   /**< FM Micronesia,_Federated_States_Of */
632     WHD_COUNTRY_MOLDOVA_REPUBLIC_OF                   = MK_CNTRY('M', 'D', 0),   /**< MD Moldova,_Republic_Of */
633     WHD_COUNTRY_MONACO                                = MK_CNTRY('M', 'C', 0),   /**< MC Monaco */
634     WHD_COUNTRY_MONGOLIA                              = MK_CNTRY('M', 'N', 0),   /**< MN Mongolia */
635     WHD_COUNTRY_MONTENEGRO                            = MK_CNTRY('M', 'E', 0),   /**< ME Montenegro */
636     WHD_COUNTRY_MONTSERRAT                            = MK_CNTRY('M', 'S', 0),   /**< MS Montserrat */
637     WHD_COUNTRY_MOROCCO                               = MK_CNTRY('M', 'A', 0),   /**< MA Morocco */
638     WHD_COUNTRY_MOZAMBIQUE                            = MK_CNTRY('M', 'Z', 0),   /**< MZ Mozambique */
639     WHD_COUNTRY_MYANMAR                               = MK_CNTRY('M', 'M', 0),   /**< MM Myanmar */
640     WHD_COUNTRY_NAMIBIA                               = MK_CNTRY('N', 'A', 0),   /**< NA Namibia */
641     WHD_COUNTRY_NAURU                                 = MK_CNTRY('N', 'R', 0),   /**< NR Nauru */
642     WHD_COUNTRY_NEPAL                                 = MK_CNTRY('N', 'P', 0),   /**< NP Nepal */
643     WHD_COUNTRY_NETHERLANDS                           = MK_CNTRY('N', 'L', 0),   /**< NL Netherlands */
644     WHD_COUNTRY_NETHERLANDS_ANTILLES                  = MK_CNTRY('A', 'N', 0),   /**< AN Netherlands_Antilles */
645     WHD_COUNTRY_NEW_CALEDONIA                         = MK_CNTRY('N', 'C', 0),   /**< NC New_Caledonia */
646     WHD_COUNTRY_NEW_ZEALAND                           = MK_CNTRY('N', 'Z', 0),   /**< NZ New_Zealand */
647     WHD_COUNTRY_NICARAGUA                             = MK_CNTRY('N', 'I', 0),   /**< NI Nicaragua */
648     WHD_COUNTRY_NIGER                                 = MK_CNTRY('N', 'E', 0),   /**< NE Niger */
649     WHD_COUNTRY_NIGERIA                               = MK_CNTRY('N', 'G', 0),   /**< NG Nigeria */
650     WHD_COUNTRY_NORFOLK_ISLAND                        = MK_CNTRY('N', 'F', 0),   /**< NF Norfolk_Island */
651     WHD_COUNTRY_NORTHERN_MARIANA_ISLANDS              = MK_CNTRY('M', 'P', 0),   /**< MP Northern_Mariana_Islands */
652     WHD_COUNTRY_NORWAY                                = MK_CNTRY('N', 'O', 0),   /**< NO Norway */
653     WHD_COUNTRY_OMAN                                  = MK_CNTRY('O', 'M', 0),   /**< OM Oman */
654     WHD_COUNTRY_PAKISTAN                              = MK_CNTRY('P', 'K', 0),   /**< PK Pakistan */
655     WHD_COUNTRY_PALAU                                 = MK_CNTRY('P', 'W', 0),   /**< PW Palau */
656     WHD_COUNTRY_PANAMA                                = MK_CNTRY('P', 'A', 0),   /**< PA Panama */
657     WHD_COUNTRY_PAPUA_NEW_GUINEA                      = MK_CNTRY('P', 'G', 0),   /**< PG Papua_New_Guinea */
658     WHD_COUNTRY_PARAGUAY                              = MK_CNTRY('P', 'Y', 0),   /**< PY Paraguay */
659     WHD_COUNTRY_PERU                                  = MK_CNTRY('P', 'E', 0),   /**< PE Peru */
660     WHD_COUNTRY_PHILIPPINES                           = MK_CNTRY('P', 'H', 0),   /**< PH Philippines */
661     WHD_COUNTRY_POLAND                                = MK_CNTRY('P', 'L', 0),   /**< PL Poland */
662     WHD_COUNTRY_PORTUGAL                              = MK_CNTRY('P', 'T', 0),   /**< PT Portugal */
663     WHD_COUNTRY_PUETO_RICO                            = MK_CNTRY('P', 'R', 0),   /**< PR Pueto_Rico */
664     WHD_COUNTRY_QATAR                                 = MK_CNTRY('Q', 'A', 0),   /**< QA Qatar */
665     WHD_COUNTRY_REUNION                               = MK_CNTRY('R', 'E', 0),   /**< RE Reunion */
666     WHD_COUNTRY_ROMANIA                               = MK_CNTRY('R', 'O', 0),   /**< RO Romania */
667     WHD_COUNTRY_RUSSIAN_FEDERATION                    = MK_CNTRY('R', 'U', 0),   /**< RU Russian_Federation */
668     WHD_COUNTRY_RWANDA                                = MK_CNTRY('R', 'W', 0),   /**< RW Rwanda */
669     WHD_COUNTRY_SAINT_KITTS_AND_NEVIS                 = MK_CNTRY('K', 'N', 0),   /**< KN Saint_Kitts_and_Nevis */
670     WHD_COUNTRY_SAINT_LUCIA                           = MK_CNTRY('L', 'C', 0),   /**< LC Saint_Lucia */
671     WHD_COUNTRY_SAINT_PIERRE_AND_MIQUELON             = MK_CNTRY('P', 'M', 0),   /**< PM Saint_Pierre_and_Miquelon */
672     WHD_COUNTRY_SAINT_VINCENT_AND_THE_GRENADINES      = MK_CNTRY('V', 'C', 0),   /**< VC Saint_Vincent_and_The_Grenadines */
673     WHD_COUNTRY_SAMOA                                 = MK_CNTRY('W', 'S', 0),   /**< WS Samoa */
674     WHD_COUNTRY_SANIT_MARTIN_SINT_MARTEEN             = MK_CNTRY('M', 'F', 0),   /**< MF Sanit_Martin_/_Sint_Marteen */
675     WHD_COUNTRY_SAO_TOME_AND_PRINCIPE                 = MK_CNTRY('S', 'T', 0),   /**< ST Sao_Tome_and_Principe */
676     WHD_COUNTRY_SAUDI_ARABIA                          = MK_CNTRY('S', 'A', 0),   /**< SA Saudi_Arabia */
677     WHD_COUNTRY_SENEGAL                               = MK_CNTRY('S', 'N', 0),   /**< SN Senegal */
678     WHD_COUNTRY_SERBIA                                = MK_CNTRY('R', 'S', 0),   /**< RS Serbia */
679     WHD_COUNTRY_SEYCHELLES                            = MK_CNTRY('S', 'C', 0),   /**< SC Seychelles */
680     WHD_COUNTRY_SIERRA_LEONE                          = MK_CNTRY('S', 'L', 0),   /**< SL Sierra_Leone */
681     WHD_COUNTRY_SINGAPORE                             = MK_CNTRY('S', 'G', 0),   /**< SG Singapore */
682     WHD_COUNTRY_SLOVAKIA                              = MK_CNTRY('S', 'K', 0),   /**< SK Slovakia */
683     WHD_COUNTRY_SLOVENIA                              = MK_CNTRY('S', 'I', 0),   /**< SI Slovenia */
684     WHD_COUNTRY_SOLOMON_ISLANDS                       = MK_CNTRY('S', 'B', 0),   /**< SB Solomon_Islands */
685     WHD_COUNTRY_SOMALIA                               = MK_CNTRY('S', 'O', 0),   /**< SO Somalia */
686     WHD_COUNTRY_SOUTH_AFRICA                          = MK_CNTRY('Z', 'A', 0),   /**< ZA South_Africa */
687     WHD_COUNTRY_SPAIN                                 = MK_CNTRY('E', 'S', 0),   /**< ES Spain */
688     WHD_COUNTRY_SRI_LANKA                             = MK_CNTRY('L', 'K', 0),   /**< LK Sri_Lanka */
689     WHD_COUNTRY_SURINAME                              = MK_CNTRY('S', 'R', 0),   /**< SR Suriname */
690     WHD_COUNTRY_SWAZILAND                             = MK_CNTRY('S', 'Z', 0),   /**< SZ Swaziland */
691     WHD_COUNTRY_SWEDEN                                = MK_CNTRY('S', 'E', 0),   /**< SE Sweden */
692     WHD_COUNTRY_SWITZERLAND                           = MK_CNTRY('C', 'H', 0),   /**< CH Switzerland */
693     WHD_COUNTRY_SYRIAN_ARAB_REPUBLIC                  = MK_CNTRY('S', 'Y', 0),   /**< SY Syrian_Arab_Republic */
694     WHD_COUNTRY_TAIWAN_PROVINCE_OF_CHINA              = MK_CNTRY('T', 'W', 0),   /**< TW Taiwan,_Province_Of_China */
695     WHD_COUNTRY_TAJIKISTAN                            = MK_CNTRY('T', 'J', 0),   /**< TJ Tajikistan */
696     WHD_COUNTRY_TANZANIA_UNITED_REPUBLIC_OF           = MK_CNTRY('T', 'Z', 0),   /**< TZ Tanzania,_United_Republic_Of */
697     WHD_COUNTRY_THAILAND                              = MK_CNTRY('T', 'H', 0),   /**< TH Thailand */
698     WHD_COUNTRY_TOGO                                  = MK_CNTRY('T', 'G', 0),   /**< TG Togo */
699     WHD_COUNTRY_TONGA                                 = MK_CNTRY('T', 'O', 0),   /**< TO Tonga */
700     WHD_COUNTRY_TRINIDAD_AND_TOBAGO                   = MK_CNTRY('T', 'T', 0),   /**< TT Trinidad_and_Tobago */
701     WHD_COUNTRY_TUNISIA                               = MK_CNTRY('T', 'N', 0),   /**< TN Tunisia */
702     WHD_COUNTRY_TURKEY                                = MK_CNTRY('T', 'R', 0),   /**< TR Turkey */
703     WHD_COUNTRY_TURKMENISTAN                          = MK_CNTRY('T', 'M', 0),   /**< TM Turkmenistan */
704     WHD_COUNTRY_TURKS_AND_CAICOS_ISLANDS              = MK_CNTRY('T', 'C', 0),   /**< TC Turks_and_Caicos_Islands */
705     WHD_COUNTRY_TUVALU                                = MK_CNTRY('T', 'V', 0),   /**< TV Tuvalu */
706     WHD_COUNTRY_UGANDA                                = MK_CNTRY('U', 'G', 0),   /**< UG Uganda */
707     WHD_COUNTRY_UKRAINE                               = MK_CNTRY('U', 'A', 0),   /**< UA Ukraine */
708     WHD_COUNTRY_UNITED_ARAB_EMIRATES                  = MK_CNTRY('A', 'E', 0),   /**< AE United_Arab_Emirates */
709     WHD_COUNTRY_UNITED_KINGDOM                        = MK_CNTRY('G', 'B', 0),   /**< GB United_Kingdom */
710     WHD_COUNTRY_UNITED_STATES                         = MK_CNTRY('U', 'S', 0),   /**< US United_States */
711     WHD_COUNTRY_UNITED_STATES_REV4                    = MK_CNTRY('U', 'S', 4),   /**< US United_States Revision 4 */
712     WHD_COUNTRY_UNITED_STATES_REV931                  = MK_CNTRY('Q', '1', 931), /**< Q1 United_States Revision 931 */
713     WHD_COUNTRY_UNITED_STATES_NO_DFS                  = MK_CNTRY('Q', '2', 0),   /**< Q2 United_States_(No_DFS) */
714     WHD_COUNTRY_UNITED_STATES_MINOR_OUTLYING_ISLANDS  = MK_CNTRY('U', 'M', 0),   /**< UM United_States_Minor_Outlying_Islands */
715     WHD_COUNTRY_URUGUAY                               = MK_CNTRY('U', 'Y', 0),   /**< UY Uruguay */
716     WHD_COUNTRY_UZBEKISTAN                            = MK_CNTRY('U', 'Z', 0),   /**< UZ Uzbekistan */
717     WHD_COUNTRY_VANUATU                               = MK_CNTRY('V', 'U', 0),   /**< VU Vanuatu */
718     WHD_COUNTRY_VENEZUELA                             = MK_CNTRY('V', 'E', 0),   /**< VE Venezuela */
719     WHD_COUNTRY_VIET_NAM                              = MK_CNTRY('V', 'N', 0),   /**< VN Viet_Nam */
720     WHD_COUNTRY_VIRGIN_ISLANDS_BRITISH                = MK_CNTRY('V', 'G', 0),   /**< VG Virgin_Islands,_British */
721     WHD_COUNTRY_VIRGIN_ISLANDS_US                     = MK_CNTRY('V', 'I', 0),   /**< VI Virgin_Islands,_U.S. */
722     WHD_COUNTRY_WALLIS_AND_FUTUNA                     = MK_CNTRY('W', 'F', 0),   /**< WF Wallis_and_Futuna */
723     WHD_COUNTRY_WEST_BANK                             = MK_CNTRY('0', 'C', 0),   /**< 0C West_Bank */
724     WHD_COUNTRY_WESTERN_SAHARA                        = MK_CNTRY('E', 'H', 0),   /**< EH Western_Sahara */
725     WHD_COUNTRY_WORLD_WIDE_XV_REV983                  = MK_CNTRY('X', 'V', 983), /**< Worldwide Locale Revision 983 */
726     WHD_COUNTRY_WORLD_WIDE_XX                         = MK_CNTRY('X', 'X', 0),   /**< Worldwide Locale (passive Ch12-14) */
727     WHD_COUNTRY_WORLD_WIDE_XX_REV17                   = MK_CNTRY('X', 'X', 17),  /**< Worldwide Locale (passive Ch12-14) Revision 17 */
728     WHD_COUNTRY_YEMEN                                 = MK_CNTRY('Y', 'E', 0),   /**< YE Yemen */
729     WHD_COUNTRY_ZAMBIA                                = MK_CNTRY('Z', 'M', 0),   /**< ZM Zambia */
730     WHD_COUNTRY_ZIMBABWE                              = MK_CNTRY('Z', 'W', 0),   /**< ZW Zimbabwe */
731 } whd_country_code_t;
732 
733 /**
734  * Structure for storing extended scan parameters
735  */
736 typedef struct
737 {
738     int32_t number_of_probes_per_channel;                     /**< Number of probes to send on each channel                                               */
739     int32_t scan_active_dwell_time_per_channel_ms;            /**< Period of time to wait on each channel when active scanning                            */
740     int32_t scan_passive_dwell_time_per_channel_ms;           /**< Period of time to wait on each channel when passive scanning                           */
741     int32_t scan_home_channel_dwell_time_between_channels_ms; /**< Period of time to wait on the home channel when scanning. Only relevant if associated. */
742 } whd_scan_extended_params_t;
743 
744 /**
745  * Structure for storing scan results
746  */
747 #pragma pack(1)
748 typedef struct whd_scan_result
749 {
750     whd_ssid_t SSID;                            /**< Service Set Identification (i.e. Name of Access Point)                    */
751     whd_mac_t BSSID;                            /**< Basic Service Set Identification (i.e. MAC address of Access Point)       */
752     int16_t signal_strength;                    /**< Receive Signal Strength Indication in dBm. <-90=Very poor, >-30=Excellent */
753     uint32_t max_data_rate;                     /**< Maximum data rate in kilobits/s                                           */
754     whd_bss_type_t bss_type;                    /**< Network type                                                              */
755     whd_security_t security;                    /**< Security type                                                             */
756     uint8_t channel;                            /**< Radio channel that the AP beacon was received on                          */
757     whd_802_11_band_t band;                     /**< Radio band                                                                */
758     uint8_t ccode[2];                           /**< Two letter ISO country code from AP                                       */
759     uint8_t flags;                              /**< flags                                                                     */
760     struct whd_scan_result *next;               /**< Pointer to the next scan result                                           */
761     uint8_t *ie_ptr;                            /**< Pointer to received Beacon/Probe Response IE(Information Element)         */
762     uint32_t ie_len;                            /**< Length of IE(Information Element)                                         */
763 } whd_scan_result_t;
764 #pragma pack()
765 
766 /**
767  * Structure to store scan result parameters for each AP
768  */
769 typedef struct whd_simple_scan_result
770 {
771     whd_ssid_t SSID;         /**< Service Set Identification (i.e. Name of Access Point)                    */
772     whd_mac_t BSSID;         /**< Basic Service Set Identification (i.e. MAC address of Access Point)       */
773     int16_t signal_strength; /**< Receive Signal Strength Indication in dBm. <-90=Very poor, >-30=Excellent */
774     whd_security_t security; /**< Security type                                                             */
775     uint8_t channel;         /**< Radio channel that the AP beacon was received on                          */
776 } whd_sync_scan_result_t;
777 
778 typedef uint16_t wl_chanspec_t;  /**< Channel specified in uint16_t */
779 #define MCSSET_LEN    16 /**< Maximum allowed mcs rate */
780 
781 /** BSS(Basic Service Set) information structure
782  *
783  * Applications MUST CHECK ie_offset field and length field to access IEs(Information Elements) and
784  * next bss_info structure in a vector (in whd_sync_scan_result_t)
785  */
786 typedef struct wl_bss_info_struct
787 {
788     uint32_t version;              /**< version field */
789     uint32_t length;               /**< byte length of data in this record, starting at version and including IEs */
790     whd_mac_t BSSID;               /**< Unique 6-byte MAC address */
791     uint16_t beacon_period;        /**< Interval between two consecutive beacon frames. Units are Kusec */
792     uint16_t capability;           /**< Capability information */
793     uint8_t SSID_len;              /**< SSID length */
794     uint8_t SSID[32];              /**< Array to store SSID */
795     uint8_t reserved1[1];          /**< Reserved(padding) */
796     struct
797     {
798         uint32_t count;            /**< Count of rates in this set */
799         uint8_t rates[16];         /**< rates in 500kbps units, higher bit set if basic */
800     } rateset;                     /**< supported rates */
801     wl_chanspec_t chanspec;        /**< Channel specification for basic service set */
802     uint16_t atim_window;          /**< Announcement traffic indication message window size. Units are Kusec */
803     uint8_t dtim_period;           /**< Delivery traffic indication message period */
804     uint8_t reserved2[1];          /**< Reserved(padding) */
805     int16_t RSSI;                  /**< receive signal strength (in dBm) */
806     int8_t phy_noise;              /**< noise (in dBm) */
807 
808     uint8_t n_cap;                 /**< BSS is 802.11N Capable */
809     uint8_t reserved3[2];          /**< Reserved(padding) */
810     uint32_t nbss_cap;             /**< 802.11N BSS Capabilities (based on HT_CAP_*) */
811     uint8_t ctl_ch;                /**< 802.11N BSS control channel number */
812     uint8_t reserved4[3];          /**< Reserved(padding) */
813     uint32_t reserved32[1];        /**< Reserved for expansion of BSS properties */
814     uint8_t flags;                 /**< flags */
815     uint8_t vht_cap;               /**< BSS is vht capable */
816     uint8_t reserved5[2];          /**< Reserved(padding) */
817     uint8_t basic_mcs[MCSSET_LEN]; /**< 802.11N BSS required MCS set */
818 
819     uint16_t ie_offset;            /**< offset at which IEs start, from beginning */
820     uint32_t ie_length;            /**< byte length of Information Elements */
821     int16_t SNR;                   /**< Average SNR(signal to noise ratio) during frame reception */
822     /* Add new fields here */
823     /* variable length Information Elements */
824 } wl_bss_info_t;
825 
826 /** Structure for storing 802.11 powersave listen interval values \n
827  *  See @ref whd_wifi_get_listen_interval for more information
828  */
829 typedef struct
830 {
831     uint8_t beacon; /**< Listen interval in beacon periods */
832     uint8_t dtim;   /**< Listen interval in DTIM periods   */
833     uint16_t assoc; /**< Listen interval as sent to APs    */
834 } whd_listen_interval_t;
835 
836 /**
837  * WHD result is specified as uint32_t value
838  */
839 typedef uint32_t whd_result_t;
840 
841 /* whd_result_t error code format
842  * |31-18 (14 bit) for module id|17-16 (2 bit) for result type|15-0 for whd error code|
843  */
844 #define WHD_RESULT_TYPE 0   /**< WHD Result type */
845 #define WHD_RESULT_CREATE(x) CY_RSLT_CREATE(WHD_RESULT_TYPE, CY_RSLT_MODULE_DRIVERS_WHD_BASE, (x) ) /**< Create a result value from the specified type, module, and result code */
846 
847 #define WHD_SUCCESS                         CY_RSLT_SUCCESS        /**< Success */
848 #define WHD_PENDING                         WHD_RESULT_CREATE(1)   /**< Pending */
849 #define WHD_TIMEOUT                         WHD_RESULT_CREATE(2)   /**< Timeout */
850 #define WHD_BADARG                          WHD_RESULT_CREATE(5)   /**< Bad Arguments */
851 #define WHD_UNFINISHED                      WHD_RESULT_CREATE(10)  /**< Operation not finished yet WHD_RESULT_CREATE(maybe aborted) */
852 
853 #define WHD_PARTIAL_RESULTS              WHD_RESULT_CREATE(1003)   /**< Partial results */
854 #define WHD_INVALID_KEY                  WHD_RESULT_CREATE(1004)   /**< Invalid key */
855 #define WHD_DOES_NOT_EXIST               WHD_RESULT_CREATE(1005)   /**< Does not exist */
856 #define WHD_NOT_AUTHENTICATED            WHD_RESULT_CREATE(1006)   /**< Not authenticated */
857 #define WHD_NOT_KEYED                    WHD_RESULT_CREATE(1007)   /**< Not keyed */
858 #define WHD_IOCTL_FAIL                   WHD_RESULT_CREATE(1008)   /**< IOCTL fail */
859 #define WHD_BUFFER_UNAVAILABLE_TEMPORARY WHD_RESULT_CREATE(1009)   /**< Buffer unavailable temporarily */
860 #define WHD_BUFFER_UNAVAILABLE_PERMANENT WHD_RESULT_CREATE(1010)   /**< Buffer unavailable permanently */
861 #define WHD_CONNECTION_LOST              WHD_RESULT_CREATE(1012)   /**< Connection lost */
862 #define WHD_OUT_OF_EVENT_HANDLER_SPACE   WHD_RESULT_CREATE(1013)   /**< Cannot add extra event handler */
863 #define WHD_SEMAPHORE_ERROR              WHD_RESULT_CREATE(1014)   /**< Error manipulating a semaphore */
864 #define WHD_FLOW_CONTROLLED              WHD_RESULT_CREATE(1015)   /**< Packet retrieval cancelled due to flow control */
865 #define WHD_NO_CREDITS                   WHD_RESULT_CREATE(1016)   /**< Packet retrieval cancelled due to lack of bus credits */
866 #define WHD_NO_PACKET_TO_SEND            WHD_RESULT_CREATE(1017)   /**< Packet retrieval cancelled due to no pending packets */
867 #define WHD_CORE_CLOCK_NOT_ENABLED       WHD_RESULT_CREATE(1018)   /**< Core disabled due to no clock */
868 #define WHD_CORE_IN_RESET                WHD_RESULT_CREATE(1019)   /**< Core disabled - in reset */
869 #define WHD_UNSUPPORTED                  WHD_RESULT_CREATE(1020)   /**< Unsupported function */
870 #define WHD_BUS_WRITE_REGISTER_ERROR     WHD_RESULT_CREATE(1021)   /**< Error writing to WLAN register */
871 #define WHD_SDIO_BUS_UP_FAIL             WHD_RESULT_CREATE(1022)   /**< SDIO bus failed to come up */
872 #define WHD_JOIN_IN_PROGRESS             WHD_RESULT_CREATE(1023)   /**< Join not finished yet */
873 #define WHD_NETWORK_NOT_FOUND            WHD_RESULT_CREATE(1024)   /**< Specified network was not found */
874 #define WHD_INVALID_JOIN_STATUS          WHD_RESULT_CREATE(1025)   /**< Join status error */
875 #define WHD_UNKNOWN_INTERFACE            WHD_RESULT_CREATE(1026)   /**< Unknown interface specified */
876 #define WHD_SDIO_RX_FAIL                 WHD_RESULT_CREATE(1027)   /**< Error during SDIO receive */
877 #define WHD_HWTAG_MISMATCH               WHD_RESULT_CREATE(1028)   /**< Hardware tag header corrupt */
878 #define WHD_RX_BUFFER_ALLOC_FAIL         WHD_RESULT_CREATE(1029)   /**< Failed to allocate a buffer to receive into */
879 #define WHD_BUS_READ_REGISTER_ERROR      WHD_RESULT_CREATE(1030)   /**< Error reading a bus hardware register */
880 #define WHD_THREAD_CREATE_FAILED         WHD_RESULT_CREATE(1031)   /**< Failed to create a new thread */
881 #define WHD_QUEUE_ERROR                  WHD_RESULT_CREATE(1032)   /**< Error manipulating a queue */
882 #define WHD_BUFFER_POINTER_MOVE_ERROR    WHD_RESULT_CREATE(1033)   /**< Error moving the current pointer of a packet buffer  */
883 #define WHD_BUFFER_SIZE_SET_ERROR        WHD_RESULT_CREATE(1034)   /**< Error setting size of packet buffer */
884 #define WHD_THREAD_STACK_NULL            WHD_RESULT_CREATE(1035)   /**< Null stack pointer passed when non null was reqired */
885 #define WHD_THREAD_DELETE_FAIL           WHD_RESULT_CREATE(1036)   /**< Error deleting a thread */
886 #define WHD_SLEEP_ERROR                  WHD_RESULT_CREATE(1037)   /**< Error sleeping a thread */
887 #define WHD_BUFFER_ALLOC_FAIL            WHD_RESULT_CREATE(1038)   /**< Failed to allocate a packet buffer */
888 #define WHD_NO_PACKET_TO_RECEIVE         WHD_RESULT_CREATE(1039)   /**< No Packets waiting to be received */
889 #define WHD_INTERFACE_NOT_UP             WHD_RESULT_CREATE(1040)   /**< Requested interface is not active */
890 #define WHD_DELAY_TOO_LONG               WHD_RESULT_CREATE(1041)   /**< Requested delay is too long */
891 #define WHD_INVALID_DUTY_CYCLE           WHD_RESULT_CREATE(1042)   /**< Duty cycle is outside limit 0 to 100 */
892 #define WHD_PMK_WRONG_LENGTH             WHD_RESULT_CREATE(1043)   /**< Returned pmk was the wrong length */
893 #define WHD_UNKNOWN_SECURITY_TYPE        WHD_RESULT_CREATE(1044)   /**< AP security type was unknown */
894 #define WHD_WEP_NOT_ALLOWED              WHD_RESULT_CREATE(1045)   /**< AP not allowed to use WEP - it is not secure - use Open instead */
895 #define WHD_WPA_KEYLEN_BAD               WHD_RESULT_CREATE(1046)   /**< WPA / WPA2 key length must be between 8 & 64 bytes */
896 #define WHD_FILTER_NOT_FOUND             WHD_RESULT_CREATE(1047)   /**< Specified filter id not found */
897 #define WHD_SPI_ID_READ_FAIL             WHD_RESULT_CREATE(1048)   /**< Failed to read 0xfeedbead SPI id from chip */
898 #define WHD_SPI_SIZE_MISMATCH            WHD_RESULT_CREATE(1049)   /**< Mismatch in sizes between SPI header and SDPCM header */
899 #define WHD_ADDRESS_ALREADY_REGISTERED   WHD_RESULT_CREATE(1050)   /**< Attempt to register a multicast address twice */
900 #define WHD_SDIO_RETRIES_EXCEEDED        WHD_RESULT_CREATE(1051)   /**< SDIO transfer failed too many times. */
901 #define WHD_NULL_PTR_ARG                 WHD_RESULT_CREATE(1052)   /**< Null Pointer argument passed to function. */
902 #define WHD_THREAD_FINISH_FAIL           WHD_RESULT_CREATE(1053)   /**< Error deleting a thread */
903 #define WHD_WAIT_ABORTED                 WHD_RESULT_CREATE(1054)   /**< Semaphore/mutex wait has been aborted */
904 #define WHD_SET_BLOCK_ACK_WINDOW_FAIL    WHD_RESULT_CREATE(1055)   /**< Failed to set block ack window */
905 #define WHD_DELAY_TOO_SHORT              WHD_RESULT_CREATE(1056)   /**< Requested delay is too short */
906 #define WHD_INVALID_INTERFACE            WHD_RESULT_CREATE(1057)   /**< Invalid interface provided */
907 #define WHD_WEP_KEYLEN_BAD               WHD_RESULT_CREATE(1058)   /**< WEP / WEP_SHARED key length must be 5 or 13 bytes */
908 #define WHD_HANDLER_ALREADY_REGISTERED   WHD_RESULT_CREATE(1059)   /**< EAPOL handler already registered */
909 #define WHD_AP_ALREADY_UP                WHD_RESULT_CREATE(1060)   /**< Soft AP or P2P group owner already up */
910 #define WHD_EAPOL_KEY_PACKET_M1_TIMEOUT  WHD_RESULT_CREATE(1061)   /**< Timeout occurred while waiting for EAPOL packet M1 from AP */
911 #define WHD_EAPOL_KEY_PACKET_M3_TIMEOUT  WHD_RESULT_CREATE(1062)   /**< Timeout occurred while waiting for EAPOL packet M3 from APwhich may indicate incorrect WPA2/WPA passphrase */
912 #define WHD_EAPOL_KEY_PACKET_G1_TIMEOUT  WHD_RESULT_CREATE(1063)   /**< Timeout occurred while waiting for EAPOL packet G1 from AP */
913 #define WHD_EAPOL_KEY_FAILURE            WHD_RESULT_CREATE(1064)   /**< Unknown failure occurred during the EAPOL key handshake */
914 #define WHD_MALLOC_FAILURE               WHD_RESULT_CREATE(1065)   /**< Memory allocation failure */
915 #define WHD_ACCESS_POINT_NOT_FOUND       WHD_RESULT_CREATE(1066)   /**< Access point not found */
916 #define WHD_RTOS_ERROR                   WHD_RESULT_CREATE(1067)   /**< RTOS operation failed */
917 #define WHD_CLM_BLOB_DLOAD_ERROR         WHD_RESULT_CREATE(1068)   /**< CLM blob download failed */
918 #define WHD_HAL_ERROR                    WHD_RESULT_CREATE(1069)   /**< WHD HAL Error */
919 #define WHD_RTOS_STATIC_MEM_LIMIT        WHD_RESULT_CREATE(1070)   /**< Exceeding the RTOS static objects memory */
920 #define WHD_NO_REGISTER_FUNCTION_POINTER WHD_RESULT_CREATE(1071)   /**< No register function pointer */
921 
922 #define WLAN_ENUM_OFFSET 2000            /**< WLAN enum offset for WHD_WLAN error processing */
923 
924 #define WHD_WLAN_ERROR                   WHD_RESULT_CREATE(2001) /**< Generic Error */
925 #define WHD_WLAN_BADARG                  WHD_RESULT_CREATE(2002) /**< Bad Argument */
926 #define WHD_WLAN_BADOPTION               WHD_RESULT_CREATE(2003) /**< Bad option */
927 #define WHD_WLAN_NOTUP                   WHD_RESULT_CREATE(2004) /**< Not up */
928 #define WHD_WLAN_NOTDOWN                 WHD_RESULT_CREATE(2005) /**< Not down */
929 #define WHD_WLAN_NOTAP                   WHD_RESULT_CREATE(2006) /**< Not AP */
930 #define WHD_WLAN_NOTSTA                  WHD_RESULT_CREATE(2007) /**< Not STA  */
931 #define WHD_WLAN_BADKEYIDX               WHD_RESULT_CREATE(2008) /**< BAD Key Index */
932 #define WHD_WLAN_RADIOOFF                WHD_RESULT_CREATE(2009) /**< Radio Off */
933 #define WHD_WLAN_NOTBANDLOCKED           WHD_RESULT_CREATE(2010) /**< Not  band locked */
934 #define WHD_WLAN_NOCLK                   WHD_RESULT_CREATE(2011) /**< No Clock */
935 #define WHD_WLAN_BADRATESET              WHD_RESULT_CREATE(2012) /**< BAD Rate valueset */
936 #define WHD_WLAN_BADBAND                 WHD_RESULT_CREATE(2013) /**< BAD Band */
937 #define WHD_WLAN_BUFTOOSHORT             WHD_RESULT_CREATE(2014) /**< Buffer too short */
938 #define WHD_WLAN_BUFTOOLONG              WHD_RESULT_CREATE(2015) /**< Buffer too long */
939 #define WHD_WLAN_BUSY                    WHD_RESULT_CREATE(2016) /**< Busy */
940 #define WHD_WLAN_NOTASSOCIATED           WHD_RESULT_CREATE(2017) /**< Not Associated */
941 #define WHD_WLAN_BADSSIDLEN              WHD_RESULT_CREATE(2018) /**< Bad SSID len */
942 #define WHD_WLAN_OUTOFRANGECHAN          WHD_RESULT_CREATE(2019) /**< Out of Range Channel */
943 #define WHD_WLAN_BADCHAN                 WHD_RESULT_CREATE(2020) /**< Bad Channel */
944 #define WHD_WLAN_BADADDR                 WHD_RESULT_CREATE(2021) /**< Bad Address */
945 #define WHD_WLAN_NORESOURCE              WHD_RESULT_CREATE(2022) /**< Not Enough Resources */
946 #define WHD_WLAN_UNSUPPORTED             WHD_RESULT_CREATE(2023) /**< Unsupported */
947 #define WHD_WLAN_BADLEN                  WHD_RESULT_CREATE(2024) /**< Bad length */
948 #define WHD_WLAN_NOTREADY                WHD_RESULT_CREATE(2025) /**< Not Ready */
949 #define WHD_WLAN_EPERM                   WHD_RESULT_CREATE(2026) /**< Not Permitted */
950 #define WHD_WLAN_NOMEM                   WHD_RESULT_CREATE(2027) /**< No Memory */
951 #define WHD_WLAN_ASSOCIATED              WHD_RESULT_CREATE(2028) /**< Associated */
952 #define WHD_WLAN_RANGE                   WHD_RESULT_CREATE(2029) /**< Not In Range */
953 #define WHD_WLAN_NOTFOUND                WHD_RESULT_CREATE(2030) /**< Not Found */
954 #define WHD_WLAN_WME_NOT_ENABLED         WHD_RESULT_CREATE(2031) /**< WME Not Enabled */
955 #define WHD_WLAN_TSPEC_NOTFOUND          WHD_RESULT_CREATE(2032) /**< TSPEC Not Found */
956 #define WHD_WLAN_ACM_NOTSUPPORTED        WHD_RESULT_CREATE(2033) /**< ACM Not Supported */
957 #define WHD_WLAN_NOT_WME_ASSOCIATION     WHD_RESULT_CREATE(2034) /**< Not WME Association */
958 #define WHD_WLAN_SDIO_ERROR              WHD_RESULT_CREATE(2035) /**< SDIO Bus Error */
959 #define WHD_WLAN_WLAN_DOWN               WHD_RESULT_CREATE(2036) /**< WLAN Not Accessible */
960 #define WHD_WLAN_BAD_VERSION             WHD_RESULT_CREATE(2037) /**< Incorrect version */
961 #define WHD_WLAN_TXFAIL                  WHD_RESULT_CREATE(2038) /**< TX failure */
962 #define WHD_WLAN_RXFAIL                  WHD_RESULT_CREATE(2039) /**< RX failure */
963 #define WHD_WLAN_NODEVICE                WHD_RESULT_CREATE(2040) /**< Device not present */
964 #define WHD_WLAN_UNFINISHED              WHD_RESULT_CREATE(2041) /**< To be finished */
965 #define WHD_WLAN_NONRESIDENT             WHD_RESULT_CREATE(2042) /**< access to nonresident overlay */
966 #define WHD_WLAN_DISABLED                WHD_RESULT_CREATE(2043) /**< Disabled in this build */
967 #define WHD_WLAN_NOFUNCTION              WHD_RESULT_CREATE(2044) /**< Function pointer not provided */
968 #define WHD_WLAN_INVALID                 WHD_RESULT_CREATE(2045) /**< Not valid */
969 #define WHD_WLAN_NOBAND                  WHD_RESULT_CREATE(2046) /**< No Band */
970 
971 /**
972  * type definition for whd_buffer_t
973  */
974 typedef whd_buffer_t whd_buffer_queue_ptr_t;
975 
976 #pragma pack(1)
977 
978 /**
979  * Structure for storing AP information
980  */
981 typedef struct whd_ap_info
982 {
983     whd_ssid_t SSID;          /**< Service Set Identification (i.e. Name of Access Point)                    */
984     whd_mac_t BSSID;          /**< Basic Service Set Identification (i.e. MAC address of Access Point)       */
985     int16_t signal_strength;  /**< Receive Signal Strength Indication in dBm. <-90=Very poor, >-30=Excellent */
986     uint32_t max_data_rate;   /**< Maximum data rate in kilobits/s                                           */
987     whd_bss_type_t bss_type;  /**< Network type                                                              */
988     whd_security_t security;  /**< Security type                                                             */
989     uint8_t channel;          /**< Radio channel that the AP beacon was received on                          */
990     whd_802_11_band_t band;   /**< Radio band                                                                */
991     struct whd_ap_info *next; /**< Pointer to the next scan result                                           */
992 } whd_ap_info_t;
993 
994 /**
995  * Structure describing a list of associated softAP clients
996  */
997 typedef struct
998 {
999     uint32_t count;          /**< Number of MAC addresses in the list    */
1000     whd_mac_t mac_list[1];   /**< Variable length array of MAC addresses */
1001 } whd_maclist_t;
1002 
1003 #pragma pack()
1004 
1005 /**
1006  * Structure describing a list of PMKID
1007  */
1008 typedef struct _pmkid
1009 {
1010     whd_mac_t BSSID;
1011     uint8_t PMKID[PMKID_LEN];
1012 } pmkid_t;
1013 
1014 typedef struct _pmkid_list
1015 {
1016     uint32_t npmkid;
1017     pmkid_t pmkid[1];
1018 } pmkid_list_t;
1019 
1020 /**
1021  * Structure used by both dongle and host
1022  * dongle asks host to start auth(SAE), host updates auth status to dongle.
1023  */
1024 typedef struct whd_auth_req_status
1025 {
1026     uint16_t flags;
1027     whd_mac_t peer_mac; /* peer mac address */
1028     uint32_t ssid_len;
1029     uint8_t ssid[SSID_NAME_SIZE];
1030     uint8_t pmkid[PMKID_LEN];
1031 } whd_auth_req_status_t;
1032 
1033 /**
1034  * Time value in milliseconds
1035  */
1036 typedef uint32_t whd_time_t;
1037 
1038 /**
1039  * Structure for storing a WEP key
1040  */
1041 typedef struct
1042 {
1043     uint8_t index;    /**< WEP key index [0/1/2/3]                                         */
1044     uint8_t length;   /**< WEP key length. Either 5 bytes (40-bits) or 13-bytes (104-bits) */
1045     uint8_t data[32]; /**< WEP key as values NOT characters                                */
1046 } whd_wep_key_t;
1047 
1048 /**
1049  * Structure for management frame(auth) params
1050  */
1051 typedef struct whd_auth_params
1052 {
1053     uint32_t version;
1054     uint32_t dwell_time;
1055     uint16_t len; /* Len includes Len(MAC Headers) + Len(Contents) */
1056     uint16_t fc;
1057     uint16_t channel;
1058     whd_mac_t da;
1059     whd_mac_t bssid;
1060     uint32_t packetId;
1061     uint8_t data[1];  /* It contains MAC Headers + Contexts*/
1062 } whd_auth_params_t;
1063 
1064 /**
1065  * Structure for Out-of-band interrupt config parameters which can be set by application during whd power up
1066  */
1067 typedef struct whd_oob_config
1068 {
1069     cyhal_gpio_t host_oob_pin;   /**< Host-side GPIO pin selection */
1070     uint8_t dev_gpio_sel;        /**< WiFi device-side GPIO pin selection (must be zero) */
1071     whd_bool_t is_falling_edge;  /**< Interrupt trigger (polarity) */
1072     uint8_t intr_priority;       /**< OOB interrupt priority */
1073 } whd_oob_config_t;
1074 
1075 /**
1076  * Structure for SDIO config parameters which can be set by application during whd power up
1077  */
1078 typedef struct whd_sdio_config
1079 {
1080     /* Bus config */
1081     whd_bool_t sdio_1bit_mode;        /**< Default is false, means SDIO operates under 4 bit mode */
1082     whd_bool_t high_speed_sdio_clock; /**< Default is false, means SDIO operates in normal clock rate */
1083     whd_oob_config_t oob_config;      /**< Out-of-band interrupt configuration (required when bus can sleep) */
1084 } whd_sdio_config_t;
1085 
1086 /**
1087  * Structure for SPI config parameters which can be set by application during whd power up
1088  */
1089 typedef struct whd_spi_config
1090 {
1091     /* Bus config */
1092     whd_bool_t is_spi_normal_mode; /**< Default is false */
1093     whd_oob_config_t oob_config;   /**< Out-of-band interrupt configuration */
1094 } whd_spi_config_t;
1095 
1096 /**
1097  * Structure for M2M config parameters which can be set by application during whd power up
1098  */
1099 typedef struct whd_m2m_config
1100 {
1101     /* Bus config */
1102     whd_bool_t is_normal_mode; /**< Default is false */
1103 } whd_m2m_config_t;
1104 
1105 
1106 /**
1107  * Enumeration of applicable packet mask bits for custom Information Elements (IEs)
1108  */
1109 typedef enum
1110 {
1111     VENDOR_IE_BEACON = 0x1,         /**< Denotes beacon packet                  */
1112     VENDOR_IE_PROBE_RESPONSE = 0x2, /**< Denotes probe response packet          */
1113     VENDOR_IE_ASSOC_RESPONSE = 0x4, /**< Denotes association response packet    */
1114     VENDOR_IE_AUTH_RESPONSE = 0x8,  /**< Denotes authentication response packet */
1115     VENDOR_IE_PROBE_REQUEST = 0x10, /**< Denotes probe request packet           */
1116     VENDOR_IE_ASSOC_REQUEST = 0x20, /**< Denotes association request packet     */
1117     VENDOR_IE_CUSTOM = 0x100,       /**< Denotes a custom IE(Information Element) identifier */
1118     VENDOR_IE_UNKNOWN = ~(VENDOR_IE_BEACON | VENDOR_IE_PROBE_RESPONSE | VENDOR_IE_ASSOC_RESPONSE | \
1119                           VENDOR_IE_AUTH_RESPONSE | VENDOR_IE_PROBE_REQUEST | VENDOR_IE_ASSOC_REQUEST | \
1120                           VENDOR_IE_CUSTOM)
1121 } whd_ie_packet_flag_t;
1122 
1123 /**
1124  * Structure for LE Scan parameters
1125  */
1126 typedef struct whd_btc_lescan_params
1127 {
1128     uint16_t priority;      /**< LE scan priority */
1129     uint16_t duty_cycle;    /**< LE scan duty cycle */
1130     uint16_t max_win;       /**< LE Max Scan window */
1131     uint16_t int_grant;     /**< LE Small Interval Grant */
1132     uint16_t scan_int;      /**< LE scan interval */
1133     uint16_t scan_win;      /**< LE scan Window */
1134 } whd_btc_lescan_params_t;
1135 
1136 /**
1137  * Structure for coex config parameters which can be set by application
1138  */
1139 typedef struct whd_coex_config
1140 {
1141     whd_btc_lescan_params_t le_scan_params;  /**< LE Scan Parameters */
1142 } whd_coex_config_t;
1143 
1144 #define PORT_FILTER_LEN 26  /**< Port filter len */
1145 #define PACKET_FILTER_LIST_BUFFER_MAX_LEN 1000  /**< Packet filter buffer max len */
1146 /**
1147  * Enumeration of packet filter rules
1148  */
1149 typedef enum
1150 {
1151     WHD_PACKET_FILTER_RULE_POSITIVE_MATCHING  = 0, /**< Specifies that a filter should match a given pattern	 */
1152     WHD_PACKET_FILTER_RULE_NEGATIVE_MATCHING  = 1  /**< Specifies that a filter should NOT match a given pattern */
1153 } whd_packet_filter_rule_t;
1154 
1155 /**
1156  * Structure describing a packet filter list item
1157  */
1158 typedef struct
1159 {
1160     uint32_t id;                                  /**< Unique identifier for a packet filter item							  */
1161     whd_packet_filter_rule_t rule;                /**< Filter matches are either POSITIVE or NEGATIVE matching */
1162     uint16_t offset;                              /**< Offset in bytes to start filtering (referenced to the start of the ethernet packet) */
1163     uint16_t mask_size;                           /**< Size of the mask in bytes */
1164     uint8_t *mask;                                /**< Pattern mask bytes to be ANDed with the pattern eg. "\xff00" (must be in network byte order) */
1165     uint8_t *pattern;                             /**< Pattern bytes used to filter eg. "\x0800"  (must be in network byte order) */
1166     whd_bool_t enabled_status;                     /**< When returned from wwd_wifi_get_packet_filters, indicates if the filter is enabled */
1167 } whd_packet_filter_t;
1168 
1169 #define TKO_DATA_OFFSET offsetof(wl_tko_t, data)  /**< TKO data offset */
1170 
1171 #ifdef __cplusplus
1172 }     /* extern "C" */
1173 #endif
1174 #endif /* ifndef INCLUDED_WHD_TYPES_H_ */
1175