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