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