1 /*
2  *  Copyright 2008-2024 NXP
3  *
4  *  SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 /** @file wifi.h
9  *
10  * @brief This file contains interface to wifi driver
11  */
12 
13 #ifndef __WIFI_H__
14 #define __WIFI_H__
15 
16 #include <wifi_config_default.h>
17 
18 #include "nxp_wifi.h"
19 
20 #if !(defined(SD8801) || defined(RW610))
21 #define CONFIG_GTK_REKEY_OFFLOAD 1
22 #endif
23 
24 #if defined(SD9177)
25 #define CONFIG_TCP_ACK_ENH 1
26 #define CONFIG_FW_VDLL     1
27 #if !CONFIG_WIFI_CAPA
28 #undef CONFIG_WIFI_CAPA
29 #define CONFIG_WIFI_CAPA 1
30 #endif
31 #endif
32 
33 #include <wifi-decl.h>
34 #include <wifi_events.h>
35 #include <osa.h>
36 #include <wmerrno.h>
37 
38 #define WIFI_NXP_EVENT_GET_WIPHY_NUM_BANDS 2
39 
40 #define WIFI_REG8(x)  (*(volatile unsigned char *)(x))
41 #define WIFI_REG16(x) (*(volatile unsigned short *)(x))
42 #define WIFI_REG32(x) (*(volatile unsigned int *)(x))
43 
44 #define WIFI_WRITE_REG8(reg, val)  (WIFI_REG8(reg) = (val))
45 #define WIFI_WRITE_REG16(reg, val) (WIFI_REG16(reg) = (val))
46 #define WIFI_WRITE_REG32(reg, val) (WIFI_REG32(reg) = (val))
47 
48 #ifdef RW610
49 #define WLAN_CAU_ENABLE_ADDR         (0x45004008U)
50 #define WLAN_CAU_TEMPERATURE_ADDR    (0x4500400CU)
51 #define WLAN_CAU_TEMPERATURE_FW_ADDR (0x41382490U)
52 #define WLAN_FW_WAKE_STATUS_ADDR     (0x40031068U)
53 #define WLAN_PMIP_TSEN_ADDR          (0x45004010U)
54 #define WLAN_V33_VSEN_ADDR           (0x45004028U)
55 #define WLAN_ADC_CTRL_ADDR           (0x45004000U)
56 #endif
57 
58 #ifdef RW610
59 #define RW610_PACKAGE_TYPE_QFN 0
60 #define RW610_PACKAGE_TYPE_CSP 1
61 #define RW610_PACKAGE_TYPE_BGA 2
62 #define RW610_PACKAGE_TYPE_WW  0x00
63 #define RW610_PACKAGE_TYPE_FCC 0x10
64 #define RW610_PACKAGE_TYPE_EU  0x30
65 #define RW610_PACKAGE_TYPE_CN  0x50
66 #define RW610_PACKAGE_TYPE_JP  0xFF
67 #endif
68 
69 #define WIFI_COMMAND_RESPONSE_WAIT_MS 20000
70 
71 #define BANDWIDTH_20MHZ 1U
72 #define BANDWIDTH_40MHZ 2U
73 #if CONFIG_11AC
74 #define BANDWIDTH_80MHZ 3U
75 #endif
76 
77 #define MAX_NUM_CHANS_IN_NBOR_RPT 6U
78 
79 /** BIT value */
80 #ifndef MBIT
81 #define MBIT(x) (((t_u32)1) << (x))
82 #endif
83 
84 #define WIFI_MGMT_DIASSOC MBIT(10)
85 #define WIFI_MGMT_AUTH    MBIT(11)
86 #define WIFI_MGMT_DEAUTH  MBIT(12)
87 /** BITMAP for Action frame */
88 #define WIFI_MGMT_ACTION MBIT(13)
89 
90 extern t_u8 wifi_tx_status;
91 extern t_u8 wifi_tx_block_cnt;
92 extern t_u8 wifi_rx_status;
93 extern t_u8 wifi_rx_block_cnt;
94 
95 extern int16_t g_bcn_nf_last;
96 extern uint8_t g_rssi;
97 extern uint16_t g_data_nf_last;
98 extern uint16_t g_data_snr_last;
99 
100 #if CONFIG_WIFI_RECOVERY
101 extern bool wifi_recovery_enable;
102 extern t_u16 wifi_recovery_cnt;
103 #endif
104 extern bool wifi_shutdown_enable;
105 
106 /** WiFi Error Code */
107 enum
108 {
109     WM_E_WIFI_ERRNO_START = MOD_ERROR_START(MOD_WIFI),
110     /** The Firmware download operation failed. */
111     WIFI_ERROR_FW_DNLD_FAILED,
112     /** The Firmware ready register not set. */
113     WIFI_ERROR_FW_NOT_READY,
114     /** The WiFi card not found. */
115     WIFI_ERROR_CARD_NOT_DETECTED,
116     /** The WiFi Firmware not found. */
117     WIFI_ERROR_FW_NOT_DETECTED,
118 #if CONFIG_XZ_DECOMPRESSION
119     /** The WiFi Firmware XZ decompression failed. */
120     WIFI_ERROR_FW_XZ_FAILED,
121 #endif
122 };
123 
124 /** WiFi driver TX/RX data status */
125 enum
126 {
127     /** Data in running status */
128     WIFI_DATA_RUNNING = 0,
129     /** Data in block status */
130     WIFI_DATA_BLOCK = 1,
131 };
132 
133 typedef enum
134 {
135     MGMT_RSN_IE = 48,
136 #if CONFIG_11K
137     MGMT_RRM_ENABLED_CAP = 70,
138 #endif
139     MGMT_VENDOR_SPECIFIC_221 = 221,
140     MGMT_WPA_IE              = MGMT_VENDOR_SPECIFIC_221,
141     MGMT_WPS_IE              = MGMT_VENDOR_SPECIFIC_221,
142     MGMT_MBO_IE              = MGMT_VENDOR_SPECIFIC_221,
143 } IEEEtypes_ElementId_t;
144 
145 typedef struct wifi_uap_client_disassoc
146 {
147     int reason_code;
148     t_u8 sta_addr[MLAN_MAC_ADDR_LENGTH];
149 } wifi_uap_client_disassoc_t;
150 
151 /**
152  * Initialize Wi-Fi driver module.
153  *
154  * Performs SDIO init, downloads Wi-Fi Firmware, creates Wi-Fi Driver
155  * and command response processor thread.
156  *
157  * Also creates mutex, and semaphores used in command and data synchronizations.
158  *
159  * \param[in] fw_start_addr address of stored Wi-Fi Firmware.
160  * \param[in] size Size of Wi-Fi Firmware.
161  *
162  * \return WM_SUCCESS on success or -WM_FAIL on error.
163  *
164  */
165 int wifi_init(const uint8_t *fw_start_addr, const size_t size);
166 
167 /**
168  * Initialize Wi-Fi driver module for FCC Certification.
169  *
170  * Performs SDIO init, downloads Wi-Fi Firmware, creates Wi-Fi Driver
171  * and command response processor thread.
172  *
173  * Also creates mutex, and semaphores used in command and data synchronizations.
174  *
175  * \param[in] fw_start_addr address of stored Manufacturing Wi-Fi Firmware.
176  * \param[in] size Size of Manufacturing Wi-Fi Firmware.
177  *
178  * \return WM_SUCCESS on success or -WM_FAIL on error.
179  *
180  */
181 int wifi_init_fcc(const uint8_t *fw_start_addr, const size_t size);
182 
183 /**
184  * Deinitialize Wi-Fi driver module.
185  *
186  * Performs SDIO deinit, send shutdown command to Wi-Fi Firmware, deletes
187  * Wi-Fi Driver and command processor thread.
188  *
189  * Also deletes mutex and semaphores used in command and data synchronizations.
190  *
191  */
192 void wifi_deinit(void);
193 #ifdef RW610
194 /**
195  * This API can be used to destroy all wifi driver tasks.
196  */
197 void wifi_destroy_wifidriver_tasks(void);
198 /**
199  * This API can be used to get IMU task lock.
200  */
201 int wifi_imu_get_task_lock(void);
202 /**
203  * This API can be used to put IMU task lock.
204  */
205 int wifi_imu_put_task_lock(void);
206 /**
207  * This API can be used to judge if wifi firmware is hang.
208  */
209 bool wifi_fw_is_hang(void);
210 /**
211  * This API can be used to send shutdown command to FW.
212  */
213 int wifi_send_shutdown_cmd(void);
214 #endif
215 /**
216  * This API can be used to set wifi driver tx status.
217  *
218  * @param[in] status Status to set for TX
219  */
220 void wifi_set_tx_status(t_u8 status);
221 
222 /**
223  * This API can be used to set wifi driver rx status.
224  *
225  * @param[in] status Status to set for RX
226  *
227  */
228 void wifi_set_rx_status(t_u8 status);
229 
230 /**
231  * This API can be used to reset mgmt_ie_index_bitmap.
232  */
233 void reset_ie_index();
234 
235 #if !CONFIG_WIFI_RX_REORDER
236 /**
237  * Register Data callback function with Wi-Fi Driver to receive
238  * DATA from SDIO.
239  *
240  * This callback function is used to send data received from Wi-Fi
241  * firmware to the networking stack.
242  *
243  * @param[in] data_input_callback Function that needs to be called
244  *
245  * @return WM_SUCCESS
246  */
247 int wifi_register_data_input_callback(void (*data_input_callback)(const uint8_t interface,
248                                                                   const uint8_t *buffer,
249                                                                   const uint16_t len));
250 
251 /** Deregister Data callback function from Wi-Fi Driver */
252 void wifi_deregister_data_input_callback(void);
253 #else
254 int wifi_register_gen_pbuf_from_data2_callback(void *(*gen_pbuf_from_data2)(t_u8 *payload,
255                                                                             t_u16 datalen,
256                                                                             void **p_payload));
257 
258 void wifi_deregister_gen_pbuf_from_data2_callback(void);
259 #endif
260 
261 #if FSL_USDHC_ENABLE_SCATTER_GATHER_TRANSFER
262 
263 int wifi_register_get_rxbuf_desc_callback(void *(*wifi_get_rxbuf_desc)(t_u16 rx_len));
264 
265 void wifi_deregister_get_rxbuf_desc_callback(void);
266 
267 #endif
268 
269 /**
270  * Register Data callback function with Wi-Fi Driver to receive
271  * processed AMSDU DATA from Wi-Fi driver.
272  *
273  * This callback function is used to send data received from Wi-Fi
274  * firmware to the networking stack.
275  *
276  * @param[in] amsdu_data_input_callback Function that needs to be called
277  *
278  * @return WM_SUCESS
279  *
280  */
281 int wifi_register_amsdu_data_input_callback(void (*amsdu_data_input_callback)(uint8_t interface,
282                                                                               uint8_t *buffer,
283                                                                               uint16_t len));
284 
285 /** Deregister Data callback function from Wi-Fi Driver */
286 void wifi_deregister_amsdu_data_input_callback(void);
287 
288 int wifi_register_deliver_packet_above_callback(void (*deliver_packet_above_callback)(void *rxpd,
289                                                                                       uint8_t interface,
290                                                                                       void *lwip_pbuf));
291 
292 void wifi_deregister_deliver_packet_above_callback(void);
293 
294 int wifi_register_wrapper_net_is_ip_or_ipv6_callback(bool (*wrapper_net_is_ip_or_ipv6_callback)(const t_u8 *buffer));
295 
296 void wifi_deregister_wrapper_net_is_ip_or_ipv6_callback(void);
297 
298 #if CONFIG_WMM
299 int wifi_add_to_bypassq(const t_u8 interface, void *pkt, t_u32 len);
300 #endif
301 
302 /**
303  * Wi-Fi Driver low level output function.
304  *
305  * Data received from upper layer is passed to Wi-Fi Driver for transmission.
306  *
307  * \param[in] interface Interface on which DATA frame will be transmitted.
308  *  0 for Station interface, 1 for uAP interface and 2 for Wi-Fi
309  *  Direct interface.
310  * \param[in] buffer A pointer pointing to DATA frame.
311  * \param[in] len Length of DATA frame.
312  * \param[in] pkt_prio Priority for.sending packet.
313  * \param[in] tid TID for tx.
314  *
315  * \return WM_SUCCESS on success or -WM_E_NOMEM if memory is not available
316  *  or -WM_E_BUSY if SDIO is busy.
317  *
318  */
319 int wifi_low_level_output(const uint8_t interface,
320                           const uint8_t *buffer,
321                           const uint16_t len
322 #if CONFIG_WMM
323                           ,
324                           uint8_t pkt_prio,
325                           uint8_t tid
326 #endif
327 );
328 
329 /**
330  * API to enable packet retries at wifi driver level.
331  *
332  * This API sets retry count which will be used by wifi driver to retry packet
333  * transmission in case there was failure in earlier attempt. Failure may
334  * happen due to SDIO write port un-availability or other failures in SDIO
335  * write operation.
336  *
337  * \note Default value of retry count is zero.
338  *
339  * \param[in] count No of retry attempts.
340  *
341  */
342 void wifi_set_packet_retry_count(const int count);
343 
344 /**
345  * This API can be used to enable AMPDU support on the go
346  * when station is a transmitter.
347  */
348 void wifi_sta_ampdu_tx_enable(void);
349 
350 /**
351  * This API can be used to disable AMPDU support on the go
352  * when station is a transmitter.
353  */
354 void wifi_sta_ampdu_tx_disable(void);
355 
356 /**
357  * This API can be used to set tid to enable AMPDU support on the go
358  * when station is a transmitter.
359  * @param[in] tid tid value
360  */
361 void wifi_sta_ampdu_tx_enable_per_tid(t_u8 tid);
362 
363 /**
364  * This API can be used to check if tid to enable AMPDU is allowed
365  * when station is a transmitter.
366  * @param[in] tid tid value
367  * @return MTRUE or MFALSE
368  */
369 t_u8 wifi_sta_ampdu_tx_enable_per_tid_is_allowed(t_u8 tid);
370 
371 /**
372  * This API can be used to enable AMPDU support on the go
373  * when station is a receiver.
374  */
375 void wifi_sta_ampdu_rx_enable(void);
376 
377 /**
378  * This API can be used to set tid to enable AMPDU support on the go
379  * when station is a receiver.
380  * @param[in] tid tid value
381  */
382 void wifi_sta_ampdu_rx_enable_per_tid(t_u8 tid);
383 
384 /**
385  * This API can be used to check if tid to enable AMPDU is allowed
386  * when station is a receiver.
387  * @param[in] tid tid value
388  * @return MTRUE or MFALSE
389  */
390 t_u8 wifi_sta_ampdu_rx_enable_per_tid_is_allowed(t_u8 tid);
391 
392 /**
393  * This API can be used to enable AMPDU support on the go
394  * when uap is a receiver.
395  */
396 void wifi_uap_ampdu_rx_enable(void);
397 
398 /**
399  * This API can be used to set tid to enable AMPDU support on the go
400  * when uap is a receiver.
401  * @param[in] tid tid value
402  */
403 void wifi_uap_ampdu_rx_enable_per_tid(t_u8 tid);
404 
405 /**
406  * This API can be used to check if tid to enable AMPDU is allowed
407  * when uap is a receiver.
408  * @param[in] tid tid value
409  * @return MTRUE or MFALSE
410  */
411 t_u8 wifi_uap_ampdu_rx_enable_per_tid_is_allowed(t_u8 tid);
412 
413 /**
414  * This API can be used to disable AMPDU support on the go
415  * when uap is a receiver.
416  */
417 void wifi_uap_ampdu_rx_disable(void);
418 
419 /**
420  * This API can be used to enable AMPDU support on the go
421  * when uap is a transmitter.
422  */
423 void wifi_uap_ampdu_tx_enable(void);
424 
425 /**
426  * This API can be used to set tid to enable AMPDU support on the go
427  * when uap is a transmitter.
428  * @param[in] tid tid value
429  */
430 void wifi_uap_ampdu_tx_enable_per_tid(t_u8 tid);
431 
432 /**
433  * This API can be used to check if tid to enable AMPDU is allowed
434  * when uap is a transmitter.
435  * @param[in] tid tid value
436  * @return MTRUE or MFALSE
437  */
438 t_u8 wifi_uap_ampdu_tx_enable_per_tid_is_allowed(t_u8 tid);
439 
440 /**
441  * This API can be used to disable AMPDU support on the go
442  * when uap is a transmitter.
443  */
444 void wifi_uap_ampdu_tx_disable(void);
445 
446 /**
447  * This API can be used to disable AMPDU support on the go
448  * when station is a receiver.
449  */
450 void wifi_sta_ampdu_rx_disable(void);
451 
452 /**
453  * Get the device sta MAC address
454  *
455  * @param[out] mac_addr Mac address
456  *
457  * @return WM_SUCESS
458  */
459 int wifi_get_device_mac_addr(wifi_mac_addr_t *mac_addr);
460 
461 /**
462  * Get the device uap MAC address
463  *
464  * @param[out] mac_addr_uap Mac address
465  *
466  * @return WM_SUCESS
467  */
468 int wifi_get_device_uap_mac_addr(wifi_mac_addr_t *mac_addr_uap);
469 
470 /**
471  * Get the cached string representation of the wlan firmware extended version.
472  *
473  * @param[in] fw_ver_ext Firmware Version Extended
474  *
475  * @return WM_SUCCESS
476  */
477 int wifi_get_device_firmware_version_ext(wifi_fw_version_ext_t *fw_ver_ext);
478 
479 /**
480  * Get the timestamp of the last command sent to the firmware
481  *
482  * @return Timestamp in millisec of the last command sent
483  */
484 unsigned wifi_get_last_cmd_sent_ms(void);
485 
486 uint32_t wifi_get_value1(void);
487 
488 uint8_t *wifi_get_outbuf(uint32_t *outbuf_len);
489 
490 #if CONFIG_WIFI_TX_PER_TRACK
491 int wifi_set_tx_pert(void *cfg, mlan_bss_type bss_type);
492 #endif
493 
494 #if CONFIG_TX_RX_HISTOGRAM
495 int wifi_set_txrx_histogram(void *cfg, t_u8 *data);
496 #endif
497 
498 #if CONFIG_ROAMING
499 int wifi_config_roaming(const int enable, uint8_t *rssi_low);
500 #endif
501 #if CONFIG_BG_SCAN
502 int wifi_config_bgscan_and_rssi(const char *ssid);
503 mlan_status wifi_stop_bgscan();
504 #endif
505 
506 /**
507  * This will update the last command sent variable value to current
508  * time. This is used for power management.
509  */
510 void wifi_update_last_cmd_sent_ms(void);
511 
512 /**
513  * Register an event queue with the wifi driver to receive events
514  *
515  * The list of events which can be received from the wifi driver are
516  * enumerated in the file wifi_events.h
517  *
518  * @param[in] event_queue The queue to which wifi driver will post events.
519  *
520  * @note Only one queue can be registered. If the registered queue needs to
521  * be changed unregister the earlier queue first.
522  *
523  * @return Standard SDK return codes
524  */
525 int wifi_register_event_queue(osa_msgq_handle_t event_queue);
526 
527 /**
528  * Unregister an event queue from the wifi driver.
529  *
530  * @param[in] event_queue The queue to which was registered earlier with
531  * the wifi driver.
532  *
533  * @return Standard SDK return codes
534  */
535 int wifi_unregister_event_queue(osa_msgq_handle_t event_queue);
536 
537 /** Get scan list
538  *
539  * @param[in] index Index
540  * @param[out] desc Descriptor of type \ref wifi_scan_result2
541  *
542  * @return WM_SUCCESS on success or error code.
543  *
544  */
545 int wifi_get_scan_result(unsigned int index, struct wifi_scan_result2 **desc);
546 
547 /**
548  * Get the count of elements in the scan list
549  *
550  * @param[in,out] count Pointer to a variable which will hold the count after
551  * this call returns
552  *
553  * @warning The count returned by this function is the current count of the
554  * elements. A scan command given to the driver or some other background
555  * event may change this count in the wifi driver. Thus when the API
556  * \ref wifi_get_scan_result is used to get individual elements of the scan
557  * list, do not assume that it will return exactly 'count' number of
558  * elements. Your application should not consider such situations as a
559  * major event.
560  *
561  * @return Standard SDK return codes.
562  */
563 int wifi_get_scan_result_count(unsigned *count);
564 
565 #if CONFIG_RX_ABORT_CFG
566 /**
567  * Set/Get Rx abort config
568  *
569  * \param[in] cfg User configurations.
570  * \param[in] action Set/Get
571  *
572  * \return WM_SUCCESS if successful otherwise failure.
573  */
574 int wifi_set_get_rx_abort_cfg(void *cfg, t_u16 action);
575 #endif
576 
577 #if CONFIG_RX_ABORT_CFG_EXT
578 /**
579  * Set/Get Rx abort config ext
580  *
581  * \param[in] cfg User configurations.
582  * \param[in] action Set/Get
583  *
584  * \return WM_SUCCESS if successful otherwise failure.
585  */
586 int wifi_set_get_rx_abort_cfg_ext(void *cfg, t_u16 action);
587 #endif
588 
589 #if CONFIG_CCK_DESENSE_CFG
590 /**
591  * Set/Get CCK Desense config
592  *
593  * \param[in] cfg User configurations.
594  * \param[in] action Set/Get
595  *
596  * \return WM_SUCCESS if successful otherwise failure.
597  */
598 int wifi_set_get_cck_desense_cfg(void *cfg, t_u16 action);
599 #endif
600 
601 #ifdef WLAN_LOW_POWER_ENABLE
602 void wifi_enable_low_pwr_mode();
603 #endif
604 
605 /** Set wifi calibration data in firmware.
606  *
607  * This function may be used to set wifi calibration data in firmware.
608  *
609  * @param[in] cdata The calibration data
610  * @param[in] clen Length of calibration data
611  *
612  */
613 void wifi_set_cal_data(const uint8_t *cdata, const unsigned int clen);
614 
615 /** Set wifi MAC address in firmware at load time.
616  *
617  * This function may be used to set wifi MAC address in firmware.
618  *
619  * @param[in] mac The new MAC Address
620  *
621  */
622 void wifi_set_mac_addr(uint8_t *mac);
623 
624 /** Set wifi MAC address in firmware at run time.
625  *
626  * This function may be used to set wifi MAC address in firmware as per passed bss type.
627  *
628  * @param[in] mac The new MAC Address
629  * @param[in] bss_type BSS Type
630  *
631  */
632 void _wifi_set_mac_addr(const uint8_t *mac, mlan_bss_type bss_type);
633 
634 #if CONFIG_WMM_UAPSD
635 int wifi_wmm_qos_cfg(t_u8 *qos_cfg, t_u8 action);
636 int wifi_sleep_period(unsigned int *sleep_period, int action);
637 #endif
638 
639 #if CONFIG_WIFI_TX_BUFF
640 /**
641  * Check whether the tx buffer size setting is reasonable.
642  *
643  * \param[in]   buf_size The tx buffer size
644  *
645  */
646 bool wifi_calibrate_tx_buf_size(uint16_t buf_size);
647 void wifi_recfg_tx_buf_size(uint16_t buf_size);
648 void _wifi_recfg_tx_buf_size(uint16_t buf_size, mlan_bss_type bss_type);
649 #endif
650 #if CONFIG_P2P
651 int wifi_register_wfd_event_queue(osa_msgq_handle_t event_queue);
652 int wifi_unregister_wfd_event_queue(osa_msgq_handle_t event_queue);
653 void wifi_wfd_event(bool peer_event, bool action_frame, void *data);
654 int wifi_wfd_start(char *ssid, int security, char *passphrase, int channel);
655 int wifi_wfd_stop(void);
656 
657 /**
658  * Returns the current STA list connected to our WFD
659  *
660  * This function gets its information after querying the firmware. It will
661  * block till the response is received from firmware or a timeout.
662  *
663  * @param[in, out] list After this call returns this points to the
664  * structure \ref sta_list_t allocated by the callee. This is variable
665  * length structure and depends on count variable inside it. <b> The caller
666  * needs to free this buffer after use.</b>. If this function is unable to
667  * get the sta list, the value of list parameter will be NULL
668  *
669  * \note The caller needs to explicitly free the buffer returned by this
670  * function.
671  *
672  * @return void
673  */
674 int wifi_wfd_bss_sta_list(sta_list_t **list);
675 
676 int wifi_get_wfd_mac_address(void);
677 int wifi_wfd_ps_inactivity_sleep_enter(unsigned int ctrl_bitmap,
678                                        unsigned int inactivity_to,
679                                        unsigned int min_sleep,
680                                        unsigned int max_sleep,
681                                        unsigned int min_awake,
682                                        unsigned int max_awake);
683 
684 int wifi_wfd_ps_inactivity_sleep_exit();
685 int wifidirectapcmd_sys_config();
686 void wifidirectcmd_config();
687 #endif
688 
689 int wifi_get_wpa_ie_in_assoc(uint8_t *wpa_ie);
690 
691 /** Add Multicast Filter by MAC Address
692  *
693  * Multicast filters should be registered with the WiFi driver for IP-level
694  * multicast addresses to work. This API allows for registration of such filters
695  * with the WiFi driver.
696  *
697  * If multicast-mapped MAC address is 00:12:23:34:45:56 then pass mac_addr as
698  * below:
699  * mac_add[0] = 0x00
700  * mac_add[1] = 0x12
701  * mac_add[2] = 0x23
702  * mac_add[3] = 0x34
703  * mac_add[4] = 0x45
704  * mac_add[5] = 0x56
705  *
706  * \param[in] mac_addr multicast mapped MAC address
707  *
708  * \return 0 on Success or else Error
709  */
710 int wifi_add_mcast_filter(uint8_t *mac_addr);
711 
712 /** Remove Multicast Filter by MAC Address
713  *
714  * This function removes multicast filters for the given multicast-mapped
715  * MAC address. If multicast-mapped MAC address is 00:12:23:34:45:56
716  * then pass mac_addr as below:
717  * mac_add[0] = 0x00
718  * mac_add[1] = 0x12
719  * mac_add[2] = 0x23
720  * mac_add[3] = 0x34
721  * mac_add[4] = 0x45
722  * mac_add[5] = 0x56
723  *
724  * \param[in] mac_addr multicast mapped MAC address
725  *
726  * \return  0 on Success or else Error
727  */
728 int wifi_remove_mcast_filter(uint8_t *mac_addr);
729 
730 /** Get Multicast Mapped Mac address from IPv4
731  *
732  * This function will generate Multicast Mapped MAC address from IPv4
733  * Multicast Mapped MAC address will be in following format:
734  * 1) Higher 24-bits filled with IANA Multicast OUI (01-00-5E)
735  * 2) 24th bit set as Zero
736  * 3) Lower 23-bits filled with IP address (ignoring higher 9bits).
737  *
738  * \param[in] ipaddr ipaddress(input)
739  * \param[in] mac_addr multicast mapped MAC address(output)
740  *
741  */
742 void wifi_get_ipv4_multicast_mac(uint32_t ipaddr, uint8_t *mac_addr);
743 
744 #if CONFIG_IPV6
745 /** Get Multicast Mapped Mac address from IPv6 address
746  *
747  * This function will generate Multicast Mapped MAC address from IPv6 address.
748  * Multicast Mapped MAC address will be in following format:
749  * 1) Higher 16-bits filled with IANA Multicast OUI (33-33)
750  * 2) Lower 32-bits filled with last 4 bytes of IPv6 address
751  *
752  * \param[in] ipaddr last 4 bytes of IPv6 address
753  * \param[in] mac_addr multicast mapped MAC address
754  *
755  */
756 void wifi_get_ipv6_multicast_mac(uint32_t ipaddr, uint8_t *mac_addr);
757 #endif /* CONFIG_IPV6 */
758 
759 #ifdef STREAM_2X2
760 int wifi_set_11n_cfg(uint16_t httxcfg);
761 int wifi_set_11ac_cfg(uint32_t vhtcap, uint16_t tx_mcs_map, uint16_t rx_mcs_map);
762 #endif
763 
764 #ifdef STREAM_2X2
765 int wifi_set_antenna(t_u8 tx_antenna, t_u8 rx_antenna);
766 #else
767 #ifndef RW610
768 int wifi_set_antenna(t_u32 ant_mode, t_u16 evaluate_time);
769 int wifi_get_antenna(t_u32 *ant_mode, t_u16 *evaluate_time, t_u16 *current_antenna);
770 #else
771 int wifi_set_antenna(t_u32 ant_mode, t_u16 evaluate_time, t_u8 evaluate_mode);
772 int wifi_get_antenna(t_u32 *ant_mode, t_u16 *evaluate_time, t_u8 *evaluate_mode, t_u16 *current_antenna);
773 #endif
774 #endif
775 
776 void wifi_process_hs_cfg_resp(t_u8 *cmd_res_buffer);
777 enum wifi_event_reason wifi_process_ps_enh_response(t_u8 *cmd_res_buffer, t_u16 *ps_event, t_u16 *action);
778 
779 typedef enum
780 {
781     REG_MAC = 1,
782     REG_BBP,
783     REG_RF,
784     REG_CAU
785 } wifi_reg_t;
786 
787 int wifi_mem_access(uint16_t action, uint32_t addr, uint32_t *value);
788 /*
789  * This function is supposed to be called after scan is complete from wlc
790  * manager.
791  */
792 void wifi_scan_process_results(void);
793 
794 /**
795  * Get the wifi region code
796  *
797  * This function will return one of the following values in the region_code
798  * variable.\n
799  * 0x10 : US FCC\n
800  * 0x20 : CANADA\n
801  * 0x30 : EU\n
802  * 0x32 : FRANCE\n
803  * 0x40 : JAPAN\n
804  * 0x41 : JAPAN\n
805  * 0x50 : China\n
806  * 0xfe : JAPAN\n
807  * 0xff : Special\n
808  *
809  * @param[out] region_code Region Code
810  *
811  * @return Standard WMSDK return codes.
812  */
813 int wifi_get_region_code(t_u32 *region_code);
814 
815 /**
816  * Set the wifi region code.
817  *
818  * This function takes one of the values from the following array.\n
819  * 0x10 : US FCC\n
820  * 0x20 : CANADA\n
821  * 0x30 : EU\n
822  * 0x32 : FRANCE\n
823  * 0x40 : JAPAN\n
824  * 0x41 : JAPAN\n
825  * 0x50 : China\n
826  * 0xfe : JAPAN\n
827  * 0xff : Special\n
828  *
829  * @param[in] region_code Region Code
830  *
831  * @return Standard WMSDK return codes.
832  */
833 int wifi_set_region_code(t_u32 region_code);
834 
835 /**
836  * Set/Get country code
837  * \param[in] alpha2 country code in 3bytes string, 2bytes country code and 1byte 0
838  *            WW : World Wide Safe
839  *            US : US FCC
840  *            CA : IC Canada
841  *            SG : Singapore
842  *            EU : ETSI
843  *            AU : Australia
844  *            KR : Republic Of Korea
845  *            FR : France
846  *            JP : Japan
847  *            CN : China
848  *
849  * \return WM_SUCCESS if successful otherwise failure.
850  */
851 int wifi_set_country_code(const char *alpha2);
852 int wifi_get_country_code(char *alpha2);
853 int wifi_set_country_ie_ignore(uint8_t *ignore);
854 
855 bool wifi_11d_is_channel_allowed(int channel);
856 wifi_sub_band_set_t *get_sub_band_from_region_code(int region_code, t_u8 *nr_sb);
857 #if CONFIG_5GHz_SUPPORT
858 wifi_sub_band_set_t *get_sub_band_from_region_code_5ghz(int region_code, t_u8 *nr_sb);
859 #endif
860 
861 int wifi_enable_11d_support();
862 int wifi_disable_11d_support();
863 
864 #ifdef OTP_CHANINFO
865 int wifi_get_fw_region_and_cfp_tables(void);
866 void wifi_free_fw_region_and_cfp_tables(void);
867 #endif
868 #if CONFIG_COMPRESS_TX_PWTBL
869 int wifi_set_region_power_cfg(const t_u8 *data, t_u16 len);
870 #endif
871 int wifi_set_txbfcap(unsigned int tx_bf_cap);
872 int wifi_set_htcapinfo(unsigned int htcapinfo);
873 int wifi_set_httxcfg(unsigned short httxcfg);
874 int wifi_get_tx_power(t_u32 *power_level);
875 int wifi_set_tx_power(t_u32 power_level);
876 int wrapper_wlan_cmd_get_hw_spec(void);
877 /* fixme: These need to be removed later after complete mlan integration */
878 void set_event_chanswann(void);
879 void clear_event_chanswann(void);
880 void wifi_set_ps_cfg(t_u16 multiple_dtims,
881                      t_u16 bcn_miss_timeout,
882                      t_u16 local_listen_interval,
883                      t_u16 adhoc_wake_period,
884                      t_u16 mode,
885                      t_u16 delay_to_ps);
886 int wifi_send_hs_cfg_cmd(mlan_bss_type interface, t_u32 ipv4_addr, t_u16 action, t_u32 conditions);
887 #if CONFIG_HOST_SLEEP
888 int wifi_cancel_host_sleep(mlan_bss_type interface);
889 #endif
890 bool wrapper_wlan_11d_support_is_enabled(void);
891 void wrapper_wlan_11d_clear_parsedtable(void);
892 void wrapper_clear_media_connected_event(void);
893 int wifi_enter_ieee_power_save(void);
894 int wifi_exit_ieee_power_save(void);
895 #if (CONFIG_WNM_PS)
896 int wifi_enter_wnm_power_save(t_u16 wnm_sleep_time);
897 int wifi_exit_wnm_power_save(void);
898 #endif
899 int wifi_enter_deepsleep_power_save(void);
900 int wifi_exit_deepsleep_power_save(void);
901 int wifi_set_power_save_mode(void);
902 int wifi_get_wakeup_reason(t_u16 *hs_wakeup_reason);
903 void send_sleep_confirm_command(mlan_bss_type interface);
904 void wifi_configure_listen_interval(int listen_interval);
905 void wifi_configure_delay_to_ps(unsigned int timeout_ms);
906 unsigned short wifi_get_listen_interval();
907 unsigned int wifi_get_delay_to_ps();
908 void wifi_configure_null_pkt_interval(unsigned int null_pkt_interval);
909 int wrapper_wifi_assoc(
910     const unsigned char *bssid, int wlan_security, bool is_wpa_tkip, unsigned int owe_trans_mode, bool is_ft);
911 bool wifi_get_xfer_pending(void);
912 void wifi_set_xfer_pending(bool xfer_val);
913 int wrapper_wlan_cmd_11n_ba_stream_timeout(void *saved_event_buff);
914 
915 int wifi_set_txratecfg(wifi_ds_rate ds_rate, mlan_bss_type bss_type);
916 int wifi_get_txratecfg(wifi_ds_rate *ds_rate, mlan_bss_type bss_type);
917 void wifi_wake_up_card(uint32_t *resp);
918 void wifi_tx_card_awake_lock(void);
919 void wifi_tx_card_awake_unlock(void);
920 #ifdef RW610
921 uint32_t wifi_get_board_type();
922 #endif
923 #if CONFIG_WPA2_ENTP
924 void wifi_scan_enable_wpa2_enterprise_ap_only();
925 #endif
926 
927 int wrapper_wlan_11d_enable(t_u32 state);
928 
929 int wifi_11h_enable(void);
930 
931 int wrapper_wlan_cmd_11n_addba_rspgen(void *saved_event_buff);
932 
933 int wrapper_wlan_cmd_11n_delba_rspgen(void *saved_event_buff);
934 
935 int wrapper_wlan_ecsa_enable(void);
936 
937 int wrapper_wlan_sta_ampdu_enable(
938 #if CONFIG_WMM
939     t_u8 tid
940 #endif
941 );
942 
943 #if CONFIG_WLAN_BRIDGE
944 /** Enable Bridge mode in WLAN firmware.
945  *
946  * \param[in] auto_link, Whether enable auto link for in-sta of bridge mode.
947  * \param[in] hidden_ssid, Whether enable hidden_ssid for in-AP of bridge mode.
948  * \param[in] cfg, Bridge configuration structure holding enable, auto_link,
949  *	      hidden_ssid, EX-AP SSID, Passphrase, Bridge SSID and Passphrase.
950  *
951  * \return WM_SUCCESS if operation is successful.
952  * \return -WM_FAIL if operation is failed.
953  */
954 int wifi_enable_bridge_mode(wifi_bridge_cfg_t *cfg);
955 
956 /** Disable Bridge mode in WLAN firmware.
957  *
958  * \return WM_SUCCESS if operation is successful.
959  * \return -WM_FAIL if operation is failed.
960  */
961 int wifi_disable_bridge_mode();
962 
963 /** Get Bridge configuration from WLAN firmware.
964  *
965  * \param[out] cfg Bridge configuration structure where EX-AP SSID,
966  *             Passphrase, Bridge SSID and Passphrase will get copied.
967  *
968  * \return WM_SUCCESS if operation is successful.
969  * \return -WM_FAIL if operation is failed.
970  */
971 int wifi_get_bridge_mode_config(wifi_bridge_cfg_t *cfg);
972 
973 /**
974  * Reconfigure TX buffer size during bridge mode operation.
975  *
976  * \param[in] buf_size Buffer size to configure.
977  *
978  * \return WM_SUCCESS if operation is successful.
979  * \return -WM_FAIL is operation is failed.
980  */
981 int wifi_config_bridge_tx_buf(uint16_t buf_size);
982 #endif
983 
984 #if CONFIG_WIFI_GET_LOG
985 /** WiFi Statistics counter */
986 typedef PACK_START struct
987 {
988     /** Multicast transmitted frame count */
989     t_u32 mcast_tx_frame;
990     /** Failure count */
991     t_u32 failed;
992     /** Retry count */
993     t_u32 retry;
994     /** Multi entry count */
995     t_u32 multi_retry;
996     /** Duplicate frame count */
997     t_u32 frame_dup;
998     /** RTS success count */
999     t_u32 rts_success;
1000     /** RTS failure count */
1001     t_u32 rts_failure;
1002     /** Ack failure count */
1003     t_u32 ack_failure;
1004     /** Rx fragmentation count */
1005     t_u32 rx_frag;
1006     /** Multicast Tx frame count */
1007     t_u32 mcast_rx_frame;
1008     /** FCS error count */
1009     t_u32 fcs_error;
1010     /** Tx frame count */
1011     t_u32 tx_frame;
1012     /** Reserved */
1013     t_u32 reserved;
1014     /** WEP ICV error count */
1015     t_u32 wep_icv_error[4];
1016     /** beacon recv count */
1017     t_u32 bcn_rcv_cnt;
1018     /** beacon miss count */
1019     t_u32 bcn_miss_cnt;
1020     /** Tx frag count */
1021     t_u32 tx_frag_cnt;
1022     /** Qos Tx frag count */
1023     t_u32 qos_tx_frag_cnt[8];
1024     /** Qos failed count */
1025     t_u32 qos_failed_cnt[8];
1026     /** Qos retry count */
1027     t_u32 qos_retry_cnt[8];
1028     /** Qos multi retry count */
1029     t_u32 qos_multi_retry_cnt[8];
1030     /** Qos frame dup count */
1031     t_u32 qos_frm_dup_cnt[8];
1032     /** Qos rts success count */
1033     t_u32 qos_rts_suc_cnt[8];
1034     /** Qos rts failure count */
1035     t_u32 qos_rts_failure_cnt[8];
1036     /** Qos ack failure count */
1037     t_u32 qos_ack_failure_cnt[8];
1038     /** Qos Rx frag count */
1039     t_u32 qos_rx_frag_cnt[8];
1040     /** Qos Tx frame count */
1041     t_u32 qos_tx_frm_cnt[8];
1042     /** Qos discarded frame count */
1043     t_u32 qos_discarded_frm_cnt[8];
1044     /** Qos mpdus Rx count */
1045     t_u32 qos_mpdus_rx_cnt[8];
1046     /** Qos retry rx count */
1047     t_u32 qos_retries_rx_cnt[8];
1048     /** CMACICV errors count */
1049     t_u32 cmacicv_errors;
1050     /** CMAC replays count */
1051     t_u32 cmac_replays;
1052     /** mgmt CCMP replays count */
1053     t_u32 mgmt_ccmp_replays;
1054     /** TKIP ICV errors count */
1055     t_u32 tkipicv_errors;
1056     /** TKIP replays count */
1057     t_u32 tkip_replays;
1058     /** CCMP decrypt errors count */
1059     t_u32 ccmp_decrypt_errors;
1060     /** CCMP replays count */
1061     t_u32 ccmp_replays;
1062     /** Tx amsdu count */
1063     t_u32 tx_amsdu_cnt;
1064     /** failed amsdu count */
1065     t_u32 failed_amsdu_cnt;
1066     /** retry amsdu count */
1067     t_u32 retry_amsdu_cnt;
1068     /** multi-retry amsdu count */
1069     t_u32 multi_retry_amsdu_cnt;
1070     /** Tx octets in amsdu count */
1071     t_u64 tx_octets_in_amsdu_cnt;
1072     /** amsdu ack failure count */
1073     t_u32 amsdu_ack_failure_cnt;
1074     /** Rx amsdu count */
1075     t_u32 rx_amsdu_cnt;
1076     /** Rx octets in amsdu count */
1077     t_u64 rx_octets_in_amsdu_cnt;
1078     /** Tx ampdu count */
1079     t_u32 tx_ampdu_cnt;
1080     /** tx mpdus in ampdu count */
1081     t_u32 tx_mpdus_in_ampdu_cnt;
1082     /** tx octets in ampdu count */
1083     t_u64 tx_octets_in_ampdu_cnt;
1084     /** ampdu Rx count */
1085     t_u32 ampdu_rx_cnt;
1086     /** mpdu in Rx ampdu count */
1087     t_u32 mpdu_in_rx_ampdu_cnt;
1088     /** Rx octets ampdu count */
1089     t_u64 rx_octets_in_ampdu_cnt;
1090     /** ampdu delimiter CRC error count */
1091     t_u32 ampdu_delimiter_crc_error_cnt;
1092     /** Rx Stuck Related Info*/
1093     /** Rx Stuck Issue count */
1094     t_u32 rx_stuck_issue_cnt[2];
1095     /** Rx Stuck Recovery count */
1096     t_u32 rx_stuck_recovery_cnt;
1097     /** Rx Stuck TSF */
1098     t_u64 rx_stuck_tsf[2];
1099     /** Tx Watchdog Recovery Related Info */
1100     /** Tx Watchdog Recovery count */
1101     t_u32 tx_watchdog_recovery_cnt;
1102     /** Tx Watchdog TSF */
1103     t_u64 tx_watchdog_tsf[2];
1104     /** Channel Switch Related Info */
1105     /** Channel Switch Announcement Sent */
1106     t_u32 channel_switch_ann_sent;
1107     /** Channel Switch State */
1108     t_u32 channel_switch_state;
1109     /** Register Class */
1110     t_u32 reg_class;
1111     /** Channel Number */
1112     t_u32 channel_number;
1113     /** Channel Switch Mode */
1114     t_u32 channel_switch_mode;
1115     /** Reset Rx Mac Recovery Count */
1116     t_u32 rx_reset_mac_recovery_cnt;
1117     /** ISR2 Not Done Count*/
1118     t_u32 rx_Isr2_NotDone_Cnt;
1119     /** GDMA Abort Count */
1120     t_u32 gdma_abort_cnt;
1121     /** Rx Reset MAC Count */
1122     t_u32 g_reset_rx_mac_cnt;
1123     // Ownership error counters
1124     /*Error Ownership error count*/
1125     t_u32 dwCtlErrCnt;
1126     /*Control Ownership error count*/
1127     t_u32 dwBcnErrCnt;
1128     /*Control Ownership error count*/
1129     t_u32 dwMgtErrCnt;
1130     /*Control Ownership error count*/
1131     t_u32 dwDatErrCnt;
1132     /*BIGTK MME good count*/
1133     t_u32 bigtk_mmeGoodCnt;
1134     /*BIGTK Replay error count*/
1135     t_u32 bigtk_replayErrCnt;
1136     /*BIGTK MIC error count*/
1137     t_u32 bigtk_micErrCnt;
1138     /*BIGTK MME not included count*/
1139     t_u32 bigtk_mmeNotFoundCnt;
1140 } PACK_END wifi_pkt_stats_t;
1141 
1142 int wifi_get_log(wifi_pkt_stats_t *stats, mlan_bss_type bss_type);
1143 #endif
1144 
1145 int wifi_set_packet_filters(wifi_flt_cfg_t *flt_cfg);
1146 
1147 int wifi_get_data_rate(wifi_ds_rate *ds_rate, mlan_bss_type bss_type);
1148 
1149 #if CONFIG_WIFI_RTS_THRESHOLD
1150 int wifi_set_rts(int rts, mlan_bss_type bss_type);
1151 #endif
1152 
1153 #if CONFIG_WIFI_FRAG_THRESHOLD
1154 int wifi_set_frag(int frag, mlan_bss_type bss_type);
1155 #endif
1156 
1157 #if CONFIG_11R
1158 bool wifi_same_ess_ft();
1159 #endif
1160 
1161 #if CONFIG_11K_OFFLOAD
1162 int wifi_11k_cfg(int enable_11k);
1163 int wifi_11k_neighbor_req();
1164 #endif
1165 
1166 #if CONFIG_11K
1167 #define BEACON_REPORT_BUF_SIZE 1400
1168 
1169 /* Reporting Detail values */
1170 enum wlan_rrm_beacon_reporting_detail
1171 {
1172     WLAN_RRM_REPORTING_DETAIL_NONE                    = 0,
1173     WLAN_RRM_REPORTING_DETAIL_AS_REQUEST              = 1,
1174     WLAN_RRM_REPORTING_DETAIL_ALL_FIELDS_AND_ELEMENTS = 2,
1175 };
1176 
1177 typedef struct _wlan_rrm_beacon_report_data
1178 {
1179     t_u8 token;
1180     t_u8 ssid[MLAN_MAX_SSID_LENGTH];
1181     t_u8 ssid_length;
1182     t_u8 bssid[MLAN_MAC_ADDR_LENGTH];
1183     t_u8 channel[MAX_CHANNEL_LIST];
1184     t_u8 channel_num;
1185     t_u8 last_ind;
1186     t_u16 duration;
1187     enum wlan_rrm_beacon_reporting_detail report_detail;
1188     t_u8 bits_field[32];
1189 } wlan_rrm_beacon_report_data;
1190 
1191 typedef struct _wlan_rrm_scan_cb_param
1192 {
1193     wlan_rrm_beacon_report_data rep_data;
1194     t_u8 dialog_tok;
1195     t_u8 dst_addr[MLAN_MAC_ADDR_LENGTH];
1196     t_u8 protect;
1197 } wlan_rrm_scan_cb_param;
1198 
1199 int wifi_host_11k_cfg(int enable_11k);
1200 
1201 int wifi_host_11k_neighbor_req(const char *ssid);
1202 #endif
1203 
1204 #if CONFIG_11V
1205 int wifi_host_11v_bss_trans_query(t_u8 query_reason);
1206 #endif
1207 
1208 #if (CONFIG_11K) || (CONFIG_11V)
1209 /* Neighbor List Mode values */
1210 enum wlan_nlist_mode
1211 {
1212 #if (CONFIG_11K)
1213     WLAN_NLIST_11K = 1,
1214 #endif
1215 #if (CONFIG_11V)
1216     WLAN_NLIST_11V           = 2,
1217     WLAN_NLIST_11V_PREFERRED = 3,
1218 #endif
1219 };
1220 
1221 #define MAX_NEIGHBOR_AP_LIMIT 6U
1222 
1223 typedef struct _wlan_rrm_neighbor_ap_t
1224 {
1225     char ssid[MLAN_MAX_SSID_LENGTH];
1226     t_u8 bssid[MLAN_MAX_SSID_LENGTH];
1227     t_u8 bssidInfo[32];
1228     int op_class;
1229     int channel;
1230     int phy_type;
1231     int freq;
1232 } wlan_rrm_neighbor_ap_t;
1233 
1234 typedef struct _wlan_neighbor_report_t
1235 {
1236     wlan_rrm_neighbor_ap_t neighbor_ap[MAX_NEIGHBOR_AP_LIMIT];
1237     int neighbor_cnt;
1238 } wlan_rrm_neighbor_report_t;
1239 
1240 typedef struct _wlan_nlist_report_param
1241 {
1242     enum wlan_nlist_mode nlist_mode;
1243     t_u8 num_channels;
1244     t_u8 channels[MAX_NUM_CHANS_IN_NBOR_RPT];
1245 #if (CONFIG_11V)
1246     t_u8 btm_mode;
1247     t_u8 bssid[MLAN_MAC_ADDR_LENGTH];
1248     t_u8 dialog_token;
1249     t_u8 dst_addr[MLAN_MAC_ADDR_LENGTH];
1250     t_u8 protect;
1251 #endif
1252 } wlan_nlist_report_param;
1253 #endif
1254 
1255 int wifi_clear_mgmt_ie(mlan_bss_type bss_type, IEEEtypes_ElementId_t index, int mgmt_bitmap_index);
1256 
1257 #if CONFIG_UAP_STA_MAC_ADDR_FILTER
1258 int wifi_set_sta_mac_filter(int filter_mode, int mac_count, unsigned char *mac_addr);
1259 #endif
1260 
1261 int wifi_set_auto_arp(t_u32 *ipv4_addr);
1262 
1263 int wifi_tcp_keep_alive(wifi_tcp_keep_alive_t *keep_alive, t_u8 *src_mac, t_u32 src_ip);
1264 
1265 #if CONFIG_CLOUD_KEEP_ALIVE
1266 int wifi_cloud_keep_alive(wifi_cloud_keep_alive_t *keep_alive, t_u16 action, t_u8 *enable);
1267 #endif
1268 
1269 #if CONFIG_HOST_SLEEP
1270 int wifi_set_packet_filters(wifi_flt_cfg_t *flt_cfg);
1271 int wakelock_get(void);
1272 int wakelock_put(void);
1273 int wakelock_isheld(void);
1274 void wifi_print_wakeup_reason(t_u16 hs_wakeup_reason);
1275 void wifi_clear_wakeup_reason(void);
1276 #endif
1277 
1278 int wifi_raw_packet_send(const t_u8 *packet, t_u32 length);
1279 
1280 int wifi_raw_packet_recv(t_u8 **data, t_u32 *pkt_type);
1281 
1282 #if CONFIG_11AX
1283 int wifi_set_11ax_tx_omi(const mlan_bss_type bss_type,
1284                          const t_u16 tx_omi,
1285                          const t_u8 tx_option,
1286                          const t_u8 num_data_pkts);
1287 int wifi_set_11ax_tol_time(const t_u32 tol_time);
1288 int wifi_set_11ax_rutxpowerlimit(const void *rutx_pwr_cfg, uint32_t rutx_pwr_cfg_len);
1289 int wifi_set_11ax_rutxpowerlimit_legacy(const wifi_rutxpwrlimit_t *ru_pwr_cfg);
1290 int wifi_get_11ax_rutxpowerlimit_legacy(wifi_rutxpwrlimit_t *ru_pwr_cfg);
1291 /** Set 11ax config params
1292  *
1293  * \param[in, out] ax_config 11AX config parameters to be sent to Firmware
1294  *
1295  * \return WM_SUCCESS if successful otherwise failure.
1296  */
1297 int wifi_set_11ax_cfg(wifi_11ax_config_t *ax_config);
1298 
1299 #if CONFIG_11AX_TWT
1300 /** Set btwt config params
1301  *
1302  * \param[in] btwt_config Broadcast TWT setup parameters to be sent to Firmware
1303  *
1304  * \return WM_SUCCESS if successful otherwise failure.
1305  */
1306 int wifi_set_btwt_cfg(const wifi_btwt_config_t *btwt_config);
1307 
1308 /** Set twt setup config params
1309  *
1310  * \param[in] twt_setup TWT Setup parameters to be sent to Firmware
1311  *
1312  * \return WM_SUCCESS if successful otherwise failure.
1313  */
1314 int wifi_set_twt_setup_cfg(const wifi_twt_setup_config_t *twt_setup);
1315 
1316 /** Set twt teardown config params
1317  *
1318  * \param[in] teardown_config TWT Teardown parameters to be sent to Firmware
1319  *
1320  * \return WM_SUCCESS if successful otherwise failure.
1321  */
1322 int wifi_set_twt_teardown_cfg(const wifi_twt_teardown_config_t *teardown_config);
1323 
1324 /** Get twt report
1325  *
1326  * \param[out] twt_report TWT Report parameters to be sent to Firmware
1327  *
1328  * \return WM_SUCCESS if successful otherwise failure.
1329  */
1330 int wifi_get_twt_report(wifi_twt_report_t *twt_report);
1331 
1332 /** Twt information
1333  *
1334  * \param[out] twt_report TWT Information
1335  *
1336  * \return WM_SUCCESS if successful otherwise failure.
1337  */
1338 int wifi_twt_information(wifi_twt_information_t *information);
1339 #endif /* CONFIG_11AX_TWT */
1340 #endif
1341 
1342 #if CONFIG_WIFI_CLOCKSYNC
1343 int wifi_set_clocksync_cfg(const wifi_clock_sync_gpio_tsf_t *tsf_latch, mlan_bss_type bss_type);
1344 int wifi_get_tsf_info(wifi_tsf_info_t *tsf_info);
1345 #endif /* CONFIG_WIFI_CLOCKSYNC */
1346 
1347 #if CONFIG_RF_TEST_MODE
1348 
1349 int wifi_set_rf_test_mode(void);
1350 
1351 int wifi_unset_rf_test_mode(void);
1352 
1353 int wifi_set_rf_channel(const uint8_t channel);
1354 
1355 int wifi_set_rf_radio_mode(const uint8_t mode);
1356 
1357 int wifi_get_rf_channel(uint8_t *channel);
1358 
1359 int wifi_get_rf_radio_mode(uint8_t *mode);
1360 
1361 int wifi_set_rf_band(const uint8_t band);
1362 
1363 int wifi_get_rf_band(uint8_t *band);
1364 
1365 int wifi_set_rf_bandwidth(const uint8_t bandwidth);
1366 
1367 int wifi_get_rf_bandwidth(uint8_t *bandwidth);
1368 
1369 int wifi_get_rf_per(uint32_t *rx_tot_pkt_count, uint32_t *rx_mcast_bcast_count, uint32_t *rx_pkt_fcs_error);
1370 
1371 int wifi_set_rf_tx_cont_mode(const uint32_t enable_tx,
1372                              const uint32_t cw_mode,
1373                              const uint32_t payload_pattern,
1374                              const uint32_t cs_mode,
1375                              const uint32_t act_sub_ch,
1376                              const uint32_t tx_rate);
1377 
1378 int wifi_set_rf_tx_antenna(const uint8_t antenna);
1379 
1380 int wifi_get_rf_tx_antenna(uint8_t *antenna);
1381 
1382 int wifi_set_rf_rx_antenna(const uint8_t antenna);
1383 
1384 int wifi_get_rf_rx_antenna(uint8_t *antenna);
1385 
1386 int wifi_set_rf_tx_power(const uint32_t power, const uint8_t mod, const uint8_t path_id);
1387 
1388 int wifi_cfg_rf_he_tb_tx(uint16_t enable, uint16_t qnum, uint16_t aid, uint16_t axq_mu_timer, int16_t tx_power);
1389 
1390 int wifi_rf_trigger_frame_cfg(uint32_t Enable_tx,
1391                               uint32_t Standalone_hetb,
1392                               uint8_t FRAME_CTRL_TYPE,
1393                               uint8_t FRAME_CTRL_SUBTYPE,
1394                               uint16_t FRAME_DURATION,
1395                               uint64_t TriggerType,
1396                               uint64_t UlLen,
1397                               uint64_t MoreTF,
1398                               uint64_t CSRequired,
1399                               uint64_t UlBw,
1400                               uint64_t LTFType,
1401                               uint64_t LTFMode,
1402                               uint64_t LTFSymbol,
1403                               uint64_t UlSTBC,
1404                               uint64_t LdpcESS,
1405                               uint64_t ApTxPwr,
1406                               uint64_t PreFecPadFct,
1407                               uint64_t PeDisambig,
1408                               uint64_t SpatialReuse,
1409                               uint64_t Doppler,
1410                               uint64_t HeSig2,
1411                               uint32_t AID12,
1412                               uint32_t RUAllocReg,
1413                               uint32_t RUAlloc,
1414                               uint32_t UlCodingType,
1415                               uint32_t UlMCS,
1416                               uint32_t UlDCM,
1417                               uint32_t SSAlloc,
1418                               uint8_t UlTargetRSSI,
1419                               uint8_t MPDU_MU_SF,
1420                               uint8_t TID_AL,
1421                               uint8_t AC_PL,
1422                               uint8_t Pref_AC);
1423 
1424 int wifi_set_rf_tx_frame(const uint32_t enable,
1425                          const uint32_t data_rate,
1426                          const uint32_t frame_pattern,
1427                          const uint32_t frame_length,
1428                          const uint16_t adjust_burst_sifs,
1429                          const uint32_t burst_sifs_in_us,
1430                          const uint32_t short_preamble,
1431                          const uint32_t act_sub_ch,
1432                          const uint32_t short_gi,
1433                          const uint32_t adv_coding,
1434                          const uint32_t tx_bf,
1435                          const uint32_t gf_mode,
1436                          const uint32_t stbc,
1437                          const uint8_t *bssid);
1438 
1439 int wifi_set_rf_otp_mac_addr(uint8_t *mac);
1440 
1441 int wifi_get_rf_otp_mac_addr(uint8_t *mac);
1442 
1443 int wifi_set_rf_otp_cal_data(const uint8_t *cal_data, uint32_t cal_data_len);
1444 
1445 int wifi_get_rf_otp_cal_data(uint8_t *cal_data);
1446 #endif
1447 #if CONFIG_WIFI_FW_DEBUG
1448 /** This function registers callbacks which are used to generate FW Dump on USB
1449  * device.
1450  *
1451  * \param[in] wifi_usb_mount_cb Callback to mount usb device.
1452  * \param[in] wifi_usb_file_open_cb Callback to open file on usb device for FW dump.
1453  * \param[in] wifi_usb_file_write_cb Callback to write FW dump data to opened file.
1454  * \param[in] wifi_usb_file_close_cb Callback to close FW dump file.
1455  *
1456  */
1457 void wifi_register_fw_dump_cb(int (*wifi_usb_mount_cb)(),
1458                               int (*wifi_usb_file_open_cb)(char *test_file_name),
1459                               int (*wifi_usb_file_write_cb)(uint8_t *data, size_t data_len),
1460                               int (*wifi_usb_file_close_cb)());
1461 #endif
1462 
1463 #if CONFIG_WMM
1464 void wifi_wmm_init();
1465 t_u32 wifi_wmm_get_pkt_prio(void *buf, t_u8 *tid);
1466 t_u8 wifi_wmm_get_packet_cnt(void);
1467 /* handle EVENT_TX_DATA_PAUSE */
1468 void wifi_handle_event_data_pause(void *data);
1469 void wifi_wmm_tx_stats_dump(int bss_type);
1470 #endif /* CONFIG_WMM */
1471 
1472 int wifi_set_rssi_low_threshold(uint8_t *low_rssi);
1473 
1474 #if CONFIG_HEAP_DEBUG
1475 /**
1476  * Show os mem alloc and free info.
1477  *
1478  */
1479 void wifi_show_os_mem_stat();
1480 #endif
1481 
1482 #if CONFIG_WPS2
1483 /**
1484  * enable/disable WPS session
1485  *
1486  * \param[in] option -- 1 is WPS session START, 0 is WPS session END
1487  *
1488  * \return WM_SUCCESS if successful otherwise failure.
1489  */
1490 int wifi_send_wps_cfg_cmd(int option);
1491 
1492 int wps_low_level_output(const uint8_t interface, const uint8_t *buf, const uint16_t len);
1493 
1494 #endif /* CONFIG_WPS2 */
1495 
1496 #if CONFIG_1AS
1497 mlan_status raw_wlan_xmit_pkt(t_u8 *buffer, t_u32 txlen, t_u8 interface, t_u32 tx_control);
1498 #endif
1499 
1500 #if CONFIG_MULTI_CHAN
1501 /**
1502  * Set multi-channel stayed time in us.
1503  *
1504  * \return WM_SUCCESS if successful otherwise failure.
1505  */
1506 int wifi_set_mc_cfg(uint32_t channel_time);
1507 
1508 /**
1509  * Get multi-channel stayed time in us.
1510  *
1511  * \return WM_SUCCESS if successful otherwise failure.
1512  */
1513 int wifi_get_mc_cfg(uint32_t *channel_time);
1514 
1515 /**
1516  * Set multi-channel status disable/enable.
1517  * \param[in]      status       status disable/enable
1518  * 0-disable, 1-enable
1519  *
1520  * \return WM_SUCCESS if successful otherwise failure.
1521  */
1522 int wifi_set_mc_policy(const int status);
1523 /**
1524  * Get multi-channel status disable/enable.
1525  *
1526  * \return status 0-disable, 1-enable.
1527  */
1528 int wifi_get_mc_policy(void);
1529 
1530 /**
1531  * Set multi-channel config.
1532  * \param[in]      num       array length of drcs_cfg[]
1533  * \param[in] 	   drcs      multi-channel config, maybe an array
1534  *
1535  * \return WM_SUCCESS if successful otherwise failure.
1536  */
1537 int wifi_set_mc_cfg_ext(const wifi_drcs_cfg_t *drcs, const int num);
1538 
1539 /**
1540  * Get multi-channel config.
1541  * \param[in]      num       array length of drcs_cfg[]
1542  * \param[out]     drcs      multi-channel config, maybe an array
1543  *
1544  * \return WM_SUCCESS if successful otherwise failure.
1545  */
1546 int wifi_get_mc_cfg_ext(wifi_drcs_cfg_t *drcs, int num);
1547 #endif
1548 
1549 /**
1550  *Frame Tx - Injecting Wireless frames from Host
1551  *
1552  * This function is used to Inject Wireless frames from application
1553  * directly.
1554  *
1555  * \note All injected frames will be sent on station interface. Application
1556  * needs minimum of 2 KBytes stack for successful operation.
1557  * Also application have to take care of allocating buffer for 802.11 Wireless
1558  * frame (Header + Data) and freeing allocated buffer. Also this
1559  * API may not work when Power Save is enabled on station interface.
1560  *
1561  * \param[in] bss_type The interface on which management frame needs to be send.
1562  * \param[in] buff Buffer holding 802.11 Wireless frame (Header + Data).
1563  * \param[in] len Length of the 802.11 Wireless frame.
1564  *
1565  * \return WM_SUCCESS on success or error code.
1566  *
1567  **/
1568 
1569 int wifi_inject_frame(const enum wlan_bss_type bss_type, const uint8_t *buff, const size_t len);
1570 
1571 int wifi_supp_inject_frame(const unsigned int bss_type, const uint8_t *buff, const size_t len);
1572 #if CONFIG_WPA_SUPP
1573 void wifi_is_wpa_supplicant_input(const uint8_t interface, const uint8_t *buffer, const uint16_t len);
1574 void wifi_wpa_supplicant_eapol_input(const uint8_t interface,
1575                                      const uint8_t *src_addr,
1576                                      const uint8_t *buffer,
1577                                      const uint16_t len);
1578 int wifi_nxp_get_wiphy(const unsigned int bss_type);
1579 int wifi_nxp_get_conn_info(uint16_t *beacon_interval, uint8_t *dtim_period, bool *twt_capable);
1580 t_u8 wifi_get_sec_channel_offset(unsigned int chan);
1581 int wifi_nxp_scan_res_get(void);
1582 int wifi_nxp_survey_res_get(void);
1583 int wifi_nxp_set_default_scan_ies(const u8 *ies, size_t ies_len);
1584 void wifi_nxp_reset_scan_flag();
1585 #endif
1586 
1587 #if CONFIG_1AS
1588 /**
1589  * Get correlated time
1590  * \param[out] host time and fw time in ns
1591  *
1592  * \return WM_SUCCESS if successful otherwise failure.
1593  */
1594 int wifi_get_fw_timestamp(wifi_correlated_time_t *time);
1595 
1596 /**
1597  * request DOT1AS slave state machine
1598  * \param[in] bss_type interface index
1599  * \param[in] peer_mac destination mac address of timing measurement request frame
1600  * \param[in] trigger 1-start, 0-stop timing measurement procedure
1601  */
1602 void wifi_request_timing_measurement(int bss_type, t_u8 *peer_mac, t_u8 trigger);
1603 
1604 /**
1605  * start DOT1AS master state machine
1606  * \param[in] bss_type interface index
1607  * \param[in] peer_mac destination mac address of timing measurement frame
1608  * \param[in] num_of_tm number of timing measurement frames
1609  *
1610  * \return WM_SUCCESS if successful otherwise failure.
1611  */
1612 int wifi_start_timing_measurement(int bss_type, t_u8 *peer_mac, uint8_t num_of_tm);
1613 
1614 /**
1615  * end DOT1AS master state machine report
1616  * \param[out] bss_type interface index
1617  */
1618 void wifi_end_timing_measurement(int bss_type);
1619 #endif
1620 #if CONFIG_DRIVER_MBO
1621 int wifi_host_mbo_cfg(int enable_mbo);
1622 int wifi_mbo_preferch_cfg(t_u8 ch0, t_u8 pefer0, t_u8 ch1, t_u8 pefer1);
1623 int wifi_mbo_send_preferch_wnm(t_u8 *src_addr, t_u8 *target_bssid, t_u8 ch0, t_u8 pefer0, t_u8 ch1, t_u8 pefer1);
1624 #endif
1625 
1626 #if CONFIG_ECSA
1627 
1628 /**
1629  * Send the ecsa config parameter to FW by TLV.
1630  *
1631  *\param[in] block_tx 0 -- no need to block traffic,1 -- need block traffic.
1632  *\param[in] oper_class Operating class according to IEEE std802.11 spec, when 0 is used, only CSA IE will be used.
1633  *\param[in] channel The channel will switch to.
1634  *\param[in] switch_count Channel switch time to send ECSA ie.
1635  *\param[in] band_width Channel width switch to(optional),only for 5G channels.
1636  *\param[in] ecsa True need to get operclass by band_width and channel, Otherwise, no need
1637  *
1638  * \return WM_SUCCESS if successful otherwise failure.
1639  */
1640 int wifi_set_ecsa_cfg(t_u8 block_tx, t_u8 oper_class, t_u8 channel, t_u8 switch_count, t_u8 band_width, t_u8 ecsa);
1641 
1642 /**
1643  * Send the ecsa config parameter to FW by action.
1644  *
1645  *\param[in] block_tx 0 -- no need to block traffic,1 -- need block traffic.
1646  *\param[in] oper_class Operating class according to IEEE std802.11 spec, when 0 is used, only CSA IE will be used.
1647  *\param[in] channel The channel will switch to.
1648  *\param[in] switch_count Channel switch time to send ECSA ie.
1649  *
1650  * \return WM_SUCCESS if successful otherwise failure.
1651  */
1652 int wifi_set_action_ecsa_cfg(t_u8 block_tx, t_u8 oper_class, t_u8 channel, t_u8 switch_count);
1653 
1654 /**
1655  * Record the ECSA blcok tx time.
1656  *
1657  *\param[in] switch_count FW expire at switch_count*beacon_period,and then switch to new_channel.
1658  *
1659  * \return void.
1660  */
1661 void set_ecsa_block_tx_time(t_u8 switch_count);
1662 
1663 /**
1664  * Get the blcok tx time when need to block traffic.
1665  *
1666  * \return blcok tx time.
1667  */
1668 t_u8 get_ecsa_block_tx_time();
1669 
1670 /**
1671  * Record whether block tx is required.
1672  *
1673  *\param[in] flag Flag is true, if block tx is required,otherwise, flag is false.
1674  *
1675  * \return void.
1676  */
1677 void set_ecsa_block_tx_flag(bool block_tx);
1678 
1679 /**
1680  * Get the block tx status.
1681  *
1682  * \return true block tx is required, false not required.
1683  */
1684 bool get_ecsa_block_tx_flag();
1685 
1686 void wifi_put_ecsa_sem(void);
1687 
1688 /** wifi_ecsa_status_control */
1689 typedef struct _wifi_ecsa_status_control
1690 {
1691     /** block tx required*/
1692     bool required;
1693     /** block time of one detect period*/
1694     t_u8 block_time;
1695     /** Semaphore to wait ECSA complete */
1696     OSA_SEMAPHORE_HANDLE_DEFINE(ecsa_sem);
1697 } wifi_ecsa_status_control;
1698 #endif
1699 
1700 typedef struct _wifi_ecsa_info
1701 {
1702     t_u8 bss_type;
1703     t_u8 band_config;
1704     /** channel */
1705     t_u8 channel;
1706 } wifi_ecsa_info;
1707 
1708 #if CONFIG_CSI
1709 typedef enum _csi_state
1710 {
1711     csi_enabled = 0,
1712     csi_disabled,
1713     csiconfig_wrong,
1714     csiinternal_restart,
1715     csiinternal_stop,
1716     csiinternal_disabled,
1717 } csi_state;
1718 
1719 typedef MLAN_PACK_START struct _wifi_csi_status_info
1720 {
1721     csi_state status;
1722     t_u8 channel;
1723     t_u16 cnt;
1724 } MLAN_PACK_END wifi_csi_status_info;
1725 #endif
1726 
1727 #ifdef RW610
1728 #if CONFIG_HOST_SLEEP
1729 extern int wakeup_by;
1730 #define WAKEUP_BY_WLAN 0x1
1731 #define WAKEUP_BY_RTC  0x2
1732 #define WAKEUP_BY_PIN1 0x4
1733 #endif
1734 #endif
1735 
1736 #if CONFIG_CSI
1737 /**
1738  * Send the csi config parameter to FW.
1739  *
1740  *\param[in] csi_params Csi config parameter
1741  * \return WM_SUCCESS if successful otherwise failure.
1742  */
1743 int wifi_csi_cfg(wifi_csi_config_params_t *csi_params);
1744 int register_csi_user_callback(int (*csi_data_recv_callback)(void *buffer, size_t len));
1745 int unregister_csi_user_callback(void);
1746 void csi_local_buff_init();
1747 void csi_save_data_to_local_buff(void *data);
1748 void csi_deliver_data_to_user();
1749 
1750 typedef struct _csi_local_buff_statu
1751 {
1752     t_u8 write_index;
1753     t_u8 read_index;
1754     t_u8 valid_data_cnt;
1755     /** Semaphore to protect data parameters */
1756     OSA_SEMAPHORE_HANDLE_DEFINE(csi_data_sem);
1757 } csi_local_buff_statu;
1758 
1759 extern int csi_event_cnt;
1760 extern t_u64 csi_event_data_len;
1761 #endif
1762 #if CONFIG_NET_MONITOR
1763 /**
1764  * Send the net monitor config parameter to FW.
1765  *
1766  *\param[in] monitor Monitor config parameter.
1767  *
1768  * \return WM_SUCCESS if successful otherwise failure.
1769  */
1770 int wifi_net_monitor_cfg(wifi_net_monitor_t *monitor);
1771 
1772 /**
1773  * Register user callback to receive monitor data.
1774  *
1775  *\param[in] monitor_cb User callback function.
1776  *
1777  * \return void.
1778  */
1779 void register_monitor_user_callback(int (*monitor_cb)(void *frame, t_u16 len));
1780 
1781 /**
1782  * Deregister user callback for monitor feature.
1783  *
1784  * \return void.
1785  */
1786 void deregister_monitor_user_callback();
1787 
1788 /**
1789  * Record the status when start monitor.
1790  *
1791  *\param[in] flag Flag is true, when in monitor mode,otherwise, flag is false.
1792  *
1793  * \return void.
1794  */
1795 void set_monitor_flag(bool flag);
1796 
1797 /**
1798  * Get the monitor status to determine if it is in monitor mode.
1799  *
1800  * \return true in monitor mode, false in other modes.
1801  */
1802 bool get_monitor_flag();
1803 
1804 #endif
1805 
1806 int wifi_send_mgmt_auth_request(const t_u8 channel,
1807                                 const t_u8 auth_alg,
1808                                 const t_u8 *auth_seq_num,
1809                                 const t_u8 *status_code,
1810                                 const t_u8 *dest,
1811                                 const t_u8 *sae_data,
1812                                 const t_u16 sae_data_len);
1813 int wifi_send_scan_cmd(t_u8 bss_mode,
1814                        const t_u8 *specific_bssid,
1815                        const char *ssid,
1816                        uint8_t ssid_num,
1817                        const t_u8 num_channels,
1818                        const wifi_scan_channel_list_t *chan_list,
1819                        const t_u8 num_probes,
1820 #if CONFIG_SCAN_WITH_RSSIFILTER
1821                        const t_s16 rssi_threshold,
1822 #endif
1823 #if CONFIG_SCAN_CHANNEL_GAP
1824                        const t_u16 scan_chan_gap,
1825 #endif
1826                        const bool keep_previous_scan,
1827                        const bool active_scan_triggered);
1828 int wifi_deauthenticate(uint8_t *bssid);
1829 
1830 #if CONFIG_TURBO_MODE
1831 int wifi_get_turbo_mode(t_u8 *mode);
1832 int wifi_get_uap_turbo_mode(t_u8 *mode);
1833 int wifi_set_turbo_mode(t_u8 mode);
1834 int wifi_set_uap_turbo_mode(t_u8 mode);
1835 #endif
1836 
1837 /**
1838  *  @brief This function converts region string to region code
1839  *
1840  *  @param region_string    Region string
1841  *
1842  *  @return                 Region code
1843  */
1844 t_u8 region_string_2_region_code(t_u8 *region_string);
1845 
1846 #if CONFIG_COEX_DUTY_CYCLE
1847 int wifi_single_ant_duty_cycle(t_u16 enable, t_u16 nbTime, t_u16 wlanTime);
1848 int wifi_dual_ant_duty_cycle(t_u16 enable, t_u16 nbTime, t_u16 wlanTime, t_u16 wlanBlockTime);
1849 #endif
1850 
1851 #ifdef RW610
1852 /* get CAU module temperature and write to firmware */
1853 void wifi_cau_temperature_enable(void);
1854 int wifi_cau_temperature_write_to_firmware(void);
1855 int32_t wifi_get_temperature(void);
1856 void wifi_pmip_v33_enable();
1857 #endif
1858 
1859 #if (CONFIG_WIFI_IND_RESET) && (CONFIG_WIFI_IND_DNLD)
1860 int wifi_set_indrst_cfg(const wifi_indrst_cfg_t *indrst_cfg, mlan_bss_type bss_type);
1861 int wifi_get_indrst_cfg(wifi_indrst_cfg_t *indrst_cfg, mlan_bss_type bss_type);
1862 int wifi_test_independent_reset();
1863 int wifi_trigger_oob_indrst();
1864 #endif
1865 
1866 #if CONFIG_WIFI_BOOT_SLEEP
1867 int wifi_boot_sleep(uint16_t action, uint16_t *enable);
1868 #endif
1869 
1870 #if CONFIG_AUTO_NULL_TX
1871 int wifi_auto_null_tx(wifi_auto_null_tx_t *auto_null_tx, mlan_bss_type bss_type);
1872 #endif
1873 
1874 #if CONFIG_WPA_SUPP
1875 void hostapd_connected_sta_list(wifi_sta_info_t *si, wifi_sta_list_t *sl);
1876 #endif
1877 bool wifi_is_remain_on_channel(void);
1878 #if CONFIG_WMM
1879 /**
1880  * Update STA TX pause status
1881  *
1882  *\param[in] tx_pause trigger tx handler if this is an unpause event.
1883  *
1884  * \return void.
1885  */
1886 void wifi_sta_handle_event_data_pause(void *tx_pause);
1887 
1888 #if UAP_SUPPORT
1889 /**
1890  * Update uAP TX pause status
1891  *
1892  *\param[in] tx_pause trigger tx handler if this is an unpause event.
1893  *           for self address, update the whole priv interface status
1894  *           for other addresses, update corresponding ralist status
1895  *           trigger tx handler if this is an unpause event
1896  * \return void.
1897  */
1898 void wifi_uap_handle_event_data_pause(void *tx_pause);
1899 #endif
1900 #endif
1901 
1902 /* UAP support */
1903 #if UAP_SUPPORT
1904 
1905 /**
1906  * Returns the current STA list connected to our uAP
1907  *
1908  * This function gets its information after querying the firmware. It will
1909  * block till the response is received from firmware or a timeout.
1910  *
1911  * @param[in, out] list After this call returns this points to the
1912  * structure \ref wifi_sta_list_t allocated by the callee. This is variable
1913  * length structure and depends on count variable inside it. <b> The caller
1914  * needs to free this buffer after use.</b>. If this function is unable to
1915  * get the sta list, the value of list parameter will be NULL
1916  *
1917  * \note The caller needs to explicitly free the buffer returned by this
1918  * function.
1919  *
1920  * @return void
1921  */
1922 int wifi_uap_bss_sta_list(wifi_sta_list_t **list);
1923 
1924 /**
1925  * Dsiconnect ex-sta which is connected to in-uap.
1926  *
1927  * \param[in] mac_addr Mac address of external station.
1928  * \param[in] reason_code Deauth reason code.
1929  *
1930  * \return WM_SUCCESS if successful otherwise failure.
1931  */
1932 int wifi_sta_deauth(uint8_t *mac_addr, uint16_t reason_code);
1933 
1934 int wifi_uap_rates_getset(uint8_t action, char *rates, uint8_t num_rates);
1935 int wifi_uap_sta_ageout_timer_getset(uint8_t action, uint32_t *sta_ageout_timer);
1936 int wifi_uap_ps_sta_ageout_timer_getset(uint8_t action, uint32_t *ps_sta_ageout_timer);
1937 
1938 /**
1939  * Get the uAP channel number
1940  *
1941  *
1942  * @param[in] channel Pointer to channel number. Will be initialized by
1943  * callee
1944  * @return Standard WMSDK return code
1945  */
1946 int wifi_get_uap_channel(int *channel);
1947 
1948 /**
1949  * Get/Set the uAP mfpc and mfpr
1950  *
1951  * @param[in] action
1952  *
1953  * \param[in, out] mfpc Management Frame Protection Capable (MFPC)
1954  *                       1: Management Frame Protection Capable
1955  *                       0: Management Frame Protection not Capable
1956  * \param[in, out] mfpr Management Frame Protection Required (MFPR)
1957  *                       1: Management Frame Protection Required
1958  *                       0: Management Frame Protection Optional
1959  *
1960  * @return cmd response status
1961  */
1962 int wifi_uap_pmf_getset(uint8_t action, uint8_t *mfpc, uint8_t *mfpr);
1963 
1964 /**
1965  * enable/disable 80211d domain feature for the uAP.
1966  *
1967  * @note This API only set 80211d domain feature.
1968  * The actual application will happen only during
1969  * starting phase of uAP. So, if the uAP is already started then the
1970  * configuration will not apply till uAP re-start.
1971  *
1972  * @return WM_SUCCESS on success or error code.
1973  *
1974  */
1975 int wifi_uap_enable_11d_support();
1976 
1977 int wifi_enable_uap_11d_support();
1978 int wifi_disable_uap_11d_support();
1979 int wrapper_wlan_uap_11d_enable(t_u32 state);
1980 
1981 void wifi_uap_set_httxcfg(const t_u16 ht_tx_cfg);
1982 int wifi_uap_set_httxcfg_int(unsigned short httxcfg);
1983 
1984 int wifi_uap_ps_inactivity_sleep_exit(mlan_bss_type type);
1985 int wifi_uap_ps_inactivity_sleep_enter(mlan_bss_type type,
1986                                        unsigned int ctrl_bitmap,
1987                                        unsigned int min_sleep,
1988                                        unsigned int max_sleep,
1989                                        unsigned int inactivity_to,
1990                                        unsigned int min_awake,
1991                                        unsigned int max_awake);
1992 
1993 #if CONFIG_WIFI_UAP_WORKAROUND_STICKY_TIM
1994 void wifi_uap_enable_sticky_bit(const uint8_t *mac_addr);
1995 #endif /* CONFIG_WIFI_UAP_WORKAROUND_STICKY_TIM */
1996 int wifi_uap_start(mlan_bss_type type,
1997                    char *ssid,
1998                    uint8_t *mac_addr,
1999                    int security,
2000                    int key_mgmt,
2001                    char *passphrase,
2002                    char *password,
2003                    int channel,
2004                    wifi_scan_chan_list_t scan_chan_list,
2005                    uint8_t pwe_derivation,
2006                    uint8_t transition_disable,
2007                    bool mfpc,
2008 #if CONFIG_WIFI_DTIM_PERIOD
2009                    bool mfpr,
2010                    uint8_t dtim
2011 #else
2012                    bool mfpr
2013 #endif
2014 );
2015 
2016 int wrapper_wlan_uap_ampdu_enable(uint8_t *addr
2017 #if CONFIG_WMM
2018                                   ,
2019                                   t_u8 tid
2020 #endif
2021 );
2022 
2023 int wifi_uap_stop();
2024 #if CONFIG_WPA_SUPP_AP
2025 int wifi_uap_do_acs(const int *freq_list);
2026 #endif
2027 
2028 #if CONFIG_WIFI_CAPA
2029 /**
2030  * Set uAP capability
2031  *
2032  * User can set uAP capability of 11ax/11ac/11n/legacy. Default is 11ax.
2033  *
2034  * @param[in] wlan_capa uAP capability bitmap.
2035  *                      1111 - 11AX
2036  *                      0111 - 11AC
2037  *                      0011 - 11N
2038  *                      0001 - legacy
2039  *
2040  */
2041 void wifi_uap_config_wifi_capa(uint8_t wlan_capa);
2042 void wifi_get_fw_info(mlan_bss_type type, t_u16 *fw_bands);
2043 #endif
2044 
2045 int wifi_uap_set_bandwidth(const t_u8 bandwidth);
2046 
2047 t_u8 wifi_uap_get_bandwidth();
2048 
2049 int wifi_uap_get_pmfcfg(t_u8 *mfpc, t_u8 *mfpr);
2050 
2051 #if CONFIG_WIFI_NM_HOSTAPD_AP
2052 t_u16 wifi_get_default_ht_capab();
2053 t_u32 wifi_get_default_vht_capab();
2054 
2055 void wifi_uap_client_assoc(t_u8 *sta_addr, unsigned char is_11n_enabled);
2056 void wifi_uap_client_deauth(t_u8 *sta_addr);
2057 #endif
2058 #endif /* UAP_SUPPORT */
2059 #endif /* __WIFI_H__ */
2060