1 /*
2  *  Copyright 2008-2024 NXP
3  *
4  *  SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 /*! \file wlan.h
9  * \brief WLAN Connection Manager
10  *
11  * The WLAN Connection Manager (WLCMGR) is one of the core components that
12  * provides WiFi-level functionality like scanning for networks,
13  * starting a network (Access Point) and associating / disassociating with
14  * other wireless networks. The WLCMGR manages two logical interfaces,
15  * the station interface and the micro-AP interface.
16  * Both these interfaces can be active at the same time.
17  *
18  * \section wlan_usage Usage
19  *
20  * The WLCMGR is initialized by calling \ref wlan_init() and started by
21  * calling \ref wlan_start(), one of the arguments of this function is a
22  * callback handler. Many of the WLCMGR tasks are asynchronous in nature,
23  * and the events are provided by invoking the callback handler.
24  * The various usage scenarios of the WLCMGR are outlined below:
25  *
26  * - <b>Scanning:</b> A call to wlan_scan() initiates an asynchronous scan of
27  *      the nearby wireless networks. The results are reported via the callback
28  *      handler.
29  * - <b>Network Profiles:</b> Starting / stopping wireless interfaces or
30  *      associating / disassociating with other wireless networks is managed
31  *      through network profiles. The network profiles record details about the
32  *      wireless network like the SSID, type of security, security passphrase
33  *      among other things. The network profiles can be managed by means of the
34  *      \ref wlan_add_network() and \ref wlan_remove_network() calls.
35  * - <b>Association:</b> The \ref wlan_connect() and \ref wlan_disconnect()
36  *      calls can be used to manage connectivity with other wireless networks
37  *      (Access Points). These calls manage the station interface of the system.
38  * - <b>Starting a Wireless Network:</b> The \ref wlan_start_network()
39  *       and \ref wlan_stop_network() calls can be used to start/stop
40  *       our own (micro-AP) network. These calls manage
41  *       the micro-AP interface of the system.
42  *
43  * @cond uml_diag
44  *
45  * \section WLCMGR_station_sm Station State Machine
46  *
47  * The WLAN Connection Manager station state diagram is as shown below. The Yellow boxes
48  * indicate the various states. The top half is the name of the state, and the
49  * bottom half consists of any code that is executed on entering that
50  * state. Labels on the transitions indicate when that particular transition is
51  * taken.
52  *
53  * @startuml{station.jpg}
54  *
55  * [*] --> Initializing
56  * Initializing: net_wlan_init()
57  * Initializing -down-> Idle : Success
58  *
59  * Idle -right-> Scanning : wlan_connect(WPA/WPA2/Mixed/Open)
60  * Idle -left-> Configuring : wlan_connect(WEP)
61  * Idle -down-> Scanning_User: wlan_scan()
62  *
63  * Scanning_User: report_scan_results()
64  * Scanning_User -up-> Idle: scan_success
65  *
66  * Scanning: handle_scan_results()
67  * Scanning -left-> Scanning : scan_success
68  * Scanning -down-> Associating: Success
69  * Configuring: wifi_send_wep_key_material_cmd()
70  * Configuring -down-> Scanning: Success
71  *
72  * Associating: configure_security(), wifi_assoc()
73  * Associating -down->Associated: assoc_success
74  * Associating -up->Scanning: assoc_failure
75  *
76  * Associated -down-> Requesting_Address: authentication_success
77  * Associated -up-> Idle: authentication_failure, disassociation, deauthentication
78  *
79  * Requesting_Address: net_configure_address()
80  * Requesting_Address -down-> Connected: static_ip
81  * Requesting_Address -left-> Obtaining_Address: dhcp_ip
82  *
83  * Obtaining_Address: dhcp_start()
84  * Obtaining_Address -down-> Connected: dhcp_success
85  * Obtaining_Address -up-> Idle: dhcp_failure
86  *
87  * Connected: net_configure_dns()
88  * Connected -up-> Idle: lins_loss, channel_switch, wlan_disconnect()
89  *
90  * @enduml
91  *
92  * \section WLCMGR_uap_sm Micro-AP State Machine
93  *
94  * The WLAN Connection Manager micro-AP state diagram is as shown below. The Yellow boxes
95  * indicate the various states. The top half is the name of the state, and the
96  * bottom half consists of any code that is executed on entering that
97  * state. Labels on the transitions indicate when that particular transition is
98  * taken.
99  *
100  * @startuml{uap.jpg}
101  *
102  * [*] --> Initializing
103  * Initializing: net_wlan_init()
104  * Initializing -down-> Configured: wlan_start_network()
105  *
106  * Configured: do_start()
107  * Configured -down-> Started: up_started
108  *
109  * Started: net_configure_address()
110  * Started -down-> Up: uap_addr_config
111  *
112  * Up -up-> Initializing: wlan_stop_network()
113  * Started -up-> Initializing: wlan_stop_network()
114  *
115  * @enduml
116  *
117  * @endcond
118  */
119 
120 #ifndef __WLAN_H__
121 #define __WLAN_H__
122 #include <nxp_wifi.h>
123 
124 #include <wmtypes.h>
125 #include <wmerrno.h>
126 #include <stdint.h>
127 #include <wifi_events.h>
128 #include <wifi.h>
129 
130 #define WLAN_DRV_VERSION "v1.3.r49.z_up.p8"
131 
132 #if CONFIG_WPA2_ENTP
133 #include <wm_mbedtls_helper_api.h>
134 #endif
135 
136 #define ARG_UNUSED(x) (void)(x)
137 /* Configuration */
138 
139 #if !CONFIG_WLAN_KNOWN_NETWORKS
140 #define CONFIG_WLAN_KNOWN_NETWORKS 5U
141 #endif
142 
143 #include <wmlog.h>
144 #define wlcm_e(...) wmlog_e("wlcm", ##__VA_ARGS__)
145 #define wlcm_w(...) wmlog_w("wlcm", ##__VA_ARGS__)
146 
147 #if CONFIG_WLCMGR_DEBUG
148 #define wlcm_d(...) wmlog("wlcm", ##__VA_ARGS__)
149 #else
150 #define wlcm_d(...)
151 #endif /* ! CONFIG_WLCMGR_DEBUG */
152 
153 #if (defined(configSUPPORT_STATIC_ALLOCATION) && (configSUPPORT_STATIC_ALLOCATION > 0U)) && \
154     !((defined(configSUPPORT_DYNAMIC_ALLOCATION) && (configSUPPORT_DYNAMIC_ALLOCATION == 1U)))
155 
156 #if CONFIG_WPA_SUPP
157 #error "Static memory allocation is not supported for wpa supplicant "
158 #endif
159 
160 #endif
161 
162 /** Action GET */
163 #define ACTION_GET (0U)
164 /** Action SET */
165 #define ACTION_SET (1)
166 
167 /** Maximum SSID length */
168 #ifndef IEEEtypes_SSID_SIZE
169 #define IEEEtypes_SSID_SIZE 32U
170 #endif /* IEEEtypes_SSID_SIZE */
171 
172 /** MAC Address length */
173 #ifndef IEEEtypes_ADDRESS_SIZE
174 #define IEEEtypes_ADDRESS_SIZE 6
175 #endif /* IEEEtypes_ADDRESS_SIZE */
176 
177 #if CONFIG_HOST_SLEEP
178 #if CONFIG_POWER_MANAGER
179 extern osa_msg_handle_t mon_thread_event_queue;
180 #endif
181 #endif
182 
183 #define WLAN_REASON_CODE_PREV_AUTH_NOT_VALID 2U
184 
185 typedef enum
186 {
187     BSS_INFRASTRUCTURE = 1,
188     BSS_INDEPENDENT,
189     BSS_ANY
190 } IEEEtypes_Bss_t;
191 
192 /* The possible types of Basic Service Sets */
193 
194 /** The number of times that the WLAN Connection Manager will look for a
195  *  network before giving up. */
196 #if CONFIG_MAX_RESCAN_LIMIT
197 #define WLAN_RESCAN_LIMIT CONFIG_MAX_RESCAN_LIMIT
198 #else
199 #if CONFIG_WPA_SUPP
200 #define WLAN_RESCAN_LIMIT 30U
201 #else
202 #if CONFIG_P2P
203 #define WLAN_RESCAN_LIMIT 10U
204 #else
205 #define WLAN_RESCAN_LIMIT 5U
206 #endif /* CONFIG_P2P */
207 #endif /* CONFIG_WPA_SUPP */
208 #endif /* CONFIG_MAX_RESCAN_LIMIT */
209 
210 #define WLAN_11D_SCAN_LIMIT 3U
211 /** The number of times that the WLAN Connection Manager will attempt a
212  * reconnection with the network before giving up. */
213 #define WLAN_RECONNECT_LIMIT 5U
214 /** The minimum length for network names, see \ref wlan_network.  This must
215  *  be between 1 and \ref WLAN_NETWORK_NAME_MAX_LENGTH */
216 #define WLAN_NETWORK_NAME_MIN_LENGTH 1U
217 /** The space reserved for storing network names, \ref wlan_network */
218 #define WLAN_NETWORK_NAME_MAX_LENGTH 32U
219 /** The space reserved for storing PSK (password) phrases. */
220 /* Min WPA2 passphrase can be upto 8 ASCII chars */
221 #define WLAN_PSK_MIN_LENGTH 8U
222 /** Max WPA2 passphrase can be upto 63 ASCII chars or 64 hexadecimal digits*/
223 #define WLAN_PSK_MAX_LENGTH 65U
224 /** Min WPA3 password can be upto 8 ASCII chars */
225 #define WLAN_PASSWORD_MIN_LENGTH 8U
226 /** Max WPA3 password can be upto 255 ASCII chars */
227 #define WLAN_PASSWORD_MAX_LENGTH 255U
228 /** Max WPA2 Enterprise identity can be upto 256 characters */
229 #define IDENTITY_MAX_LENGTH 64U
230 /** Max WPA2 Enterprise password can be upto 256 unicode characters */
231 #define PASSWORD_MAX_LENGTH 128U
232 /** Max identities for EAP server users */
233 #define MAX_USERS 8U
234 /** Encryption key for EAP-FAST PAC-Opaque values. This key must be a secret, random value. It is configured as a
235  * 16-octet value in hex format. */
236 #define PAC_OPAQUE_ENCR_KEY_MAX_LENGTH 33U
237 /** A-ID indicates the identity of the authority that issues PACs. The A-ID should be unique across all issuing servers.
238  * A-ID to be 16 octets in length */
239 #define A_ID_MAX_LENGTH 33U
240 /** MAX CA Cert hash len */
241 #define HASH_MAX_LENGTH 40U
242 /** MAX domain len */
243 #define DOMAIN_MATCH_MAX_LENGTH 64U
244 
245 #if CONFIG_WLAN_KNOWN_NETWORKS
246 /** The size of the list of known networks maintained by the WLAN
247    Connection Manager */
248 #define WLAN_MAX_KNOWN_NETWORKS CONFIG_WLAN_KNOWN_NETWORKS
249 #else
250 #error "CONFIG_WLAN_KNOWN_NETWORKS is not defined"
251 #endif /* CONFIG_WLAN_KNOWN_NETWORKS */
252 /** Length of a pairwise master key (PMK).  It's always 256 bits (32 Bytes) */
253 #define WLAN_PMK_LENGTH 32
254 
255 #if CONFIG_WMM_UAPSD
256 #define WMM_UAPSD_QOS_INFO     0x0F
257 #define WMM_UAPSD_SLEEP_PERIOD 20
258 #endif
259 
260 #if CONFIG_UAP_STA_MAC_ADDR_FILTER
261 
262 /* Max number of sta filter list can be upto 16 */
263 #define WLAN_MAX_STA_FILTER_NUM 16
264 
265 /* The length of wlan mac address */
266 #define WLAN_MAC_ADDR_LENGTH 6
267 #endif
268 
269 /* Error Codes */
270 
271 /** The operation was successful. */
272 #define WLAN_ERROR_NONE 0
273 /** The operation failed due to an error with one or more parameters. */
274 #define WLAN_ERROR_PARAM 1
275 /** The operation could not be performed because there is not enough memory. */
276 #define WLAN_ERROR_NOMEM 2
277 /** The operation could not be performed in the current system state. */
278 #define WLAN_ERROR_STATE 3
279 /** The operation failed due to an internal error. */
280 #define WLAN_ERROR_ACTION 4
281 /** The operation to change power state could not be performed*/
282 #define WLAN_ERROR_PS_ACTION 5
283 /** The requested feature is not supported*/
284 #define WLAN_ERROR_NOT_SUPPORTED 6
285 
286 /*
287  * HOST_WAKEUP_GPIO_PIN / CARD_WAKEUP_GPIO_PIN
288  *
289  *   this GPIO PIN number defines the default config. This is chip
290  *   specific, and a compile time setting depending on the system
291  *   board level build!
292  */
293 #if defined(SD8997) || defined(SD9098) || defined(SD9064) || defined(RW610)
294 #define HOST_WAKEUP_GPIO_PIN 12
295 #define CARD_WAKEUP_GPIO_PIN 13
296 #elif defined(SD9177)
297 #define HOST_WAKEUP_GPIO_PIN 17
298 #define CARD_WAKEUP_GPIO_PIN 16
299 #elif defined(SD9097)
300 #if defined(SD9097_V0)
301 #define CARD_WAKEUP_GPIO_PIN 7
302 #elif defined(SD9097_V1)
303 #define HOST_WAKEUP_GPIO_PIN 12
304 #define CARD_WAKEUP_GPIO_PIN 3
305 #endif
306 #elif defined(WIFI_88W8987_BOARD_MURATA_1ZM_M2) || defined(WIFI_IW416_BOARD_MURATA_1XK_M2)
307 #define HOST_WAKEUP_GPIO_PIN 2
308 #define CARD_WAKEUP_GPIO_PIN 16
309 #else
310 #define HOST_WAKEUP_GPIO_PIN 1
311 #define CARD_WAKEUP_GPIO_PIN 16
312 #endif
313 
314 #define WLAN_MGMT_DIASSOC MBIT(10)
315 #define WLAN_MGMT_AUTH    MBIT(11)
316 #define WLAN_MGMT_DEAUTH  MBIT(12)
317 /** BITMAP for Action frame */
318 #define WLAN_MGMT_ACTION MBIT(13)
319 
320 #if CONFIG_WMM_UAPSD
321 #define WMM_UAPSD_QOS_INFO     0x0F
322 #define WMM_UAPSD_SLEEP_PERIOD 20
323 #endif
324 
325 #define WLAN_KEY_MGMT_IEEE8021X             MBIT(0)
326 #define WLAN_KEY_MGMT_PSK                   MBIT(1)
327 #define WLAN_KEY_MGMT_NONE                  MBIT(2)
328 #define WLAN_KEY_MGMT_IEEE8021X_NO_WPA      MBIT(3)
329 #define WLAN_KEY_MGMT_WPA_NONE              MBIT(4)
330 #define WLAN_KEY_MGMT_FT_IEEE8021X          MBIT(5)
331 #define WLAN_KEY_MGMT_FT_PSK                MBIT(6)
332 #define WLAN_KEY_MGMT_IEEE8021X_SHA256      MBIT(7)
333 #define WLAN_KEY_MGMT_PSK_SHA256            MBIT(8)
334 #define WLAN_KEY_MGMT_WPS                   MBIT(9)
335 #define WLAN_KEY_MGMT_SAE                   MBIT(10)
336 #define WLAN_KEY_MGMT_FT_SAE                MBIT(11)
337 #define WLAN_KEY_MGMT_WAPI_PSK              MBIT(12)
338 #define WLAN_KEY_MGMT_WAPI_CERT             MBIT(13)
339 #define WLAN_KEY_MGMT_CCKM                  MBIT(14)
340 #define WLAN_KEY_MGMT_OSEN                  MBIT(15)
341 #define WLAN_KEY_MGMT_IEEE8021X_SUITE_B     MBIT(16)
342 #define WLAN_KEY_MGMT_IEEE8021X_SUITE_B_192 MBIT(17)
343 #define WLAN_KEY_MGMT_FILS_SHA256           MBIT(18)
344 #define WLAN_KEY_MGMT_FILS_SHA384           MBIT(19)
345 #define WLAN_KEY_MGMT_FT_FILS_SHA256        MBIT(20)
346 #define WLAN_KEY_MGMT_FT_FILS_SHA384        MBIT(21)
347 #define WLAN_KEY_MGMT_OWE                   MBIT(22)
348 #define WLAN_KEY_MGMT_DPP                   MBIT(23)
349 #define WLAN_KEY_MGMT_FT_IEEE8021X_SHA384   MBIT(24)
350 #define WLAN_KEY_MGMT_PASN                  MBIT(25)
351 #define WLAN_KEY_MGMT_SAE_EXT_KEY           MBIT(26)
352 
353 #define WLAN_KEY_MGMT_FT                                                                                            \
354     (WLAN_KEY_MGMT_FT_PSK | WLAN_KEY_MGMT_FT_IEEE8021X | WLAN_KEY_MGMT_FT_IEEE8021X_SHA384 | WLAN_KEY_MGMT_FT_SAE | \
355      WLAN_KEY_MGMT_FT_FILS_SHA256 | WLAN_KEY_MGMT_FT_FILS_SHA384)
356 
357 #if CONFIG_WPA_SUPP
358 
359 #define WLAN_CIPHER_NONE         MBIT(0)
360 #define WLAN_CIPHER_WEP40        MBIT(1)
361 #define WLAN_CIPHER_WEP104       MBIT(2)
362 #define WLAN_CIPHER_TKIP         MBIT(3)
363 #define WLAN_CIPHER_CCMP         MBIT(4)
364 #define WLAN_CIPHER_AES_128_CMAC MBIT(5)
365 #define WLAN_CIPHER_GCMP         MBIT(6)
366 #define WLAN_CIPHER_SMS4         MBIT(7)
367 #define WLAN_CIPHER_GCMP_256     MBIT(8)
368 #define WLAN_CIPHER_CCMP_256     MBIT(9)
369 #define WLAN_CIPHER_BIP_GMAC_128 MBIT(11)
370 #define WLAN_CIPHER_BIP_GMAC_256 MBIT(12)
371 #define WLAN_CIPHER_BIP_CMAC_256 MBIT(13)
372 #define WLAN_CIPHER_GTK_NOT_USED MBIT(14)
373 
374 #endif
375 
376 /** Enum for wlan errors*/
377 enum wm_wlan_errno
378 {
379     WM_E_WLAN_ERRNO_BASE = MOD_ERROR_START(MOD_WLAN),
380     /** The Firmware download operation failed. */
381     WLAN_ERROR_FW_DNLD_FAILED,
382     /** The Firmware ready register not set. */
383     WLAN_ERROR_FW_NOT_READY,
384     /** The WiFi card not found. */
385     WLAN_ERROR_CARD_NOT_DETECTED,
386     /** The WiFi Firmware not found. */
387     WLAN_ERROR_FW_NOT_DETECTED,
388     /** BSSID not found in scan list */
389     WLAN_BSSID_NOT_FOUND_IN_SCAN_LIST,
390 };
391 
392 /* Events and States */
393 
394 /** WLAN Connection Manager event reason */
395 enum wlan_event_reason
396 {
397     /** The WLAN Connection Manager has successfully connected to a network and
398      *  is now in the \ref WLAN_CONNECTED state. */
399     WLAN_REASON_SUCCESS,
400     /** The WLAN Connection Manager has successfully authenticated to a network and
401      *  is now in the \ref WLAN_ASSOCIATED state. */
402     WLAN_REASON_AUTH_SUCCESS,
403     /** The WLAN Connection Manager has successfully associated to a network and
404      *  is now in the \ref WLAN_ASSOCIATED state. */
405     WLAN_REASON_ASSOC_SUCCESS,
406     /** The WLAN Connection Manager failed to connect before actual
407      * connection attempt with AP due to incorrect wlan network profile.
408      * or The WLAN Connection Manager failed to reconnect to previously connected
409      * network and it is now in the \ref WLAN_DISCONNECTED state.*/
410     WLAN_REASON_CONNECT_FAILED,
411     /** The WLAN Connection Manager could not find the network that it was
412      *  connecting to and it is now in the \ref WLAN_DISCONNECTED state. */
413     WLAN_REASON_NETWORK_NOT_FOUND,
414 #if CONFIG_BG_SCAN
415     /** The WLAN Connection Manager could not find the network in bg scan during roam attempt that it was
416      *  connecting to and it is now in the \ref WLAN_CONNECTED state with previous AP. */
417     WLAN_REASON_BGSCAN_NETWORK_NOT_FOUND,
418 #endif
419     /** The WLAN Connection Manager failed to authenticate with the network
420      *  and is now in the \ref WLAN_DISCONNECTED state. */
421     WLAN_REASON_NETWORK_AUTH_FAILED,
422     /** DHCP lease has been renewed.*/
423     WLAN_REASON_ADDRESS_SUCCESS,
424     /** The WLAN Connection Manager failed to obtain an IP address
425      *  or TCP stack configuration has failed or the IP address
426      *  configuration was lost due to a DHCP error.  The system is
427      *  now in the \ref WLAN_DISCONNECTED state. */
428     WLAN_REASON_ADDRESS_FAILED,
429     /** The WLAN Connection Manager has lost the link to the current network. */
430     WLAN_REASON_LINK_LOST,
431     /** The WLAN Connection Manager has received a deauthentication or disassociation frame */
432     WLAN_REASON_DISCONNECTED,
433     /** The WLAN Connection Manager has received the channel switch
434      * announcement from the current network. */
435     WLAN_REASON_CHAN_SWITCH,
436     /** The WLAN Connection Manager has disconnected from the WPS network
437      *  (or has canceled a connection attempt) by request and is now in the
438      *  WLAN_DISCONNECTED state. */
439     WLAN_REASON_WPS_DISCONNECT,
440     /** The WLAN Connection Manager has disconnected from the current network
441      *  (or has canceled a connection attempt) by request and is now in the
442      *  WLAN_DISCONNECTED state. */
443     WLAN_REASON_USER_DISCONNECT,
444     /** The WLAN Connection Manager is initialized and is ready for use.
445      *  That is, it's now possible to scan or to connect to a network. */
446     WLAN_REASON_INITIALIZED,
447     /** The WLAN Connection Manager has failed to initialize and is therefore
448      *  not running. It is not possible to scan or to connect to a network.  The
449      *  WLAN Connection Manager should be stopped and started again via
450      *  wlan_stop() and wlan_start() respectively. */
451     WLAN_REASON_INITIALIZATION_FAILED,
452 #if (CONFIG_WIFI_IND_DNLD)
453     /** The WLAN Connection Manager has entered in hang mode. */
454     WLAN_REASON_FW_HANG,
455     /** The WLAN Connection Manager has reset fw successfully. */
456     WLAN_REASON_FW_RESET,
457 #endif
458     /** The WLAN Connection Manager has entered power save mode. */
459     WLAN_REASON_PS_ENTER,
460     /** The WLAN Connection Manager has exited from power save mode. */
461     WLAN_REASON_PS_EXIT,
462     /** The WLAN Connection Manager has started uAP */
463     WLAN_REASON_UAP_SUCCESS,
464     /** A wireless client has joined uAP's BSS network */
465     WLAN_REASON_UAP_CLIENT_ASSOC,
466     /** A wireless client has auhtenticated and connected to uAP's BSS network */
467     WLAN_REASON_UAP_CLIENT_CONN,
468     /** A wireless client has left uAP's BSS network */
469     WLAN_REASON_UAP_CLIENT_DISSOC,
470     /** The WLAN Connection Manager has failed to start uAP */
471     WLAN_REASON_UAP_START_FAILED,
472     /** The WLAN Connection Manager has failed to stop uAP */
473     WLAN_REASON_UAP_STOP_FAILED,
474     /** The WLAN Connection Manager has stopped uAP */
475     WLAN_REASON_UAP_STOPPED,
476     /** The WLAN Connection Manager has received subscribed RSSI low event on station interface as per configured
477        threshold and frequency. If CONFIG_11K, CONFIG_11V, CONFIG_11R or CONFIG_ROAMING enabled then RSSI low event is
478        processed internally.*/
479     WLAN_REASON_RSSI_LOW,
480 #if CONFIG_SUBSCRIBE_EVENT_SUPPORT
481     /** The WLAN Connection Manager has received subscribed RSSI high event on station interface as per configured
482        threshold and frequency. */
483     WLAN_REASON_RSSI_HIGH,
484     /** The WLAN Connection Manager has received subscribed SNR low event on station interface as per configured
485        threshold and frequency. */
486     WLAN_REASON_SNR_LOW,
487     /** The WLAN Connection Manager has received subscribed SNR high event on station interface as per configured
488        threshold and frequency. */
489     WLAN_REASON_SNR_HIGH,
490     /** The WLAN Connection Manager has received subscribed Max fail event on station interface as per configured
491        threshold and frequency. */
492     WLAN_REASON_MAX_FAIL,
493     /** The WLAN Connection Manager has received subscribed Beacon missed fail event on station interface as per
494        configured threshold and frequency. */
495     WLAN_REASON_BEACON_MISSED,
496     /** The WLAN Connection Manager has received subscribed Data RSSI low event on station interface as per configured
497        threshold and frequency. */
498     WLAN_REASON_DATA_RSSI_LOW,
499     /** The WLAN Connection Manager has received subscribed Data RSSI high event on station interface as per configured
500        threshold and frequency. */
501     WLAN_REASON_DATA_RSSI_HIGH,
502     /** The WLAN Connection Manager has received subscribed Data SNR low event on station interface as per configured
503        threshold and frequency. */
504     WLAN_REASON_DATA_SNR_LOW,
505     /** The WLAN Connection Manager has received subscribed Data SNR high event on station interface as per configured
506        threshold and frequency. */
507     WLAN_REASON_DATA_SNR_HIGH,
508     /** The WLAN Connection Manager has received subscribed LINK QUALITY event on station interface as per configured
509     link_snr threshold and frequency, link_rate threshold and frequency, link_tx_latency threshold and frequency*/
510     WLAN_REASON_LINK_QUALITY,
511     /** The WLAN Connection Manager has received subscribed Pre beacon lost event on station interface as per configured
512        threshold and frequency. */
513     WLAN_REASON_PRE_BEACON_LOST,
514 #endif
515 #if CONFIG_NCP_BRIDGE
516     /** Scan is done */
517     WLAN_REASON_SCAN_DONE,
518     /** WPS session is done */
519     WLAN_REASON_WPS_SESSION_DONE,
520 #endif
521 };
522 
523 /** Wakeup events for which wakeup will occur */
524 enum wlan_wakeup_event_t
525 {
526     /** Wakeup on broadcast  */
527     WAKE_ON_ALL_BROADCAST = 1,
528     /** Wakeup on unicast  */
529     WAKE_ON_UNICAST = 1 << 1,
530     /** Wakeup on MAC event  */
531     WAKE_ON_MAC_EVENT = 1 << 2,
532     /** Wakeup on multicast  */
533     WAKE_ON_MULTICAST = 1 << 3,
534     /** Wakeup on ARP broadcast  */
535     WAKE_ON_ARP_BROADCAST = 1 << 4,
536     /** Wakeup on receiving a management frame  */
537     WAKE_ON_MGMT_FRAME = 1 << 6,
538 };
539 
540 /** WLAN station/micro-AP/Wi-Fi Direct Connection/Status state */
541 enum wlan_connection_state
542 {
543     /** The WLAN Connection Manager is not connected and no connection attempt
544      *  is in progress.  It is possible to connect to a network or scan. */
545     WLAN_DISCONNECTED,
546     /** The WLAN Connection Manager is not connected but it is currently
547      *  attempting to connect to a network.  It is not possible to scan at this
548      *  time.  It is possible to connect to a different network. */
549     WLAN_CONNECTING,
550     /** The WLAN Connection Manager is not connected but associated. */
551     WLAN_ASSOCIATED,
552     /** The WLAN Connection Manager is not connected but authenticated. */
553     WLAN_AUTHENTICATED,
554     /** The WLAN Connection Manager is connected.  It is possible to scan and
555      *  connect to another network at this time.  Information about the current
556      *  network configuration is available. */
557     WLAN_CONNECTED,
558     /** The WLAN Connection Manager has started uAP */
559     WLAN_UAP_STARTED,
560     /** The WLAN Connection Manager has stopped uAP */
561     WLAN_UAP_STOPPED,
562     /** The WLAN Connection Manager is not connected and network scan
563      * is in progress. */
564     WLAN_SCANNING,
565     /** The WLAN Connection Manager is not connected and network association
566      * is in progress. */
567     WLAN_ASSOCIATING,
568 };
569 
570 /* Data Structures */
571 
572 /** Station Power save mode */
573 typedef enum wlan_ps_mode
574 {
575     /** Active mode */
576     WLAN_ACTIVE = 0,
577     /** IEEE power save mode */
578     WLAN_IEEE,
579     /** Deep sleep power save mode */
580     WLAN_DEEP_SLEEP,
581     /** IEEE and Deep sleep power save mode */
582     WLAN_IEEE_DEEP_SLEEP,
583 #if CONFIG_WNM_PS
584     /** WNM power save mode */
585     WLAN_WNM,
586     /** WNM and Deep sleep power save mode */
587     WLAN_WNM_DEEP_SLEEP,
588 #endif
589 } wlan_ps_mode;
590 
591 enum wlan_ps_state
592 {
593     PS_STATE_AWAKE = 0,
594     PS_STATE_PRE_SLEEP,
595     PS_STATE_SLEEP_CFM,
596     PS_STATE_SLEEP
597 };
598 
599 typedef enum _ENH_PS_MODES
600 {
601     GET_PS        = 0,
602     SLEEP_CONFIRM = 5,
603     EXT_PS_PARAM  = 6,
604 #if (CONFIG_WNM_PS)
605     DIS_WNM_PS = 0xfc,
606     EN_WNM_PS  = 0xfd,
607 #endif
608     DIS_AUTO_PS = 0xfe,
609     EN_AUTO_PS  = 0xff,
610 } ENH_PS_MODES;
611 
612 typedef enum _Host_Sleep_Action
613 {
614     HS_CONFIGURE = 0x0001,
615     HS_ACTIVATE  = 0x0002,
616 } Host_Sleep_Action;
617 
618 #if (CONFIG_WNM_PS)
619 typedef PACK_START struct
620 {
621     uint8_t action;
622     uint8_t result;
623 } PACK_END wnm_sleep_result_t;
624 #endif
625 
626 #if CONFIG_CSI
627 enum wlan_csi_opt
628 {
629     CSI_FILTER_OPT_ADD = 0,
630     CSI_FILTER_OPT_DELETE,
631     CSI_FILTER_OPT_CLEAR,
632     CSI_FILTER_OPT_DUMP,
633 };
634 #endif
635 
636 #if CONFIG_NET_MONITOR
637 enum wlan_monitor_opt
638 {
639     MONITOR_FILTER_OPT_ADD_MAC = 0,
640     MONITOR_FILTER_OPT_DELETE_MAC,
641     MONITOR_FILTER_OPT_CLEAR_MAC,
642     MONITOR_FILTER_OPT_DUMP,
643 };
644 #endif
645 
646 #if (CONFIG_11MC) || (CONFIG_11AZ)
647 #define FTM_ACTION_START 1
648 #define FTM_ACTION_STOP  2
649 
650 #define PROTO_DOT11AZ_NTB 1
651 #define PROTO_DOT11AZ_TB  2
652 #define PROTO_DOT11MC     0
653 
654 /* DOT11MC CFG */
655 /* Burst Duration
656  0 - 1: Reserved
657  2: 250 micro seconds
658  3: 500 micro seconds
659  4: 1 ms
660  5: 2 ms
661  6: 4 ms
662  7: 8 ms
663  8: 16 ms
664  9: 32 ms
665  10: 64 ms
666  11: 128 ms
667  12-14 reserved*/
668 #define BURST_DURATION 11
669 /* Burst Period in units of 100 milli seconds */
670 #define BURST_PERIOD 10
671 /* FTM frames per burst */
672 #define FTM_PER_BURST 5
673 /* Indicates minimum time between consecutive Fine Timing Measurement frames. It is specified in in units of 100 micro
674  * seconds. */
675 #define MIN_DELTA 60
676 /* ASAP */
677 #define IS_ASAP 1
678 /* Bandwidth
679  9  - HT20
680  10 - VHT20
681  11 - HT40
682  12 - VHT40
683  13 - VHT80 */
684 #define BW 13 /* RW610 only allows 20M bandwidth */
685 /*Indicates how many burst instances are requested for the FTM session */
686 #define BURST_EXP 3
687 
688 /* LCI */
689 #define LCI_REQUEST                1
690 #define LCI_LATITIUDE              -33.8570095
691 #define LCI_LONGITUDE              151.2152005
692 #define LCI_LATITUDE_UNCERTAINITY  18
693 #define LCI_LONGITUDE_UNCERTAINITY 18
694 #define LCI_ALTITUDE               11.2
695 #define LCI_ALTITUDE_UNCERTAINITY  15
696 #define Z_INFO                     0
697 
698 /* CIVIC */
699 #define CIVIC_REQUEST       1
700 #define CIVIC_LOCATION      1
701 #define CIVIC_LOCATION_TYPE 1
702 #define CIVIC_COUNTRY_CODE  0 /* US */
703 #define CIVIC_ADDRESS_TYPE  22
704 #define CIVIC_ADDRESS       "#123"
705 
706 /* DOT11AZ CFG */
707 #define FORMAT_BW 2 /* RW610 only allows 20M bandwidth */
708 /*Maximum number of space-time streams to be used in DL/UL NDP frames in the session upto 80MHz*/
709 #define MAX_I2R_STS_UPTO80 0 /* RW610 only allows to send 1 N_STS*/
710 #define MAX_R2I_STS_UPTO80 0
711 /* Measurement freq in Hz to calculate measurement interval*/
712 #define AZ_MEASUREMENT_FREQ       4 /* in 0.1 Hz increments */
713 #define AZ_NUMBER_OF_MEASUREMENTS 6
714 #define I2R_LMR_FEEDBACK          0 /* allow RSTA to request I2R reporting */
715 
716 #define FOR_RANGING 0
717 
718 /** Structure of FTM_SESSION_CFG_NTB_RANGING / FTM_SESSION_CFG_TB_RANGING TLV data*/
719 typedef struct _ranging_11az_cfg
720 {
721     /** Indicates the channel BW for session*/
722     /*0: HE20, 1: HE40, 2: HE80, 3: HE80+80, 4: HE160, 5:HE160_SRF*/
723     t_u8 format_bw;
724     /** indicates for bandwidths less than or equal to 80 MHz the maximum number of space-time streams to be used in
725      * DL/UL NDP frames in the session*/
726     t_u8 max_i2r_sts_upto80;
727     /**indicates for bandwidths less than or equal to 80 MHz the maximum number of space-time streams to be used in
728      * DL/UL NDP frames in the session*/
729     t_u8 max_r2i_sts_upto80;
730     /**Specify measurement freq in Hz to calculate measurement interval*/
731     t_u8 az_measurement_freq;
732     /**Indicates the number of measurements to be done for session*/
733     t_u8 az_number_of_measurements;
734     /** Initator lmr feedback */
735     t_u8 i2r_lmr_feedback;
736     /**Include location civic request (Expect location civic from responder)*/
737     t_u8 civic_req;
738     /**Include LCI request (Expect LCI info from responder)*/
739     t_u8 lci_req;
740 } ranging_11az_cfg_t;
741 
742 typedef struct _location_cfg_info
743 {
744     /** known Latitude uncertainty*/
745     t_u8 lat_unc;
746     /** known Longitude uncertainty*/
747     t_u8 long_unc;
748     /** Known Altitude uncertainty*/
749     t_u8 alt_unc;
750     /**Include LCI request (Expect LCI info from responder)*/
751     t_u8 lci_req;
752     /** known longitude*/
753     double longitude;
754     /** known Latitude*/
755     double latitude;
756     /** known altitude*/
757     double altitude;
758 } location_cfg_info_t;
759 
760 typedef struct _location_civic_rep
761 {
762     /**Civic location type*/
763     t_u8 civic_location_type;
764     /**Civic address type*/
765     t_u8 civic_address_type;
766     /**Civic address length*/
767     t_u8 civic_address_length;
768     /**Include LCI request (Expect LCI info from responder)*/
769     t_u8 civic_req;
770     /**Country code*/
771     t_u16 country_code;
772 } location_civic_rep_t;
773 
774 /** Structure of FTM_SESSION_CFG TLV data*/
775 typedef struct _ftm_11mc_nego_cfg
776 {
777     /** Indicates how many burst instances are requested for the FTM session*/
778     t_u8 burst_exponent;
779     /** Indicates the duration of a burst instance*/
780     t_u8 burst_duration;
781     /**Minimum time between consecutive FTM frames*/
782     t_u8 min_delta_FTM;
783     /**ASAP/non-ASAP casel*/
784     t_u8 is_ASAP;
785     /**Number of FTMs per burst*/
786     t_u8 per_burst_FTM;
787     /**FTM channel spacing: HT20/HT40/VHT80/... */
788     t_u8 channel_spacing;
789     /**Indicates the interval between two consecutive burst instances*/
790     t_u16 burst_period;
791 } ftm_11mc_nego_cfg_t;
792 #endif
793 
794 /** Scan Result */
795 struct wlan_scan_result
796 {
797     /** The network SSID, represented as a NULL-terminated C string of 0 to 32
798      *  characters.  If the network has a hidden SSID, this will be the empty
799      *  string.
800      */
801     char ssid[33];
802     /** SSID length */
803     unsigned int ssid_len;
804     /** The network BSSID, represented as a 6-byte array. */
805     char bssid[6];
806     /** The network channel. */
807     unsigned int channel;
808     /** The network wireless type. */
809     enum wlan_bss_type type;
810     /** The network wireless mode. */
811     enum wlan_bss_role role;
812 
813     /* network features */
814     /** The network supports 802.11N.  This is set to 0 if the network does not
815      *  support 802.11N or if the system does not have 802.11N support enabled. */
816     unsigned dot11n : 1;
817 #if CONFIG_11AC
818     /** The network supports 802.11AC.  This is set to 0 if the network does not
819      *  support 802.11AC or if the system does not have 802.11AC support enabled. */
820     unsigned dot11ac : 1;
821 #endif
822 #if CONFIG_11AX
823     /** The network supports 802.11AX.  This is set to 0 if the network does not
824      *  support 802.11AX or if the system does not have 802.11AX support enabled. */
825     unsigned dot11ax : 1;
826 #endif
827 
828     /** The network supports WMM.  This is set to 0 if the network does not
829      *  support WMM or if the system does not have WMM support enabled. */
830     unsigned wmm : 1;
831 #if (CONFIG_WPA_SUPP_WPS) || (CONFIG_WPS2)
832     /** The network supports WPS.  This is set to 0 if the network does not
833      *  support WPS or if the system does not have WPS support enabled. */
834     unsigned wps : 1;
835     /** WPS Type PBC/PIN */
836     unsigned int wps_session;
837 #endif
838     /** The network uses WEP security. */
839     unsigned wep : 1;
840     /** The network uses WPA security. */
841     unsigned wpa : 1;
842     /** The network uses WPA2 security */
843     unsigned wpa2 : 1;
844     /** The network uses WPA2 SHA256 security */
845     unsigned wpa2_sha256 : 1;
846 #if CONFIG_DRIVER_OWE
847     /** The network uses OWE security */
848     unsigned owe : 1;
849 #endif
850     /** The network uses WPA3 SAE security */
851     unsigned wpa3_sae : 1;
852     /** The network uses WPA2 Enterprise security */
853     unsigned wpa2_entp : 1;
854     /** The network uses WPA2 Enterprise SHA256 security */
855     unsigned wpa2_entp_sha256 : 1;
856     /** The network uses WPA3 Enterprise SHA256 security */
857     unsigned wpa3_1x_sha256 : 1;
858     /** The network uses WPA3 Enterprise SHA384 security */
859     unsigned wpa3_1x_sha384 : 1;
860 #if CONFIG_11R
861     /** The network uses FT 802.1x security (For internal use only)*/
862     unsigned ft_1x : 1;
863     /** The network uses FT 892.1x SHA384 security */
864     unsigned ft_1x_sha384 : 1;
865     /** The network uses FT PSK security (For internal use only)*/
866     unsigned ft_psk : 1;
867     /** The network uses FT SAE security (For internal use only)*/
868     unsigned ft_sae : 1;
869 #endif
870     /** The signal strength of the beacon */
871     unsigned char rssi;
872     /** The network SSID, represented as a NULL-terminated C string of 0 to 32
873      *  characters.  If the network has a hidden SSID, this will be the empty
874      *  string.
875      */
876     char trans_ssid[33];
877     /** SSID length */
878     unsigned int trans_ssid_len;
879     /** The network BSSID, represented as a 6-byte array. */
880     char trans_bssid[6];
881 
882     /** Beacon Period */
883     uint16_t beacon_period;
884 
885     /** DTIM Period */
886     uint8_t dtim_period;
887 
888     /** MFPC bit of AP*/
889     t_u8 ap_mfpc;
890     /** MFPR bit of AP*/
891     t_u8 ap_mfpr;
892     /** PWE bit of AP*/
893     t_u8 ap_pwe;
894 
895 #if CONFIG_11K
896     /** Neigbort report support (For internal use only)*/
897     bool neighbor_report_supported;
898 #endif
899 #if CONFIG_11V
900     /** bss transition support (For internal use only)*/
901     bool bss_transition_supported;
902 #endif
903 };
904 
905 typedef enum
906 {
907     Band_2_4_GHz = 0,
908     Band_5_GHz   = 1,
909     Band_4_GHz   = 2,
910 
911 } ChanBand_e;
912 
913 #define NUM_CHAN_BAND_ENUMS 3
914 
915 typedef enum
916 {
917     ChanWidth_20_MHz = 0,
918     ChanWidth_10_MHz = 1,
919     ChanWidth_40_MHz = 2,
920     ChanWidth_80_MHz = 3,
921 } ChanWidth_e;
922 
923 typedef enum
924 {
925     SECONDARY_CHAN_NONE  = 0,
926     SECONDARY_CHAN_ABOVE = 1,
927     SECONDARY_CHAN_BELOW = 3,
928     // reserved 2, 4~255
929 } Chan2Offset_e;
930 
931 typedef enum
932 {
933     MANUAL_MODE = 0,
934     ACS_MODE    = 1,
935 } ScanMode_e;
936 
937 typedef PACK_START struct
938 {
939     ChanBand_e chanBand : 2;
940     ChanWidth_e chanWidth : 2;
941     Chan2Offset_e chan2Offset : 2;
942     ScanMode_e scanMode : 2;
943 } PACK_END BandConfig_t;
944 
945 typedef PACK_START struct
946 {
947     BandConfig_t bandConfig;
948     uint8_t chanNum;
949 
950 } PACK_END ChanBandInfo_t;
951 
952 #if CONFIG_WLAN_BRIDGE
953 /*auto link switch network info*/
954 typedef PACK_START struct _Event_AutoLink_SW_Node_t
955 {
956     /** No of bytes in packet including this field */
957     uint16_t length;
958     /** Type: Event (3) */
959     uint16_t type;
960     /** Event ID */
961     uint16_t event_id;
962     /** BSS index number for multiple BSS support */
963     uint8_t bss_index;
964     /** BSS type */
965     uint8_t bss_type;
966     /*peer mac address*/
967     uint8_t peer_mac_addr[MLAN_MAC_ADDR_LENGTH];
968     /*associated channel band info*/
969     ChanBandInfo_t chanBand;
970     /*security type*/
971     uint8_t secutype;
972     /*multicast cipher*/
973     uint16_t mcstcipher;
974     /*unicast cipher*/
975     uint16_t ucstcipher;
976     /*peer ssid info*/
977     /* tlv type*/
978     uint16_t type_ssid;
979     /** Header length */
980     uint16_t len_ssid;
981     /*ssid info*/
982     uint8_t ssid[1];
983 } PACK_END Event_AutoLink_SW_Node_t;
984 #endif
985 
986 #if CONFIG_5GHz_SUPPORT
987 #define DFS_REC_HDR_LEN (8)
988 #define DFS_REC_HDR_NUM (10)
989 #define BIN_COUNTER_LEN (7)
990 
991 typedef PACK_START struct _Event_Radar_Detected_Info
992 {
993     t_u32 detect_count;
994     t_u8 reg_domain;    /*1=fcc, 2=etsi, 3=mic*/
995     t_u8 main_det_type; /*0=none, 1=pw(chirp), 2=pri(radar)*/
996     t_u16 pw_chirp_type;
997     t_u8 pw_chirp_idx;
998     t_u8 pw_value;
999     t_u8 pri_radar_type;
1000     t_u8 pri_binCnt;
1001     t_u8 binCounter[BIN_COUNTER_LEN];
1002     t_u8 numDfsRecords;
1003     t_u8 dfsRecordHdrs[DFS_REC_HDR_NUM][DFS_REC_HDR_LEN];
1004     t_u32 reallyPassed;
1005 } PACK_END Event_Radar_Detected_Info;
1006 #endif
1007 
1008 /** Network security types*/
1009 enum wlan_security_type
1010 {
1011     /** The network does not use security. */
1012     WLAN_SECURITY_NONE,
1013     /** The network uses WEP security with open key. */
1014     WLAN_SECURITY_WEP_OPEN,
1015     /** The network uses WEP security with shared key. */
1016     WLAN_SECURITY_WEP_SHARED,
1017     /** The network uses WPA security with PSK. */
1018     WLAN_SECURITY_WPA,
1019     /** The network uses WPA2 security with PSK. */
1020     WLAN_SECURITY_WPA2,
1021     /** The network uses WPA/WPA2 mixed security with PSK */
1022     WLAN_SECURITY_WPA_WPA2_MIXED,
1023 #if CONFIG_11R
1024     /** The network uses WPA2 security with PSK FT. */
1025     WLAN_SECURITY_WPA2_FT,
1026 #endif
1027     /** The network uses WPA3 security with SAE. */
1028     WLAN_SECURITY_WPA3_SAE,
1029 #if CONFIG_WPA_SUPP
1030 #if CONFIG_11R
1031     /** The network uses WPA3 security with SAE FT. */
1032     WLAN_SECURITY_WPA3_FT_SAE,
1033 #endif
1034 #endif
1035     /** The network uses WPA3 security with SAE EXT KEY. */
1036     WLAN_SECURITY_WPA3_SAE_EXT_KEY,
1037     /** The network uses WPA2/WPA3 SAE mixed security with PSK. */
1038     WLAN_SECURITY_WPA2_WPA3_SAE_MIXED,
1039 #if CONFIG_DRIVER_OWE
1040     /** The network uses OWE only security without Transition mode support. */
1041     WLAN_SECURITY_OWE_ONLY,
1042 #endif
1043 #if (CONFIG_WPA_SUPP_CRYPTO_ENTERPRISE) || (CONFIG_WPA2_ENTP)
1044     /** The network uses WPA2 Enterprise EAP-TLS security
1045      * The identity field in \ref wlan_network structure is used */
1046     WLAN_SECURITY_EAP_TLS,
1047 #endif
1048 #if CONFIG_WPA_SUPP_CRYPTO_ENTERPRISE
1049 #if CONFIG_EAP_TLS
1050     /** The network uses WPA2 Enterprise EAP-TLS SHA256 security
1051      * The identity field in \ref wlan_network structure is used */
1052     WLAN_SECURITY_EAP_TLS_SHA256,
1053 #if CONFIG_11R
1054     /** The network uses WPA2 Enterprise EAP-TLS FT security
1055      * The identity field in \ref wlan_network structure is used */
1056     WLAN_SECURITY_EAP_TLS_FT,
1057     /** The network uses WPA2 Enterprise EAP-TLS FT SHA384 security
1058      * The identity field in \ref wlan_network structure is used */
1059     WLAN_SECURITY_EAP_TLS_FT_SHA384,
1060 #endif
1061 #endif
1062 #if CONFIG_EAP_TTLS
1063     /** The network uses WPA2 Enterprise EAP-TTLS security
1064      * The identity field in \ref wlan_network structure is used */
1065     WLAN_SECURITY_EAP_TTLS,
1066 #endif
1067 #if CONFIG_EAP_MSCHAPV2
1068     /** The network uses WPA2 Enterprise EAP-TTLS-MSCHAPV2 security
1069      * The anonymous identity, identity and password fields in
1070      * \ref wlan_network structure are used */
1071     WLAN_SECURITY_EAP_TTLS_MSCHAPV2,
1072 #endif
1073 #endif
1074 #if (CONFIG_WPA_SUPP_CRYPTO_ENTERPRISE) || (CONFIG_PEAP_MSCHAPV2) || (CONFIG_WPA2_ENTP)
1075     /** The network uses WPA2 Enterprise EAP-PEAP-MSCHAPV2 security
1076      * The anonymous identity, identity and password fields in
1077      * \ref wlan_network structure are used */
1078     WLAN_SECURITY_EAP_PEAP_MSCHAPV2,
1079 #endif
1080 #if CONFIG_WPA_SUPP_CRYPTO_ENTERPRISE
1081 #if CONFIG_EAP_PEAP
1082 #if CONFIG_EAP_TLS
1083     /** The network uses WPA2 Enterprise EAP-PEAP-TLS security
1084      * The anonymous identity, identity and password fields in
1085      * \ref wlan_network structure are used */
1086     WLAN_SECURITY_EAP_PEAP_TLS,
1087 #endif
1088 #if CONFIG_EAP_GTC
1089     /** The network uses WPA2 Enterprise EAP-PEAP-GTC security
1090      * The anonymous identity, identity and password fields in
1091      * \ref wlan_network structure are used */
1092     WLAN_SECURITY_EAP_PEAP_GTC,
1093 #endif
1094 #endif
1095 #if CONFIG_EAP_FAST
1096 #if CONFIG_EAP_MSCHAPV2
1097     /** The network uses WPA2 Enterprise EAP-FAST-MSCHAPV2 security
1098      * The anonymous identity, identity and password fields in
1099      * \ref wlan_network structure are used */
1100     WLAN_SECURITY_EAP_FAST_MSCHAPV2,
1101 #endif
1102 #if CONFIG_EAP_GTC
1103     /** The network uses WPA2 Enterprise EAP-FAST-GTC security
1104      * The anonymous identity, identity and password fields in
1105      * \ref wlan_network structure are used */
1106     WLAN_SECURITY_EAP_FAST_GTC,
1107 #endif
1108 #endif
1109 #if CONFIG_EAP_SIM
1110     /** The network uses WPA2 Enterprise EAP-SIM security
1111      * The identity and password fields in
1112      * \ref wlan_network structure are used */
1113     WLAN_SECURITY_EAP_SIM,
1114 #endif
1115 #if CONFIG_EAP_AKA
1116     /** The network uses WPA2 Enterprise EAP-AKA security
1117      * The identity and password fields in
1118      * \ref wlan_network structure are used */
1119     WLAN_SECURITY_EAP_AKA,
1120 #endif
1121 #if CONFIG_EAP_AKA_PRIME
1122     /** The network uses WPA2 Enterprise EAP-AKA-PRIME security
1123      * The identity and password fields in
1124      * \ref wlan_network structure are used */
1125     WLAN_SECURITY_EAP_AKA_PRIME,
1126 #endif
1127 #endif
1128 #if CONFIG_WPA_SUPP_DPP
1129     /** The network uses DPP security with NAK(Net Access Key) */
1130     WLAN_SECURITY_DPP,
1131 #endif
1132     /** The network can use any security method. This is often used when
1133      * the user only knows the name and passphrase but not the security
1134      * type.  */
1135     WLAN_SECURITY_WILDCARD,
1136 };
1137 
1138 #if CONFIG_WPA_SUPP_CRYPTO_ENTERPRISE
1139 #if CONFIG_EAP_TLS
1140 /** EAP TLS Cipher types*/
1141 enum eap_tls_cipher_type
1142 {
1143     EAP_TLS_NONE,
1144     /** EAP TLS with ECDH & ECDSA with p384 */
1145     EAP_TLS_ECC_P384,
1146     /** EAP TLS with ECDH & RSA with > 3K */
1147     EAP_TLS_RSA_3K,
1148 };
1149 #endif
1150 #endif
1151 
1152 /** Wlan Cipher structure */
1153 struct wlan_cipher
1154 {
1155     /** 1 bit value can be set for none */
1156     uint16_t none : 1;
1157     /** 1 bit value can be set for wep40 */
1158     uint16_t wep40 : 1;
1159     /** 1 bit value can be set for wep104 */
1160     uint16_t wep104 : 1;
1161     /** 1 bit value can be set for tkip */
1162     uint16_t tkip : 1;
1163     /** 1 bit valuecan be set for ccmp */
1164     uint16_t ccmp : 1;
1165     /**  1 bit valuecan be set for aes 128 cmac */
1166     uint16_t aes_128_cmac : 1;
1167     /** 1 bit value can be set for gcmp */
1168     uint16_t gcmp : 1;
1169     /** 1 bit value can be set for sms4 */
1170     uint16_t sms4 : 1;
1171     /** 1 bit value can be set for gcmp 256 */
1172     uint16_t gcmp_256 : 1;
1173     /** 1 bit valuecan be set for ccmp 256 */
1174     uint16_t ccmp_256 : 1;
1175     /** 1 bit is reserved */
1176     uint16_t rsvd : 1;
1177     /** 1 bit value can be set for bip gmac 128 */
1178     uint16_t bip_gmac_128 : 1;
1179     /** 1 bit value can be set for bip gmac 256 */
1180     uint16_t bip_gmac_256 : 1;
1181     /** 1 bit value can be set for bip cmac 256 */
1182     uint16_t bip_cmac_256 : 1;
1183     /** 1 bit valuecan be set for gtk not used */
1184     uint16_t gtk_not_used : 1;
1185     /** 4 bits are reserved */
1186     uint16_t rsvd2 : 2;
1187 };
1188 
is_valid_security(int security)1189 static inline int is_valid_security(int security)
1190 {
1191     /*Currently only these modes are supported */
1192     if ((security == WLAN_SECURITY_NONE) || (security == WLAN_SECURITY_WEP_OPEN) || (security == WLAN_SECURITY_WPA) ||
1193         (security == WLAN_SECURITY_WPA2) ||
1194 #if CONFIG_11R
1195         (security == WLAN_SECURITY_WPA2_FT) ||
1196 #endif
1197         (security == WLAN_SECURITY_WPA_WPA2_MIXED) ||
1198 #if CONFIG_WPA_SUPP_CRYPTO_ENTERPRISE
1199 #if CONFIG_EAP_TLS
1200         (security == WLAN_SECURITY_EAP_TLS) || (security == WLAN_SECURITY_EAP_TLS_SHA256) ||
1201 #if CONFIG_11R
1202         (security == WLAN_SECURITY_EAP_TLS_FT) || (security == WLAN_SECURITY_EAP_TLS_FT_SHA384) ||
1203 #endif
1204 #endif
1205 #if CONFIG_EAP_TTLS
1206         (security == WLAN_SECURITY_EAP_TTLS) ||
1207 #if CONFIG_EAP_MSCHAPV2
1208         (security == WLAN_SECURITY_EAP_TTLS_MSCHAPV2) ||
1209 #endif
1210 #endif
1211 #if CONFIG_EAP_PEAP
1212 #if CONFIG_EAP_MSCHAPV2
1213         (security == WLAN_SECURITY_EAP_PEAP_MSCHAPV2) ||
1214 #endif
1215 #if CONFIG_EAP_TLS
1216         (security == WLAN_SECURITY_EAP_PEAP_TLS) ||
1217 #endif
1218 #if CONFIG_EAP_GTC
1219         (security == WLAN_SECURITY_EAP_PEAP_GTC) ||
1220 #endif
1221 #endif
1222 #if CONFIG_EAP_FAST
1223 #if CONFIG_EAP_MSCHAPV2
1224         (security == WLAN_SECURITY_EAP_FAST_MSCHAPV2) ||
1225 #endif
1226 #if CONFIG_EAP_GTC
1227         (security == WLAN_SECURITY_EAP_FAST_GTC) ||
1228 #endif
1229 #endif
1230 #if CONFIG_EAP_SIM
1231         (security == WLAN_SECURITY_EAP_SIM) ||
1232 #endif
1233 #if CONFIG_EAP_AKA
1234         (security == WLAN_SECURITY_EAP_AKA) ||
1235 #endif
1236 #if CONFIG_EAP_AKA_PRIME
1237         (security == WLAN_SECURITY_EAP_AKA_PRIME) ||
1238 #endif
1239 #else
1240 #if CONFIG_WPA2_ENTP
1241         (security == WLAN_SECURITY_EAP_TLS) ||
1242 #endif
1243 #if CONFIG_PEAP_MSCHAPV2
1244         (security == WLAN_SECURITY_EAP_PEAP_MSCHAPV2) ||
1245 #endif
1246 #endif /* CONFIG_WPA_SUPP_CRYPTO_ENTERPRISE */
1247 #if CONFIG_DRIVER_OWE
1248         (security == WLAN_SECURITY_OWE_ONLY) ||
1249 #endif
1250         (security == WLAN_SECURITY_WPA3_SAE) || (security == WLAN_SECURITY_WPA2_WPA3_SAE_MIXED) ||
1251 #if CONFIG_WPA_SUPP
1252 #if CONFIG_11R
1253         (security == WLAN_SECURITY_WPA3_FT_SAE) ||
1254 #endif
1255 #endif
1256         (security == WLAN_SECURITY_WPA3_SAE_EXT_KEY) || (security == WLAN_SECURITY_WILDCARD))
1257     {
1258         return 1;
1259     }
1260     return 0;
1261 }
1262 
1263 #if CONFIG_WPA_SUPP_CRYPTO_ENTERPRISE
is_ep_valid_security(int security)1264 static inline int is_ep_valid_security(int security)
1265 {
1266     /*Currently only these modes are supported */
1267     if (
1268 #if CONFIG_EAP_TLS
1269         (security == WLAN_SECURITY_EAP_TLS) || (security == WLAN_SECURITY_EAP_TLS_SHA256) ||
1270 #if CONFIG_11R
1271         (security == WLAN_SECURITY_EAP_TLS_FT) || (security == WLAN_SECURITY_EAP_TLS_FT_SHA384) ||
1272 #endif
1273 #endif
1274 #if CONFIG_EAP_TTLS
1275         (security == WLAN_SECURITY_EAP_TTLS) ||
1276 #if CONFIG_EAP_MSCHAPV2
1277         (security == WLAN_SECURITY_EAP_TTLS_MSCHAPV2) ||
1278 #endif
1279 #endif
1280 #if CONFIG_EAP_PEAP
1281 #if CONFIG_EAP_MSCHAPV2
1282         (security == WLAN_SECURITY_EAP_PEAP_MSCHAPV2) ||
1283 #endif
1284 #if CONFIG_EAP_TLS
1285         (security == WLAN_SECURITY_EAP_PEAP_TLS) ||
1286 #endif
1287 #if CONFIG_EAP_GTC
1288         (security == WLAN_SECURITY_EAP_PEAP_GTC) ||
1289 #endif
1290 #endif
1291 #if CONFIG_EAP_FAST
1292 #if CONFIG_EAP_MSCHAPV2
1293         (security == WLAN_SECURITY_EAP_FAST_MSCHAPV2) ||
1294 #endif
1295 #if CONFIG_EAP_GTC
1296         (security == WLAN_SECURITY_EAP_FAST_GTC) ||
1297 #endif
1298 #endif
1299 #if CONFIG_EAP_SIM
1300         (security == WLAN_SECURITY_EAP_SIM) ||
1301 #endif
1302 #if CONFIG_EAP_AKA
1303         (security == WLAN_SECURITY_EAP_AKA) ||
1304 #endif
1305 #if CONFIG_EAP_AKA_PRIME
1306         (security == WLAN_SECURITY_EAP_AKA_PRIME) ||
1307 #endif
1308         false)
1309     {
1310         return 1;
1311     }
1312     return 0;
1313 }
1314 #endif
1315 
1316 /** Network security configuration */
1317 struct wlan_network_security
1318 {
1319     /** Type of network security to use specified by enum
1320      * wlan_security_type. */
1321     enum wlan_security_type type;
1322     /** Key management type */
1323     int key_mgmt;
1324     /** Type of network security Group Cipher suite used internally*/
1325     struct wlan_cipher mcstCipher;
1326     /** Type of network security Pairwise Cipher suite used internally*/
1327     struct wlan_cipher ucstCipher;
1328 #if CONFIG_WPA_SUPP
1329     /** Proactive Key Caching */
1330     unsigned pkc : 1;
1331     /** Type of network security Group Cipher suite */
1332     int group_cipher;
1333     /** Type of network security Pairwise Cipher suite */
1334     int pairwise_cipher;
1335     /** Type of network security Pairwise Cipher suite */
1336     int group_mgmt_cipher;
1337 #endif
1338     /** Is PMF required */
1339     bool is_pmf_required;
1340     /** Pre-shared key (network password).  For WEP networks this is a hex byte
1341      * sequence of length psk_len, for WPA and WPA2 networks this is an ASCII
1342      * pass-phrase of length psk_len.  This field is ignored for networks with no
1343      * security. */
1344     char psk[WLAN_PSK_MAX_LENGTH];
1345     /** Length of the WEP key or WPA/WPA2 pass phrase, \ref WLAN_PSK_MIN_LENGTH to \ref
1346      * WLAN_PSK_MAX_LENGTH.  Ignored for networks with no security. */
1347     uint8_t psk_len;
1348     /** WPA3 SAE password, for WPA3 SAE networks this is an ASCII
1349      * password of length password_len.  This field is ignored for networks with no
1350      * security. */
1351     char password[WLAN_PASSWORD_MAX_LENGTH + 1];
1352     /** Length of the WPA3 SAE Password, \ref WLAN_PASSWORD_MIN_LENGTH to \ref
1353      * WLAN_PASSWORD_MAX_LENGTH.  Ignored for networks with no security. */
1354     size_t password_len;
1355     /** SAE Groups */
1356     char *sae_groups;
1357     /** PWE derivation */
1358     uint8_t pwe_derivation;
1359     /** transition disable */
1360     uint8_t transition_disable;
1361 #if CONFIG_DRIVER_OWE
1362     /** OWE Groups */
1363     char *owe_groups;
1364 #endif
1365     /** Pairwise Master Key.  When pmk_valid is set, this is the PMK calculated
1366      * from the PSK for WPA/PSK networks.  If pmk_valid is not set, this field
1367      * is not valid.  When adding networks with \ref wlan_add_network, users
1368      * can initialize pmk and set pmk_valid in lieu of setting the psk.  After
1369      * successfully connecting to a WPA/PSK network, users can call \ref
1370      * wlan_get_current_network to inspect pmk_valid and pmk.  Thus, the pmk
1371      * value can be populated in subsequent calls to \ref wlan_add_network.
1372      * This saves the CPU time required to otherwise calculate the PMK.
1373      */
1374     char pmk[WLAN_PMK_LENGTH];
1375 
1376     /** Flag reporting whether pmk is valid or not. */
1377     bool pmk_valid;
1378     /** Management Frame Protection Capable (MFPC) */
1379     bool mfpc;
1380     /** Management Frame Protection Required (MFPR) */
1381     bool mfpr;
1382 #if CONFIG_WLAN_BRIDGE
1383     /** Pre-shared key (network password) for bridge uap.*/
1384     char bridge_psk[WLAN_PSK_MAX_LENGTH];
1385     /** Length of the WEP key or WPA/WPA2 pass phrase for bridge uap, \ref WLAN_PSK_MIN_LENGTH
1386      *  to \ref WLAN_PSK_MAX_LENGTH.  Ignored for networks with no security. */
1387     char bridge_psk_len;
1388     /** Pairwise Master Key for bridge network */
1389     char bridge_pmk[WLAN_PMK_LENGTH];
1390     /** Flag reporting whether bridge pmk is valid or not. */
1391     bool bridge_pmk_valid;
1392 #endif
1393 #if CONFIG_WPA_SUPP_CRYPTO_ENTERPRISE
1394     /** WPA3 Enterprise mode */
1395     unsigned wpa3_sb : 1;
1396     /** WPA3 Enterprise Suite B 192 mode */
1397     unsigned wpa3_sb_192 : 1;
1398     /** PEAP version */
1399     unsigned eap_ver : 1;
1400 #if CONFIG_EAP_PEAP
1401     /** PEAP label */
1402     unsigned peap_label : 1;
1403     /** crypto_binding option can be used to control \ref WLAN_SECURITY_EAP_PEAP_MSCHAPV2, \ref
1404      * WLAN_SECURITY_EAP_PEAP_TLS and \ref WLAN_SECURITY_EAP_PEAP_GTC version 0 cryptobinding behavior: 0 = do not use
1405      * cryptobinding (default) 1 = use cryptobinding if server supports it 2 = require cryptobinding */
1406     uint8_t eap_crypto_binding;
1407 #endif
1408 #if (CONFIG_EAP_SIM) || (CONFIG_EAP_AKA) || (CONFIG_EAP_AKA_PRIME)
1409     /** eap_result_ind=1 can be used to enable \ref WLAN_SECURITY_EAP_SIM, \ref WLAN_SECURITY_EAP_AKA and \ref
1410      * WLAN_SECURITY_EAP_AKA_PRIME to use protected result indication.*/
1411     unsigned eap_result_ind : 1;
1412 #endif
1413 #if CONFIG_EAP_TLS
1414     /** Cipher for EAP TLS */
1415     unsigned char tls_cipher;
1416 #endif
1417     /** Identity string for EAP */
1418     char identity[IDENTITY_MAX_LENGTH];
1419     /** Anonymous identity string for EAP */
1420     char anonymous_identity[IDENTITY_MAX_LENGTH];
1421     /** Password string for EAP. This field can include
1422      * either the plaintext password (using ASCII or
1423      * hex string) */
1424     char eap_password[PASSWORD_MAX_LENGTH];
1425     /** CA cert blob in PEM/DER format */
1426     unsigned char *ca_cert_data;
1427     /** CA cert blob len */
1428     size_t ca_cert_len;
1429     /** Client cert blob in PEM/DER format */
1430     unsigned char *client_cert_data;
1431     /** Client cert blob len */
1432     size_t client_cert_len;
1433     /** Client key blob */
1434     unsigned char *client_key_data;
1435     /** Client key blob len */
1436     size_t client_key_len;
1437     /** Client key password */
1438     char client_key_passwd[PASSWORD_MAX_LENGTH];
1439     /** CA cert HASH */
1440     char ca_cert_hash[HASH_MAX_LENGTH];
1441     /** Domain */
1442     char domain_match[DOMAIN_MATCH_MAX_LENGTH];
1443     /** Domain Suffix */
1444     char domain_suffix_match[DOMAIN_MATCH_MAX_LENGTH]; /*suffix max length same as full domain name length*/
1445     /** CA cert2 blob in PEM/DER format */
1446     unsigned char *ca_cert2_data;
1447     /** CA cert2 blob len */
1448     size_t ca_cert2_len;
1449     /** Client cert2 blob in PEM/DER format */
1450     unsigned char *client_cert2_data;
1451     /** Client cert2 blob len */
1452     size_t client_cert2_len;
1453     /** Client key2 blob */
1454     unsigned char *client_key2_data;
1455     /** Client key2 blob len */
1456     size_t client_key2_len;
1457     /** Client key2 password */
1458     char client_key2_passwd[PASSWORD_MAX_LENGTH];
1459 #if CONFIG_WPA_SUPP_AP
1460 #if CONFIG_WPA_SUPP_CRYPTO_AP_ENTERPRISE
1461     /** DH params blob */
1462     unsigned char *dh_data;
1463     /** DH params blob len */
1464     size_t dh_len;
1465     /** Server cert blob in PEM/DER format */
1466     unsigned char *server_cert_data;
1467     /** Server cert blob len */
1468     size_t server_cert_len;
1469     /** Server key blob */
1470     unsigned char *server_key_data;
1471     /** Server key blob len */
1472     size_t server_key_len;
1473     /** Server key password */
1474     char server_key_passwd[PASSWORD_MAX_LENGTH];
1475     /** Number of EAP users */
1476     size_t nusers;
1477     /** User Identities */
1478     char identities[MAX_USERS][IDENTITY_MAX_LENGTH];
1479     /** User Passwords */
1480     char passwords[MAX_USERS][PASSWORD_MAX_LENGTH];
1481 #if CONFIG_EAP_FAST
1482     /** Encryption key for EAP-FAST PAC-Opaque values */
1483     char pac_opaque_encr_key[PAC_OPAQUE_ENCR_KEY_MAX_LENGTH];
1484     /** EAP-FAST authority identity (A-ID) */
1485     char a_id[A_ID_MAX_LENGTH];
1486     /** EAP-FAST provisioning modes:
1487      * 0 = provisioning disabled
1488      * 1 = only anonymous provisioning allowed
1489      * 2 = only authenticated provisioning allowed
1490      * 3 = both provisioning modes allowed (default)
1491      */
1492     uint8_t fast_prov;
1493 #endif
1494 #endif
1495 #endif
1496 #elif (CONFIG_WPA2_ENTP)
1497     /** TLS client cert configuration */
1498     wm_mbedtls_cert_t tls_cert;
1499     /** mbedtls_ssl_config handle */
1500     mbedtls_ssl_config *wlan_ctx;
1501     /** mbedtls_ssl_context handle */
1502     mbedtls_ssl_context *wlan_ssl;
1503 #endif
1504 #if CONFIG_WPA_SUPP_DPP
1505     unsigned char *dpp_connector;
1506     unsigned char *dpp_c_sign_key;
1507     unsigned char *dpp_net_access_key;
1508 #endif
1509 };
1510 
1511 /* Configuration for wireless scanning */
1512 #define MAX_CHANNEL_LIST 6
1513 struct wifi_scan_params_t
1514 {
1515     uint8_t *bssid;
1516     char *ssid;
1517     int channel[MAX_CHANNEL_LIST];
1518     IEEEtypes_Bss_t bss_type;
1519     int scan_duration;
1520     int split_scan_delay;
1521 };
1522 
1523 #if CONFIG_WIFI_GET_LOG
1524 /** Wi-Fi firmware stat from \ref wifi_pkt_stats_t
1525  */
1526 typedef wifi_pkt_stats_t wlan_pkt_stats_t;
1527 #endif
1528 
1529 /** Configuration for Wireless scan channel list from
1530  * \ref wifi_scan_channel_list_t
1531  */
1532 typedef wifi_scan_channel_list_t wlan_scan_channel_list_t;
1533 /** Configuration for wireless scanning parameters v2 from
1534  * \ref wifi_scan_params_v2_t
1535  */
1536 typedef wifi_scan_params_v2_t wlan_scan_params_v2_t;
1537 
1538 #if CONFIG_TBTT_OFFSET
1539 /** Configuration for Wireless TBTT Offset stats from
1540  * \ref wifi_tbtt_offset_t
1541  */
1542 typedef wifi_tbtt_offset_t wlan_tbtt_offset_t;
1543 #endif
1544 
1545 /** Configuration for Wireless Calibration data from
1546  * \ref wifi_cal_data_t
1547  */
1548 typedef wifi_cal_data_t wlan_cal_data_t;
1549 
1550 #if CONFIG_AUTO_RECONNECT
1551 /** Configuration for Auto reconnect configuration from
1552  * \ref wifi_auto_reconnect_config_t
1553  */
1554 typedef wifi_auto_reconnect_config_t wlan_auto_reconnect_config_t;
1555 #endif
1556 
1557 /** Configuration for Memory Efficient Filters in Wi-Fi firmware from
1558  * \ref wifi_flt_cfg_t
1559  */
1560 typedef wifi_flt_cfg_t wlan_flt_cfg_t;
1561 
1562 /** Configuration for wowlan pattern parameters from
1563  * \ref wifi_wowlan_ptn_cfg_t
1564  */
1565 typedef wifi_wowlan_ptn_cfg_t wlan_wowlan_ptn_cfg_t;
1566 /** Configuration for TCP Keep alive parameters from
1567  * \ref wifi_tcp_keep_alive_t
1568  */
1569 typedef wifi_tcp_keep_alive_t wlan_tcp_keep_alive_t;
1570 #if CONFIG_NAT_KEEP_ALIVE
1571 /** Configuration for NAT Keep alive parameters from
1572  * \ref wifi_nat_keep_alive_t
1573  */
1574 typedef wifi_nat_keep_alive_t wlan_nat_keep_alive_t;
1575 #endif
1576 
1577 #if CONFIG_CLOUD_KEEP_ALIVE
1578 /** Configuration for Cloud Keep alive parameters from
1579  * \ref wifi_cloud_keep_alive_t
1580  */
1581 typedef wifi_cloud_keep_alive_t wlan_cloud_keep_alive_t;
1582 #endif
1583 
1584 /** Configuration for TX Rate and Get data rate from
1585  * \ref wifi_ds_rate
1586  */
1587 typedef wifi_ds_rate wlan_ds_rate;
1588 /** Configuration for ED MAC Control parameters from
1589  * \ref wifi_ed_mac_ctrl_t
1590  */
1591 typedef wifi_ed_mac_ctrl_t wlan_ed_mac_ctrl_t;
1592 /** Configuration for Band from
1593  * \ref wifi_bandcfg_t
1594  */
1595 typedef wifi_bandcfg_t wlan_bandcfg_t;
1596 /** Configuration for CW Mode parameters from
1597  * \ref wifi_cw_mode_ctrl_t
1598  */
1599 typedef wifi_cw_mode_ctrl_t wlan_cw_mode_ctrl_t;
1600 /** Configuration for Channel list from
1601  * \ref wifi_chanlist_t
1602  */
1603 typedef wifi_chanlist_t wlan_chanlist_t;
1604 /** Configuration for TX Pwr Limit from
1605  * \ref wifi_txpwrlimit_t
1606  */
1607 typedef wifi_txpwrlimit_t wlan_txpwrlimit_t;
1608 #ifdef SD8801
1609 /** Statistic of External Coex from
1610  * \ref wifi_ext_coex_config_t
1611  */
1612 typedef wifi_ext_coex_stats_t wlan_ext_coex_stats_t;
1613 /** Configuration for External Coex from
1614  * \ref wifi_ext_coex_config_t
1615  */
1616 typedef wifi_ext_coex_config_t wlan_ext_coex_config_t;
1617 #endif
1618 
1619 #if CONFIG_11AX
1620 /** Configuration for RU TX Pwr Limit from
1621  * \ref wifi_rutxpwrlimit_t
1622  */
1623 typedef wifi_rutxpwrlimit_t wlan_rutxpwrlimit_t;
1624 /** Configuration for 11AX capabilities
1625  * \ref wifi_11ax_config_t
1626  */
1627 typedef wifi_11ax_config_t wlan_11ax_config_t;
1628 #if CONFIG_11AX_TWT
1629 /** Configuration for TWT Setup
1630  * \ref wifi_twt_setup_config_t
1631  */
1632 typedef wifi_twt_setup_config_t wlan_twt_setup_config_t;
1633 /** Configuration for TWT Teardown
1634  * \ref wifi_twt_teardown_config_t
1635  */
1636 typedef wifi_twt_teardown_config_t wlan_twt_teardown_config_t;
1637 /** Configuration for Broadcast TWT Setup
1638  * \ref wifi_btwt_config_t
1639  */
1640 typedef wifi_btwt_config_t wlan_btwt_config_t;
1641 /** Configuration for TWT Report
1642  * \ref wifi_twt_report_t
1643  */
1644 typedef wifi_twt_report_t wlan_twt_report_t;
1645 /** Configuration for TWT Information
1646  * \ref wifi_twt_information_t
1647  */
1648 typedef wifi_twt_information_t wlan_twt_information_t;
1649 #endif /* CONFIG_11AX_TWT */
1650 #if CONFIG_MMSF
1651 #define WLAN_AMPDU_DENSITY 0x30
1652 #define WLAN_AMPDU_MMSF    0x6
1653 #endif
1654 #endif
1655 #if CONFIG_WIFI_CLOCKSYNC
1656 /** Configuration for Clock Sync GPIO TSF latch
1657  * \ref wifi_clock_sync_gpio_tsf_t
1658  */
1659 typedef wifi_clock_sync_gpio_tsf_t wlan_clock_sync_gpio_tsf_t;
1660 /** Configuration for TSF info
1661  * \ref wifi_tsf_info_t
1662  */
1663 typedef wifi_tsf_info_t wlan_tsf_info_t;
1664 #endif
1665 
1666 #if CONFIG_MULTI_CHAN
1667 /** Configuration for multi-channel switch
1668  * \ref wifi_drcs_cfg_t
1669  */
1670 typedef wifi_drcs_cfg_t wlan_drcs_cfg_t;
1671 #endif
1672 
1673 typedef wifi_mgmt_frame_t wlan_mgmt_frame_t;
1674 
1675 #if CONFIG_1AS
1676 /** Dot1as correlated time
1677  * \ref wifi_correlated_time_t
1678  */
1679 typedef wifi_correlated_time_t wlan_correlated_time_t;
1680 
1681 /** Dot1as timing measurement info
1682  * \ref wifi_dot1as_info_t
1683  */
1684 typedef wifi_dot1as_info_t wlan_dot1as_info_t;
1685 #endif
1686 
1687 #if CONFIG_CSI
1688 /** Configuration for Csi Config Params from
1689  * \ref wifi_csi_config_params_t
1690  */
1691 typedef wifi_csi_config_params_t wlan_csi_config_params_t;
1692 #endif
1693 
1694 #if CONFIG_NET_MONITOR
1695 /** Configuration for Net monitor from
1696  * \ref wifi_net_monitor_t
1697  */
1698 typedef wifi_net_monitor_t wlan_net_monitor_t;
1699 #endif
1700 
1701 #if (CONFIG_WIFI_IND_RESET) && (CONFIG_WIFI_IND_DNLD)
1702 /** Configuration for GPIO independent reset
1703  * \ref wifi_indrst_cfg_t
1704  */
1705 typedef wifi_indrst_cfg_t wlan_indrst_cfg_t;
1706 #endif
1707 
1708 #if CONFIG_11AX
1709 /** Configuration for TX Rate Setting from
1710  * \ref txrate_setting
1711  */
1712 typedef txrate_setting wlan_txrate_setting;
1713 #endif
1714 
1715 #ifdef STA_SUPPORT
1716 /** Configuration for RSSI information
1717  * \ref wifi_rssi_info_t
1718  */
1719 typedef wifi_rssi_info_t wlan_rssi_info_t;
1720 #endif
1721 
1722 #if CONFIG_EXTERNAL_COEX_PTA
1723 #define MIN_SAMP_TIMING              20
1724 #define MAX_SAMP_TIMING              200
1725 #define COEX_PTA_FEATURE_ENABLE      1
1726 #define COEX_PTA_FEATURE_DISABLE     0
1727 #define POL_GRANT_PIN_HIGH           0
1728 #define POL_GRANT_PIN_LOW            1
1729 #define STATE_INPUT_DISABLE          0
1730 #define STATE_PTA_PIN                1
1731 #define STATE_PRIORITY_PIN           2
1732 #define SAMPLE_TIMING_VALUE          100
1733 #define EXT_COEX_PTA_INTERFACE       5
1734 #define EXT_COEX_WCI2_INTERFACE      6
1735 #define EXT_COEX_WCI2_GPIO_INTERFACE 7
1736 
1737 typedef struct _external_coex_pta_cfg
1738 {
1739     /** Enable: 0x01, Disable: 0x00 */
1740     t_u8 enabled;
1741     /** Enable ExtWifiBtArb: 0x01, Disable ExWifiBtArb: 0x00 */
1742     t_u8 ext_WifiBtArb;
1743     /** Active high: 0x00, Active low: 0x01 */
1744     t_u8 polGrantPin;
1745     /**  Enable PriPtaInt: 0x01, Disable PriPtaInt: 0x00 */
1746     t_u8 enable_PriPtaInt;
1747     /** State input disable: 0x00, State info is from state pin: 0x01, State info is sampled on priority pin: 0x02 */
1748     t_u8 enable_StatusFromPta;
1749     /** Timing to sample Priority bit */
1750     t_u16 setPriSampTiming;
1751     /** Timing to sample Tx/Rx info */
1752     t_u16 setStateInfoSampTiming;
1753     /** Enable external traffic Tx/Rx Priority: 0x01, Disable external traffic Tx/Rx Priority: 0x00 */
1754     t_u8 extRadioTrafficPrio;
1755     /** Enable wci-2 interface: 0x01, Disable wci-2 interface: 0x00 */
1756     t_u8 extCoexHwIntWci2;
1757 } ext_coex_pta_cfg;
1758 #endif
1759 
1760 int verify_scan_duration_value(int scan_duration);
1761 int verify_scan_channel_value(int channel);
1762 int verify_split_scan_delay(int delay);
1763 int set_scan_params(struct wifi_scan_params_t *wifi_scan_params);
1764 int get_scan_params(struct wifi_scan_params_t *wifi_scan_params);
1765 int wlan_get_current_rssi(short *rssi);
1766 int wlan_get_current_nf(void);
1767 
1768 /** Address types to be used by the element wlan_ip_config.addr_type below
1769  */
1770 enum address_types
1771 {
1772     /** static IP address */
1773     ADDR_TYPE_STATIC = 0,
1774     /** Dynamic  IP address*/
1775     ADDR_TYPE_DHCP = 1,
1776     /** Link level address */
1777     ADDR_TYPE_LLA = 2,
1778 };
1779 
1780 /** This data structure represents an IPv4 address */
1781 struct ipv4_config
1782 {
1783     /** Set to \ref ADDR_TYPE_DHCP to use DHCP to obtain the IP address or
1784      *  \ref ADDR_TYPE_STATIC to use a static IP. In case of static IP
1785      *  address ip, gw, netmask and dns members must be specified.  When
1786      *  using DHCP, the ip, gw, netmask and dns are overwritten by the
1787      *  values obtained from the DHCP server. They should be zeroed out if
1788      *  not used. */
1789     enum address_types addr_type;
1790     /** The system's IP address in network order. */
1791     unsigned address;
1792     /** The system's default gateway in network order. */
1793     unsigned gw;
1794     /** The system's subnet mask in network order. */
1795     unsigned netmask;
1796     /** The system's primary dns server in network order. */
1797     unsigned dns1;
1798     /** The system's secondary dns server in network order. */
1799     unsigned dns2;
1800 };
1801 
1802 #if CONFIG_IPV6
1803 /** This data structure represents an IPv6 address */
1804 struct ipv6_config
1805 {
1806     /** The system's IPv6 address in network order. */
1807     unsigned address[4];
1808     /** The address type: linklocal, site-local or global. */
1809     unsigned char addr_type;
1810     /** The state of IPv6 address (Tentative, Preferred, etc). */
1811     unsigned char addr_state;
1812 };
1813 #endif
1814 
1815 /** Network IP configuration.
1816  *
1817  *  This data structure represents the network IP configuration
1818  *  for IPv4 as well as IPv6 addresses
1819  */
1820 struct wlan_ip_config
1821 {
1822 #if CONFIG_IPV6
1823     /** The network IPv6 address configuration that should be
1824      * associated with this interface. */
1825     struct ipv6_config ipv6[CONFIG_MAX_IPV6_ADDRESSES];
1826     /** The network IPv6 valid addresses count */
1827     size_t ipv6_count;
1828 #endif
1829     /** The network IPv4 address configuration that should be
1830      * associated with this interface. */
1831     struct ipv4_config ipv4;
1832 };
1833 
1834 /** WLAN Network Profile
1835  *
1836  *  This data structure represents a WLAN network profile. It consists of an
1837  *  arbitrary name, WiFi configuration, and IP address configuration.
1838  *
1839  *  Every network profile is associated with one of the two interfaces. The
1840  *  network profile can be used for the station interface (i.e. to connect to an
1841  *  Access Point) by setting the role field to \ref
1842  *  WLAN_BSS_ROLE_STA. The network profile can be used for the micro-AP
1843  *  interface (i.e. to start a network of our own.) by setting the mode field to
1844  *  \ref WLAN_BSS_ROLE_UAP.
1845  *
1846  *  If the mode field is \ref WLAN_BSS_ROLE_STA, either of the SSID or
1847  *  BSSID fields are used to identify the network, while the other members like
1848  *  channel and security settings characterize the network.
1849  *
1850  *  If the mode field is \ref WLAN_BSS_ROLE_UAP, the SSID, channel and security
1851  *  fields are used to define the network to be started.
1852  *
1853  *  In both the above cases, the address field is used to determine the type of
1854  *  address assignment to be used for this interface.
1855  */
1856 struct wlan_network
1857 {
1858 #if CONFIG_WPA_SUPP
1859     /** Identifier for network profile */
1860     int id;
1861     /* wps_network marks the network is for wps*/
1862     int wps_network;
1863 #endif
1864     /** The name of this network profile.  Each network profile that is
1865      *  added to the WLAN Connection Manager must have a unique name. */
1866     char name[WLAN_NETWORK_NAME_MAX_LENGTH + 1];
1867     /** The network SSID, represented as a C string of up to 32 characters
1868      *  in length.
1869      *  If this profile is used in the micro-AP mode, this field is
1870      *  used as the SSID of the network.
1871      *  If this profile is used in the station mode, this field is
1872      *  used to identify the network. Set the first byte of the SSID to NULL
1873      *  (a 0-length string) to use only the BSSID to find the network.
1874      */
1875     char ssid[IEEEtypes_SSID_SIZE + 1];
1876 #if CONFIG_WLAN_BRIDGE
1877     /*The network SSID for bridge uap*/
1878     char bridge_ssid[IEEEtypes_SSID_SIZE + 1];
1879 #endif
1880     /** The network BSSID, represented as a 6-byte array.
1881      *  If this profile is used in the micro-AP mode, this field is
1882      *  ignored.
1883      *  If this profile is used in the station mode, this field is
1884      *  used to identify the network. Set all 6 bytes to 0 to use any BSSID,
1885      *  in which case only the SSID will be used to find the network.
1886      */
1887     char bssid[IEEEtypes_ADDRESS_SIZE];
1888     /** The channel for this network.
1889      *
1890      *  If this profile is used in micro-AP mode, this field
1891      *  specifies the channel to start the micro-AP interface on. Set this
1892      *  to 0 for auto channel selection.
1893      *
1894      *  If this profile is used in the station mode, this constrains the
1895      *  channel on which the network to connect should be present. Set this
1896      *  to 0 to allow the network to be found on any channel. */
1897     unsigned int channel;
1898     /** The secondary channel offset **/
1899     uint8_t sec_channel_offset;
1900     /** The ACS band if set channel to 0. **/
1901     uint16_t acs_band;
1902     /** RSSI */
1903     int rssi;
1904 #if CONFIG_SCAN_WITH_RSSIFILTER
1905     /** Rssi threshold */
1906     short rssi_threshold;
1907 #endif
1908 #if CONFIG_WPA_SUPP
1909     /** HT capabilities */
1910     unsigned short ht_capab;
1911 #if CONFIG_11AC
1912     /** VHT capabilities */
1913     unsigned int vht_capab;
1914     /** VHT bandwidth */
1915     unsigned char vht_oper_chwidth;
1916 #endif
1917 #if CONFIG_11AX
1918     /** HE bandwidth */
1919     unsigned char he_oper_chwidth;
1920 #endif
1921 #endif
1922     /** BSS type */
1923     enum wlan_bss_type type;
1924     /** The network wireless mode enum wlan_bss_role. Set this
1925      *  to specify what type of wireless network mode to use.
1926      *  This can either be \ref WLAN_BSS_ROLE_STA for use in
1927      *  the station mode, or it can be \ref WLAN_BSS_ROLE_UAP
1928      *  for use in the micro-AP mode. */
1929     enum wlan_bss_role role;
1930     /** The network security configuration specified by struct
1931      * wlan_network_security for the network. */
1932     struct wlan_network_security security;
1933     /** The network IP address configuration specified by struct
1934      * wlan_ip_config that should be associated with this interface. */
1935     struct wlan_ip_config ip;
1936 #if CONFIG_WPA2_ENTP
1937     char identity[IDENTITY_MAX_LENGTH];
1938 #if CONFIG_PEAP_MSCHAPV2
1939     char anonymous_identity[IDENTITY_MAX_LENGTH];
1940     char password[PASSWORD_MAX_LENGTH];
1941 #endif
1942 #endif
1943 
1944     /* Private Fields */
1945 
1946     /**
1947      * If set to 1, the ssid field contains the specific SSID for this
1948      * network.
1949      * The WLAN Connection Manager will only connect to networks whose SSID
1950      * matches.  If set to 0, the ssid field contents are not used when
1951      * deciding whether to connect to a network, the BSSID field is used
1952      * instead and any network whose BSSID matches is accepted.
1953      *
1954      * This field will be set to 1 if the network is added with the SSID
1955      * specified (not an empty string), otherwise it is set to 0.
1956      */
1957     unsigned ssid_specific : 1;
1958 #if CONFIG_DRIVER_OWE
1959     /**
1960      * If set to 1, the ssid field contains the transitional SSID for this
1961      * network.
1962      */
1963     unsigned trans_ssid_specific : 1;
1964 #endif
1965     /** If set to 1, the bssid field contains the specific BSSID for this
1966      *  network.  The WLAN Connection Manager will not connect to any other
1967      *  network with the same SSID unless the BSSID matches.  If set to 0, the
1968      *  WLAN Connection Manager will connect to any network whose SSID matches.
1969      *
1970      *  This field will be set to 1 if the network is added with the BSSID
1971      *  specified (not set to all zeroes), otherwise it is set to 0. */
1972     unsigned bssid_specific : 1;
1973     /**
1974      * If set to 1, the channel field contains the specific channel for this
1975      * network.  The WLAN Connection Manager will not look for this network on
1976      * any other channel.  If set to 0, the WLAN Connection Manager will look
1977      * for this network on any available channel.
1978      *
1979      * This field will be set to 1 if the network is added with the channel
1980      * specified (not set to 0), otherwise it is set to 0. */
1981     unsigned channel_specific : 1;
1982     /**
1983      * If set to 0, any security that matches is used. This field is
1984      * internally set when the security type parameter above is set to
1985      * WLAN_SECURITY_WILDCARD.
1986      */
1987     unsigned security_specific : 1;
1988 #if CONFIG_WPS2
1989     /** This indicates this network is used as an internal network for
1990      * WPS */
1991     unsigned wps_specific : 1;
1992 #endif
1993 
1994     /** The network supports 802.11N. (For internal use only) */
1995     unsigned dot11n : 1;
1996 #if CONFIG_11AC
1997     /** The network supports 802.11AC. (For internal use only) */
1998     unsigned dot11ac : 1;
1999 #endif
2000 #if CONFIG_11AX
2001     /** The network supports 802.11AX. (For internal use only) */
2002     unsigned dot11ax : 1;
2003 #endif
2004 
2005 #if CONFIG_11R
2006     /** Mobility Domain ID */
2007     uint16_t mdid;
2008     /** The network uses FT 802.1x security (For internal use only)*/
2009     unsigned ft_1x : 1;
2010     /** The network uses FT PSK security (For internal use only)*/
2011     unsigned ft_psk : 1;
2012     /** The network uses FT SAE security (For internal use only)*/
2013     unsigned ft_sae : 1;
2014 #endif
2015 #if CONFIG_DRIVER_OWE
2016     /** OWE Transition mode */
2017     unsigned int owe_trans_mode;
2018     /** The network transitional SSID, represented as a C string of up to 32 characters
2019      *  in length.
2020      *
2021      * This field is used internally.
2022      */
2023     char trans_ssid[IEEEtypes_SSID_SIZE + 1];
2024     /** Transitional SSID length
2025      *
2026      * This field is used internally.
2027      */
2028     unsigned int trans_ssid_len;
2029 #endif
2030     /** Beacon period of associated BSS */
2031     uint16_t beacon_period;
2032     /** DTIM period of associated BSS */
2033     uint8_t dtim_period;
2034 #if CONFIG_WIFI_CAPA
2035     /** Wireless capabilities of uAP network 802.11n, 802.11ac or/and 802.11ax*/
2036     uint8_t wlan_capa;
2037 #endif
2038 #if CONFIG_11V
2039     /** BTM mode */
2040     uint8_t btm_mode;
2041     /** bss transition support (For internal use only)*/
2042     bool bss_transition_supported;
2043 #endif
2044 #if CONFIG_11K
2045     /** Neighbor report support (For internal use only)*/
2046     bool neighbor_report_supported;
2047 #endif
2048 };
2049 
2050 struct wlan_ieeeps_config
2051 {
2052     /** PS null interval in seconds */
2053     t_u32 ps_null_interval;
2054     /** Multiple DTIM interval */
2055     t_u32 multiple_dtim_interval;
2056     /** Listen interval */
2057     t_u32 listen_interval;
2058     /** Adhoc awake period */
2059     t_u32 adhoc_awake_period;
2060     /** Beacon miss timeout in milliseconds */
2061     t_u32 bcn_miss_timeout;
2062     /** Delay to PS in milliseconds */
2063     t_s32 delay_to_ps;
2064     /** PS mode */
2065     t_u32 ps_mode;
2066 };
2067 
2068 #if CONFIG_WIFI_TX_PER_TRACK
2069 /** Tx Per Tracking Structure
2070  * Driver sets tx per tracking statistic to fw.
2071  * Fw will check tx packet error rate periodically and
2072  * report PER to host if per is high.
2073  */
2074 struct wlan_tx_pert_info
2075 {
2076     /** Enable/Disable tx per tracking */
2077     t_u8 tx_pert_check;
2078     /** Check period(unit sec) */
2079     t_u8 tx_pert_check_peroid;
2080     /** (Fail TX packet)/(Total TX packet) ratio(unit 10%)
2081      * default: 5
2082      */
2083     t_u8 tx_pert_check_ratio;
2084     /** A watermark of check number(default 5) */
2085     t_u16 tx_pert_check_num;
2086 };
2087 #endif
2088 #if defined(RW610)
2089 typedef enum
2090 {
2091     CLI_DISABLE_WIFI,
2092     CLI_ENABLE_WIFI,
2093     CLI_RESET_WIFI,
2094 } cli_reset_option;
2095 #endif
2096 
2097 enum wlan_mon_task_event
2098 {
2099     HOST_SLEEP_HANDSHAKE = 1,
2100     HOST_SLEEP_EXIT,
2101     WIFI_RECOVERY_REQ,
2102 };
2103 
2104 #if CONFIG_HOST_SLEEP
2105 enum wlan_hostsleep_state
2106 {
2107     HOST_SLEEP_DISABLE,
2108     HOST_SLEEP_ONESHOT,
2109     HOST_SLEEP_PERIODIC,
2110 };
2111 
2112 #define WLAN_HOSTSLEEP_SUCCESS    1
2113 #define WLAN_HOSTSLEEP_IN_PROCESS 2
2114 #define WLAN_HOSTSLEEP_FAIL       3
2115 #endif
2116 
2117 #if CONFIG_TX_RX_HISTOGRAM
2118 struct wlan_txrx_histogram_info
2119 {
2120     /**  Enable or disable  */
2121     t_u8 enable;
2122     /** Choose to get TX, RX or both */
2123     t_u16 action;
2124 };
2125 
2126 #define FLAG_TX_HISTOGRAM       0x01
2127 #define FLAG_RX_HISTOGRAM       0x02
2128 #define DISABLE_TX_RX_HISTOGRAM 0x00
2129 #define ENABLE_TX_RX_HISTOGRAM  0x01
2130 #define GET_TX_RX_HISTOGRAM     0x02
2131 
2132 /** TX histiogram ht statistic parameters */
2133 typedef struct _tx_pkt_ht_rate_info
2134 {
2135     /** tx packet counter of MCS0~MCS15 */
2136     t_u32 htmcs_txcnt[16];
2137     /** tx packet's short GI counter of MCS0~MCS15 */
2138     t_u32 htsgi_txcnt[16];
2139     /** tx STBC packet counter of MCS0~MCS15 */
2140     t_u32 htstbcrate_txcnt[16];
2141 } tx_pkt_ht_rate_info;
2142 /** TX histiogram vht statistic parameters */
2143 typedef struct _tx_pkt_vht_rate_info
2144 {
2145     /** tx packet counter of MCS0~MCS9 */
2146     t_u32 vhtmcs_txcnt[10];
2147     /** tx packet's short GI counter of MCS0~MCS9 */
2148     t_u32 vhtsgi_txcnt[10];
2149     /** tx STBC packet counter of MCS0~MCS9 */
2150     t_u32 vhtstbcrate_txcnt[10];
2151 } tx_pkt_vht_rate_info;
2152 /** TX histiogram he statistic parameters */
2153 typedef struct _tx_pkt_he_rate_info
2154 {
2155     /** tx packet counter of MCS0~MCS11 */
2156     t_u32 hemcs_txcnt[12];
2157     /** tx STBC packet counter of MCS0~MCS11 */
2158     t_u32 hestbcrate_txcnt[12];
2159 } tx_pkt_he_rate_info;
2160 /** TX histogram statistic parameters*/
2161 typedef struct _tx_pkt_rate_info
2162 {
2163     /** tx packet counter of every NSS, NSS=1,2 */
2164     t_u32 nss_txcnt[2];
2165     /** tx packet counter of every bandwith */
2166     t_u32 bandwidth_txcnt[3];
2167     /** different preamble tx packet counter */
2168     t_u32 preamble_txcnt[4];
2169     /** tx packet counter of using LDPC coding */
2170     t_u32 ldpc_txcnt;
2171     /** transmitted RTS counter */
2172     t_u32 rts_txcnt;
2173     /** RSSI of ack */
2174     t_s32 ack_RSSI;
2175 } tx_pkt_rate_info;
2176 /** RX histiogram ht statistic parameters */
2177 typedef struct _rx_pkt_ht_rate_info
2178 {
2179     /** Rx packet counter of MCS0~MCS15 */
2180     t_u32 htmcs_rxcnt[16];
2181     /** Rx packet's short GI counter of MCS0~MCS15 */
2182     t_u32 htsgi_rxcnt[16];
2183     /** Rx STBC packet counter of MCS0~MCS15 */
2184     t_u32 htstbcrate_rxcnt[16];
2185 } rx_pkt_ht_rate_info;
2186 /** RX histiogram vht statistic parameters */
2187 typedef struct _rx_pkt_vht_rate_info
2188 {
2189     /** Rx packet counter of MCS0~MCS9 */
2190     t_u32 vhtmcs_rxcnt[10];
2191     /** Rx packet's short GI counter of MCS0~MCS9 */
2192     t_u32 vhtsgi_rxcnt[10];
2193     /** Rx STBC packet counter of MCS0~MCS9 */
2194     t_u32 vhtstbcrate_rxcnt[10];
2195 } rx_pkt_vht_rate_info;
2196 /** RX histiogram he statistic parameters */
2197 typedef struct _rx_pkt_he_rate_info
2198 {
2199     /** Rx packet counter of MCS0~MCS11 */
2200     t_u32 hemcs_rxcnt[12];
2201     /** Rx STBC packet counter of MCS0~MCS11 */
2202     t_u32 hestbcrate_rxcnt[12];
2203 } rx_pkt_he_rate_info;
2204 /** RX histogram statistic parameters*/
2205 typedef struct _rx_pkt_rate_info
2206 {
2207     /** Rx packet counter of every NSS, NSS=1,2 */
2208     t_u32 nss_rxcnt[2];
2209     /** Received packet counter which using STBC */
2210     t_u32 nsts_rxcnt;
2211     /** Rx packet counter of every bandwith */
2212     t_u32 bandwidth_rxcnt[3];
2213     /** Different preamble Rx packet counter */
2214     t_u32 preamble_rxcnt[6];
2215     /** VHT SIGA2 LDPC bit*/
2216     t_u32 ldpc_txbfcnt[2];
2217     /**  Average RSSI */
2218     t_s32 rssi_value[2];
2219     /** RSSI value of path A */
2220     t_s32 rssi_chain0[4];
2221     /** RSSI value of path B */
2222     t_s32 rssi_chain1[4];
2223 } rx_pkt_rate_info;
2224 #endif
2225 
2226 #if CONFIG_TX_AMPDU_PROT_MODE
2227 #define TX_AMPDU_RTS_CTS            0
2228 #define TX_AMPDU_CTS_2_SELF         1
2229 #define TX_AMPDU_DISABLE_PROTECTION 2
2230 #define TX_AMPDU_DYNAMIC_RTS_CTS    3
2231 
2232 /** tx_ampdu_prot_mode parameters */
2233 typedef struct _tx_ampdu_prot_mode_para
2234 {
2235     /** set prot mode */
2236     int mode;
2237 } tx_ampdu_prot_mode_para;
2238 #endif
2239 
2240 typedef wifi_uap_client_disassoc_t wlan_uap_client_disassoc_t;
2241 
2242 #if CONFIG_INACTIVITY_TIMEOUT_EXT
2243 typedef wifi_inactivity_to_t wlan_inactivity_to_t;
2244 #endif
2245 
2246 /* WLAN Connection Manager API */
2247 
2248 /** Initialize the SDIO driver and create the wifi driver thread.
2249  *
2250  * \param[in]  fw_start_addr Start address of the WLAN firmware.
2251  * \param[in]  size Size of the WLAN firmware.
2252  *
2253  * \return WM_SUCCESS if the WLAN Connection Manager service has
2254  *         initialized successfully.
2255  * \return Negative value if initialization failed.
2256  */
2257 int wlan_init(const uint8_t *fw_start_addr, const size_t size);
2258 
2259 /** Start the WLAN Connection Manager service.
2260  *
2261  * This function starts the WLAN Connection Manager.
2262  *
2263  * \note The status of the WLAN Connection Manager is notified asynchronously
2264  * through the callback, \a cb, with a WLAN_REASON_INITIALIZED event
2265  * (if initialization succeeded) or WLAN_REASON_INITIALIZATION_FAILED
2266  * (if initialization failed).
2267  *
2268  * \note If the WLAN Connection Manager fails to initialize, the caller should
2269  * stop WLAN Connection Manager via wlan_stop() and try wlan_start() again.
2270  *
2271  * \param[in] cb A pointer to a callback function that handles WLAN events. All
2272  * further WLCMGR events will be notified in this callback. Refer to enum
2273  * \ref wlan_event_reason for the various events for which this callback is called.
2274  *
2275  * \return WM_SUCCESS if the WLAN Connection Manager service has started
2276  *         successfully.
2277  * \return -WM_E_INVAL if the \a cb pointer is NULL.
2278  * \return -WM_FAIL if an internal error occurred.
2279  * \return WLAN_ERROR_STATE if the WLAN Connection Manager is already running.
2280  */
2281 int wlan_start(int (*cb)(enum wlan_event_reason reason, void *data));
2282 
2283 /** Stop the WLAN Connection Manager service.
2284  *
2285  *  This function stops the WLAN Connection Manager, causing station interface
2286  *  to disconnect from the currently connected network and stop the
2287  *  micro-AP interface.
2288  *
2289  *  \return WM_SUCCESS if the WLAN Connection Manager service has been
2290  *          stopped successfully.
2291  *  \return WLAN_ERROR_STATE if the WLAN Connection Manager was not
2292  *          running.
2293  */
2294 int wlan_stop(void);
2295 
2296 /** Deinitialize SDIO driver, send shutdown command to WLAN firmware
2297  *  and delete the wifi driver thread.
2298  *  \param action Additional action to be taken with deinit
2299  *			WLAN_ACTIVE: no action to be taken
2300  */
2301 void wlan_deinit(int action);
2302 
2303 #if CONFIG_WPS2
2304 /** Generate valid PIN for WPS session.
2305  *
2306  *  This function generate PIN for WPS PIN session.
2307  *
2308  * \param[in]  pin A pointer to WPS pin to be generated.
2309  */
2310 void wlan_wps_generate_pin(uint32_t *pin);
2311 
2312 /** Start WPS PIN session.
2313  *
2314  *  This function starts WPS PIN session.
2315  *
2316  * \param[in]  pin Pin for WPS session.
2317  *
2318  * \return WM_SUCCESS if the pin entered is valid.
2319  * \return -WM_FAIL if invalid pin entered.
2320  */
2321 int wlan_start_wps_pin(uint32_t pin);
2322 
2323 /** Start WPS PBC session.
2324  *
2325  *  This function starts WPS PBC session.
2326  *
2327  * \return  WM_SUCCESS if successful
2328  */
2329 int wlan_start_wps_pbc(void);
2330 /**
2331  * Set None/WPS/802.1x session.
2332  *
2333  *\param[in] session       0 -- PROV_NON_SESSION_ATTEMPT, 1 -- PROV_WPS_SESSION_ATTEMPT, 2 -- PROV_ENTP_SESSION_ATTEMPT.
2334  */
2335 void wlan_set_prov_session(int session);
2336 
2337 /**
2338  * Get connect session type.
2339  *
2340  * \return 0 -- PROV_NON_SESSION_ATTEMPT, 1 -- PROV_WPS_SESSION_ATTEMPT, 2 -- PROV_ENTP_SESSION_ATTEMPT.
2341  */
2342 int wlan_get_prov_session(void);
2343 #endif
2344 
2345 /** Stop and Remove all wireless network profiles.
2346  *
2347  *  \return WM_SUCCESS if successful.
2348  */
2349 int wlan_remove_all_network_profiles(void);
2350 
2351 #if defined(RW610)
2352 /** Reset driver.
2353  *  \param ResetOption option including enable, disable or reset wifi driver
2354  *  can be chosen.
2355  */
2356 void wlan_reset(cli_reset_option ResetOption);
2357 /** Stop and Remove all wireless network (Access Point).
2358  *
2359  *  \return WM_SUCCESS if successful.
2360  */
2361 int wlan_remove_all_networks(void);
2362 
2363 /**
2364  * This API destroy all tasks.
2365  */
2366 void wlan_destroy_all_tasks(void);
2367 /** Retrieve the status information of if wlan started.
2368  *
2369  *  \return TRUE if started.
2370  *  \return FALSE if not started.
2371  */
2372 int wlan_is_started();
2373 
2374 #endif // RW610
2375 
2376 #if CONFIG_NCP_BRIDGE
2377 /** uap provisioning deinit callback function */
2378 void wlan_register_uap_prov_deinit_cb(int (*cb)(void));
2379 /** uap provisioning cleanup callback function */
2380 void wlan_register_uap_prov_cleanup_cb(void (*cb)(void));
2381 /** Stop all wireless network.
2382  *
2383  *  \return WM_SUCCESS if successful.
2384  */
2385 int wlan_stop_all_networks(void);
2386 #endif
2387 
2388 #if CONFIG_RX_ABORT_CFG
2389 struct wlan_rx_abort_cfg
2390 {
2391     /** Enable/Disable Rx abort config */
2392     t_u8 enable;
2393     /** Rx weak RSSI pkt threshold */
2394     int rssi_threshold;
2395 };
2396 #endif
2397 
2398 #if CONFIG_RX_ABORT_CFG_EXT
2399 struct wlan_rx_abort_cfg_ext
2400 {
2401     /** Enable/disable dyn rx abort on weak pkt rssi */
2402     int enable;
2403     /** specify rssi margin */
2404     int rssi_margin;
2405     /** specify ceil rssi threshold */
2406     int ceil_rssi_threshold;
2407     /** specify floor rssi threshold */
2408     int floor_rssi_threshold;
2409     /** current dynamic rssi threshold */
2410     int current_dynamic_rssi_threshold;
2411     /** rssi config: default or user configured */
2412     int rssi_default_config;
2413     /** EDMAC status */
2414     int edmac_enable;
2415 };
2416 #endif
2417 
2418 #if CONFIG_CCK_DESENSE_CFG
2419 #define CCK_DESENSE_MODE_DISABLED 0
2420 #define CCK_DESENSE_MODE_DYNAMIC  1
2421 #define CCK_DESENSE_MODE_DYN_ENH  2
2422 
2423 struct wlan_cck_desense_cfg
2424 {
2425     /** cck desense mode: 0:disable 1:normal 2:dynamic */
2426     t_u16 mode;
2427     /** specify rssi margin */
2428     int margin;
2429     /** specify ceil rssi threshold */
2430     int ceil_thresh;
2431     /** cck desense "on" interval count */
2432     int num_on_intervals;
2433     /** cck desense "off" interval count */
2434     int num_off_intervals;
2435 };
2436 #endif
2437 #if CONFIG_RX_ABORT_CFG
2438 /**
2439  * Set/Get RX abort configure to/from Fw.
2440  *
2441  * \param[in,out] cfg A pointer to information buffer
2442  * \param[in] action Command action: GET or SET
2443  *
2444  * \return WM_SUCCESS if successful otherwise failure.
2445  */
2446 int wlan_set_get_rx_abort_cfg(struct wlan_rx_abort_cfg *cfg, t_u16 action);
2447 #endif
2448 
2449 #if CONFIG_RX_ABORT_CFG_EXT
2450 /**
2451  * Set Dynamic RX abort config to Fw.
2452  *
2453  * \param[in] cfg A pointer to information buffer
2454  *
2455  * \return WM_SUCCESS if successful otherwise failure.
2456  */
2457 int wlan_set_rx_abort_cfg_ext(const struct wlan_rx_abort_cfg_ext *cfg);
2458 
2459 /**
2460  * Get Dynamic RX abort config from Fw.
2461  *
2462  * \param[in,out] cfg A pointer to information buffer
2463  *
2464  * \return WM_SUCCESS if successful otherwise failure.
2465  */
2466 int wlan_get_rx_abort_cfg_ext(struct wlan_rx_abort_cfg_ext *cfg);
2467 #endif
2468 
2469 #if CONFIG_CCK_DESENSE_CFG
2470 /**
2471  * Set/Get CCK Desense configure to/from Fw.
2472  *
2473  * \param[in,out] cfg A pointer to information buffer
2474  * \param[in] action Command action: GET or SET
2475  *
2476  * \return WM_SUCCESS if successful otherwise failure.
2477  */
2478 int wlan_set_get_cck_desense_cfg(struct wlan_cck_desense_cfg *cfg, t_u16 action);
2479 #endif
2480 
2481 /** WLAN initialize micro-AP network information
2482  *
2483  * This API intializes a default micro-AP network. The network ssid, passphrase
2484  * is initialized to NULL. Channel is set to auto. The IP Address of the
2485  * micro-AP interface is 192.168.10.1/255.255.255.0. Network name is set to
2486  * 'uap-network'.
2487  *
2488  * \param[out] net Pointer to the initialized micro-AP network
2489  */
2490 void wlan_initialize_uap_network(struct wlan_network *net);
2491 
2492 /** WLAN initialize station network information
2493  *
2494  * This API intializes a default station network. The network ssid, passphrase
2495  * is initialized to NULL. Channel is set to auto.
2496  *
2497  * \param[out] net Pointer to the initialized micro-AP network
2498  */
2499 void wlan_initialize_sta_network(struct wlan_network *net);
2500 
2501 /** Add a network profile to the list of known networks.
2502  *
2503  *  This function copies the contents of \a network to the list of known
2504  *  networks in the WLAN Connection Manager.  The network's 'name' field must be
2505  *  unique and between \ref WLAN_NETWORK_NAME_MIN_LENGTH and \ref
2506  *  WLAN_NETWORK_NAME_MAX_LENGTH characters.  The network must specify at least
2507  *  an SSID or BSSID.  The WLAN Connection Manager may store up to
2508  *  WLAN_MAX_KNOWN_NETWORKS networks.
2509  *
2510  *  \note Profiles for the station interface may be added only when the station
2511  *  interface is in the \ref WLAN_DISCONNECTED or \ref WLAN_CONNECTED state.
2512  *
2513  *  \note This API can be used to add profiles for station or
2514  *  micro-AP interfaces.
2515  *
2516  *  \param[in] network A pointer to the \ref wlan_network that will be copied
2517  *             to the list of known networks in the WLAN Connection Manager
2518  *             successfully.
2519  *
2520  *  \return WM_SUCCESS if the contents pointed to by \a network have been
2521  *          added to the WLAN Connection Manager.
2522  *  \return -WM_E_INVAL if \a network is NULL or the network name
2523  *          is not unique or the network name length is not valid
2524  *          or network security is \ref WLAN_SECURITY_WPA3_SAE but
2525  *          Management Frame Protection Capable is not enabled.
2526  *          in \ref wlan_network_security field. if network security type is
2527  *          \ref WLAN_SECURITY_WPA or \ref WLAN_SECURITY_WPA2 or \ref
2528  *          WLAN_SECURITY_WPA_WPA2_MIXED, but the passphrase length is less
2529  *          than 8 or greater than 63, or the psk length equal to 64 but not
2530  *          hexadecimal digits. if network security type is \ref WLAN_SECURITY_WPA3_SAE,
2531  *          but the password length is less than 8 or greater than 255.
2532  *          if network security type is \ref WLAN_SECURITY_WEP_OPEN or
2533  *          \ref WLAN_SECURITY_WEP_SHARED.
2534  *  \return -WM_E_NOMEM if there was no room to add the network.
2535  *  \return WLAN_ERROR_STATE if the WLAN Connection Manager
2536  *          was running and not in the \ref WLAN_DISCONNECTED,
2537  *          \ref WLAN_ASSOCIATED or \ref WLAN_CONNECTED state.
2538  */
2539 int wlan_add_network(struct wlan_network *network);
2540 
2541 /** Remove a network profile from the list of known networks.
2542  *
2543  *  This function removes a network (identified by its name) from the WLAN
2544  *  Connection Manager, disconnecting from that network if connected.
2545  *
2546  *  \note This function is asynchronous if it is called while the WLAN
2547  *  Connection Manager is running and connected to the network to be removed.
2548  *  In that case, the WLAN Connection Manager will disconnect from the network
2549  *  and generate an event with reason \ref WLAN_REASON_USER_DISCONNECT. This
2550  *  function is synchronous otherwise.
2551  *
2552  *  \note This API can be used to remove profiles for station or
2553  *  micro-AP interfaces. Station network will not be removed if it is
2554  *  in \ref WLAN_CONNECTED state and uAP network will not be removed
2555  *  if it is in \ref WLAN_UAP_STARTED state.
2556  *
2557  *  \param[in] name A pointer to the string representing the name of the
2558  *             network to remove.
2559  *
2560  *  \return WM_SUCCESS if the network named \a name was removed from the
2561  *          WLAN Connection Manager successfully. Otherwise,
2562  *          the network is not removed.
2563  *  \return WLAN_ERROR_STATE if the WLAN Connection Manager was
2564  *          running and the station interface was not in the \ref
2565  *          WLAN_DISCONNECTED state.
2566  *  \return -WM_E_INVAL if \a name is NULL or the network was not found in
2567  *          the list of known networks.
2568  *  \return -WM_FAIL if an internal error occurred
2569  *          while trying to disconnect from the network specified for
2570  *          removal.
2571  */
2572 int wlan_remove_network(const char *name);
2573 
2574 /** Connect to a wireless network (Access Point).
2575  *
2576  *  When this function is called, WLAN Connection Manager starts connection attempts
2577  *  to the network specified by \a name. The connection result will be notified
2578  *  asynchronously to the WLCMGR callback when the connection process has
2579  *  completed.
2580  *
2581  *  When connecting to a network, the event refers to the connection
2582  *  attempt to that network.
2583  *
2584  *  Calling this function when the station interface is in the \ref
2585  *  WLAN_DISCONNECTED state will, if successful, cause the interface to
2586  *  transition into the \ref WLAN_CONNECTING state.  If the connection attempt
2587  *  succeeds, the station interface will transition to the \ref WLAN_CONNECTED state,
2588  *  otherwise it will return to the \ref WLAN_DISCONNECTED state.  If this
2589  *  function is called while the station interface is in the \ref
2590  *  WLAN_CONNECTING or \ref WLAN_CONNECTED state, the WLAN Connection Manager
2591  *  will first cancel its connection attempt or disconnect from the network,
2592  *  respectively, and generate an event with reason \ref
2593  *  WLAN_REASON_USER_DISCONNECT. This will be followed by a second event that
2594  *  reports the result of the new connection attempt.
2595  *
2596  *  If the connection attempt was successful the WLCMGR callback is notified
2597  *  with the event \ref WLAN_REASON_SUCCESS, while if the connection attempt
2598  *  fails then either of the events, \ref WLAN_REASON_NETWORK_NOT_FOUND, \ref
2599  *  WLAN_REASON_NETWORK_AUTH_FAILED, \ref WLAN_REASON_CONNECT_FAILED
2600  *  or \ref WLAN_REASON_ADDRESS_FAILED are reported as appropriate.
2601  *
2602  *  \param[in] name A pointer to a string representing the name of the network
2603  *              to connect to.
2604  *
2605  *  \return WM_SUCCESS if a connection attempt was started successfully
2606  *  \return WLAN_ERROR_STATE if the WLAN Connection Manager was not running.
2607  *  \return -WM_E_INVAL if there are no known networks to connect to
2608  *          or the network specified by \a name is not in the list
2609  *          of known networks or network \a name is NULL.
2610  *  \return -WM_FAIL if an internal error has occurred.
2611  */
2612 int wlan_connect(char *name);
2613 
2614 /** Connect to a wireless network (Access Point) with options.
2615  *
2616  *  When this function is called, WLAN Connection Manager starts connection attempts
2617  *  to the network specified by \a name. The connection result will be notified
2618  *  asynchronously to the WLCMGR callback when the connection process has
2619  *  completed.
2620  *
2621  *  When connecting to a network, the event refers to the connection
2622  *  attempt to that network.
2623  *
2624  *  Calling this function when the station interface is in the \ref
2625  *  WLAN_DISCONNECTED state will, if successful, cause the interface to
2626  *  transition into the \ref WLAN_CONNECTING state.  If the connection attempt
2627  *  succeeds, the station interface will transition to the \ref WLAN_CONNECTED state,
2628  *  otherwise it will return to the \ref WLAN_DISCONNECTED state.  If this
2629  *  function is called while the station interface is in the \ref
2630  *  WLAN_CONNECTING or \ref WLAN_CONNECTED state, the WLAN Connection Manager
2631  *  will first cancel its connection attempt or disconnect from the network,
2632  *  respectively, and generate an event with reason \ref
2633  *  WLAN_REASON_USER_DISCONNECT. This will be followed by a second event that
2634  *  reports the result of the new connection attempt.
2635  *
2636  *  If the connection attempt was successful the WLCMGR callback is notified
2637  *  with the event \ref WLAN_REASON_SUCCESS, while if the connection attempt
2638  *  fails then either of the events, \ref WLAN_REASON_NETWORK_NOT_FOUND, \ref
2639  *  WLAN_REASON_NETWORK_AUTH_FAILED, \ref WLAN_REASON_CONNECT_FAILED
2640  *  or \ref WLAN_REASON_ADDRESS_FAILED are reported as appropriate.
2641  *
2642  *  \param[in] name A pointer to a string representing the name of the network
2643  *              to connect to.
2644  *  \param[in] skip_dfs Option to skip DFS channel when doing scan.
2645  *
2646  *  \return WM_SUCCESS if a connection attempt was started successfully
2647  *  \return WLAN_ERROR_STATE if the WLAN Connection Manager was not running.
2648  *  \return -WM_E_INVAL if there are no known networks to connect to
2649  *          or the network specified by \a name is not in the list
2650  *          of known networks or network \a name is NULL.
2651  *  \return -WM_FAIL if an internal error has occurred.
2652  */
2653 int wlan_connect_opt(char *name, bool skip_dfs);
2654 
2655 /** Reassociate to a wireless network (Access Point).
2656  *
2657  *  When this function is called, WLAN Connection Manager starts reassociation
2658  *  attempts using same SSID as currently connected network .
2659  *  The connection result will be notified asynchronously to the WLCMGR
2660  *  callback when the connection process has completed.
2661  *
2662  *  When connecting to a network, the event refers to the connection
2663  *  attempt to that network.
2664  *
2665  *  Calling this function when the station interface is in the \ref
2666  *  WLAN_DISCONNECTED state will have no effect.
2667  *
2668  *  Calling this function when the station interface is in the \ref
2669  *  WLAN_CONNECTED state will, if successful, cause the interface to
2670  *  reassociate to another network(AP).
2671  *
2672  *  If the connection attempt was successful the WLCMGR callback is notified
2673  *  with the event \ref WLAN_REASON_SUCCESS, while if the connection attempt
2674  *  fails then either of the events, \ref WLAN_REASON_NETWORK_AUTH_FAILED,
2675  *  \ref WLAN_REASON_CONNECT_FAILED or \ref WLAN_REASON_ADDRESS_FAILED
2676  *  are reported as appropriate.
2677  *
2678  *  \return WM_SUCCESS if a reassociation attempt was started successfully
2679  *  \return WLAN_ERROR_STATE if the WLAN Connection Manager was not running.
2680  *          or WLAN Connection Manager was not in \ref WLAN_CONNECTED state.
2681  *  \return -WM_E_INVAL if there are no known networks to connect to
2682  *  \return -WM_FAIL if an internal error has occurred.
2683  */
2684 int wlan_reassociate();
2685 
2686 /** Disconnect from the current wireless network (Access Point).
2687  *
2688  *  When this function is called, the WLAN Connection Manager attempts to disconnect
2689  *  the station interface from its currently connected network (or cancel an in-progress
2690  *  connection attempt) and return to the \ref WLAN_DISCONNECTED state. Calling
2691  *  this function has no effect if the station interface is already
2692  *  disconnected.
2693  *
2694  *  \note This is an asynchronous function and successful disconnection will be
2695  *  notified using the \ref WLAN_REASON_USER_DISCONNECT.
2696  *
2697  * \return  WM_SUCCESS if successful
2698  * \return  WLAN_ERROR_STATE otherwise
2699  */
2700 int wlan_disconnect(void);
2701 
2702 /** Start a wireless network (Access Point).
2703  *
2704  *  When this function is called, the WLAN Connection Manager starts the network
2705  *  specified by \a name. The network with the specified \a name must be
2706  *  first added using \ref wlan_add_network and must be a micro-AP network with
2707  *  a valid SSID.
2708  *
2709  *  \note The WLCMGR callback is asynchronously notified of the status. On
2710  *  success, the event \ref WLAN_REASON_UAP_SUCCESS is reported, while on
2711  *  failure, the event \ref WLAN_REASON_UAP_START_FAILED is reported.
2712  *
2713  *  \param[in] name A pointer to string representing the name of the network
2714  *             to connect to.
2715  *
2716  *  \return WM_SUCCESS if successful.
2717  *  \return WLAN_ERROR_STATE if in power save state or uAP already running.
2718  *  \return -WM_E_INVAL if \a name was NULL or the network \a
2719  *          name was not found or it not have a specified SSID.
2720  */
2721 int wlan_start_network(const char *name);
2722 
2723 /** Stop a wireless network (Access Point).
2724  *
2725  *  When this function is called, the WLAN Connection Manager stops the network
2726  *  specified by \a name. The specified network must be a valid micro-AP
2727  *  network that has already been started.
2728  *
2729  *  \note The WLCMGR callback is asynchronously notified of the status. On
2730  *  success, the event \ref WLAN_REASON_UAP_STOPPED is reported, while on
2731  *  failure, the event \ref WLAN_REASON_UAP_STOP_FAILED is reported.
2732  *
2733  *  \param[in] name A pointer to a string representing the name of the network
2734  *             to stop.
2735  *
2736  *  \return WM_SUCCESS if successful.
2737  *  \return WLAN_ERROR_STATE if uAP is in power save state.
2738  *  \return -WM_E_INVAL if \a name was NULL or the network \a
2739  *          name was not found or that the network \a name is not a micro-AP
2740  *          network or it is a micro-AP network but does not have a specified
2741  *          SSID.
2742  */
2743 int wlan_stop_network(const char *name);
2744 
2745 /** Retrieve the wireless MAC address of station interface.
2746  *
2747  *  This function copies the MAC address of the station interface to sta mac address and uAP interface to uap mac
2748  * address.
2749  *
2750  *  \param[out] dest A pointer to a 6-byte array where the MAC address will be
2751  *              copied.
2752  *
2753  *  \return WM_SUCCESS if the MAC address was copied.
2754  *  \return -WM_E_INVAL if \a sta_mac or uap_mac is NULL.
2755  */
2756 int wlan_get_mac_address(uint8_t *dest);
2757 
2758 /** Retrieve the wireless MAC address of micro-AP interface.
2759  *
2760  *  This function copies the MAC address of the wireless interface to
2761  *  the 6-byte array pointed to by \a dest.  In the event of an error, nothing
2762  *  is copied to \a dest.
2763  *
2764  *  \param[out] dest A pointer to a 6-byte array where the MAC address will be
2765  *              copied.
2766  *
2767  *  \return WM_SUCCESS if the MAC address was copied.
2768  *  \return -WM_E_INVAL if \a dest is NULL.
2769  */
2770 int wlan_get_mac_address_uap(uint8_t *dest);
2771 
2772 /** Retrieve the IP address configuration of the station interface.
2773  *
2774  *  This function retrieves the IP address configuration
2775  *  of the station interface and copies it to the memory
2776  *  location pointed to by \a addr.
2777  *
2778  *  \note This function may only be called when the station interface is in the
2779  *  \ref WLAN_CONNECTED state.
2780  *
2781  *  \param[out] addr A pointer to the \ref wlan_ip_config.
2782  *
2783  *  \return WM_SUCCESS if successful.
2784  *  \return -WM_E_INVAL if \a addr is NULL.
2785  *  \return WLAN_ERROR_STATE if the WLAN Connection Manager was not running or was
2786  *          not in the \ref WLAN_CONNECTED state.
2787  *  \return -WM_FAIL if an internal error
2788  *          occurred when retrieving IP address information from the
2789  *          TCP stack.
2790  */
2791 int wlan_get_address(struct wlan_ip_config *addr);
2792 
2793 /** Retrieve the IP address of micro-AP interface.
2794  *
2795  *  This function retrieves the current IP address configuration of micro-AP
2796  *  and copies it to the memory location pointed to by \a addr.
2797  *
2798  *  \note This function may only be called when the micro-AP interface is in the
2799  *  \ref WLAN_UAP_STARTED state.
2800  *
2801  *  \param[out] addr A pointer to the \ref wlan_ip_config.
2802  *
2803  *  \return WM_SUCCESS if successful.
2804  *  \return -WM_E_INVAL if \a addr is NULL.
2805  *  \return WLAN_ERROR_STATE if the WLAN Connection Manager was not running or
2806  *          the micro-AP interface was not in the \ref WLAN_UAP_STARTED state.
2807  *  \return -WM_FAIL if an internal error
2808  *          occurred when retrieving IP address information from the
2809  *          TCP stack.
2810  */
2811 int wlan_get_uap_address(struct wlan_ip_config *addr);
2812 
2813 /** Retrieve the channel of micro-AP interface.
2814  *
2815  *  This function retrieves the channel number of micro-AP
2816  *  and copies it to the memory location pointed to by \a channel.
2817  *
2818  *  \note This function may only be called when the micro-AP interface is in the
2819  *  \ref WLAN_UAP_STARTED state.
2820  *
2821  *  \param[out] channel A pointer to variable that stores channel number.
2822  *
2823  *  \return WM_SUCCESS if successful.
2824  *  \return -WM_E_INVAL if \a channel is NULL.
2825  *  \return -WM_FAIL if an internal error has occurred.
2826  */
2827 int wlan_get_uap_channel(int *channel);
2828 
2829 /** Retrieve the current network configuration of station interface.
2830  *
2831  *  This function retrieves the current network configuration of station
2832  *  interface when the station interface is in the \ref WLAN_CONNECTED
2833  *  state.
2834  *
2835  *  \param[out] network A pointer to the \ref wlan_network.
2836  *
2837  *  \return WM_SUCCESS if successful.
2838  *  \return -WM_E_INVAL if \a network is NULL.
2839  *  \return WLAN_ERROR_STATE if the WLAN Connection Manager was
2840  *          not running or not in the \ref WLAN_CONNECTED state.
2841  */
2842 int wlan_get_current_network(struct wlan_network *network);
2843 
2844 /** Retrieve the current network ssid of station interface.
2845  *
2846  *  This function retrieves the current network ssid of station
2847  *  interface when the station interface is in the \ref WLAN_CONNECTED
2848  *  state.
2849  *
2850  *  \param[out] ssid A pointer to the ssid.
2851  *
2852  *  \return WM_SUCCESS if successful.
2853  *  \return -WM_E_INVAL if \a network is NULL.
2854  *  \return WLAN_ERROR_STATE if the WLAN Connection Manager was
2855  *          not running or not in the \ref WLAN_CONNECTED state.
2856  */
2857 int wlan_get_current_network_ssid(char *ssid);
2858 
2859 /** Retrieve the current network bssid of station interface.
2860  *
2861  *  This function retrieves the current network bssid of station
2862  *  interface when the station interface is in the \ref WLAN_CONNECTED
2863  *  state.
2864  *
2865  *  \param[out] bssid A pointer to the bssid.
2866  *
2867  *  \return WM_SUCCESS if successful.
2868  *  \return -WM_E_INVAL if \a network is NULL.
2869  *  \return WLAN_ERROR_STATE if the WLAN Connection Manager was
2870  *          not running or not in the \ref WLAN_CONNECTED state.
2871  */
2872 int wlan_get_current_network_bssid(char *bssid);
2873 
2874 /** Retrieve the current network configuration of micro-AP interface.
2875  *
2876  *  This function retrieves the current network configuration of micro-AP
2877  *  interface when the micro-AP interface is in the \ref WLAN_UAP_STARTED state.
2878  *
2879  *  \param[out] network A pointer to the \ref wlan_network.
2880  *
2881  *  \return WM_SUCCESS if successful.
2882  *  \return -WM_E_INVAL if \a network is NULL.
2883  *  \return WLAN_ERROR_STATE if the WLAN Connection Manager was
2884  *           not running or not in the \ref WLAN_UAP_STARTED state.
2885  */
2886 int wlan_get_current_uap_network(struct wlan_network *network);
2887 
2888 /** Retrieve the current network ssid of micro-AP interface.
2889  *
2890  *  This function retrieves the current network ssid of micro-AP
2891  *  interface when the micro-AP interface is in the \ref WLAN_UAP_STARTED state.
2892  *
2893  *  \param[out] ssid A pointer to the ssid.
2894  *
2895  *  \return WM_SUCCESS if successful.
2896  *  \return -WM_E_INVAL if \a network is NULL.
2897  *  \return WLAN_ERROR_STATE if the WLAN Connection Manager was
2898  *           not running or not in the \ref WLAN_UAP_STARTED state.
2899  */
2900 int wlan_get_current_uap_network_ssid(char *ssid);
2901 
2902 #if CONFIG_SCAN_WITH_RSSIFILTER
2903 int wlan_set_rssi_threshold(int rssithr);
2904 #endif
2905 
2906 /** Retrieve the status information of the micro-AP interface.
2907  *
2908  *  \return TRUE if micro-AP interface is in \ref WLAN_UAP_STARTED state.
2909  *  \return FALSE otherwise.
2910  */
2911 bool is_uap_started(void);
2912 
2913 /** Retrieve the status information of the station interface.
2914  *
2915  *  \return TRUE if station interface is in \ref WLAN_CONNECTED state.
2916  *  \return FALSE otherwise.
2917  */
2918 bool is_sta_connected(void);
2919 
2920 /** Retrieve the status information of the ipv4 network of station interface.
2921  *
2922  *  \return TRUE if ipv4 network of station interface is in \ref WLAN_CONNECTED
2923  *  state.
2924  *  \return FALSE otherwise.
2925  */
2926 bool is_sta_ipv4_connected(void);
2927 
2928 #if CONFIG_IPV6
2929 /** Retrieve the status information of the ipv6 network of station interface.
2930  *
2931  *  \return TRUE if ipv6 network of station interface is in \ref WLAN_CONNECTED
2932  *  state.
2933  *  \return FALSE otherwise.
2934  */
2935 bool is_sta_ipv6_connected(void);
2936 #endif
2937 
2938 /** Retrieve the information about a known network using \a index.
2939  *
2940  *  This function retrieves the contents of a network at \a index in the
2941  *  list of known networks maintained by the WLAN Connection Manager and
2942  *  copies it to the location pointed to by \a network.
2943  *
2944  *  \note \ref wlan_get_network_count() may be used to retrieve the number
2945  *  of known networks. \ref wlan_get_network() may be used to retrieve
2946  *  information about networks at \a index 0 to one minus the number of networks.
2947  *
2948  *  \note This function may be called regardless of whether the WLAN Connection
2949  *  Manager is running. Calls to this function are synchronous.
2950  *
2951  *  \param[in] index The index of the network to retrieve.
2952  *  \param[out] network A pointer to the \ref wlan_network where the network
2953  *              configuration for the network at \a index will be copied.
2954  *
2955  *  \returns WM_SUCCESS if successful.
2956  *  \return -WM_E_INVAL if \a network is NULL or \a index is out of range.
2957  */
2958 int wlan_get_network(unsigned int index, struct wlan_network *network);
2959 
2960 /** Retrieve information about a known network using \a name.
2961  *
2962  *  This function retrieves the contents of a named network in the
2963  *  list of known networks maintained by the WLAN Connection Manager and
2964  *  copies it to the location pointed to by \a network.
2965  *
2966  *  \note This function may be called regardless of whether the WLAN Connection
2967  *  Manager is running. Calls to this function are synchronous.
2968  *
2969  *  \param[in] name The name of the network to retrieve.
2970  *  \param[out] network A pointer to the \ref wlan_network where the network
2971  *              configuration for the network having name as \a name will be copied.
2972  *
2973  *  \return WM_SUCCESS if successful.
2974  *  \return -WM_E_INVAL if \a network is NULL or \a name is NULL.
2975  */
2976 int wlan_get_network_byname(char *name, struct wlan_network *network);
2977 
2978 /** Retrieve the number of networks known to the WLAN Connection Manager.
2979  *
2980  *  This function retrieves the number of known networks in the list maintained
2981  *  by the WLAN Connection Manager and copies it to \a count.
2982  *
2983  *  \note This function may be called regardless of whether the WLAN Connection
2984  *  Manager is running. Calls to this function are synchronous.
2985  *
2986  *  \param[out] count A pointer to the memory location where the number of
2987  *              networks will be copied.
2988  *
2989  *  \return WM_SUCCESS if successful.
2990  *  \return -WM_E_INVAL if \a count is NULL.
2991  */
2992 int wlan_get_network_count(unsigned int *count);
2993 
2994 /** Retrieve the connection state of station interface.
2995  *
2996  *  This function retrieves the connection state of station interface, which is
2997  *  one of \ref WLAN_DISCONNECTED, \ref WLAN_CONNECTING, \ref WLAN_ASSOCIATED
2998  *  or \ref WLAN_CONNECTED.
2999  *
3000  *  \param[out] state A pointer to the \ref wlan_connection_state where the
3001  *         current connection state will be copied.
3002  *
3003  *  \return WM_SUCCESS if successful.
3004  *  \return -WM_E_INVAL if \a state is NULL
3005  *  \return WLAN_ERROR_STATE if the WLAN Connection Manager was not running.
3006  */
3007 int wlan_get_connection_state(enum wlan_connection_state *state);
3008 
3009 /** Retrieve the connection state of micro-AP interface.
3010  *
3011  *  This function retrieves the connection state of micro-AP interface, which is
3012  *  one of \ref WLAN_UAP_STARTED, or \ref WLAN_UAP_STOPPED.
3013  *
3014  *  \param[out] state A pointer to the \ref wlan_connection_state where the
3015  *         current connection state will be copied.
3016  *
3017  *  \return WM_SUCCESS if successful.
3018  *  \return -WM_E_INVAL if \a state is NULL
3019  *  \return WLAN_ERROR_STATE if the WLAN Connection Manager was not running.
3020  */
3021 int wlan_get_uap_connection_state(enum wlan_connection_state *state);
3022 
3023 /** Scan for wireless networks.
3024  *
3025  *  When this function is called, the WLAN Connection Manager starts scan
3026  *  for wireless networks. On completion of the scan the WLAN Connection Manager
3027  *  will call the specified callback function \a cb. The callback function can then
3028  *  retrieve the scan results by using the \ref wlan_get_scan_result() function.
3029  *
3030  *  \note This function may only be called when the station interface is in the
3031  *  \ref WLAN_DISCONNECTED or \ref WLAN_CONNECTED state. Scanning is disabled
3032  *  in the \ref WLAN_CONNECTING state.
3033  *
3034  *  \note This function will block until it can issue a scan request if called
3035  *  while another scan is in progress.
3036  *
3037  *  \param[in] cb A pointer to the function that will be called to handle scan
3038  *         results when they are available.
3039  *
3040  *  \return WM_SUCCESS if successful.
3041  *  \return -WM_E_NOMEM if failed to allocated memory for \ref
3042  *	     wlan_scan_params_v2_t structure.
3043  *  \return -WM_E_INVAL if \a cb scan result callack functio pointer is NULL.
3044  *  \return WLAN_ERROR_STATE if the WLAN Connection Manager was
3045  *           not running or not in the \ref WLAN_DISCONNECTED or \ref
3046  *           WLAN_CONNECTED states.
3047  *  \return -WM_FAIL if an internal error has occurred and
3048  *           the system is unable to scan.
3049  */
3050 int wlan_scan(int (*cb)(unsigned int count));
3051 
3052 /** Scan for wireless networks using options provided.
3053  *
3054  *  When this function is called, the WLAN Connection Manager starts scan
3055  *  for wireless networks. On completion of the scan the WLAN Connection Manager
3056  *  will call the specified callback function \a cb. The callback function
3057  *  can then retrieve the scan results by using the \ref wlan_get_scan_result()
3058  *  function.
3059  *
3060  *  \note This function may only be called when the station interface is in the
3061  *  \ref WLAN_DISCONNECTED or \ref WLAN_CONNECTED state. Scanning is disabled
3062  *  in the \ref WLAN_CONNECTING state.
3063  *
3064  *  \note This function will block until it can issue a scan request if called
3065  *  while another scan is in progress.
3066  *
3067  *  \param[in] t_wlan_scan_param  A \ref wlan_scan_params_v2_t structure holding
3068  *	       a pointer to function that will be called
3069  *	       to handle scan results when they are available,
3070  *	       SSID of a wireless network, BSSID of a wireless network,
3071  *	       number of channels with scan type information and number of
3072  *	       probes.
3073  *
3074  *  \return WM_SUCCESS if successful.
3075  *  \return -WM_E_NOMEM if failed to allocated memory for \ref
3076  *	     wlan_scan_params_v2_t structure.
3077  *  \return -WM_E_INVAL if \a cb scan result callack function pointer is NULL.
3078  *  \return WLAN_ERROR_STATE if the WLAN Connection Manager was
3079  *           not running or not in the \ref WLAN_DISCONNECTED or \ref
3080  *           WLAN_CONNECTED states.
3081  *  \return -WM_FAIL if an internal error has occurred and
3082  *           the system is unable to scan.
3083  */
3084 int wlan_scan_with_opt(wlan_scan_params_v2_t t_wlan_scan_param);
3085 
3086 /** Retrieve a scan result.
3087  *
3088  *  This function may be called to retrieve scan results when the WLAN
3089  *  Connection Manager has finished scanning. It must be called from within the
3090  *  scan result callback (see \ref wlan_scan()) as scan results are valid
3091  *  only in that context. The callback argument 'count' provides the number
3092  *  of scan results that may be retrieved and \ref wlan_get_scan_result() may
3093  *  be used to retrieve scan results at \a index 0 through that number.
3094  *
3095  *  \note This function may only be called in the context of the scan results
3096  *  callback.
3097  *
3098  *  \note Calls to this function are synchronous.
3099  *
3100  *  \param[in] index The scan result to retrieve.
3101  *  \param[out] res A pointer to the \ref wlan_scan_result where the scan
3102  *              result information will be copied.
3103  *
3104  *  \return WM_SUCCESS if successful.
3105  *  \return -WM_E_INVAL if \a res is NULL
3106  *  \return WLAN_ERROR_STATE if the WLAN Connection Manager
3107  *          was not running
3108  *  \return -WM_FAIL if the scan result at \a
3109  *          index could not be retrieved (that is, \a index
3110  *          is out of range).
3111  */
3112 int wlan_get_scan_result(unsigned int index, struct wlan_scan_result *res);
3113 
3114 #ifdef WLAN_LOW_POWER_ENABLE
3115 /**
3116  * Enable Low Power Mode in Wireless Firmware.
3117  *
3118  * \note When low power mode is enabled, the output power will be clipped at
3119  * ~+10dBm and the expected PA current is expected to be in the 80-90 mA
3120  * range for b/g/n modes.
3121  *
3122  * This function may be called to enable low power mode in firmware.
3123  * This should be called before \ref wlan_init() function.
3124  *
3125  * \return WM_SUCCESS if the call was successful.
3126  * \return -WM_FAIL if failed.
3127  *
3128  */
3129 int wlan_enable_low_pwr_mode();
3130 #endif
3131 
3132 /**
3133  * Configure ED MAC mode for Station in Wireless Firmware.
3134  *
3135  * \note When ed mac mode is enabled,
3136  * Wireless Firmware will behave following way:
3137  *
3138  * when background noise had reached -70dB or above,
3139  * WiFi chipset/module should hold data transmitting
3140  * until condition is removed.
3141  * It is applicable for both 5GHz and 2.4GHz bands.
3142  *
3143  * \param[in] wlan_ed_mac_ctrl  Struct with following parameters
3144  *	 ed_ctrl_2g	     0  - disable EU adaptivity for 2.4GHz band
3145  *                           1  - enable EU adaptivity for 2.4GHz band
3146  *
3147  *       ed_offset_2g        0  - Default Energy Detect threshold (Default: 0x9)
3148  *                           offset value range: 0x80 to 0x7F
3149  *
3150  * \note If 5GH enabled then add following parameters
3151  *
3152  *       ed_ctrl_5g          0  - disable EU adaptivity for 5GHz band
3153  *                           1  - enable EU adaptivity for 5GHz band
3154  *
3155  *       ed_offset_5g        0  - Default Energy Detect threshold(Default: 0xC)
3156  *                           offset value range: 0x80 to 0x7F
3157  *
3158  * \return WM_SUCCESS if the call was successful.
3159  * \return -WM_FAIL if failed.
3160  *
3161  */
3162 int wlan_set_ed_mac_mode(wlan_ed_mac_ctrl_t wlan_ed_mac_ctrl);
3163 
3164 /**
3165  * Configure ED MAC mode for Micro AP in Wireless Firmware.
3166  *
3167  * \note When ed mac mode is enabled,
3168  * Wireless Firmware will behave following way:
3169  *
3170  * when background noise had reached -70dB or above,
3171  * WiFi chipset/module should hold data transmitting
3172  * until condition is removed.
3173  * It is applicable for both 5GHz and 2.4GHz bands.
3174  *
3175  * \param[in] wlan_ed_mac_ctrl  Struct with following parameters
3176  *	 ed_ctrl_2g	     0  - disable EU adaptivity for 2.4GHz band
3177  *                           1  - enable EU adaptivity for 2.4GHz band
3178  *
3179  *       ed_offset_2g        0  - Default Energy Detect threshold (Default: 0x9)
3180  *                           offset value range: 0x80 to 0x7F
3181  *
3182  * \note If 5GH enabled then add following parameters
3183  *
3184  *       ed_ctrl_5g          0  - disable EU adaptivity for 5GHz band
3185  *                           1  - enable EU adaptivity for 5GHz band
3186  *
3187  *       ed_offset_5g        0  - Default Energy Detect threshold(Default: 0xC)
3188  *                           offset value range: 0x80 to 0x7F
3189  *
3190  * \return WM_SUCCESS if the call was successful.
3191  * \return -WM_FAIL if failed.
3192  *
3193  */
3194 int wlan_set_uap_ed_mac_mode(wlan_ed_mac_ctrl_t wlan_ed_mac_ctrl);
3195 
3196 /**
3197  * This API can be used to get current ED MAC MODE configuration for Station.
3198  *
3199  * \param[out] wlan_ed_mac_ctrl A pointer to \ref wlan_ed_mac_ctrl_t
3200  * 			with parameters mentioned in above set API.
3201  *
3202  * \return WM_SUCCESS if the call was successful.
3203  * \return -WM_FAIL if failed.
3204  *
3205  */
3206 int wlan_get_ed_mac_mode(wlan_ed_mac_ctrl_t *wlan_ed_mac_ctrl);
3207 
3208 /**
3209  * This API can be used to get current ED MAC MODE configuration for Micro AP.
3210  *
3211  * \param[out] wlan_ed_mac_ctrl A pointer to \ref wlan_ed_mac_ctrl_t
3212  * 			with parameters mentioned in above set API.
3213  *
3214  * \return WM_SUCCESS if the call was successful.
3215  * \return -WM_FAIL if failed.
3216  *
3217  */
3218 int wlan_get_uap_ed_mac_mode(wlan_ed_mac_ctrl_t *wlan_ed_mac_ctrl);
3219 
3220 /** Set wireless calibration data in WLAN firmware.
3221  *
3222  * This function may be called to set wireless calibration data in firmware.
3223  * This should be call before \ref wlan_init() function.
3224  *
3225  * \param[in] cal_data The calibration data buffer
3226  * \param[in] cal_data_size Size of calibration data buffer.
3227  *
3228  */
3229 void wlan_set_cal_data(const uint8_t *cal_data, const unsigned int cal_data_size);
3230 
3231 /** Set wireless MAC Address in WLAN firmware.
3232  *
3233  * This function may be called to set wireless MAC Address in firmware.
3234  * This should be call before \ref wlan_init() function.
3235  * When called after wlan init done, the incoming mac is treated as the sta mac address directly. And mac[4] plus 1 the
3236  * modifed mac as the UAP mac address.
3237  *
3238  * \param[in] mac The MAC Address in 6 byte array format like
3239  *                uint8_t mac[] = { 0x00, 0x50, 0x43, 0x21, 0x19, 0x6E};
3240  *
3241  * \return WM_SUCCESS if the call was successful.
3242  * \return -WM_FAIL if failed.
3243  */
3244 int wlan_set_mac_addr(uint8_t *mac);
3245 
3246 /** Set wireless MAC Address for STA in WLAN firmware.
3247  *
3248  * This function may be called to set wireless MAC Address in firmware.
3249  * This should be call before \ref wlan_init() function.
3250  * When called after wlan init done, it will set only STA MAC adderess.
3251  *
3252  * \param[in] mac The MAC Address in 6 byte array format like
3253  *                uint8_t mac[] = { 0x00, 0x50, 0x43, 0x21, 0x19, 0x6E};
3254  *
3255  * \return WM_SUCCESS if the call was successful.
3256  * \return -WM_FAIL if failed.
3257  */
3258 int wlan_set_sta_mac_addr(uint8_t *mac);
3259 
3260 /** Set wireless MAC Address for uAP in WLAN firmware.
3261  *
3262  * This function may be called to set wireless MAC Address in firmware.
3263  * This should be call before \ref wlan_init() function.
3264  * When called after wlan init done, it will set only uAP MAC address.
3265  *
3266  * \param[in] mac The MAC Address in 6 byte array format like
3267  *                uint8_t mac[] = { 0x00, 0x50, 0x43, 0x21, 0x19, 0x6E};
3268  *
3269  * \return WM_SUCCESS if the call was successful.
3270  * \return -WM_FAIL if failed.
3271  */
3272 int wlan_set_uap_mac_addr(uint8_t *mac);
3273 
3274 #if CONFIG_WMM_UAPSD
3275 /** Set QOS info in WLAN firmware.
3276  *
3277  * \param[in] qos_info UAPSD QOS info.
3278  * \param[in] action Set/get action.
3279  *
3280  * \return WM_SUCCESS if the call was successful.
3281  * \return -WM_FAIL if failed.
3282  */
3283 int wlan_wmm_uapsd_qosinfo(t_u8 *qos_info, t_u8 action);
3284 /** Enable/disable UAPSD in WLAN firmware.
3285  *
3286  * \param[in] uapsd_enable Enable/disable UAPSD.
3287  *
3288  * \return WM_SUCCESS if the call was successful.
3289  * \return -WM_FAIL if failed.
3290  */
3291 int wlan_set_wmm_uapsd(t_u8 uapsd_enable);
3292 /** Set/get UAPSD sleep period in WLAN firmware.
3293  *
3294  * \param[in] sleep_period UAPSD sleep period.
3295  * \param[in] action Set/get action.
3296  *
3297  * \return WM_SUCCESS if the call was successful.
3298  * \return -WM_FAIL if failed.
3299  */
3300 int wlan_sleep_period(unsigned int *sleep_period, t_u8 action);
3301 /** Check if UAPSD is enabled or not.
3302  *
3303  * \return true if UAPSD is enabled.
3304  * \return false if UAPSD is disabled.
3305  */
3306 t_u8 wlan_is_wmm_uapsd_enabled(void);
3307 #endif
3308 
3309 #if CONFIG_WIFI_TX_BUFF
3310 /** Reconfigure wifi tx buffer size in WLAN firmware.
3311  *
3312  * This function may be called to reconfigure wifi tx buffer size in firmware.
3313  * This should be call before \ref wlan_init() function.
3314  *
3315  * \param[in] buf_size The new buffer size
3316  *
3317  * \param[in] bss_type 0: STA, 1: uAP
3318  *
3319  */
3320 void wlan_recfg_tx_buf_size(uint16_t buf_size, mlan_bss_type bss_type);
3321 #endif
3322 
3323 #if CONFIG_WIFI_TX_PER_TRACK
3324 /** Set Tx PER tracking config.
3325  * This function may be called to set Tx PER tracking in firmware.
3326  *
3327  * \param[in] tx_pert User configured parameters of Tx PER tracking
3328  *            period, ratio and number of tx packets.
3329  *
3330  * \param[in] bss_type BSS type for STA or uAP.
3331  *
3332  * \return WM_SUCCESS if the call was successful.
3333  * \return -WM_FAIL if failed.
3334  */
3335 void wlan_set_tx_pert(struct wlan_tx_pert_info *tx_pert, mlan_bss_type bss_type);
3336 #endif
3337 
3338 #if CONFIG_TX_RX_HISTOGRAM
3339 /** Set Tx Rx histogram config.
3340  * This function may be called to set Tx Rx histogram config.
3341  *
3342  * \param[in] txrx_histogram User configured parameters of Tx Rx histogram
3343  *            including enable and action.
3344  * \param[out] data Tx Rx histogram data from fw.
3345  */
3346 void wlan_set_txrx_histogram(struct wlan_txrx_histogram_info *txrx_histogram, t_u8 *data);
3347 #endif
3348 
3349 #if CONFIG_ROAMING
3350 /** Set soft roaming config.
3351  *
3352  * This function may be called to enable/disable soft roaming
3353  * by specifying the RSSI threshold.
3354  *
3355  * \note <b>RSSI Threshold setting for soft roaming</b>:
3356  * The provided RSSI low threshold value is used to subscribe
3357  * RSSI low event from firmware, on reception of this event
3358  * background scan is started in firmware with same RSSI
3359  * threshold to find out APs with better signal strength than
3360  * RSSI threshold.
3361  *
3362  * If AP is found then roam attempt is initiated, otherwise
3363  * background scan started again till limit reaches to
3364  * BG_SCAN_LIMIT.
3365  *
3366  * If still AP is not found then WLAN connection manager sends
3367  * \ref WLAN_REASON_BGSCAN_NETWORK_NOT_FOUND event to
3368  * application. In this case,
3369  * if application again wants to use soft roaming then it
3370  * can call this API again or use
3371  * \ref wlan_set_rssi_low_threshold API to set RSSI low
3372  * threshold again.
3373  *
3374  * \param[in] enable Enable/disable roaming.
3375  * \param[in] rssi_low_threshold RSSI low threshold value
3376  *
3377  * \return WM_SUCCESS if the call was successful.
3378  * \return -WM_FAIL if failed.
3379  */
3380 int wlan_set_roaming(const int enable, const uint8_t rssi_low_threshold);
3381 
3382 int wlan_get_roaming_status();
3383 
3384 /** Subscribe RSSI LOW event in firmware if roaming is enabled.
3385  */
3386 void wlan_subscribe_rssi_low_event();
3387 #endif
3388 
3389 #if CONFIG_HOST_SLEEP
3390 #ifdef RW610
3391 #if CONFIG_MEF_CFG
3392 /** Wowlan configure.
3393  * This function may be called to config host sleep in firmware.
3394  *
3395  * \param[in] is_mef Flag to indicate use MEF condition or not.
3396  * \param[in] wake_up_conds Bit map of default condition.
3397  *
3398  * \return WM_SUCCESS if the call was successful.
3399  * \return -WM_FAIL if failed.
3400  */
3401 int wlan_wowlan_config(uint8_t is_mef, t_u32 wake_up_conds);
3402 #else
3403 /** Wowlan configure.
3404  * This function may be called to config host sleep in firmware.
3405  *
3406  * \param[in] wake_up_conds Bit map of default condition.
3407  *
3408  * \return WM_SUCCESS if the call was successful.
3409  * \return -WM_FAIL if failed.
3410  */
3411 int wlan_wowlan_config(t_u32 wake_up_conds);
3412 #endif
3413 
3414 /** Host sleep configure.
3415  * This function may be called to config host sleep in firmware.
3416  *
3417  * \param[in] is_manual Flag to indicate host enter low power mode with power manager or by command.
3418  * \param[in] is_periodic Flag to indicate host enter low power periodically or once with power manager.
3419  */
3420 void wlan_config_host_sleep(bool is_manual, t_u8 is_periodic);
3421 
3422 /** This function sent host sleep events to mon_thread
3423  * \param[in] id Event ID.
3424  * \param[in] data Pointer to event msg.
3425  */
3426 status_t wlan_hs_send_event(int id, void *data);
3427 #endif /*RW610*/
3428 
3429 /** Cancel host sleep.
3430  * This function may be called to cancel host sleep in firmware.
3431  */
3432 void wlan_cancel_host_sleep();
3433 
3434 /** Clear host sleep configurations in driver.
3435  * This function clears all the host sleep related configures in driver.
3436  */
3437 void wlan_clear_host_sleep_config();
3438 
3439 /** This function set multicast MEF entry
3440  *
3441  * \param[in] mef_action To be 0--discard and not wake host, 1--discard and wake host 3--allow and wake host.
3442  * \return WM_SUCCESS if the call was successful.
3443  * \return -WM_FAIL if failed.
3444  */
3445 int wlan_set_multicast(t_u8 mef_action);
3446 #endif
3447 
3448 /** Set configuration parameters of IEEE power save mode.
3449  *
3450  * \param [in] ps_cfg : powersave configuratiuon includes multiple parameters.
3451  * \return WM_SUCCESS if the call was successful.
3452  * \return -WM_FAIL if failed.
3453  */
3454 int wlan_set_ieeeps_cfg(struct wlan_ieeeps_config *ps_cfg);
3455 
3456 /** Set configuration parameters of IEEE power save mode.
3457  *
3458  * \param [in] ps_cfg : powersave configuratiuon includes multiple parameters.
3459  * \return WM_SUCCESS if the call was successful.
3460  * \return -WM_FAIL if failed.
3461  */
3462 int wlan_set_ieeeps_cfg(struct wlan_ieeeps_config *ps_cfg);
3463 
3464 /** Configure Listen interval of IEEE power save mode.
3465  *
3466  * \note <b>Delivery Traffic Indication Message (DTIM)</b>:
3467  * It is a concept in 802.11
3468  * It is a time duration after which AP will send out buffered
3469  * BROADCAST / MULTICAST data and stations connected to the AP
3470  * should wakeup to take this broadcast / multicast data.
3471 
3472  * \note <b>Traffic Indication Map (TIM)</b>:
3473  * It is a bitmap which the AP sends with each beacon.
3474  * The bitmap has one bit each for a station connected to AP.
3475  *
3476  * \note Each station is recognized by an Association Id (AID).
3477  * If AID is say 1 bit number 1 is set in the bitmap if
3478  * unicast data is present with AP in its buffer for station with AID = 1
3479  * Ideally AP does not buffer any unicast data it just sends
3480  * unicast data to the station on every beacon when station
3481  * is not sleeping.\n
3482  * When broadcast data / multicast data is to be send AP sets bit 0
3483  * of TIM indicating broadcast / multicast.\n
3484  * The occurrence of DTIM is defined by AP.\n
3485  * Each beacon has a number indicating period at which DTIM occurs.\n
3486  * The number is expressed in terms of number of beacons.\n
3487  * This period is called DTIM Period / DTIM interval.\n
3488  * For example:\n
3489  *     If AP has DTIM period = 3 the stations connected to AP
3490  *     have to wake up (if they are sleeping) to receive
3491  *     broadcast /multicast data on every third beacon.\n
3492  * Generic:\n
3493  *     When DTIM period is X
3494  *     AP buffers broadcast data / multicast data for X beacons.
3495  *     Then it transmits the data no matter whether station is awake or not.\n
3496  * Listen interval:\n
3497  * This is time interval on station side which indicates when station
3498  * will be awake to listen i.e. accept data.\n
3499  * Long listen interval:\n
3500  * It comes into picture when station sleeps (IEEEPS) and it does
3501  * not want to wake up on every DTIM
3502  * So station is not worried about broadcast data/multicast data
3503  * in this case.\n
3504  * This should be a design decision what should be chosen
3505  * Firmware suggests values which are about 3 times DTIM
3506  * at the max to gain optimal usage and reliability.\n
3507  * In the IEEEPS power save mode, the WiFi firmware goes to sleep and
3508  * periodically wakes up to check if the AP has any pending packets for it. A
3509  * longer listen interval implies that the WiFi card stays in power save for a
3510  * longer duration at the cost of additional delays while receiving data.
3511  * Please note that choosing incorrect value for listen interval will
3512  * causes poor response from device during data transfer.
3513  * Actual listen interval selected by firmware is equal to closest DTIM.\n
3514  * For e.g.:-\n
3515  *            AP beacon period : 100 ms\n
3516  *            AP DTIM period : 2\n
3517  *            Application request value: 500ms\n
3518  *            Actual listen interval = 400ms (This is the closest DTIM).
3519  * Actual listen interval set will be a multiple of DTIM closest to but
3520  * lower than the value provided by the application.\n
3521  *
3522  *  \note This API can be called before/after association.
3523  *  The configured listen interval will be used in subsequent association
3524  *  attempt.
3525  *
3526  *  \param [in]  listen_interval Listen interval as below\n
3527  *               0 : Unchanged,\n
3528  *              -1 : Disable,\n
3529  *             1-49: Value in beacon intervals,\n
3530  *            >= 50: Value in TUs\n
3531  */
3532 void wlan_configure_listen_interval(int listen_interval);
3533 
3534 void wlan_configure_delay_to_ps(unsigned int timeout_ms);
3535 
3536 unsigned short wlan_get_listen_interval();
3537 
3538 unsigned int wlan_get_delay_to_ps();
3539 
3540 bool wlan_is_power_save_enabled();
3541 
3542 /** Configure Null packet interval of IEEE power save mode.
3543  *
3544  *  \note In IEEEPS station sends a NULL packet to AP to indicate that
3545  *  the station is alive and AP should not kick it off.
3546  *  If null packet is not send some APs may disconnect station
3547  *  which might lead to a loss of connectivity.
3548  *  The time is specified in seconds.
3549  *  Default value is 30 seconds.
3550  *
3551  *  \note This API should be called before configuring IEEEPS
3552  *
3553  *  \param [in] time_in_secs : -1 Disables null packet transmission,
3554  *                              0  Null packet interval is unchanged,
3555  *                              n  Null packet interval in seconds.
3556  */
3557 void wlan_configure_null_pkt_interval(int time_in_secs);
3558 
3559 #ifdef STREAM_2X2
3560 /** This function sets current antenna.
3561  *
3562  * \param[in] ant Antenna
3563  *            Valid values are 1, 2 and 65535.
3564  *            1: Set Antenna 1,
3565  *            2: Set Antenna 2,
3566  *        65535: Set Antenna diversity.
3567  *
3568  * \return WM_SUCCESS if successful.
3569  * \return WLAN_ERROR_STATE if unsuccessful.
3570  */
3571 int wlan_set_current_ant(uint8_t tx_antenna, uint8_t rx_antenna);
3572 #else
3573 #ifndef RW610
3574 /** This API can be used to set the mode of Tx/Rx antenna.
3575  * If SAD is enabled, this API can also used to set SAD antenna
3576  * evaluate time interval(antenna mode must be antenna diversity
3577  * when set SAD evaluate time interval).
3578  *
3579  * \param[in] ant Antenna valid values are 1, 2 and 65535
3580  *                1 : Tx/Rx antenna 1
3581  *                2 : Tx/Rx antenna 2
3582  *	          0xFFFF: Tx/Rx antenna diversity
3583  * \param[in] evaluate_time
3584  *	      SAD evaluate time interval, default value is 6s(0x1770).
3585  *
3586  * \return WM_SUCCESS if successful.
3587  * \return WLAN_ERROR_STATE if unsuccessful.
3588  *
3589  */
3590 int wlan_set_antcfg(uint32_t ant, uint16_t evaluate_time);
3591 
3592 /** This API can be used to get the mode of Tx/Rx antenna.
3593  * If SAD is enabled, this API can also used to get SAD antenna
3594  * evaluate time interval(antenna mode must be antenna diversity
3595  * when set SAD evaluate time interval).
3596  *
3597  * \param[out] ant pointer to antenna variable.
3598  * \param[out] evaluate_time pointer to evaluate_time variable for SAD.
3599  * \param[out] current_antenna pointer to current antenna.
3600  *
3601  * \return WM_SUCCESS if successful.
3602  * \return WLAN_ERROR_STATE if unsuccessful.
3603  */
3604 int wlan_get_antcfg(uint32_t *ant, uint16_t *evaluate_time, uint16_t *current_antenna);
3605 #else
3606 /** This API can be used to set the mode of Tx/Rx antenna.
3607  * If SAD is enabled, this API can also used to set SAD antenna
3608  * evaluate time interval(antenna mode must be antenna diversity
3609  * when set SAD evaluate time interval).
3610  *
3611  * \param[in] ant Antenna valid values are 1, 2 and 65535
3612  *                1 : Tx/Rx antenna 1
3613  *                2 : Tx/Rx antenna 2
3614  *	          0xFFFF: Tx/Rx antenna diversity
3615  * \param[in] evaluate_time
3616  *	      SAD evaluate time interval, default value is 6s(0x1770).
3617  *  \param[in] evaluate_mode
3618  *	            0: PCB Ant  + Ext Ant0
3619  *              1: Ext Ant0 + Ext Ant1
3620  *              2: PCB Ant  + Ext Ant1
3621  *           0xFF: Default divisity mode.
3622  *
3623  * \return WM_SUCCESS if successful.
3624  * \return WLAN_ERROR_STATE if unsuccessful.
3625  *
3626  */
3627 int wlan_set_antcfg(uint32_t ant, uint16_t evaluate_time, uint8_t evaluate_mode);
3628 
3629 /** This API can be used to get the mode of Tx/Rx antenna.
3630  * If SAD is enabled, this API can also used to get SAD antenna
3631  * evaluate time interval(antenna mode must be antenna diversity
3632  * when set SAD evaluate time interval).
3633  *
3634  * \param[out] ant pointer to antenna variable.
3635  * \param[out] evaluate_time pointer to evaluate_time variable for SAD.
3636  * \param[out] current_mode pointer to evaluate_mode.
3637  * \param[out] current_antenna pointer to current antenna.
3638  *
3639  * \return WM_SUCCESS if successful.
3640  * \return WLAN_ERROR_STATE if unsuccessful.
3641  */
3642 int wlan_get_antcfg(uint32_t *ant, uint16_t *evaluate_time, uint8_t *evaluate_mode, uint16_t *current_antenna);
3643 #endif /*RW610*/
3644 #endif
3645 
3646 /** Get the wifi firmware version extension string.
3647  *
3648  * \note This API does not allocate memory for pointer.
3649  *       It just returns pointer of WLCMGR internal static
3650  *       buffer. So no need to free the pointer by caller.
3651  *
3652  * \return wifi firmware version extension string pointer stored in
3653  *         WLCMGR
3654  */
3655 char *wlan_get_firmware_version_ext(void);
3656 
3657 /** Use this API to print wlan driver and firmware extended version.
3658  */
3659 void wlan_version_extended(void);
3660 
3661 /**
3662  * Use this API to get the TSF from Wi-Fi firmware.
3663  *
3664  * \param[in] tsf_high Pointer to store TSF higher 32bits.
3665  * \param[in] tsf_low Pointer to store TSF lower 32bits.
3666  *
3667  * \return WM_SUCCESS if operation is successful.
3668  * \return -WM_FAIL if command fails.
3669  *
3670  */
3671 int wlan_get_tsf(uint32_t *tsf_high, uint32_t *tsf_low);
3672 
3673 /** Enable IEEEPS with Host Sleep Configuration
3674  *
3675  * When enabled, it opportunistically puts the wireless card into IEEEPS mode.
3676  * Before putting the Wireless card in power
3677  * save this also sets the hostsleep configuration on the card as
3678  * specified. This makes the card generate a wakeup for the processor if
3679  * any of the wakeup conditions are met.
3680  *
3681  * \param[in] wakeup_conditions conditions to wake the host. This should
3682  *            be a logical OR of the conditions in \ref wlan_wakeup_event_t.
3683  *            Typically devices would want to wake up on
3684  *            \ref WAKE_ON_ALL_BROADCAST,
3685  *            \ref WAKE_ON_UNICAST,
3686  *            \ref WAKE_ON_MAC_EVENT.
3687  *            \ref WAKE_ON_MULTICAST,
3688  *            \ref WAKE_ON_ARP_BROADCAST,
3689  *            \ref WAKE_ON_MGMT_FRAME
3690  *
3691  * \return WM_SUCCESS if the call was successful.
3692  * \return -WM_FAIL otherwise.
3693  *
3694  */
3695 int wlan_ieeeps_on(unsigned int wakeup_conditions);
3696 
3697 /** Turn off IEEE Power Save mode.
3698  *
3699  * \note This call is asynchronous. The system will exit the power-save mode
3700  *       only when all requisite conditions are met.
3701  *
3702  * \return WM_SUCCESS if the call was successful.
3703  * \return -WM_FAIL otherwise.
3704  *
3705  */
3706 int wlan_ieeeps_off(void);
3707 
3708 #if (CONFIG_WNM_PS)
3709 /** Enable WNM with Host Sleep Configuration
3710  *
3711  * When enabled, it opportunistically puts the wireless card into IEEEPS mode.
3712  * Before putting the Wireless card in power
3713  * save this also sets the hostsleep configuration on the card as
3714  * specified. This makes the card generate a wakeup for the processor if
3715  * any of the wakeup conditions are met.
3716  *
3717  * \param[in] wakeup_conditions conditions to wake the host. This should
3718  *            be a logical OR of the conditions in \ref wlan_wakeup_event_t.
3719  *            Typically devices would want to wake up on
3720  *            \ref WAKE_ON_ALL_BROADCAST,
3721  *            \ref WAKE_ON_UNICAST,
3722  *            \ref WAKE_ON_MAC_EVENT.
3723  *            \ref WAKE_ON_MULTICAST,
3724  *            \ref WAKE_ON_ARP_BROADCAST,
3725  *            \ref WAKE_ON_MGMT_FRAME
3726  * \param[in] wnm_sleep_time wnm sleep interval.(number of dtims)
3727  *
3728  * \return WM_SUCCESS if the call was successful.
3729  * \return -WM_FAIL otherwise.
3730  *
3731  */
3732 int wlan_wnmps_on(unsigned int wakeup_conditions, t_u16 wnm_sleep_time);
3733 
3734 /** Turn off WNM Power Save mode.
3735  *
3736  * \note This call is asynchronous. The system will exit the power-save mode
3737  *       only when all requisite conditions are met.
3738  *
3739  * \return WM_SUCCESS if the call was successful.
3740  * \return -WM_FAIL otherwise.
3741  *
3742  */
3743 int wlan_wnmps_off(void);
3744 #endif
3745 
3746 /** Turn on Deep Sleep Power Save mode.
3747  *
3748  * \note This call is asynchronous. The system will enter the power-save mode
3749  * only when all requisite conditions are met. For example, wlan should be
3750  * disconnected for this to work.
3751  *
3752  * \return WM_SUCCESS if the call was successful.
3753  * \return -WM_FAIL otherwise.
3754  *
3755  */
3756 int wlan_deepsleepps_on(void);
3757 
3758 /** Turn off Deep Sleep Power Save mode.
3759  *
3760  * \note This call is asynchronous. The system will exit the power-save mode
3761  *       only when all requisite conditions are met.
3762  *
3763  * \return WM_SUCCESS if the call was successful.
3764  * \return -WM_FAIL otherwise.
3765  *
3766  */
3767 int wlan_deepsleepps_off(void);
3768 
3769 /**
3770  * Use this API to configure the TCP Keep alive parameters in Wi-Fi firmware.
3771  * \ref wlan_tcp_keep_alive_t provides the parameters which are available
3772  * for configuration.
3773  *
3774  * \note To reset current TCP Keep alive configuration just pass the reset with
3775  * value 1, all other parameters are ignored in this case.
3776  *
3777  * \note Please note that this API must be called after successful connection
3778  * and before putting Wi-Fi card in IEEE power save mode.
3779  *
3780  * \param[in] keep_alive A pointer to \ref wlan_tcp_keep_alive_t
3781  * 		with following parameters.
3782  * 	         enable Enable keep alive
3783  *               reset  Reset keep alive
3784  *   	         timeout Keep alive timeout
3785  *   	         interval Keep alive interval
3786  *               max_keep_alives Maximum keep alives
3787  *   		 dst_mac Destination MAC address
3788  *   		 dst_ip Destination IP
3789  *   		 dst_tcp_port Destination TCP port
3790  *   		 src_tcp_port Source TCP port
3791  *   		 seq_no Sequence number
3792  *
3793  * \return WM_SUCCESS if operation is successful.
3794  * \return -WM_FAIL if command fails.
3795  */
3796 int wlan_tcp_keep_alive(wlan_tcp_keep_alive_t *keep_alive);
3797 
3798 #if CONFIG_NAT_KEEP_ALIVE
3799 /**
3800  * Use this API to configure the NAT Keep alive parameters in Wi-Fi firmware.
3801  * \ref wlan_nat_keep_alive_t provides the parameters which are available
3802  * for configuration.
3803  *
3804  * \note Please note that this API must be called after successful connection
3805  * and before putting Wi-Fi card in IEEE power save mode.
3806  *
3807  * \param[in] nat_keep_alive A pointer to \ref wlan_nat_keep_alive_t
3808  * 		   with following parameters.
3809  *                  interval nat keep alive interval
3810  *                  dst_mac Destination MAC address
3811  *   		    dst_ip Destination IP
3812  *   		    dst_port Destination port
3813  *
3814  * \return WM_SUCCESS if operation is successful.
3815  * \return -WM_FAIL if command fails.
3816  */
3817 int wlan_nat_keep_alive(wlan_nat_keep_alive_t *nat_keep_alive);
3818 #endif
3819 
3820 /**
3821  * Use this API to get the beacon period of associated BSS.
3822  *
3823  * \return beacon_period if operation is successful.
3824  * \return 0 if command fails.
3825  */
3826 uint16_t wlan_get_beacon_period(void);
3827 
3828 /**
3829  * Use this API to get the dtim period of associated BSS.
3830  *
3831  * \return dtim_period if operation is successful.
3832  * \return 0 if DTIM IE Is not found in AP's Probe response.
3833  * \note This API should not be called from WLAN event handler
3834  *        registered by application during \ref wlan_start.
3835  */
3836 uint8_t wlan_get_dtim_period(void);
3837 
3838 /**
3839  * Use this API to get the current tx and rx rates along with
3840  * bandwidth and guard interval information if rate is 11N.
3841  *
3842  * \param[in] ds_rate A pointer to structure which will have
3843  *            tx, rx rate information along with bandwidth and guard
3844  *	      interval information.
3845  *
3846  * \param[in] bss_type 0: STA, 1: uAP
3847  *
3848  * \note If rate is greater than 11 then it is 11N rate and from 12
3849  *       MCS0 rate starts. The bandwidth mapping is like value 0 is for
3850  *	 20MHz, 1 is 40MHz, 2 is for 80MHz.
3851  *	 The guard interval value zero means Long otherwise Short.
3852  *
3853  * \return WM_SUCCESS if operation is successful.
3854  * \return -WM_FAIL if command fails.
3855  */
3856 int wlan_get_data_rate(wlan_ds_rate *ds_rate, mlan_bss_type bss_type);
3857 
3858 /**
3859  * Use this API to get the set management frame protection parameters for sta.
3860  *
3861  * \param[out] mfpc: Management Frame Protection Capable (MFPC)
3862  *                       1: Management Frame Protection Capable
3863  *                       0: Management Frame Protection not Capable
3864  * \param[out] mfpr: Management Frame Protection Required (MFPR)
3865  *                       1: Management Frame Protection Required
3866  *                       0: Management Frame Protection Optional
3867  *
3868  * \return WM_SUCCESS if operation is successful.
3869  * \return -WM_FAIL if command fails.
3870  */
3871 int wlan_get_pmfcfg(uint8_t *mfpc, uint8_t *mfpr);
3872 
3873 /**
3874  * Use this API to get the set management frame protection parameters for Uap.
3875  *
3876  * \param[out] mfpc: Management Frame Protection Capable (MFPC)
3877  *                       1: Management Frame Protection Capable
3878  *                       0: Management Frame Protection not Capable
3879  * \param[out] mfpr: Management Frame Protection Required (MFPR)
3880  *                       1: Management Frame Protection Required
3881  *                       0: Management Frame Protection Optional
3882  *
3883  * \return WM_SUCCESS if operation is successful.
3884  * \return -WM_FAIL if command fails.
3885  */
3886 int wlan_uap_get_pmfcfg(uint8_t *mfpc, uint8_t *mfpr);
3887 
3888 #if CONFIG_TBTT_OFFSET
3889 /**
3890  * Use this API to get the min, max and avg TBTT offset values
3891  * from Wi-Fi firmware.
3892  *
3893  * \param[in] tbtt_offset A pointer to \ref wlan_tbtt_offset_t which will hold
3894  *	      min, max and avg TBTT offset values.
3895  *
3896  * \return WM_SUCCESS if operation is successful.
3897  * \return -WM_FAIL if command fails.
3898  */
3899 int wlan_get_tbtt_offset_stats(wlan_tbtt_offset_t *tbtt_offset);
3900 #endif /* CONFIG_TBTT_OFFSET */
3901 
3902 /**
3903  * Use this API to set packet filters in Wi-Fi firmware.
3904  *
3905  * \param[in] flt_cfg A pointer to structure which holds the
3906  *	      the packet filters in same way as given below.\n
3907  *
3908  * MEF Configuration command\n
3909  * mefcfg={\n
3910  * Criteria: bit0-broadcast, bit1-unicast, bit3-multicast\n
3911  * Criteria=2 		Unicast frames are received during hostsleepmode\n
3912  * NumEntries=1		Number of activated MEF entries\n
3913  * mef_entry_0: example filters to match TCP destination port 80 send by 192.168.0.88 pkt or magic pkt.\n
3914  * mef_entry_0={\n
3915  *  mode: bit0--hostsleep mode, bit1--non hostsleep mode\n
3916  *  mode=1		HostSleep mode\n
3917  *  action: 0--discard and not wake host, 1--discard and wake host 3--allow and wake host\n
3918  *  action=3	Allow and Wake host\n
3919  *  filter_num=3    Number of filter\n
3920  *   RPN only support "&&" and "||" operator,space can not be removed between operator.\n
3921  *   RPN=Filter_0 && Filter_1 || Filter_2\n
3922  *   Byte comparison filter's type is 0x41,Decimal comparison filter's type is 0x42,\n
3923  *   Bit comparison filter's type is  0x43\n
3924  *  Filter_0 is decimal comparison filter, it always with type=0x42\n
3925  *  Decimal filter always has type, pattern, offset, numbyte 4 field\n
3926  *  Filter_0 will match rx pkt with TCP destination port 80\n
3927  *  Filter_0={\n
3928  *    type=0x42	      decimal comparison filter\n
3929  *    pattern=80      80 is the decimal constant to be compared\n
3930  *    offset=44	      44 is the byte offset of the field in RX pkt to be compare\n
3931  *    numbyte=2       2 is the number of bytes of the field\n
3932  *  }\n
3933  *  Filter_1 is Byte comparison filter, it always with type=0x41\n
3934  *  Byte filter always has type, byte, repeat, offset 4 filed\n
3935  *  Filter_1 will match rx pkt send by IP address 192.168.0.88\n
3936  *  Filter_1={\n
3937  *   type=0x41         Byte comparison filter\n
3938  *   repeat=1          1 copies of 'c0:a8:00:58'\n
3939  *   byte=c0:a8:00:58  'c0:a8:00:58' is the byte sequence constant with each byte\n
3940  *   in hex format, with ':' as delimiter between two byte.\n
3941  *   offset=34         34 is the byte offset of the equal length field of rx'd pkt.\n
3942  *  }\n
3943  *  Filter_2 is Magic packet, it will looking for 16 contiguous copies of '00:50:43:20:01:02' from\n
3944  *  the rx pkt's offset 14\n
3945  *  Filter_2={\n
3946  *   type=0x41	       Byte comparison filter\n
3947  *   repeat=16         16 copies of '00:50:43:20:01:02'\n
3948  *   byte=00:50:43:20:01:02  # '00:50:43:20:01:02' is the byte sequence constant\n
3949  *   offset=14	       14 is the byte offset of the equal length field of rx'd pkt.\n
3950  *  }\n
3951  * }\n
3952  * }\n
3953  * Above filters can be set by filling values in following way in \ref wlan_flt_cfg_t structure.\n
3954  * wlan_flt_cfg_t flt_cfg;\n
3955  * uint8_t byte_seq1[] = {0xc0, 0xa8, 0x00, 0x58};\n
3956  * uint8_t byte_seq2[] = {0x00, 0x50, 0x43, 0x20, 0x01, 0x02};\n
3957  *\n
3958  * memset(&flt_cfg, 0, sizeof(wlan_flt_cfg_t));\n
3959  *\n
3960  * flt_cfg.criteria = 2;\n
3961  * flt_cfg.nentries = 1;\n
3962  *\n
3963  * flt_cfg.mef_entry.mode = 1;\n
3964  * flt_cfg.mef_entry.action = 3;\n
3965  *\n
3966  * flt_cfg.mef_entry.filter_num = 3;\n
3967  *\n
3968  * flt_cfg.mef_entry.filter_item[0].type = TYPE_DNUM_EQ;\n
3969  * flt_cfg.mef_entry.filter_item[0].pattern = 80;\n
3970  * flt_cfg.mef_entry.filter_item[0].offset = 44;\n
3971  * flt_cfg.mef_entry.filter_item[0].num_bytes = 2;\n
3972  *\n
3973  * flt_cfg.mef_entry.filter_item[1].type = TYPE_BYTE_EQ;\n
3974  * flt_cfg.mef_entry.filter_item[1].repeat = 1;\n
3975  * flt_cfg.mef_entry.filter_item[1].offset = 34;\n
3976  * flt_cfg.mef_entry.filter_item[1].num_byte_seq = 4;\n
3977  * memcpy(flt_cfg.mef_entry.filter_item[1].byte_seq, byte_seq1, 4);\n
3978  * flt_cfg.mef_entry.rpn[1] = RPN_TYPE_AND;\n
3979  *\n
3980  * flt_cfg.mef_entry.filter_item[2].type = TYPE_BYTE_EQ;\n
3981  * flt_cfg.mef_entry.filter_item[2].repeat = 16;\n
3982  * flt_cfg.mef_entry.filter_item[2].offset = 14;\n
3983  * flt_cfg.mef_entry.filter_item[2].num_byte_seq = 6;\n
3984  * memcpy(flt_cfg.mef_entry.filter_item[2].byte_seq, byte_seq2, 6);\n
3985  * flt_cfg.mef_entry.rpn[2] = RPN_TYPE_OR;\n
3986  *
3987  *
3988  * \return WM_SUCCESS if operation is successful.
3989  * \return -WM_FAIL if command fails.
3990  */
3991 int wlan_set_packet_filters(wlan_flt_cfg_t *flt_cfg);
3992 
3993 /**
3994  * Use this API to enable ARP Offload in Wi-Fi firmware
3995  *
3996  * \return WM_SUCCESS if operation is successful.
3997  * \return -WM_FAIL if command fails.
3998  */
3999 int wlan_set_auto_arp(void);
4000 
4001 #if CONFIG_AUTO_PING
4002 /**
4003  * Use this API to enable Ping Offload in Wi-Fi firmware.
4004  *
4005  * \return WM_SUCCESS if operation is successful.
4006  * \return -WM_FAIL if command fails.
4007  */
4008 int wlan_set_auto_ping();
4009 #endif /*  CONFIG_AUTO_PING */
4010 
4011 /**
4012  * Use this API to enable WOWLAN on magic pkt rx in Wi-Fi firmware
4013  *
4014  * \param[in] ptn_cfg A pointer to \ref wlan_wowlan_ptn_cfg_t containing Wake on WLAN pattern configuration
4015  *
4016  *\return WM_SUCCESS if operation is successful.
4017  *\return -WM_FAIL if command fails
4018  */
4019 int wlan_wowlan_cfg_ptn_match(wlan_wowlan_ptn_cfg_t *ptn_cfg);
4020 /**
4021  * Use this API to enable NS Offload in Wi-Fi firmware.
4022  *
4023  * \return WM_SUCCESS if operation is successful.
4024  * \return -WM_FAIL if command fails.
4025  */
4026 int wlan_set_ipv6_ns_offload();
4027 
4028 #if CONFIG_HOST_SLEEP
4029 
4030 /** WLCMGR host sleep pre configuration */
4031 void wlan_hs_pre_cfg(void);
4032 
4033 /** WLCMGR host sleep post configuration */
4034 void wlan_hs_post_cfg(void);
4035 
4036 /**
4037  * Use this API to configure host sleep params in Wi-Fi firmware.
4038  *
4039  * \param[in] wakeup_condition  bit 0: WAKE_ON_ALL_BROADCAST
4040  *                              bit 1: WAKE_ON_UNICAST
4041  *                              bit 2: WAKE_ON_MAC_EVENT
4042  *                              bit 3: WAKE_ON_MULTICAST
4043  *                              bit 4: WAKE_ON_ARP_BROADCAST
4044  *                              bit 6: WAKE_ON_MGMT_FRAME
4045  *                              All bit 0 discard and not wakeup host
4046  *
4047  * \return WM_SUCCESS if operation is successful.
4048  * \return -WM_FAIL if command fails.
4049  */
4050 int wlan_send_host_sleep(uint32_t wakeup_condition);
4051 
4052 /**
4053  * Use this API to get host sleep wakeup reason from Wi-Fi firmware.
4054  *
4055  * \param[out] hs_wakeup_reason wakeupReason:
4056  *                              0: unknown
4057  *                              1: Broadcast data matched
4058  *                              2: Multicast data matched
4059  *                              3: Unicast data matched
4060  *                              4: Maskable event matched
4061  *                              5. Non-maskable event matched
4062  *                              6: Non-maskable condition matched (EAPoL rekey)
4063  *                              7: Magic pattern matched
4064  *                              Others: reserved. (set to 0)
4065  *
4066  * \return WM_SUCCESS if operation is successful.
4067  * \return -WM_FAIL if command fails.
4068  */
4069 int wlan_get_wakeup_reason(uint16_t *hs_wakeup_reason);
4070 #endif
4071 
4072 /**
4073  * Use this API to get the BSSID of associated BSS.
4074  *
4075  * \param[in] bssid A pointer to array to store the BSSID.
4076  *
4077  * \return WM_SUCCESS if operation is successful.
4078  * \return -WM_FAIL if command fails.
4079  */
4080 int wlan_get_current_bssid(uint8_t *bssid);
4081 
4082 /**
4083  * Use this API to get the channel number of associated BSS.
4084  *
4085  * \return channel number if operation is successful.
4086  * \return 0 if command fails.
4087  */
4088 uint8_t wlan_get_current_channel(void);
4089 
4090 #if CONFIG_WIFI_GET_LOG
4091 /**
4092  * Use this API to get the various statistics of sta from Wi-Fi firmware like
4093  * number of beacons received, missed and so on.
4094  *
4095  * \param[in] stats A pointer to structure where stats collected from Wi-Fi firmware
4096  *	      will be copied.
4097  * \note Please explore the elements of the \ref wlan_pkt_stats_t strucutre for
4098  * 	 more information on stats.
4099  *
4100  * \return WM_SUCCESS if operation is successful.
4101  * \return -WM_FAIL if command fails.
4102  */
4103 int wlan_get_log(wlan_pkt_stats_t *stats);
4104 
4105 /**
4106  * Use this API to get the various statistics of uap from Wi-Fi firmware like
4107  * number of beacons received, missed and so on.
4108  *
4109  * \param[in] stats A pointer to structure where stats collected from Wi-Fi firmware
4110  *	      will be copied.
4111  * \note Please explore the elements of the \ref wlan_pkt_stats_t strucutre for
4112  * 	 more information on stats.
4113  *
4114  * \return WM_SUCCESS if operation is successful.
4115  * \return -WM_FAIL if command fails.
4116  */
4117 int wlan_uap_get_log(wlan_pkt_stats_t *stats);
4118 #endif
4119 
4120 /** Get station interface power save mode.
4121  *
4122  * \param[out] ps_mode A pointer to \ref wlan_ps_mode where station interface
4123  * 	      power save mode will be stored.
4124  *
4125  * \return WM_SUCCESS if successful.
4126  * \return -WM_E_INVAL if \a ps_mode was NULL.
4127  */
4128 int wlan_get_ps_mode(enum wlan_ps_mode *ps_mode);
4129 
4130 /** Send message to WLAN Connection Manager thread.
4131  *
4132  * \param[in] event An event from \ref wifi_event.
4133  * \param[in] reason A reason code.
4134  * \param[in] data A pointer to data buffer associated with event.
4135  *
4136  * \return WM_SUCCESS if successful.
4137  * \return -WM_FAIL if failed.
4138  */
4139 int wlan_wlcmgr_send_msg(enum wifi_event event, enum wifi_event_reason reason, void *data);
4140 
4141 /** Register WFA basic WLAN CLI commands
4142  *
4143  * This function registers basic WLAN CLI commands like showing
4144  * version information, MAC address
4145  *
4146  * \note This function can only be called by the application after
4147  * \ref wlan_init() called.
4148  *
4149  * \return WLAN_ERROR_NONE if the CLI commands were registered or
4150  * \return WLAN_ERROR_ACTION if they were not registered (for example
4151  *   if this function was called while the CLI commands were already
4152  *   registered).
4153  */
4154 int wlan_wfa_basic_cli_init(void);
4155 
4156 /** Unregister WFA basic WLAN CLI commands
4157  *
4158  * This function unregisters basic WLAN CLI commands like showing
4159  * version information, MAC address
4160  *
4161  * \note This function can only be called by the application after
4162  * \ref wlan_init() called.
4163  *
4164  * \return WLAN_ERROR_NONE if the CLI commands were unregistered or
4165  * \return WLAN_ERROR_ACTION if they were not unregistered
4166  */
4167 int wlan_wfa_basic_cli_deinit(void);
4168 
4169 /** Register basic WLAN CLI commands
4170  *
4171  * This function registers basic WLAN CLI commands like showing
4172  * version information, MAC address
4173  *
4174  * \note This function can only be called by the application after
4175  * \ref wlan_init() called.
4176  *
4177  * \note This function gets called by \ref wlan_cli_init(), hence
4178  * only one function out of these two functions should be called in
4179  * the application.
4180  *
4181  * \return WLAN_ERROR_NONE if the CLI commands were registered or
4182  * \return WLAN_ERROR_ACTION if they were not registered (for example
4183  *   if this function was called while the CLI commands were already
4184  *   registered).
4185  */
4186 int wlan_basic_cli_init(void);
4187 
4188 /** Unregister basic WLAN CLI commands
4189  *
4190  * This function unregisters basic WLAN CLI commands like showing
4191  * version information, MAC address
4192  *
4193  * \note This function can only be called by the application after
4194  * \ref wlan_init() called.
4195  *
4196  * \note This function gets called by \ref wlan_cli_init(), hence
4197  * only one function out of these two functions should be called in
4198  * the application.
4199  *
4200  * \return WLAN_ERROR_NONE if the CLI commands were unregistered or
4201  * \return WLAN_ERROR_ACTION if they were not unregistered (for example
4202  *   if this function was called while the CLI commands were already
4203  *   registered).
4204  */
4205 int wlan_basic_cli_deinit(void);
4206 
4207 /** Register WLAN CLI commands.
4208  *
4209  *  Try to register the WLAN CLI commands with the CLI subsystem. This
4210  *  function is available for the application for use.
4211  *
4212  *  \note This function can only be called by the application after \ref wlan_init()
4213  *  called.
4214  *
4215  *  \note This function internally calls \ref wlan_basic_cli_init(), hence
4216  *  only one function out of these two functions should be called in
4217  *  the application.
4218  *
4219  *  \return WM_SUCCESS if the CLI commands were registered or
4220  *  \return -WM_FAIL if they were not (for example if this function
4221  *          was called while the CLI commands were already registered).
4222  */
4223 int wlan_cli_init(void);
4224 
4225 /** Unregister WLAN CLI commands.
4226  *
4227  *  Try to unregister the WLAN CLI commands with the CLI subsystem. This
4228  *  function is available for the application for use.
4229  *
4230  *  \note This function can only be called by the application after \ref wlan_init()
4231  *  called.
4232  *
4233  *  \note This function internally calls \ref wlan_basic_cli_deinit(), hence
4234  *  only one function out of these two functions should be called in
4235  *  the application.
4236  *
4237  *  \return WM_SUCCESS if the CLI commands were unregistered or
4238  *  \return -WM_FAIL if they were not (for example if this function
4239  *          was called while the CLI commands were already unregistered).
4240  */
4241 int wlan_cli_deinit(void);
4242 
4243 /** Register WLAN enhanced CLI commands.
4244  *
4245  *  Register the WLAN enhanced CLI commands like set or get tx-power,
4246  *  tx-datarate, tx-modulation etc with the CLI subsystem.
4247  *
4248  *  \note This function can only be called by the application after \ref wlan_init()
4249  *  called.
4250  *
4251  *  \return WM_SUCCESS if the CLI commands were registered or
4252  *  \return -WM_FAIL if they were not (for example if this function
4253  *           was called while the CLI commands were already registered).
4254  */
4255 int wlan_enhanced_cli_init(void);
4256 
4257 /** Unregister WLAN enhanced CLI commands.
4258  *
4259  *  Unregister the WLAN enhanced CLI commands like set or get tx-power,
4260  *  tx-datarate, tx-modulation etc with the CLI subsystem.
4261  *
4262  *  \note This function can only be called by the application after \ref wlan_init()
4263  *  called.
4264  *
4265  *  \return WM_SUCCESS if the CLI commands were unregistered or
4266  *  \return -WM_FAIL if they were not unregistered.
4267  */
4268 
4269 int wlan_enhanced_cli_deinit(void);
4270 
4271 #if CONFIG_RF_TEST_MODE
4272 /** Register WLAN Test Mode CLI commands.
4273  *
4274  *  Register the WLAN Test Mode CLI commands like set or get channel,
4275  *  band, bandwidth, PER and more with the CLI subsystem.
4276  *
4277  *  \note This function can only be called by the application after \ref wlan_init()
4278  *  called.
4279  *
4280  *  \return WM_SUCCESS if the CLI commands were registered or
4281  *  \return -WM_FAIL if they were not (for example if this function
4282  *           was called while the CLI commands were already registered).
4283  */
4284 int wlan_test_mode_cli_init(void);
4285 
4286 /** Unregister WLAN Test Mode CLI commands.
4287  *
4288  *  Unregister the WLAN Test Mode CLI commands like set or get channel,
4289  *  band, bandwidth, PER and more with the CLI subsystem.
4290  *
4291  *  \note This function can only be called by the application after \ref wlan_init()
4292  *  called.
4293  *
4294  *  \return WM_SUCCESS if the CLI commands were unregistered or
4295  *  \return -WM_FAIL if they were not unregistered
4296  */
4297 int wlan_test_mode_cli_deinit(void);
4298 #endif
4299 
4300 /**
4301  * Get maximum number of WLAN firmware supported stations that
4302  * will be allowed to connect to the uAP.
4303  *
4304  * \return Maximum number of WLAN firmware supported stations.
4305  *
4306  * \note Get operation is allowed in any uAP state.
4307  */
4308 unsigned int wlan_get_uap_supported_max_clients(void);
4309 
4310 /**
4311  * Get current maximum number of stations that
4312  * will be allowed to connect to the uAP.
4313  *
4314  * \param[out] max_sta_num A pointer to variable where current maximum
4315  *             number of stations of uAP interface will be stored.
4316  *
4317  * \return WM_SUCCESS if successful.
4318  * \return -WM_FAIL if unsuccessful.
4319  *
4320  * \note Get operation is allowed in any uAP state.
4321  */
4322 int wlan_get_uap_max_clients(unsigned int *max_sta_num);
4323 
4324 /**
4325  * Set maximum number of stations that will be allowed to connect to the uAP.
4326  *
4327  * \param[in] max_sta_num Number of maximum stations for uAP.
4328  *
4329  * \return WM_SUCCESS if successful.
4330  * \return -WM_FAIL if unsuccessful.
4331  *
4332  * \note Set operation in not allowed in \ref WLAN_UAP_STARTED state.
4333  */
4334 int wlan_set_uap_max_clients(unsigned int max_sta_num);
4335 
4336 /**
4337  * This API can be used to configure some of parameters in HTCapInfo IE
4338  *       (such as Short GI, Channel BW, and Green field support)
4339  *
4340  * \param[in] htcapinfo This is a bitmap and should be used as following\n
4341  *               Bit 29: Green field enable/disable\n
4342  *               Bit 26: Rx STBC Support enable/disable. (As we support\n
4343  *                       single spatial stream only 1 bit is used for Rx STBC)\n
4344  *               Bit 25: Tx STBC support enable/disable.\n
4345  *               Bit 24: Short GI in 40 Mhz enable/disable\n
4346  *               Bit 23: Short GI in 20 Mhz enable/disable\n
4347  *               Bit 22: Rx LDPC enable/disable\n
4348  *               Bit 17: 20/40 Mhz enable disable.\n
4349  *               Bit  8: Enable/disable 40Mhz Intolarent bit in ht capinfo.\n
4350  *                       0 will reset this bit and 1 will set this bit in\n
4351  *                       htcapinfo attached in assoc request.\n
4352  *               All others are reserved and should be set to 0.\n
4353  *
4354  * \return WM_SUCCESS if successful.
4355  * \return -WM_FAIL if unsuccessful.
4356  *
4357  */
4358 int wlan_set_htcapinfo(unsigned int htcapinfo);
4359 
4360 /**
4361  * This API can be used to configure various 11n specific configuration
4362  *       for transmit (such as Short GI, Channel BW and Green field support)
4363  *
4364  * \param[in] httxcfg This is a bitmap and should be used as following\n
4365  *               Bit 15-10: Reserved set to 0\n
4366  *               Bit 9-8: Rx STBC set to 0x01\n
4367  *               BIT9 BIT8  Description\n
4368  *               0    0     No spatial streams\n
4369  *               0    1     One spatial streams supported\n
4370  *               1    0     Reserved\n
4371  *               1    1     Reserved\n
4372  *               Bit 7: STBC enable/disable\n
4373  *               Bit 6: Short GI in 40 Mhz enable/disable\n
4374  *               Bit 5: Short GI in 20 Mhz enable/disable\n
4375  *               Bit 4: Green field enable/disable\n
4376  *               Bit 3-2: Reserved set to 1\n
4377  *               Bit 1: 20/40 Mhz enable disable.\n
4378  *               Bit 0: LDPC enable/disable\n
4379  *
4380  *       When Bit 1 is set then firmware could transmit in 20Mhz or 40Mhz based\n
4381  *       on rate adaptation. When this bit is reset then firmware will only\n
4382  *       transmit in 20Mhz.\n
4383  *
4384  *
4385  * \return WM_SUCCESS if successful.
4386  * \return -WM_FAIL if unsuccessful.
4387  *
4388  */
4389 int wlan_set_httxcfg(unsigned short httxcfg);
4390 
4391 /**
4392  * This API can be used to set the transmit data rate.
4393  *
4394  * \note The data rate can be set only after association.
4395  *
4396  * \param[in] ds_rate struct contains following fields
4397  *             sub_command It should be WIFI_DS_RATE_CFG
4398  *             and rate_cfg should have following parameters.\n
4399  *              rate_format - This parameter specifies
4400  *                              the data rate format used
4401  *                              in this command\n
4402  *               0:    LG\n
4403  *               1:    HT\n
4404  *               2:    VHT\n
4405  *               0xff: Auto\n
4406  *
4407  *              index - This parameter specifies the rate or MCS index\n
4408  *              If  rate_format is 0 (LG),\n
4409  *               0       1 Mbps\n
4410  *               1       2 Mbps\n
4411  *               2       5.5 Mbps\n
4412  *               3       11 Mbps\n
4413  *               4       6 Mbps\n
4414  *               5       9 Mbps\n
4415  *               6       12 Mbps\n
4416  *               7       18 Mbps\n
4417  *               8       24 Mbps\n
4418  *               9       36 Mbps\n
4419  *               10      48 Mbps\n
4420  *               11      54 Mbps\n
4421  *              If  rate_format is 1 (HT),\n
4422  *               0       MCS0\n
4423  *               1       MCS1\n
4424  *               2       MCS2\n
4425  *               3       MCS3\n
4426  *               4       MCS4\n
4427  *               5       MCS5\n
4428  *               6       MCS6\n
4429  *               7       MCS7\n
4430  *	        If STREAM_2X2\n
4431  *               8       MCS8\n
4432  *               9       MCS9\n
4433  *               10      MCS10\n
4434  *               11      MCS11\n
4435  *               12      MCS12\n
4436  *               13      MCS13\n
4437  *               14      MCS14\n
4438  *               15      MCS15\n
4439  *              If  rate_format is 2 (VHT),\n
4440  *               0       MCS0\n
4441  *               1       MCS1\n
4442  *               2       MCS2\n
4443  *               3       MCS3\n
4444  *               4       MCS4\n
4445  *               5       MCS5\n
4446  *               6       MCS6\n
4447  *               7       MCS7\n
4448  *               8       MCS8\n
4449  *               9       MCS9\n
4450  *              nss - This parameter specifies the NSS.\n
4451  *			It is valid only for VHT\n
4452  *              If  rate_format is 2 (VHT),\n
4453  *               1       NSS1\n
4454  *               2       NSS2\n
4455  *
4456  * \param[in] bss_type 0: STA, 1: uAP
4457  *
4458  * \return WM_SUCCESS if successful.
4459  * \return -WM_FAIL if unsuccessful.
4460  *
4461  */
4462 int wlan_set_txratecfg(wlan_ds_rate ds_rate, mlan_bss_type bss_type);
4463 
4464 /**
4465  * This API can be used to get the transmit data rate.
4466  *
4467  * \param[in] ds_rate A pointer to \ref wlan_ds_rate where Tx Rate
4468  * 		configuration will be stored.
4469  * \param[in] bss_type 0: STA, 1: uAP
4470  *
4471  * \return WM_SUCCESS if successful.
4472  * \return -WM_FAIL if unsuccessful.
4473  *
4474  */
4475 int wlan_get_txratecfg(wlan_ds_rate *ds_rate, mlan_bss_type bss_type);
4476 
4477 /**
4478  * Get Station interface transmit power
4479  *
4480  * \param[out] power_level Transmit power level.
4481  * \return WM_SUCCESS if successful.
4482  * \return -WM_FAIL if unsuccessful.
4483  *
4484  */
4485 int wlan_get_sta_tx_power(t_u32 *power_level);
4486 
4487 /**
4488  * Set Station interface transmit power
4489  *
4490  * \param[in] power_level Transmit power level.
4491  *
4492  * \return WM_SUCCESS if successful.
4493  * \return -WM_FAIL if unsuccessful.
4494  *
4495  */
4496 int wlan_set_sta_tx_power(t_u32 power_level);
4497 
4498 /**
4499  * Set World Wide Safe Mode Tx Power Limits
4500  *
4501  * \return WM_SUCCESS if successful.
4502  * \return -WM_FAIL if unsuccessful.
4503  *
4504  */
4505 int wlan_set_wwsm_txpwrlimit(void);
4506 
4507 #ifndef RW610
4508 /**
4509  * Get wlan region code from tx power config
4510  *
4511  * \return wlan region code in string format.
4512  *
4513  */
4514 const char *wlan_get_wlan_region_code(void);
4515 #endif
4516 
4517 /**
4518  * Get Management IE for given BSS type (interface) and index.
4519  *
4520  * \param[in] bss_type 0: STA, 1: uAP
4521  * \param[in] index IE index.
4522  *
4523  * \param[out] buf Buffer to store requested IE data.
4524  * \param[out] buf_len To store length of IE data.
4525  *
4526  * \return WM_SUCCESS if successful.
4527  * \return -WM_FAIL if unsuccessful.
4528  *
4529  */
4530 int wlan_get_mgmt_ie(enum wlan_bss_type bss_type, IEEEtypes_ElementId_t index, void *buf, unsigned int *buf_len);
4531 
4532 /**
4533  * Set Management IE for given BSS type (interface) and index.
4534  *
4535  * \param[in] bss_type 0: STA, 1: uAP
4536  * \param[in] id Type/ID of Management IE.
4537  * \param[in] buf Buffer containing IE data.
4538  * \param[in] buf_len Length of IE data.
4539  *
4540  * \return IE index if successful.
4541  * \return -WM_FAIL if unsuccessful.
4542  *
4543  */
4544 int wlan_set_mgmt_ie(enum wlan_bss_type bss_type, IEEEtypes_ElementId_t id, void *buf, unsigned int buf_len);
4545 
4546 #ifdef SD8801
4547 /**
4548  * Get External Radio Coex statistics.
4549  *
4550  * \param[out] ext_coex_stats A pointer to structure to get coex statistics.
4551  *
4552  * \return WM_SUCCESS if successful.
4553  * \return -WM_FAIL if unsuccessful.
4554  *
4555  */
4556 int wlan_get_ext_coex_stats(wlan_ext_coex_stats_t *ext_coex_stats);
4557 
4558 /**
4559  * Set External Radio Coex configuration.
4560  *
4561  * \param[in] ext_coex_config to apply coex configuration.
4562  *
4563  * \return IE index if successful.
4564  * \return -WM_FAIL if unsuccessful.
4565  *
4566  */
4567 int wlan_set_ext_coex_config(const wlan_ext_coex_config_t ext_coex_config);
4568 #endif
4569 
4570 /**
4571  * Clear Management IE for given BSS type (interface) and index.
4572  *
4573  * \param[in] bss_type 0: STA, 1: uAP
4574  * \param[in] index IE index.
4575  * \param[in] mgmt_bitmap_index mgmt bitmap index.
4576  *
4577  * \return WM_SUCCESS if successful.
4578  * \return -WM_FAIL if unsuccessful.
4579  *
4580  */
4581 int wlan_clear_mgmt_ie(enum wlan_bss_type bss_type, IEEEtypes_ElementId_t index, int mgmt_bitmap_index);
4582 
4583 /**
4584  * Get current status of 11d support.
4585  *
4586  * \return true if 11d support is enabled by application.
4587  * \return false if not enabled.
4588  *
4589  */
4590 bool wlan_get_11d_enable_status(void);
4591 
4592 /**
4593  * Get current RSSI and Signal to Noise ratio from WLAN firmware.
4594  *
4595  * \param[in] rssi A pointer to variable to store current RSSI
4596  * \param[in] snr A pointer to variable to store current SNR.
4597  *
4598  * \return WM_SUCCESS if successful.
4599  */
4600 int wlan_get_current_signal_strength(short *rssi, int *snr);
4601 
4602 /**
4603  * Get average RSSI and Signal to Noise ratio from WLAN firmware.
4604  *
4605  * \param[in] rssi A pointer to variable to store current RSSI
4606  * \param[in] snr A pointer to variable to store current SNR.
4607  *
4608  * \return WM_SUCCESS if successful.
4609  */
4610 int wlan_get_average_signal_strength(short *rssi, int *snr);
4611 
4612 /**
4613  * This API is is used to set/cancel the remain on channel configuration.
4614  *
4615  * \note When status is false, channel and duration parameters are
4616  * ignored.
4617  *
4618  * \param[in] bss_type The interface to set channel  bss_type 0: STA, 1: uAP
4619  * \param[in] status false : Cancel the remain on channel configuration
4620  *                   true : Set the remain on channel configuration
4621  * \param[in] channel The channel to configure
4622  * \param[in] duration The duration for which to
4623  *	      remain on channel in milliseconds.
4624  *
4625  * \return WM_SUCCESS on success or error code.
4626  *
4627  */
4628 int wlan_remain_on_channel(const enum wlan_bss_type bss_type,
4629                            const bool status,
4630                            const uint8_t channel,
4631                            const uint32_t duration);
4632 
4633 /**
4634  * Get User Data from OTP Memory
4635  *
4636  * \param[in] buf Pointer to buffer where data will be stored
4637  * \param[in] len Number of bytes to read
4638  *
4639  * \return WM_SUCCESS if user data read operation is successful.
4640  * \return -WM_E_INVAL if buf is not valid or of insufficient size.
4641  * \return -WM_FAIL if user data field is not present or command fails.
4642  */
4643 int wlan_get_otp_user_data(uint8_t *buf, uint16_t len);
4644 
4645 /**
4646  * Get calibration data from WLAN firmware
4647  *
4648  * \param[out] cal_data Pointer to calibration data structure where
4649  *	      calibration data and it's length will be stored.
4650  *
4651  * \return WM_SUCCESS if cal data read operation is successful.
4652  * \return -WM_E_INVAL if cal_data is not valid.
4653  * \return -WM_FAIL if command fails.
4654  *
4655  * \note The user of this API should free the allocated buffer for
4656  *	 calibration data.
4657  */
4658 int wlan_get_cal_data(wlan_cal_data_t *cal_data);
4659 
4660 #if CONFIG_COMPRESS_TX_PWTBL
4661 /**
4662  * Set the compressed Tx PWR Limit configuration.
4663  *
4664  * \param[in] data A pointer to TX PWR Limit configuration.
4665  * \param[in] len Length of TX PWR Limit configuration.
4666  *
4667  * \return WM_SUCCESS on success, error otherwise.
4668  *
4669  */
4670 int wlan_set_region_power_cfg(const t_u8 *data, t_u16 len);
4671 #endif
4672 
4673 /**
4674  * Set the Channel List and TRPC channel configuration.
4675  *
4676  * \param[in] chanlist A poiner to \ref wlan_chanlist_t Channel List configuration.
4677  * \param[in] txpwrlimit A pointer to \ref wlan_txpwrlimit_t TX PWR Limit configuration.
4678  *
4679  * \return WM_SUCCESS on success, error otherwise.
4680  *
4681  */
4682 int wlan_set_chanlist_and_txpwrlimit(wlan_chanlist_t *chanlist, wlan_txpwrlimit_t *txpwrlimit);
4683 
4684 /**
4685  * Set the Channel List configuration.
4686  *
4687  * \param[in] chanlist A pointer to \ref wlan_chanlist_t Channel List configuration.
4688  *
4689  * \return WM_SUCCESS on success, error otherwise.
4690  *
4691  * \note If Region Enforcement Flag is enabled in the OTP then this API will
4692  * not take effect.
4693  */
4694 int wlan_set_chanlist(wlan_chanlist_t *chanlist);
4695 
4696 /**
4697  * Get the Channel List configuration.
4698  *
4699  * \param[out] chanlist A pointer to \ref wlan_chanlist_t Channel List configuration.
4700  *
4701  * \return WM_SUCCESS on success, error otherwise.
4702  *
4703  * \note The \ref wlan_chanlist_t struct allocates memory for a maximum of 54
4704  * channels.
4705  *
4706  */
4707 int wlan_get_chanlist(wlan_chanlist_t *chanlist);
4708 
4709 /**
4710  * Set the TRPC channel configuration.
4711  *
4712  * \param[in] txpwrlimit A pointer to \ref wlan_txpwrlimit_t TX PWR Limit configuration.
4713  *
4714  * \return WM_SUCCESS on success, error otherwise.
4715  *
4716  */
4717 int wlan_set_txpwrlimit(wlan_txpwrlimit_t *txpwrlimit);
4718 
4719 /**
4720  * Get the TRPC channel configuration.
4721  *
4722  * \param[in] subband  Where subband is:\n
4723  *              0x00 2G subband  (2.4G: channel 1-14)\n
4724  *              0x10 5G subband0 (5G: channel 36,40,44,48,\n
4725  *                                            52,56,60,64)\n
4726  *              0x11 5G subband1 (5G: channel 100,104,108,112,\n
4727  *                                            116,120,124,128,\n
4728  *                                            132,136,140,144)\n
4729  *              0x12 5G subband2 (5G: channel 149,153,157,161,165,172)\n
4730  *              0x13 5G subband3 (5G: channel 183,184,185,187,188,\n
4731  *                                            189, 192,196;\n
4732  *                                5G: channel 7,8,11,12,16,34)\n
4733  *
4734  * \param[out] txpwrlimit A pointer to \ref wlan_txpwrlimit_t TX PWR
4735  * 		Limit configuration structure where Wi-Fi firmware
4736  * 		configuration will get copied.
4737  *
4738  * \return WM_SUCCESS on success, error otherwise.
4739  *
4740  * \note application can use print_txpwrlimit API to print the
4741  *	 content of the txpwrlimit structure.
4742  */
4743 int wlan_get_txpwrlimit(wifi_SubBand_t subband, wifi_txpwrlimit_t *txpwrlimit);
4744 
4745 #if CONFIG_AUTO_RECONNECT
4746 /**
4747  * Enable Auto Reconnect feature in WLAN firmware.
4748  *
4749  * \param[in] auto_reconnect_config Auto Reconnect configuration
4750  *	      structure holding following parameters:
4751  *	      1. reconnect counter(0x1-0xff) - The number of times the WLAN
4752  *		 firmware retries connection attempt with AP.
4753  *				The value 0xff means retry forever.
4754  *				(default 0xff).
4755  *	      2. reconnect interval(0x0-0xff) - Time gap in seconds between
4756  *				each connection attempt (default 10).
4757  *	      3. flags - Bit 0:
4758  *			 Set to 1: Firmware should report link-loss to host
4759  *				if AP rejects authentication/association
4760  *				while reconnecting.
4761  *			 Set to 0: Default behaviour: Firmware does not report
4762  *				link-loss to host on AP rejection and
4763  *				continues internally.
4764  *			 Bit 1-15: Reserved.
4765  *
4766  * \return WM_SUCCESS if operation is successful.
4767  * \return -WM_FAIL if command fails.
4768  *
4769  */
4770 int wlan_auto_reconnect_enable(wlan_auto_reconnect_config_t auto_reconnect_config);
4771 
4772 /**
4773  * Disable Auto Reconnect feature in WLAN firmware.
4774  *
4775  * \return WM_SUCCESS if operation is successful.
4776  * \return -WM_FAIL if command fails.
4777  *
4778  */
4779 int wlan_auto_reconnect_disable(void);
4780 
4781 /**
4782  * Get Auto Reconnect configuration from WLAN firmware.
4783  *
4784  * \param[out] auto_reconnect_config Auto Reconnect configuration
4785  *	       structure where response from WLAN firmware will
4786  *	       get stored.
4787  *
4788  * \return WM_SUCCESS if operation is successful.
4789  * \return -WM_E_INVAL if auto_reconnect_config is not valid.
4790  * \return -WM_FAIL if command fails.
4791  *
4792  */
4793 int wlan_get_auto_reconnect_config(wlan_auto_reconnect_config_t *auto_reconnect_config);
4794 #endif
4795 /**
4796  * Set Reassociation Control in WLAN Connection Manager
4797  * \note Reassociation is enabled by default in the WLAN Connection Manager.
4798  *
4799  * \param[in] reassoc_control Reassociation enable/disable
4800  *
4801  */
4802 void wlan_set_reassoc_control(bool reassoc_control);
4803 
4804 /** API to set the beacon period of uAP
4805  *
4806  *\param[in] beacon_period Beacon period in TU (1 TU = 1024 micro seconds)
4807  *
4808  *\note Please call this API before calling uAP start API.
4809  *
4810  */
4811 void wlan_uap_set_beacon_period(const uint16_t beacon_period);
4812 
4813 /** API to set the bandwidth of uAP
4814  *
4815  *\param[in] bandwidth Wi-Fi AP Bandwidth (20MHz/40MHz)
4816     1: 20 MHz 2: 40 MHz 3: 80 MHz
4817  *
4818  *\return WM_SUCCESS if successful otherwise failure.
4819  *\return -WM_FAIL if command fails.
4820  *
4821  *\note Please call this API before calling uAP start API.
4822  *\note Default bandwidth setting is 40 MHz.
4823  *
4824  */
4825 int wlan_uap_set_bandwidth(const uint8_t bandwidth);
4826 
4827 /** API to Get the bandwidth of uAP
4828  *
4829  *\param[out] bandwidth Wi-Fi AP Bandwidth (20MHz/40MHz)
4830     1: 20 MHz 2: 40 MHz 3: 80 MHz
4831  *
4832  *\return WM_SUCCESS if successful otherwise failure.
4833  *\return -WM_FAIL if command fails.
4834  *
4835  *\note Please call this API before calling uAP start API.
4836  *
4837  */
4838 int wlan_uap_get_bandwidth(uint8_t *bandwidth);
4839 
4840 /** API to control SSID broadcast capability of uAP
4841  *
4842  * This API enables/disables the SSID broadcast feature
4843  * (also known as the hidden SSID feature). When broadcast SSID
4844  * is enabled, the AP responds to probe requests from client stations
4845  * that contain null SSID. When broadcast SSID is disabled, the AP
4846  * does not respond to probe requests that contain null SSID and
4847  * generates beacons that contain null SSID.
4848  *
4849  *\param[in] hidden_ssid Hidden SSID control
4850  *           hidden_ssid=0: broadcast SSID in beacons.
4851  *           hidden_ssid=1: send empty SSID (length=0) in beacon.
4852  *           hidden_ssid=2: clear SSID (ACSII 0), but keep the original length
4853  *
4854  *\return WM_SUCCESS if successful otherwise failure.
4855  *\return -WM_FAIL if command fails.
4856  *
4857  *\note Please call this API before calling uAP start API.
4858  *
4859  */
4860 int wlan_uap_set_hidden_ssid(const t_u8 hidden_ssid);
4861 
4862 /** API to control the deauth during uAP channel switch
4863  *
4864  *\param[in] enable 0 -- Wi-Fi firmware will use default behaviour.
4865  *		    1 -- Wi-Fi firmware will not send deauth packet
4866  *		         when uap move to another channel.
4867  *
4868  *\note Please call this API before calling uAP start API.
4869  *
4870  */
4871 void wlan_uap_ctrl_deauth(const bool enable);
4872 
4873 /** API to enable channel switch announcement functionality on uAP.
4874  *
4875  *\note Please call this API before calling uAP start API. Also
4876  *	note that 11N should be enabled on uAP. The channel switch announcement IE
4877  *	is transmitted in 7 beacons before the channel switch, during a station
4878  *	connection attempt on a different channel with Ex-AP.
4879  *
4880  */
4881 void wlan_uap_set_ecsa(void);
4882 
4883 /** API to set the HT Capability Information of uAP
4884  *
4885  *\param[in] ht_cap_info - This is a bitmap and should be used as following\n
4886  *             Bit 15: L Sig TxOP protection - reserved, set to 0 \n
4887  *             Bit 14: 40 MHz intolerant - reserved, set to 0 \n
4888  *             Bit 13: PSMP - reserved, set to 0 \n
4889  *             Bit 12: DSSS Cck40MHz mode\n
4890  *             Bit 11: Maximal AMSDU size - reserved, set to 0 \n
4891  *             Bit 10: Delayed BA - reserved, set to 0 \n
4892  *             Bits 9:8: Rx STBC - reserved, set to 0 \n
4893  *             Bit 7: Tx STBC - reserved, set to 0 \n
4894  *             Bit 6: Short GI 40 MHz\n
4895  *             Bit 5: Short GI 20 MHz\n
4896  *             Bit 4: GF preamble\n
4897  *             Bits 3:2: MIMO power save - reserved, set to 0 \n
4898  *             Bit 1: SuppChanWidth - set to 0 for 2.4 GHz band \n
4899  *             Bit 0: LDPC coding - reserved, set to 0 \n
4900  *
4901  *\note Please call this API before calling uAP start API.
4902  *
4903  */
4904 void wlan_uap_set_htcapinfo(const uint16_t ht_cap_info);
4905 
4906 /**
4907  * This API can be used to configure various 11n specific configuration
4908  *       for transmit (such as Short GI, Channel BW and Green field support)
4909  *       for uAP interface.
4910  *
4911  * \param[in] httxcfg This is a bitmap and should be used as following\n
4912  *               Bit 15-8: Reserved set to 0\n
4913  *               Bit 7: STBC enable/disable\n
4914  *               Bit 6: Short GI in 40 Mhz enable/disable\n
4915  *               Bit 5: Short GI in 20 Mhz enable/disable\n
4916  *               Bit 4: Green field enable/disable\n
4917  *               Bit 3-2: Reserved set to 1\n
4918  *               Bit 1: 20/40 Mhz enable disable.\n
4919  *               Bit 0: LDPC enable/disable\n
4920  *
4921  *       When Bit 1 is set then firmware could transmit in 20Mhz or 40Mhz based\n
4922  *       on rate adaptation. When this bit is reset then firmware will only\n
4923  *       transmit in 20Mhz.\n
4924  *
4925  *\note Please call this API before calling uAP start API.
4926  *
4927  */
4928 void wlan_uap_set_httxcfg(unsigned short httxcfg);
4929 
4930 /**
4931  * This API can be used to enable AMPDU support on the go
4932  * when station is a transmitter.
4933  *
4934  * \note By default the station AMPDU TX support is on if
4935  * configuration option is enabled in defconfig.
4936  */
4937 void wlan_sta_ampdu_tx_enable(void);
4938 
4939 /**
4940  * This API can be used to disable AMPDU support on the go
4941  * when station is a transmitter.
4942  *
4943  *\note By default the station AMPDU RX support is on if
4944  * configuration option is enabled in defconfig.
4945  *
4946  */
4947 void wlan_sta_ampdu_tx_disable(void);
4948 
4949 /**
4950  * This API can be used to enable AMPDU support on the go
4951  * when station is a receiver.
4952  */
4953 void wlan_sta_ampdu_rx_enable(void);
4954 
4955 /**
4956  * This API can be used to disable AMPDU support on the go
4957  * when station is a receiver.
4958  */
4959 void wlan_sta_ampdu_rx_disable(void);
4960 
4961 /**
4962  * This API can be used to enable AMPDU support on the go
4963  * when uap is a transmitter.
4964  *
4965  * \note By default the uap AMPDU TX support is on if
4966  * configuration option is enabled in defconfig.
4967  */
4968 void wlan_uap_ampdu_tx_enable(void);
4969 
4970 /**
4971  * This API can be used to disable AMPDU support on the go
4972  * when uap is a transmitter.
4973  *
4974  *\note By default the uap AMPDU RX support is on if
4975  * configuration option is enabled in defconfig.
4976  *
4977  */
4978 void wlan_uap_ampdu_tx_disable(void);
4979 
4980 /**
4981  * This API can be used to enable AMPDU support on the go
4982  * when uap is a receiver.
4983  */
4984 void wlan_uap_ampdu_rx_enable(void);
4985 
4986 /**
4987  * This API can be used to disable AMPDU support on the go
4988  * when uap is a receiver.
4989  */
4990 void wlan_uap_ampdu_rx_disable(void);
4991 
4992 #if CONFIG_WIFI_AMPDU_CTRL
4993 /**
4994  * This API can be used to set tid of AMPDU support on the go
4995  * when sta is a transmitter.
4996  *\param[in] tid tid value.
4997  */
4998 void wlan_sta_ampdu_tx_enable_per_tid(t_u8 tid);
4999 
5000 /**
5001  * This API can be used to set tid of AMPDU support on the go
5002  * when sta is a receiver.
5003  *\param[in] tid tid value.
5004  */
5005 void wlan_sta_ampdu_rx_enable_per_tid(t_u8 tid);
5006 
5007 /**
5008  * This API can be used to set tid of AMPDU support on the go
5009  * when uap is a transmitter.
5010  *\param[in] tid tid value.
5011  */
5012 void wlan_uap_ampdu_tx_enable_per_tid(t_u8 tid);
5013 
5014 /**
5015  * This API can be used to set tid of AMPDU support on the go
5016  * when uap is a receiver.
5017  *\param[in] tid tid value.
5018  */
5019 void wlan_uap_ampdu_rx_enable_per_tid(t_u8 tid);
5020 #endif
5021 
5022 /**
5023  * Set number of channels and channel number used during automatic
5024  * channel selection of uAP.
5025  *
5026  *\param[in] scan_chan_list A structure holding the number of channels and
5027  *	     channel numbers.
5028  *
5029  *\note Please call this API before uAP start API in order to set the user
5030  *      defined channels, otherwise it will have no effect. There is no need
5031  *      to call this API every time before uAP start, if once set same channel
5032  *      configuration will get used in all upcoming uAP start call. If user
5033  *      wish to change the channels at run time then it make sense to call
5034  *      this API before every uAP start API.
5035  */
5036 void wlan_uap_set_scan_chan_list(wifi_scan_chan_list_t scan_chan_list);
5037 
5038 #if CONFIG_WPA2_ENTP
5039 
5040 /**
5041  * Use this API if application want to allow station
5042  * connection to WPA2 Enterprise ap profiles only.
5043  *
5044  * If called the in scan result only the WPA2 Enterprise AP
5045  * will be listed and station network profile only with WPA2
5046  * Enterprise security will be allowed to add to network profile
5047  * list.
5048  */
5049 void wlan_enable_wpa2_enterprise_ap_only();
5050 #endif
5051 
5052 #if CONFIG_WIFI_RTS_THRESHOLD
5053 /**
5054  * Set the rts threshold of sta in WLAN firmware.
5055  *
5056  * \param[in] rts the value of rts threshold configuration.
5057  *
5058  * \return WM_SUCCESS if successful otherwise failure.
5059  */
5060 int wlan_set_rts(int rts);
5061 
5062 /**
5063  * Set the rts threshold of uap in WLAN firmware.
5064  *
5065  * \param[in] rts the value of rts threshold configuration.
5066  *
5067  * \return WM_SUCCESS if successful otherwise failure.
5068  */
5069 int wlan_set_uap_rts(int rts);
5070 #endif
5071 
5072 #if CONFIG_WIFI_FRAG_THRESHOLD
5073 /**
5074  * Set the fragment threshold of sta in WLAN firmware.
5075  *
5076  * \param[in] frag the value of fragment threshold configuration.
5077  *
5078  * \return WM_SUCCESS if successful otherwise failure.
5079  */
5080 int wlan_set_frag(int frag);
5081 
5082 /**
5083  * Set the fragment threshold of uap in WLAN firmware.
5084  *
5085  * \param[in] frag the value of fragment threshold configuration.
5086  *
5087  * \return WM_SUCCESS if successful otherwise failure.
5088  */
5089 int wlan_set_uap_frag(int frag);
5090 #endif
5091 
5092 #if CONFIG_11K_OFFLOAD
5093 /**
5094  * enable/disable 11k feature in WLAN firmware.
5095  *
5096  * \param[in] enable_11k the value of 11k configuration.
5097  *
5098  */
5099 int wlan_11k_cfg(int enable_11k);
5100 
5101 /**
5102  * send 11k neighbor request in WLAN firmware.
5103  *
5104  * \return WM_SUCCESS if successful otherwise failure.
5105  *
5106  */
5107 int wlan_11k_neighbor_req(void);
5108 #endif
5109 
5110 #if CONFIG_UAP_STA_MAC_ADDR_FILTER
5111 /**
5112  * Set the sta mac filter in Wi-Fi firmware.
5113  *
5114  * \param[in] filter_mode channel filter mode (disable/white/black list)
5115  * \param[in] mac_count the count of mac list
5116  * \param[in] mac_addr the pointer to mac address list
5117  *
5118  * \return WM_SUCCESS if successful otherwise failure.
5119  *
5120  */
5121 int wlan_set_sta_mac_filter(int filter_mode, int mac_count, unsigned char *mac_addr);
5122 #endif
5123 
print_mac(const char * mac)5124 static inline void print_mac(const char *mac)
5125 {
5126     (void)PRINTF("%02X:%02X:%02X:%02X:%02X:%02X ", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
5127 }
5128 
5129 #if CONFIG_RF_TEST_MODE
5130 
5131 /**
5132  * Set the RF Test Mode on in Wi-Fi firmware.
5133  *
5134  * \return WM_SUCCESS if successful otherwise failure.
5135  */
5136 int wlan_set_rf_test_mode(void);
5137 
5138 /**
5139  * UnSet the RF Test Mode on in Wi-Fi firmware.
5140  *
5141  * \return WM_SUCCESS if successful otherwise failure.
5142  */
5143 int wlan_unset_rf_test_mode(void);
5144 
5145 /**
5146  * Set the RF Channel in Wi-Fi firmware.
5147  *
5148  * \note Please call \ref wlan_set_rf_test_mode API before using this API.
5149  *
5150  * \param[in] channel The channel number to be set in Wi-Fi firmware.
5151  *
5152  * \return WM_SUCCESS if successful otherwise failure.
5153  *
5154  */
5155 int wlan_set_rf_channel(const uint8_t channel);
5156 
5157 /**
5158  * Set the RF radio mode in Wi-Fi firmware.
5159  *
5160  * \note Please call \ref wlan_set_rf_test_mode API before using this API.
5161  *
5162  * \param[in] mode The radio mode number to be set in Wi-Fi firmware.
5163  *
5164  * \return WM_SUCCESS if successful otherwise failure.
5165  *
5166  */
5167 int wlan_set_rf_radio_mode(const uint8_t mode);
5168 
5169 /**
5170  * Get the RF Channel from Wi-Fi firmware.
5171  *
5172  * \note Please call \ref wlan_set_rf_test_mode API before using this API.
5173  *
5174  * \param[out] channel A Pointer to a variable where channel number to get.
5175  *
5176  * \return WM_SUCCESS if successful otherwise failure.
5177  *
5178  */
5179 int wlan_get_rf_channel(uint8_t *channel);
5180 
5181 /**
5182  * Get the RF Radio mode from Wi-Fi firmware.
5183  *
5184  * \note Please call \ref wlan_set_rf_test_mode API before using this API.
5185  *
5186  * \param[out] mode A Pointer to a variable where radio mode number to get.
5187  *
5188  * \return WM_SUCCESS if successful otherwise failure.
5189  *
5190  */
5191 int wlan_get_rf_radio_mode(uint8_t *mode);
5192 
5193 /**
5194  * Set the RF Band in Wi-Fi firmware.
5195  *
5196  * \note Please call \ref wlan_set_rf_test_mode API before using this API.
5197  *
5198  * \param[in] band The bandwidth to be set in Wi-Fi firmware.
5199  *
5200  * \return WM_SUCCESS if successful otherwise failure.
5201  *
5202  */
5203 int wlan_set_rf_band(const uint8_t band);
5204 
5205 /**
5206  * Get the RF Band from Wi-Fi firmware.
5207  *
5208  * \note Please call \ref wlan_set_rf_test_mode API before using this API.
5209  *
5210  * \param[out] band A Pointer to a variable where RF Band is to be stored.
5211  *
5212  * \return WM_SUCCESS if successful otherwise failure.
5213  *
5214  */
5215 int wlan_get_rf_band(uint8_t *band);
5216 
5217 /**
5218  * Set the RF Bandwidth in Wi-Fi firmware.
5219  *
5220  * \note Please call \ref wlan_set_rf_test_mode API before using this API.
5221  *
5222  * \param[in] bandwidth The bandwidth to be set in Wi-Fi firmware.
5223  *
5224  * \return WM_SUCCESS if successful otherwise failure.
5225  *
5226  */
5227 int wlan_set_rf_bandwidth(const uint8_t bandwidth);
5228 
5229 /**
5230  * Get the RF Bandwidth from Wi-Fi firmware.
5231  *
5232  * \note Please call \ref wlan_set_rf_test_mode API before using this API.
5233  *
5234  * \param[out] bandwidth A Pointer to a variable where bandwidth to get.
5235  *
5236  * \return WM_SUCCESS if successful otherwise failure.
5237  *
5238  */
5239 int wlan_get_rf_bandwidth(uint8_t *bandwidth);
5240 
5241 /**
5242  * Get the RF PER from Wi-Fi firmware.
5243  *
5244  * \note Please call \ref wlan_set_rf_test_mode API before using this API.
5245  *
5246  * \param[out] rx_tot_pkt_count A Pointer to a variable where Rx Total packet count to get.
5247  * \param[out] rx_mcast_bcast_count A Pointer to a variable where Rx Total Multicast/Broadcast packet count to get.
5248  * \param[out] rx_pkt_fcs_error A Pointer to a variable where Rx Total packet count with FCS error to get.
5249  *
5250  * \return WM_SUCCESS if successful otherwise failure.
5251  *
5252  */
5253 int wlan_get_rf_per(uint32_t *rx_tot_pkt_count, uint32_t *rx_mcast_bcast_count, uint32_t *rx_pkt_fcs_error);
5254 
5255 /**
5256  * Set the RF Tx continuous mode in Wi-Fi firmware.
5257  *
5258  * \note Please call \ref wlan_set_rf_test_mode API before using this API.
5259  *
5260  * \param[in] enable_tx Enable Tx.
5261  * \param[in] cw_mode Set CW Mode.
5262  * \param[in] payload_pattern Set Payload Pattern.
5263  * \param[in] cs_mode Set CS Mode.
5264  * \param[in] act_sub_ch Act Sub Ch
5265  * \param[in] tx_rate Set Tx Rate.
5266  *
5267  * \return WM_SUCCESS if successful otherwise failure.
5268  *
5269  */
5270 int wlan_set_rf_tx_cont_mode(const uint32_t enable_tx,
5271                              const uint32_t cw_mode,
5272                              const uint32_t payload_pattern,
5273                              const uint32_t cs_mode,
5274                              const uint32_t act_sub_ch,
5275                              const uint32_t tx_rate);
5276 
5277 /**
5278  * Set the RF HE TB TX in Wi-Fi firmware.
5279  *
5280  * \note Please call \ref wlan_set_rf_test_mode API before using this API.
5281  *
5282  * \param[in] enable Enable/Disable trigger response mode
5283  * \param[in] qnum AXQ to be used for the trigger response frame
5284  * \param[in] aid AID of the peer to which response is to be generated
5285  * \param[in] axq_mu_timer MU timer for the AXQ on which response is sent
5286  * \param[in] tx_power TxPwr to be configured for the response
5287  *
5288  * \return WM_SUCCESS if successful otherwise failure.
5289  *
5290  */
5291 int wlan_cfg_rf_he_tb_tx(uint16_t enable, uint16_t qnum, uint16_t aid, uint16_t axq_mu_timer, int16_t tx_power);
5292 
5293 /**
5294  * Set the RF Trigger Frame Config in Wi-Fi firmware.
5295  *
5296  * \note Please call \ref wlan_set_rf_test_mode API before using this API.
5297  *
5298  * \param[in] Enable_tx Enable or Disable trigger frame transmission.
5299  * \param[in] Standalone_hetb Enable or Disable Standalone HE TB support.
5300  * \param[in] FRAME_CTRL_TYPE Frame control type.
5301  * \param[in] FRAME_CTRL_SUBTYPE Frame control subtype.
5302  * \param[in] FRAME_DURATION Max Duration time.
5303  * \param[in] TriggerType Identifies the Trigger frame variant and its encoding.
5304  * \param[in] UlLen Indicates the value of the L-SIG LENGTH field of the solicited HE TB PPDU.
5305  * \param[in] MoreTF Indicates whether a subsequent Trigger frame is scheduled for transmission.
5306  * \param[in] CSRequired Required to use ED to sense the medium and to consider the medium state and the NAV in
5307  * determining whether to respond. \param[in] UlBw Indicates the bandwidth in the HE-SIG-A field of the HE TB PPDU.
5308  * \param[in] LTFType Indicates the LTF type of the HE TB PPDU response.
5309  * \param[in] LTFMode Indicates the LTF mode for an HE TB PPDU.
5310  * \param[in] LTFSymbol Indicates the number of LTF symbols present in the HE TB PPDU.
5311  * \param[in] UlSTBC Indicates the status of STBC encoding for the solicited HE TB PPDUs.
5312  * \param[in] LdpcESS Indicates the status of the LDPC extra symbol segment.
5313  * \param[in] ApTxPwr Indicates the AP’s combined transmit power at the transmit antenna connector of all the antennas
5314  * used to transmit the triggering PPDU. \param[in] PreFecPadFct Indicates the pre-FEC padding factor. \param[in]
5315  * PeDisambig Indicates PE disambiguity. \param[in] SpatialReuse Carries the values to be included in the Spatial Reuse
5316  * fields in the HE-SIG-A field of the solicited HE TB PPDUs. \param[in] Doppler Indicate that a midamble is present in
5317  * the HE TB PPDU. \param[in] HeSig2 Carries the value to be included in the Reserved field in the HE-SIG-A2 subfield of
5318  * the solicited HE TB PPDUs. \param[in] AID12 If set to 0 allocates one or more contiguous RA-RUs for associated STAs.
5319  * \param[in] RUAllocReg RUAllocReg.
5320  * \param[in] RUAlloc Identifies the size and the location of the RU.
5321  * \param[in] UlCodingType Indicates the code type of the solicited HE TB PPDU.
5322  * \param[in] UlMCS Indicates the HE-MCS of the solicited HE TB PPDU.
5323  * \param[in] UlDCM Indicates DCM of the solicited HE TB PPDU.
5324  * \param[in] SSAlloc Indicates the spatial streams of the solicited HE TB PPDU.
5325  * \param[in] UlTargetRSSI Indicates the expected receive signal power.
5326  * \param[in] MPDU_MU_SF Used for calculating the value by which the minimum MPDU start spacing is multiplied.
5327  * \param[in] TID_AL Indicates the MPDUs allowed in an A-MPDU carried in the HE TB PPDU and the maximum number of TIDs
5328  * that can be aggregated by the STA in the A-MPDU. \param[in] AC_PL Reserved. \param[in] Pref_AC Indicates the lowest
5329  * AC that is recommended for aggregation of MPDUs in the A-MPDU contained in the HE TB PPDU sent as a response to the
5330  * Trigger frame.
5331  *
5332  * \return WM_SUCCESS if successful otherwise failure.
5333  *
5334  */
5335 int wlan_rf_trigger_frame_cfg(uint32_t Enable_tx,
5336                               uint32_t Standalone_hetb,
5337                               uint8_t FRAME_CTRL_TYPE,
5338                               uint8_t FRAME_CTRL_SUBTYPE,
5339                               uint16_t FRAME_DURATION,
5340                               uint64_t TriggerType,
5341                               uint64_t UlLen,
5342                               uint64_t MoreTF,
5343                               uint64_t CSRequired,
5344                               uint64_t UlBw,
5345                               uint64_t LTFType,
5346                               uint64_t LTFMode,
5347                               uint64_t LTFSymbol,
5348                               uint64_t UlSTBC,
5349                               uint64_t LdpcESS,
5350                               uint64_t ApTxPwr,
5351                               uint64_t PreFecPadFct,
5352                               uint64_t PeDisambig,
5353                               uint64_t SpatialReuse,
5354                               uint64_t Doppler,
5355                               uint64_t HeSig2,
5356                               uint32_t AID12,
5357                               uint32_t RUAllocReg,
5358                               uint32_t RUAlloc,
5359                               uint32_t UlCodingType,
5360                               uint32_t UlMCS,
5361                               uint32_t UlDCM,
5362                               uint32_t SSAlloc,
5363                               uint8_t UlTargetRSSI,
5364                               uint8_t MPDU_MU_SF,
5365                               uint8_t TID_AL,
5366                               uint8_t AC_PL,
5367                               uint8_t Pref_AC);
5368 
5369 /**
5370  * Set the RF Tx Antenna in Wi-Fi firmware.
5371  *
5372  * \note Please call \ref wlan_set_rf_test_mode API before using this API.
5373  *
5374  * \param[in] antenna The Tx antenna to be set in Wi-Fi firmware.
5375  *
5376  * \return WM_SUCCESS if successful otherwise failure.
5377  *
5378  */
5379 int wlan_set_rf_tx_antenna(const uint8_t antenna);
5380 
5381 /**
5382  * Get the RF Tx Antenna from Wi-Fi firmware.
5383  *
5384  * \note Please call \ref wlan_set_rf_test_mode API before using this API.
5385  *
5386  * \param[out] antenna A Pointer to a variable where Tx antenna is to be stored.
5387  *
5388  * \return WM_SUCCESS if successful otherwise failure.
5389  *
5390  */
5391 int wlan_get_rf_tx_antenna(uint8_t *antenna);
5392 
5393 /**
5394  * Set the RF Rx Antenna in Wi-Fi firmware.
5395  *
5396  * \note Please call \ref wlan_set_rf_test_mode API before using this API.
5397  *
5398  * \param[in] antenna The Rx antenna to be set in Wi-Fi firmware.
5399  *
5400  * \return WM_SUCCESS if successful otherwise failure.
5401  *
5402  */
5403 int wlan_set_rf_rx_antenna(const uint8_t antenna);
5404 
5405 /**
5406  * Get the RF Rx Antenna from Wi-Fi firmware.
5407  *
5408  * \note Please call \ref wlan_set_rf_test_mode API before using this API.
5409  *
5410  * \param[out] antenna A Pointer to a variable where Rx antenna is to be stored.
5411  *
5412  * \return WM_SUCCESS if successful otherwise failure.
5413  *
5414  */
5415 int wlan_get_rf_rx_antenna(uint8_t *antenna);
5416 
5417 /**
5418  * Set the RF Tx Power in Wi-Fi firmware.
5419  *
5420  * \note Please call \ref wlan_set_rf_test_mode API before using this API.
5421  *
5422  * \param[in] power The RF Tx Power to be set in Wi-Fi firmware.
5423  *                  For RW610, 20M bandwidth max linear output power is 20db per data sheet.
5424  * \param[in] mod The modulation to be set in Wi-Fi firmware.
5425  * \param[in] path_id The Path ID to be set in Wi-Fi firmware.
5426  *
5427  * \return WM_SUCCESS if successful otherwise failure.
5428  *
5429  */
5430 int wlan_set_rf_tx_power(const uint32_t power, const uint8_t mod, const uint8_t path_id);
5431 
5432 /**
5433  * Set the RF Tx Frame in Wi-Fi firmware.
5434  *
5435  * \note Please call \ref wlan_set_rf_test_mode API before using this API.
5436  *
5437  * \param[in] enable Enable/Disable RF Tx Frame
5438  * \param[in] data_rate Rate Index corresponding to legacy/HT/VHT rates
5439  * \param[in] frame_pattern Payload Pattern
5440  * \param[in] frame_length Payload Length
5441  * \param[in] adjust_burst_sifs Enabl/Disable Adjust Burst SIFS3 Gap
5442  * \param[in] burst_sifs_in_us Burst SIFS in us
5443  * \param[in] short_preamble Enable/Disable Short Preamble
5444  * \param[in] act_sub_ch Enable/Disable Active SubChannel
5445  * \param[in] short_gi Short Guard Interval
5446  * \param[in] adv_coding Enable/Disable Adv Coding
5447  * \param[in] tx_bf Enable/Disable Beamforming
5448  * \param[in] gf_mode Enable/Disable GreenField Mode
5449  * \param[in] stbc Enable/Disable STBC
5450  * \param[in] bssid BSSID
5451  *
5452  * \return WM_SUCCESS if successful otherwise failure.
5453  *
5454  */
5455 int wlan_set_rf_tx_frame(const uint32_t enable,
5456                          const uint32_t data_rate,
5457                          const uint32_t frame_pattern,
5458                          const uint32_t frame_length,
5459                          const uint16_t adjust_burst_sifs,
5460                          const uint32_t burst_sifs_in_us,
5461                          const uint32_t short_preamble,
5462                          const uint32_t act_sub_ch,
5463                          const uint32_t short_gi,
5464                          const uint32_t adv_coding,
5465                          const uint32_t tx_bf,
5466                          const uint32_t gf_mode,
5467                          const uint32_t stbc,
5468                          const uint8_t *bssid);
5469 
5470 /**
5471  * Set the RF OTP MAC address in Wi-Fi firmware.
5472  *
5473  * \note Please call \ref wlan_set_rf_test_mode API before using this API.
5474  *
5475  * \param[in] mac A Pointer to a variable where OTP MAC address is to be stored.
5476  *
5477  * \return WM_SUCCESS if successful otherwise failure.
5478  *
5479  */
5480 int wlan_set_rf_otp_mac_addr(uint8_t *mac);
5481 
5482 /**
5483  * Get the RF OTP MAC address from Wi-Fi firmware.
5484  *
5485  * \note Please call \ref wlan_set_rf_test_mode API before using this API.
5486  *
5487  * \param[out] mac A Pointer to a variable where OTP MAC address is to be stored.
5488  *
5489  * \return WM_SUCCESS if successful otherwise failure.
5490  *
5491  */
5492 int wlan_get_rf_otp_mac_addr(uint8_t *mac);
5493 
5494 /**
5495  * Set the RF OTP cal data in Wi-Fi firmware.
5496  *
5497  * \note Please call \ref wlan_set_rf_test_mode API before using this API.
5498  *
5499  * \param[in] cal_data A Pointer to a variable where OTP cal data is to be stored.
5500  * \param[in] cal_data_len The length of OTP cal data.
5501  *
5502  * \return WM_SUCCESS if successful otherwise failure.
5503  *
5504  */
5505 int wlan_set_rf_otp_cal_data(const uint8_t *cal_data, uint32_t cal_data_len);
5506 
5507 /**
5508  * Get the RF OTP cal data from Wi-Fi firmware.
5509  *
5510  * \note Please call \ref wlan_set_rf_test_mode API before using this API.
5511  *
5512  * \param[out] cal_data A Pointer to a variable where OTP cal data is to be stored.
5513  *
5514  * \return WM_SUCCESS if successful otherwise failure.
5515  *
5516  */
5517 int wlan_get_rf_otp_cal_data(uint8_t *cal_data);
5518 #endif
5519 #if CONFIG_WIFI_FW_DEBUG
5520 /** This function registers callbacks which are used to generate FW Dump on USB
5521  * device.
5522  *
5523  * \param[in] wlan_usb_init_cb Callback to initialize usb device.
5524  * \param[in] wlan_usb_mount_cb Callback to mount usb device.
5525  * \param[in] wlan_usb_file_open_cb Callback to open file on usb device for FW dump.
5526  * \param[in] wlan_usb_file_write_cb Callback to write FW dump data to opened file.
5527  * \param[in] wlan_usb_file_close_cb Callback to close FW dump file.
5528  *
5529  */
5530 void wlan_register_fw_dump_cb(void (*wlan_usb_init_cb)(void),
5531                               int (*wlan_usb_mount_cb)(),
5532                               int (*wlan_usb_file_open_cb)(char *test_file_name),
5533                               int (*wlan_usb_file_write_cb)(uint8_t *data, size_t data_len),
5534                               int (*wlan_usb_file_close_cb)());
5535 
5536 #endif
5537 
5538 #if CONFIG_WIFI_EU_CRYPTO
5539 #define EU_CRYPTO_DATA_MAX_LENGTH  1300U
5540 #define EU_CRYPTO_KEY_MAX_LENGTH   32U
5541 #define EU_CRYPTO_KEYIV_MAX_LENGTH 32U
5542 #define EU_CRYPTO_NONCE_MAX_LENGTH 14U
5543 #define EU_CRYPTO_AAD_MAX_LENGTH   32U
5544 
5545 /** Set Crypto RC4 algorithm encrypt command param.
5546  *
5547  * \param[in] Key key
5548  * \param[in] KeyLength The maximum key length is 32.
5549  * \param[in] KeyIV KeyIV
5550  * \param[in] KeyIVLength The maximum keyIV length is 32.
5551  * \param[in] Data Data
5552  * \param[in] DataLength The maximum Data length is 1300.
5553  *
5554  * \return WM_SUCCESS if successful.
5555  * \return -WM_E_PERM if not supported.
5556  * \return -WM_FAIL if failure.
5557  *
5558  * \note If the function returns WM_SUCCESS, the data in the memory pointed to by Data is overwritten by the encrypted
5559  * data. The value of DataLength is updated to the encrypted data length. The length of the encrypted data is the same
5560  * as the origin DataLength.
5561  */
5562 int wlan_set_crypto_RC4_encrypt(
5563     const t_u8 *Key, const t_u16 KeyLength, const t_u8 *KeyIV, const t_u16 KeyIVLength, t_u8 *Data, t_u16 *DataLength);
5564 
5565 /** Set Crypto RC4 algorithm decrypt command param.
5566  *
5567  * \param[in] Key key
5568  * \param[in] KeyLength The maximum key length is 32.
5569  * \param[in] KeyIV KeyIV
5570  * \param[in] KeyIVLength The maximum keyIV length is 32.
5571  * \param[in] Data Data
5572  * \param[in] DataLength The maximum Data length is 1300.
5573  * \return WM_SUCCESS if successful.
5574  * \return -WM_E_PERM if not supported.
5575  * \return -WM_FAIL if failure.
5576  *
5577  * \note If the function returns WM_SUCCESS, the data in the memory pointed to by Data is overwritten by the decrypted
5578  * data. The value of DataLength is updated to the decrypted data length. The length of the decrypted data is the same
5579  * as the origin DataLength.
5580  */
5581 int wlan_set_crypto_RC4_decrypt(
5582     const t_u8 *Key, const t_u16 KeyLength, const t_u8 *KeyIV, const t_u16 KeyIVLength, t_u8 *Data, t_u16 *DataLength);
5583 
5584 /** Set Crypto AES_ECB algorithm encrypt command param.
5585  *
5586  * \param[in] Key key
5587  * \param[in] KeyLength The maximum key length is 32.
5588  * \param[in] KeyIV KeyIV
5589  * \param[in] KeyIVLength The maximum keyIV length is 32.
5590  * \param[in] Data Data
5591  * \param[in] DataLength The maximum Data length is 1300.
5592  * \return WM_SUCCESS if successful.
5593  * \return -WM_E_PERM if not supported.
5594  * \return -WM_FAIL if failure.
5595  *
5596  * \note If the function returns WM_SUCCESS, the data in the memory pointed to by Data is overwritten by the encrypted
5597  * data. The value of DataLength is updated to the encrypted data length. The length of the encrypted data is the same
5598  * as the origin DataLength.
5599  */
5600 int wlan_set_crypto_AES_ECB_encrypt(
5601     const t_u8 *Key, const t_u16 KeyLength, const t_u8 *KeyIV, const t_u16 KeyIVLength, t_u8 *Data, t_u16 *DataLength);
5602 
5603 /** Set Crypto AES_ECB algorithm decrypt command param.
5604  *
5605  * \param[in] Key key
5606  * \param[in] KeyLength The maximum key length is 32.
5607  * \param[in] KeyIV KeyIV
5608  * \param[in] KeyIVLength The maximum keyIV length is 32.
5609  * \param[in] Data Data
5610  * \param[in] DataLength The maximum Data length is 1300.
5611  * \return WM_SUCCESS if successful.
5612  * \return -WM_E_PERM if not supported.
5613  * \return -WM_FAIL if failure.
5614  *
5615  * \note If the function returns WM_SUCCESS, the data in the memory pointed to by Data is overwritten by the decrypted
5616  * data. The value of DataLength is updated to the decrypted data length. The length of the decrypted data is the same
5617  * as the origin DataLength.
5618  */
5619 int wlan_set_crypto_AES_ECB_decrypt(
5620     const t_u8 *Key, const t_u16 KeyLength, const t_u8 *KeyIV, const t_u16 KeyIVLength, t_u8 *Data, t_u16 *DataLength);
5621 
5622 /** Set Crypto AES_WRAP algorithm encrypt command param.
5623  *
5624  * \param[in] Key key
5625  * \param[in] KeyLength The maximum key length is 32.
5626  * \param[in] KeyIV KeyIV
5627  * \param[in] KeyIVLength The maximum keyIV length is 32.
5628  * \param[in] Data Data
5629  * \param[in] DataLength The maximum Data length is 1300.
5630  * \return WM_SUCCESS if successful.
5631  * \return -WM_E_PERM if not supported.
5632  * \return -WM_FAIL if failure.
5633  *
5634  * \note If the function returns WM_SUCCESS, the data in the memory pointed to by Data is overwritten by the encrypted
5635  * data. The value of DataLength is updated to the encrypted data length. The encrypted data is 8 bytes more than the
5636  * original data. Therefore, the address pointed to by Data needs to reserve enough space.
5637  */
5638 int wlan_set_crypto_AES_WRAP_encrypt(
5639     const t_u8 *Key, const t_u16 KeyLength, const t_u8 *KeyIV, const t_u16 KeyIVLength, t_u8 *Data, t_u16 *DataLength);
5640 
5641 /** Set Crypto AES_WRAP algorithm decrypt command param.
5642  *
5643  * \param[in] Key key
5644  * \param[in] KeyLength The maximum key length is 32.
5645  * \param[in] KeyIV KeyIV
5646  * \param[in] KeyIVLength The maximum keyIV length is 32.
5647  * \param[in] Data Data
5648  * \param[in] DataLength The maximum Data length is 1300.
5649  * \return WM_SUCCESS if successful.
5650  * \return -WM_E_PERM if not supported.
5651  * \return -WM_FAIL if failure.
5652  *
5653  * \note If the function returns WM_SUCCESS, the data in the memory pointed to by Data is overwritten by the decrypted
5654  * data. The value of DataLength is updated to the decrypted data length. The decrypted data is 8 bytes less than the
5655  * original data.
5656  */
5657 int wlan_set_crypto_AES_WRAP_decrypt(
5658     const t_u8 *Key, const t_u16 KeyLength, const t_u8 *KeyIV, const t_u16 KeyIVLength, t_u8 *Data, t_u16 *DataLength);
5659 
5660 /** Set Crypto AES_CCMP algorithm encrypt command param.
5661  *
5662  * \param[in] Key key
5663  * \param[in] KeyLength The maximum key length is 32.
5664  * \param[in] AAD AAD
5665  * \param[in] AADLength The maximum AAD length is 32.
5666  * \param[in] Nonce Nonce
5667  * \param[in] NonceLength The maximum Nonce length is 14.
5668  * \param[in] Data Data
5669  * \param[in] DataLength The maximum Data length is 1300.
5670  * \return WM_SUCCESS if successful.
5671  * \return -WM_E_PERM if not supported.
5672  * \return -WM_FAIL if failure.
5673  *
5674  * \note If the function returns WM_SUCCESS, the data in the memory pointed to by Data is overwritten by the encrypted
5675  * data. The value of DataLength is updated to the encrypted data length. The encrypted data is 8 or 16 bytes more than
5676  * the original data. Therefore, the address pointed to by Data needs to reserve enough space.
5677  */
5678 int wlan_set_crypto_AES_CCMP_encrypt(const t_u8 *Key,
5679                                      const t_u16 KeyLength,
5680                                      const t_u8 *AAD,
5681                                      const t_u16 AADLength,
5682                                      const t_u8 *Nonce,
5683                                      const t_u16 NonceLength,
5684                                      t_u8 *Data,
5685                                      t_u16 *DataLength);
5686 
5687 /** Set Crypto AES_CCMP algorithm decrypt command param.
5688  *
5689  * \param[in] Key key
5690  * \param[in] KeyLength The maximum key length is 32.
5691  * \param[in] AAD AAD
5692  * \param[in] AADLength The maximum AAD length is 32.
5693  * \param[in] Nonce Nonce
5694  * \param[in] NonceLength The maximum Nonce length is 14.
5695  * \param[in] Data Data
5696  * \param[in] DataLength The maximum Data length is 1300.
5697  * \return WM_SUCCESS if successful.
5698  * \return -WM_E_PERM if not supported.
5699  * \return -WM_FAIL if failure.
5700  *
5701  * \note If the function returns WM_SUCCESS, the data in the memory pointed to by Data is overwritten by the decrypted
5702  * data. The value of DataLength is updated to the decrypted data length. The decrypted data is 8 or 16 bytes less than
5703  * the original data.
5704  */
5705 int wlan_set_crypto_AES_CCMP_decrypt(const t_u8 *Key,
5706                                      const t_u16 KeyLength,
5707                                      const t_u8 *AAD,
5708                                      const t_u16 AADLength,
5709                                      const t_u8 *Nonce,
5710                                      const t_u16 NonceLength,
5711                                      t_u8 *Data,
5712                                      t_u16 *DataLength);
5713 
5714 /** Set Crypto AES_GCMP algorithm encrypt command param.
5715  *
5716  * \param[in] Key key
5717  * \param[in] KeyLength The maximum key length is 32.
5718  * \param[in] AAD AAD
5719  * \param[in] AADLength The maximum AAD length is 32.
5720  * \param[in] Nonce Nonce
5721  * \param[in] NonceLength The maximum Nonce length is 14.
5722  * \param[in] Data Data
5723  * \param[in] DataLength The maximum Data length is 1300.
5724  * \return WM_SUCCESS if successful.
5725  * \return -WM_E_PERM if not supported.
5726  * \return -WM_FAIL if failure.
5727  *
5728  * \note If the function returns WM_SUCCESS, the data in the memory pointed to by Data is overwritten by the encrypted
5729  * data. The value of DataLength is updated to the encrypted data length. The encrypted data is 16 bytes more than the
5730  * original data. Therefore, the address pointed to by Data needs to reserve enough space.
5731  */
5732 int wlan_set_crypto_AES_GCMP_encrypt(const t_u8 *Key,
5733                                      const t_u16 KeyLength,
5734                                      const t_u8 *AAD,
5735                                      const t_u16 AADLength,
5736                                      const t_u8 *Nonce,
5737                                      const t_u16 NonceLength,
5738                                      t_u8 *Data,
5739                                      t_u16 *DataLength);
5740 
5741 /** Set Crypto AES_CCMP algorithm decrypt command param.
5742  *
5743  * \param[in] Key key
5744  * \param[in] KeyLength The maximum key length is 32.
5745  * \param[in] AAD AAD
5746  * \param[in] AADLength The maximum AAD length is 32.
5747  * \param[in] Nonce Nonce
5748  * \param[in] NonceLength The maximum Nonce length is 14.
5749  * \param[in] Data Data
5750  * \param[in] DataLength The maximum Data length is 1300.
5751  * \return WM_SUCCESS if successful.
5752  * \return -WM_E_PERM if not supported.
5753  * \return -WM_FAIL if failure.
5754  *
5755  * \note If the function returns WM_SUCCESS, the data in the memory pointed to by Data is overwritten by the decrypted
5756  * data. The value of DataLength is updated to the decrypted data length. The decrypted data is 16 bytes less than the
5757  * original data.
5758  */
5759 int wlan_set_crypto_AES_GCMP_decrypt(const t_u8 *Key,
5760                                      const t_u16 KeyLength,
5761                                      const t_u8 *AAD,
5762                                      const t_u16 AADLength,
5763                                      const t_u8 *Nonce,
5764                                      const t_u16 NonceLength,
5765                                      t_u8 *Data,
5766                                      t_u16 *DataLength);
5767 #endif
5768 
5769 #if CONFIG_WIFI_MEM_ACCESS
5770 /** This function reads/writes adapter memory location value.
5771  *
5772  *\param[in]        action      0 -- read, 1 -- write
5773  *\param[in]        addr        Specifies the memory address that is to be read/write.
5774  *\param[in/out]    value       Value if specified, stand for write action, then that value will be written to that
5775  *offset in the specified register. Value should be specified in hexadecimal. Otherwise, it stands for read action, the
5776  *value is updated with read value.
5777  *
5778  * \return WM_SUCCESS if successful otherwise failure.
5779  */
5780 int wlan_mem_access(uint16_t action, uint32_t addr, uint32_t *value);
5781 #endif
5782 
5783 #if CONFIG_WIFI_BOOT_SLEEP
5784 /** This function get/set wlan boot sleep enable status.
5785  *
5786  *\param[in]        action      0 -- get, 1 -- set
5787  *\param[in/out]    enable      If action is get then enable value is used to store firmware returned Value otherwise it
5788  *is set in firmware.
5789  *
5790  * \return WM_SUCCESS if successful otherwise failure.
5791  */
5792 int wlan_boot_sleep(uint16_t action, uint16_t *enable);
5793 #endif
5794 
5795 /**
5796  * This function sends the host command to f/w and copies back response to caller provided buffer in case of
5797  * success Response from firmware is not parsed by this function but just copied back to the caller buffer.
5798  *
5799  *  \param[in]    cmd_buf         Buffer containing the host command with header
5800  *  \param[in]    cmd_buf_len     length of valid bytes in cmd_buf
5801  *  \param[out]   host_resp_buf        Caller provided buffer, in case of success command response is copied to this
5802  * buffer Can be same as cmd_buf \param[in]    resp_buf_len    resp_buf's allocated length \param[out]   reqd_resp_len
5803  * length of valid bytes in response buffer if successful otherwise invalid. \return                       WM_SUCCESS in
5804  * case of success. \return                       WM_E_INBIG in case cmd_buf_len is bigger than the commands that can be
5805  * handled by driver. \return                       WM_E_INSMALL in case cmd_buf_len is smaller than the minimum length.
5806  * Minimum length is atleast the length of command header. Please see Note for same. \return WM_E_OUTBIG in case the
5807  * resp_buf_len is not sufficient to copy response from firmware. reqd_resp_len is updated with the response size.
5808  *  \return                       WM_E_INVAL in case cmd_buf_len and resp_buf_len have invalid values.
5809  *  \return                       WM_E_NOMEM in case cmd_buf, resp_buf and reqd_resp_len are NULL
5810  *  \note                         Brief on the Command Header: Start 8 bytes of cmd_buf should have these values set.
5811  *                                Firmware would update resp_buf with these 8 bytes at the start.\n
5812  *                                2 bytes : Command.\n
5813  *                                2 bytes : Size.\n
5814  *                                2 bytes : Sequence number.\n
5815  *                                2 bytes : Result.\n
5816  *                                Rest of buffer length is Command/Response Body.
5817  */
5818 
5819 int wlan_send_hostcmd(
5820     const void *cmd_buf, uint32_t cmd_buf_len, void *host_resp_buf, uint32_t resp_buf_len, uint32_t *reqd_resp_len);
5821 
5822 #if CONFIG_11AX
5823 /**
5824  * This function is used to set HTC parameter.
5825  *
5826  *  \param[in]    count
5827  *  \param[in]    vht
5828  *  \param[in]    he
5829  *  \param[in]    rxNss
5830  *  \param[in]    channelWidth
5831  *  \param[in]    ulMuDisable
5832  *  \param[in]    txNSTS
5833  *  \param[in]    erSuDisable
5834  *  \param[in]    dlResoundRecomm
5835  *  \param[in]    ulMuDataDisable
5836  *
5837  * \return WM_SUCCESS if operation is successful, otherwise failure
5838  */
5839 int wlan_send_debug_htc(const uint8_t count,
5840                         const uint8_t vht,
5841                         const uint8_t he,
5842                         const uint8_t rxNss,
5843                         const uint8_t channelWidth,
5844                         const uint8_t ulMuDisable,
5845                         const uint8_t txNSTS,
5846                         const uint8_t erSuDisable,
5847                         const uint8_t dlResoundRecomm,
5848                         const uint8_t ulMuDataDisable);
5849 
5850 /**
5851  * This function is used to enable/disable HTC.
5852  *
5853  *  \param[in]    option         1 => Enable; 0 => Disable
5854  *
5855  * \return WM_SUCCESS if operation is successful, otherwise failure
5856  */
5857 int wlan_enable_disable_htc(uint8_t option);
5858 #endif
5859 
5860 #if CONFIG_11AX
5861 /**
5862  * Use this API to set the set 11AX Tx OMI.
5863  *
5864  * \param[in] interface Interface type STA or uAP.
5865  * \param[in] tx_omi value to be sent to Firmware
5866  * \param[in] tx_option value to be sent to Firmware
5867  *            1: send OMI in QoS data.
5868  * \param[in] num_data_pkts value to be sent to Firmware
5869  *            num_data_pkts is applied only if OMI is sent in QoS data frame.
5870  *            It specifies the number of consecutive data frames containing the OMI.
5871  *            Minimum value is 1
5872  *            Maximum value is 16
5873  *
5874  * \return WM_SUCCESS if operation is successful.
5875  * \return -WM_FAIL if command fails.
5876  */
5877 int wlan_set_11ax_tx_omi(const t_u8 interface, const t_u16 tx_omi, const t_u8 tx_option, const t_u8 num_data_pkts);
5878 /**
5879  * Set 802_11 AX OBSS Narrow Bandwidth RU Tolerance Time
5880  * In uplink transmission, AP sends a trigger frame to all the stations that will be involved in the upcoming
5881  *transmission, and then these stations transmit Trigger-based(TB) PPDU in response to the trigger frame. If STA
5882  *connects to AP which channel is set to 100,STA doesn't support 26 tones RU. The API should be called when station is
5883  *in disconnected state.
5884  *
5885  *
5886  * \param[in] tol_time     Valid range [1...3600]
5887  *          tolerance time is in unit of seconds.
5888  *			STA periodically check AP's beacon for ext cap bit79 (OBSS Narrow bandwidth RU in ofdma tolerance support)
5889  * 			and set 20 tone RU tolerance time if ext cap bit79 is not set
5890  *
5891  * \return WM_SUCCESS if successful otherwise failure.
5892  */
5893 int wlan_set_11ax_tol_time(const t_u32 tol_time);
5894 /**
5895  * Use this API to set the RU tx power limit.
5896  *
5897  * \param[in] rutx_pwr_cfg       11AX rutxpwr of sub-bands to be sent to Firmware.
5898  * \param[in] rutx_pwr_cfg_len   Size of rutx_pwr_cfg buffer.
5899  *
5900  * \return WM_SUCCESS if operation is successful.
5901  * \return -WM_FAIL if command fails.
5902  */
5903 int wlan_set_11ax_rutxpowerlimit(const void *rutx_pwr_cfg, uint32_t rutx_pwr_cfg_len);
5904 
5905 /**
5906  * Use this API to set the RU tx power limit by channel based approach.
5907  *
5908  * \param[in] ru_pwr_cfg       11AX rutxpwr of channels to be sent to Firmware.
5909  *
5910  * \return WM_SUCCESS if operation is successful.
5911  * \return -WM_FAIL if command fails.
5912  */
5913 int wlan_set_11ax_rutxpowerlimit_legacy(const wlan_rutxpwrlimit_t *ru_pwr_cfg);
5914 
5915 /**
5916  * Use this API to get the RU tx power limit by channel based approach.
5917  *
5918  * \param[in] ru_pwr_cfg   11AX rutxpwr of channels to be get from Firmware
5919  *
5920  * \return WM_SUCCESS if operation is successful.
5921  * \return -WM_FAIL if command fails.
5922  */
5923 int wlan_get_11ax_rutxpowerlimit_legacy(wlan_rutxpwrlimit_t *ru_pwr_cfg);
5924 
5925 /** Set 11ax config params
5926  *
5927  * \param[in, out] ax_config 11AX config parameters to be sent to Firmware
5928  *
5929  * \return WM_SUCCESS if successful otherwise failure.
5930  */
5931 int wlan_set_11ax_cfg(wlan_11ax_config_t *ax_config);
5932 
5933 /** Get default 11ax config params
5934  *
5935  * \return 11AX config parameters default array.
5936  */
5937 uint8_t *wlan_get_11ax_cfg();
5938 
5939 #if CONFIG_11AX_TWT
5940 /** Set btwt config params
5941  *
5942  * \param[in] btwt_config Broadcast TWT Setup parameters to be sent to Firmware
5943  *
5944  * \return WM_SUCCESS if successful otherwise failure.
5945  */
5946 int wlan_set_btwt_cfg(const wlan_btwt_config_t *btwt_config);
5947 
5948 /** Get btwt config params
5949  *
5950  * \return Broadcast TWT Setup parameters default config array.
5951  */
5952 uint8_t *wlan_get_btwt_cfg();
5953 
5954 /** Set twt setup config params
5955  *
5956  * \param[in] twt_setup TWT Setup parameters to be sent to Firmware
5957  *
5958  * \return WM_SUCCESS if successful otherwise failure.
5959  */
5960 int wlan_set_twt_setup_cfg(const wlan_twt_setup_config_t *twt_setup);
5961 
5962 /** Get twt setup config params
5963  *
5964  * \return TWT Setup parameters default array.
5965  */
5966 uint8_t *wlan_get_twt_setup_cfg();
5967 
5968 /** Set twt teardown config params
5969  *
5970  * \param[in] teardown_config TWT Teardown parameters sent to Firmware
5971  *
5972  * \return WM_SUCCESS if successful otherwise failure.
5973  */
5974 int wlan_set_twt_teardown_cfg(const wlan_twt_teardown_config_t *teardown_config);
5975 
5976 /** Get twt teardown config params
5977  *
5978  * \return TWT Teardown parameters default array
5979  */
5980 uint8_t *wlan_get_twt_teardown_cfg();
5981 
5982 /** Get twt report
5983  *
5984  * \param[out] twt_report TWT Report parameter.
5985  *
5986  * \return WM_SUCCESS if successful otherwise failure.
5987  */
5988 int wlan_get_twt_report(wlan_twt_report_t *twt_report);
5989 
5990 /** Twt information
5991  *
5992  * \param[out] twt_information TWT information.
5993  *
5994  * \return WM_SUCCESS if successful otherwise failure.
5995  */
5996 int wlan_twt_information(wlan_twt_information_t *twt_information);
5997 #endif /* CONFIG_11AX_TWT */
5998 
5999 #if CONFIG_MMSF
6000 /**
6001  * Set 11AX AMPDU Density config.
6002  * \param[in] enable     0 - Disbale MMSF;  1 - Enable MMSF
6003  * \param[in] Density    ampdu Density value. Default value is 0x30.
6004  * \param[in] MMSF       ampdu MMSF value. Default value is 0x6.
6005  *
6006  * \return WM_SUCCESS if successful otherwise failure.
6007  */
6008 int wlan_set_mmsf(const t_u8 enable, const t_u8 Density, const t_u8 MMSF);
6009 
6010 /**
6011  * Get 11AX AMPDU Density config.
6012  * \param[out] enable     0 - Disbale MMSF;  1 - Enable MMSF
6013  * \param[out] Density    ampdu Density value. Default value is 0x30.
6014  * \param[out] MMSF       ampdu MMSF value. Default value is 0x6.
6015  *
6016  * \return WM_SUCCESS if successful otherwise failure.
6017  */
6018 int wlan_get_mmsf(t_u8 *enable, t_u8 *Density, t_u8 *MMSF);
6019 #endif
6020 #endif /* CONFIG_11AX */
6021 
6022 #if CONFIG_WIFI_RECOVERY
6023 int wlan_recovery_test(void);
6024 #endif
6025 
6026 #if CONFIG_WIFI_CLOCKSYNC
6027 /** Set Clock Sync GPIO based TSF
6028  *
6029  * \param[in] tsf_latch Clock Sync TSF latch parameters to be sent to Firmware
6030  *
6031  * \return WM_SUCCESS if successful otherwise failure.
6032  */
6033 int wlan_set_clocksync_cfg(const wlan_clock_sync_gpio_tsf_t *tsf_latch);
6034 /** Get TSF info from firmware using GPIO latch
6035  *
6036  * \param[out] tsf_info TSF info parameter received from Firmware
6037  *
6038  * \return WM_SUCCESS if successful otherwise failure.
6039  */
6040 int wlan_get_tsf_info(wlan_tsf_info_t *tsf_info);
6041 #endif /* CONFIG_WIFI_CLOCKSYNC */
6042 
6043 #if CONFIG_HEAP_DEBUG
6044 /**
6045  * Show os mem alloc and free info.
6046  *
6047  */
6048 void wlan_show_os_mem_stat();
6049 #endif
6050 
6051 #if CONFIG_MULTI_CHAN
6052 /**
6053  * Set multi-channel status disable/enable.
6054  * \param[in]      status       multi channel status
6055  * 0-disable, 1-enable
6056  *
6057  * \return WM_SUCCESS if successful otherwise failure.
6058  */
6059 int wlan_set_multi_chan_status(const int status);
6060 
6061 /**
6062  * Get multi-channel status disable/enable.
6063  * \param[out]      status       multi channel status
6064  * 0-disable, 1-enable
6065  *
6066  * \return WM_SUCCESS if successful otherwise failure.
6067  */
6068 int wlan_get_multi_chan_status(int *status);
6069 
6070 /**
6071  * Set multi-channel config.
6072  * \param[in]      num       array length of drcs_cfg[]
6073  * \param[in] drcs_cfg  multi-channel config, maybe an array
6074  *
6075  * \return WM_SUCCESS if successful otherwise failure.
6076  */
6077 int wlan_set_drcs_cfg(const wlan_drcs_cfg_t *drcs_cfg, const int num);
6078 
6079 /**
6080  * Get multi-channel config.
6081  * \param[in]      num       array length of drcs_cfg[]
6082  * \param[out] drcs_cfg  multi-channel config, maybe an array
6083  *
6084  * \return WM_SUCCESS if successful otherwise failure.
6085  */
6086 int wlan_get_drcs_cfg(wlan_drcs_cfg_t *drcs_cfg, int num);
6087 #endif
6088 
6089 #if CONFIG_11R
6090 /**
6091  * Start FT roaming : This API is used to initiate fast BSS transition based
6092  * roaming.
6093  *
6094  * \param[in] bssid       BSSID of AP to roam
6095  * \param[in] channel     Channel of AP to roam
6096  *
6097  * \return WM_SUCCESS if successful otherwise failure.
6098  */
6099 int wlan_ft_roam(const t_u8 *bssid, const t_u8 channel);
6100 #endif
6101 
6102 /**
6103  * This API can be used to start/stop the management frame forwards
6104  * to host through datapath.
6105  *
6106  * \param[in] bss_type The interface from which management frame needs to be
6107  *            collected 0: STA, 1: uAP
6108 
6109  * \param[in] mgmt_subtype_mask     Management Subtype Mask
6110  *            If Bit X is set in mask, it means that IEEE Management Frame
6111  *            SubTyoe X is to be filtered and passed through to host.
6112  *            Bit                   Description
6113  *            [31:14]               Reserved
6114  *            [13]                  Action frame
6115  *            [12:9]                Reserved
6116  *            [8]                   Beacon
6117  *            [7:6]                 Reserved
6118  *            [5]                   Probe response
6119  *            [4]                   Probe request
6120  *            [3]                   Reassociation response
6121  *            [2]                   Reassociation request
6122  *            [1]                   Association response
6123  *            [0]                   Association request
6124  *            Support multiple bits set.
6125  *            0 = stop forward frame
6126  *            1 = start forward frame
6127  *\param[in] rx_mgmt_callback The receive callback where the received management
6128  *           frames are passed.
6129  *
6130  * \return WM_SUCCESS if operation is successful.
6131  * \return -WM_FAIL if command fails.
6132  *
6133  * \note Pass Management Subtype Mask all zero to disable all the management
6134  *       frame forward to host.
6135  */
6136 int wlan_rx_mgmt_indication(const enum wlan_bss_type bss_type,
6137                             const uint32_t mgmt_subtype_mask,
6138                             int (*rx_mgmt_callback)(const enum wlan_bss_type bss_type,
6139                                                     const wlan_mgmt_frame_t *frame,
6140                                                     const size_t len));
6141 
6142 #if CONFIG_WMM
6143 void wlan_wmm_tx_stats_dump(int bss_type);
6144 #endif
6145 
6146 #if CONFIG_SCAN_CHANNEL_GAP
6147 /**
6148  * Set scan channel gap.
6149  * \param[in] scan_chan_gap      Time gap to be used between two consecutive channels scan.
6150  *
6151  */
6152 void wlan_set_scan_channel_gap(unsigned scan_chan_gap);
6153 #endif
6154 
6155 #if CONFIG_11K
6156 /**
6157  * enable/disable host 11k feature
6158  *
6159  * \param[in] enable_11k the value of 11k configuration.
6160  * \return WM_SUCCESS if successful otherwise failure.
6161  *
6162  */
6163 int wlan_host_11k_cfg(int enable_11k);
6164 
6165 bool wlan_get_host_11k_status();
6166 int wlan_set_host_11k_status(int enable_11k);
6167 
6168 /**
6169  * host send neighbor report request
6170  *
6171  * \param[in] ssid the SSID for neighbor report
6172  * \note ssid parameter is optional
6173  * \return WM_SUCCESS if successful otherwise failure.
6174  */
6175 int wlan_host_11k_neighbor_req(const char *ssid);
6176 #endif
6177 
6178 #if CONFIG_11V
6179 /**
6180  * host send bss transition management query
6181  *
6182  * \param[in] query_reason BTM request query reason code
6183  *
6184  * \return WM_SUCCESS if successful otherwise failure.
6185  */
6186 int wlan_host_11v_bss_trans_query(t_u8 query_reason);
6187 #endif
6188 
6189 #if !CONFIG_WPA_SUPP
6190 #if CONFIG_DRIVER_MBO
6191 /**
6192  * enable/disable MBO feature
6193  *
6194  * \param[in] enable_mbo the value of mbo configuration.
6195  * \return WM_SUCCESS if successful otherwise failure.
6196  *
6197  */
6198 int wlan_host_mbo_cfg(int enable_mbo);
6199 
6200 /**
6201  * mbo channel operation preference configuration
6202  *
6203  * \param[in] ch0 channel number.
6204  * \param[in] prefer0 operation preference for ch0.
6205  * \param[in] ch1 channel number.
6206  * \param[in] prefer1 operation preference for ch1.
6207  * \return WM_SUCCESS if successful otherwise failure.
6208  */
6209 int wlan_mbo_peferch_cfg(t_u8 ch0, t_u8 pefer0, t_u8 ch1, t_u8 pefer1);
6210 #endif
6211 #endif
6212 
6213 #if (CONFIG_11MC) || (CONFIG_11AZ)
6214 /**
6215  * start or stop ftm based on the command from cli.
6216  * \param[in] action 1: start ftm  2: stop ftm.
6217  * \param[in] loop_cnt         number of ftm sessions to run repeatedly ( default:1,  0:non-stop, n>1: n times).
6218  * \param[in] mac              Mac address of the peer with whom FTM session is required.
6219  * \param[in] channel          Channel on which FTM must be started.
6220  *
6221  * \return WM_SUCCESS if successful otherwise failure.
6222  */
6223 int wlan_ftm_start_stop(const t_u16 action, const t_u8 loop_cnt, const t_u8 *mac, const t_u8 channel);
6224 
6225 /**
6226  * Config ftm protocol.
6227  * \param[in] protocol 0:Dot11mc, 1:Dot11az_ntb, 2:Dot11az_tb
6228  * \param[in] ftm_ranging_cfg      FTM ranging config
6229  *
6230  * \return WM_SUCCESS if successful otherwise failure.
6231  */
6232 int wlan_ftm_cfg(const t_u8 protocol, ranging_11az_cfg_t *ftm_ranging_cfg);
6233 
6234 int wlan_ftm_11mc_cfg(ftm_11mc_nego_cfg_t *ftm_11mc_nego_cfg);
6235 
6236 int wlan_ftm_location_cfg(location_cfg_info_t *ftm_location_cfg);
6237 
6238 int wlan_ftm_civic_cfg(location_civic_rep_t *ftm_civic_cfg);
6239 #endif
6240 
6241 #if CONFIG_WPA_SUPP
6242 #if (CONFIG_11AX && defined(CONFIG_MBO))
6243 /**
6244  * Multi Band Operation (MBO) non-preferred channels
6245  *
6246  * A space delimited list of non-preferred channels where each channel is a colon delimited list of values.
6247  *
6248  * Format:
6249  *
6250  * non_pref_chan=oper_class:chan:preference:reason
6251  * Example:
6252  *
6253  * non_pref_chan=81:5:10:2 81:1:0:2 81:9:0:2
6254  *
6255  * \param[in] non_pref_chan list of non-preferred channels.
6256  *
6257  * \return WM_SUCCESS if successful otherwise failure.
6258  */
6259 int wlan_mbo_peferch_cfg(const char *non_pref_chan);
6260 
6261 /**
6262  * MBO set Cellular Data Capabilities
6263  *
6264  * \param[in] cell_capa 1 = Cellular data connection available
6265  * 2 = Cellular data connection not available
6266  * 3 = Not cellular capable (default)
6267  *
6268  * \return WM_SUCCESS if successful otherwise failure.
6269  */
6270 int wlan_mbo_set_cell_capa(t_u8 cell_capa);
6271 
6272 /**
6273  * Optimized Connectivity Experience (OCE)
6274  *
6275  * \param[in] oce Enable OCE features
6276  * 1 = Enable OCE in non-AP STA mode (default; disabled if the driver
6277  * does not indicate support for OCE in STA mode).
6278  * 2 = Enable OCE in STA-CFON mode.
6279  *
6280  * \return WM_SUCCESS if successful otherwise failure.
6281  */
6282 int wlan_mbo_set_oce(t_u8 oce);
6283 #endif
6284 
6285 /**
6286  * Opportunistic Key Caching (also known as Proactive Key Caching) default
6287  * This parameter can be used to set the default behavior for the
6288  * proactive_key_caching parameter. By default, OKC is disabled unless enabled
6289  * with the global okc=1 parameter or with the per-network
6290  * pkc(proactive_key_caching)=1 parameter. With okc=1, OKC is enabled by default, but
6291  * can be disabled with per-network pkc(proactive_key_caching)=0 parameter.
6292  *
6293  * \param[in] okc Enable Opportunistic Key Caching
6294  *
6295  * 0 = Disable OKC (default)
6296  * 1 = Enable OKC
6297  *
6298  * \return WM_SUCCESS if successful otherwise failure.
6299  */
6300 int wlan_set_okc(t_u8 okc);
6301 
6302 /**
6303  * Dump text list of entries in PMKSA cache
6304  *
6305  * \param[out] buf Buffer to save PMKSA cache text list
6306  * \param[in] buflen length of the buffer
6307  *
6308  * \return WM_SUCCESS if successful otherwise failure.
6309  */
6310 int wlan_pmksa_list(char *buf, size_t buflen);
6311 
6312 /**
6313  * Flush PTKSA cache entries
6314  *
6315  * \return WM_SUCCESS if successful otherwise failure.
6316  */
6317 int wlan_pmksa_flush();
6318 
6319 /**
6320  * Set wpa supplicant scan interval in seconds
6321  *
6322  * \param[in] scan_int Scan interval in seconds
6323  *
6324  * \return WM_SUCCESS if successful otherwise failure.
6325  */
6326 int wlan_set_scan_interval(int scan_int);
6327 #endif
6328 
6329 #if CONFIG_1AS
6330 /**
6331  * Get correlated time
6332  *
6333  * \param[out] host time and fw time in ns
6334  *
6335  * \return WM_SUCCESS if successful otherwise failure.
6336  */
6337 int wlan_get_fw_timestamp(wlan_correlated_time_t *time);
6338 
6339 /**
6340  * start DOT1AS master state machine
6341  *
6342  * \param[in] bss_type 0: STA, 1: uAP
6343  * \param[in] peer_mac destination mac address of timing measurement frame
6344  * \param[in] num_of_tm number of timing measurement frames
6345  *
6346  * \return WM_SUCCESS if successful otherwise failure.
6347  */
6348 int wlan_start_timing_measurement(int bss_type, t_u8 *peer_mac, uint8_t num_of_tm);
6349 
6350 /**
6351  * end DOT1AS master state machine report
6352  * \param[out] info dot1as related info
6353  */
6354 void wlan_end_timing_measurement(wlan_dot1as_info_t *info);
6355 
6356 /**
6357  * request DOT1AS slave state machine
6358  *
6359  * \param[in] bss_type 0: STA, 1: uAP
6360  * \param[in] peer_mac destination mac address of timing measurement request frame
6361  * \param[in] trigger 1-start, 0-stop timing measurement procedure
6362  */
6363 void wlan_request_timing_measurement(int bss_type, t_u8 *peer_mac, t_u8 trigger);
6364 
6365 /**
6366  * report DOT1AS slave state machine info
6367  * \param[out] info dot1as related info
6368  */
6369 void wlan_report_timing_measurement(wlan_dot1as_info_t *info);
6370 #endif
6371 
6372 #if CONFIG_ECSA
6373 /**
6374  * Send the ecsa config parameter to FW.
6375  *
6376  *\param[in] block_tx      0 -- no need to block traffic,1 -- need block traffic.
6377  *\param[in] oper_class    Operating class according to IEEE std802.11 spec, refer to Annex E,
6378  *                         when 0 is used, automatically get operclass through band_width and channel.
6379  *\param[in] channel       The channel will switch to.
6380  *\param[in] switch_count  Channel switch time to send ECSA ie, unit is 110ms.
6381  *\param[in] band_width    Channel width switch to(optional), only for 5G channels.
6382  *                         Depends on the hardware capabilities, when the hardware does not support, it will
6383  *automatically downgrade. Redfinch support 20M. 0 -- 20MHZ, 1 -- 40M above, 3 -- 40M below, 4 -- 80M, 5 -- 160M
6384  *
6385  * \return WM_SUCCESS if successful otherwise failure.
6386  */
6387 int wlan_uap_set_ecsa_cfg(t_u8 block_tx, t_u8 oper_class, t_u8 channel, t_u8 switch_count, t_u8 band_width);
6388 #endif
6389 
6390 #if CONFIG_SUBSCRIBE_EVENT_SUPPORT
6391 
6392 /*Type enum definition of subscribe event*/
6393 typedef enum
6394 {
6395     /** Event Id for subscribe event rssi low */
6396     EVENT_SUB_RSSI_LOW = 0,
6397     /** Event Id for subscribe event rssi high */
6398     EVENT_SUB_RSSI_HIGH,
6399     /** Event Id for subscribe event snr low */
6400     EVENT_SUB_SNR_LOW,
6401     /** Event Id for subscribe event snr high */
6402     EVENT_SUB_SNR_HIGH,
6403     /** Event Id for subscribe event max fail */
6404     EVENT_SUB_MAX_FAIL,
6405     /** Event Id for subscribe event beacon missed */
6406     EVENT_SUB_BEACON_MISSED,
6407     /** Event Id for subscribe event data rssi low */
6408     EVENT_SUB_DATA_RSSI_LOW,
6409     /** Event Id for subscribe event data rssi high */
6410     EVENT_SUB_DATA_RSSI_HIGH,
6411     /** Event Id for subscribe event data snr low */
6412     EVENT_SUB_DATA_SNR_LOW,
6413     /** Event Id for subscribe event data snr high */
6414     EVENT_SUB_DATA_SNR_HIGH,
6415     /** Event Id for subscribe event link quality */
6416     EVENT_SUB_LINK_QUALITY,
6417     /** Event Id for subscribe event pre_beacon_lost */
6418     EVENT_SUB_PRE_BEACON_LOST,
6419     /** Fail event id */
6420     MAX_EVENT_ID,
6421 } sub_event_id;
6422 
6423 /** Type definition of wlan_ds_subscribe_evt for subscribe events */
6424 typedef wifi_ds_subscribe_evt wlan_ds_subscribe_evt;
6425 
6426 /**
6427  * Subscribe specified event from the Wi-Fi firmware. Wi-Fi firmware will report the registered event to driver upon
6428  * configured report conditions are met. \param[in] event_id event to register as per \ref sub_event_id \param[in]
6429  * thresh_value threshold value (dBm) \param[in] freq event frequency 0--report once, 1--report everytime happened, N --
6430  * report only happened > N consecutive times.
6431  */
6432 int wlan_set_subscribe_event(unsigned int event_id, unsigned int thresh_value, unsigned int freq);
6433 /**
6434  * Get all subscribed events from Wi-Fi firmware along with threshold value and report frequency.
6435  * \param[in] sub_evt A pointer to \ref wlan_ds_subscribe_evt to store the events data.
6436  */
6437 int wlan_get_subscribe_event(wlan_ds_subscribe_evt *sub_evt);
6438 /**
6439  * cancel the subscribe event to firmware
6440  * \param[in] event_id event id to clear as per \ref sub_event_id
6441  * \return WM_SUCCESS if successful otherwise failure.
6442  */
6443 int wlan_clear_subscribe_event(unsigned int event_id);
6444 /**
6445  * subscibe link quality event
6446  * \param[in] event_id event id to clear as per \ref sub_event_id
6447  * \param[in] link_snr link quality snr value
6448  * \param[in] link_snr_freq link quality snr freq
6449  * \param[in] link_rate link quality rate
6450  * \param[in] link_rate_freq link quality rate freq
6451  * \param[in] link_tx_latency link quality write lantency
6452  * \param[in] link_tx_lantency_freq link quality write lantency freq
6453  * \return WM_SUCCESS if successful otherwise failure.
6454  */
6455 int wlan_set_threshold_link_quality(unsigned int evend_id,
6456                                     unsigned int link_snr,
6457                                     unsigned int link_snr_freq,
6458                                     unsigned int link_rate,
6459                                     unsigned int link_rate_freq,
6460                                     unsigned int link_tx_latency,
6461                                     unsigned int link_tx_lantency_freq);
6462 #endif
6463 
6464 #if CONFIG_TSP
6465 /**
6466  * get TSP(Thermal Safeguard Protection) configuration.
6467  * TSP algorithm moniters PA Tj and primarily backs off data throughput.
6468  * \param[out] enable    enable/disable tsp algothrim
6469  * \param[out] back_off     power back off   [0...20]dB
6470  * \param[out] highThreshold     high threshold  [0...300]°C
6471  * \param[out] lowThreshold     low threshold   [0...300]°C
6472  *          High Threshold must be greater than Low Threshold.
6473  * \return WM_SUCCESS if successful otherwise failure.
6474  */
6475 int wlan_get_tsp_cfg(t_u16 *enable,
6476                      t_u32 *back_off,
6477                      t_u32 *highThreshold,
6478                      t_u32 *lowThreshold,
6479                      t_u32 *dutycycstep,
6480                      t_u32 *dutycycmin,
6481                      int *highthrtemp,
6482                      int *lowthrtemp,
6483                      int *currCAUTemp,
6484                      int *currRFUTemp);
6485 /**
6486  * set TSP(Thermal Safeguard Protection) configuration.
6487  * TSP algorithm moniters PA Tj and primarily backs off data throughput.
6488  * \param[in] enable    enable/disable tsp algothrim
6489  * \param[in] back_off     power back off   [0...20]dB
6490  * \param[in] highThreshold     high threshold  [0...300]°C
6491  * \param[in] lowThreshold     low threshold   [0...300]°C
6492  *          High Threshold must be greater than Low Threshold.
6493  * \return WM_SUCCESS if successful otherwise failure.
6494  */
6495 
6496 int wlan_set_tsp_cfg(t_u16 enable,
6497                      t_u32 back_off,
6498                      t_u32 highThreshold,
6499                      t_u32 lowThreshold,
6500                      t_u32 dutycycstep,
6501                      t_u32 dutycycmin,
6502                      int highthrtemp,
6503                      int lowthrtemp);
6504 #endif
6505 
6506 #if CONFIG_WIFI_REG_ACCESS
6507 /** This function reads/writes adapter registers value.
6508  *
6509  *\param[in]        type        Register type: 1 -- MAC, 2 -- BBP, 3 -- RF.
6510  *\param[in]        action      0 -- read, 1 -- write
6511  *\param[in]        offset      Specifies the offset location that is to be read/write.
6512  *\param[in/out]    value       Value if specified, stand for write action, then that value will be written to that
6513  *offset in the specified register. Value should be specified in hexadecimal. Otherwise, it stands for read action, the
6514  *value is updated with read value.
6515  *
6516  * \return WM_SUCCESS if successful otherwise failure.
6517  */
6518 int wlan_reg_access(wifi_reg_t type, uint16_t action, uint32_t offset, uint32_t *value);
6519 #endif
6520 
6521 #if CONFIG_TX_AMPDU_PROT_MODE
6522 /**
6523  * Set/Get Tx ampdu prot mode.
6524  *
6525  * \param[in, out] prot_mode    Tx ampdu prot mode
6526  * \param[in]     action       Command action
6527  *
6528  * \return WM_SUCCESS if successful otherwise failure.
6529  */
6530 int wlan_tx_ampdu_prot_mode(tx_ampdu_prot_mode_para *prot_mode, t_u16 action);
6531 #endif
6532 
6533 struct wlan_message
6534 {
6535     t_u16 id;
6536     void *data;
6537 };
6538 
6539 #if CONFIG_MEF_CFG
6540 enum wlan_mef_type
6541 {
6542     MEF_TYPE_DELETE = 0,
6543     MEF_TYPE_PING,
6544     MEF_TYPE_ARP,
6545     MEF_TYPE_MULTICAST,
6546     MEF_TYPE_IPV6_NS,
6547     MEF_TYPE_END,
6548 };
6549 /** This function set auto ARP configuration.
6550  *
6551  * \param[in] mef_action  To be 0--discard and not wake host, 1--discard and wake host 3--allow and wake host.
6552  *
6553  * \return WM_SUCCESS if successful otherwise failure.
6554  *
6555  */
6556 int wlan_mef_set_auto_arp(t_u8 mef_action);
6557 /** This function set auto ping configuration.
6558  *
6559  * \param[in] mef_action  To be 0--discard and not wake host, 1--discard and wake host 3--allow and wake host.
6560  *
6561  * \return WM_SUCCESS if successful otherwise failure.
6562  *
6563  */
6564 int wlan_mef_set_auto_ping(t_u8 mef_action);
6565 /** This function set/delete mef entries configuration.
6566  *
6567  * \param[in] type        MEF type: MEF_TYPE_DELETE, MEF_TYPE_AUTO_PING, MEF_TYPE_AUTO_ARP
6568  * \param[in] mef_action  To be 0--discard and not wake host, 1--discard and wake host 3--allow and wake host.
6569  *
6570  * \return WM_SUCCESS if the call was successful.
6571  * \return -WM_FAIL if failed.
6572  */
6573 int wlan_config_mef(int type, t_u8 mef_action);
6574 /**
6575  * Use this API to enable IPv6 Neighbor Solicitation offload in Wi-Fi firmware
6576  *
6577  * \param[in] mef_action  0--discard and not wake host, 1--discard and wake host 3--allow and wake host.
6578  *
6579  * \return WM_SUCCESS if operation is successful.
6580  * \return -WM_FAIL if command fails.
6581  */
6582 int wlan_set_ipv6_ns_mef(t_u8 mef_action);
6583 #endif
6584 
6585 #if CONFIG_CSI
6586 /**
6587  * Send the csi config parameter to FW.
6588  *
6589  *\param[in] csi_params Csi config parameter
6590  * \return WM_SUCCESS if successful otherwise failure.
6591  */
6592 int wlan_csi_cfg(wlan_csi_config_params_t *csi_params);
6593 
6594 /** This function registers callback which are used to deliver CSI data to user.
6595  *
6596  * \param[in] csi_data_recv_callback Callback to deliver CSI data and max data length is 768 bytes.
6597  * Pls save data as soon as possible in callback
6598  * Type of callback return vale is int.
6599  *
6600  *          Memory layout of buffer:
6601  *          size(byte)                         items
6602  *          2                                  buffer len[bit 0:12]
6603  *          2                                  CSI signature, 0xABCD fixed
6604  *          4                                  User defined HeaderID
6605  *          2                                  Packet info
6606  *          2                                  Frame control field for the received packet
6607  *          8                                  Timestamp when packet received
6608  *          6                                  Received Packet Destination MAC Address
6609  *          6                                  Received Packet Source MAC Address
6610  *          1                                  RSSI for antenna A
6611  *          1                                  RSSI for antenna B
6612  *          1                                  Noise floor for antenna A
6613  *          1                                  Noise floor for antenna B
6614  *          1                                  Rx signal strength above noise floor
6615  *          1                                  Channel
6616  *          2                                  user defined Chip ID
6617  *          4                                  Reserved
6618  *          4                                  CSI data length in DWORDs
6619  *                                             CSI data
6620  *
6621  * \return WM_SUCCESS if successful otherwise failure.
6622  */
6623 int wlan_register_csi_user_callback(int (*csi_data_recv_callback)(void *buffer, size_t len));
6624 
6625 /** This function unregisters callback which are used to deliver CSI data to user.
6626  *
6627  * \return  WM_SUCCESS if successful
6628  */
6629 int wlan_unregister_csi_user_callback(void);
6630 #endif
6631 
6632 #if (CONFIG_11K) || (CONFIG_11V) || (CONFIG_11R) || (CONFIG_ROAMING)
6633 /**
6634  * Use this API to set the RSSI threshold value for low RSSI event subscription.
6635  * When RSSI falls below this threshold firmware will generate the low RSSI event to driver.
6636  * This low RSSI event is used when either of CONFIG_11R, CONFIG_11K, CONFIG_11V or CONFIG_ROAMING is enabled.
6637  * NOTE: By default rssi low threshold is set at -70 dbm
6638  *
6639  * \param[in]     threshold      Threshold rssi value to be set
6640  *
6641  */
6642 void wlan_set_rssi_low_threshold(uint8_t threshold);
6643 #endif
6644 
6645 #if CONFIG_WPA_SUPP
6646 #if CONFIG_WPA_SUPP_WPS
6647 /** Generate valid PIN for WPS session.
6648  *
6649  *  This function generate PIN for WPS PIN session.
6650  *
6651  * \param[in]  pin A pointer to WPS pin to be generated.
6652  */
6653 void wlan_wps_generate_pin(uint32_t *pin);
6654 
6655 /** Start WPS PIN session.
6656  *
6657  *  This function starts WPS PIN session.
6658  *
6659  * \param[in]  pin Pin for WPS session.
6660  *
6661  * \return WM_SUCCESS if the pin entered is valid.
6662  * \return -WM_FAIL if invalid pin entered.
6663  */
6664 int wlan_start_wps_pin(const char *pin);
6665 
6666 /** Start WPS PBC session.
6667  *
6668  *  This function starts WPS PBC session.
6669  *
6670  * \return  WM_SUCCESS if successful
6671  * \return -WM_FAIL if invalid pin entered.
6672  *
6673  */
6674 int wlan_start_wps_pbc(void);
6675 
6676 /** Cancel WPS session.
6677  *
6678  *  This function cancels ongoing WPS session.
6679  *
6680  * \return  WM_SUCCESS if successful
6681  * \return -WM_FAIL if invalid pin entered.
6682  *
6683  */
6684 int wlan_wps_cancel(void);
6685 
6686 #if CONFIG_WPA_SUPP_AP
6687 /** Start WPS PIN session.
6688  *
6689  *  This function starts AP WPS PIN session.
6690  *
6691  * \param[in]  pin Pin for WPS session.
6692  *
6693  * \return WM_SUCCESS if the pin entered is valid.
6694  * \return -WM_FAIL if invalid pin entered.
6695  */
6696 int wlan_start_ap_wps_pin(const char *pin);
6697 
6698 /** Start WPS PBC session.
6699  *
6700  *  This function starts AP WPS PBC session.
6701  *
6702  * \return  WM_SUCCESS if successful
6703  * \return -WM_FAIL if invalid pin entered.
6704  *
6705  */
6706 int wlan_start_ap_wps_pbc(void);
6707 
6708 /** Cancel AP's WPS session.
6709  *
6710  *  This function cancels ongoing WPS session.
6711  *
6712  * \return  WM_SUCCESS if successful
6713  * \return -WM_FAIL if invalid pin entered.
6714  *
6715  */
6716 int wlan_wps_ap_cancel(void);
6717 #endif
6718 #endif
6719 #endif
6720 
6721 #if (CONFIG_WPA2_ENTP) || (CONFIG_WPA_SUPP_CRYPTO_ENTERPRISE)
6722 #define FILE_TYPE_NONE              0
6723 #define FILE_TYPE_ENTP_CA_CERT      1
6724 #define FILE_TYPE_ENTP_CLIENT_CERT  2
6725 #define FILE_TYPE_ENTP_CLIENT_KEY   3
6726 #define FILE_TYPE_ENTP_CA_CERT2     4
6727 #define FILE_TYPE_ENTP_CLIENT_CERT2 5
6728 #define FILE_TYPE_ENTP_CLIENT_KEY2  6
6729 
6730 #if CONFIG_WPA_SUPP_AP
6731 #define FILE_TYPE_ENTP_SERVER_CERT 8
6732 #define FILE_TYPE_ENTP_SERVER_KEY  9
6733 #define FILE_TYPE_ENTP_DH_PARAMS   10
6734 #endif
6735 
6736 /** This function specifies the enterprise certificate file
6737  *  This function must be used before adding network profile. It will store certificate data
6738  *  in "wlan" global structure. When adding new network profile, it will be get by
6739  *  wlan_get_entp_cert_files(), and put into profile security structure after mbedtls parse.
6740  *
6741  * \param[in]        cert_type   certificate file type:
6742  * 1 -- FILE_TYPE_ENTP_CA_CERT,
6743  * 2 -- FILE_TYPE_ENTP_CLIENT_CERT,
6744  * 3 -- FILE_TYPE_ENTP_CLIENT_KEY.
6745  * \param[in]        data        raw data
6746  * \param[in]        data_len    size of raw data
6747  *
6748  * \return WM_SUCCESS if successful otherwise failure.
6749  */
6750 int wlan_set_entp_cert_files(int cert_type, t_u8 *data, t_u32 data_len);
6751 
6752 /** This function get enterprise certificate data from "wlan" global structure           *
6753  * \param[in]        cert_type   certificate file type:
6754  * 1 -- FILE_TYPE_ENTP_CA_CERT,
6755  * 2 -- FILE_TYPE_ENTP_CLIENT_CERT,
6756  * 3 -- FILE_TYPE_ENTP_CLIENT_KEY.
6757  * \param[in]        data        raw data
6758  *
6759  * \return size of raw data
6760  */
6761 t_u32 wlan_get_entp_cert_files(int cert_type, t_u8 **data);
6762 
6763 /** This function free the temporary memory of enterprise certificate data
6764  *  After add new enterprise network profile, the certificate data has been parsed by mbedtls into another data, which
6765  * can be freed.
6766  *
6767  */
6768 void wlan_free_entp_cert_files(void);
6769 #endif
6770 
6771 #if CONFIG_NET_MONITOR
6772 /**
6773  * Send the net monitor config parameter to FW.
6774  *
6775  *\param[in] monitor Monitor config parameter
6776  *
6777  * \return WM_SUCCESS if successful otherwise failure.
6778  */
6779 int wlan_net_monitor_cfg(wlan_net_monitor_t *monitor);
6780 
6781 /** This function registers callback which are used to deliver monitor data to user.
6782  *
6783  * \param[in] monitor_data_recv_callback Callback to deliver monitor data and data length to user.
6784  *          Memory layout of buffer:
6785  *          offset(byte)                        items
6786  *          0                                   rssi
6787  *          1                                   802.11 mac header
6788  *          1 + 'size of 802.11 mac header'     frame body
6789  *
6790  * \return void
6791  */
6792 void wlan_register_monitor_user_callback(int (*monitor_data_recv_callback)(void *buffer, t_u16 data_len));
6793 
6794 /** This function deregisters monitor callback.
6795  *
6796  * \return void
6797  */
6798 void wlan_deregister_net_monitor_user_callback();
6799 #endif
6800 
6801 #if CONFIG_WIFI_CAPA
6802 /** Check if 11n(2G or 5G) is supported by hardware or not.
6803  *
6804  * \param[in] channel Channel number.
6805  *
6806  * \return true if 11n is supported or false if not.
6807  */
6808 uint8_t wlan_check_11n_capa(unsigned int channel);
6809 
6810 /** Check if 11ac(2G or 5G) is supported by hardware or not.
6811  *
6812  * \param[in] channel Channel number.
6813  *
6814  * \return true if 11ac is supported or false if not.
6815  */
6816 uint8_t wlan_check_11ac_capa(unsigned int channel);
6817 
6818 /** Check if 11ax(2G or 5G) is supported by hardware or not.
6819  *
6820  * \param[in] channel Channel number.
6821  *
6822  * \return true if 11ax is supported or false if not.
6823  */
6824 uint8_t wlan_check_11ax_capa(unsigned int channel);
6825 #endif
6826 
6827 #if (CONFIG_IPS)
6828 /**
6829  * Config IEEE power save mode(IPS).If the option is 1, the ips hardware listens to beacon frames after WLAN CPU enters
6830  * power save mode. When there is work needed to done by WLAN CPU, WLAN CPU will be woken up by ips hardware. \param[in]
6831  * option    0/1  disable/enable ips
6832  *
6833  * \return WM_SUCCESS if successful otherwise failure.
6834  */
6835 int wlan_set_ips(int option);
6836 #endif
6837 
6838 #ifdef STA_SUPPORT
6839 /**
6840  * Get rssi information.
6841  * \param[out] signal    rssi infomation get report buffer
6842  *
6843  * \return WM_SUCCESS if successful otherwise failure.
6844  */
6845 int wlan_get_signal_info(wlan_rssi_info_t *signal);
6846 #endif
6847 
6848 #if (CONFIG_COMPRESS_TX_PWTBL)
6849 /**
6850  * set region power table
6851  * \param[in] region_code region code
6852  * \return WM_SUCCESS if successful otherwise failure.
6853  */
6854 int wlan_set_rg_power_cfg(t_u16 region_code);
6855 #endif
6856 
6857 #if CONFIG_TURBO_MODE
6858 /**
6859  * Get Turbo mode.
6860  * \param[out] mode    turbo mode
6861  *                          0: disable turbo mode
6862  *                          1: turbo mode 1
6863  *                          2: turbo mode 2
6864  *                          3: turbo mode 3
6865  * \return WM_SUCCESS if successful otherwise failure.
6866  */
6867 int wlan_get_turbo_mode(t_u8 *mode);
6868 
6869 /**
6870  * Get UAP Turbo mode.
6871  * \param[out] mode    turbo mode
6872  *                          0: disable turbo mode
6873  *                          1: turbo mode 1
6874  *                          2: turbo mode 2
6875  *                          3: turbo mode 3
6876  * \return WM_SUCCESS if successful otherwise failure.
6877  */
6878 int wlan_get_uap_turbo_mode(t_u8 *mode);
6879 
6880 /**
6881  * Set Turbo mode.
6882  * \param[in] mode    turbo mode
6883  *                          0: disable turbo mode
6884  *                          1: turbo mode 1
6885  *                          2: turbo mode 2
6886  *                          3: turbo mode 3
6887  * \return WM_SUCCESS if successful otherwise failure.
6888  */
6889 int wlan_set_turbo_mode(t_u8 mode);
6890 
6891 /**
6892  * Set UAP Turbo mode.
6893  * \param[in] mode    turbo mode
6894  *                          0: disable turbo mode
6895  *                          1: turbo mode 1
6896  *                          2: turbo mode 2
6897  *                          3: turbo mode 3
6898  * \return WM_SUCCESS if successful otherwise failure.
6899  */
6900 int wlan_set_uap_turbo_mode(t_u8 mode);
6901 #endif
6902 
6903 /**
6904  * set ps configuration.
6905  * Currently only used to modify multiple dtim.
6906  * \param[in] multiple_dtims        num dtims, range [1,20]
6907  * \param[in] bcn_miss_timeout      becaon miss interval
6908  * \param[in] local_listen_interval local listen interval
6909  * \param[in] adhoc_wake_period     adhoc awake period
6910  * \param[in] mode                  mode - (0x01 - firmware to automatically choose PS_POLL or NULL mode,
6911  *                                          0x02 - PS_POLL,
6912  *                                          0x03 - NULL mode )
6913  * \param[in] delay_to_ps           Delay to PS in milliseconds
6914  */
6915 void wlan_set_ps_cfg(t_u16 multiple_dtims,
6916                      t_u16 bcn_miss_timeout,
6917                      t_u16 local_listen_interval,
6918                      t_u16 adhoc_wake_period,
6919                      t_u16 mode,
6920                      t_u16 delay_to_ps);
6921 
6922 #if CONFIG_CLOUD_KEEP_ALIVE
6923 /**
6924  * Save start cloud keep alive parameters
6925  *
6926  * \param[in] cloud_keep_alive    cloud keep alive information
6927  * \param[in] src_port Source port
6928  * \param[in] dst_port Destination port
6929  * \param[in] seq_number Sequence number
6930  * \param[in] ack_number Acknowledgement number
6931  * \param[in] enable Enable
6932  *
6933  * \return WM_SUCCESS if successful otherwise failure.
6934  */
6935 int wlan_save_cloud_keep_alive_params(wlan_cloud_keep_alive_t *cloud_keep_alive,
6936                                       t_u16 src_port,
6937                                       t_u16 dst_port,
6938                                       t_u32 seq_number,
6939                                       t_u32 ack_number,
6940                                       t_u8 enable);
6941 
6942 /**
6943  * Get cloud keep alive status for given destination ip and port
6944  *
6945  * \param[in] dst_ip Destination ip address
6946  * \param[in] dst_port Destination port
6947  *
6948  * \return 1 if enabled otherwise 0.
6949  */
6950 int wlan_cloud_keep_alive_enabled(t_u32 dst_ip, t_u16 dst_port);
6951 
6952 /**
6953  * Start cloud keep alive
6954  *
6955  * \return WM_SUCCESS if successful otherwise failure.
6956  */
6957 int wlan_start_cloud_keep_alive(void);
6958 /**
6959  * Stop cloud keep alive
6960  * \param[in] cloud_keep_alive    cloud keep alive information
6961  * \return WM_SUCCESS if successful otherwise failure.
6962  */
6963 int wlan_stop_cloud_keep_alive(wlan_cloud_keep_alive_t *cloud_keep_alive);
6964 #endif
6965 
6966 /**
6967  * Set country code
6968  *
6969  * \note This API should be called after WLAN is initialized
6970  * but before starting uAP interface.
6971  *
6972  * \param[in] alpha2 country code in 3 octets string, 2 octets country code and 1 octet environment
6973  *            2 octets country code supported:
6974  *            WW : World Wide Safe
6975  *            US : US FCC
6976  *            CA : IC Canada
6977  *            SG : Singapore
6978  *            EU : ETSI
6979  *            AU : Australia
6980  *            KR : Republic Of Korea
6981  *            FR : France
6982  *            JP : Japan
6983  *            CN : China
6984  *
6985  * For the third octet, STA is always 0.
6986  * For uAP environment:
6987  * All environments of the current frequency band and country (default)
6988  * alpha2[2]=0x20
6989  * Outdoor environment only
6990  * alpha2[2]=0x4f
6991  * Indoor environment only
6992  * alpha2[2]=0x49
6993  * Noncountry entity (country_code=XX)
6994  * alpha[2]=0x58
6995  * IEEE 802.11 standard Annex E table indication: 0x01 .. 0x1f
6996  * Annex E, Table E-4 (Global operating classes)
6997  * alpha[2]=0x04
6998  *
6999  * \return WM_SUCCESS if successful otherwise failure.
7000  */
7001 int wlan_set_country_code(const char *alpha2);
7002 
7003 /** Set ignore region code
7004  *
7005  * \param[in] ignore     0: Don't ignore 1: ignore
7006  * \return WM_SUCCESS if successful otherwise failure.
7007  */
7008 int wlan_set_country_ie_ignore(uint8_t *ignore);
7009 
7010 /** Set region code
7011  *
7012  * \param[in] region_code
7013  * \return WM_SUCCESS if successful otherwise failure.
7014  */
7015 int wlan_set_region_code(unsigned int region_code);
7016 
7017 /** Get region code
7018  *
7019  * \param[out] region_code pointer
7020  * \return WM_SUCCESS if successful otherwise failure.
7021  */
7022 int wlan_get_region_code(unsigned int *region_code);
7023 
7024 const chan_freq_power_t  *wlan_get_regulatory_domain(uint8_t chan_freq, int *cfp_no);
7025 
7026 /** Set STA/uAP 80211d feature enable/disable
7027  *
7028  * \param[in] bss_type 0: STA, 1: uAP
7029  * \param[in] state    0: disable, 1: enable
7030  * \return WM_SUCCESS if successful otherwise failure.
7031  */
7032 int wlan_set_11d_state(int bss_type, int state);
7033 
7034 #if CONFIG_COEX_DUTY_CYCLE
7035 /**
7036  * Set single ant duty cycle.
7037  * \param[in] enable
7038  * \param[in] nbTime
7039  * \param[in] wlanTime
7040  * \return WM_SUCCESS if successful otherwise failure.
7041  */
7042 int wlan_single_ant_duty_cycle(t_u16 enable, t_u16 nbTime, t_u16 wlanTime);
7043 
7044 /**
7045  * Set dual ant duty cycle.
7046  * \param[in] enable
7047  * \param[in] nbTime
7048  * \param[in] wlanTime
7049  * \param[in] wlanBlockTime
7050  * \return WM_SUCCESS if successful otherwise failure.
7051  */
7052 int wlan_dual_ant_duty_cycle(t_u16 enable, t_u16 nbTime, t_u16 wlanTime, t_u16 wlanBlockTime);
7053 #endif
7054 
7055 #if CONFIG_EXTERNAL_COEX_PTA
7056 /**
7057  * Set external coex pta parameters.
7058  * \param[in] coex_pta_config
7059  * \return WM_SUCCESS if successful otherwise failure.
7060  */
7061 int wlan_external_coex_pta_cfg(ext_coex_pta_cfg coex_pta_config);
7062 #endif
7063 
7064 #if CONFIG_IMD3_CFG
7065 /**
7066  * Set imd validation parameters.
7067  * \param[in] imd3_value   disable imd3: imd3_value = 0;
7068  *                         enable imd3: low 4 bits: enable, high 4 bits: isolation index.
7069  * \return WM_SUCCESS if successful otherwise failure.
7070  */
7071 int wlan_imd3_cfg(t_u8 imd3_value);
7072 #endif
7073 
7074 #if CONFIG_UAP_STA_MAC_ADDR_FILTER
7075 int wlan_host_set_sta_mac_filter(int filter_mode, int mac_count, unsigned char *mac_addr);
7076 #endif
7077 
7078 #if (CONFIG_WIFI_IND_RESET) && (CONFIG_WIFI_IND_DNLD)
7079 /**
7080  * Set GPIO independent reset configuration
7081  *
7082  * \param[in] indrst_cfg GPIO independent reset config to be sent to Firmware
7083  *
7084  * \return WM_SUCCESS if successful otherwise failure.
7085  */
7086 int wlan_set_indrst_cfg(const wifi_indrst_cfg_t *indrst_cfg);
7087 
7088 /* Get GPIO independent reset configuration
7089  *
7090  * \param[out] indrst_cfg GPIO independent reset config set in Firmware
7091  *
7092  * \return WM_SUCCESS if successful otherwise failure.
7093  */
7094 int wlan_get_indrst_cfg(wifi_indrst_cfg_t *indrst_cfg);
7095 
7096 /** Test Independent Firmware reset
7097  *
7098  * This function will either send cmd that will cause timeout in firmware or
7099  * send GPIO pulse that will cause out of band reset in firmware as per configuration
7100  * int earlier \ref wlan_set_indrst_cfg API.
7101  *
7102  * \return WM_SUCCESS if successful otherwise failure.
7103  */
7104 int wlan_independent_reset();
7105 
7106 #endif
7107 
7108 int wlan_set_network_ip_byname(char *name, struct wlan_ip_config *ip);
7109 
7110 #if CONFIG_INACTIVITY_TIMEOUT_EXT
7111 /**
7112  * Get/Set inactivity timeout extend
7113  * \param[in] inac_to
7114  * \param[in] action
7115  * \return WM_SUCCESS if successful otherwise failure.
7116  */
7117 int wlan_sta_inactivityto(wlan_inactivity_to_t *inac_to, t_u16 action);
7118 #endif
7119 
7120 #ifdef RW610
7121 /**
7122  * Get board temperature.
7123  * \return board temperature.
7124  */
7125 int32_t wlan_get_temperature(void);
7126 #endif
7127 
7128 #if CONFIG_CPU_LOADING
7129 /**
7130  * Set parameters for cpu loading test.
7131  *
7132  * \param[in]  start    0 stop test, 1 start test.
7133  * \param[in]  number   The number of cpu loading test.
7134  * \param[in]  period   The period of cpu loading test.
7135  *
7136  * \return WM_SUCCESS if successful otherwise failure.
7137  */
7138 int wlan_cpu_loading(uint8_t start, uint32_t number, uint8_t period);
7139 #endif
7140 
7141 #if CONFIG_AUTO_NULL_TX
7142 /** Configuration for auto null tx parameters from
7143  * \ref wifi_auto_null_tx_t
7144  */
7145 typedef wifi_auto_null_tx_t wlan_auto_null_tx_t;
7146 
7147 /**
7148  * Start/Stop auto tx null
7149  *
7150  * \return WM_SUCCESS if successful otherwise failure.
7151  */
7152 int wlan_auto_null_tx(wlan_auto_null_tx_t *auto_null_tx, mlan_bss_type bss_type);
7153 #endif
7154 
7155 /**
7156  * allocate a copy of a string
7157  *
7158  */
7159 char *wlan_string_dup(const char *s);
7160 
7161 /**
7162  * Get board type.
7163  *
7164  * \return board type.
7165  */
7166 uint32_t wlan_get_board_type();
7167 
7168 #if UAP_SUPPORT
7169 /**
7170  * Disconnect to sta which is connected with internal uap.
7171  *
7172  * \param[in]  sta_addr    sta mac address
7173  * \return WM_SUCCESS if successful otherwise failure.
7174  */
7175 int wlan_uap_disconnect_sta(uint8_t *sta_addr);
7176 
7177 /**
7178  * Set ageout timer for sta
7179  *
7180  * \param[in]  sta_ageout_time    sta ageout time (100ms)
7181  * \return WM_SUCCESS if successful otherwise failure.
7182  */
7183 int wlan_uap_set_sta_ageout_timer(uint32_t sta_ageout_time);
7184 #endif
7185 
7186 #if CONFIG_WIFI_NM_WPA_SUPPLICANT
7187 int wlan_supp_dpp_listen(int bss_type, int enable);
7188 #endif
7189 #endif /* __WLAN_H__ */
7190