From 093d98fa6170f12b6412fba2390f8bfc51b2b66c Mon Sep 17 00:00:00 2001 From: maochen Date: Mon, 5 Aug 2024 00:25:00 -0700 Subject: [PATCH] middleware: wifi_nxp: add wifi driver Add wifi driver code. SHA: b39e5ea Signed-off-by: Maochen Wang --- mcux/middleware/wifi_nxp/CMakeLists.txt | 310 + mcux/middleware/wifi_nxp/README.txt | 30 + mcux/middleware/wifi_nxp/certs/ca-cert.h | 65 + mcux/middleware/wifi_nxp/certs/client-cert.h | 60 + mcux/middleware/wifi_nxp/certs/client-key.h | 95 + mcux/middleware/wifi_nxp/certs/dh-param.h | 17 + mcux/middleware/wifi_nxp/certs/server-cert.h | 60 + mcux/middleware/wifi_nxp/certs/server-key.h | 95 + mcux/middleware/wifi_nxp/cli/cli_utils.c | 269 + mcux/middleware/wifi_nxp/cli/wifi_shell.c | 201 + mcux/middleware/wifi_nxp/cli/wifi_shell.h | 86 + .../wifi_nxp/firmware_dnld/firmware_dnld.c | 258 + .../wifi_nxp/firmware_dnld/firmware_dnld.h | 26 + .../fwdnld_intf_abs/fwdnld_intf_abs.c | 34 + .../fwdnld_intf_abs/fwdnld_intf_abs.h | 101 + .../WIFI_IW416_BOARD_AW_AM457_CAL_DATA_EXT.h | 39 + mcux/middleware/wifi_nxp/incl/cli_utils.h | 37 + mcux/middleware/wifi_nxp/incl/nxp_wifi.h | 565 + .../mbedtls/wpa_supp_els_pkc_mbedtls_config.h | 3839 ++++ .../wifi_nxp/incl/port/net/zephyr/wm_net.h | 630 + .../incl/port/net/zephyr/wm_net_decl.h | 66 + .../wifi_nxp/incl/port/osa/mem_pool.h | 90 + .../wifi_nxp/incl/port/osa/mem_pool_config.h | 46 + mcux/middleware/wifi_nxp/incl/port/osa/osa.h | 363 + .../middleware/wifi_nxp/incl/port/osa/slist.h | 181 + .../wifi_nxp/incl/port/osa/stack_simple.h | 103 + mcux/middleware/wifi_nxp/incl/sigma_agent.h | 39 + .../wifi_nxp/incl/wifi_cal_data_ext.h | 257 + .../wifi_nxp/incl/wifi_config_default.h | 11 + mcux/middleware/wifi_nxp/incl/wifi_ping.h | 56 + .../wifi_nxp/incl/wifidriver/wifi-decl.h | 2025 ++ .../wifi_nxp/incl/wifidriver/wifi.h | 2016 ++ .../wifi_nxp/incl/wifidriver/wifi_events.h | 241 + .../wifi_nxp/incl/wifidriver/wifi_nxp.h | 73 + mcux/middleware/wifi_nxp/incl/wlcmgr/wlan.h | 7189 +++++++ .../wifi_nxp/incl/wlcmgr/wlan_11d.h | 55 + .../wifi_nxp/incl/wlcmgr/wlan_features.h | 32 + .../incl/wlcmgr/wlan_mcu_mem_access_cli.h | 26 + .../wifi_nxp/incl/wlcmgr/wlan_tests.h | 73 + mcux/middleware/wifi_nxp/incl/wm_utils.h | 320 + .../incl/wmcrypto/wm_mbedtls_helper_api.h | 411 + .../wifi_nxp/incl/wmcrypto/wmcrypto.h | 306 + mcux/middleware/wifi_nxp/incl/wmerrno.h | 139 + mcux/middleware/wifi_nxp/incl/wmlog.h | 45 + mcux/middleware/wifi_nxp/incl/wmstats.h | 114 + mcux/middleware/wifi_nxp/incl/wmsysinfo.h | 78 + mcux/middleware/wifi_nxp/incl/wmtime.h | 140 + mcux/middleware/wifi_nxp/incl/wmtypes.h | 19 + .../wifi_nxp/incl/wps/wifi_nxp_wps.h | 278 + .../middleware/wifi_nxp/port/net/zephyr/net.c | 1605 ++ .../wifi_nxp/port/net/zephyr/netif_decl.h | 92 + mcux/middleware/wifi_nxp/port/osa/mem_pool.c | 165 + .../wifi_nxp/port/osa/mem_pool_config.c | 495 + mcux/middleware/wifi_nxp/port/osa/osa.c | 145 + .../middleware/wifi_nxp/port/osa/osa_zephyr.c | 210 + .../middleware/wifi_nxp/port/osa/osa_zephyr.h | 103 + mcux/middleware/wifi_nxp/port/osa/slist.c | 210 + .../wifi_nxp/port/osa/stack_simple.c | 87 + .../wifi_nxp/sdio_nxp_abs/fwdnld_sdio.c | 381 + .../wifi_nxp/sdio_nxp_abs/incl/fwdnld_sdio.h | 32 + .../wifi_nxp/sdio_nxp_abs/incl/mlan_sdio.h | 137 + .../sdio_nxp_abs/incl/mlan_sdio_api.h | 136 + .../sdio_nxp_abs/incl/mlan_sdio_defs.h | 425 + .../wifi_nxp/sdio_nxp_abs/mlan_sdio.c | 158 + .../wifi_bt_firmware/8801/8801_cpu1.c | 29 + .../wifi_bt_firmware/8801/sd8801_wlan.h | 15 + .../wifi_bt_firmware/8987/8987_cpu1.c | 25 + .../wifi_bt_firmware/8987/8987_cpu12.c | 32 + .../wifi_bt_firmware/8987/8987_cpu2.c | 25 + .../wifi_bt_firmware/8987/sd8987_wlan.h | 15 + .../8987/sduart8987_wlan_bt.h | 19 + .../wifi_bt_firmware/8987/uart8987_bt.h | 15 + .../wifi_bt_firmware/IW416/IW416_cpu1.c | 25 + .../wifi_bt_firmware/IW416/IW416_cpu12.c | 32 + .../wifi_bt_firmware/IW416/IW416_cpu2.c | 25 + .../wifi_bt_firmware/IW416/sdIW416_wlan.h | 15 + .../IW416/sduartIW416_wlan_bt.h | 19 + .../wifi_bt_firmware/IW416/uartIW416_bt.h | 15 + .../wifi_bt_firmware/nw61x/nw61x_cpu12_se.c | 32 + .../wifi_bt_firmware/nw61x/nw61x_cpu1_se.c | 25 + .../wifi_bt_firmware/nw61x/nw61x_cpu2_se.c | 25 + .../wifi_bt_firmware/nw61x/sd_nw61x_se.h | 15 + .../wifi_bt_firmware/nw61x/sduart_nw61x_se.h | 19 + .../wifi_bt_firmware/nw61x/uart_nw61x_se.h | 15 + .../wifi_nxp/wifi_bt_firmware/version.txt | 34 + .../wifi_nxp/wifi_bt_firmware/wlan_bt_fw.h | 43 + .../wifi_nxp/wifidriver/incl/mlan.h | 56 + .../wifi_nxp/wifidriver/incl/mlan_11ac.h | 53 + .../wifi_nxp/wifidriver/incl/mlan_11ax.h | 54 + .../wifi_nxp/wifidriver/incl/mlan_11h.h | 50 + .../wifi_nxp/wifidriver/incl/mlan_11k.h | 194 + .../wifi_nxp/wifidriver/incl/mlan_11n.h | 362 + .../wifi_nxp/wifidriver/incl/mlan_11n_aggr.h | 28 + .../wifidriver/incl/mlan_11n_rxreorder.h | 91 + .../wifi_nxp/wifidriver/incl/mlan_11v.h | 69 + .../wifi_nxp/wifidriver/incl/mlan_action.h | 44 + .../wifi_nxp/wifidriver/incl/mlan_api.h | 627 + .../wifi_nxp/wifidriver/incl/mlan_decl.h | 1062 ++ .../wifi_nxp/wifidriver/incl/mlan_fw.h | 8193 ++++++++ .../wifi_nxp/wifidriver/incl/mlan_ieee.h | 2564 +++ .../wifi_nxp/wifidriver/incl/mlan_init.h | 78 + .../wifi_nxp/wifidriver/incl/mlan_ioctl.h | 4331 +++++ .../wifi_nxp/wifidriver/incl/mlan_join.h | 30 + .../wifi_nxp/wifidriver/incl/mlan_main.h | 3403 ++++ .../wifi_nxp/wifidriver/incl/mlan_main_defs.h | 41 + .../wifi_nxp/wifidriver/incl/mlan_mbo.h | 45 + .../wifi_nxp/wifidriver/incl/mlan_meas.h | 40 + .../incl/mlan_remap_mem_operations.h | 46 + .../wifi_nxp/wifidriver/incl/mlan_uap.h | 100 + .../wifi_nxp/wifidriver/incl/mlan_util.h | 542 + .../wifi_nxp/wifidriver/incl/mlan_wmm.h | 276 + .../wifi_nxp/wifidriver/incl/type_decls.h | 61 + .../wifi_nxp/wifidriver/mlan_11ac.c | 1348 ++ .../wifi_nxp/wifidriver/mlan_11ax.c | 739 + .../middleware/wifi_nxp/wifidriver/mlan_11d.c | 1636 ++ .../middleware/wifi_nxp/wifidriver/mlan_11h.c | 282 + .../middleware/wifi_nxp/wifidriver/mlan_11k.c | 1088 ++ .../middleware/wifi_nxp/wifidriver/mlan_11n.c | 1678 ++ .../wifi_nxp/wifidriver/mlan_11n_aggr.c | 193 + .../wifi_nxp/wifidriver/mlan_11n_rxreorder.c | 1438 ++ .../middleware/wifi_nxp/wifidriver/mlan_11v.c | 401 + .../wifi_nxp/wifidriver/mlan_action.c | 351 + .../middleware/wifi_nxp/wifidriver/mlan_api.c | 6614 +++++++ .../middleware/wifi_nxp/wifidriver/mlan_cfp.c | 2970 +++ .../wifi_nxp/wifidriver/mlan_cmdevt.c | 2480 +++ .../wifi_nxp/wifidriver/mlan_glue.c | 8778 +++++++++ .../wifi_nxp/wifidriver/mlan_init.c | 566 + .../wifi_nxp/wifidriver/mlan_join.c | 1569 ++ .../middleware/wifi_nxp/wifidriver/mlan_mbo.c | 171 + .../wifi_nxp/wifidriver/mlan_misc.c | 1127 ++ .../wifi_nxp/wifidriver/mlan_scan.c | 5073 +++++ .../wifi_nxp/wifidriver/mlan_shim.c | 359 + .../wifi_nxp/wifidriver/mlan_sta_cmd.c | 2314 +++ .../wifi_nxp/wifidriver/mlan_sta_cmdresp.c | 950 + .../wifi_nxp/wifidriver/mlan_sta_event.c | 135 + .../wifi_nxp/wifidriver/mlan_sta_ioctl.c | 1621 ++ .../wifi_nxp/wifidriver/mlan_sta_rx.c | 293 + .../wifi_nxp/wifidriver/mlan_txrx.c | 72 + .../wifi_nxp/wifidriver/mlan_uap_cmdevent.c | 1429 ++ .../wifi_nxp/wifidriver/mlan_uap_ioctl.c | 167 + .../middleware/wifi_nxp/wifidriver/mlan_wmm.c | 1226 ++ mcux/middleware/wifi_nxp/wifidriver/sdio.c | 280 + mcux/middleware/wifi_nxp/wifidriver/sdio.h | 64 + .../wifi_nxp/wifidriver/wifi-debug.c | 191 + .../wifi_nxp/wifidriver/wifi-debug.h | 114 + .../middleware/wifi_nxp/wifidriver/wifi-imu.c | 1805 ++ .../middleware/wifi_nxp/wifidriver/wifi-imu.h | 141 + .../wifi_nxp/wifidriver/wifi-internal.h | 482 + .../middleware/wifi_nxp/wifidriver/wifi-mem.c | 91 + .../wifi_nxp/wifidriver/wifi-sdio.c | 3144 +++ .../wifi_nxp/wifidriver/wifi-sdio.h | 149 + .../middleware/wifi_nxp/wifidriver/wifi-uap.c | 4819 +++++ .../middleware/wifi_nxp/wifidriver/wifi-wps.c | 94 + mcux/middleware/wifi_nxp/wifidriver/wifi.c | 5239 +++++ .../wifi_nxp/wifidriver/wifi_common.h | 226 + .../wifi_nxp/wifidriver/wifi_pwrmgr.c | 686 + .../wpa_supp_if/incl/rtos_wpa_supp_if.h | 185 + .../wpa_supp_if/incl/wifi_nxp_internal.h | 680 + .../wifidriver/wpa_supp_if/rtos_wpa_supp_if.c | 3491 ++++ .../wifidriver/wpa_supp_if/wifi_nxp.c | 293 + .../wpa_supp_if/wifi_nxp_internal.c | 161 + mcux/middleware/wifi_nxp/wlcmgr/wlan.c | 15917 ++++++++++++++++ .../wifi_nxp/wlcmgr/wlan_basic_cli.c | 146 + .../wifi_nxp/wlcmgr/wlan_enhanced_tests.c | 2144 +++ .../wifi_nxp/wlcmgr/wlan_features.c | 140 + .../wifi_nxp/wlcmgr/wlan_mcu_mem_access_cli.c | 76 + .../wifi_nxp/wlcmgr/wlan_test_mode_tests.c | 1431 ++ mcux/middleware/wifi_nxp/wlcmgr/wlan_tests.c | 8845 +++++++++ .../wifi_nxp/wlcmgr/wlan_txpwrlimit_cfg.c | 309 + mcux/middleware/wifi_nxp/wls/range_kalman.c | 143 + mcux/middleware/wifi_nxp/wls/range_kalman.h | 64 + .../wifi_nxp/wls/wls_QR_algorithm.c | 1540 ++ .../wifi_nxp/wls/wls_QR_algorithm.h | 43 + mcux/middleware/wifi_nxp/wls/wls_api.c | 288 + mcux/middleware/wifi_nxp/wls/wls_api.h | 31 + .../wifi_nxp/wls/wls_param_defines.h | 175 + mcux/middleware/wifi_nxp/wls/wls_processing.c | 2738 +++ mcux/middleware/wifi_nxp/wls/wls_processing.h | 129 + mcux/middleware/wifi_nxp/wls/wls_radix4Fft.c | 2694 +++ mcux/middleware/wifi_nxp/wls/wls_radix4Fft.h | 75 + .../wifi_nxp/wls/wls_structure_defs.h | 566 + .../wifi_nxp/wls/wls_subspace_processing.c | 883 + .../wifi_nxp/wls/wls_subspace_processing.h | 32 + 183 files changed, 156756 insertions(+) create mode 100644 mcux/middleware/wifi_nxp/CMakeLists.txt create mode 100644 mcux/middleware/wifi_nxp/README.txt create mode 100644 mcux/middleware/wifi_nxp/certs/ca-cert.h create mode 100644 mcux/middleware/wifi_nxp/certs/client-cert.h create mode 100644 mcux/middleware/wifi_nxp/certs/client-key.h create mode 100644 mcux/middleware/wifi_nxp/certs/dh-param.h create mode 100644 mcux/middleware/wifi_nxp/certs/server-cert.h create mode 100644 mcux/middleware/wifi_nxp/certs/server-key.h create mode 100644 mcux/middleware/wifi_nxp/cli/cli_utils.c create mode 100644 mcux/middleware/wifi_nxp/cli/wifi_shell.c create mode 100755 mcux/middleware/wifi_nxp/cli/wifi_shell.h create mode 100644 mcux/middleware/wifi_nxp/firmware_dnld/firmware_dnld.c create mode 100644 mcux/middleware/wifi_nxp/firmware_dnld/firmware_dnld.h create mode 100644 mcux/middleware/wifi_nxp/fwdnld_intf_abs/fwdnld_intf_abs.c create mode 100644 mcux/middleware/wifi_nxp/fwdnld_intf_abs/fwdnld_intf_abs.h create mode 100644 mcux/middleware/wifi_nxp/incl/WIFI_IW416_BOARD_AW_AM457_CAL_DATA_EXT.h create mode 100644 mcux/middleware/wifi_nxp/incl/cli_utils.h create mode 100644 mcux/middleware/wifi_nxp/incl/nxp_wifi.h create mode 100644 mcux/middleware/wifi_nxp/incl/port/mbedtls/wpa_supp_els_pkc_mbedtls_config.h create mode 100644 mcux/middleware/wifi_nxp/incl/port/net/zephyr/wm_net.h create mode 100644 mcux/middleware/wifi_nxp/incl/port/net/zephyr/wm_net_decl.h create mode 100644 mcux/middleware/wifi_nxp/incl/port/osa/mem_pool.h create mode 100644 mcux/middleware/wifi_nxp/incl/port/osa/mem_pool_config.h create mode 100644 mcux/middleware/wifi_nxp/incl/port/osa/osa.h create mode 100644 mcux/middleware/wifi_nxp/incl/port/osa/slist.h create mode 100644 mcux/middleware/wifi_nxp/incl/port/osa/stack_simple.h create mode 100644 mcux/middleware/wifi_nxp/incl/sigma_agent.h create mode 100644 mcux/middleware/wifi_nxp/incl/wifi_cal_data_ext.h create mode 100644 mcux/middleware/wifi_nxp/incl/wifi_config_default.h create mode 100644 mcux/middleware/wifi_nxp/incl/wifi_ping.h create mode 100644 mcux/middleware/wifi_nxp/incl/wifidriver/wifi-decl.h create mode 100644 mcux/middleware/wifi_nxp/incl/wifidriver/wifi.h create mode 100644 mcux/middleware/wifi_nxp/incl/wifidriver/wifi_events.h create mode 100644 mcux/middleware/wifi_nxp/incl/wifidriver/wifi_nxp.h create mode 100644 mcux/middleware/wifi_nxp/incl/wlcmgr/wlan.h create mode 100644 mcux/middleware/wifi_nxp/incl/wlcmgr/wlan_11d.h create mode 100644 mcux/middleware/wifi_nxp/incl/wlcmgr/wlan_features.h create mode 100644 mcux/middleware/wifi_nxp/incl/wlcmgr/wlan_mcu_mem_access_cli.h create mode 100644 mcux/middleware/wifi_nxp/incl/wlcmgr/wlan_tests.h create mode 100644 mcux/middleware/wifi_nxp/incl/wm_utils.h create mode 100755 mcux/middleware/wifi_nxp/incl/wmcrypto/wm_mbedtls_helper_api.h create mode 100755 mcux/middleware/wifi_nxp/incl/wmcrypto/wmcrypto.h create mode 100644 mcux/middleware/wifi_nxp/incl/wmerrno.h create mode 100644 mcux/middleware/wifi_nxp/incl/wmlog.h create mode 100644 mcux/middleware/wifi_nxp/incl/wmstats.h create mode 100644 mcux/middleware/wifi_nxp/incl/wmsysinfo.h create mode 100755 mcux/middleware/wifi_nxp/incl/wmtime.h create mode 100644 mcux/middleware/wifi_nxp/incl/wmtypes.h create mode 100755 mcux/middleware/wifi_nxp/incl/wps/wifi_nxp_wps.h create mode 100644 mcux/middleware/wifi_nxp/port/net/zephyr/net.c create mode 100644 mcux/middleware/wifi_nxp/port/net/zephyr/netif_decl.h create mode 100644 mcux/middleware/wifi_nxp/port/osa/mem_pool.c create mode 100644 mcux/middleware/wifi_nxp/port/osa/mem_pool_config.c create mode 100644 mcux/middleware/wifi_nxp/port/osa/osa.c create mode 100644 mcux/middleware/wifi_nxp/port/osa/osa_zephyr.c create mode 100644 mcux/middleware/wifi_nxp/port/osa/osa_zephyr.h create mode 100644 mcux/middleware/wifi_nxp/port/osa/slist.c create mode 100644 mcux/middleware/wifi_nxp/port/osa/stack_simple.c create mode 100644 mcux/middleware/wifi_nxp/sdio_nxp_abs/fwdnld_sdio.c create mode 100644 mcux/middleware/wifi_nxp/sdio_nxp_abs/incl/fwdnld_sdio.h create mode 100644 mcux/middleware/wifi_nxp/sdio_nxp_abs/incl/mlan_sdio.h create mode 100644 mcux/middleware/wifi_nxp/sdio_nxp_abs/incl/mlan_sdio_api.h create mode 100644 mcux/middleware/wifi_nxp/sdio_nxp_abs/incl/mlan_sdio_defs.h create mode 100644 mcux/middleware/wifi_nxp/sdio_nxp_abs/mlan_sdio.c create mode 100644 mcux/middleware/wifi_nxp/wifi_bt_firmware/8801/8801_cpu1.c create mode 100644 mcux/middleware/wifi_nxp/wifi_bt_firmware/8801/sd8801_wlan.h create mode 100644 mcux/middleware/wifi_nxp/wifi_bt_firmware/8987/8987_cpu1.c create mode 100644 mcux/middleware/wifi_nxp/wifi_bt_firmware/8987/8987_cpu12.c create mode 100644 mcux/middleware/wifi_nxp/wifi_bt_firmware/8987/8987_cpu2.c create mode 100644 mcux/middleware/wifi_nxp/wifi_bt_firmware/8987/sd8987_wlan.h create mode 100644 mcux/middleware/wifi_nxp/wifi_bt_firmware/8987/sduart8987_wlan_bt.h create mode 100644 mcux/middleware/wifi_nxp/wifi_bt_firmware/8987/uart8987_bt.h create mode 100644 mcux/middleware/wifi_nxp/wifi_bt_firmware/IW416/IW416_cpu1.c create mode 100644 mcux/middleware/wifi_nxp/wifi_bt_firmware/IW416/IW416_cpu12.c create mode 100644 mcux/middleware/wifi_nxp/wifi_bt_firmware/IW416/IW416_cpu2.c create mode 100644 mcux/middleware/wifi_nxp/wifi_bt_firmware/IW416/sdIW416_wlan.h create mode 100644 mcux/middleware/wifi_nxp/wifi_bt_firmware/IW416/sduartIW416_wlan_bt.h create mode 100644 mcux/middleware/wifi_nxp/wifi_bt_firmware/IW416/uartIW416_bt.h create mode 100644 mcux/middleware/wifi_nxp/wifi_bt_firmware/nw61x/nw61x_cpu12_se.c create mode 100644 mcux/middleware/wifi_nxp/wifi_bt_firmware/nw61x/nw61x_cpu1_se.c create mode 100644 mcux/middleware/wifi_nxp/wifi_bt_firmware/nw61x/nw61x_cpu2_se.c create mode 100644 mcux/middleware/wifi_nxp/wifi_bt_firmware/nw61x/sd_nw61x_se.h create mode 100644 mcux/middleware/wifi_nxp/wifi_bt_firmware/nw61x/sduart_nw61x_se.h create mode 100644 mcux/middleware/wifi_nxp/wifi_bt_firmware/nw61x/uart_nw61x_se.h create mode 100644 mcux/middleware/wifi_nxp/wifi_bt_firmware/version.txt create mode 100644 mcux/middleware/wifi_nxp/wifi_bt_firmware/wlan_bt_fw.h create mode 100644 mcux/middleware/wifi_nxp/wifidriver/incl/mlan.h create mode 100644 mcux/middleware/wifi_nxp/wifidriver/incl/mlan_11ac.h create mode 100644 mcux/middleware/wifi_nxp/wifidriver/incl/mlan_11ax.h create mode 100644 mcux/middleware/wifi_nxp/wifidriver/incl/mlan_11h.h create mode 100644 mcux/middleware/wifi_nxp/wifidriver/incl/mlan_11k.h create mode 100644 mcux/middleware/wifi_nxp/wifidriver/incl/mlan_11n.h create mode 100644 mcux/middleware/wifi_nxp/wifidriver/incl/mlan_11n_aggr.h create mode 100644 mcux/middleware/wifi_nxp/wifidriver/incl/mlan_11n_rxreorder.h create mode 100644 mcux/middleware/wifi_nxp/wifidriver/incl/mlan_11v.h create mode 100644 mcux/middleware/wifi_nxp/wifidriver/incl/mlan_action.h create mode 100644 mcux/middleware/wifi_nxp/wifidriver/incl/mlan_api.h create mode 100644 mcux/middleware/wifi_nxp/wifidriver/incl/mlan_decl.h create mode 100644 mcux/middleware/wifi_nxp/wifidriver/incl/mlan_fw.h create mode 100644 mcux/middleware/wifi_nxp/wifidriver/incl/mlan_ieee.h create mode 100644 mcux/middleware/wifi_nxp/wifidriver/incl/mlan_init.h create mode 100644 mcux/middleware/wifi_nxp/wifidriver/incl/mlan_ioctl.h create mode 100644 mcux/middleware/wifi_nxp/wifidriver/incl/mlan_join.h create mode 100644 mcux/middleware/wifi_nxp/wifidriver/incl/mlan_main.h create mode 100644 mcux/middleware/wifi_nxp/wifidriver/incl/mlan_main_defs.h create mode 100644 mcux/middleware/wifi_nxp/wifidriver/incl/mlan_mbo.h create mode 100644 mcux/middleware/wifi_nxp/wifidriver/incl/mlan_meas.h create mode 100644 mcux/middleware/wifi_nxp/wifidriver/incl/mlan_remap_mem_operations.h create mode 100644 mcux/middleware/wifi_nxp/wifidriver/incl/mlan_uap.h create mode 100644 mcux/middleware/wifi_nxp/wifidriver/incl/mlan_util.h create mode 100644 mcux/middleware/wifi_nxp/wifidriver/incl/mlan_wmm.h create mode 100644 mcux/middleware/wifi_nxp/wifidriver/incl/type_decls.h create mode 100644 mcux/middleware/wifi_nxp/wifidriver/mlan_11ac.c create mode 100644 mcux/middleware/wifi_nxp/wifidriver/mlan_11ax.c create mode 100644 mcux/middleware/wifi_nxp/wifidriver/mlan_11d.c create mode 100644 mcux/middleware/wifi_nxp/wifidriver/mlan_11h.c create mode 100644 mcux/middleware/wifi_nxp/wifidriver/mlan_11k.c create mode 100644 mcux/middleware/wifi_nxp/wifidriver/mlan_11n.c create mode 100644 mcux/middleware/wifi_nxp/wifidriver/mlan_11n_aggr.c create mode 100644 mcux/middleware/wifi_nxp/wifidriver/mlan_11n_rxreorder.c create mode 100644 mcux/middleware/wifi_nxp/wifidriver/mlan_11v.c create mode 100644 mcux/middleware/wifi_nxp/wifidriver/mlan_action.c create mode 100644 mcux/middleware/wifi_nxp/wifidriver/mlan_api.c create mode 100644 mcux/middleware/wifi_nxp/wifidriver/mlan_cfp.c create mode 100644 mcux/middleware/wifi_nxp/wifidriver/mlan_cmdevt.c create mode 100644 mcux/middleware/wifi_nxp/wifidriver/mlan_glue.c create mode 100644 mcux/middleware/wifi_nxp/wifidriver/mlan_init.c create mode 100644 mcux/middleware/wifi_nxp/wifidriver/mlan_join.c create mode 100644 mcux/middleware/wifi_nxp/wifidriver/mlan_mbo.c create mode 100644 mcux/middleware/wifi_nxp/wifidriver/mlan_misc.c create mode 100644 mcux/middleware/wifi_nxp/wifidriver/mlan_scan.c create mode 100644 mcux/middleware/wifi_nxp/wifidriver/mlan_shim.c create mode 100644 mcux/middleware/wifi_nxp/wifidriver/mlan_sta_cmd.c create mode 100644 mcux/middleware/wifi_nxp/wifidriver/mlan_sta_cmdresp.c create mode 100644 mcux/middleware/wifi_nxp/wifidriver/mlan_sta_event.c create mode 100644 mcux/middleware/wifi_nxp/wifidriver/mlan_sta_ioctl.c create mode 100644 mcux/middleware/wifi_nxp/wifidriver/mlan_sta_rx.c create mode 100644 mcux/middleware/wifi_nxp/wifidriver/mlan_txrx.c create mode 100644 mcux/middleware/wifi_nxp/wifidriver/mlan_uap_cmdevent.c create mode 100644 mcux/middleware/wifi_nxp/wifidriver/mlan_uap_ioctl.c create mode 100644 mcux/middleware/wifi_nxp/wifidriver/mlan_wmm.c create mode 100644 mcux/middleware/wifi_nxp/wifidriver/sdio.c create mode 100644 mcux/middleware/wifi_nxp/wifidriver/sdio.h create mode 100644 mcux/middleware/wifi_nxp/wifidriver/wifi-debug.c create mode 100644 mcux/middleware/wifi_nxp/wifidriver/wifi-debug.h create mode 100644 mcux/middleware/wifi_nxp/wifidriver/wifi-imu.c create mode 100644 mcux/middleware/wifi_nxp/wifidriver/wifi-imu.h create mode 100644 mcux/middleware/wifi_nxp/wifidriver/wifi-internal.h create mode 100644 mcux/middleware/wifi_nxp/wifidriver/wifi-mem.c create mode 100644 mcux/middleware/wifi_nxp/wifidriver/wifi-sdio.c create mode 100644 mcux/middleware/wifi_nxp/wifidriver/wifi-sdio.h create mode 100644 mcux/middleware/wifi_nxp/wifidriver/wifi-uap.c create mode 100644 mcux/middleware/wifi_nxp/wifidriver/wifi-wps.c create mode 100644 mcux/middleware/wifi_nxp/wifidriver/wifi.c create mode 100644 mcux/middleware/wifi_nxp/wifidriver/wifi_common.h create mode 100644 mcux/middleware/wifi_nxp/wifidriver/wifi_pwrmgr.c create mode 100644 mcux/middleware/wifi_nxp/wifidriver/wpa_supp_if/incl/rtos_wpa_supp_if.h create mode 100644 mcux/middleware/wifi_nxp/wifidriver/wpa_supp_if/incl/wifi_nxp_internal.h create mode 100644 mcux/middleware/wifi_nxp/wifidriver/wpa_supp_if/rtos_wpa_supp_if.c create mode 100644 mcux/middleware/wifi_nxp/wifidriver/wpa_supp_if/wifi_nxp.c create mode 100644 mcux/middleware/wifi_nxp/wifidriver/wpa_supp_if/wifi_nxp_internal.c create mode 100644 mcux/middleware/wifi_nxp/wlcmgr/wlan.c create mode 100644 mcux/middleware/wifi_nxp/wlcmgr/wlan_basic_cli.c create mode 100644 mcux/middleware/wifi_nxp/wlcmgr/wlan_enhanced_tests.c create mode 100644 mcux/middleware/wifi_nxp/wlcmgr/wlan_features.c create mode 100644 mcux/middleware/wifi_nxp/wlcmgr/wlan_mcu_mem_access_cli.c create mode 100644 mcux/middleware/wifi_nxp/wlcmgr/wlan_test_mode_tests.c create mode 100644 mcux/middleware/wifi_nxp/wlcmgr/wlan_tests.c create mode 100644 mcux/middleware/wifi_nxp/wlcmgr/wlan_txpwrlimit_cfg.c create mode 100644 mcux/middleware/wifi_nxp/wls/range_kalman.c create mode 100644 mcux/middleware/wifi_nxp/wls/range_kalman.h create mode 100644 mcux/middleware/wifi_nxp/wls/wls_QR_algorithm.c create mode 100644 mcux/middleware/wifi_nxp/wls/wls_QR_algorithm.h create mode 100644 mcux/middleware/wifi_nxp/wls/wls_api.c create mode 100644 mcux/middleware/wifi_nxp/wls/wls_api.h create mode 100644 mcux/middleware/wifi_nxp/wls/wls_param_defines.h create mode 100644 mcux/middleware/wifi_nxp/wls/wls_processing.c create mode 100644 mcux/middleware/wifi_nxp/wls/wls_processing.h create mode 100644 mcux/middleware/wifi_nxp/wls/wls_radix4Fft.c create mode 100644 mcux/middleware/wifi_nxp/wls/wls_radix4Fft.h create mode 100644 mcux/middleware/wifi_nxp/wls/wls_structure_defs.h create mode 100644 mcux/middleware/wifi_nxp/wls/wls_subspace_processing.c create mode 100644 mcux/middleware/wifi_nxp/wls/wls_subspace_processing.h diff --git a/mcux/middleware/wifi_nxp/CMakeLists.txt b/mcux/middleware/wifi_nxp/CMakeLists.txt new file mode 100644 index 000000000..3f3271b09 --- /dev/null +++ b/mcux/middleware/wifi_nxp/CMakeLists.txt @@ -0,0 +1,310 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright 2022-2024 NXP + +# define part number for this driver + +zephyr_compile_definitions_ifdef(CONFIG_NXP_88W8987 + SD8987 +) + +zephyr_compile_definitions_ifdef(CONFIG_NXP_IW416 + SD8978 +) + +zephyr_compile_definitions_ifdef(CONFIG_NXP_IW61X + SD9177 +) + +zephyr_compile_definitions_ifdef(CONFIG_NXP_88W8801 + SD8801 +) + +zephyr_compile_definitions_ifdef(CONFIG_NXP_RW610 + RW610 + WIFI_BT_TX_PWR_LIMITS="wlan_txpwrlimit_cfg_WW_rw610.h" +) + +zephyr_compile_definitions_ifdef(CONFIG_88W8987_AW_CM358_USD + WIFI_BT_TX_PWR_LIMITS="wlan_txpwrlimit_cfg_WW.h" + CONFIG_NXP_WIFI_ED_OFFSET_2G=0x09 + CONFIG_NXP_WIFI_ED_OFFSET_5G=0x0C + WIFI_BT_USE_USD_INTERFACE +) + +zephyr_compile_definitions_ifdef(CONFIG_88W8987_AW_CM358MA_M2 + WIFI_BT_TX_PWR_LIMITS="wlan_txpwrlimit_cfg_WW.h" + CONFIG_NXP_WIFI_ED_OFFSET_2G=0x09 + CONFIG_NXP_WIFI_ED_OFFSET_5G=0x0C + WIFI_BT_USE_M2_INTERFACE +) + +zephyr_compile_definitions_ifdef(CONFIG_88W8987_MURATA_1ZM_USD + WIFI_BT_TX_PWR_LIMITS="wlan_txpwrlimit_cfg_murata_1ZM_WW.h" + CONFIG_NXP_WIFI_ED_OFFSET_2G=0x06 + CONFIG_NXP_WIFI_ED_OFFSET_5G=0x06 + WIFI_BT_USE_USD_INTERFACE +) + +zephyr_compile_definitions_ifdef(CONFIG_88W8987_MURATA_1ZM_M2 + WIFI_BT_TX_PWR_LIMITS="wlan_txpwrlimit_cfg_murata_1ZM_WW.h" + CONFIG_NXP_WIFI_ED_OFFSET_2G=0x06 + CONFIG_NXP_WIFI_ED_OFFSET_5G=0x06 + WIFI_BT_USE_M2_INTERFACE +) + +zephyr_compile_definitions_ifdef(CONFIG_IW416_AW_AM457_USD + WIFI_BT_TX_PWR_LIMITS="wlan_txpwrlimit_cfg_WW.h" + CONFIG_NXP_WIFI_ED_OFFSET_2G=0x09 + CONFIG_NXP_WIFI_ED_OFFSET_5G=0x0C + WIFI_BT_USE_USD_INTERFACE +) + +zephyr_compile_definitions_ifdef(CONFIG_IW416_AW_AM457MA_M2 + WIFI_BT_TX_PWR_LIMITS="wlan_txpwrlimit_cfg_WW.h" + CONFIG_NXP_WIFI_ED_OFFSET_2G=0x09 + CONFIG_NXP_WIFI_ED_OFFSET_5G=0x0C + WIFI_BT_USE_M2_INTERFACE +) + +zephyr_compile_definitions_ifdef(CONFIG_IW416_AW_AM510_USD + WIFI_BT_TX_PWR_LIMITS="wlan_txpwrlimit_cfg_WW.h" + CONFIG_NXP_WIFI_ED_OFFSET_2G=0x09 + CONFIG_NXP_WIFI_ED_OFFSET_5G=0x0C + WIFI_BT_USE_USD_INTERFACE +) + +zephyr_compile_definitions_ifdef(CONFIG_IW416_AW_AM510MA_M2 + WIFI_BT_TX_PWR_LIMITS="wlan_txpwrlimit_cfg_murata_1XK_WW.h" + CONFIG_NXP_WIFI_ED_OFFSET_2G=0x09 + CONFIG_NXP_WIFI_ED_OFFSET_5G=0x0C + WIFI_BT_USE_M2_INTERFACE +) + +zephyr_compile_definitions_ifdef(CONFIG_IW416_MURATA_1XK_USD + WIFI_BT_TX_PWR_LIMITS="wlan_txpwrlimit_cfg_murata_1XK_WW.h" + CONFIG_NXP_WIFI_ED_OFFSET_2G=0x00 + CONFIG_NXP_WIFI_ED_OFFSET_5G=0x0C + WIFI_BT_USE_USD_INTERFACE +) + +zephyr_compile_definitions_ifdef(CONFIG_IW416_MURATA_1XK_M2 + WIFI_BT_TX_PWR_LIMITS="wlan_txpwrlimit_cfg_murata_1XK_WW.h" + CONFIG_NXP_WIFI_ED_OFFSET_2G=0x00 + CONFIG_NXP_WIFI_ED_OFFSET_5G=0x0C + WIFI_BT_USE_M2_INTERFACE +) + +zephyr_compile_definitions_ifdef(CONFIG_IW612_MURATA_2EL_USD + WIFI_BT_TX_PWR_LIMITS="wlan_txpwrlimit_cfg_murata_2EL_WW.h" + CONFIG_NXP_WIFI_ED_OFFSET_2G=0x0A + CONFIG_NXP_WIFI_ED_OFFSET_5G=0x0A + WIFI_BT_USE_USD_INTERFACE +) + +zephyr_compile_definitions_ifdef(CONFIG_IW612_MURATA_2EL_M2 + WIFI_BT_TX_PWR_LIMITS="wlan_txpwrlimit_cfg_murata_2EL_WW.h" + CONFIG_NXP_WIFI_ED_OFFSET_2G=0x0A + CONFIG_NXP_WIFI_ED_OFFSET_5G=0x0A + WIFI_BT_USE_M2_INTERFACE +) + +zephyr_compile_definitions_ifdef(CONFIG_IW611_MURATA_2DL_USD + WIFI_BT_TX_PWR_LIMITS="wlan_txpwrlimit_cfg_murata_2EL_WW.h" + CONFIG_NXP_WIFI_ED_OFFSET_2G=0x0A + CONFIG_NXP_WIFI_ED_OFFSET_5G=0x0A + WIFI_BT_USE_USD_INTERFACE +) + +zephyr_compile_definitions_ifdef(CONFIG_IW611_MURATA_2DL_M2 + WIFI_BT_TX_PWR_LIMITS="wlan_txpwrlimit_cfg_murata_2EL_WW.h" + CONFIG_NXP_WIFI_ED_OFFSET_2G=0x0A + CONFIG_NXP_WIFI_ED_OFFSET_5G=0x0A + WIFI_BT_USE_M2_INTERFACE +) + +zephyr_compile_definitions_ifdef(CONFIG_88W8801_AW_NM191_USD + WIFI_BT_TX_PWR_LIMITS="wlan_txpwrlimit_cfg_WW.h" + CONFIG_NXP_WIFI_ED_OFFSET_2G=0x1B +) + +zephyr_compile_definitions_ifdef(CONFIG_88W8801_AW_NM191MA_M2 + WIFI_BT_TX_PWR_LIMITS="wlan_txpwrlimit_cfg_WW.h" + CONFIG_NXP_WIFI_ED_OFFSET_2G=0x1B +) + +zephyr_compile_definitions_ifdef(CONFIG_88W8801_MURATA_2DS_USD + WIFI_BT_TX_PWR_LIMITS="wlan_txpwrlimit_cfg_murata_2DS_WW.h" + CONFIG_NXP_WIFI_ED_OFFSET_2G=0x0E +) + +zephyr_compile_definitions_ifdef(CONFIG_88W8801_MURATA_2DS_M2 + WIFI_BT_TX_PWR_LIMITS="wlan_txpwrlimit_cfg_murata_2DS_WW.h" + CONFIG_NXP_WIFI_ED_OFFSET_2G=0x0E +) + +zephyr_compile_definitions_ifdef(CONFIG_NXP_WIFI_BT_USE_USD_INTERFACE + WIFI_BT_USE_USD_INTERFACE +) + +zephyr_compile_definitions_ifdef(CONFIG_NXP_WIFI_BT_USE_M2_INTERFACE + WIFI_BT_USE_M2_INTERFACE +) + +zephyr_library_compile_definitions( + FSL_OSA_TASK_ENABLE=1 + CONFIG_FSL_RTOS_ZEPHYR=1 + CONFIG_OSA_DEBUG_ASSERT_ENABLED=1 +) + +zephyr_library_sources(${ZEPHYR_HAL_NXP_MODULE_DIR}/mcux/mcux-sdk/utilities/misc_utilities/fsl_memcpy.S) + +zephyr_library_sources(${ZEPHYR_HAL_NXP_MODULE_DIR}/mcux/mcux-sdk/components/lists/fsl_component_generic_list.c) + +zephyr_library_sources(${ZEPHYR_HAL_NXP_MODULE_DIR}/mcux/mcux-sdk/components/osa/fsl_os_abstraction_zephyr.c) + +zephyr_include_directories( + incl + incl/wifidriver + incl/wlcmgr + incl/port/osa + incl/port/net/zephyr + port/osa + port/net/zephyr + sdio_nxp_abs/incl + firmware_dnld + fwdnld_intf_abs + wifidriver + wifidriver/incl + wifi_bt_firmware + wifi_bt_firmware/8987 + wifi_bt_firmware/IW416 + wifi_bt_firmware/nw61x + wifi_bt_firmware/8801 + cli + ${ZEPHYR_HAL_NXP_MODULE_DIR}/mcux/mcux-sdk/components/osa/ + ${ZEPHYR_HAL_NXP_MODULE_DIR}/mcux/mcux-sdk/components/lists/ + ${ZEPHYR_HAL_NXP_MODULE_DIR}/mcux/mcux-sdk/components/wifi_bt_module/AzureWave/tx_pwr_limits/ + ${ZEPHYR_HAL_NXP_MODULE_DIR}/mcux/mcux-sdk/components/wifi_bt_module/Murata/tx_pwr_limits/ + ${ZEPHYR_HAL_NXP_MODULE_DIR}/mcux/mcux-sdk/components/rpmsg/ +) + +# OS abstraction layer source +zephyr_library_sources( + port/osa/osa.c + port/osa/osa_zephyr.c +) +# net stack abstraction layer source +zephyr_library_sources(port/net/zephyr/net.c) + +file(GLOB WIFI_SRC ./wifidriver/*.c) +list(FILTER WIFI_SRC EXCLUDE REGEX ".*imu.c$") +list(FILTER WIFI_SRC EXCLUDE REGEX ".*sdio.c$") +list(FILTER WIFI_SRC EXCLUDE REGEX ".*firmware_dnld.c$") + +zephyr_library_sources_ifdef(CONFIG_NXP_RW610 + wifidriver/wifi-imu.c +) + +zephyr_library_sources_ifdef(CONFIG_SDIO_STACK + wifidriver/sdio.c + sdio_nxp_abs/fwdnld_sdio.c + sdio_nxp_abs/mlan_sdio.c + wifidriver/wifi-sdio.c + firmware_dnld/firmware_dnld.c + fwdnld_intf_abs/fwdnld_intf_abs.c +) + +zephyr_library_sources(${WIFI_SRC}) + +file(GLOB WLCMGR_SRC ./wlcmgr/*.c) + +zephyr_library_sources(${WLCMGR_SRC}) + +# nxp wifi shell +zephyr_library_sources(cli/wifi_shell.c) +zephyr_library_sources(cli/cli_utils.c) + +# macros for wpa_supplicant +if(CONFIG_WIFI_NM_WPA_SUPPLICANT) +zephyr_include_directories( + certs + wifidriver/wpa_supp_if/incl +) + +zephyr_library_include_directories(wifidriver/wpa_supp_if wifidriver/wpa_supp_if/incl) +file(GLOB WIFI_SUPP_SRC ./wifidriver/wpa_supp_if/*.c) +zephyr_library_sources(${WIFI_SUPP_SRC}) +endif() + +zephyr_include_directories_ifdef(CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ALT + incl/port/mbedtls +) + +zephyr_library_compile_definitions_ifdef(CONFIG_WIFI_NM_HOSTAPD_AP + HOSTAPD +) + +if(CONFIG_CODE_DATA_RELOCATION) +if(CONFIG_SPEED_OPTIMIZATIONS OR CONFIG_SIZE_OPTIMIZATIONS) +# critical path code relocated to SRAM +zephyr_code_relocate(FILES + port/osa/osa.c + port/osa/osa_zephyr.c + port/net/zephyr/net.c + wifidriver/mlan_11n.c + wifidriver/mlan_11n_aggr.c + wifidriver/mlan_11n_rxreorder.c + wifidriver/mlan_wmm.c + wifidriver/wifi.c + LOCATION RAM_TEXT) + +if(CONFIG_SDIO_STACK) +zephyr_code_relocate(FILES + sdio_nxp_abs/mlan_sdio.c + wifidriver/wifi-sdio.c + LOCATION RAM_TEXT) +endif() + +if(CONFIG_NXP_RW610) +zephyr_code_relocate(FILES + wifidriver/wifi-imu.c + ${ZEPHYR_HAL_NXP_MODULE_DIR}/mcux/mcux-sdk/drivers/imu/fsl_imu.c + ${ZEPHYR_HAL_NXP_MODULE_DIR}/mcux/mcux-sdk/components/rpmsg/fsl_adapter_rfimu.c + LOCATION RAM_TEXT) +endif() + +zephyr_code_relocate(FILES + ${ZEPHYR_HAL_NXP_MODULE_DIR}/mcux/mcux-sdk/components/osa/fsl_os_abstraction_zephyr.c + ${ZEPHYR_HAL_NXP_MODULE_DIR}/mcux/mcux-sdk/utilities/misc_utilities/fsl_memcpy.S + LOCATION RAM_TEXT) + +file(GLOB ZPERF_SRC ${ZEPHYR_BASE}/subsys/net/lib/zperf/*.c) +zephyr_code_relocate(FILES ${ZPERF_SRC} LOCATION RAM_TEXT) + +file(GLOB SOCKET_SRC ${ZEPHYR_BASE}/subsys/net/lib/sockets/*.c) +zephyr_code_relocate(FILES ${SOCKET_SRC} LOCATION RAM_TEXT) + +file(GLOB NET_SRC ${ZEPHYR_BASE}/subsys/net/ip/*.c) +zephyr_code_relocate(FILES ${NET_SRC} LOCATION RAM_TEXT) + +file(GLOB ETH_SRC ${ZEPHYR_BASE}/subsys/net/l2/ethernet/*.c) +zephyr_code_relocate(FILES ${ETH_SRC} LOCATION RAM_TEXT) + +zephyr_code_relocate(FILES ${ZEPHYR_BASE}/lib/net_buf/buf.c LOCATION RAM_TEXT) + +zephyr_code_relocate(FILES + ${ZEPHYR_BASE}/kernel/mem_slab.c + ${ZEPHYR_BASE}/kernel/mempool.c + ${ZEPHYR_BASE}/kernel/msg_q.c + ${ZEPHYR_BASE}/kernel/mutex.c + ${ZEPHYR_BASE}/kernel/queue.c + ${ZEPHYR_BASE}/kernel/sched.c + ${ZEPHYR_BASE}/kernel/sem.c + ${ZEPHYR_BASE}/kernel/thread.c + ${ZEPHYR_BASE}/kernel/work.c + LOCATION RAM_TEXT) +endif() +endif() + +zephyr_library_link_libraries_ifdef(CONFIG_MBEDTLS mbedTLS) +zephyr_library_link_libraries_ifdef(CONFIG_WIFI_NM_WPA_SUPPLICANT hostap) diff --git a/mcux/middleware/wifi_nxp/README.txt b/mcux/middleware/wifi_nxp/README.txt new file mode 100644 index 000000000..20c4fc323 --- /dev/null +++ b/mcux/middleware/wifi_nxp/README.txt @@ -0,0 +1,30 @@ +Please start by looking at the documentation under +doxy/refman/. + +/* Doxygen related documentation */ +/** +* \mainpage +* +* \section intro Introduction +* +* NXP's WiFi functionality enables customers to +* quickly develop applications of interest to add connectivity to +* different sensors and appliances. +* +* \subsection devdoc Developer Documentation +* +* This manual provides developer reference documentation for WiFi driver and +* WLAN Connection Manager. +* +* In addition to the reference documentation in this manual, you can +* also explore the source code. +* +* \note +* The File Documentation provides documentation for all the APIs that are +* available in WiFi driver and connection manager. +* +*/ + + + + diff --git a/mcux/middleware/wifi_nxp/certs/ca-cert.h b/mcux/middleware/wifi_nxp/certs/ca-cert.h new file mode 100644 index 000000000..25bff7cd5 --- /dev/null +++ b/mcux/middleware/wifi_nxp/certs/ca-cert.h @@ -0,0 +1,65 @@ +const unsigned char ca_der[] = { + 0x30, 0x82, 0x04, 0xa1, 0x30, 0x82, 0x03, 0x09, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x14, 0x39, 0x27, 0xf3, 0x9b, + 0x20, 0x1e, 0xa5, 0xe3, 0xda, 0xdb, 0x44, 0x64, 0x0d, 0x71, 0x24, 0xb6, 0x8a, 0x94, 0x33, 0x64, 0x30, 0x0d, 0x06, + 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x30, 0x5f, 0x31, 0x0b, 0x30, 0x09, 0x06, + 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x49, 0x4e, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0c, 0x02, + 0x4d, 0x48, 0x31, 0x0d, 0x30, 0x0b, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0c, 0x04, 0x50, 0x55, 0x4e, 0x45, 0x31, 0x0c, + 0x30, 0x0a, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x03, 0x4e, 0x58, 0x50, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, + 0x04, 0x03, 0x0c, 0x02, 0x43, 0x41, 0x31, 0x19, 0x30, 0x17, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, + 0x09, 0x01, 0x16, 0x0a, 0x63, 0x61, 0x40, 0x6e, 0x78, 0x70, 0x2e, 0x63, 0x6f, 0x6d, 0x30, 0x20, 0x17, 0x0d, 0x32, + 0x33, 0x30, 0x33, 0x31, 0x35, 0x31, 0x34, 0x32, 0x33, 0x31, 0x33, 0x5a, 0x18, 0x0f, 0x33, 0x30, 0x32, 0x32, 0x30, + 0x37, 0x31, 0x36, 0x31, 0x34, 0x32, 0x33, 0x31, 0x33, 0x5a, 0x30, 0x5f, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, + 0x04, 0x06, 0x13, 0x02, 0x49, 0x4e, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0c, 0x02, 0x4d, 0x48, + 0x31, 0x0d, 0x30, 0x0b, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0c, 0x04, 0x50, 0x55, 0x4e, 0x45, 0x31, 0x0c, 0x30, 0x0a, + 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x03, 0x4e, 0x58, 0x50, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x03, + 0x0c, 0x02, 0x43, 0x41, 0x31, 0x19, 0x30, 0x17, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x01, + 0x16, 0x0a, 0x63, 0x61, 0x40, 0x6e, 0x78, 0x70, 0x2e, 0x63, 0x6f, 0x6d, 0x30, 0x82, 0x01, 0xa2, 0x30, 0x0d, 0x06, + 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x8f, 0x00, 0x30, 0x82, + 0x01, 0x8a, 0x02, 0x82, 0x01, 0x81, 0x00, 0xdd, 0x70, 0x03, 0x4e, 0xb4, 0x53, 0xdf, 0x45, 0xfb, 0xf2, 0x9f, 0x74, + 0x0b, 0x1e, 0x53, 0x0e, 0x98, 0x30, 0x5b, 0x68, 0x26, 0x8f, 0x59, 0xba, 0xfc, 0x3c, 0xd6, 0x80, 0x33, 0xd4, 0xf1, + 0x16, 0x44, 0x42, 0xc7, 0x7e, 0x77, 0xfe, 0x0b, 0xae, 0x92, 0x50, 0x4c, 0x3b, 0xeb, 0x3f, 0x28, 0x53, 0x4d, 0xa0, + 0x58, 0xad, 0xd9, 0x88, 0x4a, 0xd8, 0xac, 0x52, 0xfb, 0x35, 0x5a, 0x34, 0x07, 0xb9, 0x14, 0xd4, 0x0f, 0x3d, 0xa5, + 0x7a, 0xa8, 0x44, 0x17, 0x9c, 0x97, 0xb6, 0x7f, 0x0e, 0x7a, 0x05, 0x33, 0x65, 0x58, 0x42, 0xf0, 0x61, 0xd8, 0x20, + 0x1f, 0xaa, 0xc6, 0xdc, 0xcf, 0x6b, 0x50, 0xb5, 0x13, 0x55, 0x19, 0x3f, 0x57, 0x6d, 0x15, 0x8f, 0x33, 0xe9, 0x86, + 0x98, 0x85, 0xdf, 0xb3, 0x72, 0x4b, 0x8b, 0xa1, 0xe3, 0xa9, 0xa5, 0x43, 0x84, 0xcd, 0x61, 0x6a, 0x61, 0xbc, 0x1a, + 0xb9, 0xd6, 0x57, 0xaa, 0x53, 0x4e, 0xa3, 0x1c, 0x8a, 0xab, 0x81, 0x40, 0x84, 0xaa, 0x11, 0x55, 0xcf, 0x37, 0xb4, + 0x69, 0xe5, 0x65, 0x59, 0x27, 0x74, 0x78, 0xfb, 0xa3, 0xf0, 0x1a, 0xa1, 0xdd, 0xaf, 0xd7, 0x5e, 0x65, 0x72, 0x99, + 0x1b, 0x40, 0x44, 0x99, 0x9f, 0x67, 0x30, 0x5f, 0x12, 0x3c, 0xb7, 0x6a, 0x03, 0xe3, 0x35, 0x10, 0xc2, 0x02, 0x80, + 0x66, 0x80, 0xc2, 0xa6, 0x50, 0x9a, 0x9a, 0xa1, 0xa1, 0xf3, 0xc4, 0x06, 0x3b, 0x87, 0x3f, 0xb3, 0x0a, 0x52, 0x4d, + 0xb7, 0x3c, 0x8b, 0x8d, 0x17, 0x23, 0x4f, 0x4c, 0x27, 0x7d, 0x1c, 0xb2, 0xb2, 0x6c, 0x19, 0x0c, 0xef, 0x6c, 0xf2, + 0x2a, 0xfc, 0x6a, 0x98, 0xb4, 0x7f, 0x46, 0xa2, 0xf2, 0xf1, 0x36, 0x46, 0xbf, 0x40, 0x06, 0x47, 0xf3, 0xdd, 0xa7, + 0xe7, 0xe4, 0xef, 0xd3, 0x1e, 0xc5, 0x01, 0xb1, 0xb0, 0x1a, 0x8b, 0x86, 0x06, 0x5f, 0x66, 0xc4, 0x3a, 0xa5, 0x49, + 0x09, 0xaa, 0xf6, 0x64, 0x51, 0x41, 0x14, 0x8a, 0x7b, 0x9c, 0x06, 0xfa, 0xff, 0x06, 0xa0, 0xf2, 0x12, 0xa9, 0xef, + 0x14, 0x2d, 0xd3, 0x6e, 0xee, 0x0f, 0x35, 0x10, 0xb0, 0x7a, 0x1b, 0xbb, 0x58, 0x44, 0xe8, 0x18, 0x5c, 0xc0, 0x26, + 0x1c, 0xfb, 0xc3, 0x80, 0x97, 0xc1, 0xae, 0x56, 0x44, 0xd1, 0x5e, 0xd8, 0xe1, 0x66, 0xfd, 0x43, 0xea, 0x3e, 0x1f, + 0x88, 0x00, 0x73, 0xb1, 0x05, 0xd5, 0xbb, 0x70, 0xe6, 0xea, 0xab, 0x6a, 0x63, 0xe7, 0xa2, 0x3b, 0xad, 0x50, 0xe0, + 0xc8, 0x79, 0x22, 0x71, 0x8d, 0x31, 0x5c, 0x7d, 0xf6, 0xea, 0x0b, 0x92, 0x7a, 0x1d, 0x46, 0xde, 0xf7, 0x33, 0x4d, + 0xca, 0xb0, 0xa4, 0x81, 0x1b, 0xd8, 0xd3, 0xf1, 0x8d, 0xa7, 0xc1, 0xe2, 0x84, 0x24, 0x31, 0x19, 0x71, 0x8c, 0xe6, + 0xfe, 0x5d, 0xdb, 0xcd, 0x8b, 0xae, 0xa3, 0x25, 0xdd, 0x2d, 0x07, 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3, 0x53, 0x30, + 0x51, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0xc5, 0x31, 0x78, 0x1d, 0x4a, 0xde, 0xf0, + 0x95, 0x0c, 0xdd, 0xd2, 0x21, 0x41, 0x2c, 0x8c, 0xfa, 0xc8, 0x20, 0x2d, 0xb1, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, + 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0xc5, 0x31, 0x78, 0x1d, 0x4a, 0xde, 0xf0, 0x95, 0x0c, 0xdd, 0xd2, 0x21, + 0x41, 0x2c, 0x8c, 0xfa, 0xc8, 0x20, 0x2d, 0xb1, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, + 0x05, 0x30, 0x03, 0x01, 0x01, 0xff, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, + 0x05, 0x00, 0x03, 0x82, 0x01, 0x81, 0x00, 0xb1, 0x1b, 0x2b, 0xdc, 0xf0, 0x60, 0x19, 0xa8, 0x83, 0xb9, 0x10, 0xc3, + 0x69, 0x40, 0x52, 0x09, 0x14, 0x41, 0x85, 0x5c, 0x07, 0x73, 0xbc, 0x0f, 0x19, 0xae, 0xcd, 0x40, 0xb2, 0x88, 0x60, + 0x12, 0x15, 0x49, 0x8a, 0x37, 0x82, 0xb5, 0x66, 0xa6, 0xea, 0x3e, 0x94, 0xe0, 0x17, 0x64, 0x1d, 0x9f, 0x40, 0x49, + 0x03, 0x8e, 0x0b, 0x0d, 0x4e, 0x16, 0xdf, 0x3d, 0x0d, 0x1d, 0x79, 0xe5, 0xaf, 0xd0, 0x20, 0x48, 0xe2, 0x4b, 0x07, + 0xc1, 0x3a, 0x23, 0x10, 0x21, 0xc2, 0x72, 0xe1, 0xb4, 0xd6, 0x78, 0xd8, 0xe5, 0xa9, 0xa8, 0x34, 0x2c, 0x74, 0x70, + 0x09, 0x30, 0xb7, 0xbe, 0xde, 0x3e, 0x25, 0x02, 0x74, 0xfc, 0xe4, 0x1c, 0xfa, 0xb9, 0xa7, 0x70, 0x94, 0xfa, 0x52, + 0x5f, 0x32, 0x73, 0x93, 0x1b, 0x1c, 0x11, 0xb4, 0xc6, 0x7a, 0xd9, 0x72, 0x18, 0xf5, 0x74, 0x06, 0xce, 0xb6, 0xb1, + 0x0f, 0x5c, 0x45, 0x21, 0xca, 0x52, 0xda, 0x14, 0x50, 0x8a, 0x1a, 0x30, 0xbd, 0xd3, 0xed, 0x13, 0x10, 0x5c, 0x94, + 0x93, 0xb0, 0x45, 0x46, 0x31, 0xbb, 0xb1, 0x61, 0xc8, 0xa9, 0xad, 0x91, 0xee, 0xe1, 0xea, 0xeb, 0x1f, 0x8e, 0x67, + 0x22, 0xc4, 0x3a, 0x54, 0xd8, 0x52, 0xeb, 0xde, 0xcf, 0x6d, 0x72, 0x31, 0xaf, 0x75, 0x8c, 0xd2, 0x2c, 0xa8, 0x72, + 0x8d, 0x1a, 0x35, 0x53, 0x4b, 0x10, 0x98, 0xc7, 0xd8, 0x3d, 0x59, 0x18, 0x24, 0xdf, 0x57, 0xe6, 0x31, 0x91, 0x55, + 0x17, 0x2e, 0x40, 0x1d, 0x82, 0x34, 0xa6, 0x2d, 0x99, 0x23, 0x73, 0xd6, 0x1c, 0x2b, 0x66, 0xe2, 0x50, 0x18, 0xc2, + 0x9d, 0x85, 0x32, 0x12, 0xac, 0x7e, 0x41, 0x76, 0x33, 0x39, 0x5b, 0x6d, 0x22, 0xd4, 0x0b, 0xb0, 0xc2, 0x26, 0x53, + 0x72, 0x2c, 0x18, 0xbf, 0x45, 0x13, 0x8f, 0xce, 0xc8, 0x28, 0x3c, 0x6d, 0x13, 0x83, 0x02, 0x79, 0xe0, 0x38, 0xb7, + 0x14, 0x74, 0x1e, 0xab, 0xc8, 0x9d, 0xad, 0xe2, 0x64, 0xae, 0x4f, 0x16, 0xd6, 0x60, 0xa1, 0x0d, 0x90, 0x11, 0xce, + 0x9b, 0x9b, 0x51, 0xe0, 0xba, 0x7c, 0xa2, 0xb5, 0xfd, 0xa4, 0x40, 0x7f, 0xee, 0xaa, 0x5f, 0xf1, 0xbd, 0xf8, 0x04, + 0x8f, 0x5a, 0x82, 0x50, 0x80, 0xf5, 0x27, 0x18, 0x8d, 0x37, 0x86, 0x35, 0xb5, 0xf2, 0xfa, 0x18, 0x71, 0x82, 0x24, + 0x9a, 0xdd, 0x37, 0x1e, 0xf1, 0xee, 0xd8, 0xd2, 0x16, 0xf4, 0x93, 0xa7, 0x35, 0x46, 0xa0, 0x54, 0x1c, 0x3b, 0x7d, + 0x77, 0x48, 0x4e, 0x76, 0x46, 0x27, 0x2d, 0x83, 0x40, 0x76, 0x66, 0x1b, 0x3c, 0x7b, 0x57, 0x68, 0x2d, 0x9d, 0x21, + 0xa4, 0x70, 0xf5, 0xff, 0x58, 0xce, 0x3c, 0xf3, 0xc9, 0x67, 0x8c, 0x9d, 0x5a, 0x9c, 0xa0, 0x02, 0xf3, 0x0c, 0x44, + 0x65, 0x1b, 0xe3, 0x51, 0x79, 0xcd, 0xf7, 0xb6, 0x66, 0xb3, 0x9d}; +unsigned int ca_der_len = 1189; diff --git a/mcux/middleware/wifi_nxp/certs/client-cert.h b/mcux/middleware/wifi_nxp/certs/client-cert.h new file mode 100644 index 000000000..48b77f649 --- /dev/null +++ b/mcux/middleware/wifi_nxp/certs/client-cert.h @@ -0,0 +1,60 @@ +const unsigned char client_der[] = { + 0x30, 0x82, 0x04, 0x3c, 0x30, 0x82, 0x02, 0xa4, 0x02, 0x01, 0x01, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, + 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x30, 0x5f, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, + 0x02, 0x49, 0x4e, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0c, 0x02, 0x4d, 0x48, 0x31, 0x0d, 0x30, + 0x0b, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0c, 0x04, 0x50, 0x55, 0x4e, 0x45, 0x31, 0x0c, 0x30, 0x0a, 0x06, 0x03, 0x55, + 0x04, 0x0a, 0x0c, 0x03, 0x4e, 0x58, 0x50, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x02, 0x43, + 0x41, 0x31, 0x19, 0x30, 0x17, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x01, 0x16, 0x0a, 0x63, + 0x61, 0x40, 0x6e, 0x78, 0x70, 0x2e, 0x63, 0x6f, 0x6d, 0x30, 0x20, 0x17, 0x0d, 0x32, 0x33, 0x30, 0x33, 0x31, 0x35, + 0x31, 0x34, 0x32, 0x36, 0x32, 0x31, 0x5a, 0x18, 0x0f, 0x33, 0x30, 0x32, 0x32, 0x30, 0x37, 0x31, 0x36, 0x31, 0x34, + 0x32, 0x36, 0x32, 0x31, 0x5a, 0x30, 0x67, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x49, + 0x4e, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0c, 0x02, 0x4d, 0x48, 0x31, 0x0d, 0x30, 0x0b, 0x06, + 0x03, 0x55, 0x04, 0x07, 0x0c, 0x04, 0x50, 0x55, 0x4e, 0x45, 0x31, 0x0c, 0x30, 0x0a, 0x06, 0x03, 0x55, 0x04, 0x0a, + 0x0c, 0x03, 0x4e, 0x58, 0x50, 0x31, 0x0f, 0x30, 0x0d, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x06, 0x43, 0x6c, 0x69, + 0x65, 0x6e, 0x74, 0x31, 0x1d, 0x30, 0x1b, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x01, 0x16, + 0x0e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x40, 0x6e, 0x78, 0x70, 0x2e, 0x63, 0x6f, 0x6d, 0x30, 0x82, 0x01, 0xa2, + 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x8f, + 0x00, 0x30, 0x82, 0x01, 0x8a, 0x02, 0x82, 0x01, 0x81, 0x00, 0xd6, 0xd8, 0x4e, 0x1a, 0xc7, 0x51, 0x89, 0x3c, 0x6e, + 0xd5, 0xf7, 0xc2, 0x44, 0xbd, 0x8d, 0x53, 0x6a, 0x01, 0xc4, 0x6b, 0x1d, 0xe3, 0xae, 0xbd, 0x83, 0x34, 0x92, 0x31, + 0x89, 0xe3, 0x65, 0x63, 0x25, 0xf3, 0xe8, 0x38, 0x37, 0xcd, 0xae, 0x13, 0xac, 0xe3, 0x61, 0xa8, 0x4f, 0x1a, 0xa0, + 0x61, 0xb0, 0x54, 0x19, 0x39, 0x4c, 0xd5, 0xb2, 0x99, 0xaa, 0x2c, 0x15, 0xe5, 0x7e, 0x61, 0xec, 0xe9, 0x2f, 0x1e, + 0xd1, 0x89, 0x91, 0x90, 0x08, 0x08, 0x51, 0xc7, 0x8a, 0x9f, 0xa2, 0xf0, 0xa8, 0x69, 0x8e, 0xf7, 0xda, 0x7e, 0x69, + 0xb4, 0x28, 0xf8, 0x83, 0x81, 0x6d, 0x96, 0x6d, 0xb2, 0x88, 0x98, 0xa3, 0x1f, 0x2f, 0xe3, 0x09, 0x3a, 0x5e, 0xe1, + 0x0a, 0xfc, 0xba, 0xd5, 0x98, 0x0a, 0x1d, 0x66, 0x1f, 0xeb, 0x8d, 0x9b, 0x6a, 0x7a, 0xd9, 0x43, 0x29, 0x8c, 0xd9, + 0xbd, 0x6e, 0x97, 0xde, 0x84, 0x8b, 0xe0, 0x9c, 0x36, 0x21, 0xd8, 0x22, 0xa1, 0xbf, 0xcc, 0x01, 0x53, 0x53, 0x31, + 0x36, 0x97, 0xaa, 0xfe, 0x53, 0x88, 0x14, 0xc9, 0xac, 0xbb, 0x03, 0x4d, 0x74, 0x48, 0x8d, 0x47, 0x5b, 0xbe, 0x41, + 0xc0, 0xd2, 0x70, 0x2a, 0xc0, 0x41, 0x2d, 0xa8, 0x1a, 0xd8, 0xa5, 0x88, 0xd1, 0x5e, 0x07, 0x33, 0x40, 0x00, 0xaa, + 0xe4, 0xc3, 0xd1, 0xb5, 0x57, 0x22, 0x1c, 0xfc, 0xc8, 0x84, 0x23, 0xab, 0xe2, 0x27, 0x2d, 0x40, 0xa8, 0x1e, 0x39, + 0xf3, 0x58, 0xd3, 0x6a, 0x62, 0x55, 0x6d, 0x46, 0x53, 0xf9, 0xad, 0x5a, 0xa4, 0xf5, 0xba, 0x5c, 0xb8, 0x95, 0xc8, + 0x32, 0xef, 0x8e, 0x77, 0x50, 0x58, 0x71, 0xc8, 0xaf, 0x5b, 0xc2, 0x8c, 0x37, 0x46, 0xeb, 0x75, 0xbc, 0x96, 0x89, + 0x12, 0x86, 0xe8, 0x5c, 0x9e, 0x34, 0x42, 0xed, 0xbc, 0xf6, 0x72, 0x69, 0x28, 0xa5, 0xbd, 0x36, 0x9c, 0xe2, 0x67, + 0xf1, 0x09, 0x4f, 0xcb, 0x49, 0x96, 0x45, 0x16, 0xe4, 0xe8, 0x6a, 0x03, 0x91, 0xab, 0x77, 0x5a, 0x52, 0x49, 0x9c, + 0xa6, 0x6a, 0x84, 0xc1, 0x7c, 0x7b, 0x68, 0x71, 0x23, 0x3d, 0x82, 0x13, 0x58, 0x1c, 0xd7, 0x75, 0x37, 0x81, 0x86, + 0x2e, 0xfb, 0x74, 0x66, 0xfb, 0xcf, 0xfe, 0xab, 0x57, 0x1c, 0xe0, 0x02, 0x95, 0x4c, 0x54, 0x7d, 0x31, 0xf7, 0xb7, + 0x3f, 0xe2, 0xb8, 0xf0, 0xe6, 0x90, 0x68, 0x8d, 0x81, 0x9b, 0xdd, 0xad, 0x25, 0x8d, 0x53, 0x5b, 0x6e, 0xbe, 0x87, + 0x61, 0x62, 0x10, 0xe6, 0x2b, 0x2e, 0x14, 0xa6, 0x1b, 0x0c, 0x5a, 0xca, 0xe1, 0x32, 0xb1, 0xf9, 0xd6, 0x0b, 0xb2, + 0xfb, 0xc4, 0xf4, 0xe8, 0xf9, 0x86, 0xae, 0x9c, 0x8c, 0x37, 0x07, 0x96, 0x59, 0x87, 0xdf, 0x2d, 0xd4, 0x05, 0x97, + 0x7d, 0xc2, 0x59, 0xef, 0xa9, 0x8c, 0xcd, 0x7c, 0xb6, 0xab, 0x14, 0xc7, 0x7d, 0xe3, 0x02, 0x03, 0x01, 0x00, 0x01, + 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x03, 0x82, 0x01, 0x81, + 0x00, 0xc4, 0xce, 0x37, 0x39, 0x3f, 0x3e, 0x78, 0xdb, 0x9e, 0x37, 0x9c, 0x42, 0x49, 0x30, 0x65, 0xe7, 0x59, 0xd1, + 0xd8, 0x83, 0x55, 0xf4, 0x1b, 0xb0, 0x8e, 0x43, 0xc4, 0x5c, 0x6c, 0xca, 0x95, 0x5a, 0xd9, 0x89, 0xd3, 0x4b, 0x73, + 0x78, 0x8a, 0x3a, 0xc6, 0xe3, 0xdc, 0x67, 0x1d, 0xb6, 0xe9, 0x8e, 0x67, 0x71, 0x0a, 0xa4, 0x00, 0x79, 0x82, 0x40, + 0x11, 0x64, 0x86, 0x4a, 0x8a, 0x8f, 0x98, 0xce, 0x2c, 0x74, 0xb5, 0x56, 0xeb, 0xfa, 0xe8, 0x83, 0x27, 0x0f, 0xec, + 0x12, 0xcb, 0x85, 0x30, 0x9a, 0x16, 0xcc, 0x15, 0x91, 0xb5, 0x66, 0xd0, 0x58, 0xec, 0x1f, 0x55, 0x2c, 0xde, 0x17, + 0xc1, 0x83, 0x5c, 0x50, 0x53, 0x8f, 0x64, 0x62, 0xab, 0xec, 0x2b, 0x04, 0x06, 0xeb, 0x29, 0x7e, 0x18, 0x53, 0xfa, + 0xfd, 0x0b, 0x79, 0x73, 0x65, 0x02, 0x5b, 0x85, 0x8f, 0x8b, 0xb3, 0xd3, 0xa1, 0x1b, 0x3e, 0x4c, 0x90, 0x55, 0xd1, + 0x38, 0x01, 0x0c, 0x76, 0xca, 0x06, 0xe3, 0xaa, 0x3e, 0x7b, 0xfc, 0x3c, 0xbe, 0x8c, 0x25, 0x5a, 0x06, 0x5f, 0x1f, + 0x61, 0x8b, 0xab, 0x2c, 0xa4, 0xc3, 0xc7, 0x2b, 0xfa, 0x07, 0x63, 0x1c, 0xda, 0xea, 0x3f, 0x09, 0x92, 0x67, 0x40, + 0xbb, 0x5d, 0xd5, 0xc8, 0x3d, 0xf0, 0x6b, 0xdc, 0x7d, 0x88, 0x6a, 0x42, 0xb2, 0xe4, 0xd0, 0x82, 0x69, 0xb5, 0x00, + 0x18, 0x40, 0x3c, 0xd1, 0x2c, 0x22, 0x8d, 0xda, 0x9a, 0xdf, 0xb6, 0x79, 0x51, 0xf9, 0x73, 0xe8, 0xfd, 0xb1, 0xb4, + 0x24, 0x3c, 0x2f, 0xfe, 0xeb, 0xb3, 0xd2, 0x0c, 0x14, 0x64, 0x9b, 0x63, 0xe9, 0xc4, 0x71, 0x8e, 0x6b, 0xac, 0x5a, + 0xa2, 0x16, 0x18, 0xe9, 0x12, 0xec, 0xa1, 0x8c, 0x4c, 0x81, 0xd1, 0x26, 0xb3, 0xa5, 0x3d, 0x5a, 0x0f, 0xf1, 0x81, + 0xe4, 0x2b, 0xb5, 0x9a, 0xc6, 0x83, 0x28, 0x64, 0x92, 0xfe, 0x36, 0x88, 0xab, 0x16, 0x29, 0x5a, 0x03, 0xef, 0x96, + 0x2c, 0xb0, 0xd8, 0x16, 0x02, 0x3b, 0x5d, 0x38, 0xff, 0xed, 0xcb, 0x59, 0xdf, 0xb0, 0x9a, 0x5f, 0xae, 0xf9, 0xff, + 0xaa, 0xd3, 0xaf, 0x7c, 0xce, 0xa2, 0xeb, 0xd0, 0xeb, 0xb4, 0x2e, 0xb8, 0x60, 0xea, 0x7f, 0xb5, 0x79, 0xb5, 0x93, + 0x39, 0x83, 0x04, 0x2b, 0xfe, 0xab, 0xd3, 0x9b, 0x8c, 0xee, 0x32, 0x13, 0x76, 0xaa, 0xed, 0x67, 0x87, 0x0d, 0xa9, + 0x7b, 0xe8, 0x96, 0xb3, 0x22, 0x3e, 0xf4, 0xac, 0xf8, 0xd4, 0x1e, 0xce, 0x1c, 0x73, 0x9a, 0xf4, 0x13, 0x33, 0xe6, + 0x0f, 0x43, 0xc3, 0xe5, 0x23, 0x78, 0xeb, 0xc3, 0xe4, 0x98, 0x82, 0x46, 0x0f, 0x93, 0xb0, 0xda, 0xa5, 0xa4, 0xb8, + 0x9b, 0x81, 0x65, 0x68, 0xf5, 0xf1, 0xae, 0xd0, 0x5c, 0x9e, 0x9d, 0x9b, 0xa8, 0x88, 0x2f, 0xdd, 0x25, 0x2b, 0xf3, + 0xbb, 0xe0, 0xfe, 0xf8, 0xeb}; +unsigned int client_der_len = 1088; diff --git a/mcux/middleware/wifi_nxp/certs/client-key.h b/mcux/middleware/wifi_nxp/certs/client-key.h new file mode 100644 index 000000000..c71f5d629 --- /dev/null +++ b/mcux/middleware/wifi_nxp/certs/client-key.h @@ -0,0 +1,95 @@ +const unsigned char client_key_der[] = { + 0x30, 0x82, 0x06, 0xe3, 0x02, 0x01, 0x00, 0x02, 0x82, 0x01, 0x81, 0x00, 0xd6, 0xd8, 0x4e, 0x1a, 0xc7, 0x51, 0x89, + 0x3c, 0x6e, 0xd5, 0xf7, 0xc2, 0x44, 0xbd, 0x8d, 0x53, 0x6a, 0x01, 0xc4, 0x6b, 0x1d, 0xe3, 0xae, 0xbd, 0x83, 0x34, + 0x92, 0x31, 0x89, 0xe3, 0x65, 0x63, 0x25, 0xf3, 0xe8, 0x38, 0x37, 0xcd, 0xae, 0x13, 0xac, 0xe3, 0x61, 0xa8, 0x4f, + 0x1a, 0xa0, 0x61, 0xb0, 0x54, 0x19, 0x39, 0x4c, 0xd5, 0xb2, 0x99, 0xaa, 0x2c, 0x15, 0xe5, 0x7e, 0x61, 0xec, 0xe9, + 0x2f, 0x1e, 0xd1, 0x89, 0x91, 0x90, 0x08, 0x08, 0x51, 0xc7, 0x8a, 0x9f, 0xa2, 0xf0, 0xa8, 0x69, 0x8e, 0xf7, 0xda, + 0x7e, 0x69, 0xb4, 0x28, 0xf8, 0x83, 0x81, 0x6d, 0x96, 0x6d, 0xb2, 0x88, 0x98, 0xa3, 0x1f, 0x2f, 0xe3, 0x09, 0x3a, + 0x5e, 0xe1, 0x0a, 0xfc, 0xba, 0xd5, 0x98, 0x0a, 0x1d, 0x66, 0x1f, 0xeb, 0x8d, 0x9b, 0x6a, 0x7a, 0xd9, 0x43, 0x29, + 0x8c, 0xd9, 0xbd, 0x6e, 0x97, 0xde, 0x84, 0x8b, 0xe0, 0x9c, 0x36, 0x21, 0xd8, 0x22, 0xa1, 0xbf, 0xcc, 0x01, 0x53, + 0x53, 0x31, 0x36, 0x97, 0xaa, 0xfe, 0x53, 0x88, 0x14, 0xc9, 0xac, 0xbb, 0x03, 0x4d, 0x74, 0x48, 0x8d, 0x47, 0x5b, + 0xbe, 0x41, 0xc0, 0xd2, 0x70, 0x2a, 0xc0, 0x41, 0x2d, 0xa8, 0x1a, 0xd8, 0xa5, 0x88, 0xd1, 0x5e, 0x07, 0x33, 0x40, + 0x00, 0xaa, 0xe4, 0xc3, 0xd1, 0xb5, 0x57, 0x22, 0x1c, 0xfc, 0xc8, 0x84, 0x23, 0xab, 0xe2, 0x27, 0x2d, 0x40, 0xa8, + 0x1e, 0x39, 0xf3, 0x58, 0xd3, 0x6a, 0x62, 0x55, 0x6d, 0x46, 0x53, 0xf9, 0xad, 0x5a, 0xa4, 0xf5, 0xba, 0x5c, 0xb8, + 0x95, 0xc8, 0x32, 0xef, 0x8e, 0x77, 0x50, 0x58, 0x71, 0xc8, 0xaf, 0x5b, 0xc2, 0x8c, 0x37, 0x46, 0xeb, 0x75, 0xbc, + 0x96, 0x89, 0x12, 0x86, 0xe8, 0x5c, 0x9e, 0x34, 0x42, 0xed, 0xbc, 0xf6, 0x72, 0x69, 0x28, 0xa5, 0xbd, 0x36, 0x9c, + 0xe2, 0x67, 0xf1, 0x09, 0x4f, 0xcb, 0x49, 0x96, 0x45, 0x16, 0xe4, 0xe8, 0x6a, 0x03, 0x91, 0xab, 0x77, 0x5a, 0x52, + 0x49, 0x9c, 0xa6, 0x6a, 0x84, 0xc1, 0x7c, 0x7b, 0x68, 0x71, 0x23, 0x3d, 0x82, 0x13, 0x58, 0x1c, 0xd7, 0x75, 0x37, + 0x81, 0x86, 0x2e, 0xfb, 0x74, 0x66, 0xfb, 0xcf, 0xfe, 0xab, 0x57, 0x1c, 0xe0, 0x02, 0x95, 0x4c, 0x54, 0x7d, 0x31, + 0xf7, 0xb7, 0x3f, 0xe2, 0xb8, 0xf0, 0xe6, 0x90, 0x68, 0x8d, 0x81, 0x9b, 0xdd, 0xad, 0x25, 0x8d, 0x53, 0x5b, 0x6e, + 0xbe, 0x87, 0x61, 0x62, 0x10, 0xe6, 0x2b, 0x2e, 0x14, 0xa6, 0x1b, 0x0c, 0x5a, 0xca, 0xe1, 0x32, 0xb1, 0xf9, 0xd6, + 0x0b, 0xb2, 0xfb, 0xc4, 0xf4, 0xe8, 0xf9, 0x86, 0xae, 0x9c, 0x8c, 0x37, 0x07, 0x96, 0x59, 0x87, 0xdf, 0x2d, 0xd4, + 0x05, 0x97, 0x7d, 0xc2, 0x59, 0xef, 0xa9, 0x8c, 0xcd, 0x7c, 0xb6, 0xab, 0x14, 0xc7, 0x7d, 0xe3, 0x02, 0x03, 0x01, + 0x00, 0x01, 0x02, 0x82, 0x01, 0x80, 0x04, 0x89, 0x7c, 0xdc, 0xc3, 0xe8, 0xcc, 0xe5, 0x21, 0xd2, 0x12, 0xf1, 0x5f, + 0x52, 0x41, 0x71, 0xc9, 0x83, 0x50, 0x0a, 0x93, 0x0f, 0x03, 0xd9, 0xac, 0xb3, 0xa7, 0x82, 0xb4, 0x4e, 0xc1, 0x0d, + 0x5e, 0xf7, 0xcf, 0xa7, 0xa0, 0x46, 0x0f, 0xaf, 0x0a, 0xaf, 0xa2, 0x98, 0x53, 0x53, 0x54, 0x9f, 0xbb, 0x81, 0x8b, + 0x26, 0xd2, 0xa0, 0x90, 0xac, 0xfe, 0x13, 0x00, 0x43, 0x60, 0x6f, 0xe0, 0xf8, 0xeb, 0xad, 0xd2, 0xee, 0xfc, 0xcb, + 0xf5, 0xdf, 0x77, 0x1a, 0xa7, 0xaa, 0xc7, 0x5e, 0x1d, 0xb0, 0x5c, 0xfc, 0x8e, 0xf8, 0xac, 0x72, 0xc9, 0x8a, 0xb5, + 0xfc, 0x3d, 0xbc, 0x37, 0x84, 0xd5, 0xad, 0xa3, 0x84, 0x3d, 0x16, 0xa6, 0x53, 0x3d, 0x3d, 0xb3, 0x65, 0xb2, 0xec, + 0x5f, 0xd1, 0x96, 0xdd, 0x59, 0x3f, 0x38, 0x36, 0x58, 0x01, 0x50, 0x25, 0x42, 0xf3, 0x5e, 0x85, 0xc9, 0x98, 0x1b, + 0x72, 0xe1, 0x21, 0x55, 0x2b, 0x2f, 0x7b, 0xc8, 0xff, 0x71, 0x75, 0x75, 0x71, 0xb5, 0x08, 0x0d, 0x07, 0x16, 0xed, + 0x58, 0x06, 0x3f, 0xaa, 0x22, 0xa3, 0xb0, 0x66, 0x2a, 0x56, 0x7d, 0xe5, 0x4b, 0xe2, 0xb0, 0xb0, 0xc9, 0xc0, 0xe4, + 0xa6, 0x3a, 0xba, 0x24, 0x1a, 0xad, 0x08, 0x91, 0xe3, 0x1a, 0x01, 0x3c, 0xeb, 0xd5, 0x17, 0xc6, 0xcc, 0xfb, 0xd8, + 0xc0, 0x86, 0x4f, 0xe6, 0x66, 0xb5, 0xa3, 0xab, 0x2b, 0xa5, 0x11, 0xff, 0xcb, 0x56, 0x5f, 0x88, 0xef, 0x64, 0x45, + 0x73, 0x09, 0x68, 0x86, 0x5a, 0x7c, 0xb4, 0x3c, 0xb8, 0x1f, 0x4b, 0x40, 0xd3, 0x05, 0xe2, 0xbb, 0x2c, 0x05, 0x8e, + 0xda, 0x81, 0x9f, 0x37, 0x25, 0xfa, 0x7d, 0x7d, 0x94, 0x5f, 0x11, 0xc9, 0x47, 0x24, 0x72, 0x0e, 0x17, 0x08, 0xb6, + 0xa7, 0xf0, 0x13, 0x2d, 0x76, 0xfe, 0x97, 0xed, 0x0c, 0xe6, 0x3b, 0xc0, 0x04, 0xe8, 0xf9, 0x0e, 0x70, 0xd7, 0x63, + 0xa8, 0x32, 0xf1, 0x63, 0xd1, 0xca, 0xc7, 0xe2, 0x81, 0xf5, 0x72, 0x97, 0x22, 0x43, 0x52, 0x0a, 0x6b, 0x22, 0xdd, + 0xe6, 0xf3, 0x9d, 0xed, 0x3a, 0xeb, 0x3b, 0x52, 0x7c, 0x38, 0xca, 0x14, 0xbc, 0x95, 0x9c, 0x9c, 0x0b, 0x14, 0x4b, + 0x2c, 0x99, 0x45, 0xd1, 0x4e, 0x02, 0xaa, 0xf4, 0x57, 0x60, 0xba, 0xaf, 0x92, 0x03, 0x22, 0x03, 0x6d, 0x5e, 0x36, + 0xfa, 0x14, 0x92, 0x26, 0x09, 0x61, 0x40, 0xe2, 0x9d, 0x75, 0x01, 0xb6, 0x0e, 0x89, 0xfc, 0x44, 0xc4, 0xf1, 0x4f, + 0xb0, 0xe9, 0x50, 0xfe, 0xdf, 0xcd, 0xec, 0xe7, 0xda, 0x41, 0x75, 0x73, 0x4f, 0x46, 0x63, 0xf9, 0xa1, 0x28, 0xf4, + 0xcb, 0xf6, 0x19, 0x15, 0x1c, 0xea, 0x0b, 0xde, 0x9a, 0x7d, 0xe8, 0x4c, 0x22, 0xd2, 0x0b, 0x4e, 0x5b, 0xa5, 0x0c, + 0xe0, 0x34, 0x05, 0x97, 0x83, 0xa6, 0x5f, 0x74, 0xba, 0x81, 0x02, 0x81, 0xc1, 0x00, 0xfc, 0x1c, 0xe8, 0x40, 0x0f, + 0x52, 0x89, 0x0b, 0x71, 0x02, 0x91, 0x64, 0xf1, 0x40, 0xfb, 0x55, 0x52, 0x44, 0x43, 0x9d, 0x85, 0x3e, 0x74, 0x86, + 0xfc, 0xbb, 0x16, 0x3e, 0x3f, 0xa5, 0x6a, 0xb5, 0x04, 0xec, 0x4b, 0x5e, 0x06, 0x43, 0xd0, 0xa5, 0xf2, 0x48, 0xdb, + 0x0c, 0xea, 0x4d, 0xf7, 0xfd, 0x8c, 0xcc, 0xb9, 0xe6, 0xe7, 0xa4, 0xb7, 0x2b, 0xbc, 0x80, 0xd0, 0x67, 0xa6, 0x41, + 0xf4, 0x97, 0x5f, 0x86, 0x82, 0x42, 0xe3, 0xf4, 0xfd, 0x68, 0xc2, 0xcc, 0xe2, 0x60, 0x75, 0x9c, 0x55, 0x42, 0x06, + 0x6c, 0xf3, 0x58, 0xa2, 0xdb, 0x3c, 0x63, 0x16, 0x21, 0x99, 0xde, 0x96, 0x46, 0x39, 0x36, 0x12, 0xc0, 0x7a, 0x69, + 0x4c, 0x92, 0x3b, 0x69, 0xd6, 0xc9, 0xc6, 0x01, 0x0f, 0x77, 0x58, 0xc2, 0xba, 0xb4, 0xe1, 0x86, 0x90, 0x92, 0xa8, + 0xba, 0x04, 0x76, 0xd7, 0xb4, 0x2b, 0x24, 0x6e, 0x7c, 0xca, 0x14, 0x3d, 0xe8, 0xb4, 0xcb, 0xf0, 0x2c, 0x00, 0xf9, + 0x21, 0x8c, 0x6f, 0x37, 0x8c, 0x30, 0x69, 0x7a, 0xd2, 0x0e, 0x0a, 0xa1, 0xd5, 0x41, 0x7b, 0x75, 0xe7, 0xa9, 0x41, + 0xe4, 0xeb, 0xbf, 0x7a, 0x89, 0xc4, 0x77, 0x0e, 0x78, 0x80, 0x28, 0x55, 0x97, 0x52, 0x4f, 0x88, 0xc6, 0x96, 0x72, + 0x4c, 0x27, 0x56, 0x73, 0xc7, 0x76, 0x4c, 0x40, 0xf1, 0x3f, 0xf2, 0x6e, 0xc6, 0xc9, 0x08, 0x29, 0x02, 0x81, 0xc1, + 0x00, 0xda, 0x28, 0x4c, 0xfb, 0x2b, 0xa1, 0xb9, 0xe9, 0x95, 0x77, 0x2a, 0x81, 0x4d, 0x51, 0x54, 0xcb, 0xc6, 0xb8, + 0xbb, 0xf4, 0xf0, 0x99, 0x7b, 0x02, 0x7b, 0xdf, 0x0b, 0x2a, 0x83, 0x8f, 0x4b, 0xa7, 0x8b, 0xcb, 0x27, 0x04, 0x7e, + 0x1e, 0x9f, 0x7a, 0xd7, 0x13, 0x8d, 0x9c, 0xa2, 0xbc, 0xf5, 0x3e, 0x1b, 0x2a, 0x7f, 0xb3, 0xc9, 0x05, 0xbd, 0x41, + 0x8f, 0xa5, 0xbf, 0x04, 0x7f, 0xf4, 0xa4, 0x33, 0xd2, 0x45, 0x0d, 0xcf, 0x80, 0x86, 0x59, 0xaa, 0x95, 0xc9, 0xd5, + 0x16, 0x30, 0xc8, 0xbe, 0x1a, 0x5b, 0xaf, 0x78, 0xe3, 0xc2, 0x3e, 0xc8, 0xd5, 0x0b, 0x96, 0x97, 0x7b, 0x51, 0xbb, + 0x88, 0xd4, 0x7c, 0x58, 0x8c, 0x11, 0xd7, 0x81, 0xb3, 0xff, 0x0e, 0x66, 0x4b, 0x2e, 0xac, 0x23, 0x02, 0x0e, 0x7f, + 0xc0, 0xb1, 0x5a, 0xd7, 0x19, 0x05, 0x0a, 0xa4, 0x41, 0x04, 0xcb, 0xbc, 0xd3, 0x3b, 0xc6, 0x49, 0x6e, 0xfa, 0x64, + 0xb7, 0x8b, 0xfe, 0xf8, 0xe9, 0xf3, 0x62, 0xbf, 0xfc, 0x4c, 0xe8, 0x7a, 0x27, 0x9e, 0x30, 0xcd, 0x30, 0x15, 0x4d, + 0xb7, 0x6c, 0xe4, 0xcc, 0x64, 0x6b, 0xe2, 0x1b, 0x94, 0x20, 0x81, 0xb7, 0x93, 0xb0, 0xfd, 0x49, 0x27, 0x5d, 0x98, + 0x19, 0x6d, 0xc9, 0x4e, 0xf6, 0xfd, 0x6f, 0xcb, 0xd3, 0x27, 0x77, 0xbd, 0xf1, 0x1b, 0x6f, 0x8f, 0x67, 0x66, 0xa4, + 0xba, 0x07, 0x2b, 0x02, 0x81, 0xc1, 0x00, 0x93, 0x91, 0xf4, 0x1c, 0x33, 0x1b, 0xd3, 0x9d, 0xff, 0xdb, 0x49, 0xf1, + 0xb5, 0x09, 0x9d, 0x54, 0x16, 0xe0, 0x60, 0x57, 0x9e, 0xbb, 0xad, 0x07, 0xaa, 0x7d, 0x74, 0x0a, 0xa1, 0xc4, 0x98, + 0x8e, 0x36, 0xc0, 0x7d, 0x69, 0x1e, 0xef, 0xa8, 0xfc, 0xc9, 0xb1, 0xfd, 0x8e, 0x34, 0xc3, 0xc8, 0xaa, 0x00, 0x35, + 0x81, 0x87, 0x78, 0x05, 0xc1, 0x35, 0xf7, 0x93, 0xca, 0xe9, 0x30, 0xb7, 0x20, 0x8d, 0x4e, 0x5b, 0xf4, 0x79, 0x64, + 0xe7, 0x6d, 0x41, 0x59, 0xed, 0x05, 0x81, 0x02, 0xb6, 0xac, 0x6d, 0x06, 0x47, 0xd5, 0xb5, 0x07, 0x36, 0x9e, 0xc5, + 0x3d, 0x1a, 0x13, 0xef, 0xe7, 0x34, 0x59, 0x9e, 0x9e, 0x21, 0x4e, 0x45, 0xbe, 0x8d, 0x45, 0xfb, 0xb0, 0xbe, 0xd0, + 0x88, 0xa4, 0x5d, 0xee, 0x75, 0xa5, 0x45, 0xe5, 0x50, 0x97, 0xe5, 0x50, 0x9f, 0xf9, 0xa6, 0xfa, 0xa1, 0xba, 0x33, + 0x0b, 0xfd, 0x3d, 0x67, 0xd5, 0xc9, 0x15, 0xb2, 0xdd, 0xf5, 0x53, 0xe8, 0x7f, 0xcb, 0xac, 0xf9, 0xed, 0xb4, 0x14, + 0xb9, 0xd0, 0xa4, 0x69, 0x72, 0xca, 0xda, 0x16, 0x83, 0x30, 0x43, 0xb1, 0x8f, 0x66, 0xb2, 0xe0, 0xee, 0x2d, 0x32, + 0xa7, 0x24, 0xbf, 0x97, 0x5c, 0x6a, 0x43, 0xc2, 0xcc, 0x43, 0xb9, 0xa2, 0x53, 0x93, 0x1f, 0x16, 0x8c, 0x25, 0x61, + 0x83, 0x0d, 0xf3, 0xa9, 0x5b, 0x50, 0x3e, 0x31, 0xe9, 0x02, 0x81, 0xc0, 0x43, 0x5e, 0x1a, 0x97, 0x9d, 0x9b, 0xad, + 0x9b, 0x92, 0x4a, 0x60, 0x57, 0xd9, 0x96, 0x7a, 0x07, 0x0b, 0x70, 0xd4, 0xaa, 0x08, 0xfa, 0x7c, 0x60, 0x01, 0xfc, + 0x98, 0xa8, 0x22, 0x44, 0x47, 0xea, 0x8f, 0x62, 0xc6, 0xc3, 0xbe, 0x66, 0x9a, 0x7d, 0x06, 0x99, 0xc5, 0x2b, 0x4f, + 0x9d, 0xe6, 0x65, 0xad, 0x61, 0xec, 0x59, 0x8a, 0x84, 0x39, 0x33, 0x5b, 0xb6, 0xa5, 0x4c, 0x30, 0x6f, 0x4d, 0x9d, + 0xab, 0x1b, 0x23, 0xee, 0xa6, 0x13, 0xd6, 0xf0, 0xb4, 0x9c, 0xc5, 0x2e, 0xbb, 0x15, 0xe2, 0x8e, 0xa5, 0x2d, 0x84, + 0xb9, 0x60, 0xac, 0x9e, 0xbc, 0x1b, 0x7d, 0xff, 0x7d, 0x57, 0x7a, 0x00, 0x01, 0x0d, 0xfd, 0x12, 0x14, 0x18, 0x66, + 0xb7, 0x3c, 0xd6, 0x27, 0x84, 0xa3, 0xff, 0x08, 0x38, 0x84, 0x5d, 0xb3, 0x15, 0x91, 0xa5, 0xc6, 0xd6, 0x25, 0xb9, + 0x1f, 0x52, 0xe9, 0xcf, 0x7f, 0xb3, 0x7f, 0xc2, 0x01, 0x81, 0x55, 0x44, 0xd0, 0xf8, 0x85, 0xc9, 0x49, 0x1d, 0x7f, + 0x87, 0xdc, 0x00, 0x16, 0x68, 0xd1, 0x92, 0xe4, 0x6a, 0x2a, 0xc9, 0xfb, 0x10, 0xa7, 0x7e, 0xee, 0xab, 0xda, 0x01, + 0x06, 0x37, 0x1b, 0x97, 0xa3, 0x06, 0x0e, 0xd1, 0x5e, 0x54, 0xaa, 0xb9, 0x7f, 0x8b, 0xa0, 0xd4, 0xe8, 0xe2, 0x73, + 0x20, 0xdb, 0x99, 0x40, 0x90, 0x8a, 0x16, 0x63, 0x44, 0x5d, 0x10, 0x15, 0x5a, 0x4d, 0x02, 0x81, 0xc0, 0x5a, 0x64, + 0x55, 0x96, 0x85, 0x29, 0xf3, 0x13, 0xe5, 0x67, 0xf4, 0xb8, 0xfa, 0x43, 0xae, 0x75, 0xce, 0xae, 0x01, 0xc7, 0x51, + 0xac, 0xc4, 0x95, 0x81, 0x36, 0x2c, 0x4d, 0x31, 0x92, 0x3d, 0xa4, 0x1e, 0x42, 0x2e, 0x66, 0xe0, 0xd9, 0x04, 0xfd, + 0xb7, 0xc1, 0x88, 0xdc, 0xc7, 0xee, 0x01, 0x0d, 0xfa, 0x2a, 0x4a, 0x04, 0x85, 0x51, 0xa9, 0x52, 0x35, 0xe7, 0xe6, + 0x4a, 0xac, 0x6d, 0x0f, 0x1c, 0xa5, 0x28, 0x66, 0xd5, 0x55, 0xf9, 0x0e, 0x13, 0x7e, 0xfa, 0x26, 0x28, 0xad, 0xbe, + 0xf9, 0xe8, 0xfd, 0x37, 0xdf, 0x9b, 0x8d, 0x9b, 0x7c, 0xe1, 0x28, 0xd2, 0x21, 0xb0, 0x47, 0xba, 0xdc, 0xbb, 0xf9, + 0x69, 0xcc, 0x0f, 0x3b, 0x98, 0x6c, 0xdb, 0xc1, 0x66, 0x0f, 0x97, 0x06, 0xbe, 0xcb, 0xe2, 0x65, 0xae, 0x23, 0x75, + 0x7c, 0x5c, 0xbf, 0x26, 0x75, 0xae, 0xf6, 0x0d, 0xad, 0x16, 0xb5, 0x14, 0x9e, 0x0f, 0xd3, 0x66, 0x62, 0x48, 0xd4, + 0x35, 0x09, 0x63, 0xc4, 0xed, 0x13, 0xa2, 0x09, 0x11, 0x4a, 0x20, 0x52, 0x6b, 0x39, 0x74, 0xc4, 0xff, 0x6a, 0xb3, + 0xc5, 0xbf, 0x72, 0xf7, 0xae, 0x6c, 0x60, 0xba, 0x8f, 0xb9, 0xe0, 0xc3, 0x04, 0xe0, 0x47, 0xbc, 0xb3, 0x70, 0x49, + 0x89, 0xbc, 0x4c, 0x4f, 0x51, 0xcb, 0x5a, 0x7f, 0xc1, 0xbc, 0x92, 0xc9, 0x90, 0x66, 0x58, 0x94, 0x63, 0x2a, 0xcd}; +unsigned int client_key_der_len = 1767; diff --git a/mcux/middleware/wifi_nxp/certs/dh-param.h b/mcux/middleware/wifi_nxp/certs/dh-param.h new file mode 100644 index 000000000..145e9152b --- /dev/null +++ b/mcux/middleware/wifi_nxp/certs/dh-param.h @@ -0,0 +1,17 @@ +unsigned char dh_der[] = { + 0x30, 0x82, 0x01, 0x08, 0x02, 0x82, 0x01, 0x01, 0x00, 0xf5, 0x39, 0x89, 0x48, 0xe9, 0x02, 0xfc, 0xd5, 0x13, + 0x31, 0xa5, 0x83, 0x8c, 0xeb, 0xdf, 0x6f, 0xb5, 0xd2, 0x94, 0x35, 0x17, 0x60, 0xec, 0xb5, 0x1f, 0x43, 0xd0, + 0x90, 0xbd, 0xc8, 0x77, 0xa7, 0x1e, 0xd3, 0x0a, 0x2b, 0x2a, 0xd4, 0xea, 0xa8, 0xbb, 0x19, 0xa9, 0x01, 0x11, + 0xde, 0x35, 0xaf, 0xd1, 0x95, 0x55, 0x05, 0x17, 0x9d, 0xf9, 0xc9, 0x73, 0x63, 0xdf, 0x10, 0x97, 0x4d, 0x55, + 0xa2, 0x25, 0xa1, 0x90, 0xf0, 0x16, 0xe2, 0x23, 0xd0, 0x87, 0x7b, 0xc9, 0x03, 0xdb, 0x13, 0xdf, 0xf9, 0xe2, + 0xb3, 0xe7, 0xf0, 0xff, 0x53, 0xf8, 0xbb, 0xd0, 0x5b, 0xe2, 0x97, 0x17, 0xeb, 0x6b, 0x20, 0x72, 0x96, 0x1f, + 0xec, 0x18, 0x60, 0xd0, 0x1f, 0xe8, 0xf1, 0x6f, 0xa1, 0x82, 0x16, 0xca, 0xdc, 0x03, 0xde, 0xcd, 0x8b, 0xbc, + 0xc8, 0xd3, 0xca, 0x30, 0x16, 0x52, 0x7f, 0x42, 0xfa, 0xbc, 0xb5, 0xae, 0xb1, 0x64, 0x4a, 0x00, 0x28, 0x0b, + 0xcc, 0xfa, 0x7a, 0x59, 0xe9, 0x67, 0x84, 0xb1, 0x5e, 0x95, 0x86, 0x9a, 0xc7, 0xc5, 0xb3, 0xc0, 0x5a, 0x9c, + 0x35, 0xa2, 0x33, 0x6e, 0xbd, 0xbf, 0x4a, 0x59, 0x07, 0x76, 0x7c, 0xdd, 0x3e, 0xe2, 0x70, 0x2b, 0x12, 0x75, + 0x60, 0xfc, 0x89, 0xc3, 0x0b, 0xe7, 0xb0, 0x08, 0x01, 0x91, 0x68, 0x6e, 0x19, 0xe5, 0x3f, 0xdf, 0xc7, 0xdf, + 0x57, 0x86, 0x83, 0xfa, 0x50, 0x46, 0x07, 0x5f, 0xe0, 0x59, 0x2c, 0x98, 0x79, 0x01, 0xb0, 0x8b, 0xad, 0xb5, + 0x40, 0x36, 0x5b, 0xcf, 0x01, 0x59, 0x79, 0xfd, 0xb1, 0x4f, 0x69, 0x2b, 0x1c, 0xec, 0x97, 0x04, 0xd2, 0xdb, + 0x7c, 0x0e, 0x5f, 0xa4, 0xd6, 0x16, 0x4a, 0x6c, 0x78, 0x8b, 0xa7, 0x23, 0xff, 0x14, 0x6e, 0x88, 0x37, 0xbf, + 0x77, 0xc3, 0x11, 0xac, 0x87, 0xe9, 0xab, 0x0e, 0x4f, 0x95, 0xa0, 0x37, 0x2b, 0x02, 0x01, 0x02}; +unsigned int dh_der_len = 268; diff --git a/mcux/middleware/wifi_nxp/certs/server-cert.h b/mcux/middleware/wifi_nxp/certs/server-cert.h new file mode 100644 index 000000000..8c2048580 --- /dev/null +++ b/mcux/middleware/wifi_nxp/certs/server-cert.h @@ -0,0 +1,60 @@ +const unsigned char server_der[] = { + 0x30, 0x82, 0x04, 0x3c, 0x30, 0x82, 0x02, 0xa4, 0x02, 0x01, 0x01, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, + 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x30, 0x5f, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, + 0x02, 0x49, 0x4e, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0c, 0x02, 0x4d, 0x48, 0x31, 0x0d, 0x30, + 0x0b, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0c, 0x04, 0x50, 0x55, 0x4e, 0x45, 0x31, 0x0c, 0x30, 0x0a, 0x06, 0x03, 0x55, + 0x04, 0x0a, 0x0c, 0x03, 0x4e, 0x58, 0x50, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x02, 0x43, + 0x41, 0x31, 0x19, 0x30, 0x17, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x01, 0x16, 0x0a, 0x63, + 0x61, 0x40, 0x6e, 0x78, 0x70, 0x2e, 0x63, 0x6f, 0x6d, 0x30, 0x20, 0x17, 0x0d, 0x32, 0x33, 0x30, 0x33, 0x31, 0x35, + 0x31, 0x34, 0x32, 0x34, 0x33, 0x37, 0x5a, 0x18, 0x0f, 0x33, 0x30, 0x32, 0x32, 0x30, 0x37, 0x31, 0x36, 0x31, 0x34, + 0x32, 0x34, 0x33, 0x37, 0x5a, 0x30, 0x67, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x49, + 0x4e, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0c, 0x02, 0x4d, 0x48, 0x31, 0x0d, 0x30, 0x0b, 0x06, + 0x03, 0x55, 0x04, 0x07, 0x0c, 0x04, 0x50, 0x55, 0x4e, 0x45, 0x31, 0x0c, 0x30, 0x0a, 0x06, 0x03, 0x55, 0x04, 0x0a, + 0x0c, 0x03, 0x4e, 0x58, 0x50, 0x31, 0x0f, 0x30, 0x0d, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x06, 0x53, 0x45, 0x52, + 0x56, 0x45, 0x52, 0x31, 0x1d, 0x30, 0x1b, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x01, 0x16, + 0x0e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x40, 0x6e, 0x78, 0x70, 0x2e, 0x63, 0x6f, 0x6d, 0x30, 0x82, 0x01, 0xa2, + 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x8f, + 0x00, 0x30, 0x82, 0x01, 0x8a, 0x02, 0x82, 0x01, 0x81, 0x00, 0xce, 0x19, 0xcb, 0x0e, 0x8d, 0x82, 0xc1, 0x22, 0xe1, + 0xed, 0xa2, 0x88, 0xd0, 0x46, 0xb6, 0x3c, 0x70, 0xcf, 0x30, 0x9c, 0x83, 0x55, 0x7d, 0xd6, 0xac, 0xb3, 0x2f, 0x02, + 0xb3, 0x86, 0x8c, 0x8e, 0xcc, 0xcc, 0x9a, 0x6b, 0x1c, 0xf4, 0x12, 0x6e, 0x3a, 0x97, 0xb5, 0x6f, 0x0a, 0xf7, 0x0f, + 0x7d, 0x61, 0x1f, 0xf4, 0xf1, 0xef, 0x27, 0xa8, 0x8d, 0xde, 0xcf, 0x77, 0xfa, 0x8c, 0x0c, 0xe3, 0x9b, 0x06, 0xfe, + 0x70, 0x54, 0xd2, 0xb5, 0x4b, 0xd8, 0xac, 0x96, 0x6b, 0xef, 0x45, 0xe5, 0x33, 0xe4, 0xd4, 0xec, 0x37, 0xae, 0xfc, + 0xe9, 0xbf, 0x4d, 0x97, 0x22, 0x85, 0xde, 0xbf, 0xfe, 0x58, 0x31, 0x01, 0xfd, 0x7c, 0xc1, 0x10, 0x8b, 0x06, 0xdd, + 0x78, 0x6f, 0xad, 0x93, 0x6f, 0x1a, 0xf4, 0xf7, 0xab, 0x72, 0x63, 0xd3, 0x24, 0xcc, 0x47, 0xc4, 0xd2, 0x38, 0xfd, + 0x69, 0x6a, 0x20, 0x72, 0x65, 0xa9, 0xe2, 0xe3, 0x14, 0xb3, 0xe1, 0x99, 0xc2, 0x70, 0xed, 0x4f, 0xd8, 0xf9, 0x71, + 0x5a, 0x08, 0x2e, 0x90, 0x99, 0x87, 0x4c, 0x8d, 0x5b, 0xf2, 0x25, 0x82, 0xe1, 0xfe, 0x50, 0x38, 0xf3, 0x91, 0xd2, + 0x86, 0xe6, 0xc9, 0xdc, 0x14, 0xef, 0xaf, 0x75, 0x48, 0x92, 0x65, 0xb3, 0x1a, 0x27, 0x21, 0x56, 0xa9, 0xa0, 0xfd, + 0x99, 0xc6, 0xfe, 0x13, 0x3f, 0x65, 0xe2, 0x5a, 0x21, 0x1c, 0xac, 0xce, 0xea, 0x8d, 0x21, 0xae, 0x04, 0xeb, 0x0e, + 0x1e, 0x90, 0x2b, 0x4b, 0x63, 0x11, 0xd4, 0x27, 0x3f, 0x72, 0xd3, 0x6a, 0x7c, 0xae, 0x41, 0x47, 0xd4, 0xdb, 0x7b, + 0xf3, 0xbf, 0x31, 0x4d, 0x3a, 0x40, 0x02, 0x65, 0xfd, 0x1d, 0x0a, 0x35, 0x8b, 0xf3, 0x2e, 0x38, 0x56, 0xc2, 0xb3, + 0x88, 0xc1, 0x36, 0xa0, 0x02, 0x09, 0xe7, 0x2d, 0xc2, 0xbe, 0x68, 0xcd, 0x42, 0xc3, 0xda, 0x4d, 0xdd, 0xfa, 0x69, + 0x39, 0x49, 0x93, 0x3c, 0x6c, 0x00, 0x6f, 0x8b, 0x30, 0x88, 0x23, 0x8c, 0x0f, 0xef, 0x9e, 0x65, 0xd2, 0x45, 0x00, + 0xd9, 0x80, 0x59, 0x1f, 0xcb, 0x65, 0x35, 0xdc, 0x85, 0xf7, 0xc2, 0x00, 0x9b, 0xc0, 0x2e, 0x4c, 0xb0, 0x90, 0xcd, + 0x72, 0xbd, 0x8d, 0x61, 0x4f, 0x26, 0x12, 0x4c, 0x10, 0x32, 0xeb, 0x03, 0x42, 0x1f, 0xb6, 0x9a, 0xc2, 0xab, 0x31, + 0x54, 0xb8, 0x80, 0xe2, 0x05, 0x40, 0xdd, 0x36, 0xed, 0x62, 0x84, 0xee, 0xb3, 0x0e, 0x0e, 0x74, 0x48, 0xad, 0xad, + 0x6b, 0xd6, 0x99, 0x09, 0xc0, 0xa6, 0x61, 0x24, 0x19, 0x12, 0xcc, 0xca, 0x47, 0x12, 0x4a, 0xf3, 0x65, 0xef, 0xed, + 0x97, 0x1a, 0x74, 0xa5, 0x4a, 0xbb, 0xdf, 0x02, 0x49, 0x1b, 0xb0, 0x4d, 0xa1, 0x95, 0x25, 0xda, 0x63, 0xe5, 0x44, + 0xb2, 0xf2, 0x35, 0x5e, 0x80, 0x72, 0x7b, 0x50, 0x45, 0x5f, 0xc4, 0xc6, 0xcd, 0x85, 0x02, 0x03, 0x01, 0x00, 0x01, + 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x03, 0x82, 0x01, 0x81, + 0x00, 0xaa, 0x6d, 0x4f, 0x75, 0x97, 0x2d, 0x69, 0xa6, 0x13, 0xc0, 0xde, 0xe1, 0x2f, 0x91, 0xeb, 0x63, 0x2a, 0x16, + 0x8a, 0x56, 0x75, 0xce, 0xcb, 0x6f, 0xfa, 0xfa, 0x96, 0xa2, 0xf4, 0x87, 0xcd, 0xea, 0xc5, 0x9c, 0x79, 0x63, 0x56, + 0x3b, 0x20, 0x02, 0xc2, 0xb4, 0xc8, 0x6c, 0x03, 0x0a, 0x19, 0xa0, 0xd6, 0x2d, 0xb4, 0x9a, 0x70, 0xe8, 0x86, 0x09, + 0xcd, 0xf7, 0x38, 0xf7, 0x9a, 0x6c, 0xce, 0xeb, 0x1f, 0xff, 0x34, 0x1f, 0x20, 0xbd, 0x64, 0x93, 0xef, 0x95, 0xc4, + 0x60, 0x68, 0x23, 0xe6, 0x5f, 0x20, 0xdd, 0xcd, 0xbf, 0xe2, 0x31, 0x66, 0xa5, 0x8a, 0x50, 0x88, 0xcc, 0x5a, 0x8d, + 0x6d, 0x81, 0x00, 0x8b, 0xba, 0xf7, 0x2b, 0x0d, 0xe6, 0x02, 0x0e, 0x43, 0x96, 0x49, 0x78, 0x0f, 0xbf, 0x2a, 0x26, + 0x2e, 0xde, 0xa0, 0xc4, 0x99, 0x71, 0x70, 0xfd, 0x31, 0xdc, 0xa4, 0x98, 0x80, 0x14, 0xaf, 0xe9, 0x86, 0x4e, 0x00, + 0x52, 0x42, 0x9e, 0x22, 0x63, 0xbc, 0x25, 0x4d, 0xd0, 0xf4, 0xa9, 0x08, 0x9c, 0x82, 0xbb, 0x72, 0xce, 0xee, 0x08, + 0x13, 0x33, 0xe4, 0xa8, 0x9c, 0x74, 0x8d, 0x3b, 0x79, 0x99, 0x17, 0x18, 0x28, 0x9c, 0x18, 0x6b, 0xd7, 0x36, 0x94, + 0x2c, 0xf4, 0x0e, 0x0c, 0x6f, 0x27, 0x57, 0xdc, 0x23, 0x18, 0xee, 0xb7, 0xc2, 0x65, 0x5e, 0xd1, 0x6a, 0x59, 0x7e, + 0x2a, 0xe8, 0xeb, 0xb4, 0xf8, 0xb7, 0xa5, 0xbc, 0xc5, 0x7c, 0x0f, 0x7b, 0x6f, 0x60, 0x32, 0x24, 0x8a, 0xf6, 0x60, + 0xb2, 0x6d, 0x96, 0xb9, 0x27, 0x11, 0x58, 0x94, 0x75, 0x30, 0xe2, 0x34, 0x8d, 0x88, 0x90, 0xa7, 0xb4, 0x36, 0x55, + 0x30, 0x7f, 0x10, 0x30, 0x48, 0x8c, 0x60, 0x6a, 0x7e, 0x2f, 0x16, 0xc8, 0x72, 0x9e, 0xb8, 0xe8, 0xb8, 0x05, 0xf7, + 0x48, 0xe9, 0x22, 0x4d, 0x9c, 0x2a, 0xd7, 0xba, 0x4b, 0xf7, 0x63, 0xf9, 0x08, 0x6b, 0xd3, 0x88, 0x8f, 0x54, 0xce, + 0xc3, 0x23, 0xed, 0x57, 0xb8, 0xa2, 0x44, 0x2c, 0x36, 0xe6, 0x96, 0xcb, 0xf7, 0xed, 0x8b, 0xfb, 0xf6, 0x6d, 0x6e, + 0xa1, 0xd5, 0x43, 0x6d, 0xbd, 0x4c, 0xe7, 0xc6, 0x30, 0x03, 0x1f, 0x1f, 0x48, 0xbd, 0xc6, 0x1b, 0x5d, 0xc7, 0x60, + 0xb3, 0x42, 0xbf, 0x0f, 0x8c, 0x1f, 0xd3, 0xea, 0x8b, 0x1c, 0x91, 0x89, 0x7c, 0x88, 0xbe, 0x93, 0xc9, 0xf1, 0x1c, + 0x5c, 0xc6, 0x56, 0x10, 0x6e, 0xae, 0x55, 0x3e, 0x19, 0xa2, 0xab, 0x05, 0x4c, 0x62, 0xa9, 0x25, 0x3f, 0x54, 0x9e, + 0xac, 0x47, 0x22, 0x7e, 0x03, 0xf0, 0xfb, 0x36, 0x8c, 0x89, 0x5c, 0x5f, 0xfd, 0xcf, 0xf3, 0x92, 0xc6, 0x13, 0xed, + 0x4e, 0x28, 0x63, 0xa0, 0xfa, 0xae, 0x19, 0x53, 0x95, 0x80, 0x0f, 0xa8, 0x82, 0x52, 0xde, 0x89, 0xb5, 0xa7, 0xc5, + 0xf9, 0x80, 0x0a, 0x3c, 0x2a}; +unsigned int server_der_len = 1088; diff --git a/mcux/middleware/wifi_nxp/certs/server-key.h b/mcux/middleware/wifi_nxp/certs/server-key.h new file mode 100644 index 000000000..47d947c5c --- /dev/null +++ b/mcux/middleware/wifi_nxp/certs/server-key.h @@ -0,0 +1,95 @@ +const unsigned char server_key_der[] = { + 0x30, 0x82, 0x06, 0xe3, 0x02, 0x01, 0x00, 0x02, 0x82, 0x01, 0x81, 0x00, 0xce, 0x19, 0xcb, 0x0e, 0x8d, 0x82, 0xc1, + 0x22, 0xe1, 0xed, 0xa2, 0x88, 0xd0, 0x46, 0xb6, 0x3c, 0x70, 0xcf, 0x30, 0x9c, 0x83, 0x55, 0x7d, 0xd6, 0xac, 0xb3, + 0x2f, 0x02, 0xb3, 0x86, 0x8c, 0x8e, 0xcc, 0xcc, 0x9a, 0x6b, 0x1c, 0xf4, 0x12, 0x6e, 0x3a, 0x97, 0xb5, 0x6f, 0x0a, + 0xf7, 0x0f, 0x7d, 0x61, 0x1f, 0xf4, 0xf1, 0xef, 0x27, 0xa8, 0x8d, 0xde, 0xcf, 0x77, 0xfa, 0x8c, 0x0c, 0xe3, 0x9b, + 0x06, 0xfe, 0x70, 0x54, 0xd2, 0xb5, 0x4b, 0xd8, 0xac, 0x96, 0x6b, 0xef, 0x45, 0xe5, 0x33, 0xe4, 0xd4, 0xec, 0x37, + 0xae, 0xfc, 0xe9, 0xbf, 0x4d, 0x97, 0x22, 0x85, 0xde, 0xbf, 0xfe, 0x58, 0x31, 0x01, 0xfd, 0x7c, 0xc1, 0x10, 0x8b, + 0x06, 0xdd, 0x78, 0x6f, 0xad, 0x93, 0x6f, 0x1a, 0xf4, 0xf7, 0xab, 0x72, 0x63, 0xd3, 0x24, 0xcc, 0x47, 0xc4, 0xd2, + 0x38, 0xfd, 0x69, 0x6a, 0x20, 0x72, 0x65, 0xa9, 0xe2, 0xe3, 0x14, 0xb3, 0xe1, 0x99, 0xc2, 0x70, 0xed, 0x4f, 0xd8, + 0xf9, 0x71, 0x5a, 0x08, 0x2e, 0x90, 0x99, 0x87, 0x4c, 0x8d, 0x5b, 0xf2, 0x25, 0x82, 0xe1, 0xfe, 0x50, 0x38, 0xf3, + 0x91, 0xd2, 0x86, 0xe6, 0xc9, 0xdc, 0x14, 0xef, 0xaf, 0x75, 0x48, 0x92, 0x65, 0xb3, 0x1a, 0x27, 0x21, 0x56, 0xa9, + 0xa0, 0xfd, 0x99, 0xc6, 0xfe, 0x13, 0x3f, 0x65, 0xe2, 0x5a, 0x21, 0x1c, 0xac, 0xce, 0xea, 0x8d, 0x21, 0xae, 0x04, + 0xeb, 0x0e, 0x1e, 0x90, 0x2b, 0x4b, 0x63, 0x11, 0xd4, 0x27, 0x3f, 0x72, 0xd3, 0x6a, 0x7c, 0xae, 0x41, 0x47, 0xd4, + 0xdb, 0x7b, 0xf3, 0xbf, 0x31, 0x4d, 0x3a, 0x40, 0x02, 0x65, 0xfd, 0x1d, 0x0a, 0x35, 0x8b, 0xf3, 0x2e, 0x38, 0x56, + 0xc2, 0xb3, 0x88, 0xc1, 0x36, 0xa0, 0x02, 0x09, 0xe7, 0x2d, 0xc2, 0xbe, 0x68, 0xcd, 0x42, 0xc3, 0xda, 0x4d, 0xdd, + 0xfa, 0x69, 0x39, 0x49, 0x93, 0x3c, 0x6c, 0x00, 0x6f, 0x8b, 0x30, 0x88, 0x23, 0x8c, 0x0f, 0xef, 0x9e, 0x65, 0xd2, + 0x45, 0x00, 0xd9, 0x80, 0x59, 0x1f, 0xcb, 0x65, 0x35, 0xdc, 0x85, 0xf7, 0xc2, 0x00, 0x9b, 0xc0, 0x2e, 0x4c, 0xb0, + 0x90, 0xcd, 0x72, 0xbd, 0x8d, 0x61, 0x4f, 0x26, 0x12, 0x4c, 0x10, 0x32, 0xeb, 0x03, 0x42, 0x1f, 0xb6, 0x9a, 0xc2, + 0xab, 0x31, 0x54, 0xb8, 0x80, 0xe2, 0x05, 0x40, 0xdd, 0x36, 0xed, 0x62, 0x84, 0xee, 0xb3, 0x0e, 0x0e, 0x74, 0x48, + 0xad, 0xad, 0x6b, 0xd6, 0x99, 0x09, 0xc0, 0xa6, 0x61, 0x24, 0x19, 0x12, 0xcc, 0xca, 0x47, 0x12, 0x4a, 0xf3, 0x65, + 0xef, 0xed, 0x97, 0x1a, 0x74, 0xa5, 0x4a, 0xbb, 0xdf, 0x02, 0x49, 0x1b, 0xb0, 0x4d, 0xa1, 0x95, 0x25, 0xda, 0x63, + 0xe5, 0x44, 0xb2, 0xf2, 0x35, 0x5e, 0x80, 0x72, 0x7b, 0x50, 0x45, 0x5f, 0xc4, 0xc6, 0xcd, 0x85, 0x02, 0x03, 0x01, + 0x00, 0x01, 0x02, 0x82, 0x01, 0x81, 0x00, 0xc3, 0x41, 0x1c, 0x66, 0x85, 0x1a, 0x42, 0xef, 0x51, 0x2b, 0x58, 0xb8, + 0x54, 0xd9, 0x28, 0xfc, 0xc9, 0xc3, 0x00, 0x42, 0xc7, 0x09, 0xcf, 0x55, 0xf9, 0xf7, 0x27, 0xaa, 0x5f, 0x7a, 0x30, + 0xdf, 0x78, 0x96, 0xbe, 0x14, 0x8c, 0x31, 0x8e, 0xe4, 0x6f, 0x0e, 0x1b, 0x0d, 0x40, 0x4e, 0x1f, 0x96, 0xa0, 0xd5, + 0x2d, 0xb1, 0xa6, 0xe8, 0xe3, 0x7e, 0xc4, 0x7f, 0xb9, 0x22, 0xdc, 0x5b, 0xb9, 0xa5, 0xbd, 0x52, 0x80, 0x09, 0x5c, + 0x35, 0xf5, 0xcd, 0x28, 0x74, 0xb9, 0x7c, 0xcd, 0xb2, 0xff, 0x1e, 0xe3, 0xb9, 0x86, 0x67, 0x79, 0xa3, 0xd9, 0x61, + 0x20, 0xb5, 0xcc, 0x2d, 0xe3, 0xa6, 0x8a, 0xd6, 0xa3, 0x14, 0x0b, 0x84, 0xbc, 0xaf, 0x79, 0xa9, 0x87, 0xd8, 0x05, + 0x91, 0x8f, 0xc8, 0xf2, 0x1b, 0x51, 0x89, 0xe5, 0x98, 0xbb, 0x5b, 0xed, 0x02, 0x42, 0x47, 0x4b, 0x8c, 0xfa, 0xc6, + 0x12, 0x9a, 0xcd, 0xff, 0xed, 0x32, 0x47, 0xd8, 0x8b, 0x5a, 0xf2, 0xb1, 0x60, 0xdc, 0x26, 0x35, 0x85, 0x1e, 0x0b, + 0x3f, 0x62, 0xb4, 0x13, 0x8a, 0x38, 0x79, 0x87, 0xa0, 0x1f, 0x8a, 0x57, 0x66, 0x1d, 0x1b, 0x21, 0x60, 0x3c, 0x75, + 0x30, 0xd3, 0x84, 0xdf, 0xad, 0x35, 0x3b, 0xbc, 0xad, 0x99, 0x31, 0x49, 0x1c, 0x59, 0x47, 0xf3, 0xfa, 0x23, 0xd3, + 0xc1, 0x58, 0x66, 0xa5, 0xb2, 0xcd, 0x7b, 0xe5, 0x19, 0xcc, 0xe6, 0x2f, 0x1f, 0x16, 0xd0, 0xad, 0xa1, 0xaf, 0xdf, + 0x16, 0x70, 0xe8, 0x1d, 0x77, 0xe2, 0x15, 0x48, 0x4b, 0x2c, 0xf6, 0xb6, 0x31, 0x50, 0x69, 0x99, 0x66, 0xb0, 0xc2, + 0x58, 0x3b, 0x80, 0xc2, 0x59, 0x68, 0x77, 0x8a, 0x40, 0xec, 0x15, 0x26, 0x9c, 0x2b, 0x58, 0xdf, 0x75, 0xe9, 0x52, + 0xa3, 0x41, 0x43, 0x77, 0xa7, 0xc7, 0x1f, 0x62, 0x76, 0x75, 0xd1, 0x13, 0x72, 0xcd, 0x47, 0x46, 0x28, 0xd1, 0x41, + 0xac, 0x4d, 0x1b, 0x56, 0x58, 0x0b, 0xf8, 0x37, 0x0f, 0xae, 0x0b, 0xd4, 0x75, 0x05, 0xb6, 0x66, 0x0d, 0x06, 0x3e, + 0xa9, 0xb6, 0x66, 0xe2, 0x69, 0x60, 0x6d, 0x0b, 0x3f, 0x07, 0x62, 0xd6, 0x5a, 0xb3, 0x66, 0x83, 0x9c, 0x14, 0xd4, + 0x86, 0xb5, 0xa6, 0x81, 0x90, 0x23, 0x77, 0xa8, 0x26, 0x51, 0x82, 0xad, 0xae, 0x43, 0x31, 0x0d, 0xf2, 0xb9, 0xc8, + 0xbd, 0x3d, 0x11, 0xa9, 0x5c, 0x83, 0x11, 0x98, 0xe3, 0x0d, 0x2e, 0x29, 0x59, 0xe3, 0x2b, 0xd4, 0x8f, 0x69, 0xe7, + 0xd3, 0x23, 0x74, 0x64, 0x13, 0x86, 0x8b, 0x44, 0x85, 0x03, 0xd0, 0xc0, 0x04, 0x0c, 0xe0, 0xbb, 0x2e, 0x1c, 0xb1, + 0x4e, 0x20, 0xb0, 0xf1, 0x23, 0x84, 0xda, 0x03, 0xcf, 0xb8, 0x4d, 0x9f, 0x34, 0x8a, 0x92, 0x5d, 0x84, 0x08, 0x87, + 0x86, 0x04, 0x6a, 0x19, 0x5f, 0xcb, 0xc5, 0x93, 0x82, 0xe7, 0x01, 0x02, 0x81, 0xc1, 0x00, 0xff, 0x3b, 0x7a, 0xe2, + 0xdb, 0x66, 0x15, 0x4f, 0x21, 0x66, 0xee, 0x47, 0x84, 0x41, 0x5f, 0x75, 0x4f, 0x44, 0xf0, 0xc5, 0x93, 0xc0, 0x4e, + 0xdf, 0x36, 0x47, 0x07, 0xe7, 0x45, 0x31, 0x57, 0x44, 0x5b, 0x23, 0x49, 0xd1, 0x5f, 0x7e, 0x0e, 0x2d, 0xd5, 0x93, + 0xa1, 0xb5, 0x8c, 0xba, 0xf6, 0x77, 0x33, 0xc0, 0xb3, 0x4f, 0x6e, 0x1d, 0x02, 0x61, 0xfd, 0xb2, 0xfc, 0x78, 0x28, + 0x89, 0x8f, 0xf4, 0x8a, 0xc6, 0x69, 0xdb, 0xc3, 0xe2, 0xc4, 0x54, 0x2e, 0xd1, 0xd9, 0x87, 0x7f, 0x35, 0x88, 0x4e, + 0xcf, 0x16, 0x78, 0x57, 0x00, 0x3d, 0xe7, 0x02, 0x72, 0x22, 0xbe, 0x0d, 0x39, 0x1c, 0xfa, 0x7f, 0x41, 0xda, 0x65, + 0x1a, 0xf9, 0xd5, 0xb7, 0x0c, 0xfc, 0x25, 0x86, 0xb4, 0xd5, 0xe7, 0x81, 0x01, 0x2f, 0x56, 0x17, 0xb5, 0x0b, 0x6b, + 0x2c, 0xa5, 0xcb, 0x7c, 0xa2, 0x2f, 0xaf, 0x4b, 0xf7, 0x15, 0xe8, 0x15, 0x9f, 0xa6, 0x68, 0xab, 0x12, 0x5c, 0x11, + 0xc6, 0xb1, 0x8c, 0x1f, 0x02, 0x31, 0x8d, 0x0c, 0x8f, 0x87, 0x88, 0x2a, 0xf6, 0x4d, 0x6b, 0x87, 0x75, 0x06, 0xa7, + 0x5c, 0xf4, 0xb4, 0xf2, 0x2c, 0x48, 0xbb, 0x67, 0x44, 0x37, 0x14, 0xff, 0x7b, 0xc5, 0x0d, 0xa8, 0xcb, 0x3f, 0x62, + 0x5e, 0x7d, 0x5c, 0x52, 0x63, 0x66, 0x8b, 0x6e, 0xc7, 0xb6, 0x52, 0xd3, 0x0b, 0x43, 0x60, 0xde, 0x89, 0x02, 0x81, + 0xc1, 0x00, 0xce, 0xb8, 0x7b, 0xca, 0xb5, 0x7a, 0x44, 0x2c, 0x19, 0x5d, 0x52, 0xfb, 0x2a, 0xd2, 0x57, 0xe7, 0xa3, + 0xba, 0x69, 0x00, 0xc0, 0x92, 0x8d, 0xba, 0xc9, 0x8c, 0x98, 0x6a, 0x13, 0x96, 0xa2, 0x64, 0xb8, 0x89, 0x36, 0x2d, + 0x8a, 0x39, 0x65, 0x12, 0x9e, 0xbb, 0x64, 0xa5, 0x23, 0x0c, 0x6d, 0x98, 0x37, 0xa0, 0x9b, 0x00, 0x33, 0x3b, 0xc1, + 0x76, 0x71, 0x41, 0x4e, 0xf2, 0xc5, 0x5f, 0x42, 0x6e, 0x26, 0x73, 0x27, 0x46, 0xcd, 0x18, 0x14, 0x7d, 0x8d, 0x91, + 0xba, 0x90, 0x88, 0xd4, 0x33, 0x4f, 0xbd, 0x0a, 0x66, 0x0f, 0x11, 0x0f, 0xe8, 0x71, 0xcc, 0xad, 0x20, 0x81, 0x4b, + 0x60, 0xdb, 0xf1, 0xef, 0x3f, 0x08, 0xf5, 0x57, 0x68, 0xaa, 0x23, 0xbf, 0xfe, 0x06, 0x77, 0x68, 0x4d, 0x51, 0x1d, + 0xd3, 0xf6, 0x49, 0x9d, 0xe5, 0xfe, 0xbb, 0x21, 0xec, 0xef, 0xd6, 0x79, 0xdf, 0x8b, 0x25, 0x66, 0xee, 0x9b, 0x24, + 0x4a, 0xba, 0xc8, 0x6a, 0x4d, 0x94, 0xc2, 0x48, 0x6d, 0x2f, 0xad, 0x49, 0x62, 0x33, 0xe0, 0x75, 0x7f, 0xa6, 0x9a, + 0x96, 0x97, 0x37, 0xda, 0xff, 0xee, 0x6f, 0x6a, 0x15, 0xc8, 0x8e, 0x1e, 0xce, 0x89, 0x0e, 0xe2, 0xfc, 0x45, 0x72, + 0x19, 0x74, 0x91, 0x0f, 0x77, 0xf5, 0x6c, 0xa7, 0xa2, 0x9e, 0x9c, 0x8c, 0x54, 0xf3, 0x0e, 0x5c, 0x95, 0x52, 0xc6, + 0x1c, 0x3a, 0xd8, 0x1d, 0x02, 0x81, 0xc0, 0x0f, 0x31, 0x3e, 0x2e, 0x54, 0xba, 0xed, 0xd7, 0xc8, 0xf8, 0x34, 0x84, + 0xc3, 0x45, 0x94, 0xe6, 0x09, 0xb2, 0xe3, 0xd6, 0x0e, 0xe6, 0x6a, 0x8b, 0x74, 0xd2, 0xa3, 0x90, 0xcb, 0x98, 0x95, + 0x46, 0x37, 0x5a, 0x91, 0x61, 0x4a, 0x1a, 0xd9, 0xc3, 0x36, 0xac, 0x53, 0xfa, 0xd7, 0x86, 0xa5, 0x77, 0x10, 0xf8, + 0x8e, 0x73, 0xd2, 0xed, 0x1d, 0x20, 0x32, 0x16, 0xbe, 0x5a, 0x74, 0xa7, 0x43, 0x8f, 0x5d, 0xd7, 0x53, 0xa3, 0xc6, + 0x34, 0x30, 0x55, 0x86, 0x77, 0xed, 0x47, 0xd8, 0x75, 0x9a, 0x48, 0x7e, 0xa1, 0x2a, 0xc6, 0x9a, 0xf8, 0x14, 0x51, + 0x1b, 0xf4, 0x1f, 0x75, 0xf0, 0x09, 0x5e, 0x8b, 0xc6, 0xa2, 0xb6, 0x53, 0xf5, 0xbd, 0x17, 0xe9, 0x48, 0xf4, 0xfe, + 0xe0, 0xb2, 0xbe, 0xd5, 0xf9, 0xf9, 0x14, 0x59, 0xd2, 0xe7, 0xfc, 0x18, 0x2b, 0x42, 0x42, 0x87, 0xf0, 0xe8, 0xb1, + 0x4f, 0xe2, 0xd8, 0xee, 0xb8, 0x93, 0x12, 0x35, 0xe4, 0xa0, 0xe0, 0x5a, 0x00, 0x65, 0x83, 0xcf, 0x00, 0x9e, 0x11, + 0xba, 0x55, 0x69, 0xf0, 0x8c, 0xba, 0xad, 0x04, 0xe2, 0x1d, 0x64, 0x46, 0xef, 0x35, 0xfa, 0x18, 0x52, 0xb7, 0xfc, + 0xfc, 0x9d, 0x7e, 0xbd, 0x7a, 0x63, 0x8f, 0x5d, 0x95, 0xc3, 0x8f, 0x1a, 0x6a, 0xc1, 0xdd, 0x11, 0x97, 0xa0, 0x03, + 0x17, 0x16, 0x2e, 0x35, 0xeb, 0xbc, 0xb5, 0xfe, 0x69, 0x02, 0x81, 0xc0, 0x77, 0xc3, 0x98, 0x2c, 0xc3, 0xe1, 0x57, + 0x37, 0xb9, 0x66, 0x41, 0x1a, 0x35, 0x1f, 0xf2, 0x3f, 0xc8, 0xb2, 0xc9, 0xfc, 0xde, 0x94, 0xc9, 0xba, 0x0a, 0xe5, + 0x02, 0xb4, 0x8a, 0x2e, 0xbe, 0x5c, 0xde, 0x30, 0xd8, 0x8b, 0x9f, 0xc6, 0x4a, 0xd1, 0x73, 0xd7, 0x1b, 0xa3, 0x34, + 0xe0, 0x11, 0x6a, 0x9b, 0xe7, 0xd7, 0x85, 0x51, 0x29, 0x70, 0x97, 0x3f, 0x5c, 0x57, 0xf1, 0xfc, 0xf9, 0x88, 0x92, + 0x2a, 0x82, 0x92, 0xa1, 0xc9, 0x57, 0x07, 0x20, 0x0a, 0x72, 0x00, 0x85, 0x96, 0x50, 0x62, 0x7d, 0xf3, 0x06, 0xe0, + 0x44, 0x20, 0x5d, 0x78, 0x0c, 0xde, 0x48, 0xfb, 0x49, 0x0d, 0x33, 0xcb, 0x99, 0xaa, 0x43, 0x79, 0xdc, 0x32, 0x4c, + 0xf8, 0x2d, 0x88, 0x21, 0x12, 0xfc, 0x01, 0x18, 0xb2, 0x43, 0x36, 0xb7, 0x3c, 0xc5, 0x57, 0x27, 0xb2, 0xa1, 0x20, + 0x15, 0x7f, 0xcb, 0xd2, 0x00, 0x5a, 0xa5, 0xfc, 0xdd, 0x33, 0x34, 0x7c, 0x6c, 0x7a, 0x72, 0x02, 0x1a, 0x61, 0x3d, + 0xa8, 0xde, 0x9b, 0x62, 0x62, 0xad, 0xcb, 0x45, 0x2e, 0x6f, 0xe7, 0x89, 0x2a, 0x9a, 0x1d, 0xa6, 0xb5, 0x33, 0xdf, + 0xf4, 0xf6, 0xa9, 0xd0, 0x7c, 0xc5, 0x7c, 0x2a, 0x2d, 0xcd, 0xc2, 0x03, 0xaf, 0xbb, 0x27, 0x83, 0xaf, 0xf4, 0x9b, + 0x19, 0x8b, 0x97, 0x1d, 0xec, 0x47, 0x48, 0xca, 0x56, 0x4f, 0x62, 0xb1, 0x90, 0xdd, 0x02, 0x81, 0xc0, 0x26, 0x80, + 0xdf, 0xf2, 0x8b, 0x17, 0x31, 0x72, 0x38, 0x4a, 0x05, 0x90, 0x92, 0xc5, 0x26, 0x71, 0xb2, 0xeb, 0x1e, 0x5e, 0x30, + 0x56, 0x5a, 0x42, 0x60, 0x3c, 0x91, 0xf9, 0x29, 0xbe, 0x09, 0x89, 0xbe, 0xd1, 0x23, 0x3d, 0x52, 0xfd, 0x35, 0xf7, + 0xab, 0x1a, 0xb5, 0x00, 0xae, 0x02, 0xc5, 0x68, 0x76, 0x5b, 0x6f, 0x6b, 0x95, 0xd5, 0x1f, 0x12, 0x05, 0x02, 0x42, + 0x40, 0xd5, 0xa3, 0xc2, 0x7c, 0xd5, 0x04, 0xa8, 0x81, 0xa2, 0x79, 0xfc, 0x27, 0xe7, 0x11, 0x02, 0x84, 0x50, 0x90, + 0x55, 0x1c, 0x96, 0x2f, 0x0d, 0xa8, 0xf6, 0x14, 0xdb, 0x33, 0xca, 0x1c, 0x4f, 0x99, 0x55, 0x11, 0x20, 0x19, 0xab, + 0x97, 0xb3, 0xd1, 0x25, 0x56, 0xb9, 0x6e, 0x71, 0xec, 0x53, 0xfe, 0x58, 0xa6, 0xe5, 0x0a, 0x5f, 0x29, 0x2e, 0xfe, + 0x20, 0xd0, 0x3b, 0xfc, 0x2c, 0x3d, 0x6e, 0x4b, 0x48, 0x05, 0x78, 0x9b, 0xf2, 0xd4, 0xc6, 0x58, 0xc8, 0x07, 0x22, + 0x95, 0x51, 0x71, 0x6a, 0xb0, 0x20, 0x48, 0x91, 0x94, 0x67, 0x71, 0xb3, 0x6b, 0x09, 0x10, 0x09, 0x17, 0x32, 0x4c, + 0xbf, 0x70, 0xe5, 0xce, 0x9b, 0x64, 0xfe, 0x04, 0x5e, 0x0c, 0xd9, 0xfb, 0xa7, 0x4e, 0xf7, 0xcb, 0x03, 0xb9, 0xcc, + 0x17, 0x58, 0xff, 0x42, 0x3d, 0x1c, 0x09, 0x09, 0x9c, 0x4e, 0x7b, 0x1e, 0x0d, 0x08, 0x2d, 0x21, 0xd9, 0xd0, 0xf1}; +unsigned int server_key_der_len = 1767; diff --git a/mcux/middleware/wifi_nxp/cli/cli_utils.c b/mcux/middleware/wifi_nxp/cli/cli_utils.c new file mode 100644 index 000000000..0bbb5a4c3 --- /dev/null +++ b/mcux/middleware/wifi_nxp/cli/cli_utils.c @@ -0,0 +1,269 @@ +/** @file cli_utils.c + * + * @brief This file provides Convenience functions for the CLI + * + * Copyright 2008-2024 NXP + * + * SPDX-License-Identifier: BSD-3-Clause + * + */ + +/* cli_utils.c: Convenience functions for the CLI + * + */ +#include +#include +#include +#include +#include +#include /* for errno */ + +bool string_equal(const char *s1, const char *s2) +{ + size_t len = strlen(s1); + + if (len == strlen(s2) && (strncmp(s1, s2, len) == 0)) + { + return true; + } + return false; +} + +/** + *@brief convert char to hex integer + * + *@param chr char + *@return hex integer + **/ +unsigned char hexc2bin(char chr) +{ + if (chr >= '0' && chr <= '9') + { + chr -= '0'; + } + else if (chr >= 'A' && chr <= 'F') + { + chr -= ('A' - 10); + } + else if (chr >= 'a' && chr <= 'f') + { + chr -= ('a' - 10); + } + else + { /* Do Nothing */ + } + return (uint8_t)chr; +} + +/** + *@brief convert string to hex integer + * + *@param s A pointer string buffer + *@return hex integer + **/ +unsigned int a2hex(const char *s) +{ + uint32_t val = 0; + + if (strncmp("0x", s, 2) == 0 || strncmp("0X", s, 2) == 0) + { + s += 2; + } + + while ((*s != '\0') && (isxdigit((unsigned char)(*s)) != 0)) + { + val = (val << 4) + hexc2bin(*s++); + } + return val; +} + +/* + * @brief convert String to integer + * + *@param value A pointer to string + *@return integer + **/ +unsigned int a2hex_or_atoi(char *value) +{ + unsigned int ret = 0; + + if (value[0] == '0' && (value[1] == 'X' || value[1] == 'x')) + { + ret = a2hex(value + 2); + } + else if (isdigit((unsigned char)*value) != 0) + { + errno = 0; + ret = (uint32_t)strtol(value, NULL, 10); + if (errno != 0) + { + (void)PRINTF("Error during strtoul errno:%d", errno); + } + } + else + { + ret = (uint32_t)(*value); + } + return ret; +} + +bool get_uint(const char *arg, unsigned int *dest, unsigned int len) +{ + unsigned int i; + unsigned int val = 0; + + for (i = 0; i < len; i++) + { + if (arg[i] < '0' || arg[i] > '9') + { + return true; + } + val *= 10U; + val += (unsigned int)arg[i] - (unsigned int)'0'; + } + + *dest = val; + return false; +} + +/* Parse string 'arg' formatted "AA:BB:CC:DD:EE:FF" (assuming 'sep' is ':') + * into a 6-byte array 'dest' such that dest = {0xAA,0xBB,0xCC,0xDD,0xEE,0xFF} + * set 'sep' accordingly. */ +bool get_mac(const char *arg, char *dest, char sep) +{ + unsigned char n; + int i, j, k = 0; + int l = 0; + + if (strlen(arg) < 17U) + { + return true; + } + + (void)memset(dest, 0, 6); + + for (i = 0; i < 17; i += 3) + { + for (j = 0; j < 2; j++) + { + if (arg[i + j] >= '0' && arg[i + j] <= '9') + { + n = (unsigned char)(arg[i + j]) - (unsigned char)'0'; + } + else if (arg[i + j] >= 'A' && arg[i + j] <= 'F') + { + n = (unsigned char)(arg[i + j]) - (unsigned char)'A' + (unsigned char)10; + } + else if (arg[i + j] >= 'a' && arg[i + j] <= 'f') + { + n = (unsigned char)(arg[i + j]) - (unsigned char)'a' + (unsigned char)10; + } + else + { + return true; + } + + l = 1 - j; + + n <<= (unsigned int)4 * (unsigned int)l; + dest[k] += n; + } + if (i < 15 && arg[i + 2] != sep) + { + return true; + } + k++; + } + + return false; +} + +#if defined(RW610) && (CONFIG_ANT_DETECT) +bool get_channel_list(const char *arg, uint8_t *num_channels, uint8_t *chan_number, char sep) +{ + unsigned int len = 0; + unsigned int i; + uint8_t count = 0; + uint8_t val = 0; + + len = strlen(arg); + + if (len == 0U) + { + (void)PRINTF("Error: len == 0\r\n"); + return true; + } + + for (i = 0; i < len; i++) + { + if (arg[i] == sep) + { + chan_number[count] = val; + count++; + val = 0; + continue; + } + + if (arg[i] < '0' || arg[i] > '9') + { + return true; + } + val *= 10U; + val += (uint8_t)arg[i] - (uint8_t)'0'; + + if (i == len - 1) + { + chan_number[count] = val; + } + } + + *num_channels = count + 1; + return false; +} +#endif + +/* Non-reentrant getopt implementation */ +int cli_optind = 0; +char *cli_optarg = NULL; +int cli_getopt(int argc, char **argv, const char *fmt) +{ + char *opt, *c; + + if (cli_optind == argc) + { + return -1; + } + cli_optarg = NULL; + opt = argv[cli_optind]; + if (opt[0] != '-') + { + return -1; + } + if (opt[0] == '\0' || opt[1] == '\0') + { + return (int)'?'; + } + cli_optind++; + c = strchr(fmt, (int)opt[1]); + if (c == NULL) + { + return (int)opt[1]; + } + if (c[1] == ':') + { + if (cli_optind < argc) + { + cli_optarg = argv[cli_optind++]; + } + } + return (int)c[0]; +} + +/* allocate a copy of a string */ +char *string_dup(const char *s) +{ + char *snew = (char *)OSA_MemoryAllocate(strlen(s) + 1); + if (snew) + (void)strcpy(snew, s); + return snew; +} diff --git a/mcux/middleware/wifi_nxp/cli/wifi_shell.c b/mcux/middleware/wifi_nxp/cli/wifi_shell.c new file mode 100644 index 000000000..9ec727bc6 --- /dev/null +++ b/mcux/middleware/wifi_nxp/cli/wifi_shell.c @@ -0,0 +1,201 @@ +/* + * Copyright 2022-2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "nxp_wifi.h" + +#if CONFIG_WIFI_SHELL +#include +#include + +#include "wifi_shell.h" +#include +#include + +static struct +{ + const struct cli_command *commands[MAX_COMMANDS]; + unsigned int num_commands; +} cli; + +int cli_register_command(const struct cli_command *command) +{ + unsigned int i; + if (command->name == NULL || command->function == NULL) + { + return 1; + } + + if (cli.num_commands < MAX_COMMANDS) + { + /* Check if the command has already been registered. + * Return 0, if it has been registered. + */ + for (i = 0; i < cli.num_commands; i++) + { + if (cli.commands[i] == command) + { + return 0; + } + } + cli.commands[cli.num_commands++] = command; + return 0; + } + + return 1; +} + +int cli_unregister_command(const struct cli_command *command) +{ + unsigned int i = 0; + if (command->name == NULL || command->function == NULL) + { + return 1; + } + + while (i < cli.num_commands) + { + if (cli.commands[i] == command) + { + cli.num_commands--; + unsigned int remaining_cmds = cli.num_commands - i; + if (remaining_cmds > 0U) + { + (void)memmove(&cli.commands[i], &cli.commands[i + 1U], (remaining_cmds * sizeof(struct cli_command *))); + } + cli.commands[cli.num_commands] = NULL; + return 0; + } + i++; + } + + return 1; +} + +int cli_register_commands(const struct cli_command *commands, int num_commands) +{ + int i; + for (i = 0; i < num_commands; i++) + { + if (cli_register_command(commands++) != 0) + { + return 1; + } + } + return 0; +} + +int cli_unregister_commands(const struct cli_command *commands, int num_commands) +{ + int i; + for (i = 0; i < num_commands; i++) + { + if (cli_unregister_command(commands++) != 0) + { + return 1; + } + } + + return 0; +} + +static const struct cli_command *lookup_command(char *name, int len) +{ + unsigned int i = 0; + unsigned int n = 0; + + while (i < MAX_COMMANDS && n < cli.num_commands) + { + if (cli.commands[i]->name == NULL) + { + i++; + continue; + } + /* See if partial or full match is expected */ + if (len != 0) + { + if (strncmp(cli.commands[i]->name, name, (size_t)len) == 0) + { + return cli.commands[i]; + } + } + else + { + if (strcmp(cli.commands[i]->name, name) == 0) + { + return cli.commands[i]; + } + } + + i++; + n++; + } + + return NULL; +} + +/* prints all registered commands and their help text string, if any. */ +void help_command(int argc, char **argv) +{ + unsigned int i = 0, n = 0; + + while (i < MAX_COMMANDS && n < cli.num_commands) + { + if (cli.commands[i]->name != NULL) + { + (void)PRINTF("%s %s\r\n", (char *)cli.commands[i]->name + 5, + cli.commands[i]->help != NULL ? cli.commands[i]->help : ""); + n++; + } + i++; + } +} + +static char nxp_wifi_cmd_name[32]; + +/** + * wlan shell entry + * syntax: wlansh wlan-add ... + */ +int nxp_wifi_request(size_t argc, char **argv) +{ + const struct cli_command *command = NULL; + + if (argc < 2) + { + (void)PRINTF("nxp_wifi command too few arguments\r\n"); + return -1; + } + + /* cmd name should be less than buff size */ + if (strlen(argv[1]) >= sizeof(nxp_wifi_cmd_name) - strlen("wlan-")) + { + (void)PRINTF("nxp_wifi command name too long\r\n"); + return -1; + } + + if (strcmp(argv[1], "help") == 0) + { + help_command(argc, argv); + return 0; + } + + strcpy(nxp_wifi_cmd_name, "wlan-"); + strcat(nxp_wifi_cmd_name, argv[1]); + + command = lookup_command(nxp_wifi_cmd_name, strlen(nxp_wifi_cmd_name)); + if (command != NULL) + { + command->function(argc - 1, &argv[1]); + (void)PRINTF("Command %s\r\n", command->name); + } + else + { + (void)PRINTF("Unknown comamnd %s\r\n", argv[1]); + } + + return 0; +} +#endif diff --git a/mcux/middleware/wifi_nxp/cli/wifi_shell.h b/mcux/middleware/wifi_nxp/cli/wifi_shell.h new file mode 100755 index 000000000..30c111284 --- /dev/null +++ b/mcux/middleware/wifi_nxp/cli/wifi_shell.h @@ -0,0 +1,86 @@ +/* + * Copyright 2008-2024 NXP + * + * SPDX-License-Identifier: BSD-3-Clause + * + */ + +/** @file wifi_shell.h + * + * @brief WLAN CLI module + * + * \section cli_usage Usage + * The CLI module lets you register commands with the CLI interface. Modules + * that wish to register the commands should initialize the struct cli_command + * structure and pass this to cli_register_command(). These commands will then + * be available on the CLI. + * + */ + +#ifndef __WIFI_SHELL_H__ +#define __WIFI_SHELL_H__ +#include + +#define MAX_COMMANDS 200U + +/** Structure for registering CLI commands */ +struct cli_command +{ + /** The name of the CLI command */ + const char *name; + /** The help text associated with the command */ + const char *help; + /** The function that should be invoked for this command. */ + void (*function)(int argc, char **argv); +}; + +/** Register a CLI command + * + * This function registers a command with the command-line interface. + * + * \param[in] command The structure to register one CLI command + * \return 0 on success + * \return 1 on failure + */ +int cli_register_command(const struct cli_command *command); + +/** Unregister a CLI command + * + * This function unregisters a command from the command-line interface. + * + * \param[in] command The structure to unregister one CLI command + * \return 0 on success + * \return 1 on failure + */ +int cli_unregister_command(const struct cli_command *command); + +/** Register a batch of CLI commands + * + * Often, a module will want to register several commands. + * + * \param[in] commands Pointer to an array of commands. + * \param[in] num_commands Number of commands in the array. + * \return 0 on success + * \return 1 on failure + */ +int cli_register_commands(const struct cli_command *commands, int num_commands); + +/** Unregister a batch of CLI commands + * + * \param[in] commands Pointer to an array of commands. + * \param[in] num_commands Number of commands in the array. + * \return 0 on success + * \return 1 on failure + */ +int cli_unregister_commands(const struct cli_command *commands, int num_commands); + +/* + * @internal + * + * CLI help command to print all registered CLIs + */ +void help_command(int argc, char **argv); + +int nxp_wifi_request(size_t argc, char **argv); + +#endif /* __WIFI_SHELL_H__ */ diff --git a/mcux/middleware/wifi_nxp/firmware_dnld/firmware_dnld.c b/mcux/middleware/wifi_nxp/firmware_dnld/firmware_dnld.c new file mode 100644 index 000000000..3665d54c8 --- /dev/null +++ b/mcux/middleware/wifi_nxp/firmware_dnld/firmware_dnld.c @@ -0,0 +1,258 @@ +/** @file firmware_load.c + * + * @brief This file provides firmware download related API + * + * Copyright 2021-2024 NXP + * + * SPDX-License-Identifier: BSD-3-Clause + * + */ + +#if (CONFIG_XZ_DECOMPRESSION) +#include +#include +#endif /* CONFIG_XZ_DECOMPRESSION */ + +#include +/* Additional WMSDK header files */ +#include "type_decls.h" +#include "firmware_dnld.h" +#include "fwdnld_intf_abs.h" + +static const uint8_t *conn_fw; + +/* remove this after mlan integration complete */ +enum +{ + FWDNLD_STATUS_FAILURE = 0xffffffff, + FWDNLD_STATUS_SUCCESS = 0, + FWDNLD_STATUS_SKIP, + FWDNLD_CARD_NOT_DETECTED = 3, + FWDNLD_STATUS_FW_DNLD_FAILED, + FWDNLD_STATUS_FW_NOT_DETECTED = 5, + FWDNLD_STATUS_FW_NOT_READY, + FWDNLD_STATUS_FW_XZ_FAILED, + FWDNLD_CARD_CMD_TIMEOUT +}; + +static int32_t conn_download_normal_fw(const t_u8 *connfw_dl, t_u32 firmwarelen, fwdnld_intf_t *intf) +{ + t_u32 offset = 0; + int32_t ret = FWDNLD_STATUS_FAILURE; + t_u32 remaining_len = firmwarelen; + uint32_t len = 0; + + if (firmwarelen <= 0) + { + return ret; + } + + if (intf->intf_s.fwdnld_intf_send) + { + ret = intf->intf_s.fwdnld_intf_send(intf, (const void *)(connfw_dl + offset), remaining_len, &len); + } + + return ret; +} + +#if (CONFIG_XZ_DECOMPRESSION) +int32_t conn_download_decomp_fw(t_u8 *wlanfw_xz, t_u32 firmwarelen, t_u32 ioport) +{ + t_u32 tx_blocks = 0, txlen = 0, buflen = 0; + t_u16 len = 0; + t_u32 offset = 0; + t_u32 tries = 0; + uint32_t resp; + uint32_t outbuf_len; + uint8_t *loutbuf = NULL : + + loutbuf = wifi_get_sdio_outbuf(&outbuf_len); + (void)memset(loutbuf, 0, outbuf_len); + +#define SBUF_SIZE 2048 + int ret; + struct xz_buf stream; + uint32_t retlen, readlen = 0; +#if !CONFIG_MEM_POOLS + t_u8 *sbuf = (t_u8 *)OSA_MemoryAllocate(SBUF_SIZE); +#else + t_u8 *sbuf = (t_u8 *)OSA_MemoryPoolAllocate(buf_2048_MemoryPool); +#endif + if (sbuf == NULL) + { + fwdnld_io_e("Allocation failed"); + return FWDNLD_STATUS_FAILURE; + } + + xz_uncompress_init(&stream, sbuf, loutbuf); + + do + { + /* Read CARD_STATUS_REG (0X30) FN =1 */ + for (tries = 0; tries < MAX_POLL_TRIES; tries++) + { + if (wlan_card_status(DN_LD_CARD_RDY | CARD_IO_READY) == true) + { + len = wlan_card_read_f1_base_regs(); + } + else + { + fwdnld_io_e("Error in wlan_card_status()"); + break; + } + + if (len) + break; + } + + if (!len) + { + fwdnld_io_e("Card timeout %s:%d", __func__, __LINE__); + break; + } + else if (len > WLAN_UPLD_SIZE) + { + fwdnld_io_e("FW Download Failure. Invalid len"); + xz_uncompress_end(); +#if !CONFIG_MEM_POOLS + OSA_MemoryFree(sbuf); +#else + OSA_MemoryPoolFree(buf_2048_MemoryPool, sbuf); +#endif + return FWDNLD_STATUS_FW_DNLD_FAILED; + } + + txlen = len; + + do + { + if (stream.in_pos == stream.in_size) + { + readlen = MIN(SBUF_SIZE, firmwarelen); + (void)memcpy((void *)sbuf, (const void *)(wlanfw_xz + offset), readlen); + offset += readlen; + firmwarelen -= readlen; + } + ret = xz_uncompress_stream(&stream, sbuf, readlen, loutbuf, txlen, &retlen); + + if (ret == XZ_STREAM_END) + { + txlen = retlen; + break; + } + else if (ret != XZ_OK) + { + fwdnld_io_e("Decompression failed:%d", ret); + break; + } + } while (retlen == 0); + + calculate_sdio_write_params(txlen, &tx_blocks, &buflen); + + sdio_drv_write(ioport, 1, tx_blocks, buflen, (t_u8 *)loutbuf, &resp); + + if (ret == XZ_STREAM_END) + { + fwdnld_io_d("Decompression successful"); + break; + } + else if (ret != XZ_OK) + { + fwdnld_io_e("Exit:%d", ret); + break; + } + len = 0; + } while (1); + + xz_uncompress_end(); +#if !CONFIG_MEM_POOLS + OSA_MemoryFree(sbuf); +#else + OSA_MemoryPoolFree(buf_2048_MemoryPool, sbuf); +#endif + + if (ret == XZ_OK || ret == XZ_STREAM_END) + return FWDNLD_STATUS_SUCCESS; + else + return FWDNLD_STATUS_FW_XZ_FAILED; +} + +#endif /* CONFIG_XZ_DECOMPRESSION */ + +/* + * Download firmware to the card through SDIO. + * The firmware is stored in Flash. + * in param intf returned from the interface init + */ +int32_t firmware_download(const uint8_t *fw_start_addr, const size_t size, void *interface, uint8_t fw_reload) +{ + t_u32 firmwarelen; + int32_t ret = FWDNLD_STATUS_SUCCESS; + fwdnld_intf_t *intf = (fwdnld_intf_t *)interface; + + if (size == 0) + { + return ret; + } + + if (intf->intf_s.fwdnld_intf_prepare) + { + ret = intf->intf_s.fwdnld_intf_prepare(intf, NULL); + if (ret != FWDNLD_STATUS_SUCCESS) + { + return ret; + } + } + +#if (CONFIG_WIFI_IND_DNLD) + if ((fw_reload != 0) && (intf->intf_s.fwdnld_intf_check_reload)) + { + ret = intf->intf_s.fwdnld_intf_check_reload(intf, fw_reload); + if (ret != FWDNLD_STATUS_SUCCESS) + { + return ret; + } + } +#endif + + conn_fw = fw_start_addr; + + fwdnld_io_d("Start copying connectivity firmware from 0x%x", (t_u32)conn_fw); + + firmwarelen = size; + /*Making this section as #if 00 for now, as the decopress and + * verification of compression etc funcitons are not present*/ +#if (CONFIG_XZ_DECOMPRESSION) + t_u8 buffer[6]; + + (void)memcpy((void *)buffer, (const void *)conn_fw, sizeof(buffer)); + + /* See if image is XZ compressed or not */ + if (verify_xz_header(buffer) == WM_SUCCESS) + { + fwdnld_io_d( + "XZ Compressed image found, start decompression," + " len: %d", + firmwarelen); + ret = conn_download_decomp_fw(conn_fw, firmwarelen, ioport_g); + } + else +#endif /* CONFIG_XZ_DECOMPRESSION */ + { + fwdnld_io_d( + "Un-compressed image found, start download," + " len: %d", + firmwarelen); + ret = conn_download_normal_fw(conn_fw, firmwarelen, intf); + } + + if (ret != FWDNLD_STATUS_SUCCESS) + { + return FWDNLD_STATUS_FAILURE; + } + if (intf->intf_s.fwdnld_intf_check_ready) + { + return intf->intf_s.fwdnld_intf_check_ready(intf, NULL); + } + return ret; +} diff --git a/mcux/middleware/wifi_nxp/firmware_dnld/firmware_dnld.h b/mcux/middleware/wifi_nxp/firmware_dnld/firmware_dnld.h new file mode 100644 index 000000000..aac2a718d --- /dev/null +++ b/mcux/middleware/wifi_nxp/firmware_dnld/firmware_dnld.h @@ -0,0 +1,26 @@ +/** @file firmware_dnld.h + * + * @brief firmware download header file to download connectivity firmwares + * + * Copyright 2021-2024 NXP + * + * SPDX-License-Identifier: BSD-3-Clause + * + */ +#ifndef _FIMRWARE_DNLD_H_ +#define _FIMRWARE_DNLD_H_ + +#include + +#define fwdnld_io_e(...) wmlog_e("wifi_io", ##__VA_ARGS__) +#define fwdnld_io_w(...) wmlog_w("wifi_io", ##__VA_ARGS__) + +#if CONFIG_FWDNLD_IO_DEBUG +#define fwdnld_io_d(...) wmlog("wifi_io", ##__VA_ARGS__) +#else +#define fwdnld_io_d(...) +#endif /* ! CONFIG_DWDNLD_IO_DEBUG */ + +int32_t firmware_download(const uint8_t *fw_start_addr, const size_t size, void *intf, uint8_t fw_reload); + +#endif //_FIMRWARE_DNLD_H_ diff --git a/mcux/middleware/wifi_nxp/fwdnld_intf_abs/fwdnld_intf_abs.c b/mcux/middleware/wifi_nxp/fwdnld_intf_abs/fwdnld_intf_abs.c new file mode 100644 index 000000000..24514c852 --- /dev/null +++ b/mcux/middleware/wifi_nxp/fwdnld_intf_abs/fwdnld_intf_abs.c @@ -0,0 +1,34 @@ +/** @file fwdnld_intf_abs.c + * + * @brief This file provides interface abstraction APIs + * + * Copyright 2023-2024 NXP + * + * SPDX-License-Identifier: BSD-3-Clause + * + */ +#include "fwdnld_intf_abs.h" +#include "fwdnld_sdio.h" + +/** API to init the interface + * + * This function calls internally the interface specific init + * + * \param[in] intf_type Its of type fwdnld_intf_type_t + * \param[in] intf_specific Initialisation sequence related any setting that + * the specific interface needs. + * \note intf_specific is to be interpretted and defined by each interface + * + * \return fwdnld_intf* Success, a pointer to interface is returned. To be used in + * further API calls to this inited interface. + * \return In case init fails, NULL is returned. + */ + +fwdnld_intf_t *fwdnld_intf_init(fwdnld_intf_type_t intf_type, void *intf_specific) +{ + if (intf_type == FWDNLD_INTF_SDIO) + { + return sdio_init_interface(intf_specific); + } + return NULL; +} diff --git a/mcux/middleware/wifi_nxp/fwdnld_intf_abs/fwdnld_intf_abs.h b/mcux/middleware/wifi_nxp/fwdnld_intf_abs/fwdnld_intf_abs.h new file mode 100644 index 000000000..6045059bb --- /dev/null +++ b/mcux/middleware/wifi_nxp/fwdnld_intf_abs/fwdnld_intf_abs.h @@ -0,0 +1,101 @@ +/** @file fwdnld_inf_abs.h + * + * @brief This file provides interface abstraction APIs + * + * Copyright 2023-2024 NXP + * + * SPDX-License-Identifier: BSD-3-Clause + * + */ + +#ifndef _FWDNLD_INTF_ABS_H_ +#define _FWDNLD_INTF_ABS_H_ + +#include + +#include +#include + +/* Return type defines */ +typedef enum +{ + /* Please add interface specific return types with the values + * APIs just return interface returned return types*/ + FWDNLD_INTF_FAIL = 0xffffffff, + FWDNLD_INTF_SUCCESS = 0, + FWDNLD_INTF_SKIP, + FWDNLD_INTF_PART_WRITE, + FWDNLD_INTF_PART_READ, + FWDNLD_INTF_WAIT, + FWDNLD_INTF_EPARAM +} fwdnld_intf_ret_t; + +/*Interface type defines*/ + +typedef enum +{ + FWDNLD_INTF_IMU, + FWDNLD_INTF_SDIO, + FWDNLD_INTF_SPI, + FWDNLD_INTF_UART +} fwdnld_intf_type_t; + +struct fwdnldintf; + +typedef struct intf_elems +{ + /* Functions for the interface */ + fwdnld_intf_ret_t (*fwdnld_intf_send)(struct fwdnldintf *intf, + const uint8_t *buff, + uint32_t transfer_len, + uint32_t *transferred_len); + fwdnld_intf_ret_t (*fwdnld_intf_prepare)(struct fwdnldintf *intf, void *params); + fwdnld_intf_ret_t (*fwdnld_intf_check_ready)(struct fwdnldintf *intf, void *params); +#if (CONFIG_WIFI_IND_DNLD) + fwdnld_intf_ret_t (*fwdnld_intf_check_reload)(struct fwdnldintf *intf, uint8_t fw_reload); +#endif + /* interface values to be stored */ + uint8_t *outbuf; /* For Tx */ + uint32_t outbuf_len; + uint8_t *inbuf; /* For Rx */ + uint32_t inbuf_len; + void *intf_specific; /*Place holder to store interface specific struct */ +} intf_t; + +typedef struct fwdnldintf +{ + fwdnld_intf_type_t intf_type; + intf_t intf_s; /*returned by interface init */ +} fwdnld_intf_t; + +#define GET_INTF_TYPE(x) ((x)->intf_type) +#define GET_INTF_OUTBUF(x) ((x)->intf_s.outbuf) +#define GET_INTF_OUTBUFLEN(x) ((x)->intf_s.outbuf_len) + +#if CONFIG_WIFI_IND_DNLD +/** driver initial the fw reset */ +#define FW_RELOAD_SDIO_INBAND_RESET 1 +/** out band reset trigger reset, no interface re-emulation */ +#define FW_RELOAD_NO_EMULATION 2 +/** out band reset with interface re-emulation */ +#define FW_RELOAD_WITH_EMULATION 3 +/** sdio hw reset */ +#define FW_RELOAD_SDIO_HW_RESET 5 +#endif + +/** API to init the interface + * + * This function calls internally the interface specific init + * + * \param[in] intf_type Its of type fwdnld_intf_type_t + * \param[in] intf_specific Initialisation sequence related any setting that + * the specific interface needs. + * \note intf_specific is to be interpretted and defined by each interface + * + * \return fwdnld_intf* Success, a pointer to interface is returned. To be used in + * further API calls to this inited interface. + * \return In case init fails, NULL is returned. + */ +fwdnld_intf_t *fwdnld_intf_init(fwdnld_intf_type_t intf_type, void *intf_specific); + +#endif /*_FWDNLD_INTF_ABS_H_*/ diff --git a/mcux/middleware/wifi_nxp/incl/WIFI_IW416_BOARD_AW_AM457_CAL_DATA_EXT.h b/mcux/middleware/wifi_nxp/incl/WIFI_IW416_BOARD_AW_AM457_CAL_DATA_EXT.h new file mode 100644 index 000000000..c28c2d79d --- /dev/null +++ b/mcux/middleware/wifi_nxp/incl/WIFI_IW416_BOARD_AW_AM457_CAL_DATA_EXT.h @@ -0,0 +1,39 @@ +/** @file WIFI_IW416_BOARD_AW_AM457_CAL_DATA_EXT.h + * + * @brief This file contains the cal data + */ +/* + * Copyright 2021-2024 NXP + * + * SPDX-License-Identifier: BSD-3-Clause + * + */ +#ifndef _WIFI_CAL_DATA_H_ +#define _WIFI_CAL_DATA_H_ + +/* + * Following cal data is specific to IW416 QFN A1 chips. If other Modules require + * external cal data to be loaded then this array needs to be updated accordingly. + */ +uint8_t ext_cal_data[] = { + 0x01, 0x00, 0x0E, 0x00, 0x64, 0x01, 0x00, 0x20, 0x77, 0x0E, 0x00, 0x00, 0x00, 0x20, 0x01, 0x01, 0x20, 0x00, 0xA0, + 0x02, 0xBE, 0x19, 0x00, 0x3F, 0x00, 0x10, 0x00, 0x02, 0x58, 0x81, 0x02, 0x00, 0x00, 0x3E, 0x01, 0x00, 0x00, 0x36, + 0x00, 0x3C, 0x22, 0x4B, 0x00, 0x00, 0x00, 0x5C, 0xFF, 0xFF, 0x06, 0x00, 0x05, 0x11, 0x62, 0x03, 0xFF, 0xFF, 0x6B, + 0x6B, 0x05, 0x17, 0x5F, 0x43, 0xFF, 0xFF, 0x76, 0x76, 0x05, 0x14, 0x57, 0x47, 0xFF, 0xFF, 0x54, 0x54, 0x05, 0x16, + 0x5B, 0x4B, 0xFF, 0xFF, 0x6E, 0x6E, 0x05, 0x15, 0x62, 0x4F, 0xFF, 0xFF, 0x72, 0x72, 0x05, 0x13, 0x4B, 0x53, 0xFF, + 0xFF, 0x54, 0x54, 0x00, 0x6C, 0x92, 0x4D, 0x00, 0x00, 0x00, 0xC8, 0xFF, 0xF1, 0x0C, 0x00, 0x01, 0xA5, 0xFF, 0xFF, + 0x00, 0x06, 0x10, 0x5F, 0x01, 0x93, 0xFF, 0xFF, 0x40, 0x10, 0x10, 0x5F, 0x01, 0x9F, 0xFF, 0xFF, 0x44, 0x30, 0x10, + 0x5F, 0x01, 0x97, 0xFF, 0xFF, 0x48, 0x78, 0x10, 0x5F, 0x01, 0x92, 0xFF, 0xFF, 0x4C, 0x9D, 0x10, 0x5F, 0x01, 0x92, + 0xFF, 0xFF, 0x50, 0x50, 0x10, 0x5F, 0x40, 0x0A, 0xFF, 0xFF, 0x00, 0x06, 0x10, 0x5F, 0x40, 0x1C, 0xFF, 0xFF, 0x40, + 0x10, 0x10, 0x5F, 0x40, 0x1C, 0xFF, 0xFF, 0x44, 0x30, 0x10, 0x5F, 0x40, 0x1C, 0xFF, 0xFF, 0x48, 0x78, 0x10, 0x5F, + 0x40, 0x1E, 0xFF, 0xFF, 0x4C, 0x9D, 0x10, 0x5F, 0x40, 0x1C, 0xFF, 0xFF, 0x50, 0x50, 0x10, 0x5F, 0x00, 0x24, 0xDE, + 0x49, 0x00, 0x00, 0x00, 0xEC, 0xFF, 0xFF, 0x06, 0x00, 0x03, 0xFF, 0x04, 0x05, 0x43, 0xFF, 0x08, 0x09, 0x47, 0xFF, + 0x08, 0x09, 0x4B, 0xFF, 0x06, 0x07, 0x4F, 0xFF, 0x06, 0x07, 0x53, 0xFF, 0x06, 0x07, 0x00, 0x44, 0x06, 0x5A, 0x00, + 0x00, 0x01, 0x30, 0x00, 0x07, 0x01, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, + 0xFF, 0xFF, 0x00, 0x22, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, + 0x08, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, + 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x18, 0x8C, 0x53, 0x00, 0x00, 0x01, 0x48, 0x39, 0x54, 0xDC, 0x66, 0xBC, + 0x58, 0x44, 0xD0, 0xBE, 0x5D, 0x2F, 0x1B, 0x41, 0x1A, 0xB8, 0x52, 0x00, 0x1C, 0x9B, 0x37, 0xFF, 0xFF, 0xFF, 0xFF, + 0x02, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x2D, 0xC6, 0xC0, 0x33, 0x44, 0x55, 0x66, 0x00, 0xF0, 0x11, + 0x22}; +#endif diff --git a/mcux/middleware/wifi_nxp/incl/cli_utils.h b/mcux/middleware/wifi_nxp/incl/cli_utils.h new file mode 100644 index 000000000..b4ce760fb --- /dev/null +++ b/mcux/middleware/wifi_nxp/incl/cli_utils.h @@ -0,0 +1,37 @@ +/** @file cli_utils.h + * + * @brief CLI Utils + * + * Copyright 2008-2024 NXP + * + * SPDX-License-Identifier: BSD-3-Clause + * + */ + +#ifndef __CLI_UTILS_H__ +#define __CLI_UTILS_H__ + +#include +#include + +bool string_equal(const char *s1, const char *s2); +bool get_uint(const char *arg, unsigned int *dest, unsigned int len); +bool get_mac(const char *arg, char *dest, char sep); +#if defined(RW610) && (CONFIG_ANT_DETECT) +bool get_channel_list(const char *arg, uint8_t *num_channels, uint8_t *chan_number, char sep); +#endif +/* Simplified non-re-entrant cli_getopt function. Call this in a while loop to + * parse argv. Here are some caveats: + * + * Be sure to set cli_optind to 1 before invoking getopt for the first time. + * Only short options with preceding '-' are supported. + * Returns '?' when it encounters an unexpected condition or option + */ +extern int cli_optind; +extern char *cli_optarg; +int cli_getopt(int argc, char **argv, const char *fmt); +unsigned int a2hex_or_atoi(char *value); +unsigned int a2hex(const char *s); +unsigned char hexc2bin(char chr); +char *string_dup(const char *s); +#endif diff --git a/mcux/middleware/wifi_nxp/incl/nxp_wifi.h b/mcux/middleware/wifi_nxp/incl/nxp_wifi.h new file mode 100644 index 000000000..758813e18 --- /dev/null +++ b/mcux/middleware/wifi_nxp/incl/nxp_wifi.h @@ -0,0 +1,565 @@ +/* + * Copyright 2023-2024 NXP + * + * SPDX-License-Identifier: BSD-3-Clause + * + */ + +#ifndef __NXP_WIFI_H__ +#define __NXP_WIFI_H__ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define LWIPERF_REVERSE_MODE 1 +#define CONFIG_11N 1 +#define STA_SUPPORT 1 +#define UAP_SUPPORT 1 +#define WPA 1 +#define KEY_MATERIAL_WEP 1 +#define KEY_PARAM_SET_V2 1 +#define ENABLE_802_11W 1 +#define ENABLE_GCMP_SUPPORT 1 +#define CONFIG_STA_AMPDU_RX 1 +#define CONFIG_STA_AMPDU_TX 1 +#define CONFIG_ENABLE_AMSDU_RX 1 +#define CONFIG_UAP_AMPDU_TX 1 +#define CONFIG_UAP_AMPDU_RX 1 +#define CONFIG_WIFIDRIVER_PS_LOCK 1 +#define CONFIG_WNM_PS 0 +#define CONFIG_SCAN_CHANNEL_GAP 1 +#define CONFIG_COMBO_SCAN 1 +#define CONFIG_BG_SCAN 1 +#define CONFIG_HOST_MLME 1 +#define UAP_HOST_MLME 1 +#define CONFIG_STA_AUTO_DHCPV4 1 + +#if CONFIG_NXP_WIFI_SHELL +#define CONFIG_WIFI_SHELL 1 +#endif + +#if CONFIG_NXP_WIFI_MAX_AP_ENTRIES +#define CONFIG_MAX_AP_ENTRIES CONFIG_NXP_WIFI_MAX_AP_ENTRIES +#endif + +#if CONFIG_NXP_WIFI_WLAN_KNOWN_NETWORKS +#define CONFIG_WLAN_KNOWN_NETWORKS CONFIG_NXP_WIFI_WLAN_KNOWN_NETWORKS +#endif + +#if CONFIG_NXP_WIFI_SDIO_MULTI_PORT_RX_AGGR +#define CONFIG_SDIO_MULTI_PORT_RX_AGGR CONFIG_NXP_WIFI_SDIO_MULTI_PORT_RX_AGGR +#endif + +#if CONFIG_NXP_WIFI_SDIO_MULTI_PORT_TX_AGGR +#define CONFIG_SDIO_MULTI_PORT_TX_AGGR CONFIG_NXP_WIFI_SDIO_MULTI_PORT_TX_AGGR +#endif + +#if CONFIG_NXP_WIFI_AUTO_POWER_SAVE +#define CONFIG_WIFI_AUTO_POWER_SAVE 1 +#endif + +#if CONFIG_NXP_WIFI_TX_RX_ZERO_COPY +#define CONFIG_TX_RX_ZERO_COPY 1 +#endif + +#if CONFIG_NXP_WIFI_RF_TEST_MODE +#define CONFIG_WIFI_RF_TEST_MODE 1 +#endif + +#if CONFIG_NXP_WIFI_SOFTAP_SUPPORT +#define CONFIG_WIFI_SOFTAP_SUPPORT 1 +#endif + +#if CONFIG_NXP_WIFI_OFFLOAD +#define CONFIG_OFFLOAD CONFIG_NXP_WIFI_OFFLOAD +#endif + +#if CONFIG_NXP_WIFI_STA_RECONNECT +#define CONFIG_WIFI_STA_RECONNECT 1 +#endif + +#if CONFIG_NXP_WIFI_MON_THREAD_STACK_SIZE +#define CONFIG_MON_THREAD_STACK_SIZE CONFIG_NXP_WIFI_MON_THREAD_STACK_SIZE +#endif + +#if CONFIG_NXP_WIFI_WLCMGR_STACK_SIZE +#define CONFIG_WLCMGR_STACK_SIZE CONFIG_NXP_WIFI_WLCMGR_STACK_SIZE +#endif + +#if CONFIG_NXP_WIFI_WPS_STACK_SIZE +#define CONFIG_WPS_STACK_SIZE CONFIG_NXP_WIFI_WPS_STACK_SIZE +#endif + +#if CONFIG_NXP_WIFI_POWERSAVE_STACK_SIZE +#define CONFIG_POWERSAVE_STACK_SIZE CONFIG_NXP_WIFI_POWERSAVE_STACK_SIZE +#endif + +#if CONFIG_NXP_WIFI_TX_STACK_SIZE +#define CONFIG_TX_STACK_SIZE CONFIG_NXP_WIFI_TX_STACK_SIZE +#endif + +#if CONFIG_NXP_WIFI_DRIVER_STACK_SIZE +#define CONFIG_DRIVER_STACK_SIZE CONFIG_NXP_WIFI_DRIVER_STACK_SIZE +#endif + +#if CONFIG_NXP_WIFI_DHCP_SERVER_STACK_SIZE +#define CONFIG_DHCP_SERVER_STACK_SIZE CONFIG_NXP_WIFI_DHCP_SERVER_STACK_SIZE +#endif + +#if CONFIG_NXP_WIFI_11AX +#define CONFIG_11AX 1 +#endif + +#if CONFIG_NXP_WIFI_11AC +#define CONFIG_11AC 1 +#endif + +#if CONFIG_NXP_WIFI_ENABLE_HTTPSERVER +#define CONFIG_ENABLE_HTTPSERVER CONFIG_NXP_WIFI_ENABLE_HTTPSERVER +#endif + +#if CONFIG_NXP_WIFI_TX_RX_ZERO_COPY +#define CONFIG_TX_RX_ZERO_COPY 1 +#endif + +#if CONFIG_NXP_WIFI_CAPA +#define CONFIG_WIFI_CAPA 1 +#endif + +#if CONFIG_NXP_WIFI_WMM_UAPSD +#define CONFIG_WMM_UAPSD 1 +#endif + +#if CONFIG_NXP_WIFI_GET_LOG +#define CONFIG_WIFI_GET_LOG 1 +#endif + +#if CONFIG_NXP_WIFI_TX_PER_TRACK +#define CONFIG_WIFI_TX_PER_TRACK 1 +#endif + +#if CONFIG_NXP_WIFI_CSI +#define CONFIG_CSI 1 +#endif + +#if CONFIG_NXP_WIFI_RESET +#define CONFIG_WIFI_RESET 1 +#endif + +#if CONFIG_NXP_WIFI_NET_MONITOR +#define CONFIG_NET_MONITOR 1 +#endif + +#if CONFIG_NXP_WIFI_ECSA +#define CONFIG_ECSA 1 +#endif + +#if CONFIG_NXP_TX_AMPDU_PROT_MODE +#define CONFIG_TX_AMPDU_PROT_MODE 1 +#endif + +#if CONFIG_NXP_WIFI_UNII4_BAND_SUPPORT +#define CONFIG_UNII4_BAND_SUPPORT 1 +#endif + +#if CONFIG_NXP_WIFI_RECOVERY +#define CONFIG_WIFI_RECOVERY 1 +#endif + +#if CONFIG_NXP_WIFI_TSP +#define CONFIG_TSP 1 +#endif + +#if CONFIG_NXP_WIFI_11AX_TWT +#define CONFIG_11AX_TWT 1 +#endif + +#if CONFIG_NXP_WIFI_COMPRESS_TX_PWTBL +#define CONFIG_COMPRESS_TX_PWTBL 1 +#endif + +#if CONFIG_NXP_WIFI_COMPRESS_RU_TX_PWTBL +#define CONFIG_COMPRESS_RU_TX_PWTBL 1 +#endif + +#if CONFIG_NXP_WIFI_MAX_PRIO +#define CONFIG_WIFI_MAX_PRIO CONFIG_NXP_WIFI_MAX_PRIO +#endif + +#if CONFIG_NXP_WIFI_IPS +#define CONFIG_IPS 1 +#endif + +#if CONFIG_NXP_WIFI_EXT_SCAN_SUPPORT +#define CONFIG_EXT_SCAN_SUPPORT 1 +#endif + +#if CONFIG_NXP_WIFI_SCAN_WITH_RSSIFILTER +#define CONFIG_SCAN_WITH_RSSIFILTER 1 +#endif + +#if CONFIG_NXP_WIFI_DTIM_PERIOD +#define CONFIG_WIFI_DTIM_PERIOD 1 +#endif + +#if CONFIG_NXP_WIFI_RX_ABORT_CFG +#define CONFIG_RX_ABORT_CFG 1 +#endif + +#if CONFIG_NXP_WIFI_RX_ABORT_CFG_EXT +#define CONFIG_RX_ABORT_CFG_EXT 1 +#endif + +#if CONFIG_NXP_WIFI_CCK_DESENSE_CFG +#define CONFIG_CCK_DESENSE_CFG 1 +#endif + +#if CONFIG_NXP_WIFI_MEM_ACCESS +#define CONFIG_WIFI_MEM_ACCESS 1 +#endif + +#if CONFIG_NXP_WIFI_REG_ACCESS +#define CONFIG_WIFI_REG_ACCESS 1 +#endif + +#if CONFIG_NXP_WIFI_SUBSCRIBE_EVENT_SUPPORT +#define CONFIG_SUBSCRIBE_EVENT_SUPPORT 1 +#endif + +#if CONFIG_NXP_WIFI_TX_RX_HISTOGRAM +#define CONFIG_TX_RX_HISTOGRAM 1 +#endif + +#if CONFIG_NXP_WIFI_COEX_DUTY_CYCLE +#define CONFIG_COEX_DUTY_CYCLE 1 +#endif + +#if CONFIG_NXP_WIFI_MMSF +#define CONFIG_MMSF 1 +#endif + +#if CONFIG_NXP_WIFI_USB_FILE_ACCESS +#define CONFIG_USB_FILE_ACCESS 1 +#endif + +#if CONFIG_NXP_WIFI_SCAN_CHANNEL_GAP_TIME +#define CONFIG_SCAN_CHANNEL_GAP_TIME CONFIG_NXP_WIFI_SCAN_CHANNEL_GAP_TIME +#endif + +#if CONFIG_NXP_WIFI_INACTIVITY_TIMEOUT_EXT +#define CONFIG_INACTIVITY_TIMEOUT_EXT 1 +#endif + +#if CONFIG_NXP_WIFI_RF_TEST_MODE +#define CONFIG_RF_TEST_MODE 1 +#endif + +#if CONFIG_NXP_WIFI_IMD3_CFG +#define CONFIG_IMD3_CFG 1 +#endif + +#if CONFIG_NXP_WIFI_ANT_DETECT +#define CONFIG_ANT_DETECT 1 +#endif + +#if CONFIG_NXP_WIFI_WLAN_CALDATA_1ANT +#define CONFIG_WLAN_CALDATA_1ANT 1 +#endif + +#if CONFIG_NXP_WIFI_WLAN_CALDATA_1ANT_WITH_DIVERSITY +#define CONFIG_WLAN_CALDATA_1ANT_WITH_DIVERSITY 1 +#endif + +#if CONFIG_NXP_WIFI_WLAN_CALDATA_3ANT_DIVERSITY +#define CONFIG_WLAN_CALDATA_3ANT_DIVERSITY 1 +#endif + +#if CONFIG_NXP_WIFI_EU_VALIDATION +#define CONFIG_EU_VALIDATION 1 +#endif + +#if CONFIG_NXP_WIFI_WMM +#define CONFIG_WMM 1 +#endif + +#if CONFIG_NXP_WIFI_IPV6 +#define CONFIG_IPV6 1 +#endif + +#if CONFIG_NET_IF_UNICAST_IPV6_ADDR_COUNT +#define CONFIG_MAX_IPV6_ADDRESSES CONFIG_NET_IF_UNICAST_IPV6_ADDR_COUNT +#endif + +#if CONFIG_NXP_WIFI_5GHz_SUPPORT +#define CONFIG_5GHz_SUPPORT 1 +#endif + +#if CONFIG_NXP_WIFI_HOST_SLEEP +#define CONFIG_HOST_SLEEP 1 +#endif + +#if CONFIG_PM +#define CONFIG_POWER_MANAGER 1 +#endif + +#if CONFIG_NXP_WIFI_ROAMING +#define CONFIG_ROAMING 1 +#endif + +#if CONFIG_NXP_WIFI_CLOUD_KEEP_ALIVE +#define CONFIG_CLOUD_KEEP_ALIVE 1 +#endif + +#if CONFIG_NXP_WIFI_MEF_CFG +#define CONFIG_MEF_CFG 1 +#endif + +#if CONFIG_NXP_WIFI_TURBO_MODE +#define CONFIG_TURBO_MODE 1 +#endif + +#if CONFIG_NXP_WIFI_EU_CRYPTO +#define CONFIG_EU_CRYPTO 1 +#endif + +#if CONFIG_NXP_WIFI_FIPS +#define CONFIG_FIPS 1 +#endif + +#if !defined CONFIG_DRIVER_OWE +#define CONFIG_DRIVER_OWE 0 +#endif + +#if CONFIG_DRIVER_OWE +#undef CONFIG_DRIVER_OWE +#define CONFIG_DRIVER_OWE CONFIG_WPA_SUPP +#endif + +#if CONFIG_DRIVER_OWE +#define CONFIG_OWE +#endif + +#if !CONFIG_DRIVER_OWE +#undef CONFIG_OWE +#endif + +#if CONFIG_NXP_WIFI_11K +#define CONFIG_11K 1 +#endif + +#if CONFIG_NXP_WIFI_11V +#define CONFIG_11V 1 +#endif + +#if CONFIG_NXP_WIFI_11R +#define CONFIG_11R 1 +#endif + +#if CONFIG_NXP_WIFI_EU_CRYPTO +#define CONFIG_WIFI_EU_CRYPTO 1 +#endif + +#if CONFIG_NXP_WIFI_CLOCKSYNC +#define CONFIG_WIFI_CLOCKSYNC 1 +#endif + +#if CONFIG_NXP_WIFI_RTS_THRESHOLD +#define CONFIG_WIFI_RTS_THRESHOLD 1 +#endif + +#if CONFIG_NXP_WIFI_UAP_WORKAROUND_STICKY_TIM +#define CONFIG_UAP_WORKAROUND_STICKY_TIM CONFIG_NXP_WIFI_UAP_WORKAROUND_STICKY_TIM +#endif + +#if CONFIG_NXP_WIFI_AUTO_NULL_TX +#define CONFIG_AUTO_NULL_TX 1 +#endif + +#if CONFIG_NXP_WIFI_ENABLE_ERROR_LOGS +#define CONFIG_ENABLE_ERROR_LOGS 1 +#endif + +#if CONFIG_NXP_WIFI_ENABLE_WARNING_LOGS +#define CONFIG_ENABLE_WARNING_LOGS 1 +#endif + +#if CONFIG_NXP_WIFI_DEBUG_BUILD +#define CONFIG_DEBUG_BUILD 1 +#endif + +#if CONFIG_NXP_WIFI_OS_DEBUG +#define CONFIG_OS_DEBUG 1 +#endif + +#if CONFIG_NXP_WIFI_NET_DEBUG +#define CONFIG_NET_DEBUG 1 +#endif + +#if CONFIG_NXP_WIFI_WLCMGR_DEBUG +#define CONFIG_WLCMGR_DEBUG 1 +#endif + +#if CONFIG_NXP_WIFI_EXTRA_DEBUG +#define CONFIG_WIFI_EXTRA_DEBUG 1 +#endif + +#if CONFIG_NXP_WIFI_UAP_DEBUG +#define CONFIG_WIFI_UAP_DEBUG 1 +#endif + +#if CONFIG_NXP_WIFI_EVENTS_DEBUG +#define CONFIG_WIFI_EVENTS_DEBUG 1 +#endif + +#if CONFIG_NXP_WIFI_CMD_RESP_DEBUG +#define CONFIG_WIFI_CMD_RESP_DEBUG 1 +#endif + +#if CONFIG_NXP_WIFI_PS_DEBUG +#define CONFIG_WIFI_PS_DEBUG 1 +#endif + +#if CONFIG_NXP_WIFI_SCAN_DEBUG +#define CONFIG_WIFI_SCAN_DEBUG 1 +#endif + +#if CONFIG_NXP_WIFI_PKT_DEBUG +#define CONFIG_WIFI_PKT_DEBUG 1 +#endif + +#if CONFIG_NXP_WIFI_IO_INFO_DUMP +#define CONFIG_WIFI_IO_INFO_DUMP 1 +#endif + +#if CONFIG_NXP_WIFI_IO_DEBUG +#define CONFIG_WIFI_IO_DEBUG 1 +#endif + +#if CONFIG_NXP_WIFI_IO_DUMP +#define CONFIG_WIFI_IO_DUMP 1 +#endif + +#if CONFIG_NXP_WIFI_MEM_DEBUG +#define CONFIG_WIFI_MEM_DEBUG 1 +#endif + +#if CONFIG_NXP_WIFI_AMPDU_DEBUG +#define CONFIG_WIFI_AMPDU_DEBUG 1 +#endif + +#if CONFIG_NXP_WIFI_TIMER_DEBUG +#define CONFIG_WIFI_TIMER_DEBUG 1 +#endif + +#if CONFIG_NXP_WIFI_SDIO_DEBUG +#define CONFIG_WIFI_SDIO_DEBUG 1 +#endif + +#if CONFIG_NXP_WIFI_SDIO_IO_DEBUG +#define CONFIG_SDIO_IO_DEBUG 1 +#endif + +#if CONFIG_NXP_WIFI_FWDNLD_IO_DEBUG +#define CONFIG_FWDNLD_IO_DEBUG 1 +#endif + +#if CONFIG_NXP_WIFI_FW_DEBUG +#define CONFIG_WIFI_FW_DEBUG 1 +#endif + +#if CONFIG_NXP_WIFI_FW_VDLL_DEBUG +#define CONFIG_FW_VDLL_DEBUG 1 +#endif + +#if CONFIG_NXP_WIFI_DHCP_SERVER_DEBUG +#define CONFIG_DHCP_SERVER_DEBUG 1 +#endif + +#if CONFIG_NXP_WIFI_SMOKE_TESTS +#define CONFIG_WIFI_SMOKE_TESTS 1 +#endif + +#if CONFIG_NXP_WIFI_SM_IP_DHCP +#define IP_USE_DHCP 1 +#endif + +#if CONFIG_NXP_WIFI_SIGMA_AGENT +#define CONFIG_SIGMA_AGENT 1 +#endif + +#if CONFIG_NXP_WIFI_CUSTOM_CALDATA +#define CONFIG_CUSTOM_CALDATA 1 +#endif + +#if CONFIG_WIFI_NM_WPA_SUPPLICANT +#define CONFIG_WPA_SUPP 1 +#endif + +#if CONFIG_NXP_WIFI_SET_SU +#define CONFIG_SET_SU 1 +#endif + +#if CONFIG_NXP_WIFI_MULTI_BSSID_SUPPORT +#define CONFIG_MULTI_BSSID_SUPPORT 1 +#endif + +#if CONFIG_NXP_WIFI_FRAG_THRESHOLD +#define CONFIG_WIFI_FRAG_THRESHOLD 1 +#endif + +#if CONFIG_NXP_WIFI_FORCE_RTS +#define CONFIG_WIFI_FORCE_RTS 1 +#endif + +#if CONFIG_NXP_WIFI_TX_AMPDU_PROT_MODE +#define CONFIG_TX_AMPDU_PROT_MODE 1 +#endif + +#if CONFIG_NXP_WIFI_EXTERNAL_COEX_PTA +#define CONFIG_EXTERNAL_COEX_PTA 1 +#endif + +#if CONFIG_NXP_WIFI_FW_VDLLV2 +#define CONFIG_FW_VDLLV2 1 +#endif + +#if CONFIG_WIFI_NM_HOSTAPD_AP +#define CONFIG_WPA_SUPP_AP 1 +#endif +#if (CONFIG_NXP_WIFI_8978) || (CONFIG_NXP_WIFI_8987) || (CONFIG_NXP_WIFI_9177) + +#define CONFIG_GTK_REKEY_OFFLOAD 1 + +#define CONFIG_FW_VDLL 1 + +#endif + +#if (CONFIG_NXP_WIFI_9177) +#define CONFIG_TCP_ACK_ENH 1 +#endif + +#if CONFIG_11AX + +#if !CONFIG_11K +#define CONFIG_11K 1 +#endif + +#if !CONFIG_11V +#define CONFIG_11V 1 +#endif + +#if !CONFIG_WPA_SUPP +#define CONFIG_DRIVER_MBO 1 +#endif + +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __NXP_WIFI_H__ */ diff --git a/mcux/middleware/wifi_nxp/incl/port/mbedtls/wpa_supp_els_pkc_mbedtls_config.h b/mcux/middleware/wifi_nxp/incl/port/mbedtls/wpa_supp_els_pkc_mbedtls_config.h new file mode 100644 index 000000000..532b61cf7 --- /dev/null +++ b/mcux/middleware/wifi_nxp/incl/port/mbedtls/wpa_supp_els_pkc_mbedtls_config.h @@ -0,0 +1,3839 @@ +/** + * \file config.h + * + * \brief Configuration options (set of defines) + * + * This set of compile-time options may be used to enable + * or disable features selectively, and reduce the global + * memory footprint. + */ +/* + * Copyright The Mbed TLS Contributors + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef MBEDTLS_USER_CONFIG_H +#define MBEDTLS_USER_CONFIG_H + +#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) +#define _CRT_SECURE_NO_DEPRECATE 1 +#endif + +/**************************** MCUX CSS_PKC ********************************************/ +#include + +#if defined(CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_MBEDTLS_PSA) && \ + !defined(CONFIG_BUILD_WITH_TFM) +#define MBEDTLS_CTR_DRBG_ENABLED +#define MBEDTLS_CIPHER_AES_ENABLED +#define MBEDTLS_CIPHER_MODE_CBC_ENABLED +#define MBEDTLS_CIPHER_PADDING_PKCS7 +#define PSA_CRYPTO_DRIVER_ELS_PKC + +//#define MBEDTLS_PSA_ACCEL_ALG_MD5 +//#define MBEDTLS_PSA_ACCEL_ALG_SHA_1 +#define MBEDTLS_PSA_ACCEL_ALG_SHA_224 +#define MBEDTLS_PSA_ACCEL_ALG_SHA_256 +#define MBEDTLS_PSA_ACCEL_ALG_SHA_384 +#define MBEDTLS_PSA_ACCEL_ALG_SHA_512 +#define MBEDTLS_PSA_ACCEL_ALG_RIPEMD160 + +#define PSA_WANT_ALG_ECDSA 1 +#define PSA_WANT_ALG_ECDSA_ANY 1 +#define PSA_WANT_ALG_RSA_PKCS1V15_SIGN 1 +#define PSA_WANT_ALG_RSA_PKCS1V15_SIGN_RAW 1 +#endif + +/**************************** MCUX CSS_PKC end ****************************************/ +/** + * \name SECTION: System support + * + * This section sets system specific settings. + * \{ + */ + +/** + * \def MBEDTLS_HAVE_ASM + * + * The compiler has support for asm(). + * + * Requires support for asm() in compiler. + * + * Used in: + * library/aria.c + * library/timing.c + * include/mbedtls/bn_mul.h + * + * Required by: + * MBEDTLS_AESNI_C + * MBEDTLS_PADLOCK_C + * + * Comment to disable the use of assembly code. + */ +#define MBEDTLS_HAVE_ASM + +/** + * \def MBEDTLS_NO_UDBL_DIVISION + * + * The platform lacks support for double-width integer division (64-bit + * division on a 32-bit platform, 128-bit division on a 64-bit platform). + * + * Used in: + * include/mbedtls/bignum.h + * library/bignum.c + * + * The bignum code uses double-width division to speed up some operations. + * Double-width division is often implemented in software that needs to + * be linked with the program. The presence of a double-width integer + * type is usually detected automatically through preprocessor macros, + * but the automatic detection cannot know whether the code needs to + * and can be linked with an implementation of division for that type. + * By default division is assumed to be usable if the type is present. + * Uncomment this option to prevent the use of double-width division. + * + * Note that division for the native integer type is always required. + * Furthermore, a 64-bit type is always required even on a 32-bit + * platform, but it need not support multiplication or division. In some + * cases it is also desirable to disable some double-width operations. For + * example, if double-width division is implemented in software, disabling + * it can reduce code size in some embedded targets. + */ +//#define MBEDTLS_NO_UDBL_DIVISION + +/** + * \def MBEDTLS_NO_64BIT_MULTIPLICATION + * + * The platform lacks support for 32x32 -> 64-bit multiplication. + * + * Used in: + * library/poly1305.c + * + * Some parts of the library may use multiplication of two unsigned 32-bit + * operands with a 64-bit result in order to speed up computations. On some + * platforms, this is not available in hardware and has to be implemented in + * software, usually in a library provided by the toolchain. + * + * Sometimes it is not desirable to have to link to that library. This option + * removes the dependency of that library on platforms that lack a hardware + * 64-bit multiplier by embedding a software implementation in Mbed TLS. + * + * Note that depending on the compiler, this may decrease performance compared + * to using the library function provided by the toolchain. + */ +//#define MBEDTLS_NO_64BIT_MULTIPLICATION + +/** + * \def MBEDTLS_HAVE_SSE2 + * + * CPU supports SSE2 instruction set. + * + * Uncomment if the CPU supports SSE2 (IA-32 specific). + */ +//#define MBEDTLS_HAVE_SSE2 + +/** + * \def MBEDTLS_HAVE_TIME + * + * System has time.h and time(). + * The time does not need to be correct, only time differences are used, + * by contrast with MBEDTLS_HAVE_TIME_DATE + * + * Defining MBEDTLS_HAVE_TIME allows you to specify MBEDTLS_PLATFORM_TIME_ALT, + * MBEDTLS_PLATFORM_TIME_MACRO, MBEDTLS_PLATFORM_TIME_TYPE_MACRO and + * MBEDTLS_PLATFORM_STD_TIME. + * + * Comment if your system does not support time functions + */ +//#define MBEDTLS_HAVE_TIME + +/** + * \def MBEDTLS_HAVE_TIME_DATE + * + * System has time.h, time(), and an implementation for + * mbedtls_platform_gmtime_r() (see below). + * The time needs to be correct (not necessarily very accurate, but at least + * the date should be correct). This is used to verify the validity period of + * X.509 certificates. + * + * Comment if your system does not have a correct clock. + * + * \note mbedtls_platform_gmtime_r() is an abstraction in platform_util.h that + * behaves similarly to the gmtime_r() function from the C standard. Refer to + * the documentation for mbedtls_platform_gmtime_r() for more information. + * + * \note It is possible to configure an implementation for + * mbedtls_platform_gmtime_r() at compile-time by using the macro + * MBEDTLS_PLATFORM_GMTIME_R_ALT. + */ +//#define MBEDTLS_HAVE_TIME_DATE + +/** + * \def MBEDTLS_PLATFORM_MEMORY + * + * Enable the memory allocation layer. + * + * By default mbed TLS uses the system-provided calloc() and free(). + * This allows different allocators (self-implemented or provided) to be + * provided to the platform abstraction layer. + * + * Enabling MBEDTLS_PLATFORM_MEMORY without the + * MBEDTLS_PLATFORM_{FREE,CALLOC}_MACROs will provide + * "mbedtls_platform_set_calloc_free()" allowing you to set an alternative calloc() and + * free() function pointer at runtime. + * + * Enabling MBEDTLS_PLATFORM_MEMORY and specifying + * MBEDTLS_PLATFORM_{CALLOC,FREE}_MACROs will allow you to specify the + * alternate function at compile time. + * + * Requires: MBEDTLS_PLATFORM_C + * + * Enable this layer to allow use of alternative memory allocators. + */ +//#define MBEDTLS_PLATFORM_MEMORY + +/** + * \def MBEDTLS_PLATFORM_NO_STD_FUNCTIONS + * + * Do not assign standard functions in the platform layer (e.g. calloc() to + * MBEDTLS_PLATFORM_STD_CALLOC and printf() to MBEDTLS_PLATFORM_STD_PRINTF) + * + * This makes sure there are no linking errors on platforms that do not support + * these functions. You will HAVE to provide alternatives, either at runtime + * via the platform_set_xxx() functions or at compile time by setting + * the MBEDTLS_PLATFORM_STD_XXX defines, or enabling a + * MBEDTLS_PLATFORM_XXX_MACRO. + * + * Requires: MBEDTLS_PLATFORM_C + * + * Uncomment to prevent default assignment of standard functions in the + * platform layer. + */ +//#define MBEDTLS_PLATFORM_NO_STD_FUNCTIONS + +/** + * \def MBEDTLS_PLATFORM_EXIT_ALT + * + * MBEDTLS_PLATFORM_XXX_ALT: Uncomment a macro to let mbed TLS support the + * function in the platform abstraction layer. + * + * Example: In case you uncomment MBEDTLS_PLATFORM_PRINTF_ALT, mbed TLS will + * provide a function "mbedtls_platform_set_printf()" that allows you to set an + * alternative printf function pointer. + * + * All these define require MBEDTLS_PLATFORM_C to be defined! + * + * \note MBEDTLS_PLATFORM_SNPRINTF_ALT is required on Windows; + * it will be enabled automatically by check_config.h + * + * \warning MBEDTLS_PLATFORM_XXX_ALT cannot be defined at the same time as + * MBEDTLS_PLATFORM_XXX_MACRO! + * + * Requires: MBEDTLS_PLATFORM_TIME_ALT requires MBEDTLS_HAVE_TIME + * + * Uncomment a macro to enable alternate implementation of specific base + * platform function + */ +//#define MBEDTLS_PLATFORM_EXIT_ALT +//#define MBEDTLS_PLATFORM_TIME_ALT +//#define MBEDTLS_PLATFORM_FPRINTF_ALT +//#define MBEDTLS_PLATFORM_PRINTF_ALT +//#define MBEDTLS_PLATFORM_SNPRINTF_ALT +//#define MBEDTLS_PLATFORM_VSNPRINTF_ALT +//#define MBEDTLS_PLATFORM_NV_SEED_ALT +//#define MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT + +/** + * \def MBEDTLS_DEPRECATED_WARNING + * + * Mark deprecated functions and features so that they generate a warning if + * used. Functionality deprecated in one version will usually be removed in the + * next version. You can enable this to help you prepare the transition to a + * new major version by making sure your code is not using this functionality. + * + * This only works with GCC and Clang. With other compilers, you may want to + * use MBEDTLS_DEPRECATED_REMOVED + * + * Uncomment to get warnings on using deprecated functions and features. + */ +//#define MBEDTLS_DEPRECATED_WARNING + +/** + * \def MBEDTLS_DEPRECATED_REMOVED + * + * Remove deprecated functions and features so that they generate an error if + * used. Functionality deprecated in one version will usually be removed in the + * next version. You can enable this to help you prepare the transition to a + * new major version by making sure your code is not using this functionality. + * + * Uncomment to get errors on using deprecated functions and features. + */ +//#define MBEDTLS_DEPRECATED_REMOVED + +/** + * \def MBEDTLS_CHECK_PARAMS + * + * This configuration option controls whether the library validates more of + * the parameters passed to it. + * + * When this flag is not defined, the library only attempts to validate an + * input parameter if: (1) they may come from the outside world (such as the + * network, the filesystem, etc.) or (2) not validating them could result in + * internal memory errors such as overflowing a buffer controlled by the + * library. On the other hand, it doesn't attempt to validate parameters whose + * values are fully controlled by the application (such as pointers). + * + * When this flag is defined, the library additionally attempts to validate + * parameters that are fully controlled by the application, and should always + * be valid if the application code is fully correct and trusted. + * + * For example, when a function accepts as input a pointer to a buffer that may + * contain untrusted data, and its documentation mentions that this pointer + * must not be NULL: + * - The pointer is checked to be non-NULL only if this option is enabled. + * - The content of the buffer is always validated. + * + * When this flag is defined, if a library function receives a parameter that + * is invalid: + * 1. The function will invoke the macro MBEDTLS_PARAM_FAILED(). + * 2. If MBEDTLS_PARAM_FAILED() did not terminate the program, the function + * will immediately return. If the function returns an Mbed TLS error code, + * the error code in this case is MBEDTLS_ERR_xxx_BAD_INPUT_DATA. + * + * When defining this flag, you also need to arrange a definition for + * MBEDTLS_PARAM_FAILED(). You can do this by any of the following methods: + * - By default, the library defines MBEDTLS_PARAM_FAILED() to call a + * function mbedtls_param_failed(), but the library does not define this + * function. If you do not make any other arrangements, you must provide + * the function mbedtls_param_failed() in your application. + * See `platform_util.h` for its prototype. + * - If you enable the macro #MBEDTLS_CHECK_PARAMS_ASSERT, then the + * library defines MBEDTLS_PARAM_FAILED(\c cond) to be `assert(cond)`. + * You can still supply an alternative definition of + * MBEDTLS_PARAM_FAILED(), which may call `assert`. + * - If you define a macro MBEDTLS_PARAM_FAILED() before including `config.h` + * or you uncomment the definition of MBEDTLS_PARAM_FAILED() in `config.h`, + * the library will call the macro that you defined and will not supply + * its own version. Note that if MBEDTLS_PARAM_FAILED() calls `assert`, + * you need to enable #MBEDTLS_CHECK_PARAMS_ASSERT so that library source + * files include ``. + * + * Uncomment to enable validation of application-controlled parameters. + */ +//#define MBEDTLS_CHECK_PARAMS + +/** + * \def MBEDTLS_CHECK_PARAMS_ASSERT + * + * Allow MBEDTLS_PARAM_FAILED() to call `assert`, and make it default to + * `assert`. This macro is only used if #MBEDTLS_CHECK_PARAMS is defined. + * + * If this macro is not defined, then MBEDTLS_PARAM_FAILED() defaults to + * calling a function mbedtls_param_failed(). See the documentation of + * #MBEDTLS_CHECK_PARAMS for details. + * + * Uncomment to allow MBEDTLS_PARAM_FAILED() to call `assert`. + */ +//#define MBEDTLS_CHECK_PARAMS_ASSERT + +/* \} name SECTION: System support */ + +/** + * \name SECTION: mbed TLS feature support + * + * This section sets support for features that are or are not needed + * within the modules that are enabled. + * \{ + */ + +/** + * \def MBEDTLS_TIMING_ALT + * + * Uncomment to provide your own alternate implementation for mbedtls_timing_hardclock(), + * mbedtls_timing_get_timer(), mbedtls_set_alarm(), mbedtls_set/get_delay() + * + * Only works if you have MBEDTLS_TIMING_C enabled. + * + * You will need to provide a header "timing_alt.h" and an implementation at + * compile time. + */ +//#define MBEDTLS_TIMING_ALT + +/** + * \def MBEDTLS_AES_ALT + * + * MBEDTLS__MODULE_NAME__ALT: Uncomment a macro to let mbed TLS use your + * alternate core implementation of a symmetric crypto, an arithmetic or hash + * module (e.g. platform specific assembly optimized implementations). Keep + * in mind that the function prototypes should remain the same. + * + * This replaces the whole module. If you only want to replace one of the + * functions, use one of the MBEDTLS__FUNCTION_NAME__ALT flags. + * + * Example: In case you uncomment MBEDTLS_AES_ALT, mbed TLS will no longer + * provide the "struct mbedtls_aes_context" definition and omit the base + * function declarations and implementations. "aes_alt.h" will be included from + * "aes.h" to include the new function definitions. + * + * Uncomment a macro to enable alternate implementation of the corresponding + * module. + * + * \warning MD2, MD4, MD5, ARC4, DES and SHA-1 are considered weak and their + * use constitutes a security risk. If possible, we recommend + * avoiding dependencies on them, and considering stronger message + * digests and ciphers instead. + * + */ + +/** + * \def MBEDTLS_ECP_INTERNAL_ALT + * + * Expose a part of the internal interface of the Elliptic Curve Point module. + * + * MBEDTLS_ECP__FUNCTION_NAME__ALT: Uncomment a macro to let mbed TLS use your + * alternative core implementation of elliptic curve arithmetic. Keep in mind + * that function prototypes should remain the same. + * + * This partially replaces one function. The header file from mbed TLS is still + * used, in contrast to the MBEDTLS_ECP_ALT flag. The original implementation + * is still present and it is used for group structures not supported by the + * alternative. + * + * Any of these options become available by defining MBEDTLS_ECP_INTERNAL_ALT + * and implementing the following functions: + * unsigned char mbedtls_internal_ecp_grp_capable( + * const mbedtls_ecp_group *grp ) + * int mbedtls_internal_ecp_init( const mbedtls_ecp_group *grp ) + * void mbedtls_internal_ecp_free( const mbedtls_ecp_group *grp ) + * The mbedtls_internal_ecp_grp_capable function should return 1 if the + * replacement functions implement arithmetic for the given group and 0 + * otherwise. + * The functions mbedtls_internal_ecp_init and mbedtls_internal_ecp_free are + * called before and after each point operation and provide an opportunity to + * implement optimized set up and tear down instructions. + * + * Example: In case you uncomment MBEDTLS_ECP_INTERNAL_ALT and + * MBEDTLS_ECP_DOUBLE_JAC_ALT, mbed TLS will still provide the ecp_double_jac + * function, but will use your mbedtls_internal_ecp_double_jac if the group is + * supported (your mbedtls_internal_ecp_grp_capable function returns 1 when + * receives it as an argument). If the group is not supported then the original + * implementation is used. The other functions and the definition of + * mbedtls_ecp_group and mbedtls_ecp_point will not change, so your + * implementation of mbedtls_internal_ecp_double_jac and + * mbedtls_internal_ecp_grp_capable must be compatible with this definition. + * + * Uncomment a macro to enable alternate implementation of the corresponding + * function. + */ +/* Required for all the functions in this section */ +//#define MBEDTLS_ECP_INTERNAL_ALT +/* Support for Weierstrass curves with Jacobi representation */ +//#define MBEDTLS_ECP_RANDOMIZE_JAC_ALT +//#define MBEDTLS_ECP_ADD_MIXED_ALT +//#define MBEDTLS_ECP_DOUBLE_JAC_ALT +//#define MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT +//#define MBEDTLS_ECP_NORMALIZE_JAC_ALT +/* Support for curves with Montgomery arithmetic */ +//#define MBEDTLS_ECP_DOUBLE_ADD_MXZ_ALT +//#define MBEDTLS_ECP_RANDOMIZE_MXZ_ALT +//#define MBEDTLS_ECP_NORMALIZE_MXZ_ALT + +/** + * \def MBEDTLS_TEST_NULL_ENTROPY + * + * Enables testing and use of mbed TLS without any configured entropy sources. + * This permits use of the library on platforms before an entropy source has + * been integrated (see for example the MBEDTLS_ENTROPY_HARDWARE_ALT or the + * MBEDTLS_ENTROPY_NV_SEED switches). + * + * WARNING! This switch MUST be disabled in production builds, and is suitable + * only for development. + * Enabling the switch negates any security provided by the library. + * + * Requires MBEDTLS_ENTROPY_C, MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES + * + */ +//#define MBEDTLS_TEST_NULL_ENTROPY + +/** + * \def MBEDTLS_AES_ROM_TABLES + * + * Use precomputed AES tables stored in ROM. + * + * Uncomment this macro to use precomputed AES tables stored in ROM. + * Comment this macro to generate AES tables in RAM at runtime. + * + * Tradeoff: Using precomputed ROM tables reduces RAM usage by ~8kb + * (or ~2kb if \c MBEDTLS_AES_FEWER_TABLES is used) and reduces the + * initialization time before the first AES operation can be performed. + * It comes at the cost of additional ~8kb ROM use (resp. ~2kb if \c + * MBEDTLS_AES_FEWER_TABLES below is used), and potentially degraded + * performance if ROM access is slower than RAM access. + * + * This option is independent of \c MBEDTLS_AES_FEWER_TABLES. + * + */ +//#define MBEDTLS_AES_ROM_TABLES + +/** + * \def MBEDTLS_AES_FEWER_TABLES + * + * Use less ROM/RAM for AES tables. + * + * Uncommenting this macro omits 75% of the AES tables from + * ROM / RAM (depending on the value of \c MBEDTLS_AES_ROM_TABLES) + * by computing their values on the fly during operations + * (the tables are entry-wise rotations of one another). + * + * Tradeoff: Uncommenting this reduces the RAM / ROM footprint + * by ~6kb but at the cost of more arithmetic operations during + * runtime. Specifically, one has to compare 4 accesses within + * different tables to 4 accesses with additional arithmetic + * operations within the same table. The performance gain/loss + * depends on the system and memory details. + * + * This option is independent of \c MBEDTLS_AES_ROM_TABLES. + * + */ +//#define MBEDTLS_AES_FEWER_TABLES + +/** + * \def MBEDTLS_CAMELLIA_SMALL_MEMORY + * + * Use less ROM for the Camellia implementation (saves about 768 bytes). + * + * Uncomment this macro to use less memory for Camellia. + */ +//#define MBEDTLS_CAMELLIA_SMALL_MEMORY + +/** + * \def MBEDTLS_CIPHER_MODE_CBC + * + * Enable Cipher Block Chaining mode (CBC) for symmetric ciphers. + */ +#define MBEDTLS_CIPHER_MODE_CBC + +/** + * \def MBEDTLS_CIPHER_MODE_CFB + * + * Enable Cipher Feedback mode (CFB) for symmetric ciphers. + */ +#define MBEDTLS_CIPHER_MODE_CFB + +/** + * \def MBEDTLS_CIPHER_MODE_CTR + * + * Enable Counter Block Cipher mode (CTR) for symmetric ciphers. + */ +#define MBEDTLS_CIPHER_MODE_CTR + +/** + * \def MBEDTLS_CIPHER_MODE_OFB + * + * Enable Output Feedback mode (OFB) for symmetric ciphers. + */ +#define MBEDTLS_CIPHER_MODE_OFB + +/** + * \def MBEDTLS_CIPHER_MODE_XTS + * + * Enable Xor-encrypt-xor with ciphertext stealing mode (XTS) for AES. + */ +#define MBEDTLS_CIPHER_MODE_XTS + +/** + * \def MBEDTLS_CIPHER_NULL_CIPHER + * + * Enable NULL cipher. + * Warning: Only do so when you know what you are doing. This allows for + * encryption or channels without any security! + * + * Requires MBEDTLS_ENABLE_WEAK_CIPHERSUITES as well to enable + * the following ciphersuites: + * MBEDTLS_TLS_ECDH_ECDSA_WITH_NULL_SHA + * MBEDTLS_TLS_ECDH_RSA_WITH_NULL_SHA + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_NULL_SHA + * MBEDTLS_TLS_ECDHE_RSA_WITH_NULL_SHA + * MBEDTLS_TLS_ECDHE_PSK_WITH_NULL_SHA384 + * MBEDTLS_TLS_ECDHE_PSK_WITH_NULL_SHA256 + * MBEDTLS_TLS_ECDHE_PSK_WITH_NULL_SHA + * MBEDTLS_TLS_DHE_PSK_WITH_NULL_SHA384 + * MBEDTLS_TLS_DHE_PSK_WITH_NULL_SHA256 + * MBEDTLS_TLS_DHE_PSK_WITH_NULL_SHA + * MBEDTLS_TLS_RSA_WITH_NULL_SHA256 + * MBEDTLS_TLS_RSA_WITH_NULL_SHA + * MBEDTLS_TLS_RSA_WITH_NULL_MD5 + * MBEDTLS_TLS_RSA_PSK_WITH_NULL_SHA384 + * MBEDTLS_TLS_RSA_PSK_WITH_NULL_SHA256 + * MBEDTLS_TLS_RSA_PSK_WITH_NULL_SHA + * MBEDTLS_TLS_PSK_WITH_NULL_SHA384 + * MBEDTLS_TLS_PSK_WITH_NULL_SHA256 + * MBEDTLS_TLS_PSK_WITH_NULL_SHA + * + * Uncomment this macro to enable the NULL cipher and ciphersuites + */ +//#define MBEDTLS_CIPHER_NULL_CIPHER + +/** + * \def MBEDTLS_CIPHER_PADDING_PKCS7 + * + * MBEDTLS_CIPHER_PADDING_XXX: Uncomment or comment macros to add support for + * specific padding modes in the cipher layer with cipher modes that support + * padding (e.g. CBC) + * + * If you disable all padding modes, only full blocks can be used with CBC. + * + * Enable padding modes in the cipher layer. + */ +#define MBEDTLS_CIPHER_PADDING_PKCS7 +#define MBEDTLS_CIPHER_PADDING_ONE_AND_ZEROS +#define MBEDTLS_CIPHER_PADDING_ZEROS_AND_LEN +#define MBEDTLS_CIPHER_PADDING_ZEROS + +/** \def MBEDTLS_CTR_DRBG_USE_128_BIT_KEY + * + * Uncomment this macro to use a 128-bit key in the CTR_DRBG module. + * By default, CTR_DRBG uses a 256-bit key. + */ +//#define MBEDTLS_CTR_DRBG_USE_128_BIT_KEY + +/** + * \def MBEDTLS_ENABLE_WEAK_CIPHERSUITES + * + * Enable weak ciphersuites in SSL / TLS. + * Warning: Only do so when you know what you are doing. This allows for + * channels with virtually no security at all! + * + * This enables the following ciphersuites: + * MBEDTLS_TLS_RSA_WITH_DES_CBC_SHA + * MBEDTLS_TLS_DHE_RSA_WITH_DES_CBC_SHA + * + * Uncomment this macro to enable weak ciphersuites + * + * \warning DES is considered a weak cipher and its use constitutes a + * security risk. We recommend considering stronger ciphers instead. + */ +//#define MBEDTLS_ENABLE_WEAK_CIPHERSUITES + +/** + * \def MBEDTLS_REMOVE_ARC4_CIPHERSUITES + * + * Remove RC4 ciphersuites by default in SSL / TLS. + * This flag removes the ciphersuites based on RC4 from the default list as + * returned by mbedtls_ssl_list_ciphersuites(). However, it is still possible to + * enable (some of) them with mbedtls_ssl_conf_ciphersuites() by including them + * explicitly. + * + * Uncomment this macro to remove RC4 ciphersuites by default. + */ +#define MBEDTLS_REMOVE_ARC4_CIPHERSUITES + +/** + * \def MBEDTLS_REMOVE_3DES_CIPHERSUITES + * + * Remove 3DES ciphersuites by default in SSL / TLS. + * This flag removes the ciphersuites based on 3DES from the default list as + * returned by mbedtls_ssl_list_ciphersuites(). However, it is still possible + * to enable (some of) them with mbedtls_ssl_conf_ciphersuites() by including + * them explicitly. + * + * A man-in-the-browser attacker can recover authentication tokens sent through + * a TLS connection using a 3DES based cipher suite (see "On the Practical + * (In-)Security of 64-bit Block Ciphers" by Karthikeyan Bhargavan and Gaëtan + * Leurent, see https://sweet32.info/SWEET32_CCS16.pdf). If this attack falls + * in your threat model or you are unsure, then you should keep this option + * enabled to remove 3DES based cipher suites. + * + * Comment this macro to keep 3DES in the default ciphersuite list. + */ +#define MBEDTLS_REMOVE_3DES_CIPHERSUITES + +/** + * \def MBEDTLS_ECP_DP_SECP192R1_ENABLED + * + * MBEDTLS_ECP_XXXX_ENABLED: Enables specific curves within the Elliptic Curve + * module. By default all supported curves are enabled. + * + * Comment macros to disable the curve and functions for it + */ +/* Short Weierstrass curves (supporting ECP, ECDH, ECDSA) */ +#define MBEDTLS_ECP_DP_SECP192R1_ENABLED +#define MBEDTLS_ECP_DP_SECP224R1_ENABLED +#define MBEDTLS_ECP_DP_SECP256R1_ENABLED +#define MBEDTLS_ECP_DP_SECP384R1_ENABLED +#define MBEDTLS_ECP_DP_SECP521R1_ENABLED +#define MBEDTLS_ECP_DP_SECP192K1_ENABLED +#define MBEDTLS_ECP_DP_SECP224K1_ENABLED +#define MBEDTLS_ECP_DP_SECP256K1_ENABLED +#define MBEDTLS_ECP_DP_BP256R1_ENABLED +#define MBEDTLS_ECP_DP_BP384R1_ENABLED +#define MBEDTLS_ECP_DP_BP512R1_ENABLED +/* Montgomery curves (supporting ECP), NOT supported by CSS PKC*/ +//#define MBEDTLS_ECP_DP_CURVE25519_ENABLED +//#define MBEDTLS_ECP_DP_CURVE448_ENABLED + +/** + * \def MBEDTLS_ECP_NIST_OPTIM + * + * Enable specific 'modulo p' routines for each NIST prime. + * Depending on the prime and architecture, makes operations 4 to 8 times + * faster on the corresponding curve. + * + * Comment this macro to disable NIST curves optimisation. + */ +#define MBEDTLS_ECP_NIST_OPTIM + +/** + * \def MBEDTLS_ECP_NO_INTERNAL_RNG + * + * When this option is disabled, mbedtls_ecp_mul() will make use of an + * internal RNG when called with a NULL \c f_rng argument, in order to protect + * against some side-channel attacks. + * + * This protection introduces a dependency of the ECP module on one of the + * DRBG modules. For very constrained implementations that don't require this + * protection (for example, because you're only doing signature verification, + * so not manipulating any secret, or because local/physical side-channel + * attacks are outside your threat model), it might be desirable to get rid of + * that dependency. + * + * \warning Enabling this option makes some uses of ECP vulnerable to some + * side-channel attacks. Only enable it if you know that's not a problem for + * your use case. + * + * Uncomment this macro to disable some counter-measures in ECP. + */ +//#define MBEDTLS_ECP_NO_INTERNAL_RNG + +/** + * \def MBEDTLS_ECP_RESTARTABLE + * + * Enable "non-blocking" ECC operations that can return early and be resumed. + * + * This allows various functions to pause by returning + * #MBEDTLS_ERR_ECP_IN_PROGRESS (or, for functions in the SSL module, + * #MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS) and then be called later again in + * order to further progress and eventually complete their operation. This is + * controlled through mbedtls_ecp_set_max_ops() which limits the maximum + * number of ECC operations a function may perform before pausing; see + * mbedtls_ecp_set_max_ops() for more information. + * + * This is useful in non-threaded environments if you want to avoid blocking + * for too long on ECC (and, hence, X.509 or SSL/TLS) operations. + * + * Uncomment this macro to enable restartable ECC computations. + * + * \note This option only works with the default software implementation of + * elliptic curve functionality. It is incompatible with + * MBEDTLS_ECP_ALT, MBEDTLS_ECDH_XXX_ALT, MBEDTLS_ECDSA_XXX_ALT + * and MBEDTLS_ECDH_LEGACY_CONTEXT. + */ +//#define MBEDTLS_ECP_RESTARTABLE + +/** + * \def MBEDTLS_ECDH_LEGACY_CONTEXT + * + * Use a backward compatible ECDH context. + * + * Mbed TLS supports two formats for ECDH contexts (#mbedtls_ecdh_context + * defined in `ecdh.h`). For most applications, the choice of format makes + * no difference, since all library functions can work with either format, + * except that the new format is incompatible with MBEDTLS_ECP_RESTARTABLE. + + * The new format used when this option is disabled is smaller + * (56 bytes on a 32-bit platform). In future versions of the library, it + * will support alternative implementations of ECDH operations. + * The new format is incompatible with applications that access + * context fields directly and with restartable ECP operations. + * + * Define this macro if you enable MBEDTLS_ECP_RESTARTABLE or if you + * want to access ECDH context fields directly. Otherwise you should + * comment out this macro definition. + * + * This option has no effect if #MBEDTLS_ECDH_C is not enabled. + * + * \note This configuration option is experimental. Future versions of the + * library may modify the way the ECDH context layout is configured + * and may modify the layout of the new context type. + */ +#ifdef MBEDTLS_ECDH_LEGACY_CONTEXT +#undef MBEDTLS_ECDH_LEGACY_CONTEXT +#endif + +/** + * \def MBEDTLS_ECDSA_DETERMINISTIC + * + * Enable deterministic ECDSA (RFC 6979). + * Standard ECDSA is "fragile" in the sense that lack of entropy when signing + * may result in a compromise of the long-term signing key. This is avoided by + * the deterministic variant. + * + * Requires: MBEDTLS_HMAC_DRBG_C, MBEDTLS_ECDSA_C + * + * Comment this macro to disable deterministic ECDSA. + */ +#define MBEDTLS_ECDSA_DETERMINISTIC + +/** + * \def MBEDTLS_KEY_EXCHANGE_PSK_ENABLED + * + * Enable the PSK based ciphersuite modes in SSL / TLS. + * + * This enables the following ciphersuites (if other requisites are + * enabled as well): + * MBEDTLS_TLS_PSK_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_PSK_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_PSK_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_PSK_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_PSK_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_PSK_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_PSK_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_PSK_WITH_3DES_EDE_CBC_SHA + * MBEDTLS_TLS_PSK_WITH_RC4_128_SHA + */ +#define MBEDTLS_KEY_EXCHANGE_PSK_ENABLED + +/** + * \def MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED + * + * Enable the DHE-PSK based ciphersuite modes in SSL / TLS. + * + * Requires: MBEDTLS_DHM_C + * + * This enables the following ciphersuites (if other requisites are + * enabled as well): + * MBEDTLS_TLS_DHE_PSK_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_DHE_PSK_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_DHE_PSK_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_DHE_PSK_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_DHE_PSK_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_DHE_PSK_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA + * MBEDTLS_TLS_DHE_PSK_WITH_RC4_128_SHA + * + * \warning Using DHE constitutes a security risk as it + * is not possible to validate custom DH parameters. + * If possible, it is recommended users should consider + * preferring other methods of key exchange. + * See dhm.h for more details. + * + */ +#define MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED + +/** + * \def MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED + * + * Enable the ECDHE-PSK based ciphersuite modes in SSL / TLS. + * + * Requires: MBEDTLS_ECDH_C + * + * This enables the following ciphersuites (if other requisites are + * enabled as well): + * MBEDTLS_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA + * MBEDTLS_TLS_ECDHE_PSK_WITH_RC4_128_SHA + */ +#define MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED + +/** + * \def MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED + * + * Enable the RSA-PSK based ciphersuite modes in SSL / TLS. + * + * Requires: MBEDTLS_RSA_C, MBEDTLS_PKCS1_V15, + * MBEDTLS_X509_CRT_PARSE_C + * + * This enables the following ciphersuites (if other requisites are + * enabled as well): + * MBEDTLS_TLS_RSA_PSK_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_RSA_PSK_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_RSA_PSK_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_RSA_PSK_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_RSA_PSK_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_RSA_PSK_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA + * MBEDTLS_TLS_RSA_PSK_WITH_RC4_128_SHA + */ +#define MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED + +/** + * \def MBEDTLS_KEY_EXCHANGE_RSA_ENABLED + * + * Enable the RSA-only based ciphersuite modes in SSL / TLS. + * + * Requires: MBEDTLS_RSA_C, MBEDTLS_PKCS1_V15, + * MBEDTLS_X509_CRT_PARSE_C + * + * This enables the following ciphersuites (if other requisites are + * enabled as well): + * MBEDTLS_TLS_RSA_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_RSA_WITH_AES_256_CBC_SHA256 + * MBEDTLS_TLS_RSA_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256 + * MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA + * MBEDTLS_TLS_RSA_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_RSA_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_RSA_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA + * MBEDTLS_TLS_RSA_WITH_3DES_EDE_CBC_SHA + * MBEDTLS_TLS_RSA_WITH_RC4_128_SHA + * MBEDTLS_TLS_RSA_WITH_RC4_128_MD5 + */ +#define MBEDTLS_KEY_EXCHANGE_RSA_ENABLED + +/** + * \def MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED + * + * Enable the DHE-RSA based ciphersuite modes in SSL / TLS. + * + * Requires: MBEDTLS_DHM_C, MBEDTLS_RSA_C, MBEDTLS_PKCS1_V15, + * MBEDTLS_X509_CRT_PARSE_C + * + * This enables the following ciphersuites (if other requisites are + * enabled as well): + * MBEDTLS_TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 + * MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 + * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA + * MBEDTLS_TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA + * MBEDTLS_TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA + * + * \warning Using DHE constitutes a security risk as it + * is not possible to validate custom DH parameters. + * If possible, it is recommended users should consider + * preferring other methods of key exchange. + * See dhm.h for more details. + * + */ +#define MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED + +/** + * \def MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED + * + * Enable the ECDHE-RSA based ciphersuite modes in SSL / TLS. + * + * Requires: MBEDTLS_ECDH_C, MBEDTLS_RSA_C, MBEDTLS_PKCS1_V15, + * MBEDTLS_X509_CRT_PARSE_C + * + * This enables the following ciphersuites (if other requisites are + * enabled as well): + * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA + * MBEDTLS_TLS_ECDHE_RSA_WITH_RC4_128_SHA + */ +#define MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED + +/** + * \def MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED + * + * Enable the ECDHE-ECDSA based ciphersuite modes in SSL / TLS. + * + * Requires: MBEDTLS_ECDH_C, MBEDTLS_ECDSA_C, MBEDTLS_X509_CRT_PARSE_C, + * + * This enables the following ciphersuites (if other requisites are + * enabled as well): + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_RC4_128_SHA + */ +#define MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED + +/** + * \def MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED + * + * Enable the ECDH-ECDSA based ciphersuite modes in SSL / TLS. + * + * Requires: MBEDTLS_ECDH_C, MBEDTLS_ECDSA_C, MBEDTLS_X509_CRT_PARSE_C + * + * This enables the following ciphersuites (if other requisites are + * enabled as well): + * MBEDTLS_TLS_ECDH_ECDSA_WITH_RC4_128_SHA + * MBEDTLS_TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA + * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384 + */ +#define MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED + +/** + * \def MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED + * + * Enable the ECDH-RSA based ciphersuite modes in SSL / TLS. + * + * Requires: MBEDTLS_ECDH_C, MBEDTLS_RSA_C, MBEDTLS_X509_CRT_PARSE_C + * + * This enables the following ciphersuites (if other requisites are + * enabled as well): + * MBEDTLS_TLS_ECDH_RSA_WITH_RC4_128_SHA + * MBEDTLS_TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA + * MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_GCM_SHA384 + */ +#define MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED + +/** + * \def MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED + * + * Enable the ECJPAKE based ciphersuite modes in SSL / TLS. + * + * \warning This is currently experimental. EC J-PAKE support is based on the + * Thread v1.0.0 specification; incompatible changes to the specification + * might still happen. For this reason, this is disabled by default. + * + * Requires: MBEDTLS_ECJPAKE_C + * MBEDTLS_SHA256_C + * MBEDTLS_ECP_DP_SECP256R1_ENABLED + * + * This enables the following ciphersuites (if other requisites are + * enabled as well): + * MBEDTLS_TLS_ECJPAKE_WITH_AES_128_CCM_8 + */ +//#define MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED + +/** + * \def MBEDTLS_PK_PARSE_EC_EXTENDED + * + * Enhance support for reading EC keys using variants of SEC1 not allowed by + * RFC 5915 and RFC 5480. + * + * Currently this means parsing the SpecifiedECDomain choice of EC + * parameters (only known groups are supported, not arbitrary domains, to + * avoid validation issues). + * + * Disable if you only need to support RFC 5915 + 5480 key formats. + */ +#define MBEDTLS_PK_PARSE_EC_EXTENDED + +/** + * \def MBEDTLS_ERROR_STRERROR_DUMMY + * + * Enable a dummy error function to make use of mbedtls_strerror() in + * third party libraries easier when MBEDTLS_ERROR_C is disabled + * (no effect when MBEDTLS_ERROR_C is enabled). + * + * You can safely disable this if MBEDTLS_ERROR_C is enabled, or if you're + * not using mbedtls_strerror() or error_strerror() in your application. + * + * Disable if you run into name conflicts and want to really remove the + * mbedtls_strerror() + */ +#define MBEDTLS_ERROR_STRERROR_DUMMY + +/** + * \def MBEDTLS_GENPRIME + * + * Enable the prime-number generation code. + * + * Requires: MBEDTLS_BIGNUM_C + */ +#define MBEDTLS_GENPRIME + +/** + * \def MBEDTLS_FS_IO + * + * Enable functions that use the filesystem. + */ +//#define MBEDTLS_FS_IO + +/** + * \def MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES + * + * Do not add default entropy sources. These are the platform specific, + * mbedtls_timing_hardclock and HAVEGE based poll functions. + * + * This is useful to have more control over the added entropy sources in an + * application. + * + * Uncomment this macro to prevent loading of default entropy functions. + */ +//#define MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES + +/** + * \def MBEDTLS_NO_PLATFORM_ENTROPY + * + * Do not use built-in platform entropy functions. + * This is useful if your platform does not support + * standards like the /dev/urandom or Windows CryptoAPI. + * + * Uncomment this macro to disable the built-in platform entropy functions. + */ +#define MBEDTLS_NO_PLATFORM_ENTROPY + +/** + * \def MBEDTLS_ENTROPY_FORCE_SHA256 + * + * Force the entropy accumulator to use a SHA-256 accumulator instead of the + * default SHA-512 based one (if both are available). + * + * Requires: MBEDTLS_SHA256_C + * + * On 32-bit systems SHA-256 can be much faster than SHA-512. Use this option + * if you have performance concerns. + * + * This option is only useful if both MBEDTLS_SHA256_C and + * MBEDTLS_SHA512_C are defined. Otherwise the available hash module is used. + */ +//#define MBEDTLS_ENTROPY_FORCE_SHA256 + +/** + * \def MBEDTLS_ENTROPY_NV_SEED + * + * Enable the non-volatile (NV) seed file-based entropy source. + * (Also enables the NV seed read/write functions in the platform layer) + * + * This is crucial (if not required) on systems that do not have a + * cryptographic entropy source (in hardware or kernel) available. + * + * Requires: MBEDTLS_ENTROPY_C, MBEDTLS_PLATFORM_C + * + * \note The read/write functions that are used by the entropy source are + * determined in the platform layer, and can be modified at runtime and/or + * compile-time depending on the flags (MBEDTLS_PLATFORM_NV_SEED_*) used. + * + * \note If you use the default implementation functions that read a seedfile + * with regular fopen(), please make sure you make a seedfile with the + * proper name (defined in MBEDTLS_PLATFORM_STD_NV_SEED_FILE) and at + * least MBEDTLS_ENTROPY_BLOCK_SIZE bytes in size that can be read from + * and written to or you will get an entropy source error! The default + * implementation will only use the first MBEDTLS_ENTROPY_BLOCK_SIZE + * bytes from the file. + * + * \note The entropy collector will write to the seed file before entropy is + * given to an external source, to update it. + */ +//#define MBEDTLS_ENTROPY_NV_SEED + +/* MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER + * + * Enable key identifiers that encode a key owner identifier. + * + * The owner of a key is identified by a value of type ::mbedtls_key_owner_id_t + * which is currently hard-coded to be int32_t. + * + * Note that this option is meant for internal use only and may be removed + * without notice. It is incompatible with MBEDTLS_USE_PSA_CRYPTO. + */ +//#define MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER + +/** + * \def MBEDTLS_MEMORY_DEBUG + * + * Enable debugging of buffer allocator memory issues. Automatically prints + * (to stderr) all (fatal) messages on memory allocation issues. Enables + * function for 'debug output' of allocated memory. + * + * Requires: MBEDTLS_MEMORY_BUFFER_ALLOC_C + * + * Uncomment this macro to let the buffer allocator print out error messages. + */ +//#define MBEDTLS_MEMORY_DEBUG + +/** + * \def MBEDTLS_MEMORY_BACKTRACE + * + * Include backtrace information with each allocated block. + * + * Requires: MBEDTLS_MEMORY_BUFFER_ALLOC_C + * GLIBC-compatible backtrace() an backtrace_symbols() support + * + * Uncomment this macro to include backtrace information + */ +//#define MBEDTLS_MEMORY_BACKTRACE + +/** + * \def MBEDTLS_PK_RSA_ALT_SUPPORT + * + * Support external private RSA keys (eg from a HSM) in the PK layer. + * + * Comment this macro to disable support for external private RSA keys. + */ +#define MBEDTLS_PK_RSA_ALT_SUPPORT + +/** + * \def MBEDTLS_PKCS1_V15 + * + * Enable support for PKCS#1 v1.5 encoding. + * + * Requires: MBEDTLS_RSA_C + * + * This enables support for PKCS#1 v1.5 operations. + */ +#define MBEDTLS_PKCS1_V15 + +/** + * \def MBEDTLS_PKCS1_V21 + * + * Enable support for PKCS#1 v2.1 encoding. + * + * Requires: MBEDTLS_MD_C, MBEDTLS_RSA_C + * + * This enables support for RSAES-OAEP and RSASSA-PSS operations. + */ +#define MBEDTLS_PKCS1_V21 + +/** \def MBEDTLS_PSA_CRYPTO_DRIVERS + * + * Enable support for the experimental PSA crypto driver interface. + * + * Requires: MBEDTLS_PSA_CRYPTO_C + * + * \warning This interface is experimental and may change or be removed + * without notice. + */ +//#define MBEDTLS_PSA_CRYPTO_DRIVERS + +/** + * \def MBEDTLS_PSA_CRYPTO_SPM + * + * When MBEDTLS_PSA_CRYPTO_SPM is defined, the code is built for SPM (Secure + * Partition Manager) integration which separates the code into two parts: a + * NSPE (Non-Secure Process Environment) and an SPE (Secure Process + * Environment). + * + * Module: library/psa_crypto.c + * Requires: MBEDTLS_PSA_CRYPTO_C + * + */ +//#define MBEDTLS_PSA_CRYPTO_SPM + +/** + * \def MBEDTLS_PSA_INJECT_ENTROPY + * + * Enable support for entropy injection at first boot. This feature is + * required on systems that do not have a built-in entropy source (TRNG). + * This feature is currently not supported on systems that have a built-in + * entropy source. + * + * Requires: MBEDTLS_PSA_CRYPTO_STORAGE_C, MBEDTLS_ENTROPY_NV_SEED + * + */ +//#define MBEDTLS_PSA_INJECT_ENTROPY + +/** + * \def MBEDTLS_RSA_NO_CRT + * + * Do not use the Chinese Remainder Theorem + * for the RSA private operation. + * + * Uncomment this macro to disable the use of CRT in RSA. + * + */ +//#define MBEDTLS_RSA_NO_CRT + +/** + * \def MBEDTLS_SELF_TEST + * + * Enable the checkup functions (*_self_test). + */ +#define MBEDTLS_SELF_TEST + +/** + * \def MBEDTLS_SHA256_SMALLER + * + * Enable an implementation of SHA-256 that has lower ROM footprint but also + * lower performance. + * + * The default implementation is meant to be a reasonnable compromise between + * performance and size. This version optimizes more aggressively for size at + * the expense of performance. Eg on Cortex-M4 it reduces the size of + * mbedtls_sha256_process() from ~2KB to ~0.5KB for a performance hit of about + * 30%. + * + * Uncomment to enable the smaller implementation of SHA256. + */ +//#define MBEDTLS_SHA256_SMALLER + +/** + * \def MBEDTLS_SHA512_SMALLER + * + * Enable an implementation of SHA-512 that has lower ROM footprint but also + * lower performance. + * + * Uncomment to enable the smaller implementation of SHA512. + */ +//#define MBEDTLS_SHA512_SMALLER + +/** + * \def MBEDTLS_SHA512_NO_SHA384 + * + * Disable the SHA-384 option of the SHA-512 module. Use this to save some + * code size on devices that don't use SHA-384. + * + * Requires: MBEDTLS_SHA512_C + * + * Uncomment to disable SHA-384 + */ +//#define MBEDTLS_SHA512_NO_SHA384 + +/** + * \def MBEDTLS_SSL_ALL_ALERT_MESSAGES + * + * Enable sending of alert messages in case of encountered errors as per RFC. + * If you choose not to send the alert messages, mbed TLS can still communicate + * with other servers, only debugging of failures is harder. + * + * The advantage of not sending alert messages, is that no information is given + * about reasons for failures thus preventing adversaries of gaining intel. + * + * Enable sending of all alert messages + */ +#define MBEDTLS_SSL_ALL_ALERT_MESSAGES + +/** + * \def MBEDTLS_SSL_RECORD_CHECKING + * + * Enable the function mbedtls_ssl_check_record() which can be used to check + * the validity and authenticity of an incoming record, to verify that it has + * not been seen before. These checks are performed without modifying the + * externally visible state of the SSL context. + * + * See mbedtls_ssl_check_record() for more information. + * + * Uncomment to enable support for record checking. + */ +#define MBEDTLS_SSL_RECORD_CHECKING + +/** + * \def MBEDTLS_SSL_DTLS_CONNECTION_ID + * + * Enable support for the DTLS Connection ID extension + * (version draft-ietf-tls-dtls-connection-id-05, + * https://tools.ietf.org/html/draft-ietf-tls-dtls-connection-id-05) + * which allows to identify DTLS connections across changes + * in the underlying transport. + * + * Setting this option enables the SSL APIs `mbedtls_ssl_set_cid()`, + * `mbedtls_ssl_get_peer_cid()` and `mbedtls_ssl_conf_cid()`. + * See the corresponding documentation for more information. + * + * \warning The Connection ID extension is still in draft state. + * We make no stability promises for the availability + * or the shape of the API controlled by this option. + * + * The maximum lengths of outgoing and incoming CIDs can be configured + * through the options + * - MBEDTLS_SSL_CID_OUT_LEN_MAX + * - MBEDTLS_SSL_CID_IN_LEN_MAX. + * + * Requires: MBEDTLS_SSL_PROTO_DTLS + * + * Uncomment to enable the Connection ID extension. + */ +//#define MBEDTLS_SSL_DTLS_CONNECTION_ID + +/** + * \def MBEDTLS_SSL_ASYNC_PRIVATE + * + * Enable asynchronous external private key operations in SSL. This allows + * you to configure an SSL connection to call an external cryptographic + * module to perform private key operations instead of performing the + * operation inside the library. + * + */ +//#define MBEDTLS_SSL_ASYNC_PRIVATE + +/** + * \def MBEDTLS_SSL_CONTEXT_SERIALIZATION + * + * Enable serialization of the TLS context structures, through use of the + * functions mbedtls_ssl_context_save() and mbedtls_ssl_context_load(). + * + * This pair of functions allows one side of a connection to serialize the + * context associated with the connection, then free or re-use that context + * while the serialized state is persisted elsewhere, and finally deserialize + * that state to a live context for resuming read/write operations on the + * connection. From a protocol perspective, the state of the connection is + * unaffected, in particular this is entirely transparent to the peer. + * + * Note: this is distinct from TLS session resumption, which is part of the + * protocol and fully visible by the peer. TLS session resumption enables + * establishing new connections associated to a saved session with shorter, + * lighter handshakes, while context serialization is a local optimization in + * handling a single, potentially long-lived connection. + * + * Enabling these APIs makes some SSL structures larger, as 64 extra bytes are + * saved after the handshake to allow for more efficient serialization, so if + * you don't need this feature you'll save RAM by disabling it. + * + * Comment to disable the context serialization APIs. + */ +#define MBEDTLS_SSL_CONTEXT_SERIALIZATION + +/** + * \def MBEDTLS_SSL_DEBUG_ALL + * + * Enable the debug messages in SSL module for all issues. + * Debug messages have been disabled in some places to prevent timing + * attacks due to (unbalanced) debugging function calls. + * + * If you need all error reporting you should enable this during debugging, + * but remove this for production servers that should log as well. + * + * Uncomment this macro to report all debug messages on errors introducing + * a timing side-channel. + * + */ +//#define MBEDTLS_SSL_DEBUG_ALL + +/** \def MBEDTLS_SSL_ENCRYPT_THEN_MAC + * + * Enable support for Encrypt-then-MAC, RFC 7366. + * + * This allows peers that both support it to use a more robust protection for + * ciphersuites using CBC, providing deep resistance against timing attacks + * on the padding or underlying cipher. + * + * This only affects CBC ciphersuites, and is useless if none is defined. + * + * Requires: MBEDTLS_SSL_PROTO_TLS1 or + * MBEDTLS_SSL_PROTO_TLS1_1 or + * MBEDTLS_SSL_PROTO_TLS1_2 + * + * Comment this macro to disable support for Encrypt-then-MAC + */ +#define MBEDTLS_SSL_ENCRYPT_THEN_MAC + +/** \def MBEDTLS_SSL_EXTENDED_MASTER_SECRET + * + * Enable support for RFC 7627: Session Hash and Extended Master Secret + * Extension. + * + * This was introduced as "the proper fix" to the Triple Handshake familiy of + * attacks, but it is recommended to always use it (even if you disable + * renegotiation), since it actually fixes a more fundamental issue in the + * original SSL/TLS design, and has implications beyond Triple Handshake. + * + * Requires: MBEDTLS_SSL_PROTO_TLS1 or + * MBEDTLS_SSL_PROTO_TLS1_1 or + * MBEDTLS_SSL_PROTO_TLS1_2 + * + * Comment this macro to disable support for Extended Master Secret. + */ +#define MBEDTLS_SSL_EXTENDED_MASTER_SECRET + +/** + * \def MBEDTLS_SSL_FALLBACK_SCSV + * + * Enable support for RFC 7507: Fallback Signaling Cipher Suite Value (SCSV) + * for Preventing Protocol Downgrade Attacks. + * + * For servers, it is recommended to always enable this, unless you support + * only one version of TLS, or know for sure that none of your clients + * implements a fallback strategy. + * + * For clients, you only need this if you're using a fallback strategy, which + * is not recommended in the first place, unless you absolutely need it to + * interoperate with buggy (version-intolerant) servers. + * + * Comment this macro to disable support for FALLBACK_SCSV + */ +#define MBEDTLS_SSL_FALLBACK_SCSV + +/** + * \def MBEDTLS_SSL_KEEP_PEER_CERTIFICATE + * + * This option controls the availability of the API mbedtls_ssl_get_peer_cert() + * giving access to the peer's certificate after completion of the handshake. + * + * Unless you need mbedtls_ssl_peer_cert() in your application, it is + * recommended to disable this option for reduced RAM usage. + * + * \note If this option is disabled, mbedtls_ssl_get_peer_cert() is still + * defined, but always returns \c NULL. + * + * \note This option has no influence on the protection against the + * triple handshake attack. Even if it is disabled, Mbed TLS will + * still ensure that certificates do not change during renegotiation, + * for exaple by keeping a hash of the peer's certificate. + * + * Comment this macro to disable storing the peer's certificate + * after the handshake. + */ +#define MBEDTLS_SSL_KEEP_PEER_CERTIFICATE + +/** + * \def MBEDTLS_SSL_HW_RECORD_ACCEL + * + * Enable hooking functions in SSL module for hardware acceleration of + * individual records. + * + * \deprecated This option is deprecated and will be removed in a future + * version of Mbed TLS. + * + * Uncomment this macro to enable hooking functions. + */ +//#define MBEDTLS_SSL_HW_RECORD_ACCEL + +/** + * \def MBEDTLS_SSL_CBC_RECORD_SPLITTING + * + * Enable 1/n-1 record splitting for CBC mode in SSLv3 and TLS 1.0. + * + * This is a countermeasure to the BEAST attack, which also minimizes the risk + * of interoperability issues compared to sending 0-length records. + * + * Comment this macro to disable 1/n-1 record splitting. + */ +#define MBEDTLS_SSL_CBC_RECORD_SPLITTING + +/** + * \def MBEDTLS_SSL_RENEGOTIATION + * + * Enable support for TLS renegotiation. + * + * The two main uses of renegotiation are (1) refresh keys on long-lived + * connections and (2) client authentication after the initial handshake. + * If you don't need renegotiation, it's probably better to disable it, since + * it has been associated with security issues in the past and is easy to + * misuse/misunderstand. + * + * Comment this to disable support for renegotiation. + * + * \note Even if this option is disabled, both client and server are aware + * of the Renegotiation Indication Extension (RFC 5746) used to + * prevent the SSL renegotiation attack (see RFC 5746 Sect. 1). + * (See \c mbedtls_ssl_conf_legacy_renegotiation for the + * configuration of this extension). + * + */ +#define MBEDTLS_SSL_RENEGOTIATION + +/** + * \def MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO + * + * Enable support for receiving and parsing SSLv2 Client Hello messages for the + * SSL Server module (MBEDTLS_SSL_SRV_C). + * + * \deprecated This option is deprecated and will be removed in a future + * version of Mbed TLS. + * + * Uncomment this macro to enable support for SSLv2 Client Hello messages. + */ +//#define MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO + +/** + * \def MBEDTLS_SSL_SRV_RESPECT_CLIENT_PREFERENCE + * + * Pick the ciphersuite according to the client's preferences rather than ours + * in the SSL Server module (MBEDTLS_SSL_SRV_C). + * + * Uncomment this macro to respect client's ciphersuite order + */ +//#define MBEDTLS_SSL_SRV_RESPECT_CLIENT_PREFERENCE + +/** + * \def MBEDTLS_SSL_MAX_FRAGMENT_LENGTH + * + * Enable support for RFC 6066 max_fragment_length extension in SSL. + * + * Comment this macro to disable support for the max_fragment_length extension + */ +#define MBEDTLS_SSL_MAX_FRAGMENT_LENGTH + +/** + * \def MBEDTLS_SSL_PROTO_SSL3 + * + * Enable support for SSL 3.0. + * + * Requires: MBEDTLS_MD5_C + * MBEDTLS_SHA1_C + * + * \deprecated This option is deprecated and will be removed in a future + * version of Mbed TLS. + * + * Comment this macro to disable support for SSL 3.0 + */ +//#define MBEDTLS_SSL_PROTO_SSL3 + +/** + * \def MBEDTLS_SSL_PROTO_TLS1 + * + * Enable support for TLS 1.0. + * + * Requires: MBEDTLS_MD5_C + * MBEDTLS_SHA1_C + * + * Comment this macro to disable support for TLS 1.0 + */ +#define MBEDTLS_SSL_PROTO_TLS1 + +/** + * \def MBEDTLS_SSL_PROTO_TLS1_1 + * + * Enable support for TLS 1.1 (and DTLS 1.0 if DTLS is enabled). + * + * Requires: MBEDTLS_MD5_C + * MBEDTLS_SHA1_C + * + * Comment this macro to disable support for TLS 1.1 / DTLS 1.0 + */ +#define MBEDTLS_SSL_PROTO_TLS1_1 + +/** + * \def MBEDTLS_SSL_PROTO_TLS1_2 + * + * Enable support for TLS 1.2 (and DTLS 1.2 if DTLS is enabled). + * + * Requires: MBEDTLS_SHA1_C or MBEDTLS_SHA256_C or MBEDTLS_SHA512_C + * (Depends on ciphersuites) + * + * Comment this macro to disable support for TLS 1.2 / DTLS 1.2 + */ +#define MBEDTLS_SSL_PROTO_TLS1_2 + +/** + * \def MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL + * + * This macro is used to selectively enable experimental parts + * of the code that contribute to the ongoing development of + * the prototype TLS 1.3 and DTLS 1.3 implementation, and provide + * no other purpose. + * + * \warning TLS 1.3 and DTLS 1.3 aren't yet supported in Mbed TLS, + * and no feature exposed through this macro is part of the + * public API. In particular, features under the control + * of this macro are experimental and don't come with any + * stability guarantees. + * + * Uncomment this macro to enable experimental and partial + * functionality specific to TLS 1.3. + */ +//#define MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL + +/** + * \def MBEDTLS_SSL_PROTO_DTLS + * + * Enable support for DTLS (all available versions). + * + * Enable this and MBEDTLS_SSL_PROTO_TLS1_1 to enable DTLS 1.0, + * and/or this and MBEDTLS_SSL_PROTO_TLS1_2 to enable DTLS 1.2. + * + * Requires: MBEDTLS_SSL_PROTO_TLS1_1 + * or MBEDTLS_SSL_PROTO_TLS1_2 + * + * Comment this macro to disable support for DTLS + */ +#define MBEDTLS_SSL_PROTO_DTLS + +/** + * \def MBEDTLS_SSL_ALPN + * + * Enable support for RFC 7301 Application Layer Protocol Negotiation. + * + * Comment this macro to disable support for ALPN. + */ +#define MBEDTLS_SSL_ALPN + +/** + * \def MBEDTLS_SSL_DTLS_ANTI_REPLAY + * + * Enable support for the anti-replay mechanism in DTLS. + * + * Requires: MBEDTLS_SSL_TLS_C + * MBEDTLS_SSL_PROTO_DTLS + * + * \warning Disabling this is often a security risk! + * See mbedtls_ssl_conf_dtls_anti_replay() for details. + * + * Comment this to disable anti-replay in DTLS. + */ +#define MBEDTLS_SSL_DTLS_ANTI_REPLAY + +/** + * \def MBEDTLS_SSL_DTLS_HELLO_VERIFY + * + * Enable support for HelloVerifyRequest on DTLS servers. + * + * This feature is highly recommended to prevent DTLS servers being used as + * amplifiers in DoS attacks against other hosts. It should always be enabled + * unless you know for sure amplification cannot be a problem in the + * environment in which your server operates. + * + * \warning Disabling this can ba a security risk! (see above) + * + * Requires: MBEDTLS_SSL_PROTO_DTLS + * + * Comment this to disable support for HelloVerifyRequest. + */ +#define MBEDTLS_SSL_DTLS_HELLO_VERIFY + +/** + * \def MBEDTLS_SSL_DTLS_SRTP + * + * Enable support for negotation of DTLS-SRTP (RFC 5764) + * through the use_srtp extension. + * + * \note This feature provides the minimum functionality required + * to negotiate the use of DTLS-SRTP and to allow the derivation of + * the associated SRTP packet protection key material. + * In particular, the SRTP packet protection itself, as well as the + * demultiplexing of RTP and DTLS packets at the datagram layer + * (see Section 5 of RFC 5764), are not handled by this feature. + * Instead, after successful completion of a handshake negotiating + * the use of DTLS-SRTP, the extended key exporter API + * mbedtls_ssl_conf_export_keys_ext_cb() should be used to implement + * the key exporter described in Section 4.2 of RFC 5764 and RFC 5705 + * (this is implemented in the SSL example programs). + * The resulting key should then be passed to an SRTP stack. + * + * Setting this option enables the runtime API + * mbedtls_ssl_conf_dtls_srtp_protection_profiles() + * through which the supported DTLS-SRTP protection + * profiles can be configured. You must call this API at + * runtime if you wish to negotiate the use of DTLS-SRTP. + * + * Requires: MBEDTLS_SSL_PROTO_DTLS + * + * Uncomment this to enable support for use_srtp extension. + */ +//#define MBEDTLS_SSL_DTLS_SRTP + +/** + * \def MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE + * + * Enable server-side support for clients that reconnect from the same port. + * + * Some clients unexpectedly close the connection and try to reconnect using the + * same source port. This needs special support from the server to handle the + * new connection securely, as described in section 4.2.8 of RFC 6347. This + * flag enables that support. + * + * Requires: MBEDTLS_SSL_DTLS_HELLO_VERIFY + * + * Comment this to disable support for clients reusing the source port. + */ +#define MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE + +/** + * \def MBEDTLS_SSL_DTLS_BADMAC_LIMIT + * + * Enable support for a limit of records with bad MAC. + * + * See mbedtls_ssl_conf_dtls_badmac_limit(). + * + * Requires: MBEDTLS_SSL_PROTO_DTLS + */ +#define MBEDTLS_SSL_DTLS_BADMAC_LIMIT + +/** + * \def MBEDTLS_SSL_SESSION_TICKETS + * + * Enable support for RFC 5077 session tickets in SSL. + * Client-side, provides full support for session tickets (maintenance of a + * session store remains the responsibility of the application, though). + * Server-side, you also need to provide callbacks for writing and parsing + * tickets, including authenticated encryption and key management. Example + * callbacks are provided by MBEDTLS_SSL_TICKET_C. + * + * Comment this macro to disable support for SSL session tickets + */ +#define MBEDTLS_SSL_SESSION_TICKETS + +/** + * \def MBEDTLS_SSL_EXPORT_KEYS + * + * Enable support for exporting key block and master secret. + * This is required for certain users of TLS, e.g. EAP-TLS. + * + * Comment this macro to disable support for key export + */ +#define MBEDTLS_SSL_EXPORT_KEYS + +/** + * \def MBEDTLS_SSL_SERVER_NAME_INDICATION + * + * Enable support for RFC 6066 server name indication (SNI) in SSL. + * + * Requires: MBEDTLS_X509_CRT_PARSE_C + * + * Comment this macro to disable support for server name indication in SSL + */ +#define MBEDTLS_SSL_SERVER_NAME_INDICATION + +/** + * \def MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT + * + * Fallback to old (pre-2.7), non-conforming implementation of the truncated + * HMAC extension which also truncates the HMAC key. Note that this option is + * only meant for a transitory upgrade period and will be removed in a future + * version of the library. + * + * \warning The old implementation is non-compliant and has a security weakness + * (2^80 brute force attack on the HMAC key used for a single, + * uninterrupted connection). This should only be enabled temporarily + * when (1) the use of truncated HMAC is essential in order to save + * bandwidth, and (2) the peer is an Mbed TLS stack that doesn't use + * the fixed implementation yet (pre-2.7). + * + * \deprecated This option is deprecated and will be removed in a + * future version of Mbed TLS. + * + * Uncomment to fallback to old, non-compliant truncated HMAC implementation. + * + * Requires: MBEDTLS_SSL_TRUNCATED_HMAC + */ +//#define MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT + +/** + * \def MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH + * + * Enable modifying the maximum I/O buffer size. + */ +//#define MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH + +/** + * \def MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN + * + * Enable testing of the constant-flow nature of some sensitive functions with + * clang's MemorySanitizer. This causes some existing tests to also test + * this non-functional property of the code under test. + * + * This setting requires compiling with clang -fsanitize=memory. The test + * suites can then be run normally. + * + * \warning This macro is only used for extended testing; it is not considered + * part of the library's API, so it may change or disappear at any time. + * + * Uncomment to enable testing of the constant-flow nature of selected code. + */ +//#define MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN + +/** + * \def MBEDTLS_TEST_CONSTANT_FLOW_VALGRIND + * + * Enable testing of the constant-flow nature of some sensitive functions with + * valgrind's memcheck tool. This causes some existing tests to also test + * this non-functional property of the code under test. + * + * This setting requires valgrind headers for building, and is only useful for + * testing if the tests suites are run with valgrind's memcheck. This can be + * done for an individual test suite with 'valgrind ./test_suite_xxx', or when + * using CMake, this can be done for all test suites with 'make memcheck'. + * + * \warning This macro is only used for extended testing; it is not considered + * part of the library's API, so it may change or disappear at any time. + * + * Uncomment to enable testing of the constant-flow nature of selected code. + */ +//#define MBEDTLS_TEST_CONSTANT_FLOW_VALGRIND + +/** + * \def MBEDTLS_TEST_HOOKS + * + * Enable features for invasive testing such as introspection functions and + * hooks for fault injection. This enables additional unit tests. + * + * Merely enabling this feature should not change the behavior of the product. + * It only adds new code, and new branching points where the default behavior + * is the same as when this feature is disabled. + * However, this feature increases the attack surface: there is an added + * risk of vulnerabilities, and more gadgets that can make exploits easier. + * Therefore this feature must never be enabled in production. + * + * See `docs/architecture/testing/mbed-crypto-invasive-testing.md` for more + * information. + * + * Uncomment to enable invasive tests. + */ +//#define MBEDTLS_TEST_HOOKS + +/** + * \def MBEDTLS_THREADING_PTHREAD + * + * Enable the pthread wrapper layer for the threading layer. + * + * Requires: MBEDTLS_THREADING_C + * + * Uncomment this to enable pthread mutexes. + */ +//#define MBEDTLS_THREADING_PTHREAD + +/** + * \def MBEDTLS_USE_PSA_CRYPTO + * + * Make the X.509 and TLS library use PSA for cryptographic operations, and + * enable new APIs for using keys handled by PSA Crypto. + * + * \note Development of this option is currently in progress, and parts of Mbed + * TLS's X.509 and TLS modules are not ported to PSA yet. However, these parts + * will still continue to work as usual, so enabling this option should not + * break backwards compatibility. + * + * \warning The PSA Crypto API is in beta stage. While you're welcome to + * experiment using it, incompatible API changes are still possible, and some + * parts may not have reached the same quality as the rest of Mbed TLS yet. + * + * \warning This option enables new Mbed TLS APIs that are dependent on the + * PSA Crypto API, so can't come with the same stability guarantees as the + * rest of the Mbed TLS APIs. You're welcome to experiment with them, but for + * now, access to these APIs is opt-in (via enabling the present option), in + * order to clearly differentiate them from the stable Mbed TLS APIs. + * + * Requires: MBEDTLS_PSA_CRYPTO_C. + * + * Uncomment this to enable internal use of PSA Crypto and new associated APIs. + */ +//#define MBEDTLS_USE_PSA_CRYPTO + +/** + * \def MBEDTLS_PSA_CRYPTO_CONFIG + * + * This setting allows support for cryptographic mechanisms through the PSA + * API to be configured separately from support through the mbedtls API. + * + * Uncomment this to enable use of PSA Crypto configuration settings which + * can be found in include/psa/crypto_config.h. + * + * If you enable this option and write your own configuration file, you must + * include mbedtls/config_psa.h in your configuration file. The default + * provided mbedtls/config.h contains the necessary inclusion. + * + * This feature is still experimental and is not ready for production since + * it is not completed. + */ +//#define MBEDTLS_PSA_CRYPTO_CONFIG + +/** + * \def MBEDTLS_VERSION_FEATURES + * + * Allow run-time checking of compile-time enabled features. Thus allowing users + * to check at run-time if the library is for instance compiled with threading + * support via mbedtls_version_check_feature(). + * + * Requires: MBEDTLS_VERSION_C + * + * Comment this to disable run-time checking and save ROM space + */ +#define MBEDTLS_VERSION_FEATURES + +/** + * \def MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3 + * + * If set, the X509 parser will not break-off when parsing an X509 certificate + * and encountering an extension in a v1 or v2 certificate. + * + * Uncomment to prevent an error. + */ +//#define MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3 + +/** + * \def MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION + * + * If set, the X509 parser will not break-off when parsing an X509 certificate + * and encountering an unknown critical extension. + * + * \warning Depending on your PKI use, enabling this can be a security risk! + * + * Uncomment to prevent an error. + */ +//#define MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION + +/** + * \def MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK + * + * If set, this enables the X.509 API `mbedtls_x509_crt_verify_with_ca_cb()` + * and the SSL API `mbedtls_ssl_conf_ca_cb()` which allow users to configure + * the set of trusted certificates through a callback instead of a linked + * list. + * + * This is useful for example in environments where a large number of trusted + * certificates is present and storing them in a linked list isn't efficient + * enough, or when the set of trusted certificates changes frequently. + * + * See the documentation of `mbedtls_x509_crt_verify_with_ca_cb()` and + * `mbedtls_ssl_conf_ca_cb()` for more information. + * + * Uncomment to enable trusted certificate callbacks. + */ +//#define MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK + +/** + * \def MBEDTLS_X509_CHECK_KEY_USAGE + * + * Enable verification of the keyUsage extension (CA and leaf certificates). + * + * Disabling this avoids problems with mis-issued and/or misused + * (intermediate) CA and leaf certificates. + * + * \warning Depending on your PKI use, disabling this can be a security risk! + * + * Comment to skip keyUsage checking for both CA and leaf certificates. + */ +#define MBEDTLS_X509_CHECK_KEY_USAGE + +/** + * \def MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE + * + * Enable verification of the extendedKeyUsage extension (leaf certificates). + * + * Disabling this avoids problems with mis-issued and/or misused certificates. + * + * \warning Depending on your PKI use, disabling this can be a security risk! + * + * Comment to skip extendedKeyUsage checking for certificates. + */ +#define MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE + +/** + * \def MBEDTLS_X509_RSASSA_PSS_SUPPORT + * + * Enable parsing and verification of X.509 certificates, CRLs and CSRS + * signed with RSASSA-PSS (aka PKCS#1 v2.1). + * + * Comment this macro to disallow using RSASSA-PSS in certificates. + */ +#define MBEDTLS_X509_RSASSA_PSS_SUPPORT + +/** + * \def MBEDTLS_ZLIB_SUPPORT + * + * If set, the SSL/TLS module uses ZLIB to support compression and + * decompression of packet data. + * + * \warning TLS-level compression MAY REDUCE SECURITY! See for example the + * CRIME attack. Before enabling this option, you should examine with care if + * CRIME or similar exploits may be applicable to your use case. + * + * \note Currently compression can't be used with DTLS. + * + * \deprecated This feature is deprecated and will be removed + * in the next major revision of the library. + * + * Used in: library/ssl_tls.c + * library/ssl_cli.c + * library/ssl_srv.c + * + * This feature requires zlib library and headers to be present. + * + * Uncomment to enable use of ZLIB + */ +//#define MBEDTLS_ZLIB_SUPPORT +/* \} name SECTION: mbed TLS feature support */ + +/** + * \name SECTION: mbed TLS modules + * + * This section enables or disables entire modules in mbed TLS + * \{ + */ + +/** + * \def MBEDTLS_AESNI_C + * + * Enable AES-NI support on x86-64. + * + * Module: library/aesni.c + * Caller: library/aes.c + * + * Requires: MBEDTLS_HAVE_ASM + * + * This modules adds support for the AES-NI instructions on x86-64 + */ +#define MBEDTLS_AESNI_C + +/** + * \def MBEDTLS_AES_C + * + * Enable the AES block cipher. + * + * Module: library/aes.c + * Caller: library/cipher.c + * library/pem.c + * library/ctr_drbg.c + * + * This module enables the following ciphersuites (if other requisites are + * enabled as well): + * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_DHE_PSK_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_DHE_PSK_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_DHE_PSK_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_DHE_PSK_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_DHE_PSK_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_DHE_PSK_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_RSA_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_RSA_WITH_AES_256_CBC_SHA256 + * MBEDTLS_TLS_RSA_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_RSA_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_RSA_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_RSA_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_RSA_PSK_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_RSA_PSK_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_RSA_PSK_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_RSA_PSK_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_RSA_PSK_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_RSA_PSK_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_PSK_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_PSK_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_PSK_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_PSK_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_PSK_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_PSK_WITH_AES_128_CBC_SHA + * + * PEM_PARSE uses AES for decrypting encrypted keys. + */ +#define MBEDTLS_AES_C + +/** + * \def MBEDTLS_ASN1_PARSE_C + * + * Enable the generic ASN1 parser. + * + * Module: library/asn1.c + * Caller: library/x509.c + * library/dhm.c + * library/pkcs12.c + * library/pkcs5.c + * library/pkparse.c + */ +#define MBEDTLS_ASN1_PARSE_C + +/** + * \def MBEDTLS_ASN1_WRITE_C + * + * Enable the generic ASN1 writer. + * + * Module: library/asn1write.c + * Caller: library/ecdsa.c + * library/pkwrite.c + * library/x509_create.c + * library/x509write_crt.c + * library/x509write_csr.c + */ +#define MBEDTLS_ASN1_WRITE_C + +/** + * \def MBEDTLS_BASE64_C + * + * Enable the Base64 module. + * + * Module: library/base64.c + * Caller: library/pem.c + * + * This module is required for PEM support (required by X.509). + */ +#define MBEDTLS_BASE64_C + +/** + * \def MBEDTLS_BIGNUM_C + * + * Enable the multi-precision integer library. + * + * Module: library/bignum.c + * Caller: library/dhm.c + * library/ecp.c + * library/ecdsa.c + * library/rsa.c + * library/rsa_internal.c + * library/ssl_tls.c + * + * This module is required for RSA, DHM and ECC (ECDH, ECDSA) support. + */ +#define MBEDTLS_BIGNUM_C + +/** + * \def MBEDTLS_BLOWFISH_C + * + * Enable the Blowfish block cipher. + * + * Module: library/blowfish.c + */ +#define MBEDTLS_BLOWFISH_C + +/** + * \def MBEDTLS_CAMELLIA_C + * + * Enable the Camellia block cipher. + * + * Module: library/camellia.c + * Caller: library/cipher.c + * + * This module enables the following ciphersuites (if other requisites are + * enabled as well): + * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 + * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA + * MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256 + * MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA + * MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA + * MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_PSK_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256 + */ +//#define MBEDTLS_CAMELLIA_C + +/** + * \def MBEDTLS_ARIA_C + * + * Enable the ARIA block cipher. + * + * Module: library/aria.c + * Caller: library/cipher.c + * + * This module enables the following ciphersuites (if other requisites are + * enabled as well): + * + * MBEDTLS_TLS_RSA_WITH_ARIA_128_CBC_SHA256 + * MBEDTLS_TLS_RSA_WITH_ARIA_256_CBC_SHA384 + * MBEDTLS_TLS_DHE_RSA_WITH_ARIA_128_CBC_SHA256 + * MBEDTLS_TLS_DHE_RSA_WITH_ARIA_256_CBC_SHA384 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_ARIA_128_CBC_SHA256 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_ARIA_256_CBC_SHA384 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_ARIA_128_CBC_SHA256 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_ARIA_256_CBC_SHA384 + * MBEDTLS_TLS_ECDHE_RSA_WITH_ARIA_128_CBC_SHA256 + * MBEDTLS_TLS_ECDHE_RSA_WITH_ARIA_256_CBC_SHA384 + * MBEDTLS_TLS_ECDH_RSA_WITH_ARIA_128_CBC_SHA256 + * MBEDTLS_TLS_ECDH_RSA_WITH_ARIA_256_CBC_SHA384 + * MBEDTLS_TLS_RSA_WITH_ARIA_128_GCM_SHA256 + * MBEDTLS_TLS_RSA_WITH_ARIA_256_GCM_SHA384 + * MBEDTLS_TLS_DHE_RSA_WITH_ARIA_128_GCM_SHA256 + * MBEDTLS_TLS_DHE_RSA_WITH_ARIA_256_GCM_SHA384 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384 + * MBEDTLS_TLS_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256 + * MBEDTLS_TLS_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384 + * MBEDTLS_TLS_ECDH_RSA_WITH_ARIA_128_GCM_SHA256 + * MBEDTLS_TLS_ECDH_RSA_WITH_ARIA_256_GCM_SHA384 + * MBEDTLS_TLS_PSK_WITH_ARIA_128_CBC_SHA256 + * MBEDTLS_TLS_PSK_WITH_ARIA_256_CBC_SHA384 + * MBEDTLS_TLS_DHE_PSK_WITH_ARIA_128_CBC_SHA256 + * MBEDTLS_TLS_DHE_PSK_WITH_ARIA_256_CBC_SHA384 + * MBEDTLS_TLS_RSA_PSK_WITH_ARIA_128_CBC_SHA256 + * MBEDTLS_TLS_RSA_PSK_WITH_ARIA_256_CBC_SHA384 + * MBEDTLS_TLS_PSK_WITH_ARIA_128_GCM_SHA256 + * MBEDTLS_TLS_PSK_WITH_ARIA_256_GCM_SHA384 + * MBEDTLS_TLS_DHE_PSK_WITH_ARIA_128_GCM_SHA256 + * MBEDTLS_TLS_DHE_PSK_WITH_ARIA_256_GCM_SHA384 + * MBEDTLS_TLS_RSA_PSK_WITH_ARIA_128_GCM_SHA256 + * MBEDTLS_TLS_RSA_PSK_WITH_ARIA_256_GCM_SHA384 + * MBEDTLS_TLS_ECDHE_PSK_WITH_ARIA_128_CBC_SHA256 + * MBEDTLS_TLS_ECDHE_PSK_WITH_ARIA_256_CBC_SHA384 + */ +//#define MBEDTLS_ARIA_C + +/** + * \def MBEDTLS_CCM_C + * + * Enable the Counter with CBC-MAC (CCM) mode for 128-bit block cipher. + * + * Module: library/ccm.c + * + * Requires: MBEDTLS_AES_C or MBEDTLS_CAMELLIA_C + * + * This module enables the AES-CCM ciphersuites, if other requisites are + * enabled as well. + */ +#define MBEDTLS_CCM_C + +/** + * \def MBEDTLS_CERTS_C + * + * Enable the test certificates. + * + * Module: library/certs.c + * Caller: + * + * This module is used for testing (ssl_client/server). + */ +#define MBEDTLS_CERTS_C + +/** + * \def MBEDTLS_CHACHA20_C + * + * Enable the ChaCha20 stream cipher. + * + * Module: library/chacha20.c + */ +//#define MBEDTLS_CHACHA20_C + +/** + * \def MBEDTLS_CHACHAPOLY_C + * + * Enable the ChaCha20-Poly1305 AEAD algorithm. + * + * Module: library/chachapoly.c + * + * This module requires: MBEDTLS_CHACHA20_C, MBEDTLS_POLY1305_C + */ +//#define MBEDTLS_CHACHAPOLY_C + +/** + * \def MBEDTLS_CIPHER_C + * + * Enable the generic cipher layer. + * + * Module: library/cipher.c + * Caller: library/ssl_tls.c + * + * Uncomment to enable generic cipher wrappers. + */ +#define MBEDTLS_CIPHER_C + +/** + * \def MBEDTLS_CMAC_C + * + * Enable the CMAC (Cipher-based Message Authentication Code) mode for block + * ciphers. + * + * Module: library/cmac.c + * + * Requires: MBEDTLS_AES_C or MBEDTLS_DES_C + * + */ +#define MBEDTLS_CMAC_C + +/** + * \def MBEDTLS_CTR_DRBG_C + * + * Enable the CTR_DRBG AES-based random generator. + * The CTR_DRBG generator uses AES-256 by default. + * To use AES-128 instead, enable \c MBEDTLS_CTR_DRBG_USE_128_BIT_KEY above. + * + * \note To achieve a 256-bit security strength with CTR_DRBG, + * you must use AES-256 *and* use sufficient entropy. + * See ctr_drbg.h for more details. + * + * Module: library/ctr_drbg.c + * Caller: + * + * Requires: MBEDTLS_AES_C + * + * This module provides the CTR_DRBG AES random number generator. + */ +#define MBEDTLS_CTR_DRBG_C + +/** + * \def MBEDTLS_DEBUG_C + * + * Enable the debug functions. + * + * Module: library/debug.c + * Caller: library/ssl_cli.c + * library/ssl_srv.c + * library/ssl_tls.c + * + * This module provides debugging functions. + */ +//#define MBEDTLS_DEBUG_C + +/** + * \def MBEDTLS_DES_C + * + * Enable the DES block cipher. + * + * Module: library/des.c + * Caller: library/pem.c + * library/cipher.c + * + * This module enables the following ciphersuites (if other requisites are + * enabled as well): + * MBEDTLS_TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA + * MBEDTLS_TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA + * MBEDTLS_TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA + * MBEDTLS_TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA + * MBEDTLS_TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA + * MBEDTLS_TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA + * MBEDTLS_TLS_RSA_WITH_3DES_EDE_CBC_SHA + * MBEDTLS_TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA + * MBEDTLS_TLS_PSK_WITH_3DES_EDE_CBC_SHA + * + * PEM_PARSE uses DES/3DES for decrypting encrypted keys. + * + * \warning DES is considered a weak cipher and its use constitutes a + * security risk. We recommend considering stronger ciphers instead. + */ +#define MBEDTLS_DES_C + +/** + * \def MBEDTLS_DHM_C + * + * Enable the Diffie-Hellman-Merkle module. + * + * Module: library/dhm.c + * Caller: library/ssl_cli.c + * library/ssl_srv.c + * + * This module is used by the following key exchanges: + * DHE-RSA, DHE-PSK + * + * \warning Using DHE constitutes a security risk as it + * is not possible to validate custom DH parameters. + * If possible, it is recommended users should consider + * preferring other methods of key exchange. + * See dhm.h for more details. + * + */ +#define MBEDTLS_DHM_C + +/** + * \def MBEDTLS_ECDH_C + * + * Enable the elliptic curve Diffie-Hellman library. + * + * Module: library/ecdh.c + * Caller: library/ssl_cli.c + * library/ssl_srv.c + * + * This module is used by the following key exchanges: + * ECDHE-ECDSA, ECDHE-RSA, DHE-PSK + * + * Requires: MBEDTLS_ECP_C + */ +#define MBEDTLS_ECDH_C + +/** + * \def MBEDTLS_ECDSA_C + * + * Enable the elliptic curve DSA library. + * + * Module: library/ecdsa.c + * Caller: + * + * This module is used by the following key exchanges: + * ECDHE-ECDSA + * + * Requires: MBEDTLS_ECP_C, MBEDTLS_ASN1_WRITE_C, MBEDTLS_ASN1_PARSE_C, + * and at least one MBEDTLS_ECP_DP_XXX_ENABLED for a + * short Weierstrass curve. + */ +#define MBEDTLS_ECDSA_C + +/** + * \def MBEDTLS_ECJPAKE_C + * + * Enable the elliptic curve J-PAKE library. + * + * \warning This is currently experimental. EC J-PAKE support is based on the + * Thread v1.0.0 specification; incompatible changes to the specification + * might still happen. For this reason, this is disabled by default. + * + * Module: library/ecjpake.c + * Caller: + * + * This module is used by the following key exchanges: + * ECJPAKE + * + * Requires: MBEDTLS_ECP_C, MBEDTLS_MD_C + */ +//#define MBEDTLS_ECJPAKE_C + +/** + * \def MBEDTLS_ECP_C + * + * Enable the elliptic curve over GF(p) library. + * + * Module: library/ecp.c + * Caller: library/ecdh.c + * library/ecdsa.c + * library/ecjpake.c + * + * Requires: MBEDTLS_BIGNUM_C and at least one MBEDTLS_ECP_DP_XXX_ENABLED + */ +#define MBEDTLS_ECP_C + +/** + * \def MBEDTLS_ENTROPY_C + * + * Enable the platform-specific entropy code. + * + * Module: library/entropy.c + * Caller: + * + * Requires: MBEDTLS_SHA512_C or MBEDTLS_SHA256_C + * + * This module provides a generic entropy pool + */ +#define MBEDTLS_ENTROPY_C + +/** + * \def MBEDTLS_ERROR_C + * + * Enable error code to error string conversion. + * + * Module: library/error.c + * Caller: + * + * This module enables mbedtls_strerror(). + */ +#define MBEDTLS_ERROR_C + +/** + * \def MBEDTLS_GCM_C + * + * Enable the Galois/Counter Mode (GCM). + * + * Module: library/gcm.c + * + * Requires: MBEDTLS_AES_C or MBEDTLS_CAMELLIA_C or MBEDTLS_ARIA_C + * + * This module enables the AES-GCM and CAMELLIA-GCM ciphersuites, if other + * requisites are enabled as well. + */ +#define MBEDTLS_GCM_C + +/** + * \def MBEDTLS_HAVEGE_C + * + * Enable the HAVEGE random generator. + * + * Warning: the HAVEGE random generator is not suitable for virtualized + * environments + * + * Warning: the HAVEGE random generator is dependent on timing and specific + * processor traits. It is therefore not advised to use HAVEGE as + * your applications primary random generator or primary entropy pool + * input. As a secondary input to your entropy pool, it IS able add + * the (limited) extra entropy it provides. + * + * Module: library/havege.c + * Caller: + * + * Requires: MBEDTLS_TIMING_C + * + * Uncomment to enable the HAVEGE random generator. + */ +//#define MBEDTLS_HAVEGE_C + +/** + * \def MBEDTLS_HKDF_C + * + * Enable the HKDF algorithm (RFC 5869). + * + * Module: library/hkdf.c + * Caller: + * + * Requires: MBEDTLS_MD_C + * + * This module adds support for the Hashed Message Authentication Code + * (HMAC)-based key derivation function (HKDF). + */ +#define MBEDTLS_HKDF_C + +/** + * \def MBEDTLS_HMAC_DRBG_C + * + * Enable the HMAC_DRBG random generator. + * + * Module: library/hmac_drbg.c + * Caller: + * + * Requires: MBEDTLS_MD_C + * + * Uncomment to enable the HMAC_DRBG random number geerator. + */ +#define MBEDTLS_HMAC_DRBG_C + +#ifndef CONFIG_BUILD_WITH_TFM +/** + * \def MBEDTLS_NIST_KW_C + * + * Enable the Key Wrapping mode for 128-bit block ciphers, + * as defined in NIST SP 800-38F. Only KW and KWP modes + * are supported. At the moment, only AES is approved by NIST. + * + * Module: library/nist_kw.c + * + * Requires: MBEDTLS_AES_C and MBEDTLS_CIPHER_C + */ +#define MBEDTLS_NIST_KW_C +#endif + +/** + * \def MBEDTLS_MD_C + * + * Enable the generic message digest layer. + * + * Module: library/md.c + * Caller: + * + * Uncomment to enable generic message digest wrappers. + */ +#define MBEDTLS_MD_C + +/** + * \def MBEDTLS_MD2_C + * + * Enable the MD2 hash algorithm. + * + * Module: library/md2.c + * Caller: + * + * Uncomment to enable support for (rare) MD2-signed X.509 certs. + * + * \warning MD2 is considered a weak message digest and its use constitutes a + * security risk. If possible, we recommend avoiding dependencies on + * it, and considering stronger message digests instead. + * + */ +//#define MBEDTLS_MD2_C + +/** + * \def MBEDTLS_MD5_C + * + * Enable the MD5 hash algorithm. + * + * Module: library/md5.c + * Caller: library/md.c + * library/pem.c + * library/ssl_tls.c + * + * This module is required for SSL/TLS up to version 1.1, and for TLS 1.2 + * depending on the handshake parameters. Further, it is used for checking + * MD5-signed certificates, and for PBKDF1 when decrypting PEM-encoded + * encrypted keys. + * + * \warning MD5 is considered a weak message digest and its use constitutes a + * security risk. If possible, we recommend avoiding dependencies on + * it, and considering stronger message digests instead. + * + */ +#define MBEDTLS_MD5_C + +/** + * \def MBEDTLS_MEMORY_BUFFER_ALLOC_C + * + * Enable the buffer allocator implementation that makes use of a (stack) + * based buffer to 'allocate' dynamic memory. (replaces calloc() and free() + * calls) + * + * Module: library/memory_buffer_alloc.c + * + * Requires: MBEDTLS_PLATFORM_C + * MBEDTLS_PLATFORM_MEMORY (to use it within mbed TLS) + * + * Enable this module to enable the buffer memory allocator. + */ +//#define MBEDTLS_MEMORY_BUFFER_ALLOC_C + +/** + * \def MBEDTLS_NET_C + * + * Enable the TCP and UDP over IPv6/IPv4 networking routines. + * + * \note This module only works on POSIX/Unix (including Linux, BSD and OS X) + * and Windows. For other platforms, you'll want to disable it, and write your + * own networking callbacks to be passed to \c mbedtls_ssl_set_bio(). + * + * \note See also our Knowledge Base article about porting to a new + * environment: + * https://tls.mbed.org/kb/how-to/how-do-i-port-mbed-tls-to-a-new-environment-OS + * + * Module: library/net_sockets.c + * + * This module provides networking routines. + */ +//#define MBEDTLS_NET_C + +/** + * \def MBEDTLS_OID_C + * + * Enable the OID database. + * + * Module: library/oid.c + * Caller: library/asn1write.c + * library/pkcs5.c + * library/pkparse.c + * library/pkwrite.c + * library/rsa.c + * library/x509.c + * library/x509_create.c + * library/x509_crl.c + * library/x509_crt.c + * library/x509_csr.c + * library/x509write_crt.c + * library/x509write_csr.c + * + * This modules translates between OIDs and internal values. + */ +#define MBEDTLS_OID_C + +/** + * \def MBEDTLS_PADLOCK_C + * + * Enable VIA Padlock support on x86. + * + * Module: library/padlock.c + * Caller: library/aes.c + * + * Requires: MBEDTLS_HAVE_ASM + * + * This modules adds support for the VIA PadLock on x86. + */ +#define MBEDTLS_PADLOCK_C + +/** + * \def MBEDTLS_PEM_PARSE_C + * + * Enable PEM decoding / parsing. + * + * Module: library/pem.c + * Caller: library/dhm.c + * library/pkparse.c + * library/x509_crl.c + * library/x509_crt.c + * library/x509_csr.c + * + * Requires: MBEDTLS_BASE64_C + * + * This modules adds support for decoding / parsing PEM files. + */ +#define MBEDTLS_PEM_PARSE_C + +/** + * \def MBEDTLS_PEM_WRITE_C + * + * Enable PEM encoding / writing. + * + * Module: library/pem.c + * Caller: library/pkwrite.c + * library/x509write_crt.c + * library/x509write_csr.c + * + * Requires: MBEDTLS_BASE64_C + * + * This modules adds support for encoding / writing PEM files. + */ +#define MBEDTLS_PEM_WRITE_C + +/** + * \def MBEDTLS_PK_C + * + * Enable the generic public (asymetric) key layer. + * + * Module: library/pk.c + * Caller: library/ssl_tls.c + * library/ssl_cli.c + * library/ssl_srv.c + * + * Requires: MBEDTLS_RSA_C or MBEDTLS_ECP_C + * + * Uncomment to enable generic public key wrappers. + */ +#define MBEDTLS_PK_C + +/** + * \def MBEDTLS_PK_PARSE_C + * + * Enable the generic public (asymetric) key parser. + * + * Module: library/pkparse.c + * Caller: library/x509_crt.c + * library/x509_csr.c + * + * Requires: MBEDTLS_PK_C + * + * Uncomment to enable generic public key parse functions. + */ +#define MBEDTLS_PK_PARSE_C + +/** + * \def MBEDTLS_PK_WRITE_C + * + * Enable the generic public (asymetric) key writer. + * + * Module: library/pkwrite.c + * Caller: library/x509write.c + * + * Requires: MBEDTLS_PK_C + * + * Uncomment to enable generic public key write functions. + */ +#define MBEDTLS_PK_WRITE_C + +/** + * \def MBEDTLS_PKCS5_C + * + * Enable PKCS#5 functions. + * + * Module: library/pkcs5.c + * + * Requires: MBEDTLS_MD_C + * + * This module adds support for the PKCS#5 functions. + */ +#define MBEDTLS_PKCS5_C + +/** + * \def MBEDTLS_PKCS11_C + * + * Enable wrapper for PKCS#11 smartcard support via the pkcs11-helper library. + * + * \deprecated This option is deprecated and will be removed in a future + * version of Mbed TLS. + * + * Module: library/pkcs11.c + * Caller: library/pk.c + * + * Requires: MBEDTLS_PK_C + * + * This module enables SSL/TLS PKCS #11 smartcard support. + * Requires the presence of the PKCS#11 helper library (libpkcs11-helper) + */ +//#define MBEDTLS_PKCS11_C + +/** + * \def MBEDTLS_PKCS12_C + * + * Enable PKCS#12 PBE functions. + * Adds algorithms for parsing PKCS#8 encrypted private keys + * + * Module: library/pkcs12.c + * Caller: library/pkparse.c + * + * Requires: MBEDTLS_ASN1_PARSE_C, MBEDTLS_CIPHER_C, MBEDTLS_MD_C + * Can use: MBEDTLS_ARC4_C + * + * This module enables PKCS#12 functions. + */ +#define MBEDTLS_PKCS12_C + +/** + * \def MBEDTLS_PLATFORM_C + * + * Enable the platform abstraction layer that allows you to re-assign + * functions like calloc(), free(), snprintf(), printf(), fprintf(), exit(). + * + * Enabling MBEDTLS_PLATFORM_C enables to use of MBEDTLS_PLATFORM_XXX_ALT + * or MBEDTLS_PLATFORM_XXX_MACRO directives, allowing the functions mentioned + * above to be specified at runtime or compile time respectively. + * + * \note This abstraction layer must be enabled on Windows (including MSYS2) + * as other module rely on it for a fixed snprintf implementation. + * + * Module: library/platform.c + * Caller: Most other .c files + * + * This module enables abstraction of common (libc) functions. + */ +#define MBEDTLS_PLATFORM_C + +/** + * \def MBEDTLS_POLY1305_C + * + * Enable the Poly1305 MAC algorithm. + * + * Module: library/poly1305.c + * Caller: library/chachapoly.c + */ +#define MBEDTLS_POLY1305_C + +/** + * \def MBEDTLS_PSA_CRYPTO_C + * + * Enable the Platform Security Architecture cryptography API. + * + * \warning The PSA Crypto API is still beta status. While you're welcome to + * experiment using it, incompatible API changes are still possible, and some + * parts may not have reached the same quality as the rest of Mbed TLS yet. + * + * Module: library/psa_crypto.c + * + * Requires: MBEDTLS_CTR_DRBG_C, MBEDTLS_ENTROPY_C + * + */ +#define MBEDTLS_PSA_CRYPTO_C + +/** + * \def MBEDTLS_PSA_CRYPTO_SE_C + * + * Enable secure element support in the Platform Security Architecture + * cryptography API. + * + * \warning This feature is not yet suitable for production. It is provided + * for API evaluation and testing purposes only. + * + * Module: library/psa_crypto_se.c + * + * Requires: MBEDTLS_PSA_CRYPTO_C, MBEDTLS_PSA_CRYPTO_STORAGE_C + * + */ +//#define MBEDTLS_PSA_CRYPTO_SE_C + +/** + * \def MBEDTLS_PSA_CRYPTO_STORAGE_C + * + * Enable the Platform Security Architecture persistent key storage. + * + * Module: library/psa_crypto_storage.c + * + * Requires: MBEDTLS_PSA_CRYPTO_C, + * either MBEDTLS_PSA_ITS_FILE_C or a native implementation of + * the PSA ITS interface + */ +//#define MBEDTLS_PSA_CRYPTO_STORAGE_C + +/** + * \def MBEDTLS_PSA_ITS_FILE_C + * + * Enable the emulation of the Platform Security Architecture + * Internal Trusted Storage (PSA ITS) over files. + * + * Module: library/psa_its_file.c + * + * Requires: MBEDTLS_FS_IO + */ +//#define MBEDTLS_PSA_ITS_FILE_C + +/** + * \def MBEDTLS_RIPEMD160_C + * + * Enable the RIPEMD-160 hash algorithm. + * + * Module: library/ripemd160.c + * Caller: library/md.c + * + */ +//#define MBEDTLS_RIPEMD160_C + +/** + * \def MBEDTLS_RSA_C + * + * Enable the RSA public-key cryptosystem. + * + * Module: library/rsa.c + * library/rsa_internal.c + * Caller: library/ssl_cli.c + * library/ssl_srv.c + * library/ssl_tls.c + * library/x509.c + * + * This module is used by the following key exchanges: + * RSA, DHE-RSA, ECDHE-RSA, RSA-PSK + * + * Requires: MBEDTLS_BIGNUM_C, MBEDTLS_OID_C + */ +#define MBEDTLS_RSA_C + +/** + * \def MBEDTLS_SHA1_C + * + * Enable the SHA1 cryptographic hash algorithm. + * + * Module: library/sha1.c + * Caller: library/md.c + * library/ssl_cli.c + * library/ssl_srv.c + * library/ssl_tls.c + * library/x509write_crt.c + * + * This module is required for SSL/TLS up to version 1.1, for TLS 1.2 + * depending on the handshake parameters, and for SHA1-signed certificates. + * + * \warning SHA-1 is considered a weak message digest and its use constitutes + * a security risk. If possible, we recommend avoiding dependencies + * on it, and considering stronger message digests instead. + * + */ +#define MBEDTLS_SHA1_C + +/** + * \def MBEDTLS_SHA224_C + * + * Enable the SHA-224 cryptographic hash algorithm. + * + * Requires: MBEDTLS_SHA256_C. The library does not currently support enabling + * SHA-224 without SHA-256. + * + * Module: library/sha256.c + * Caller: library/md.c + * library/ssl_cookie.c + * + * This module adds support for SHA-224. + */ +#define MBEDTLS_SHA224_C + +/** + * \def MBEDTLS_SHA256_C + * + * Enable the SHA-224 and SHA-256 cryptographic hash algorithms. + * + * Module: library/sha256.c + * Caller: library/entropy.c + * library/md.c + * library/ssl_cli.c + * library/ssl_srv.c + * library/ssl_tls.c + * + * This module adds support for SHA-224 and SHA-256. + * This module is required for the SSL/TLS 1.2 PRF function. + */ +#define MBEDTLS_SHA256_C + +/** + * \def MBEDTLS_SHA384_C + * + * Enable the SHA-384 cryptographic hash algorithm. + * + * Requires: MBEDTLS_SHA512_C + * + * Module: library/sha512.c + * Caller: library/md.c + * library/psa_crypto_hash.c + * library/ssl_tls.c + * library/ssl*_client.c + * library/ssl*_server.c + * + * Comment to disable SHA-384 + */ +#define MBEDTLS_SHA384_C + +/** + * \def MBEDTLS_SHA512_C + * + * Enable the SHA-384 and SHA-512 cryptographic hash algorithms. + * + * Module: library/sha512.c + * Caller: library/entropy.c + * library/md.c + * library/ssl_cli.c + * library/ssl_srv.c + * + * This module adds support for SHA-384 and SHA-512. + */ +#define MBEDTLS_SHA512_C + +/** + * \def MBEDTLS_SSL_CACHE_C + * + * Enable simple SSL cache implementation. + * + * Module: library/ssl_cache.c + * Caller: + * + * Requires: MBEDTLS_SSL_CACHE_C + */ +#define MBEDTLS_SSL_CACHE_C + +/** + * \def MBEDTLS_SSL_COOKIE_C + * + * Enable basic implementation of DTLS cookies for hello verification. + * + * Module: library/ssl_cookie.c + * Caller: + */ +#define MBEDTLS_SSL_COOKIE_C + +/** + * \def MBEDTLS_SSL_TICKET_C + * + * Enable an implementation of TLS server-side callbacks for session tickets. + * + * Module: library/ssl_ticket.c + * Caller: + * + * Requires: MBEDTLS_CIPHER_C + */ +#define MBEDTLS_SSL_TICKET_C + +/** + * \def MBEDTLS_SSL_CLI_C + * + * Enable the SSL/TLS client code. + * + * Module: library/ssl_cli.c + * Caller: + * + * Requires: MBEDTLS_SSL_TLS_C + * + * This module is required for SSL/TLS client support. + */ +#define MBEDTLS_SSL_CLI_C + +/** + * \def MBEDTLS_SSL_SRV_C + * + * Enable the SSL/TLS server code. + * + * Module: library/ssl_srv.c + * Caller: + * + * Requires: MBEDTLS_SSL_TLS_C + * + * This module is required for SSL/TLS server support. + */ +#define MBEDTLS_SSL_SRV_C + +/** + * \def MBEDTLS_SSL_TLS_C + * + * Enable the generic SSL/TLS code. + * + * Module: library/ssl_tls.c + * Caller: library/ssl_cli.c + * library/ssl_srv.c + * + * Requires: MBEDTLS_CIPHER_C, MBEDTLS_MD_C + * and at least one of the MBEDTLS_SSL_PROTO_XXX defines + * + * This module is required for SSL/TLS. + */ +#define MBEDTLS_SSL_TLS_C + +/** + * \def MBEDTLS_TIMING_C + * + * Enable the semi-portable timing interface. + * + * \note The provided implementation only works on POSIX/Unix (including Linux, + * BSD and OS X) and Windows. On other platforms, you can either disable that + * module and provide your own implementations of the callbacks needed by + * \c mbedtls_ssl_set_timer_cb() for DTLS, or leave it enabled and provide + * your own implementation of the whole module by setting + * \c MBEDTLS_TIMING_ALT in the current file. + * + * \note See also our Knowledge Base article about porting to a new + * environment: + * https://tls.mbed.org/kb/how-to/how-do-i-port-mbed-tls-to-a-new-environment-OS + * + * Module: library/timing.c + * Caller: library/havege.c + * + * This module is used by the HAVEGE random number generator. + */ +//#define MBEDTLS_TIMING_C + +/** + * \def MBEDTLS_VERSION_C + * + * Enable run-time version information. + * + * Module: library/version.c + * + * This module provides run-time version information. + */ +#define MBEDTLS_VERSION_C + +/** + * \def MBEDTLS_X509_USE_C + * + * Enable X.509 core for using certificates. + * + * Module: library/x509.c + * Caller: library/x509_crl.c + * library/x509_crt.c + * library/x509_csr.c + * + * Requires: MBEDTLS_ASN1_PARSE_C, MBEDTLS_BIGNUM_C, MBEDTLS_OID_C, + * MBEDTLS_PK_PARSE_C + * + * This module is required for the X.509 parsing modules. + */ +#define MBEDTLS_X509_USE_C + +/** + * \def MBEDTLS_X509_CRT_PARSE_C + * + * Enable X.509 certificate parsing. + * + * Module: library/x509_crt.c + * Caller: library/ssl_cli.c + * library/ssl_srv.c + * library/ssl_tls.c + * + * Requires: MBEDTLS_X509_USE_C + * + * This module is required for X.509 certificate parsing. + */ +#define MBEDTLS_X509_CRT_PARSE_C + +/** + * \def MBEDTLS_X509_CRL_PARSE_C + * + * Enable X.509 CRL parsing. + * + * Module: library/x509_crl.c + * Caller: library/x509_crt.c + * + * Requires: MBEDTLS_X509_USE_C + * + * This module is required for X.509 CRL parsing. + */ +#define MBEDTLS_X509_CRL_PARSE_C + +/** + * \def MBEDTLS_X509_CSR_PARSE_C + * + * Enable X.509 Certificate Signing Request (CSR) parsing. + * + * Module: library/x509_csr.c + * Caller: library/x509_crt_write.c + * + * Requires: MBEDTLS_X509_USE_C + * + * This module is used for reading X.509 certificate request. + */ +#define MBEDTLS_X509_CSR_PARSE_C + +/** + * \def MBEDTLS_X509_CREATE_C + * + * Enable X.509 core for creating certificates. + * + * Module: library/x509_create.c + * + * Requires: MBEDTLS_BIGNUM_C, MBEDTLS_OID_C, MBEDTLS_PK_WRITE_C + * + * This module is the basis for creating X.509 certificates and CSRs. + */ +#define MBEDTLS_X509_CREATE_C + +/** + * \def MBEDTLS_X509_CRT_WRITE_C + * + * Enable creating X.509 certificates. + * + * Module: library/x509_crt_write.c + * + * Requires: MBEDTLS_X509_CREATE_C + * + * This module is required for X.509 certificate creation. + */ +#define MBEDTLS_X509_CRT_WRITE_C + +/** + * \def MBEDTLS_X509_CSR_WRITE_C + * + * Enable creating X.509 Certificate Signing Requests (CSR). + * + * Module: library/x509_csr_write.c + * + * Requires: MBEDTLS_X509_CREATE_C + * + * This module is required for X.509 certificate request writing. + */ +#define MBEDTLS_X509_CSR_WRITE_C + +/** + * \def MBEDTLS_XTEA_C + * + * Enable the XTEA block cipher. + * + * Module: library/xtea.c + * Caller: + */ +//#define MBEDTLS_XTEA_C + +/* \} name SECTION: mbed TLS modules */ + +/** + * \name SECTION: Module configuration options + * + * This section allows for the setting of module specific sizes and + * configuration options. The default values are already present in the + * relevant header files and should suffice for the regular use cases. + * + * Our advice is to enable options and change their values here + * only if you have a good reason and know the consequences. + * + * Please check the respective header file for documentation on these + * parameters (to prevent duplicate documentation). + * \{ + */ + +/* MPI / BIGNUM options */ +//#define MBEDTLS_MPI_WINDOW_SIZE 6 /**< Maximum window size used. */ +//#define MBEDTLS_MPI_MAX_SIZE 1024 /**< Maximum number of bytes for usable MPIs. */ + +/* CTR_DRBG options */ +//#define MBEDTLS_CTR_DRBG_ENTROPY_LEN 48 /**< Amount of entropy used per seed by default (48 with SHA-512, 32 with SHA-256) */ +//#define MBEDTLS_CTR_DRBG_RESEED_INTERVAL 10000 /**< Interval before reseed is performed by default */ +//#define MBEDTLS_CTR_DRBG_MAX_INPUT 256 /**< Maximum number of additional input bytes */ +//#define MBEDTLS_CTR_DRBG_MAX_REQUEST 1024 /**< Maximum number of requested bytes per call */ +//#define MBEDTLS_CTR_DRBG_MAX_SEED_INPUT 384 /**< Maximum size of (re)seed buffer */ + +/* HMAC_DRBG options */ +//#define MBEDTLS_HMAC_DRBG_RESEED_INTERVAL 10000 /**< Interval before reseed is performed by default */ +//#define MBEDTLS_HMAC_DRBG_MAX_INPUT 256 /**< Maximum number of additional input bytes */ +//#define MBEDTLS_HMAC_DRBG_MAX_REQUEST 1024 /**< Maximum number of requested bytes per call */ +//#define MBEDTLS_HMAC_DRBG_MAX_SEED_INPUT 384 /**< Maximum size of (re)seed buffer */ + +/* ECP options */ +//#define MBEDTLS_ECP_MAX_BITS 521 /**< Maximum bit size of groups */ +//#define MBEDTLS_ECP_WINDOW_SIZE 6 /**< Maximum window size used */ +//#define MBEDTLS_ECP_FIXED_POINT_OPTIM 1 /**< Enable fixed-point speed-up */ + +/* Entropy options */ +//#define MBEDTLS_ENTROPY_MAX_SOURCES 20 /**< Maximum number of sources supported */ +//#define MBEDTLS_ENTROPY_MAX_GATHER 128 /**< Maximum amount requested from entropy sources */ +//#define MBEDTLS_ENTROPY_MIN_HARDWARE 32 /**< Default minimum number of bytes required for the hardware entropy source mbedtls_hardware_poll() before entropy is released */ + +/* Memory buffer allocator options */ +//#define MBEDTLS_MEMORY_ALIGN_MULTIPLE 4 /**< Align on multiples of this value */ + +/* Platform options */ +//#define MBEDTLS_PLATFORM_STD_MEM_HDR /**< Header to include if MBEDTLS_PLATFORM_NO_STD_FUNCTIONS is defined. Don't define if no header is needed. */ +//#define MBEDTLS_PLATFORM_STD_CALLOC calloc /**< Default allocator to use, can be undefined */ +//#define MBEDTLS_PLATFORM_STD_FREE free /**< Default free to use, can be undefined */ +//#define MBEDTLS_PLATFORM_STD_EXIT exit /**< Default exit to use, can be undefined */ +//#define MBEDTLS_PLATFORM_STD_TIME time /**< Default time to use, can be undefined. MBEDTLS_HAVE_TIME must be enabled */ +//#define MBEDTLS_PLATFORM_STD_FPRINTF fprintf /**< Default fprintf to use, can be undefined */ +//#define MBEDTLS_PLATFORM_STD_PRINTF printf /**< Default printf to use, can be undefined */ +/* Note: your snprintf must correctly zero-terminate the buffer! */ +//#define MBEDTLS_PLATFORM_STD_SNPRINTF snprintf /**< Default snprintf to use, can be undefined */ +//#define MBEDTLS_PLATFORM_STD_EXIT_SUCCESS 0 /**< Default exit value to use, can be undefined */ +//#define MBEDTLS_PLATFORM_STD_EXIT_FAILURE 1 /**< Default exit value to use, can be undefined */ +//#define MBEDTLS_PLATFORM_STD_NV_SEED_READ mbedtls_platform_std_nv_seed_read /**< Default nv_seed_read function to use, can be undefined */ +//#define MBEDTLS_PLATFORM_STD_NV_SEED_WRITE mbedtls_platform_std_nv_seed_write /**< Default nv_seed_write function to use, can be undefined */ +//#define MBEDTLS_PLATFORM_STD_NV_SEED_FILE "seedfile" /**< Seed file to read/write with default implementation */ + +/* To Use Function Macros MBEDTLS_PLATFORM_C must be enabled */ +/* MBEDTLS_PLATFORM_XXX_MACRO and MBEDTLS_PLATFORM_XXX_ALT cannot both be defined */ +//#define MBEDTLS_PLATFORM_CALLOC_MACRO calloc /**< Default allocator macro to use, can be undefined */ +//#define MBEDTLS_PLATFORM_FREE_MACRO free /**< Default free macro to use, can be undefined */ +//#define MBEDTLS_PLATFORM_EXIT_MACRO exit /**< Default exit macro to use, can be undefined */ +//#define MBEDTLS_PLATFORM_TIME_MACRO time /**< Default time macro to use, can be undefined. MBEDTLS_HAVE_TIME must be enabled */ +//#define MBEDTLS_PLATFORM_TIME_TYPE_MACRO time_t /**< Default time macro to use, can be undefined. MBEDTLS_HAVE_TIME must be enabled */ +//#define MBEDTLS_PLATFORM_FPRINTF_MACRO fprintf /**< Default fprintf macro to use, can be undefined */ +#define MBEDTLS_PLATFORM_PRINTF_MACRO printk /**< Default printf macro to use, can be undefined */ +/* Note: your snprintf must correctly zero-terminate the buffer! */ +//#define MBEDTLS_PLATFORM_SNPRINTF_MACRO snprintf /**< Default snprintf macro to use, can be undefined */ +//#define MBEDTLS_PLATFORM_VSNPRINTF_MACRO vsnprintf /**< Default vsnprintf macro to use, can be undefined */ +//#define MBEDTLS_PLATFORM_NV_SEED_READ_MACRO mbedtls_platform_std_nv_seed_read /**< Default nv_seed_read function to use, can be undefined */ +//#define MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO mbedtls_platform_std_nv_seed_write /**< Default nv_seed_write function to use, can be undefined */ + +/** + * \brief This macro is invoked by the library when an invalid parameter + * is detected that is only checked with #MBEDTLS_CHECK_PARAMS + * (see the documentation of that option for context). + * + * When you leave this undefined here, the library provides + * a default definition. If the macro #MBEDTLS_CHECK_PARAMS_ASSERT + * is defined, the default definition is `assert(cond)`, + * otherwise the default definition calls a function + * mbedtls_param_failed(). This function is declared in + * `platform_util.h` for the benefit of the library, but + * you need to define in your application. + * + * When you define this here, this replaces the default + * definition in platform_util.h (which no longer declares the + * function mbedtls_param_failed()) and it is your responsibility + * to make sure this macro expands to something suitable (in + * particular, that all the necessary declarations are visible + * from within the library - you can ensure that by providing + * them in this file next to the macro definition). + * If you define this macro to call `assert`, also define + * #MBEDTLS_CHECK_PARAMS_ASSERT so that library source files + * include ``. + * + * Note that you may define this macro to expand to nothing, in + * which case you don't have to worry about declarations or + * definitions. However, you will then be notified about invalid + * parameters only in non-void functions, and void function will + * just silently return early on invalid parameters, which + * partially negates the benefits of enabling + * #MBEDTLS_CHECK_PARAMS in the first place, so is discouraged. + * + * \param cond The expression that should evaluate to true, but doesn't. + */ +//#define MBEDTLS_PARAM_FAILED( cond ) assert( cond ) + +/* SSL Cache options */ +//#define MBEDTLS_SSL_CACHE_DEFAULT_TIMEOUT 86400 /**< 1 day */ +//#define MBEDTLS_SSL_CACHE_DEFAULT_MAX_ENTRIES 50 /**< Maximum entries in cache */ + +/* SSL options */ + +/** \def MBEDTLS_SSL_MAX_CONTENT_LEN + * + * Maximum length (in bytes) of incoming and outgoing plaintext fragments. + * + * This determines the size of both the incoming and outgoing TLS I/O buffers + * in such a way that both are capable of holding the specified amount of + * plaintext data, regardless of the protection mechanism used. + * + * To configure incoming and outgoing I/O buffers separately, use + * #MBEDTLS_SSL_IN_CONTENT_LEN and #MBEDTLS_SSL_OUT_CONTENT_LEN, + * which overwrite the value set by this option. + * + * \note When using a value less than the default of 16KB on the client, it is + * recommended to use the Maximum Fragment Length (MFL) extension to + * inform the server about this limitation. On the server, there + * is no supported, standardized way of informing the client about + * restriction on the maximum size of incoming messages, and unless + * the limitation has been communicated by other means, it is recommended + * to only change the outgoing buffer size #MBEDTLS_SSL_OUT_CONTENT_LEN + * while keeping the default value of 16KB for the incoming buffer. + * + * Uncomment to set the maximum plaintext size of both + * incoming and outgoing I/O buffers. + */ +#define MBEDTLS_SSL_MAX_CONTENT_LEN (1024 * 8) + +/** \def MBEDTLS_SSL_IN_CONTENT_LEN + * + * Maximum length (in bytes) of incoming plaintext fragments. + * + * This determines the size of the incoming TLS I/O buffer in such a way + * that it is capable of holding the specified amount of plaintext data, + * regardless of the protection mechanism used. + * + * If this option is undefined, it inherits its value from + * #MBEDTLS_SSL_MAX_CONTENT_LEN. + * + * \note When using a value less than the default of 16KB on the client, it is + * recommended to use the Maximum Fragment Length (MFL) extension to + * inform the server about this limitation. On the server, there + * is no supported, standardized way of informing the client about + * restriction on the maximum size of incoming messages, and unless + * the limitation has been communicated by other means, it is recommended + * to only change the outgoing buffer size #MBEDTLS_SSL_OUT_CONTENT_LEN + * while keeping the default value of 16KB for the incoming buffer. + * + * Uncomment to set the maximum plaintext size of the incoming I/O buffer + * independently of the outgoing I/O buffer. + */ +//#define MBEDTLS_SSL_IN_CONTENT_LEN 16384 + +/** \def MBEDTLS_SSL_CID_IN_LEN_MAX + * + * The maximum length of CIDs used for incoming DTLS messages. + * + */ +//#define MBEDTLS_SSL_CID_IN_LEN_MAX 32 + +/** \def MBEDTLS_SSL_CID_OUT_LEN_MAX + * + * The maximum length of CIDs used for outgoing DTLS messages. + * + */ +//#define MBEDTLS_SSL_CID_OUT_LEN_MAX 32 + +/** \def MBEDTLS_SSL_CID_PADDING_GRANULARITY + * + * This option controls the use of record plaintext padding + * when using the Connection ID extension in DTLS 1.2. + * + * The padding will always be chosen so that the length of the + * padded plaintext is a multiple of the value of this option. + * + * Note: A value of \c 1 means that no padding will be used + * for outgoing records. + * + * Note: On systems lacking division instructions, + * a power of two should be preferred. + * + */ +//#define MBEDTLS_SSL_CID_PADDING_GRANULARITY 16 + +/** \def MBEDTLS_SSL_TLS1_3_PADDING_GRANULARITY + * + * This option controls the use of record plaintext padding + * in TLS 1.3. + * + * The padding will always be chosen so that the length of the + * padded plaintext is a multiple of the value of this option. + * + * Note: A value of \c 1 means that no padding will be used + * for outgoing records. + * + * Note: On systems lacking division instructions, + * a power of two should be preferred. + */ +//#define MBEDTLS_SSL_TLS1_3_PADDING_GRANULARITY 1 + +/** \def MBEDTLS_SSL_OUT_CONTENT_LEN + * + * Maximum length (in bytes) of outgoing plaintext fragments. + * + * This determines the size of the outgoing TLS I/O buffer in such a way + * that it is capable of holding the specified amount of plaintext data, + * regardless of the protection mechanism used. + * + * If this option undefined, it inherits its value from + * #MBEDTLS_SSL_MAX_CONTENT_LEN. + * + * It is possible to save RAM by setting a smaller outward buffer, while keeping + * the default inward 16384 byte buffer to conform to the TLS specification. + * + * The minimum required outward buffer size is determined by the handshake + * protocol's usage. Handshaking will fail if the outward buffer is too small. + * The specific size requirement depends on the configured ciphers and any + * certificate data which is sent during the handshake. + * + * Uncomment to set the maximum plaintext size of the outgoing I/O buffer + * independently of the incoming I/O buffer. + */ +//#define MBEDTLS_SSL_OUT_CONTENT_LEN 16384 + +/** \def MBEDTLS_SSL_DTLS_MAX_BUFFERING + * + * Maximum number of heap-allocated bytes for the purpose of + * DTLS handshake message reassembly and future message buffering. + * + * This should be at least 9/8 * MBEDTLSSL_IN_CONTENT_LEN + * to account for a reassembled handshake message of maximum size, + * together with its reassembly bitmap. + * + * A value of 2 * MBEDTLS_SSL_IN_CONTENT_LEN (32768 by default) + * should be sufficient for all practical situations as it allows + * to reassembly a large handshake message (such as a certificate) + * while buffering multiple smaller handshake messages. + * + */ +//#define MBEDTLS_SSL_DTLS_MAX_BUFFERING 32768 + +//#define MBEDTLS_SSL_DEFAULT_TICKET_LIFETIME 86400 /**< Lifetime of session tickets (if enabled) */ +//#define MBEDTLS_PSK_MAX_LEN 32 /**< Max size of TLS pre-shared keys, in bytes (default 256 bits) */ +//#define MBEDTLS_SSL_COOKIE_TIMEOUT 60 /**< Default expiration delay of DTLS cookies, in seconds if HAVE_TIME, or in number of cookies issued */ + +/** + * Complete list of ciphersuites to use, in order of preference. + * + * \warning No dependency checking is done on that field! This option can only + * be used to restrict the set of available ciphersuites. It is your + * responsibility to make sure the needed modules are active. + * + * Use this to save a few hundred bytes of ROM (default ordering of all + * available ciphersuites) and a few to a few hundred bytes of RAM. + * + * The value below is only an example, not the default. + */ +//#define MBEDTLS_SSL_CIPHERSUITES MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 + +/* X509 options */ +//#define MBEDTLS_X509_MAX_INTERMEDIATE_CA 8 /**< Maximum number of intermediate CAs in a verification chain. */ +//#define MBEDTLS_X509_MAX_FILE_PATH_LEN 512 /**< Maximum length of a path/filename string in bytes including the null terminator character ('\0'). */ + +/** + * Allow SHA-1 in the default TLS configuration for certificate signing. + * Without this build-time option, SHA-1 support must be activated explicitly + * through mbedtls_ssl_conf_cert_profile. Turning on this option is not + * recommended because of it is possible to generate SHA-1 collisions, however + * this may be safe for legacy infrastructure where additional controls apply. + * + * \warning SHA-1 is considered a weak message digest and its use constitutes + * a security risk. If possible, we recommend avoiding dependencies + * on it, and considering stronger message digests instead. + * + */ +//#define MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES + +/** + * Allow SHA-1 in the default TLS configuration for TLS 1.2 handshake + * signature and ciphersuite selection. Without this build-time option, SHA-1 + * support must be activated explicitly through mbedtls_ssl_conf_sig_hashes. + * The use of SHA-1 in TLS <= 1.1 and in HMAC-SHA-1 is always allowed by + * default. At the time of writing, there is no practical attack on the use + * of SHA-1 in handshake signatures, hence this option is turned on by default + * to preserve compatibility with existing peers, but the general + * warning applies nonetheless: + * + * \warning SHA-1 is considered a weak message digest and its use constitutes + * a security risk. If possible, we recommend avoiding dependencies + * on it, and considering stronger message digests instead. + * + */ +#define MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_KEY_EXCHANGE + +/** + * Uncomment the macro to let mbed TLS use your alternate implementation of + * mbedtls_platform_zeroize(). This replaces the default implementation in + * platform_util.c. + * + * mbedtls_platform_zeroize() is a widely used function across the library to + * zero a block of memory. The implementation is expected to be secure in the + * sense that it has been written to prevent the compiler from removing calls + * to mbedtls_platform_zeroize() as part of redundant code elimination + * optimizations. However, it is difficult to guarantee that calls to + * mbedtls_platform_zeroize() will not be optimized by the compiler as older + * versions of the C language standards do not provide a secure implementation + * of memset(). Therefore, MBEDTLS_PLATFORM_ZEROIZE_ALT enables users to + * configure their own implementation of mbedtls_platform_zeroize(), for + * example by using directives specific to their compiler, features from newer + * C standards (e.g using memset_s() in C11) or calling a secure memset() from + * their system (e.g explicit_bzero() in BSD). + */ +//#define MBEDTLS_PLATFORM_ZEROIZE_ALT + +/** + * Uncomment the macro to let Mbed TLS use your alternate implementation of + * mbedtls_platform_gmtime_r(). This replaces the default implementation in + * platform_util.c. + * + * gmtime() is not a thread-safe function as defined in the C standard. The + * library will try to use safer implementations of this function, such as + * gmtime_r() when available. However, if Mbed TLS cannot identify the target + * system, the implementation of mbedtls_platform_gmtime_r() will default to + * using the standard gmtime(). In this case, calls from the library to + * gmtime() will be guarded by the global mutex mbedtls_threading_gmtime_mutex + * if MBEDTLS_THREADING_C is enabled. We recommend that calls from outside the + * library are also guarded with this mutex to avoid race conditions. However, + * if the macro MBEDTLS_PLATFORM_GMTIME_R_ALT is defined, Mbed TLS will + * unconditionally use the implementation for mbedtls_platform_gmtime_r() + * supplied at compile time. + */ +//#define MBEDTLS_PLATFORM_GMTIME_R_ALT + +/** + * Enable the verified implementations of ECDH primitives from Project Everest + * (currently only Curve25519). This feature changes the layout of ECDH + * contexts and therefore is a compatibility break for applications that access + * fields of a mbedtls_ecdh_context structure directly. See also + * MBEDTLS_ECDH_LEGACY_CONTEXT in include/mbedtls/ecdh.h. + */ +//#define MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED + +/** + * \def MBEDTLS_CCM_USE_AES_CBC_MAC + * + * Uncomment this macro in case CCM should be used with AES CBC-MAC calling CSS IP. + * + */ +#define MBEDTLS_CCM_USE_AES_CBC_MAC + +/** + * \def MBEDTLS_CBC_MAC_USE_CMAC + * + * Uncomment this macro in case AES CBC-MAC should be used with CSS CMAC command. + * + */ +//#define MBEDTLS_CBC_MAC_USE_CMAC + +/* Uncomment if you do not want PSA wrapper inside Mbedtls */ +//#undef MBEDTLS_USE_PSA_CRYPTO + +/* \} name SECTION: Customisation configuration options */ + +/* Target and application specific configurations + * + * Allow user to override any previous default. + * + */ + +#define MBEDTLS_ALLOW_PRIVATE_ACCESS + +#ifndef CONFIG_BUILD_WITH_TFM +#define MBEDTLS_CTR_DRBG_ENABLED +#define MBEDTLS_CIPHER_AES_ENABLED +#define MBEDTLS_CIPHER_MODE_CBC_ENABLED +#define MBEDTLS_CIPHER_PADDING_PKCS7 + +#define PSA_CRYPTO_DRIVER_ELS_PKC +//#define PSA_CRYPTO_DRIVER_THREAD_ALT + +//#define MBEDTLS_THREADING_C +//#define MBEDTLS_THREADING_ALT +//#define MBEDTLS_MCUX_ENTROPY +#define MBEDTLS_ENTROPY_HARDWARE_ALT +#undef MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES +#endif /* CONFIG_BUILD_WITH_TFM */ + +/* + * CBC-MAC is not yet supported via the PSA API in Mbed TLS. + */ +//#define PSA_WANT_ALG_CBC_MAC 1 +#define PSA_WANT_ALG_CBC_NO_PADDING 1 +#define PSA_WANT_ALG_CBC_PKCS7 1 +#define PSA_WANT_ALG_CCM 1 +#define PSA_WANT_ALG_CMAC 1 +#define PSA_WANT_ALG_CFB 1 +//#define PSA_WANT_ALG_CHACHA20_POLY1305 1 +#define PSA_WANT_ALG_CTR 1 +#define PSA_WANT_ALG_DETERMINISTIC_ECDSA 1 +#define PSA_WANT_ALG_ECB_NO_PADDING 1 +#define PSA_WANT_ALG_ECDH 1 +#define PSA_WANT_ALG_ECDSA 1 +#define PSA_WANT_ALG_GCM 1 +#define PSA_WANT_ALG_HKDF 1 +#define PSA_WANT_ALG_HMAC 1 +#define PSA_WANT_ALG_MD5 1 +#define PSA_WANT_ALG_OFB 1 +#define PSA_WANT_ALG_PBKDF2_HMAC 1 +//#define PSA_WANT_ALG_RIPEMD160 1 +#define PSA_WANT_ALG_RSA_OAEP 1 +#define PSA_WANT_ALG_RSA_PKCS1V15_CRYPT 1 +#define PSA_WANT_ALG_RSA_PKCS1V15_SIGN 1 +#define PSA_WANT_ALG_RSA_PSS 1 +#define PSA_WANT_ALG_SHA_1 1 +#define PSA_WANT_ALG_SHA_224 1 +#define PSA_WANT_ALG_SHA_256 1 +#define PSA_WANT_ALG_SHA_384 1 +#define PSA_WANT_ALG_SHA_512 1 +//#define PSA_WANT_ALG_STREAM_CIPHER 1 +#define PSA_WANT_ALG_TLS12_PRF 1 +#define PSA_WANT_ALG_TLS12_PSK_TO_MS 1 +//#define PSA_WANT_ALG_XTS 1 +//#define PSA_WANT_ECC_BRAINPOOL_P_R1_256 1 +//#define PSA_WANT_ECC_BRAINPOOL_P_R1_384 1 +//#define PSA_WANT_ECC_BRAINPOOL_P_R1_512 1 +#define PSA_WANT_ECC_MONTGOMERY_255 1 +#define PSA_WANT_ECC_MONTGOMERY_448 1 +//#define PSA_WANT_ECC_SECP_K1_192 1 +/* + * SECP224K1 is buggy via the PSA API in Mbed TLS + * (https://github.com/Mbed-TLS/mbedtls/issues/3541). Thus, do not enable it by + * default. + */ +//#define PSA_WANT_ECC_SECP_K1_224 1 +#define PSA_WANT_ECC_SECP_K1_256 1 +#define PSA_WANT_ECC_SECP_R1_192 1 +#define PSA_WANT_ECC_SECP_R1_224 1 +#define PSA_WANT_ECC_SECP_R1_256 1 +#define PSA_WANT_ECC_SECP_R1_384 1 +#define PSA_WANT_ECC_SECP_R1_521 1 + +#define PSA_WANT_KEY_TYPE_DERIVE 1 +#define PSA_WANT_KEY_TYPE_HMAC 1 +#define PSA_WANT_KEY_TYPE_AES 1 +//#define PSA_WANT_KEY_TYPE_ARIA 1 +//#define PSA_WANT_KEY_TYPE_CAMELLIA 1 +//#define PSA_WANT_KEY_TYPE_CHACHA20 1 +//#define PSA_WANT_KEY_TYPE_DES 1 +#define PSA_WANT_KEY_TYPE_ECC_KEY_PAIR 1 +#define PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY 1 +#define PSA_WANT_KEY_TYPE_RAW_DATA 1 +#define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR 1 +#define PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY 1 + +#define PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_BASIC 1 +#define PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT 1 +#define PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT 1 +#define PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE 1 +#define PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_DERIVE 1 + +#define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC 1 +#define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT 1 +#define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_EXPORT 1 +#define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE 1 + +#endif /* MBEDTLS_USER_CONFIG_H */ diff --git a/mcux/middleware/wifi_nxp/incl/port/net/zephyr/wm_net.h b/mcux/middleware/wifi_nxp/incl/port/net/zephyr/wm_net.h new file mode 100644 index 000000000..b2a1f946c --- /dev/null +++ b/mcux/middleware/wifi_nxp/incl/port/net/zephyr/wm_net.h @@ -0,0 +1,630 @@ +/* + * Copyright 2008-2024 NXP + * + * SPDX-License-Identifier: BSD-3-Clause + */ +/* + * Copyright (c) 2016 Intel Corporation. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/*! \file wm_net.h + * \brief Network Abstraction Layer + * + * This provides the calls related to the network layer. + * + * + */ + +#ifndef _WM_NET_H_ +#define _WM_NET_H_ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#if (CONFIG_POSIX_API) +#include +#include +#include +#include +#else +#include +#endif + +#define NETIF_NAMESIZE 6 +#define NETIF_MAX_HWADDR_LEN 6 + +/* copy zephyr struct net if */ +struct netif +{ + /** The net_if_dev instance the net_if is related to */ + struct net_if_dev *if_dev; +#if (CONFIG_NET_STATISTICS_PER_INTERFACE) + /** Network statistics related to this network interface */ + struct net_stats stats; +#endif /* CONFIG_NET_STATISTICS_PER_INTERFACE */ + + /** Network interface instance configuration */ + struct net_if_config config; + +#if (CONFIG_NET_POWER_MANAGEMENT) + /** Keep track of packets pending in traffic queues. This is + * needed to avoid putting network device driver to sleep if + * there are packets waiting to be sent. + */ + int tx_pending; +#endif + + struct k_mutex lock; + struct k_mutex tx_lock; +}; + +/** + * Helper struct to hold private data used to operate your ethernet interface. + * Keeping the ethernet address of the MAC in this struct is not necessary + * as it is already kept in the struct netif. + * But this is only an example, anyway... + */ +struct ethernetif +{ + struct net_eth_addr ethaddr; + /* Interface to bss type identification that tells the FW wherether + the data is for STA for UAP */ + uint8_t interface; + /* Add whatever per-interface state that is needed here. */ +}; + +struct interface +{ + struct net_if *netif; + uint8_t mac_address[6]; + struct net_addr ipaddr; + struct net_addr nmask; + struct net_addr gw; + struct ethernetif state; +#if (CONFIG_NET_STATISTICS_WIFI) + struct net_stats_wifi stats; +#endif + scan_result_cb_t scan_cb; + uint16_t max_bss_cnt; +}; + +typedef struct interface interface_t; + +#define NET_SUCCESS WM_SUCCESS +#define NET_ERROR (-WM_FAIL) +#define NET_ENOBUFS ENOBUFS + +#define NET_BLOCKING_OFF 1 +#define NET_BLOCKING_ON 0 + +/* Error Codes + * lwIP provides all standard errnos defined in arch.h, hence no need to + * redefine them here. + * */ + +/* To be consistent with naming convention */ +#define net_socket(domain, type, protocol) socket(domain, type, protocol) +#define net_select(nfd, read, write, except, timeout) select(nfd, read, write, except, timeout) +#define net_bind(sock, addr, len) bind(sock, addr, len) +#define net_listen(sock, backlog) listen(sock, backlog) +#define net_close(c) close((c)) +#define net_accept(sock, addr, len) accept(sock, addr, len) +#define net_shutdown(c, b) shutdown(c, b) +#define net_connect(sock, addr, len) connect(sock, addr, len) +#define net_read(sock, data, len) read(sock, data, len) +#define net_write(sock, data, len) write(sock, data, len) + +/* directly map this to the zephyr internal functions */ +#define inet_aton(cp, addr) inet_pton(AF_INET, cp, (char *)addr) + +enum net_address_types +{ + /** static IP address */ + NET_ADDR_TYPE_STATIC = 0, + /** Dynamic IP address*/ + NET_ADDR_TYPE_DHCP = 1, + /** Link level address */ + NET_ADDR_TYPE_LLA = 2, +}; + +/** This data structure represents an IPv4 address */ +struct net_ipv4_config +{ + /** Set to \ref ADDR_TYPE_DHCP to use DHCP to obtain the IP address or + * \ref ADDR_TYPE_STATIC to use a static IP. In case of static IP + * address ip, gw, netmask and dns members must be specified. When + * using DHCP, the ip, gw, netmask and dns are overwritten by the + * values obtained from the DHCP server. They should be zeroed out if + * not used. */ + enum net_address_types addr_type; + /** The system's IP address in network order. */ + unsigned address; + /** The system's default gateway in network order. */ + unsigned gw; + /** The system's subnet mask in network order. */ + unsigned netmask; + /** The system's primary dns server in network order. */ + unsigned dns1; + /** The system's secondary dns server in network order. */ + unsigned dns2; +}; + +#if CONFIG_IPV6 +/** This data structure represents an IPv6 address */ +struct net_ipv6_config +{ + /** The system's IPv6 address in network order. */ + unsigned address[4]; + /** The address type: linklocal, site-local or global. */ + unsigned char addr_type; + /** The state of IPv6 address (Tentative, Preferred, etc). */ + unsigned char addr_state; +}; +#endif + +/** Network IP configuration. + * + * This data structure represents the network IP configuration + * for IPv4 as well as IPv6 addresses + */ +struct net_ip_config +{ +#if CONFIG_IPV6 + /** The network IPv6 address configuration that should be + * associated with this interface. */ + struct net_ipv6_config ipv6[CONFIG_MAX_IPV6_ADDRESSES]; + /** The network IPv6 valid addresses count */ + size_t ipv6_count; +#endif + /** The network IPv4 address configuration that should be + * associated with this interface. */ + struct net_ipv4_config ipv4; +}; + +/** Set hostname for network interface + * + * \param[in] hostname Hostname to be set. + * + * \note NULL is a valid value for hostname. + * + * \return WM_SUCESS + */ +int net_dhcp_hostname_set(char *hostname); + +/** Deactivate the dhcp timer + * + */ +void net_stop_dhcp_timer(void); + +/** Set socket blocking option as on or off + * + * \param[in] sock socket number to be set for blocking option. + * \param[in] state set blocking on or off + * + * \return WM_SUCESS otherwise standard LWIP error codes. + */ +static inline int net_socket_blocking(int sock, int state) +{ + /* TODO: implement */ + return 0; +} + +/** Get error number from provided socket + * + * \param[in] sock socket number to get error number. + * + * \return error number. + */ +static inline int net_get_sock_error(int sock) +{ + int ret = 0; + + return ret; +} + +/** Converts Internet host address from the IPv4 dotted-decimal notation into + * binary form (in network byte order) + * + * \param[in] cp IPv4 host address in dotted-decimal notation. + * + * \return IPv4 address in binary form + */ +static inline uint32_t net_inet_aton(const char *cp) +{ + struct in_addr addr; + addr.s_addr = 0; + + (void)net_addr_pton(AF_INET, cp, &addr); + return addr.s_addr; +} + +/** set MAC hardware address to lwip network interface + * + * \param[in] stamac sta MAC address. + * \param[in] uapmac uap MAC address. + * + */ +void net_wlan_set_mac_address(unsigned char *stamac, unsigned char *uapmac); + +/** Skip a number of bytes at the start of a stack buffer + * + * \param[in] buf input stack buffer. + * \param[in] in_offset offset to skip. + * + * \return the payload pointer after skip a number of bytes + */ +static inline uint8_t *net_stack_buffer_skip(void *buf, uint16_t in_offset) +{ + uint16_t offset_left = in_offset; + struct net_buf *frag = ((struct net_pkt *)buf)->frags; + while (frag && (frag->len <= offset_left)) + { + offset_left = offset_left - frag->len; + frag = frag->frags; + } + return (uint8_t *)(frag->data + offset_left); +} + +/** Free a buffer allocated from stack memory + * + * \param[in] buf stack buffer pointer. + * + */ +static inline void net_stack_buffer_free(void *buf) +{ + net_pkt_unref((struct net_pkt *)buf); +} + +/** Copy (part of) the contents of a packet buffer to an application supplied buffer + * + * \param[in] stack_buffer the stack buffer from which to copy data. + * \param[in] dst the destination buffer. + * \param[in] len length of data to copy. + * \param[in] offset offset into the stack buffer from where to begin copying + * \return copy status based on stack definition. + */ +int net_stack_buffer_copy_partial(void *stack_buffer, void *dst, uint16_t len, uint16_t offset); + +/** Get the data payload inside the stack buffer. + * + * \param[in] buf input stack buffer. + * + * \return the payload pointer of the stack buffer. + */ +static inline void *net_stack_buffer_get_payload(void *buf) +{ + return net_pkt_data((struct net_pkt *)buf); +} + +/** Converts Internet host address in network byte order to a string in IPv4 + * dotted-decimal notation + * + * \param[in] addr IP address in network byte order. + * \param[out] cp buffer in which IPv4 dotted-decimal string is returned. + * + */ +static inline void net_inet_ntoa(unsigned long addr, char *cp) +{ + struct in_addr saddr; + + saddr.s_addr = addr; + net_addr_ntop(AF_INET, &saddr, cp, NET_IPV4_ADDR_LEN); +} + +/** Check whether buffer is IPv4 or IPV6 packet type + * + * \param[in] buffer pointer to buffer where packet to be checked located. + * + * \return true if buffer packet type matches with IPv4 or IPv6, false otherwise. + * + */ +static inline bool net_is_ip_or_ipv6(const uint8_t *buffer) +{ + if (((const struct net_eth_hdr *)(const void *)buffer)->type == htons(ETH_P_IP) || + ((const struct net_eth_hdr *)(const void *)buffer)->type == htons(ETH_P_IPV6)) + { + return true; + } + + return false; +} + +/** Get interface handle from socket descriptor + * + * Given a socket descriptor this API returns which interface it is bound with. + * + * \param[in] sock socket descriptor + * + * \return[out] interface handle + */ +void *net_sock_to_interface(int sock); + +/** Initialize TCP/IP networking stack + * + * \return WM_SUCCESS on success + * \return -WM_FAIL otherwise + */ +int net_wlan_init(void); + +/** DiInitialize TCP/IP networking stack + * + * \return WM_SUCCESS on success + * \return -WM_FAIL otherwise + */ +int net_wlan_deinit(void); + +/** Get STA interface netif structure pointer + * + * \rerurn A pointer to STA interface netif structure + * + */ +struct netif *net_get_sta_interface(void); + +/** Get uAP interface netif structure pointer + * + * \rerurn A pointer to uAP interface netif structure + * + */ +struct netif *net_get_uap_interface(void); + +/** Get interface name for given netif + * + * \param[out] pif_name Buffer to store interface name + * \param[in] iface Interface to get the name + * + * \return WM_SUCCESS on success + * \return -WM_FAIL otherwise + * + */ +int net_get_if_name_netif(char *pif_name, struct netif *iface); + +/** Get client data index for storing private data in * netif. + * + * \return allocated client data index, -1 if error or + * not supported. + */ +int net_alloc_client_data_id(); + +/** Get station interface handle + * + * Some APIs require the interface handle to be passed to them. The handle can + * be retrieved using this API. + * + * \return station interface handle + */ +void *net_get_sta_handle(void); +#define net_get_mlan_handle() net_get_sta_handle() + +/** Get micro-AP interface handle + * + * Some APIs require the interface handle to be passed to them. The handle can + * be retrieved using this API. + * + * \return micro-AP interface handle + */ +void *net_get_uap_handle(void); + +/** Take interface up + * + * Change interface state to up. Use net_get_sta_handle(), + * net_get_uap_handle() to get interface handle. + * + * \param[in] intrfc_handle interface handle + * + * \return void + */ +void net_interface_up(void *intrfc_handle); + +/** Take interface down + * + * Change interface state to down. Use net_get_sta_handle(), + * net_get_uap_handle() to get interface handle. + * + * \param[in] intrfc_handle interface handle + * + * \return void + */ +void net_interface_down(void *intrfc_handle); + +/** Stop DHCP client on given interface + * + * Stop the DHCP client on given interface state. Use net_get_sta_handle(), + * net_get_uap_handle() to get interface handle. + * + * \param[in] intrfc_handle interface handle + * + * \return void + */ +void net_interface_dhcp_stop(void *intrfc_handle); + +/** Cleanup DHCP client on given interface + * + * Cleanup the DHCP client on given interface state. Use net_get_sta_handle(), + * net_get_uap_handle() to get interface handle. + * + * \param[in] intrfc_handle interface handle + * + */ +void net_interface_dhcp_cleanup(void *intrfc_handle); + +/** Configure IP address for interface + * + * \param[in] addr Address that needs to be configured. + * \param[in] intrfc_handle Handle for network interface to be configured. + * + * \return WM_SUCCESS on success or an error code. + */ +int net_configure_address(struct net_ip_config *addr, void *intrfc_handle); + +/** Configure DNS server address + * + * \param[in] ip IP address of the DNS server to set + * \param[in] role Network wireless BSS Role + * + */ +void net_configure_dns(struct net_ip_config *ip, unsigned int role); + +/** Get interface IP Address in \ref net_ip_config + * + * This function will get the IP address of a given interface. Use + * net_get_sta_handle(), net_get_uap_handle() to get + * interface handle. + * + * \param[out] addr \ref net_ip_config + * \param[in] intrfc_handle interface handle + * + * \return WM_SUCCESS on success or error code. + */ +int net_get_if_addr(struct net_ip_config *addr, void *intrfc_handle); + +#if CONFIG_IPV6 +/** Get interface IPv6 Addresses & their states in \ref net_ip_config + * + * This function will get the IPv6 addresses & address states of a given + * interface. Use net_get_sta_handle() to get interface handle. + * + * \param[out] addr \ref net_ip_config + * \param[in] intrfc_handle interface handle + * + * \return WM_SUCCESS on success or error code. + */ +int net_get_if_ipv6_addr(struct net_ip_config *addr, void *intrfc_handle); + +/** Get list of preferred IPv6 Addresses of a given interface + * in \ref net_ip_config + * + * This function will get the list of IPv6 addresses whose address state + * is Preferred. + * Use net_get_sta_handle() to get interface handle. + * + * \param[out] addr \ref net_ip_config + * \param[in] intrfc_handle interface handle + * + * \return Number of IPv6 addresses whose address state is Preferred + */ +int net_get_if_ipv6_pref_addr(struct net_ip_config *addr, void *intrfc_handle); + +/** Get the description of IPv6 address state + * + * This function will get the IPv6 address state description like - + * Invalid, Preferred, Deprecated + * + * \param[in] addr_state Address state + * + * \return IPv6 address state description + */ +char *ipv6_addr_state_to_desc(unsigned char addr_state); + +/** Get the description of IPv6 address + * + * This function will get the IPv6 address type description like - + * Linklocal, Global, Sitelocal, Uniquelocal + * + * \param[in] ipv6_conf Pointer to IPv6 configuration of type \ref net_ipv6_config + * + * \return IPv6 address description + */ +char *ipv6_addr_addr_to_desc(struct net_ipv6_config *ipv6_conf); + +/** Get the description of IPv6 address type + * + * This function will get the IPv6 address type description like - + * Linklocal, Global, Sitelocal, Uniquelocal + * + * \param[in] ipv6_conf Pointer to IPv6 configuration of type \ref net_ipv6_config + * + * \return IPv6 address type description + */ +char *ipv6_addr_type_to_desc(struct net_ipv6_config *ipv6_conf); +#endif /* CONFIG_IPV6 */ + +/** Get interface Name string containing name and number + * + * This function will get the string containing name and number for given interface. + * Use net_get_sta_handle(), net_get_uap_handle() to get + * interface handle. + * + * \param[out] if_name interface name pointer + * \param[in] intrfc_handle interface handle + * + * \return WM_SUCCESS on success or error code. + */ +int net_get_if_name(char *if_name, void *intrfc_handle); + +/** Get interface IP Address + * + * This function will get the IP Address of a given interface. Use + * net_get_sta_handle(), net_get_uap_handle() to get + * interface handle. + * + * \param[out] ip ip address pointer + * \param[in] intrfc_handle interface handle + * + * \return WM_SUCCESS on success or error code. + */ +int net_get_if_ip_addr(uint32_t *ip, void *intrfc_handle); + +/** Get interface IP Subnet-Mask + * + * This function will get the Subnet-Mask of a given interface. Use + * net_get_sta_handle(), net_get_uap_handle() to get + * interface handle. + * + * \param[in] mask Subnet Mask pointer + * \param[in] intrfc_handle interface + * + * \return WM_SUCCESS on success or error code. + */ +int net_get_if_ip_mask(uint32_t *nm, void *intrfc_handle); + +/** Initialize the network stack + * + * This function initializes the network stack. This function is + * called by wlan_start(). + * + * Applications may optionally call this function directly: + * if they wish to use the networking stack (loopback interface) + * without the wlan functionality. + * if they wish to initialize the networking stack even before wlan + * comes up. + * + * \note This function may safely be called multiple times. + */ +void net_ipv4stack_init(void); + +/** Display network statistics + */ +void net_stat(void); + +#if CONFIG_WIFI_NM_WPA_SUPPLICANT +/** Get supplicant ready state + */ +bool get_supp_ready_state(void); +#endif + +#if CONFIG_P2P +int netif_get_bss_type(); +#endif + +#ifdef MGMT_RX +void rx_mgmt_register_callback(int (*rx_mgmt_cb_fn)(const enum wlan_bss_type bss_type, + const wifi_mgmt_frame_t *frame, + const size_t len)); + +void rx_mgmt_deregister_callback(void); +#endif + +int nxp_wifi_internal_tx(const struct device *dev, struct net_pkt *pkt); +void nxp_wifi_internal_register_rx_cb(int (*rx_cb_fn)(struct net_if *iface, struct net_pkt *pkt)); +const struct netif *net_if_get_binding(const char *ifname); +#endif /* _WM_NET_H_ */ diff --git a/mcux/middleware/wifi_nxp/incl/port/net/zephyr/wm_net_decl.h b/mcux/middleware/wifi_nxp/incl/port/net/zephyr/wm_net_decl.h new file mode 100644 index 000000000..32ed20dbc --- /dev/null +++ b/mcux/middleware/wifi_nxp/incl/port/net/zephyr/wm_net_decl.h @@ -0,0 +1,66 @@ +/* + * Copyright 2023-2024 NXP + * + * SPDX-License-Identifier: BSD-3-Clause + * + */ + +/*! \file wm_net_decl.h + * \brief Network Abstraction Declaration Layer + * + * This provides declarations related to the network layer. + * + * + */ + +#ifndef _WM_NET_DECL_H_ +#define _WM_NET_DECL_H_ + +#include +#include +#include +#include +#include +#include + +#define NETIF_NAMESIZE 6 +#define NETIF_MAX_HWADDR_LEN 6 + +/* copy zephyr struct net if */ +struct netif +{ + /** The net_if_dev instance the net_if is related to */ + struct net_if_dev *if_dev; +#if (CONFIG_NET_STATISTICS_PER_INTERFACE) + /** Network statistics related to this network interface */ + struct net_stats stats; +#endif /* CONFIG_NET_STATISTICS_PER_INTERFACE */ + + /** Network interface instance configuration */ + struct net_if_config config; + +#if (CONFIG_NET_POWER_MANAGEMENT) + /** Keep track of packets pending in traffic queues. This is + * needed to avoid putting network device driver to sleep if + * there are packets waiting to be sent. + */ + int tx_pending; +#endif +}; + +/** + * Helper struct to hold private data used to operate your ethernet interface. + * Keeping the ethernet address of the MAC in this struct is not necessary + * as it is already kept in the struct netif. + * But this is only an example, anyway... + */ +struct ethernetif +{ + struct net_eth_addr ethaddr; + /* Interface to bss type identification that tells the FW wherether + the data is for STA for UAP */ + uint8_t interface; + /* Add whatever per-interface state that is needed here. */ +}; + +#endif /* _WM_NET_DECL_H_ */ diff --git a/mcux/middleware/wifi_nxp/incl/port/osa/mem_pool.h b/mcux/middleware/wifi_nxp/incl/port/osa/mem_pool.h new file mode 100644 index 000000000..bbcc90a60 --- /dev/null +++ b/mcux/middleware/wifi_nxp/incl/port/osa/mem_pool.h @@ -0,0 +1,90 @@ +/* + * Copyright 2023-2024 NXP + * + * SPDX-License-Identifier: BSD-3-Clause + * + */ + +#ifndef MEM_POOL_H_ +#define MEM_POOL_H_ + +#include + +/** + * @brief Amount of memory reserved for overhead + */ +#define POOL_OVERHEAD (sizeof(uint32_t)) + +#include "stack_simple.h" + +/** + * The actual Memory Pool data structure. + * + * This is a variable length data structure. + */ +typedef struct MemPool_t_ +{ + /** + * We need a lock to make this thread safe. + */ + OSA_MUTEX_HANDLE_DEFINE(Lock); + + /** + * Memory blocks are stored on a stack. + */ + Stack_t Stack; + + /** + * Save the item size for additions. + */ + int ItemSize; + + /** + * The overall alignment of an item. + */ + int Alignment; + + /** + * The begining of the actual memory pool itself. + */ + unsigned char Buffer[1]; + +} MemPool_t; + +/** + * Create a MemoryPool + * + * @param ItemSize How big is an allocation. + * @param PreallocatedMemory Pointer to the preallocated memory + * you are dedicating to this pool. + * @param PreallocatedMemorySize How big is the buffer you are + * passing in. + * @param Alignment Power of 2 value denoting on which address boundary the + * memory will be aligned to. Must be at least sizeof(unsigned char *). + * @return A Handle to the pool, or NULL on failure. + */ +MemoryPool_t OSA_MemoryPoolCreate( + MemPool_t *MemPool, int ItemSize, void *PreallocatedMemory, int PreallocatedMemorySize, int Alignment); + +/** + * Get a memory buffer from the pool. + * + * Note that this can block, and cannnot be used from ISR context. + * + * @param pool A handle to a MemoryPool. + * @return A pointer or NULL on failure. + */ +void *OSA_MemoryPoolAllocate(MemoryPool_t pool); + +/** + * Return a memory buffer to the pool. + * + * @note This can block, and cannnot be used from ISR context. + * @note There is no check that the memory passed in is valid. + * + * @param pool A handle to a MemoryPool. + * @param memory memory obtained from OSA_MemoryPoolAllocate(). + */ +void OSA_MemoryPoolFree(MemoryPool_t pool, void *memory); + +#endif diff --git a/mcux/middleware/wifi_nxp/incl/port/osa/mem_pool_config.h b/mcux/middleware/wifi_nxp/incl/port/osa/mem_pool_config.h new file mode 100644 index 000000000..e521ebffa --- /dev/null +++ b/mcux/middleware/wifi_nxp/incl/port/osa/mem_pool_config.h @@ -0,0 +1,46 @@ +/* + * Copyright 2023-2024 NXP + * + * SPDX-License-Identifier: BSD-3-Clause + * + */ + +#ifndef _MEM_POOL_CONFIG_H_ +#define _MEM_POOL_CONFIG_H_ + +#include + +#include +#define mpool_e(...) wmlog_e("mpool", ##__VA_ARGS__) +#define mpool_w(...) wmlog_w("mpool", ##__VA_ARGS__) + +#if CONFIG_MEM_POOL_DEBUG +#define mpool_d(...) wmlog("mpool", ##__VA_ARGS__) +#else +#define mpool_d(...) +#endif /* ! CONFIG_MEM_POOL_DEBUG */ + +/** + * Handle for memory pools. + * + * These are fixed allocation size memory areas. + */ +extern MemoryPool_t pmAdapterMemoryPool; +extern MemoryPool_t pmPrivateMemoryPool; +extern MemoryPool_t buf_32_MemoryPool; +extern MemoryPool_t buf_128_MemoryPool; +extern MemoryPool_t buf_256_MemoryPool; +extern MemoryPool_t buf_512_MemoryPool; +extern MemoryPool_t buf_768_MemoryPool; +extern MemoryPool_t buf_1024_MemoryPool; +extern MemoryPool_t buf_1280_MemoryPool; +extern MemoryPool_t buf_1536_MemoryPool; +extern MemoryPool_t buf_1792_MemoryPool; +extern MemoryPool_t buf_2048_MemoryPool; +extern MemoryPool_t buf_2560_MemoryPool; +extern MemoryPool_t buf_3072_MemoryPool; +extern MemoryPool_t buf_4096_MemoryPool; + +int mem_pool_init(); + +#endif // _MEM_POOL_CONFIG_H_ diff --git a/mcux/middleware/wifi_nxp/incl/port/osa/osa.h b/mcux/middleware/wifi_nxp/incl/port/osa/osa.h new file mode 100644 index 000000000..6adcb2819 --- /dev/null +++ b/mcux/middleware/wifi_nxp/incl/port/osa/osa.h @@ -0,0 +1,363 @@ + +#ifndef _OSA_H_ +#define _OSA_H_ + +#include +#include "fsl_os_abstraction.h" +#include +#include +#include + +/*** Timer Management ***/ +/** Create timer + * + * This function creates a timer. + * + * @param[in] timerHandle Pointer to the timer handle + * @param[in] ticks Period in ticks + * @param[in] call_back Timer expire callback function + * @param[in] cb_arg Timer callback data + * @param[in] reload Reload Options, valid values include \ref KOSA_TimerOnce + * or \ref KOSA_TimerPeriodic. + * @param[in] activate Activate Options, valid values include \ref + * OSA_TIMER_AUTO_ACTIVATE or \ref OSA_TIMER_NO_ACTIVATE + * + * @return KOSA_StatusSuccess if timer created successfully + * @return KOSA_StatusError if timer creation fails + */ +osa_status_t OSA_TimerCreate(osa_timer_handle_t timerHandle, + osa_timer_tick ticks, + void (*call_back)(osa_timer_arg_t), + void *cb_arg, + osa_timer_t reload, + osa_timer_activate_t activate); + +/** Activate timer + * + * This function activates (or starts) a timer that was previously created using + * OSA_TimerCreate(). If the timer had already started and was already in the + * active state, then this call is equivalent to OSA_TimerReset(). + * + * @param[in] timerHandle Pointer to a timer handle + * + * @return KOSA_StatusSuccess if timer activated successfully + * @return KOSA_StatusError if timer activation fails + * + */ +osa_status_t OSA_TimerActivate(osa_timer_handle_t timerHandle); + +/** Change timer period + * + * This function changes the period of a timer that was previously created using + * OSA_TimerCreate(). This function changes the period of an active or dormant + * state timer. + * + * @param[in] timerHandle Pointer to a timer handle + * @param[in] ntime Time in ticks after which the timer will expire + * @param[in] block_time This option is currently not supported + * + * @return KOSA_StatusSuccess if timer change successfully + * @return KOSA_StatusError if timer change fails + */ +osa_status_t OSA_TimerChange(osa_timer_handle_t timerHandle, osa_timer_tick ntime, osa_timer_tick block_time); + +/** Check the timer active state + * + * This function checks if the timer is in the active or dormant state. A timer + * is in the dormant state if (a) it has been created but not started, or (b) it + * has expired and a one-shot timer. + * + * @param [in] timerHandle Pointer to a timer handle + * + * @return true if timer is active + * @return false if time is not active + */ +bool OSA_TimerIsRunning(osa_timer_handle_t timerHandle); + +/** + * Get the timer context + * + * This function helps to retrieve the timer context i.e. 'cb_arg' passed + * to OSA_TimerCreate(). + * + * @param[in] timer_t Pointer to timer handle. The timer handle is received + * in the timer callback. + * + * @return The timer context i.e. the callback argument passed to + * OSA_TimerCreate(). + */ +void *OSA_TimerGetContext(osa_timer_handle_t timerHandle); + +/** Reset timer + * + * This function resets a timer that was previously created using using + * OSA_TimerCreate(). If the timer had already been started and was already in + * the active state, then this call will cause the timer to re-evaluate its + * expiry time so that it is relative to when OSA_TimerReset() was called. If + * the timer was in the dormant state then this call behaves in the same way as + * OSA_TimerActivate(). + * + * @param[in] timerHandle Pointer to a timer handle + * + * @return KOSA_StatusSuccess if timer reset successfully + * @return KOSA_StatusError if timer reset fails + */ +osa_status_t OSA_TimerReset(osa_timer_handle_t timerHandle); + +/** Deactivate timer + * + * This function deactivates (or stops) a timer that was previously started. + * + * @param [in] timerHandle handle populated by OSA_TimerCreate(). + * + * @return KOSA_StatusSuccess if timer deactivate successfully + * @return KOSA_StatusError if timer deactivate fails + */ +osa_status_t OSA_TimerDeactivate(osa_timer_handle_t timerHandle); + +/** Destroy timer + * + * This function deletes a timer. + * + * @param[in] timerHandle Pointer to a timer handle + * + * @return KOSA_StatusSuccess if timer destroy successfully + * @return KOSA_StatusError if timer destroy fails + */ +osa_status_t OSA_TimerDestroy(osa_timer_handle_t timerHandle); + +/* + * Reader Writer Locks + * This is a generic implementation of reader writer locks + * which is reader priority. + * Not only it provides mutual exclusion but also synchronization. + * Six APIs are exposed to user which include. + * -# Create a reader writer lock + * -# Delete a reader writer lock + * -# Reader lock + * -# Reader unlock + * -# Writer lock + * -# Writer unlock + * The locking operation is timeout based. + * Caller can give a timeout from 0 (no wait) to + * infinite (wait forever) + */ + +typedef struct _rw_lock osa_rw_lock_t; +/** This is prototype of reader callback */ +typedef int (*cb_fn)(osa_rw_lock_t *plock, unsigned int wait_time); + +struct _rw_lock +{ + /** Mutex for reader mutual exclusion */ + OSA_MUTEX_HANDLE_DEFINE(reader_mutex); + /** Mutex for write mutual exclusion */ + OSA_MUTEX_HANDLE_DEFINE(write_mutex); + /** Lock which when held by reader, + * writer cannot enter critical section + */ + OSA_SEMAPHORE_HANDLE_DEFINE(rw_lock); + /** Function being called when first reader gets + * the lock + */ + cb_fn reader_cb; + /** Counter to maintain number of readers + * in critical section + */ + unsigned int reader_count; +}; + +int OSA_RWLockCreateWithCB(osa_rw_lock_t *plock, const char *mutex_name, const char *lock_name, cb_fn r_fn); + +/** Create reader-writer lock + * + * This function creates a reader-writer lock. + * + * @param[in] lock Pointer to a reader-writer lock handle + * @param[in] mutex_name Name of the mutex + * @param[in] lock_name Name of the lock + * + * @return WM_SUCCESS on success + * @return -WM_FAIL on error + */ +int OSA_RWLockCreate(osa_rw_lock_t *plock, const char *mutex_name, const char *lock_name); + +/** Delete a reader-write lock + * + * This function deletes a reader-writer lock. + * + * @param[in] lock Pointer to the reader-writer lock handle + * + */ +void OSA_RWLockDestroy(osa_rw_lock_t *lock); + +/** Acquire writer lock + * + * This function acquires a writer lock. While readers can acquire the lock on a + * sharing basis, writers acquire the lock in an exclusive manner. + * + * @param[in] lock Pointer to the reader-writer lock handle + * @param[in] wait_time The maximum amount of time, in OS ticks, the task should + * block waiting for the lock to be acquired. The special values \ref + * osaWaitForever_c and \ref osaWaitNone_c are provided to respectively wait + * infinitely or return immediately. + * + * @return WM_SUCCESS on success + * @return -WM_FAIL on error + * + */ +int OSA_RWLockWriteLock(osa_rw_lock_t *lock, unsigned int wait_time); + +/** Release writer lock + * + * This function releases a writer lock previously acquired using + * OSA_RWLockWriteLock(). + * + * @param[in] lock Pointer to the reader-writer lock handle + */ +void OSA_RWLockWriteUnlock(osa_rw_lock_t *lock); + +/** Acquire reader lock + * + * This function acquires a reader lock. While readers can acquire the lock on a + * sharing basis, writers acquire the lock in an exclusive manner. + * + * @param[in] lock pointer to the reader-writer lock handle + * @param[in] wait_time The maximum amount of time, in OS ticks, the task should + * block waiting for the lock to be acquired. The special values \ref + * osaWaitForever_c and \ref osaWaitNone_c are provided to respectively wait + * infinitely or return immediately. + * + * @return WM_SUCCESS on success + * @return -WM_FAIL on error + * + */ +int OSA_RWLockReadLock(osa_rw_lock_t *lock, unsigned int wait_time); + +/** Release reader lock + * + * This function releases a reader lock previously acquired using + * OSA_RWLockReadLock(). + * + * @param[in] lock pointer to the reader-writer lock handle + * + * @return WM_SUCCESS if unlock operation successful. + * @return -WM_FAIL if unlock operation failed. + */ +int OSA_RWLockReadUnlock(osa_rw_lock_t *lock); + +/*** Tick function */ +#define MAX_CUSTOM_HOOKS 4U + +extern void (*g_osa_tick_hooks[MAX_CUSTOM_HOOKS])(void); +extern void (*g_osa_idle_hooks[MAX_CUSTOM_HOOKS])(void); + +/** Setup idle function + * + * This function sets up a callback function which will be called whenever the + * system enters the idle thread context. + * + * @param[in] func The callback function + * + * @return WM_SUCCESS on success + * @return -WM_FAIL on error + */ +int OSA_SetupIdleFunction(void (*func)(void)); + +/** Setup tick function + * + * This function sets up a callback function which will be called on every + * SysTick interrupt. + * + * @param[in] func The callback function + * + * @return WM_SUCCESS on success + * @return -WM_FAIL on error + */ +int OSA_SetupTickFunction(void (*func)(void)); + +/** Remove idle function + * + * This function removes an idle callback function that was registered + * previously using OSA_SetupIdleFunction(). + * + * @param[in] func The callback function + * + * @return WM_SUCCESS on success + * @return -WM_FAIL on error + */ +int OSA_RemoveIdleFunction(void (*func)(void)); + +/** Remove tick function + * + * This function removes a tick callback function that was registered + * previously using OSA_SetupTickFunction(). + * + * @param[in] func Callback function + * @return WM_SUCCESS on success + * @return -WM_FAIL on error + */ +int OSA_RemoveTickFunction(void (*func)(void)); + +/* Init value for rand generator seed */ +extern uint32_t wm_rand_seed; + +/** This function initialize the seed for rand generator + * @return a uint32_t random numer + */ +static inline void OSA_Srand(uint32_t seed) +{ + wm_rand_seed = seed; +} + +/** This function generate a random number + * @return a uint32_t random numer + */ +static inline uint32_t OSA_Rand() +{ + if (wm_rand_seed == -1) + OSA_Srand(OSA_TimeGetMsec()); + wm_rand_seed = (uint32_t)((((uint64_t)wm_rand_seed * 279470273UL) % 4294967291UL) & 0xFFFFFFFFUL); + return wm_rand_seed; +} + +/** This function generate a random number in a range + * @param [in] low range low + * @param [in] high range high + * @return a uint32_t random numer + */ +static inline uint32_t OSA_RandRange(uint32_t low, uint32_t high) +{ + uint32_t tmp; + if (low == high) + return low; + if (low > high) + { + tmp = low; + low = high; + high = tmp; + } + return (low + OSA_Rand() % (high - low)); +} + +/** Suspend the given thread + * + * - The function OSA_ThreadSelfComplete() will \b permanently suspend the + * given thread. Passing NULL will suspend the current thread. This + * function never returns. + * - The thread continues to consume system resources. To delete the thread + * the function OSA_TaskDestroy() needs to be called separately. + * + * @param[in] taskHandle Pointer to thread handle + */ +void OSA_ThreadSelfComplete(osa_task_handle_t taskHandle); + +/** Return the number of messages stored in queue. + * + * @param[in] msgqHandle Pointer to handle of the queue to be queried. + * + * @returns Number of items in the queue + */ +uint32_t OSA_MsgQWaiting(osa_msgq_handle_t msgqHandle); + +#endif /* ! _OSA_H_ */ diff --git a/mcux/middleware/wifi_nxp/incl/port/osa/slist.h b/mcux/middleware/wifi_nxp/incl/port/osa/slist.h new file mode 100644 index 000000000..f91a182fa --- /dev/null +++ b/mcux/middleware/wifi_nxp/incl/port/osa/slist.h @@ -0,0 +1,181 @@ +/**************************************************************************** + * + * Copyright (c) 2023, Michael Becker (michael.f.becker@gmail.com) + * + * This file is part of the FreeRTOS Add-ons project. + * + * Source Code: + * https://github.com/michaelbecker/freertos-addons + * + * Project Page: + * http://michaelbecker.github.io/freertos-addons/ + * + * On-line Documentation: + * http://michaelbecker.github.io/freertos-addons/docs/html/index.html + * + * MIT License + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files + * (the "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so,subject to the + * following conditions: + * + * + The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + Credit is appreciated, but not required, if you find this project + * useful enough to include in your application, product, device, etc. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + ***************************************************************************/ +/* + * Copyright 2023-2024 NXP + * + * SPDX-License-Identifier: BSD-3-Clause + * + */ + +#ifndef SLIST_H_ +#define SLIST_H_ + +/** + * The singly linked list structure. + * + * This is designed to be embedded within your data + * structure(s). + * + * These lists offer the smallest storage overhead (one pointer per item), + * but many operations may take O(n) time. + */ +typedef struct SlNode_t_ +{ + /** + * A pointer to ourselves. + */ + struct SlNode_t_ *Next; + +} SlNode_t; + +/** + * Macro to initialize a list head. + * + * @param _head A pointer to the list head. + */ +#define SlInitHead(_head) (_head)->Next = NULL; + +/** + * Add a node to the list head. + * Runs in O(1) time. + * + * @param _head A pointer to the existing list head. + * @param _node A pointer to the node you are adding. + */ +#define SlAddNodeToHead(_head, _node) SlInsertNodeAfter(_head, _node) + +/** + * Add a node to the list tail. + * Runs in O(n) time. + * + * @param Head A pointer to the existing list head. + * @param Node A pointer to the node you are adding. + */ +void SlAddNodeToTail(SlNode_t *Head, SlNode_t *Node); + +/** + * Removes the node from the list head. + * Runs in O(1) time. + * + * @param Head A pointer to the existing list head. + * @return The node removed, or NULL for an empty list. + */ +SlNode_t *SlRemoveNodeFromHead(SlNode_t *Head); + +/** + * Removes the node from the list tail. + * Runs in O(n) time. + * + * @param Head A pointer to the existing list head. + * @return The node removed, or NULL for an empty list. + */ +SlNode_t *SlRemoveNodeFromTail(SlNode_t *Head); + +/** + * Check if the list is empty. + * + * @param _head A pointer to the existing list head. + * @return true if the list is empty, false otherwise. + */ +#define SlIsListEmpty(_head) ((_head)->Next == NULL) + +/** + * Inserts a new node into the list right after the marker element. + * Runs in O(1) time. + * + * @param Marker The node you are inserting after. Cannot be NULL. + * @param Node The node you are inserting. Cannot be NULL. + */ +void SlInsertNodeAfter(SlNode_t *Marker, SlNode_t *Node); + +/** + * Inserts a new node into the list right before the marker element. + * Runs in O(n) time. + * + * @param Head Pointer to the list head. + * @param Marker Node you are inserting before. Cannot be NULL. + * @param Node The node you are inserting. Cannot be NULL. + */ +void SlInsertNodeBefore(SlNode_t *Head, SlNode_t *Marker, SlNode_t *Node); + +/** + * Removes a node from the list. + * Runs in O(n) time worst case. + * + * @param Head Pointer to the list head. + * @param Node The node you are removing. + */ +void SlRemoveNode(SlNode_t *Head, SlNode_t *Node); + +/** + * Given here in case you do not have an equivalent macro. + * @param _type The structure type. + * @param _field The name of the field you want the offset to. + * @returns The offset into _type where _field starts, in bytes. + */ +#ifndef OFFSET_OF +#define OFFSET_OF(_type, _field) ((size_t) & ((_type *)0)->_field) +#endif + +/** + * Given here in case you do not have an equivalent macro. + * @param _address The real address of the _field you have. + * @param _type The structure type. + * @param _field The name of the field you want the offset to. + * @returns A typed pointer to the structure containing the _field + * at _address. + */ +#ifndef CONTAINING_RECORD +#define CONTAINING_RECORD(_address, _type, _field) ((_type *)((unsigned char *)(_address)-OFFSET_OF(_type, _field))) +#endif + +/** + * Macro to ease walking through all of the nodes in a list. + * Runs in O(n) time. + * + * This will work for an empty list. + * + * @param _head A pointer to the list head. Cannot be NULL. + * @param _node An SlNode_t pointer that you need to define before calling + * this macro. + */ +#define SlForEachNode(_head, _node) for ((_node) = (_head)->Next; (_node) != NULL; (_node) = (_node)->Next) + +#endif diff --git a/mcux/middleware/wifi_nxp/incl/port/osa/stack_simple.h b/mcux/middleware/wifi_nxp/incl/port/osa/stack_simple.h new file mode 100644 index 000000000..9e7880773 --- /dev/null +++ b/mcux/middleware/wifi_nxp/incl/port/osa/stack_simple.h @@ -0,0 +1,103 @@ +/**************************************************************************** + * + * Copyright (c) 2023, Michael Becker (michael.f.becker@gmail.com) + * + * This file is part of the FreeRTOS Add-ons project. + * + * Source Code: + * https://github.com/michaelbecker/freertos-addons + * + * Project Page: + * http://michaelbecker.github.io/freertos-addons/ + * + * On-line Documentation: + * http://michaelbecker.github.io/freertos-addons/docs/html/index.html + * + * MIT License + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files + * (the "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so,subject to the + * following conditions: + * + * + The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + Credit is appreciated, but not required, if you find this project + * useful enough to include in your application, product, device, etc. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + ***************************************************************************/ +/* + * Copyright 2023-2024 NXP + * + * SPDX-License-Identifier: BSD-3-Clause + * + */ + +#ifndef STACK_H_ +#define STACK_H_ + +#include "slist.h" + +/** + * The stack structure, we leverage low overhead singly linked lists here. + */ +typedef struct Stack_t_ +{ + /** + * How many items are in the stack. + */ + int Count; + + /** + * The head of the stack. + */ + SlNode_t Head; + +} Stack_t; + +/** + * Initialize a Stack structure you provide. + * + * @param Stack Pointer to your stack structure. + */ +void InitStack(Stack_t *Stack); + +/** + * Push an item onto the stack. + * + * Note that you have to have embedded an SListNode inside your data + * structure. + * + * @param Stack Pointer to your stack structure. + * @param Node The SListNode you want on the stack. + */ +void PushOnStack(Stack_t *Stack, SlNode_t *Node); + +/** + * Pop an item off the stack. + * + * Note that you have to have embedded an SListNode inside your data + * structure. + * + * @param Stack Pointer to your stack structure. + * @return An SListNode from the stack, or NULL if it's empty. + */ +SlNode_t *PopOffStack(Stack_t *Stack); + +/** + * @return True if the stack is empty, false otherwise. + */ +#define IsStackEmpty(_stack) ((_stack)->Count == 0) + +#endif diff --git a/mcux/middleware/wifi_nxp/incl/sigma_agent.h b/mcux/middleware/wifi_nxp/incl/sigma_agent.h new file mode 100644 index 000000000..c9a31a57b --- /dev/null +++ b/mcux/middleware/wifi_nxp/incl/sigma_agent.h @@ -0,0 +1,39 @@ +/** @file sigma_agent.h + * + * @brief This file provides the support for Sigma Agent utility for Wi-F + * certification. + */ +/* + * Copyright 2023-2024 NXP + * + * SPDX-License-Identifier: BSD-3-Clause + * + */ + +#ifndef _SIGMA_AGENT_H_ +#define _SIGMA_AGENT_H_ + +#include + +#define sigma_e(...) wmlog_e("iperf", ##__VA_ARGS__) +#define sigma_w(...) wmlog_w("iperf", ##__VA_ARGS__) + +/** Register the Network Utility CLI command iperf. + * + * \note This function can only be called by the application after \ref + * wlan_init() called. + * + * \return WM_SUCCESS if the CLI commands are registered + * \return -WM_FAIL otherwise (for example if this function + * was called while the CLI commands were already registered) + */ +int sigma_agent_init(void); + +/** Unregister Network Utility CLI command iperf. + * + * \return WM_SUCCESS if the CLI commands are unregistered + * \return -WM_FAIL otherwise + */ +int sigma_agent_deinit(void); + +#endif /*_SIGMA_AGENT_H_ */ diff --git a/mcux/middleware/wifi_nxp/incl/wifi_cal_data_ext.h b/mcux/middleware/wifi_nxp/incl/wifi_cal_data_ext.h new file mode 100644 index 000000000..e818688c1 --- /dev/null +++ b/mcux/middleware/wifi_nxp/incl/wifi_cal_data_ext.h @@ -0,0 +1,257 @@ +/** @file wifi_cal_data_ext.h + * + * @brief This file contains the cal data + */ +/* + * Copyright 2021-2024 NXP + * + * SPDX-License-Identifier: BSD-3-Clause + * + */ + +#ifndef _WIFI_CAL_DATA_H_ +#define _WIFI_CAL_DATA_H_ + +#if defined(SD8978) +/* Following cal data is specific to IW416 QFN A1 chips */ +#if CONFIG_WLAN_CALDATA_1ANT +const uint8_t int_cal_data[] = { + 0x01, 0x00, 0x0E, 0x00, 0x64, 0x01, 0x00, 0x20, 0x77, 0x0E, 0x00, 0x00, 0x00, 0x20, 0x01, 0x01, 0x20, 0x00, 0xA0, + 0x02, 0xBE, 0x19, 0x00, 0x3F, 0x00, 0x10, 0x00, 0x02, 0x58, 0x81, 0x02, 0x00, 0x00, 0x3E, 0x01, 0x00, 0x00, 0x36, + 0x00, 0x3C, 0x22, 0x4B, 0x00, 0x00, 0x00, 0x5C, 0xFF, 0xFF, 0x06, 0x00, 0x05, 0x11, 0x62, 0x03, 0xFF, 0xFF, 0x6B, + 0x6B, 0x05, 0x17, 0x5F, 0x43, 0xFF, 0xFF, 0x76, 0x76, 0x05, 0x14, 0x57, 0x47, 0xFF, 0xFF, 0x54, 0x54, 0x05, 0x16, + 0x5B, 0x4B, 0xFF, 0xFF, 0x6E, 0x6E, 0x05, 0x15, 0x62, 0x4F, 0xFF, 0xFF, 0x72, 0x72, 0x05, 0x13, 0x4B, 0x53, 0xFF, + 0xFF, 0x54, 0x54, 0x00, 0x6C, 0x92, 0x4D, 0x00, 0x00, 0x00, 0xC8, 0xFF, 0xF1, 0x0C, 0x00, 0x01, 0xA5, 0xFF, 0xFF, + 0x00, 0x06, 0x10, 0x5F, 0x01, 0x93, 0xFF, 0xFF, 0x40, 0x10, 0x10, 0x5F, 0x01, 0x9F, 0xFF, 0xFF, 0x44, 0x30, 0x10, + 0x5F, 0x01, 0x97, 0xFF, 0xFF, 0x48, 0x78, 0x10, 0x5F, 0x01, 0x92, 0xFF, 0xFF, 0x4C, 0x9D, 0x10, 0x5F, 0x01, 0x92, + 0xFF, 0xFF, 0x50, 0x50, 0x10, 0x5F, 0x40, 0x0A, 0xFF, 0xFF, 0x00, 0x06, 0x10, 0x5F, 0x40, 0x1C, 0xFF, 0xFF, 0x40, + 0x10, 0x10, 0x5F, 0x40, 0x1C, 0xFF, 0xFF, 0x44, 0x30, 0x10, 0x5F, 0x40, 0x1C, 0xFF, 0xFF, 0x48, 0x78, 0x10, 0x5F, + 0x40, 0x1E, 0xFF, 0xFF, 0x4C, 0x9D, 0x10, 0x5F, 0x40, 0x1C, 0xFF, 0xFF, 0x50, 0x50, 0x10, 0x5F, 0x00, 0x24, 0xDE, + 0x49, 0x00, 0x00, 0x00, 0xEC, 0xFF, 0xFF, 0x06, 0x00, 0x03, 0xFF, 0x04, 0x05, 0x43, 0xFF, 0x08, 0x09, 0x47, 0xFF, + 0x08, 0x09, 0x4B, 0xFF, 0x06, 0x07, 0x4F, 0xFF, 0x06, 0x07, 0x53, 0xFF, 0x06, 0x07, 0x00, 0x44, 0x06, 0x5A, 0x00, + 0x00, 0x01, 0x30, 0x00, 0x07, 0x01, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, + 0xFF, 0xFF, 0x00, 0x22, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, + 0x08, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, + 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x18, 0x8C, 0x53, 0x00, 0x00, 0x01, 0x48, 0x39, 0x54, 0xDC, 0x66, 0xBC, + 0x58, 0x44, 0xD0, 0xBE, 0x5D, 0x2F, 0x1B, 0x41, 0x1A, 0xB8, 0x52, 0x00, 0x1C, 0x9B, 0x37, 0xFF, 0xFF, 0xFF, 0xFF, + 0x02, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x2D, 0xC6, 0xC0, 0x33, 0x44, 0x55, 0x66, 0x00, 0xF0, 0x11, + 0x22}; +#else +const uint8_t int_cal_data[] = {0x00}; +#endif +#endif + +#if defined(SD8987) +const uint8_t int_cal_data[] = {0x00}; +#endif + +#if defined(SD8801) +const uint8_t int_cal_data[] = {0x00}; +#endif + +#if defined(SD9177) +#if CONFIG_WLAN_CALDATA_2ANT_DIVERSITY +/*Antenna Diversity*/ +const uint8_t int_cal_data[] = { + 0x01, 0x00, 0x0F, 0x00, 0x6C, 0x01, 0x00, 0x20, 0x99, 0x0F, 0x00, 0x00, 0x00, 0x20, 0xFF, 0xFF, 0x40, 0x00, 0x77, + 0x00, 0x27, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x03, 0xE8, 0x88, 0x02, 0x00, 0x00, 0x3F, 0x01, 0x00, 0x00, 0x71, + 0x00, 0x2C, 0x9A, 0x4B, 0x00, 0x00, 0x00, 0x4C, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0xC6, 0xC6, 0x03, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xDB, 0xDB, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE1, 0xE1, 0x4B, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDD, + 0xDD, 0x4F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8C, 0xE4, 0x61, 0x00, 0x00, 0x00, 0xD8, 0xFF, 0xF1, 0x08, 0x00, 0x00, + 0x05, 0x01, 0x25, 0xFB, 0x6E, 0x20, 0x21, 0xC4, 0x40, 0x5B, 0xE8, 0xCB, 0x22, 0x78, 0x6F, 0x00, 0x0B, 0x01, 0x27, + 0xFB, 0xDE, 0x3C, 0x22, 0xC4, 0xB0, 0x7B, 0xF0, 0xCB, 0x32, 0x8C, 0x77, 0x44, 0x28, 0x01, 0x10, 0xFB, 0x3E, 0x30, + 0x24, 0xC3, 0xF0, 0x4B, 0xE4, 0xCA, 0xE2, 0x30, 0x67, 0x44, 0x38, 0x01, 0x0F, 0xFC, 0x1E, 0x68, 0x25, 0xC4, 0xB0, + 0x7F, 0xF2, 0xCB, 0x32, 0x54, 0x70, 0x48, 0x6C, 0x01, 0x37, 0xFB, 0x6E, 0x38, 0x25, 0xC3, 0xF0, 0x4F, 0xE6, 0xCA, + 0xB2, 0x34, 0x68, 0x48, 0x84, 0x01, 0x36, 0xFC, 0x6E, 0x7C, 0x26, 0xC4, 0xF0, 0x93, 0xF7, 0xCB, 0x02, 0x68, 0x75, + 0x4C, 0x99, 0x01, 0x3B, 0xFE, 0x1E, 0xE8, 0x26, 0xC6, 0x80, 0xF8, 0x12, 0xCA, 0xE2, 0x90, 0x89, 0x4C, 0xA5, 0x01, + 0x3F, 0xFE, 0x4E, 0xF4, 0x27, 0xC6, 0x50, 0xFC, 0x15, 0xCA, 0x92, 0x78, 0x83, 0x00, 0x1C, 0xFD, 0x62, 0x00, 0x00, + 0x00, 0xF4, 0xFF, 0xFF, 0x04, 0x00, 0x03, 0xF0, 0xFC, 0x3F, 0x47, 0xF0, 0xFC, 0x3F, 0x4B, 0xF0, 0xFC, 0x3F, 0x4F, + 0xF0, 0xFC, 0x3F, 0x00, 0x18, 0x5C, 0x53, 0x00, 0x00, 0x01, 0x0C, 0x39, 0x06, 0x75, 0x0D, 0xBC, 0x55, 0x1F, 0x97, + 0x3D, 0x16, 0x3D, 0x21, 0x41, 0x49, 0xAE, 0xBC, 0x00, 0x44, 0xCE, 0x5A, 0x00, 0x00, 0x01, 0x50, 0x00, 0x07, 0x01, + 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0xFF, 0xFF, 0x00, 0x22, 0x00, 0x01, + 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, + 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, + 0x00, 0x1C, 0x00, 0x37, 0xFF, 0xFF, 0xFF, 0xFF, 0x04, 0x04, 0x77, 0x01, 0x00, 0x00, 0x00, 0x09, 0x00, 0x2D, 0xC6, + 0xC0, 0xDA, 0x21, 0x12, 0x14, 0x00, 0x00, 0xC0, 0x95, +}; + +#else +const uint8_t int_cal_data[] = { + 0x01, 0x00, 0x0F, 0x00, 0xD0, 0x01, 0x00, 0x20, 0x98, 0x0F, 0x00, 0x00, 0x00, 0x20, 0xFF, 0xFF, 0x40, 0x00, 0x77, + 0x00, 0x28, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x03, 0xE8, 0x88, 0x02, 0x00, 0x00, 0x3F, 0x01, 0x00, 0x00, 0x71, + 0x00, 0x2C, 0x9A, 0x4B, 0x00, 0x00, 0x00, 0x4C, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0xC6, 0xC6, 0x03, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xDB, 0xDB, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE1, 0xE1, 0x4B, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDD, + 0xDD, 0x4F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8C, 0x7D, 0x61, 0x00, 0x00, 0x00, 0xD8, 0xFF, 0xF1, 0x08, 0x00, 0x00, + 0x05, 0x01, 0x00, 0x39, 0x7D, 0x9C, 0x23, 0x02, 0x6F, 0xE3, 0xC8, 0x0A, 0xC2, 0x0C, 0x55, 0x00, 0x0B, 0x01, 0x0E, + 0x39, 0x5D, 0x9C, 0x25, 0x02, 0x6F, 0xDF, 0xC8, 0x0A, 0xB2, 0x0C, 0x55, 0x44, 0x28, 0x01, 0xCE, 0x3A, 0x7D, 0xF0, + 0x27, 0x03, 0x40, 0x1B, 0xD7, 0x0A, 0xF2, 0x1C, 0x60, 0x44, 0x38, 0x01, 0xD4, 0x3A, 0xBE, 0x10, 0x29, 0x03, 0x70, + 0x27, 0xDB, 0x0A, 0xB2, 0x1C, 0x61, 0x48, 0x6C, 0x01, 0xD1, 0x3A, 0x4E, 0x00, 0x29, 0x03, 0x00, 0x07, 0xD3, 0x0B, + 0x12, 0x10, 0x5F, 0x48, 0x84, 0x01, 0xD2, 0x3A, 0x8E, 0x00, 0x2A, 0x03, 0x20, 0x0F, 0xD6, 0x0A, 0xB2, 0x0C, 0x5E, + 0x4C, 0x99, 0x01, 0xD6, 0x3A, 0x2D, 0xE0, 0x2A, 0x02, 0xCF, 0xFB, 0xD0, 0x0A, 0x51, 0xF4, 0x58, 0x4C, 0xA5, 0x01, + 0xD3, 0x3A, 0x0D, 0xE0, 0x2B, 0x02, 0x9F, 0xEF, 0xCF, 0x09, 0xF1, 0xE4, 0x54, 0x00, 0x1C, 0x55, 0x62, 0x00, 0x00, + 0x00, 0xF4, 0xFF, 0xFF, 0x04, 0x00, 0x03, 0xF0, 0x84, 0x21, 0x47, 0xF0, 0x84, 0x21, 0x4B, 0xF0, 0x84, 0x21, 0x4F, + 0xF0, 0x84, 0x21, 0x00, 0x18, 0x2D, 0x53, 0x00, 0x00, 0x01, 0x0C, 0x39, 0x1B, 0x30, 0x73, 0xBC, 0x15, 0x18, 0x2B, + 0xBE, 0x82, 0x8F, 0x5C, 0x41, 0x4C, 0xCC, 0xCD, 0x00, 0x70, 0xDD, 0x5A, 0x00, 0x00, 0x01, 0x7C, 0x00, 0x07, 0x02, + 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x02, 0x00, 0x03, + 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x03, 0x00, 0x03, 0x00, + 0x03, 0x00, 0x05, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, + 0xFF, 0xFF, 0x00, 0x20, 0x00, 0x05, 0x00, 0x05, 0x00, 0x05, 0x00, 0x05, 0x00, 0x05, 0x00, 0x05, 0x00, 0x05, 0x00, + 0x05, 0x00, 0x05, 0x00, 0x05, 0x00, 0x05, 0x00, 0x05, 0x00, 0x05, 0x00, 0x05, 0x00, 0x05, 0x00, 0x05, 0x00, 0x05, + 0x00, 0x05, 0x00, 0x05, 0x00, 0x05, 0x00, 0x10, 0xE4, 0x63, 0x00, 0x00, 0x01, 0x8C, 0xF1, 0x11, 0x00, 0x01, 0x00, + 0x00, 0x0D, 0x0D, 0x00, 0x1C, 0x07, 0x37, 0x00, 0x00, 0x01, 0xA8, 0x07, 0x0D, 0x77, 0x01, 0x00, 0x00, 0x00, 0x28, + 0x00, 0x01, 0xC2, 0x00, 0x23, 0xBB, 0x5E, 0x71, 0x00, 0x00, 0xDC, 0xFE, 0x00, 0x18, 0x60, 0x68, 0x00, 0x00, 0x01, + 0xC0, 0x00, 0x74, 0x00, 0x01, 0xFE, 0xBB, 0x5E, 0x70, 0xDC, 0xFE, 0x23, 0xFF, 0x00, 0x00, 0x00, 0x68, 0x00, 0x10, + 0x87, 0x64, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x04, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01}; +#endif +#endif + +#ifdef RW610 +#ifdef FRDMRW610 +#define CONFIG_WLAN_CALDATA_1ANT 1 +#endif +#if CONFIG_WLAN_CALDATA_1ANT +#ifdef FRDMRW610 +/*one ANT*/ +const uint8_t cal_data_rw610[] = { + 0x01, 0x00, 0x0F, 0x00, 0xB8, 0x01, 0x00, 0x20, 0xDD, 0x0F, 0x00, 0x00, 0x00, 0x20, 0xFF, 0xFF, + 0x40, 0x00, 0x7C, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x26, 0x79, 0x02, 0x00, + 0x00, 0x3F, 0x01, 0x00, 0x00, 0x12, 0x00, 0x8C, 0x74, 0x61, 0x00, 0x00, 0x00, 0xAC, 0x23, 0xF0, + 0x08, 0x00, 0x00, 0x05, 0x01, 0x10, 0x3B, 0x6E, 0x20, 0x23, 0x04, 0x70, 0x63, 0xE8, 0x0C, 0x42, + 0x88, 0x74, 0x00, 0x0B, 0x01, 0x1A, 0x3B, 0x4E, 0x18, 0x25, 0x04, 0x40, 0x57, 0xE5, 0x0C, 0x12, + 0x80, 0x71, 0x44, 0x28, 0x01, 0x10, 0x3A, 0x7E, 0x00, 0x27, 0x03, 0x60, 0x1F, 0xD7, 0x0A, 0xC2, + 0x14, 0x61, 0x44, 0x38, 0x01, 0x23, 0x3A, 0x7E, 0x00, 0x29, 0x03, 0x50, 0x1F, 0xD8, 0x0A, 0xA2, + 0x10, 0x5F, 0x48, 0x6C, 0x01, 0x14, 0x3A, 0x8E, 0x04, 0x2A, 0x03, 0x60, 0x23, 0xD9, 0x0A, 0xD2, + 0x14, 0x61, 0x48, 0x84, 0x01, 0xF7, 0x3A, 0x6E, 0x00, 0x2C, 0x03, 0x40, 0x1B, 0xD7, 0x0A, 0x82, + 0x0C, 0x5F, 0x4C, 0x99, 0x01, 0xFF, 0x3B, 0x3E, 0x30, 0x2C, 0x03, 0xE0, 0x47, 0xE3, 0x0A, 0xC2, + 0x28, 0x66, 0x4C, 0xA5, 0x01, 0x00, 0x3B, 0x3E, 0x30, 0x2D, 0x03, 0xE0, 0x4B, 0xE3, 0x0A, 0xB2, + 0x28, 0x66, 0x00, 0x70, 0xF2, 0x5A, 0x00, 0x00, 0x01, 0x1C, 0x00, 0x07, 0x02, 0x04, 0x00, 0x0F, + 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x02, 0x00, 0x06, + 0x00, 0x05, 0x00, 0x05, 0x00, 0x05, 0x00, 0x05, 0x00, 0x05, 0x00, 0x05, 0x00, 0x06, 0x00, 0x05, + 0x00, 0x05, 0x00, 0x05, 0x00, 0x06, 0x00, 0x05, 0x00, 0x05, 0x00, 0x05, 0x00, 0x05, 0x00, 0x05, + 0x00, 0x05, 0x00, 0x05, 0x00, 0x05, 0xFF, 0xFF, 0x00, 0x20, 0x00, 0x06, 0x00, 0x06, 0x00, 0x06, + 0x00, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, 0x06, + 0x00, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, 0x06, + 0x00, 0x06, 0x00, 0x10, 0x49, 0x63, 0x00, 0x00, 0x01, 0x2C, 0xF1, 0x11, 0x00, 0x01, 0x00, 0x00, + 0x0D, 0x08, 0x00, 0x2C, 0x85, 0x4B, 0x00, 0x00, 0x01, 0x58, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0xD6, + 0xDA, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDB, 0xDD, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD6, + 0xD9, 0x4B, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD6, 0xD9, 0x4F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, + 0x56, 0x62, 0x00, 0x00, 0x01, 0x74, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x01, 0x8C, 0x63, 0x44, 0x02, + 0x94, 0xA5, 0x48, 0x03, 0x9C, 0xE7, 0x4C, 0x04, 0x21, 0x08, 0x00, 0x1C, 0xD2, 0x37, 0x00, 0x00, + 0x01, 0x90, 0x05, 0x04, 0x7C, 0x01, 0x00, 0x00, 0x00, 0x28, 0x00, 0x2D, 0xC6, 0xC0, 0xFF, 0xFF, + 0xFF, 0xFF, 0x00, 0xF0, 0xFF, 0xFF, 0x00, 0x18, 0xDF, 0x68, 0x00, 0x00, 0x01, 0xA8, 0x00, 0x00, + 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, + 0x8D, 0x64, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00}; +#else +/*one ANT*/ +const uint8_t cal_data_rw610[] = { + 0x01, 0x00, 0x0F, 0x00, 0xB8, 0x01, 0x00, 0x20, 0xDF, 0x0F, 0x00, 0x00, 0x00, 0x20, 0xFF, 0xFF, + 0x40, 0x00, 0x7C, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x26, 0x79, 0x02, 0x00, + 0x00, 0x3F, 0x01, 0x00, 0x00, 0x12, 0x00, 0x8C, 0xCF, 0x61, 0x00, 0x00, 0x00, 0xAC, 0x23, 0xF0, + 0x08, 0x00, 0x00, 0x05, 0x01, 0x0E, 0x3C, 0x1E, 0x4C, 0x1E, 0x05, 0x00, 0x8B, 0xF2, 0x0C, 0x72, + 0xAC, 0x7D, 0x00, 0x0B, 0x01, 0x0B, 0x3B, 0xCE, 0x38, 0x20, 0x04, 0xC0, 0x77, 0xEE, 0x0C, 0x52, + 0x9C, 0x79, 0x44, 0x28, 0x01, 0x04, 0x3A, 0xBE, 0x10, 0x22, 0x03, 0xB0, 0x33, 0xDC, 0x0B, 0x32, + 0x2C, 0x66, 0x44, 0x38, 0x01, 0x00, 0x3A, 0x7E, 0x00, 0x24, 0x03, 0x50, 0x1F, 0xD8, 0x0A, 0xB2, + 0x14, 0x61, 0x48, 0x6C, 0x01, 0x1E, 0x3B, 0xBE, 0x50, 0x25, 0x04, 0x80, 0x6F, 0xEC, 0x0B, 0xB2, + 0x58, 0x72, 0x48, 0x84, 0x01, 0x0D, 0x3B, 0x4E, 0x34, 0x26, 0x04, 0x30, 0x57, 0xE6, 0x0B, 0x72, + 0x48, 0x6D, 0x4C, 0x99, 0x01, 0x09, 0x3B, 0xCE, 0x54, 0x27, 0x04, 0x80, 0x73, 0xEE, 0x0B, 0x52, + 0x4C, 0x6F, 0x4C, 0xA5, 0x01, 0x01, 0x3B, 0x2E, 0x28, 0x28, 0x03, 0xD0, 0x47, 0xE3, 0x0A, 0xB2, + 0x28, 0x65, 0x00, 0x70, 0x92, 0x5A, 0x00, 0x00, 0x01, 0x1C, 0x00, 0x07, 0x02, 0x04, 0x00, 0x0F, + 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x02, 0x00, 0x02, + 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, + 0x00, 0x01, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, + 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0xFF, 0xFF, 0x00, 0x20, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, + 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, + 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, + 0x00, 0x02, 0x00, 0x10, 0x49, 0x63, 0x00, 0x00, 0x01, 0x2C, 0xF1, 0x11, 0x00, 0x01, 0x00, 0x00, + 0x0D, 0x08, 0x00, 0x2C, 0x85, 0x4B, 0x00, 0x00, 0x01, 0x58, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0xD6, + 0xDA, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDB, 0xDD, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD6, + 0xD9, 0x4B, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD6, 0xD9, 0x4F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, + 0x93, 0x62, 0x00, 0x00, 0x01, 0x74, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x01, 0x8C, 0x63, 0x44, 0x01, + 0x8C, 0x63, 0x48, 0x02, 0x94, 0xA5, 0x4C, 0x03, 0x9C, 0xE7, 0x00, 0x1C, 0xD3, 0x37, 0x00, 0x00, + 0x01, 0x90, 0x04, 0x04, 0x7C, 0x01, 0x00, 0x00, 0x00, 0x28, 0x00, 0x2D, 0xC6, 0xC0, 0xFF, 0xFF, + 0xFF, 0xFF, 0x00, 0xF0, 0xFF, 0xFF, 0x00, 0x18, 0xDF, 0x68, 0x00, 0x00, 0x01, 0xA8, 0x00, 0x00, + 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, + 0x8D, 0x64, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00}; +#endif /*FRDMRW610*/ +#else +#if CONFIG_WLAN_CALDATA_3ANT_DIVERSITY +const uint8_t cal_data_rw610[] = { + 0x01, 0x00, 0x0F, 0x00, 0xA8, 0x01, 0x00, 0x20, 0x46, 0x0F, 0x00, 0x00, 0x00, 0x20, 0xFF, 0xFF, 0x40, 0x00, 0x72, + 0x00, 0x22, 0x00, 0x00, 0xA3, 0x00, 0x00, 0x00, 0x04, 0x26, 0x79, 0x02, 0x00, 0x00, 0x3F, 0x01, 0x00, 0x00, 0x12, + 0x00, 0x8C, 0x93, 0x61, 0x00, 0x00, 0x00, 0xAC, 0xFF, 0xF0, 0x08, 0x00, 0x00, 0x05, 0x01, 0x15, 0x3B, 0xAE, 0x30, + 0x20, 0x04, 0xC0, 0x73, 0xED, 0x0C, 0x12, 0x84, 0x7B, 0x00, 0x0B, 0x01, 0x18, 0x3B, 0xCE, 0x38, 0x21, 0x04, 0xE0, + 0x7B, 0xEE, 0x0C, 0x12, 0x88, 0x7A, 0x44, 0x28, 0x01, 0x1E, 0x3B, 0x8E, 0x40, 0x21, 0x04, 0x30, 0x5B, 0xE8, 0x0B, + 0x82, 0x50, 0x6B, 0x44, 0x38, 0x01, 0x2D, 0x3B, 0xAE, 0x4C, 0x23, 0x04, 0xB0, 0x6F, 0xEC, 0x0B, 0x72, 0x9C, 0x79, + 0x48, 0x6C, 0x01, 0x15, 0x3C, 0x1E, 0x68, 0x24, 0x04, 0xC0, 0x7F, 0xF0, 0x0B, 0xA2, 0x60, 0x75, 0x48, 0x84, 0x01, + 0x2D, 0x3B, 0x8E, 0x44, 0x24, 0x04, 0x80, 0x67, 0xE9, 0x0B, 0x52, 0x7C, 0x77, 0x4C, 0x99, 0x01, 0x22, 0x3B, 0xFE, + 0x60, 0x24, 0x04, 0xA0, 0x7B, 0xF0, 0x0A, 0xD2, 0x50, 0x72, 0x4C, 0xA5, 0x01, 0x0F, 0x3B, 0x4E, 0x30, 0x25, 0x03, + 0xE0, 0x47, 0xE4, 0x0A, 0x92, 0x28, 0x68, 0x00, 0x70, 0x7A, 0x5A, 0x00, 0x00, 0x01, 0x1C, 0x00, 0x07, 0x02, 0x04, + 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x0C, 0xFF, 0xFF, 0x00, 0x02, 0x00, 0x02, 0x00, + 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, + 0x00, 0x02, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0xFF, + 0xFF, 0x00, 0x20, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, + 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, + 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x10, 0x49, 0x63, 0x00, 0x00, 0x01, 0x2C, 0xF1, 0x11, 0x00, 0x01, 0x00, 0x00, + 0x0D, 0x08, 0x00, 0x2C, 0x49, 0x4B, 0x00, 0x00, 0x01, 0x58, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0xE4, 0xEA, 0x03, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xE0, 0xE2, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDD, 0xE0, 0x4B, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xDB, 0xDA, 0x4F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0xF3, 0x62, 0x00, 0x00, 0x01, 0x74, 0xFF, 0xFF, 0x04, + 0x00, 0x00, 0x02, 0x90, 0xA4, 0x44, 0x04, 0xA5, 0x29, 0x48, 0x04, 0x20, 0xE8, 0x4C, 0x04, 0x21, 0x08, 0x00, 0x1C, + 0x0A, 0x37, 0x00, 0x00, 0x01, 0x90, 0x03, 0x04, 0x72, 0x01, 0x00, 0x00, 0x00, 0x28, 0x00, 0x2D, 0xC6, 0xC0, 0xDA, + 0x01, 0x07, 0x97, 0x00, 0xF0, 0xC0, 0x95, 0x00, 0x18, 0x27, 0x68, 0xFF, 0xFF, 0xFF, 0xFF, 0x65, 0x00, 0x00, 0x01, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00}; +#elif (CONFIG_WLAN_CALDATA_1ANT_WITH_DIVERSITY) +const uint8_t cal_data_rw610[] = { + 0x01, 0x00, 0x0F, 0x00, 0xB8, 0x01, 0x00, 0x20, 0xE1, 0x0F, 0x00, 0x00, 0x00, 0x20, 0xFF, 0xFF, + 0x40, 0x00, 0x7B, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x26, 0x79, 0x02, 0x00, + 0x00, 0x3F, 0x01, 0x00, 0x00, 0x12, 0x00, 0x8C, 0x29, 0x61, 0x00, 0x00, 0x00, 0xAC, 0x23, 0xF0, + 0x08, 0x00, 0x00, 0x05, 0x01, 0x09, 0x3B, 0x5E, 0x1C, 0x1F, 0x04, 0x50, 0x5B, 0xE6, 0x0C, 0x32, + 0x80, 0x72, 0x00, 0x0B, 0x01, 0x0C, 0x3B, 0x5E, 0x1C, 0x21, 0x04, 0x50, 0x5B, 0xE7, 0x0C, 0x32, + 0x84, 0x72, 0x44, 0x28, 0x01, 0x09, 0x3A, 0x1D, 0xE8, 0x23, 0x03, 0x00, 0x0B, 0xD2, 0x0A, 0x82, + 0x04, 0x5C, 0x44, 0x38, 0x01, 0x12, 0x3A, 0x2D, 0xEC, 0x25, 0x03, 0x10, 0x0F, 0xD3, 0x0A, 0x62, + 0x04, 0x5C, 0x48, 0x6C, 0x01, 0x0D, 0x3A, 0x9E, 0x08, 0x26, 0x03, 0x60, 0x23, 0xDA, 0x0A, 0xD2, + 0x18, 0x61, 0x48, 0x84, 0x01, 0x2A, 0x3B, 0x5E, 0x38, 0x27, 0x04, 0x20, 0x57, 0xE6, 0x0B, 0x42, + 0x40, 0x6B, 0x4C, 0x99, 0x01, 0x2A, 0x3C, 0x2E, 0x68, 0x28, 0x04, 0xD0, 0x87, 0xF3, 0x0B, 0x52, + 0x5C, 0x73, 0x4C, 0xA5, 0x01, 0x33, 0x3B, 0xCE, 0x50, 0x29, 0x04, 0x60, 0x6F, 0xED, 0x0A, 0xF2, + 0x40, 0x6C, 0x00, 0x70, 0xDA, 0x5A, 0x00, 0x00, 0x01, 0x1C, 0x00, 0x07, 0x02, 0x04, 0x00, 0x0F, + 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x0C, 0xFF, 0xFF, 0x00, 0x02, 0x00, 0x06, + 0x00, 0x05, 0x00, 0x05, 0x00, 0x05, 0x00, 0x05, 0x00, 0x05, 0x00, 0x05, 0x00, 0x06, 0x00, 0x05, + 0x00, 0x05, 0x00, 0x05, 0x00, 0x06, 0x00, 0x05, 0x00, 0x05, 0x00, 0x05, 0x00, 0x05, 0x00, 0x05, + 0x00, 0x05, 0x00, 0x05, 0x00, 0x05, 0xFF, 0xFF, 0x00, 0x20, 0x00, 0x06, 0x00, 0x06, 0x00, 0x06, + 0x00, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, 0x06, + 0x00, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, 0x06, + 0x00, 0x06, 0x00, 0x10, 0x49, 0x63, 0x00, 0x00, 0x01, 0x2C, 0xF1, 0x11, 0x00, 0x01, 0x00, 0x00, + 0x0D, 0x08, 0x00, 0x2C, 0x85, 0x4B, 0x00, 0x00, 0x01, 0x58, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0xD6, + 0xDA, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDB, 0xDD, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD6, + 0xD9, 0x4B, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD6, 0xD9, 0x4F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, + 0xB0, 0x62, 0x00, 0x00, 0x01, 0x74, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x02, 0x10, 0x84, 0x44, 0x02, + 0x94, 0xA5, 0x48, 0x03, 0x9C, 0xE7, 0x4C, 0x04, 0x21, 0x08, 0x00, 0x1C, 0xD3, 0x37, 0x00, 0x00, + 0x01, 0x90, 0x05, 0x04, 0x7B, 0x01, 0x00, 0x00, 0x00, 0x28, 0x00, 0x2D, 0xC6, 0xC0, 0xFF, 0xFF, + 0xFF, 0xFF, 0x00, 0xF0, 0xFF, 0xFF, 0x00, 0x18, 0xDF, 0x68, 0x00, 0x00, 0x01, 0xA8, 0x00, 0x00, + 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, + 0x7D, 0x64, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00,}; +#else /*TWO ANT*/ +const uint8_t cal_data_rw610[] = { + 0x01, 0x00, 0x0F, 0x00, 0x38, 0x01, 0x00, 0x20, 0xE0, 0x0F, 0x00, 0x00, 0x00, 0x20, 0xFF, 0xFF, + 0x40, 0x00, 0x7B, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x26, 0x79, 0x02, 0x00, + 0x00, 0x3F, 0x01, 0x00, 0x00, 0x12, 0x00, 0x8C, 0xA2, 0x61, 0x00, 0x00, 0x00, 0xAC, 0x23, 0xF0, + 0x08, 0x00, 0x00, 0x05, 0x01, 0x1B, 0x3C, 0x6E, 0x60, 0x1F, 0x05, 0x50, 0x9F, 0xF8, 0x0C, 0x72, + 0xC0, 0x81, 0x00, 0x0B, 0x01, 0x17, 0x3C, 0x3E, 0x54, 0x21, 0x05, 0x30, 0x97, 0xF5, 0x0C, 0x62, + 0xB4, 0x7F, 0x44, 0x28, 0x01, 0x03, 0x3A, 0xAE, 0x08, 0x23, 0x03, 0x90, 0x2B, 0xDB, 0x0B, 0x12, + 0x28, 0x65, 0x44, 0x38, 0x01, 0x02, 0x3A, 0x5D, 0xFC, 0x25, 0x03, 0x40, 0x1B, 0xD6, 0x0A, 0x92, + 0x10, 0x5F, 0x48, 0x6C, 0x01, 0x1D, 0x3B, 0xBE, 0x50, 0x26, 0x04, 0x80, 0x6F, 0xEC, 0x0B, 0xC2, + 0x5C, 0x72, 0x48, 0x84, 0x01, 0x0E, 0x3B, 0x2E, 0x2C, 0x27, 0x04, 0x10, 0x4B, 0xE3, 0x0B, 0x62, + 0x40, 0x6B, 0x4C, 0x99, 0x01, 0x05, 0x3B, 0xCE, 0x54, 0x28, 0x04, 0x80, 0x6F, 0xEE, 0x0B, 0x62, + 0x50, 0x70, 0x4C, 0xA5, 0x01, 0xFF, 0x3B, 0x1E, 0x28, 0x28, 0x03, 0xD0, 0x47, 0xE3, 0x0A, 0xB2, + 0x24, 0x65, 0x00, 0x10, 0xBF, 0x63, 0x00, 0x00, 0x00, 0xBC, 0xF1, 0x11, 0x00, 0x01, 0x00, 0x00, + 0x08, 0x08, 0x00, 0x2C, 0xF6, 0x4B, 0x00, 0x00, 0x00, 0xE8, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0xD6, + 0xDA, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDB, 0xDD, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD6, + 0xD9, 0x4B, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD6, 0xD9, 0x4F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, + 0x03, 0x62, 0x00, 0x00, 0x01, 0x04, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x01, 0x8C, 0x63, 0x44, 0x01, + 0x8C, 0x63, 0x48, 0x02, 0x94, 0xA5, 0x4C, 0x03, 0x9C, 0xE7, 0x00, 0x1C, 0x46, 0x37, 0x00, 0x00, + 0x01, 0x20, 0x02, 0x04, 0x7B, 0x01, 0x00, 0x00, 0x00, 0x28, 0x00, 0x2D, 0xC6, 0xC0, 0xFF, 0xFF, + 0xFF, 0xFF, 0x00, 0xF0, 0xFF, 0xFF, 0x00, 0x18, 0x8C, 0x68, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, + 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,}; +#endif +#endif +#endif +#endif diff --git a/mcux/middleware/wifi_nxp/incl/wifi_config_default.h b/mcux/middleware/wifi_nxp/incl/wifi_config_default.h new file mode 100644 index 000000000..173ff74e4 --- /dev/null +++ b/mcux/middleware/wifi_nxp/incl/wifi_config_default.h @@ -0,0 +1,11 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: BSD-3-Clause + * + */ + +#if !defined WIFI_HDR_CONFIG_H +#define WIFI_HDR_CONFIG_H + +#endif /* WIFI_HDR_CONFIG_H */ diff --git a/mcux/middleware/wifi_nxp/incl/wifi_ping.h b/mcux/middleware/wifi_nxp/incl/wifi_ping.h new file mode 100644 index 000000000..757934e58 --- /dev/null +++ b/mcux/middleware/wifi_nxp/incl/wifi_ping.h @@ -0,0 +1,56 @@ +/** @file wifi_ping.h + * + * @brief This file provides the support for network utility ping + */ +/* + * Copyright 2008-2024 NXP + * + * SPDX-License-Identifier: BSD-3-Clause + * + */ + +#ifndef _WIFI_PING_H_ +#define _WIFI_PING_H_ + +#include + +#define ping_e(...) wmlog_e("ping", ##__VA_ARGS__) +#define ping_w(...) wmlog_w("ping", ##__VA_ARGS__) + +#define PING_ID 0xAFAFU +#define PING_INTERVAL 1000 +#define PING_DEFAULT_TIMEOUT_SEC 2 +#define PING_DEFAULT_COUNT 10 +#define PING_DEFAULT_SIZE 56 +#define PING_MAX_SIZE 65507U +#define PING_MAX_COUNT 65535U + +/** Register Network Utility CLI commands. + * + * Register the Network Utility CLI commands. Currently, only ping command is + * supported. + * + * \note This function can only be called by the application after \ref + * wlan_init() called. + * + * \return WM_SUCCESS if the CLI commands are registered + * \return -WM_FAIL otherwise (for example if this function + * was called while the CLI commands were already registered) + */ + +int ping_cli_init(void); + +int ping(uint16_t count, int interval, unsigned short size, unsigned int r_timeout, const char *addr); + +void ping_stats(int *total, int *recvd); + +/** Unregister Network Utility CLI commands. + * + * Unregister the Network Utility CLI commands. + * + * \return WM_SUCCESS if the CLI commands are unregistered + * \return -WM_FAIL otherwise + */ + +int ping_cli_deinit(void); +#endif /*_WIFI_PING_H_ */ diff --git a/mcux/middleware/wifi_nxp/incl/wifidriver/wifi-decl.h b/mcux/middleware/wifi_nxp/incl/wifidriver/wifi-decl.h new file mode 100644 index 000000000..b0f800db3 --- /dev/null +++ b/mcux/middleware/wifi_nxp/incl/wifidriver/wifi-decl.h @@ -0,0 +1,2025 @@ +/* + * Copyright 2008-2024 NXP + * + * SPDX-License-Identifier: BSD-3-Clause + * + */ + +/*! \file wifi-decl.h + * \brief Wifi structure declarations + */ + +#ifndef __WIFI_DECL_H__ +#define __WIFI_DECL_H__ + +#include +#include +#include +#include +#include +#include + +/* fixme: remove these after complete integration with mlan */ +#define MLAN_MAC_ADDR_LENGTH (6U) +/** Version string buffer length */ +#define MLAN_MAX_VER_STR_LEN 128 + +#define WIFI_MAX_CHANNEL_NUM 42 + +#define PMK_BIN_LEN 32 +#define PMK_HEX_LEN 64 + +#define MOD_GROUPS 7 + +#if CONFIG_DRIVER_OWE +/** The open AP in OWE transmition Mode */ +#define OWE_TRANS_MODE_OPEN 1U +/** The security AP in OWE trsnsition Mode */ +#define OWE_TRANS_MODE_OWE 2U +#endif + +#if CONFIG_WIFI_CAPA +#define WIFI_SUPPORT_11AX (1 << 3) +#define WIFI_SUPPORT_11AC (1 << 2) +#define WIFI_SUPPORT_11N (1 << 1) +#define WIFI_SUPPORT_LEGACY (1 << 0) +#endif + +#if 0 +/** channel_field.flags */ +#define CHANNEL_FLAGS_TURBO 0x0010 +#define CHANNEL_FLAGS_CCK 0x0020 +#define CHANNEL_FLAGS_OFDM 0x0040 +#define CHANNEL_FLAGS_2GHZ 0x0080 +#define CHANNEL_FLAGS_5GHZ 0x0100 +#define CHANNEL_FLAGS_ONLY_PASSIVSCAN_ALLOW 0x0200 +#define CHANNEL_FLAGS_DYNAMIC_CCK_OFDM 0x0400 +#define CHANNEL_FLAGS_GFSK 0x0800 +PACK_START struct channel_field { + t_u16 frequency; + t_u16 flags; +} PACK_END; + +/** mcs_field.known */ +#define MCS_KNOWN_BANDWIDTH 0x01 +#define MCS_KNOWN_MCS_INDEX_KNOWN 0x02 +#define MCS_KNOWN_GUARD_INTERVAL 0x04 +#define MCS_KNOWN_HT_FORMAT 0x08 +#define MCS_KNOWN_FEC_TYPE 0x10 +#define MCS_KNOWN_STBC_KNOWN 0x20 +#define MCS_KNOWN_NESS_KNOWN 0x40 +#define MCS_KNOWN_NESS_DATA 0x80 +/** bandwidth */ +#define RX_BW_20 0 +#define RX_BW_40 1 +#define RX_BW_20L 2 +#define RX_BW_20U 3 +/** mcs_field.flags +The flags field is any combination of the following: +0x03 bandwidth - 0: 20, 1: 40, 2: 20L, 3: 20U +0x04 guard interval - 0: long GI, 1: short GI +0x08 HT format - 0: mixed, 1: greenfield +0x10 FEC type - 0: BCC, 1: LDPC +0x60 Number of STBC streams +0x80 Ness - bit 0 (LSB) of Number of extension spatial streams */ +PACK_START struct mcs_field { + t_u8 known; + t_u8 flags; + t_u8 mcs; +} PACK_END; + +/** radiotap_body.flags */ +#define RADIOTAP_FLAGS_DURING_CFG 0x01 +#define RADIOTAP_FLAGS_SHORT_PREAMBLE 0x02 +#define RADIOTAP_FLAGS_WEP_ENCRYPTION 0x04 +#define RADIOTAP_FLAGS_WITH_FRAGMENT 0x08 +#define RADIOTAP_FLAGS_INCLUDE_FCS 0x10 +#define RADIOTAP_FLAGS_PAD_BTW_HEADER_PAYLOAD 0x20 +#define RADIOTAP_FLAGS_FAILED_FCS_CHECK 0x40 +#define RADIOTAP_FLAGS_USE_SGI_HT 0x80 +PACK_START struct radiotap_body { + t_u64 timestamp; + t_u8 flags; + t_u8 rate; + struct channel_field channel; + t_s8 antenna_signal; + t_s8 antenna_noise; + t_u8 antenna; + struct mcs_field mcs; +} PACK_END; + +typedef PACK_START struct _radiotap_header { + struct ieee80211_radiotap_header hdr; + struct radiotap_body body; +} PACK_END radiotap_header_t; +#endif + +/** Station information structure */ +typedef struct +{ + /** MAC address buffer */ + t_u8 mac[MLAN_MAC_ADDR_LENGTH]; + /** + * Power management status + * 0 = active (not in power save) + * 1 = in power save status + */ + t_u8 power_mgmt_status; + /** RSSI: dBm */ + t_s8 rssi; +} wifi_sta_info_t; + +/** Channel list structure */ +typedef PACK_START struct _wifi_scan_chan_list_t +{ + /** Number of channels */ + uint8_t num_of_chan; + /** Channel number */ + uint8_t chan_number[MLAN_MAX_CHANNEL]; +} PACK_END wifi_scan_chan_list_t; + +/** + * Note: This is variable length structure. The size of array mac_list is + * equal to count. The caller of the API which returns this structure does + * not need to separately free the array mac_list. It only needs to free + * the sta_list_t object after use. + */ +typedef struct +{ + /** Count */ + int count; + /* + * Variable length array. Max size is MAX_NUM_CLIENTS. + */ + /* wifi_sta_info_t *list; */ +} wifi_sta_list_t; + +/** BSS type : STA */ +#define BSS_TYPE_STA 0U +/** BSS type : UAP */ +#define BSS_TYPE_UAP 1U + +#define UAP_DEFAULT_CHANNEL 0 +#ifdef RW610 +#define UAP_DEFAULT_BANDWIDTH 1 +#else +#define UAP_DEFAULT_BANDWIDTH 2 +#endif +#define UAP_DEFAULT_BEACON_PERIOD 100 +#define UAP_DEFAULT_HIDDEN_SSID 0 + +enum wifi_bss_security +{ + WIFI_SECURITY_NONE = 0, + WIFI_SECURITY_WEP_STATIC, + WIFI_SECURITY_WEP_DYNAMIC, + WIFI_SECURITY_WPA, + WIFI_SECURITY_WPA2, +}; + +enum wifi_bss_features +{ + WIFI_BSS_FEATURE_WMM = 0, + WIFI_BSS_FEATURE_WPS = 1, +}; + +struct wifi_message +{ + uint16_t event; + enum wifi_event_reason reason; + void *data; +}; + +#if CONFIG_P2P +struct wifi_wfd_event +{ + bool peer_event; + bool action_frame; + void *data; +}; +#endif + +/* Wlan Cipher structure */ +typedef struct +{ + /** 1 bit value can be set for none */ + uint16_t none : 1; + /** 1 bit value can be set for wep40 */ + uint16_t wep40 : 1; + /** 1 bit value can be set for wep104 */ + uint16_t wep104 : 1; + /** 1 bit value can be set for tkip */ + uint16_t tkip : 1; + /** 1 bit valuecan be set for ccmp */ + uint16_t ccmp : 1; + /** 1 bit valuecan be set for aes 128 cmac */ + uint16_t aes_128_cmac : 1; + /** 1 bit value can be set for gcmp */ + uint16_t gcmp : 1; + /** 1 bit value can be set for sms4 */ + uint16_t sms4 : 1; + /** 1 bit value can be set for gcmp 256 */ + uint16_t gcmp_256 : 1; + /** 1 bit valuecan be set for ccmp 256 */ + uint16_t ccmp_256 : 1; + /** 1 bit is reserved */ + uint16_t rsvd : 1; + /** 1 bit value can be set for bip gmac 128 */ + uint16_t bip_gmac_128 : 1; + /** 1 bit value can be set for bip gmac 256 */ + uint16_t bip_gmac_256 : 1; + /** 1 bit value can be set for bip cmac 256 */ + uint16_t bip_cmac_256 : 1; + /** 1 bit valuecan be set for gtk not used */ + uint16_t gtk_not_used : 1; + /** 4 bits are reserved */ + uint16_t rsvd2 : 2; +} _Cipher_t; + +/* Security mode structure */ +typedef struct +{ + /** No security */ + uint32_t noRsn : 1; + /** WEP static */ + uint32_t wepStatic : 1; + /** WEP dynamic */ + uint32_t wepDynamic : 1; + /** WPA */ + uint32_t wpa : 1; + /** WPA none */ + uint32_t wpaNone : 1; + /** WPA 2 */ + uint32_t wpa2 : 1; + /** WPA 2 sha256 */ + uint32_t wpa2_sha256 : 1; + /** OWE */ + uint32_t owe : 1; + /** WPA3 SAE */ + uint32_t wpa3_sae : 1; + /** 802.1x */ + uint32_t wpa2_entp : 1; + /** 802.1x sha256 */ + uint32_t wpa2_entp_sha256 : 1; + /** FT 802.1x */ + uint32_t ft_1x : 1; + /** FT 802.1x sha384 */ + uint32_t ft_1x_sha384 : 1; + /** FT PSK */ + uint32_t ft_psk : 1; + /** FT SAE */ + uint32_t ft_sae : 1; + /** WPA3 802.1x sha256 */ + uint32_t wpa3_1x_sha256 : 1; + /** WPA3 802.1x sha384 */ + uint32_t wpa3_1x_sha384 : 1; + /** Reserved 16 bits */ + uint32_t rsvd : 16; +} _SecurityMode_t; + +/* TODO: clean up the parts brought over from the Host SME BSSDescriptor_t, + * remove ifdefs, consolidate security info */ + +/** MLAN Maximum SSID Length */ +#define MLAN_MAX_SSID_LENGTH (32U) +/** MLAN Maximum PASSPHRASE Length */ +#define MLAN_MAX_PASS_LENGTH (64) + +/** Scan result information */ +struct wifi_scan_result2 +{ + uint8_t bssid[MLAN_MAC_ADDR_LENGTH]; /*!< BSSID array */ + bool is_ibss_bit_set; /*!< Is bssid set? */ + + uint8_t ssid[MLAN_MAX_SSID_LENGTH]; /*!< ssid array */ + int ssid_len; /*!< SSID length */ + uint8_t Channel; /*!< Channel associated to the BSSID */ + uint8_t RSSI; /*!< Received signal strength */ + uint16_t beacon_period; /*!< Beacon period */ + uint16_t dtim_period; /*!< DTIM period */ + _SecurityMode_t WPA_WPA2_WEP; /*!< Security mode info */ + _Cipher_t wpa_mcstCipher; /*!< WPA multicast cipher */ + _Cipher_t wpa_ucstCipher; /*!< WPA unicast cipher */ + _Cipher_t rsn_mcstCipher; /*!< No security multicast cipher */ + _Cipher_t rsn_ucstCipher; /*!< No security unicast cipher */ + bool is_pmf_required; /*!< Is pmf required flag */ + t_u8 ap_mfpc; /*!< MFPC bit of AP */ + t_u8 ap_mfpr; /*!< MFPR bit of AP */ + t_u8 ap_pwe; /*!< PWE bit of AP */ + + /*!< + ** WPA_WPA2 = 0 => Security not enabled + ** = 1 => WPA mode + ** = 2 => WPA2 mode + ** = 3 => WEP mode + */ + bool phtcap_ie_present; /*!< PHT CAP IE present info */ + bool phtinfo_ie_present; /*!< PHT INFO IE present info */ +#if CONFIG_11AC + /** 11AC VHT capab support */ + bool pvhtcap_ie_present; +#endif +#if CONFIG_11AX + /** 11AX HE capab support */ + bool phecap_ie_present; +#endif + + bool wmm_ie_present; /*!< WMM IE present info */ + uint16_t band; /*!< Band info */ + + bool wps_IE_exist; /*!< WPS IE exist info */ + uint16_t wps_session; /*!< WPS session */ + bool wpa2_entp_IE_exist; /*!< WPA2 enterprise IE exist info */ + uint8_t trans_mode; /*!< Trans mode */ + uint8_t trans_bssid[MLAN_MAC_ADDR_LENGTH]; /*!< Trans bssid array */ + uint8_t trans_ssid[MLAN_MAX_SSID_LENGTH]; /*!< Trans ssid array */ + int trans_ssid_len; /*!< Trans bssid length */ +#if CONFIG_DRIVER_MBO + bool mbo_assoc_disallowed; /*!< MBO disallowed */ +#endif +#if CONFIG_11R + /** Mobility domain identifier */ + uint16_t mdid; +#endif +#if CONFIG_11K + /** Neigbort report support */ + bool neighbor_report_supported; +#endif +#if CONFIG_11V + /** bss transition support */ + bool bss_transition_supported; +#endif +}; + +/** MAC address */ +typedef struct +{ + /** Mac address array */ + char mac[MLAN_MAC_ADDR_LENGTH]; +} wifi_mac_addr_t; + +/** Firmware version */ +typedef struct +{ + /** Firmware version string */ + char version_str[MLAN_MAX_VER_STR_LEN]; +} wifi_fw_version_t; + +/** Extended Firmware version */ +typedef struct +{ + /** ID for extended version select */ + uint8_t version_str_sel; + /** Firmware version string */ + char version_str[MLAN_MAX_VER_STR_LEN]; +} wifi_fw_version_ext_t; + +enum wlan_type +{ + WLAN_TYPE_NORMAL = 0, + WLAN_TYPE_WIFI_CALIB, + WLAN_TYPE_FCC_CERTIFICATION, +}; + +/** Tx power levels */ +typedef struct +{ + /** Current power level */ + uint16_t current_level; + /** Maximum power level */ + uint8_t max_power; + /** Minimum power level */ + uint8_t min_power; + +} wifi_tx_power_t; + +/** Rf channel */ +typedef struct +{ + /** Current channel */ + uint16_t current_channel; + /** RF Type */ + uint16_t rf_type; +} wifi_rf_channel_t; + +/** Remain on channel info structure */ +typedef struct +{ + /** Remove */ + uint16_t remove; + /** Current status */ + uint8_t status; + /** band configuration */ + uint8_t bandcfg; + /** Channel */ + uint8_t channel; + /** Remain on channel period */ + uint32_t remain_period; +} wifi_remain_on_channel_t; + +#if CONFIG_11AX +/** TX Rate Setting */ +typedef PACK_START struct _txrate_setting +{ + /** Preamble */ + t_u16 preamble : 2; /*BIT1-BIT0: + * For legacy 11b: preamble type + * 00 = long + * 01 = short + * 10/11 = reserved + * For legacy 11g: reserved + * For 11n: Green field PPDU indicator + * 00 = HT-mix + * 01 = HT-GF + * 10/11 = reserved. + * For 11ac: reserved. + * For 11ax: + * 00 = HE-SU + * 01 = HE-EXT-SU + * 10 = HE-MU + * 11 = HE trigger based + */ + /** Bandwidth */ + t_u16 bandwidth : 3; /* BIT2- BIT4 + * For 11n and 11ac traffic: Bandwidth + * 0 = 20Mhz + * 1 = 40Mhz + * 2 = 80 Mhz + * 3 = 160 Mhz + * 4-7 = reserved + * For legacy rate : BW>0 implies non-HT duplicates. + * For HE SU PPDU: + * 0 = 20Mhz + * 1 = 40Mhz + * 2 = 80 Mhz + * 3 = 160 Mhz + * 4-7 = reserved + * For HE ER SU PPDU: + * 0 = 242-tone RU + * 1 = upper frequency 106 tone RU within the primary 20 Mhz. + * For HE MU PPDU: + * 0 = 20Mhz. + * 1 = 40Mhz. + * 2 = 80Mhz non-preamble puncturing mode + * 3 = 160Mhz and 80+80 Mhz non-preamble. + * 4 = for preemble puncturing in 80 Mhz , + * where in the preamble only the secondary 20Mhz is punctured. + * 5 = for preemble puncturing in 80 Mhz , + * where in the preamble only one of the two 20Mhz subchannels in the secondary 40Mhz is + * punctured. 6 = for preemble puncturing in 160 Mhz or 80 Mhz + 80 Mhz, where in the primary + * 80 Mhz of the preamble only the secondary 20 Mhz is punctured. 7 = for preemble puncturing + * in 160 Mhz or 80 Mhz + 80 Mhz, where in the primary 80 Mhz of the preamble the primary 40 + * Mhz is present. + */ + /** Short GI */ + t_u16 shortGI : 2; /*BIT5- BIT6 + * For legacy: not used + * For 11n: 00 = normal, 01 =shortGI, 10/11 = reserved + * For 11ac: SGI map to VHT-SIG-A2[0] + * VHT-SIG-A2[1] is set to 1 if short guard interval is used + * and NSYM mod 10 = 9, otherwise set to 0. + * For 11ax: + * 00 = 1xHELTF+GI0.8usec + * 01 = 2xHELTF+GI0.8usec + * 10 = 2xHELTF+GI1.6usec + * 11 = 4xHELTF+GI0.8 usec if both DCM and STBC are 1 + * 4xHELTF+GI3.2 usec otherwise + */ + /** STBC */ + t_u16 stbc : 1; // BIT7, 0: no STBC; 1: STBC + /** DCM */ + t_u16 dcm : 1; // BIT8, 0: no DCM; 1: DCM used. + /** Adv coding */ + t_u16 adv_coding : 1; // BIT9, 0: BCC; 1: LDPC. + /** Doppler */ + t_u16 doppler : 2; /* BIT11-BIT10, + 00: Doppler0 + 01: Doppler 1 with Mma =10 + 10: Doppler 1 with Mma =20 + */ + /** Max PK text */ + t_u16 max_pktext : 2; /*BIT12-BIT13: + * Max packet extension + * 0 - 0 usec + * 1 - 8 usec + * 2 - 16 usec. + */ + /** Reserved */ + t_u16 reserverd : 2; // BIT14-BIT15 +} PACK_END txrate_setting; + +#if CONFIG_MMSF +typedef struct +{ + t_u8 *enable; + t_u8 *Density; + t_u8 *MMSF; +} wifi_mmsf_cfg_t; +#endif +#endif + +/** Data structure for cmd txratecfg */ +typedef PACK_START struct _wifi_rate_cfg_t +{ + /** LG rate: 0, HT rate: 1, VHT rate: 2 */ + mlan_rate_format rate_format; + /** Rate/MCS index (0xFF: auto) */ + t_u32 rate_index; + /** Rate rate */ + t_u32 rate; +#if (CONFIG_11AC) || (CONFIG_11AX) + /** NSS */ + t_u32 nss; +#endif + /** Rate Setting */ + t_u16 rate_setting; +} PACK_END wifi_rate_cfg_t; + +/** Data structure for cmd get data rate */ +typedef PACK_START struct _wifi_data_rate_t +{ + /** Tx data rate */ + t_u32 tx_data_rate; + /** Rx data rate */ + t_u32 rx_data_rate; + + /** Tx channel bandwidth */ + t_u32 tx_bw; + /** Tx guard interval */ + t_u32 tx_gi; + /** Rx channel bandwidth */ + t_u32 rx_bw; + /** Rx guard interval */ + t_u32 rx_gi; + +#ifndef SD8801 + /** MCS index */ + t_u32 tx_mcs_index; + /** MCS index */ + t_u32 rx_mcs_index; +#if (CONFIG_11AC) || (CONFIG_11AX) + /** NSS */ + t_u32 tx_nss; + /** NSS */ + t_u32 rx_nss; +#endif + /** LG rate: 0, HT rate: 1, VHT rate: 2 */ + mlan_rate_format tx_rate_format; + /** LG rate: 0, HT rate: 1, VHT rate: 2 */ + mlan_rate_format rx_rate_format; +#endif +} PACK_END wifi_data_rate_t; + +enum wifi_ds_command_type +{ + WIFI_DS_RATE_CFG = 0, + WIFI_DS_GET_DATA_RATE = 1, +}; + +/** Type definition of wifi_ds_rate */ +typedef PACK_START struct _wifi_ds_rate +{ + /** Sub-command */ + enum wifi_ds_command_type sub_command; +#if CONFIG_AUTO_NULL_TX + /** Only set auto tx fix rate */ + t_u16 auto_null_fixrate_enable; +#endif + /** Rate configuration parameter */ + union + { + /** Rate configuration for MLAN_OID_RATE_CFG */ + wifi_rate_cfg_t rate_cfg; + /** Data rate for MLAN_OID_GET_DATA_RATE */ + wifi_data_rate_t data_rate; + } param; +} PACK_END wifi_ds_rate; + +/** Type definition of wifi_ed_mac_ctrl_t */ +typedef PACK_START struct _wifi_ed_mac_ctrl_t +{ + /** ED CTRL 2G */ + t_u16 ed_ctrl_2g; + /** ED Offset 2G */ + t_s16 ed_offset_2g; + /** ED CTRL 5G */ + t_u16 ed_ctrl_5g; + /** ED Offset 5G */ + t_s16 ed_offset_5g; +} PACK_END wifi_ed_mac_ctrl_t; + +/** Type definition of wifi_bandcfg_t */ +typedef PACK_START struct _wifi_bandcfg_t +{ + /** Infra band */ + t_u16 config_bands; + /** fw supported band */ + t_u16 fw_bands; +} PACK_END wifi_bandcfg_t; + +#ifdef SD8801 +/** Type definition of wifi_ext_coex_config_t */ +typedef PACK_START struct _wifi_ext_coex_config_t +{ + /** Enable or disable external coexistence */ + t_u8 Enabled; + /** Ignore the priority of the external radio request */ + t_u8 IgnorePriority; + /** Default priority when the priority of the external radio +request is ignored */ + t_u8 DefaultPriority; + /** Input request GPIO pin for EXT_RADIO_REQ signal */ + t_u8 EXT_RADIO_REQ_ip_gpio_num; + /** Input request GPIO polarity for EXT_RADIO_REQ signal */ + t_u8 EXT_RADIO_REQ_ip_gpio_polarity; + /** Input priority GPIO pin for EXT_RADIO_PRI signal */ + t_u8 EXT_RADIO_PRI_ip_gpio_num; + /** Input priority GPIO polarity for EXT_RADIO_PRI signal */ + t_u8 EXT_RADIO_PRI_ip_gpio_polarity; + /** Output grant GPIO pin for WLAN_GRANT signal */ + t_u8 WLAN_GRANT_op_gpio_num; + /** Output grant GPIO polarity of WLAN_GRANT */ + t_u8 WLAN_GRANT_op_gpio_polarity; + /** Reserved Bytes */ + t_u16 reserved_1; + /** Reserved Bytes */ + t_u16 reserved_2; +} PACK_END wifi_ext_coex_config_t; + +/** Type definition of wifi_ext_coex_stats_t */ +typedef PACK_START struct _wifi_ext_coex_stats_t +{ + /** External Radio Request count */ + t_u16 ext_radio_req_count; + /** External Radio Priority count */ + t_u16 ext_radio_pri_count; + /** WLAN GRANT count */ + t_u16 wlan_grant_count; +} PACK_END wifi_ext_coex_stats_t; +#endif + +/** Type definition of wifi_antcfg_t */ +typedef PACK_START struct _wifi_antcfg_t +{ + /** Antenna Mode */ + t_u32 *ant_mode; + /** Evaluate Time */ + t_u16 *evaluate_time; + /** Current antenna*/ + t_u16 *current_antenna; +#ifdef RW610 + /** Evaluate mode */ + t_u8 *evaluate_mode; +#endif +} PACK_END wifi_antcfg_t; + +/** CW_MODE_CTRL structure */ +typedef PACK_START struct _wifi_cw_mode_ctrl_t +{ + /** Mode of Operation 0:Disable 1: Tx Continuous Packet 2 : Tx + Continuous Wave */ + t_u8 mode; + /** channel */ + t_u8 channel; + /** channel info */ + t_u8 chanInfo; + /** Tx Power level in dBm */ + t_u16 txPower; + /** Packet Length */ + t_u16 pktLength; + /** bit rate info */ + t_u32 rateInfo; +} PACK_END wifi_cw_mode_ctrl_t; + +/** TBTT offset structure */ +typedef struct +{ + /** Min TBTT offset */ + t_u32 min_tbtt_offset; + /** Max TBTT offset */ + t_u32 max_tbtt_offset; + /** AVG TBTT offset */ + t_u32 avg_tbtt_offset; +} wifi_tbtt_offset_t; + +#ifndef BIT +#define BIT(n) (1U << (n)) +#endif +#define WOWLAN_MAX_PATTERN_LEN 20 +#define WOWLAN_MAX_OFFSET_LEN 50 +#define MAX_NUM_FILTERS 10 +#define MEF_MODE_HOST_SLEEP (1 << 0) +#define MEF_MODE_NON_HOST_SLEEP (1 << 1) +#define MEF_ACTION_WAKE (1 << 0) +#define MEF_ACTION_ALLOW (1 << 1) +#define MEF_ACTION_ALLOW_AND_WAKEUP_HOST 3 +#define MEF_AUTO_ARP 0x10 +#define MEF_AUTO_PING 0x20 +#define MEF_NS_RESP 0x40 +#define MEF_MAGIC_PKT 0x80 +#define CRITERIA_BROADCAST MBIT(0) +#define CRITERIA_UNICAST MBIT(1) +#define CRITERIA_MULTICAST MBIT(3) + +#define MAX_NUM_ENTRIES 8 +#define MAX_NUM_BYTE_SEQ 6 +#define MAX_NUM_MASK_SEQ 6 + +#define OPERAND_DNUM 1 +#define OPERAND_BYTE_SEQ 2 + +#define MAX_OPERAND 0x40 +#define TYPE_BYTE_EQ (MAX_OPERAND + 1) +#define TYPE_DNUM_EQ (MAX_OPERAND + 2) +#define TYPE_BIT_EQ (MAX_OPERAND + 3) + +#define RPN_TYPE_AND (MAX_OPERAND + 4) +#define RPN_TYPE_OR (MAX_OPERAND + 5) + +#define ICMP_OF_IP_PROTOCOL 0x01 +#define TCP_OF_IP_PROTOCOL 0x06 +#define UDP_OF_IP_PROTOCOL 0x11 + +#define IPV4_PKT_OFFSET 20 +#define IP_PROTOCOL_OFFSET 31 +#define PORT_PROTOCOL_OFFSET 44 + +#define FILLING_TYPE MBIT(0) +#define FILLING_PATTERN MBIT(1) +#define FILLING_OFFSET MBIT(2) +#define FILLING_NUM_BYTES MBIT(3) +#define FILLING_REPEAT MBIT(4) +#define FILLING_BYTE_SEQ MBIT(5) +#define FILLING_MASK_SEQ MBIT(6) + +/** Type definition of filter_item + * support three match methods: + * <1>Byte comparison type=0x41 + * <2>Decimal comparison type=0x42 + * <3>Bit comparison type=0x43 + */ +typedef struct _wifi_mef_filter_t +{ + /** flag*/ + t_u32 fill_flag; + /** BYTE 0X41; Decimal 0X42; Bit 0x43*/ + t_u16 type; + /** value*/ + t_u32 pattern; + /** offset*/ + t_u16 offset; + /** number of bytes*/ + t_u16 num_bytes; + /** repeat*/ + t_u16 repeat; + /** byte number*/ + t_u8 num_byte_seq; + /** array*/ + t_u8 byte_seq[MAX_NUM_BYTE_SEQ]; + /** mask numbers*/ + t_u8 num_mask_seq; + /** array*/ + t_u8 mask_seq[MAX_NUM_MASK_SEQ]; +} wifi_mef_filter_t; + +/** MEF entry struct */ +typedef struct _wifi_mef_entry_t +{ + /** mode: bit0--hostsleep mode; bit1--non hostsleep mode */ + t_u8 mode; + /** action: 0--discard and not wake host; + 1--discard and wake host; + 3--allow and wake host;*/ + t_u8 action; + /** filter number */ + t_u8 filter_num; + /** filter array*/ + wifi_mef_filter_t filter_item[MAX_NUM_FILTERS]; + /** rpn array*/ + t_u8 rpn[MAX_NUM_FILTERS]; +} wifi_mef_entry_t; + +/** Wifi filter config struct */ +typedef struct _wifi_flt_cfg +{ + /** Filter Criteria */ + t_u32 criteria; + /** Number of entries */ + t_u16 nentries; + /** MEF entry*/ + wifi_mef_entry_t mef_entry[MAX_NUM_ENTRIES]; +} wifi_flt_cfg_t; + +/* User defined pattern struct */ +typedef struct +{ + /** pattern offset of received pattern */ + t_u8 pkt_offset; + /** pattern length */ + t_u8 pattern_len; + /** wowlan pattern */ + t_u8 pattern[WOWLAN_MAX_PATTERN_LEN]; + /** mask */ + t_u8 mask[6]; +} wifi_wowlan_pattern_t; + +/** Wowlan Pattern config struct */ +typedef struct +{ + /** Enable user defined pattern*/ + t_u8 enable; + /** number of patterns******/ + t_u8 n_patterns; + /** user define pattern*/ + wifi_wowlan_pattern_t patterns[MAX_NUM_FILTERS]; +} wifi_wowlan_ptn_cfg_t; + +/** TCP keep alive information */ +typedef struct +{ + /** Enable keep alive */ + t_u8 enable; + /** Reset */ + t_u8 reset; + /** Keep alive timeout */ + t_u32 timeout; + /** Keep alive interval */ + t_u16 interval; + /** Maximum keep alives */ + t_u16 max_keep_alives; + /** Destination MAC address */ + t_u8 dst_mac[MLAN_MAC_ADDR_LENGTH]; + /** Destination IP */ + t_u32 dst_ip; + /** Destination TCP port */ + t_u16 dst_tcp_port; + /** Source TCP port */ + t_u16 src_tcp_port; + /** Sequence number */ + t_u32 seq_no; +} wifi_tcp_keep_alive_t; + +/** TCP nat keep alive information */ +typedef struct +{ + /** Keep alive interval */ + t_u16 interval; + /** Destination MAC address */ + t_u8 dst_mac[MLAN_MAC_ADDR_LENGTH]; + /** Destination IP */ + t_u32 dst_ip; + /** Destination port */ + t_u16 dst_port; +} wifi_nat_keep_alive_t; + +#if CONFIG_CLOUD_KEEP_ALIVE +#define MKEEP_ALIVE_IP_PKT_MAX 256 +/** Cloud keep alive information */ +typedef struct +{ + /** Keep alive id */ + t_u8 mkeep_alive_id; + /** Enable keep alive */ + t_u8 enable; + /** Enable/Disable tcp reset */ + t_u8 reset; + /** Saved in driver */ + t_u8 cached; + /** Period to send keep alive packet(The unit is milliseconds) */ + t_u32 send_interval; + /** Period to send retry packet(The unit is milliseconds) */ + t_u16 retry_interval; + /** Count to send retry packet */ + t_u16 retry_count; + /** Source MAC address */ + t_u8 src_mac[MLAN_MAC_ADDR_LENGTH]; + /** Destination MAC address */ + t_u8 dst_mac[MLAN_MAC_ADDR_LENGTH]; + /** Source IP */ + t_u32 src_ip; + /** Destination IP */ + t_u32 dst_ip; + /** Source Port */ + t_u16 src_port; + /** Destination Port */ + t_u16 dst_port; + /** Packet length */ + t_u16 pkt_len; + /** Packet buffer */ + t_u8 packet[MKEEP_ALIVE_IP_PKT_MAX]; +} wifi_cloud_keep_alive_t; +#endif + +/** RSSI information */ +typedef struct +{ + /** Data RSSI last */ + int16_t data_rssi_last; + /** Data nf last */ + int16_t data_nf_last; + /** Data RSSI average */ + int16_t data_rssi_avg; + /** Data nf average */ + int16_t data_nf_avg; + /** BCN SNR */ + int16_t bcn_snr_last; + /** BCN SNR average */ + int16_t bcn_snr_avg; + /** Data SNR last */ + int16_t data_snr_last; + /** Data SNR average */ + int16_t data_snr_avg; + /** BCN RSSI */ + int16_t bcn_rssi_last; + /** BCN nf */ + int16_t bcn_nf_last; + /** BCN RSSI average */ + int16_t bcn_rssi_avg; + /** BCN nf average */ + int16_t bcn_nf_avg; +} wifi_rssi_info_t; + +/** + * Data structure for subband set + * + * For uAP 11d support + */ +typedef struct +{ + /** First channel */ + t_u8 first_chan; + /** Number of channels */ + t_u8 no_of_chan; + /** Maximum Tx power in dBm */ + t_u8 max_tx_pwr; + +} wifi_sub_band_set_t; + +/** + * Data structure for Channel attributes + * + */ +typedef PACK_START struct +{ + /** Channel Number */ + t_u8 chan_num; + /** Channel frequency for this channel */ + t_u16 chan_freq; + /** Passice Scan or RADAR Detect*/ + bool passive_scan_or_radar_detect; +} PACK_END wifi_chan_info_t; + +/** + * Data structure for Channel List Config + * + */ +typedef PACK_START struct +{ + /** Number of Channels */ + t_u8 num_chans; + /** Channel Info */ + wifi_chan_info_t chan_info[54]; +} PACK_END wifi_chanlist_t; + +/** Wifi subband enum */ +typedef enum +{ + /** Subband 2.4 GHz */ + SubBand_2_4_GHz = 0x00, + /** Subband 5 GHz 0 */ + SubBand_5_GHz_0 = 0x10, + /** Subband 5 GHz 1 */ + SubBand_5_GHz_1 = 0x11, + /** Subband 5 GHz 2 */ + SubBand_5_GHz_2 = 0x12, + /** Subband 5 GHz 3 */ + SubBand_5_GHz_3 = 0x13, +} wifi_SubBand_t; + +/** + * Data structure for Channel descriptor + * + * Set CFG data for Tx power limitation + * + * start_freq: Starting Frequency of the band for this channel\n + * 2407, 2414 or 2400 for 2.4 GHz\n + * 5000\n + * 4000\n + * chan_width: Channel Width\n + * 20\n + * chan_num : Channel Number\n + * + */ +typedef PACK_START struct +{ + /** Starting frequency of the band for this channel */ + t_u16 start_freq; + /** Channel width */ + t_u8 chan_width; + /** Channel Number */ + t_u8 chan_num; +} PACK_END wifi_channel_desc_t; + +/** + * Data structure for Modulation Group + * + * mod_group : ModulationGroup\n + * 0: CCK (1,2,5.5,11 Mbps)\n + * 1: OFDM (6,9,12,18 Mbps)\n + * 2: OFDM (24,36 Mbps)\n + * 3: OFDM (48,54 Mbps)\n + * 4: HT20 (0,1,2)\n + * 5: HT20 (3,4)\n + * 6: HT20 (5,6,7)\n + * 7: HT40 (0,1,2)\n + * 8: HT40 (3,4)\n + * 9: HT40 (5,6,7)\n + * 10: HT2_20 (8,9,10)\n + * 11: HT2_20 (11,12)\n + * 12: HT2_20 (13,14,15)\n + *tx_power : Power Limit in dBm\n + * + */ +typedef PACK_START struct +{ + /** Modulation group */ + t_u8 mod_group; + /** Tx Power */ + t_u8 tx_power; +} PACK_END wifi_txpwrlimit_entry_t; + +/** + * Data structure for TRPC config + * + * For TRPC support + */ +typedef PACK_START struct +{ + /** Number of modulation groups */ + t_u8 num_mod_grps; + /** Chnannel descriptor */ + wifi_channel_desc_t chan_desc; + /** Channel Modulation groups */ +#if CONFIG_11AX + wifi_txpwrlimit_entry_t txpwrlimit_entry[20]; +#elif (CONFIG_11AC) + wifi_txpwrlimit_entry_t txpwrlimit_entry[16]; +#else + wifi_txpwrlimit_entry_t txpwrlimit_entry[10]; +#endif /* CONFIG_11AX */ +} PACK_END wifi_txpwrlimit_config_t; + +/** + * Data structure for Channel TRPC config + * + * For TRPC support + */ +typedef PACK_START struct +{ + /** SubBand */ + wifi_SubBand_t subband; + /** Number of Channels */ + t_u8 num_chans; + /** TRPC config */ +#if defined(SD9177) + wifi_txpwrlimit_config_t txpwrlimit_config[43]; +#else + wifi_txpwrlimit_config_t txpwrlimit_config[40]; +#endif +} PACK_END wifi_txpwrlimit_t; + +#if CONFIG_11AX +typedef PACK_START struct _wifi_rupwrlimit_config_t +{ + /** start freq */ + t_u16 start_freq; + /* channel width */ + t_u8 width; + /** channel number */ + t_u8 chan_num; + /** chan ru Power */ + t_s16 ruPower[MAX_RU_COUNT]; +} PACK_END wifi_rupwrlimit_config_t; + +/** + * Data structure for Channel RU PWR config + * + * For RU PWR support + */ +typedef PACK_START struct +{ + /** Number of Channels */ + t_u8 num_chans; + /** RU PWR config */ + wifi_rupwrlimit_config_t rupwrlimit_config[MAX_RUTXPWR_NUM]; +} PACK_END wifi_rutxpwrlimit_t; + +/** Wi-Fi 11AX Configuration */ +typedef PACK_START struct +{ + /** Band */ + t_u8 band; + /** tlv id of he capability */ + t_u16 id; + /** length of the payload */ + t_u16 len; + /** extension id */ + t_u8 ext_id; + /** he mac capability info */ + t_u8 he_mac_cap[6]; + /** he phy capability info */ + t_u8 he_phy_cap[11]; + /** he txrx mcs support for 80MHz */ + t_u8 he_txrx_mcs_support[4]; + /** val for PE thresholds */ + t_u8 val[4]; +} PACK_END wifi_11ax_config_t; + +#if CONFIG_11AX_TWT +/** Wi-Fi TWT setup configuration */ +typedef PACK_START struct +{ + /** Implicit, 0: TWT session is explicit, 1: Session is implicit */ + t_u8 implicit; + /** Announced, 0: Unannounced, 1: Announced TWT */ + t_u8 announced; + /** Trigger Enabled, 0: Non-Trigger enabled, 1: Trigger enabled TWT */ + t_u8 trigger_enabled; + /** TWT Information Disabled, 0: TWT info enabled, 1: TWT info disabled */ + t_u8 twt_info_disabled; + /** Negotiation Type, 0: Future Individual TWT SP start time, 1: Next + * Wake TBTT time */ + t_u8 negotiation_type; + /** TWT Wakeup Duration, time after which the TWT requesting STA can + * transition to doze state */ + t_u8 twt_wakeup_duration; + /** Flow Identifier. Range: [0-7]*/ + t_u8 flow_identifier; + /** Hard Constraint, 0: FW can tweak the TWT setup parameters if it is + *rejected by AP. + ** 1: Firmware should not tweak any parameters. */ + t_u8 hard_constraint; + /** TWT Exponent, Range: [0-63] */ + t_u8 twt_exponent; + /** TWT Mantissa Range: [0-sizeof(UINT16)] */ + t_u16 twt_mantissa; + /** TWT Request Type, 0: REQUEST_TWT, 1: SUGGEST_TWT*/ + t_u8 twt_request; + /** TWT Setup State. Set to 0 by driver, filled by FW in response*/ + t_u8 twt_setup_state; + /** TWT link lost timeout threshold */ + t_u16 bcnMiss_threshold; +} PACK_END wifi_twt_setup_config_t; + +/** Wi-Fi Teardown Configuration */ +typedef PACK_START struct +{ + /** TWT Flow Identifier. Range: [0-7] */ + t_u8 flow_identifier; + /** Negotiation Type. 0: Future Individual TWT SP start time, 1: Next + * Wake TBTT time */ + t_u8 negotiation_type; + /** Tear down all TWT. 1: To teardown all TWT, 0 otherwise */ + t_u8 teardown_all_twt; +} PACK_END wifi_twt_teardown_config_t; + +/** Wi-Fi BTWT Configuration */ +typedef PACK_START struct +{ + /** Only support 1: Set*/ + t_u16 action; + /** Broadcast TWT AP config */ + t_u16 sub_id; + /** Range 64-255 */ + t_u8 nominal_wake; + /** Max STA Support */ + t_u8 max_sta_support; + /** TWT Mantissa */ + t_u16 twt_mantissa; + /** TWT Offset */ + t_u16 twt_offset; + /** TWT Exponent */ + t_u8 twt_exponent; + /** SP Gap */ + t_u8 sp_gap; +} PACK_END wifi_btwt_config_t; + +#define WLAN_BTWT_REPORT_LEN 9 +#define WLAN_BTWT_REPORT_MAX_NUM 4 +/** Wi-Fi TWT Report Configuration */ +typedef PACK_START struct +{ + /** TWT report type, 0: BTWT id */ + t_u8 type; + /** TWT report length of value in data */ + t_u8 length; + /** Reserved 2 */ + t_u8 reserve[2]; + /** TWT report buffer */ + t_u8 data[WLAN_BTWT_REPORT_LEN * WLAN_BTWT_REPORT_MAX_NUM]; +} PACK_END wifi_twt_report_t; + +typedef PACK_START struct +{ + /** TWT Flow Identifier. Range: [0-7] */ + t_u8 flow_identifier; + /** TWT operation suspend duration in milli seconds. */ + t_u32 suspend_duration; + /** TWT information state from FW. */ + t_u8 information_state; +} PACK_END wifi_twt_information_t; +#endif /* CONFIG_11AX_TWT */ +#endif + +#if CONFIG_WIFI_CLOCKSYNC +/** Wi-Fi Clock sync configuration */ +typedef PACK_START struct +{ + /**clock sync Mode */ + t_u8 clock_sync_mode; + /**clock sync Role */ + t_u8 clock_sync_Role; + /**clock sync GPIO Pin Number */ + t_u8 clock_sync_gpio_pin_number; + /**clock sync GPIO Level or Toggle */ + t_u8 clock_sync_gpio_level_toggle; + /**clock sync GPIO Pulse Width */ + t_u16 clock_sync_gpio_pulse_width; +} PACK_END wifi_clock_sync_gpio_tsf_t; + +/** Wi-Fi TSF information */ +typedef PACK_START struct +{ + /**get tsf info format */ + t_u16 tsf_format; + /**tsf info */ + t_u16 tsf_info; + /**tsf */ + t_u64 tsf; + /**Positive or negative offset in microsecond from Beacon TSF to GPIO toggle TSF */ + t_s32 tsf_offset; +} PACK_END wifi_tsf_info_t; +#endif /* CONFIG_WIFI_CLOCKSYNC */ +#if CONFIG_WLAN_BRIDGE +/** + * Data structure for Bridge Autolink Configuration + */ +typedef struct +{ + /** Auto Link Periodical scan interval */ + uint32_t scan_timer_interval; + /** The condition triggers Auto Link periodical scan + * 0: trigger scan when current link is not good + * 1: trigger scan by host setting(always periodical scan) + */ + uint8_t scan_timer_condition; + /** Auto Link periodical scan channel list: + * 0: only scan with previous In-STA associated channel + * 1: 2.4G all channels + */ + uint8_t scan_channel_list; +} wifi_autolink_cfg_t; + +/** + * Data structure for Bridge Configuration + */ +#define ENABLE_AUTOLINK_BIT 1 +#define HIDDEN_SSID_BIT 2 +typedef struct +{ + /** Bit 0: Enable/Disable bridge mode, + * Bit 1: Enable/Disable auto link, + * Bit 2: Enable/Disable hidden ssid + */ + uint8_t enable; + /** Auto Link */ + bool auto_link; + /** Hideen Bridge SSID */ + bool hidden_ssid; + /** EX-AP SSID Length */ + uint8_t ex_ap_ssid_len; + /** EX-AP SSID */ + char ex_ap_ssid[MLAN_MAX_SSID_LENGTH]; + /** EX-AP Passphrase length */ + uint8_t ex_ap_pass_len; + /** EX-AP Passphrase */ + char ex_ap_pass[MLAN_MAX_PASS_LENGTH]; + /** Bridge SSID Length */ + uint8_t bridge_ssid_len; + /** Bridge SSID */ + char bridge_ssid[MLAN_MAX_SSID_LENGTH]; + /** Bridge Passphrase length */ + uint8_t bridge_pass_len; + /** Bridge Passphrase */ + char bridge_pass[MLAN_MAX_PASS_LENGTH]; + /**auto link configuration*/ + wifi_autolink_cfg_t autolink; +} wifi_bridge_cfg_t; +#endif + +#if CONFIG_NET_MONITOR +typedef t_u8 wifi_802_11_mac_addr[MLAN_MAC_ADDR_LENGTH]; + +/** Network monitor structure */ +typedef PACK_START struct +{ + /** Action */ + t_u16 action; + /** Monitor activity */ + t_u16 monitor_activity; + /** Filter flags */ + t_u16 filter_flags; + /** Channel scan parameter : Radio type */ + t_u8 radio_type; + /** Channel number */ + t_u8 chan_number; + /** mac num of filter*/ + t_u8 filter_num; + /** Source address of the packet to receive */ + wifi_802_11_mac_addr mac_addr[MAX_MONIT_MAC_FILTER_NUM]; +} PACK_END wifi_net_monitor_t; + +/** Beacon information structure */ +typedef PACK_START struct +{ + /** Frame control flags */ + uint8_t frame_ctrl_flags; + uint16_t duration; + /** Destination MAC address */ + char dest[MLAN_MAC_ADDR_LENGTH]; + /** Source MAC address */ + char src[MLAN_MAC_ADDR_LENGTH]; + /** BSSID */ + char bssid[MLAN_MAC_ADDR_LENGTH]; + uint16_t seq_frag_num; + /** Timestamp */ + uint8_t timestamp[8]; + uint16_t beacon_interval; + uint16_t cap_info; + uint8_t ssid_element_id; + /** SSID Length */ + uint8_t ssid_len; + /* SSID */ + char ssid[MLAN_MAX_SSID_LENGTH]; +} PACK_END wifi_beacon_info_t; + +/** Wifi data information */ +typedef PACK_START struct +{ + /** Frame control flags */ + uint8_t frame_ctrl_flags; + uint16_t duration; + char bssid[MLAN_MAC_ADDR_LENGTH]; + /** Source MAC address */ + char src[MLAN_MAC_ADDR_LENGTH]; + /** Destination MAC address */ + char dest[MLAN_MAC_ADDR_LENGTH]; + uint16_t seq_frag_num; + /** QOS control */ + uint16_t qos_ctrl; +} PACK_END wifi_data_info_t; +#endif +/** Wifi frame types */ +typedef enum +{ + /** Assoc request frame */ + ASSOC_REQ_FRAME = 0x00, + /** Assoc response frame */ + ASSOC_RESP_FRAME = 0x10, + /** ReAssoc request frame */ + REASSOC_REQ_FRAME = 0x20, + /** ReAssoc response frame */ + REASSOC_RESP_FRAME = 0x30, + /** Probe request frame */ + PROBE_REQ_FRAME = 0x40, + /** Probe response frame */ + PROBE_RESP_FRAME = 0x50, + /** BEACON frame */ + BEACON_FRAME = 0x80, + /** Dis assoc frame */ + DISASSOC_FRAME = 0xA0, + /** Auth frame */ + AUTH_FRAME = 0xB0, + /** Deauth frame */ + DEAUTH_FRAME = 0xC0, + /** Action frame */ + ACTION_FRAME = 0xD0, + /** Data frame */ + DATA_FRAME = 0x08, + /** QOS frame */ + QOS_DATA_FRAME = 0x88, +} wifi_frame_type_t; + +typedef PACK_START struct +{ + wifi_frame_type_t frame_type; +#if CONFIG_NET_MONITOR + union + { + wifi_beacon_info_t beacon_info; + wifi_data_info_t data_info; + } frame_data; +#endif +} PACK_END wifi_frame_t; + +typedef struct +{ + uint8_t mfpc; + uint8_t mfpr; +} wifi_pmf_params_t; + +/** Channel scan parameters */ +typedef struct +{ + /** channel number */ + t_u8 chan_number; + /** minimum scan time */ + t_u16 min_scan_time; + /** maximum scan time */ + t_u16 max_scan_time; +} wifi_chan_scan_param_set_t; + +/** Channel list parameter set */ +typedef struct +{ + /** number of channels */ + t_u8 no_of_channels; + /** channel scan array */ + wifi_chan_scan_param_set_t chan_scan_param[1]; +} wifi_chan_list_param_set_t; + +/** 802_11_header packet */ +typedef PACK_START struct _wifi_mgmt_frame_t +{ + /** Packet Length */ + t_u16 frm_len; + /** Frame Type */ + wifi_frame_type_t frame_type; + /** Frame Control flags */ + t_u8 frame_ctrl_flags; + /** Duration ID */ + t_u16 duration_id; + /** Address 1 */ + t_u8 addr1[MLAN_MAC_ADDR_LENGTH]; + /** Address 2 */ + t_u8 addr2[MLAN_MAC_ADDR_LENGTH]; + /** Address 3 */ + t_u8 addr3[MLAN_MAC_ADDR_LENGTH]; + /** Sequence Control */ + t_u16 seq_ctl; + /** Address 4 */ + t_u8 addr4[MLAN_MAC_ADDR_LENGTH]; + /** Frame payload */ + t_u8 payload[1]; +} PACK_END wifi_mgmt_frame_t; + +/** Calibration Data */ +typedef PACK_START struct _wifi_cal_data_t +{ + /** Calibration data length */ + t_u16 data_len; + /** Calibration data */ + t_u8 *data; +} PACK_END wifi_cal_data_t; + +/** Auto reconnect structure */ +typedef PACK_START struct _wifi_auto_reconnect_config_t +{ + /** Reconnect counter */ + t_u8 reconnect_counter; + /** Reconnect interval */ + t_u8 reconnect_interval; + /** Flags */ + t_u16 flags; +} PACK_END wifi_auto_reconnect_config_t; + +/** Scan all the channels in specified band */ +#define BAND_SPECIFIED 0x80U + +/** Scan channel list */ +typedef PACK_START struct _wifi_scan_channel_list_t +{ + /** Channel scan parameter : Radio type */ + t_u8 radio_type; + /** Channel numder */ + t_u8 chan_number; + /** Scan type Active = 1, Passive = 2 */ + mlan_scan_type scan_type; + /** Scan time */ + t_u16 scan_time; +} PACK_END wifi_scan_channel_list_t; + +/* Configuration for wireless scanning */ +#if defined(RW610) && (CONFIG_ANT_DETECT) +#define ANT_DETECT_MAX_CHANNEL_LIST 50U +#endif +#define MAX_CHANNEL_LIST 6 +#if CONFIG_COMBO_SCAN +#define MAX_NUM_SSID 2 +#endif +/** V2 scan parameters */ +typedef PACK_START struct _wifi_scan_params_v2_t +{ +#if CONFIG_WPA_SUPP + /** Scan Only */ + t_u8 scan_only; + /** BSSID present */ + t_u8 is_bssid; + /** SSID present */ + t_u8 is_ssid; +#endif + /** BSSID to scan */ + t_u8 bssid[MLAN_MAC_ADDR_LENGTH]; + /** SSID to scan */ +#if CONFIG_COMBO_SCAN + char ssid[MAX_NUM_SSID][MLAN_MAX_SSID_LENGTH + 1]; +#else + char ssid[MLAN_MAX_SSID_LENGTH + 1]; +#endif + /** Number of channels */ + t_u8 num_channels; + /** Channel list with channel information */ +#if defined(RW610) && (CONFIG_ANT_DETECT) + wifi_scan_channel_list_t chan_list[ANT_DETECT_MAX_CHANNEL_LIST]; +#else + wifi_scan_channel_list_t chan_list[MAX_CHANNEL_LIST]; +#endif + /** Number of probes */ + t_u8 num_probes; +#if CONFIG_SCAN_WITH_RSSIFILTER + /** Threshold of rssi */ + t_s16 rssi_threshold; +#endif +#if CONFIG_SCAN_CHANNEL_GAP + /** scan channel gap */ + t_u16 scan_chan_gap; +#endif + /** Callback to be called when scan is completed */ + int (*cb)(unsigned int count); +} PACK_END wifi_scan_params_v2_t; + +#if CONFIG_RF_TEST_MODE +/** Configuration for Manufacturing generic command */ +typedef PACK_START struct _wifi_mfg_cmd_generic_cfg +{ + /** MFG command code */ + t_u32 mfg_cmd; + /** Action */ + t_u16 action; + /** Device ID */ + t_u16 device_id; + /** MFG Error code */ + t_u32 error; + /** value 1 */ + t_u32 data1; + /** value 2 */ + t_u32 data2; + /** value 3 */ + t_u32 data3; +} PACK_END wifi_mfg_cmd_generic_cfg_t; + +/** Configuration for Manufacturing command Tx Frame */ +typedef PACK_START struct _wifi_mfg_cmd_tx_frame +{ + /** MFG command code */ + t_u32 mfg_cmd; + /** Action */ + t_u16 action; + /** Device ID */ + t_u16 device_id; + /** MFG Error code */ + t_u32 error; + /** enable */ + t_u32 enable; + /** data_rate */ + t_u32 data_rate; + /** frame pattern */ + t_u32 frame_pattern; + /** frame length */ + t_u32 frame_length; + /** BSSID */ + t_u8 bssid[MLAN_MAC_ADDR_LENGTH]; + /** Adjust burst sifs */ + t_u16 adjust_burst_sifs; + /** Burst sifs in us*/ + t_u32 burst_sifs_in_us; + /** short preamble */ + t_u32 short_preamble; + /** active sub channel */ + t_u32 act_sub_ch; + /** short GI */ + t_u32 short_gi; + /** Adv coding */ + t_u32 adv_coding; + /** Tx beamforming */ + t_u32 tx_bf; + /** HT Greenfield Mode*/ + t_u32 gf_mode; + /** STBC */ + t_u32 stbc; + /** power id */ + t_u32 rsvd[2]; +} PACK_END wifi_mfg_cmd_tx_frame_t; + +/** Configuration for Manufacturing command Tx Continuous */ +typedef PACK_START struct _wifi_mfg_cmd_tx_cont +{ + /** MFG command code */ + t_u32 mfg_cmd; + /** Action */ + t_u16 action; + /** Device ID */ + t_u16 device_id; + /** MFG Error code */ + t_u32 error; + /** enable Tx*/ + t_u32 enable_tx; + /** Continuous Wave mode */ + t_u32 cw_mode; + /** payload pattern */ + t_u32 payload_pattern; + /** CS Mode */ + t_u32 cs_mode; + /** active sub channel */ + t_u32 act_sub_ch; + /** Tx rate */ + t_u32 tx_rate; + /** power id */ + t_u32 rsvd; +} PACK_END wifi_mfg_cmd_tx_cont_t; + +typedef PACK_START struct wifi_mfg_cmd_he_tb_tx +{ + /** MFG command code */ + t_u32 mfg_cmd; + /** Action */ + t_u16 action; + /** Device ID */ + t_u16 device_id; + /** MFG Error code */ + t_u32 error; + /** Enable Tx */ + t_u16 enable; + /** Q num */ + t_u16 qnum; + /** AID */ + t_u16 aid; + /** AXQ Mu Timer */ + t_u16 axq_mu_timer; + /** Tx Power */ + t_s16 tx_power; +} PACK_END wifi_mfg_cmd_he_tb_tx_t; + +typedef PACK_START struct wifi_mfg_cmd_IEEEtypes_CtlBasicTrigHdr +{ + /** MFG command code */ + t_u32 mfg_cmd; + /** Action */ + t_u16 action; + /** Device ID */ + t_u16 device_id; + /** MFG Error code */ + t_u32 error; + /** enable Tx*/ + t_u32 enable_tx; + /** enable Stand Alone HE TB */ + t_u32 standalone_hetb; + /** Frame Control */ + mfg_cmd_IEEEtypes_FrameCtrl_t frmCtl; + /** Duration */ + t_u16 duration; + /** Destination MAC Address */ + t_u8 dest_addr[MLAN_MAC_ADDR_LENGTH]; + /** Source MAC Address */ + t_u8 src_addr[MLAN_MAC_ADDR_LENGTH]; + /** Common Info Field **/ + mfg_cmd_IEEEtypes_HETrigComInfo_t trig_common_field; + /** User Info Field **/ + mfg_cmd_IEEEtypes_HETrigUserInfo_t trig_user_info_field; + /** Trigger Dependent User Info Field **/ + mfg_cmd_IEEETypes_BasicHETrigUserInfo_t basic_trig_user_info; +} PACK_END wifi_mfg_cmd_IEEEtypes_CtlBasicTrigHdr_t; + +typedef PACK_START struct wifi_mfg_cmd_otp_mac_addr_rd_wr +{ + /** MFG command code */ + t_u32 mfg_cmd; + /** Action */ + t_u16 action; + /** Device ID */ + t_u16 device_id; + /** MFG Error code */ + t_u32 error; + /** Destination MAC Address */ + t_u8 mac_addr[MLAN_MAC_ADDR_LENGTH]; +} PACK_END wifi_mfg_cmd_otp_mac_addr_rd_wr_t; + +typedef PACK_START struct wifi_mfg_cmd_otp_cal_data_rd_wr +{ + /** MFG command code */ + t_u32 mfg_cmd; + /** Action */ + t_u16 action; + /** Device ID */ + t_u16 device_id; + /** MFG Error code */ + t_u32 error; + /** CAL Data write status */ + t_u32 cal_data_status; + /** CAL Data Length*/ + t_u32 cal_data_len; + /** Destination MAC Address */ + t_u8 cal_data[CAL_DATA_LEN]; +} PACK_END wifi_mfg_cmd_otp_cal_data_rd_wr_t; +#endif + +#if CONFIG_HEAP_DEBUG +#define MAX_FUNC_SYMBOL_LEN 64 +#define OS_MEM_STAT_TABLE_SIZE 128 + +typedef struct +{ + char name[MAX_FUNC_SYMBOL_LEN]; + t_u32 size; + t_u32 line_num; + + t_u32 alloc_cnt; + t_u32 free_cnt; +} wifi_os_mem_info; +#endif + +#if CONFIG_MULTI_CHAN +typedef PACK_START struct +{ + /** Channel Index*/ + t_u16 chan_idx; + /** Channel time (in TU) for chan_idx */ + t_u8 chantime; + /** Channel switch time (in TU) for chan_idx */ + t_u8 switchtime; + /** Undoze time (in TU) for chan_idx */ + t_u8 undozetime; + /** Rx traffic control scheme when channel switch*/ + /** only valid for GC/STA interface*/ + t_u8 mode; +} PACK_END wifi_drcs_cfg_t; +#endif + +#if CONFIG_1AS +#define DOT1AS_TM_ROLE_TRANSMITTER 0 +#define DOT1AS_TM_ROLE_RECEIVER 1 + +#define DOT1AS_TM_STATUS_COMPLETE 0 +#define DOT1AS_TM_STATUS_INPROGRESS 1 + +typedef struct +{ + /* host time in nano secs */ + t_u64 time; + /* fw time in nano secs */ + t_u64 fw_time; +} wifi_correlated_time_t; + +typedef struct _wifi_dot1as_info_t +{ + /* 0 - completed or unstarted, 1 - in progress */ + t_u8 status; + /* 0 - master(transmitter, send TM), 1 - slave(receiver, receive TM) */ + t_u8 role; + /* current number of TM frame, used in master mode */ + t_u8 tm_num; + /* max number of TM frames, used in master mode */ + t_u8 max_tm_num; + /* peer addr */ + t_u8 peer_addr[MLAN_MAC_ADDR_LENGTH]; + /* dialog_token */ + t_u8 dialog_token; + /* prev_dialog_token */ + t_u8 prev_dialog_token; + /* time of TX TM frame depart */ + t_u32 t1; + /* time of TX TM frame acked */ + t_u32 t4; + /* time of RX TM frame receive */ + t_u32 t2; + /* time of RX TM frame ack */ + t_u32 t3; + /* fw status error of t1 in 10ns */ + t_u8 t1_err; + /* fw status error of t4 in 10ns */ + t_u8 t4_err; + /* max error of t1 in 10ns */ + t_u8 max_t1_err; + /* max error of t4 in 10ns */ + t_u8 max_t4_err; + /* error of t2 in 10ns */ + t_u8 t2_err; + /* error of t3 in 10ns */ + t_u8 t3_err; + /* max error of t2 in 10ns */ + t_u8 max_t2_err; + /* max error of t3 in 10ns */ + t_u8 max_t3_err; + /* egress time of TX TM frame */ + t_u64 egress_time; + /* ingress time of RX TM frame */ + t_u64 ingress_time; +} wifi_dot1as_info_t; + +#endif + +#if CONFIG_SUBSCRIBE_EVENT_SUPPORT +/** Type definition of mlan_ds_subscribe_evt for subscribe events */ +typedef struct _wifi_ds_subscribe_evt +{ + /** bitmap for subscribe event */ + t_u16 evt_bitmap; + /** Absolute value of RSSI threshold value (dBm) */ + t_u8 low_rssi; + /** 0--report once, 1--report everytime happend, N -- report only happend > N consecutive times */ + t_u8 low_rssi_freq; + /** SNR threshold value (dB) */ + t_u8 low_snr; + /** 0--report once, 1--report everytime happend, N -- report only happend > N consecutive times */ + t_u8 low_snr_freq; + /** Failure count threshold */ + t_u8 failure_count; + /** 0--report once, 1--report everytime happend, N -- report only happend > N consecutive times */ + t_u8 failure_count_freq; + /** num of missed beacons */ + t_u8 beacon_miss; + /** 0--report once, 1--report everytime happend, N -- report only happend > N consecutive times */ + t_u8 beacon_miss_freq; + /** Absolute value of RSSI threshold value (dBm) */ + t_u8 high_rssi; + /** 0--report once, 1--report everytime happend, N -- report only happend > N consecutive times */ + t_u8 high_rssi_freq; + /** SNR threshold value (dB) */ + t_u8 high_snr; + /** 0--report once, 1--report everytime happend, N -- report only happend > N consecutive times */ + t_u8 high_snr_freq; + /** Absolute value of data RSSI threshold value (dBm) */ + t_u8 data_low_rssi; + /** 0--report once, 1--report everytime happend, N -- report only happend > N consecutive times */ + t_u8 data_low_rssi_freq; + /** Absolute value of data SNR threshold value (dBm) */ + t_u8 data_low_snr; + /** 0--report once, 1--report everytime happend, N -- report only happend > N consecutive times */ + t_u8 data_low_snr_freq; + /** Absolute value of data RSSI threshold value (dBm) */ + t_u8 data_high_rssi; + /** 0--report once, 1--report everytime happend, N -- report only happend > N consecutive times */ + t_u8 data_high_rssi_freq; + /** Absolute value of data SNR threshold value (dBm) */ + t_u8 data_high_snr; + /** 0--report once, 1--report everytime happend, N -- report only happend > N consecutive times */ + t_u8 data_high_snr_freq; + /* Link SNR threshold (dB) */ + t_u16 link_snr; + /* Link SNR frequency */ + t_u16 link_snr_freq; + /* Second minimum rate value as per the rate table below */ + t_u16 link_rate; + /* Second minimum rate frequency */ + t_u16 link_rate_freq; + /* Tx latency value (us) */ + t_u16 link_tx_latency; + /* Tx latency frequency */ + t_u16 link_tx_lantency_freq; + /* Number of pre missed beacons */ + t_u8 pre_beacon_miss; +} wifi_ds_subscribe_evt; +#endif + +#if CONFIG_CSI +#define CSI_FILTER_MAX 16 +/** Structure of CSI filters */ +typedef PACK_START struct _wifi_csi_filter_t +{ + /** Source address of the packet to receive */ + t_u8 mac_addr[MLAN_MAC_ADDR_LENGTH]; + /** Pakcet type of the interested CSI */ + t_u8 pkt_type; + /** Packet subtype of the interested CSI */ + t_u8 subtype; + /** Other filter flags */ + t_u8 flags; +} PACK_END wifi_csi_filter_t; +/** Structure of CSI parameters */ +typedef PACK_START struct _wifi_csi_config_params_t +{ + t_u8 bss_type; + /** CSI enable flag. 1: enable, 2: disable */ + t_u16 csi_enable; + /** Header ID*/ + t_u32 head_id; + /** Tail ID */ + t_u32 tail_id; + /** Number of CSI filters */ + t_u8 csi_filter_cnt; + /** Chip ID */ + t_u8 chip_id; + /** band config */ + t_u8 band_config; + /** Channel num */ + t_u8 channel; + /** Enable getting CSI data on special channel */ + t_u8 csi_monitor_enable; + /** CSI data received in cfg channel with mac addr filter, not only RA is us or other*/ + t_u8 ra4us; + /** CSI filters */ + wifi_csi_filter_t csi_filter[CSI_FILTER_MAX]; +} PACK_END wifi_csi_config_params_t; +#endif /* CSI_SUPPORT */ + +#if (CONFIG_WIFI_IND_RESET) && (CONFIG_WIFI_IND_DNLD) +/** Wi-Fi independent reset config */ +typedef PACK_START struct +{ + /** reset mode enable/ disable */ + t_u8 ir_mode; + /** gpio pin */ + t_u8 gpio_pin; +} PACK_END wifi_indrst_cfg_t; +#endif + +#if CONFIG_INACTIVITY_TIMEOUT_EXT +/** Type definition of wifi_inactivity_to + * for MLAN_OID_PM_CFG_INACTIVITY_TO + */ +typedef PACK_START struct +{ + /** Timeout unit in microsecond, 0 means 1000us (1ms) */ + t_u32 timeout_unit; + /** Inactivity timeout for unicast data */ + t_u32 unicast_timeout; + /** Inactivity timeout for multicast data */ + t_u32 mcast_timeout; + /** Timeout for additional Rx traffic after Null PM1 packet exchange */ + t_u32 ps_entry_timeout; + /** Inactivity timeout for cmd */ + t_u32 ps_cmd_timeout; +} PACK_END wifi_inactivity_to_t; +#endif + +#if CONFIG_AUTO_NULL_TX +/** auto null tx information */ +typedef struct +{ + /** 1-start 0-stop */ + t_u8 start; + /** bit15:14 unit: 00-s 01-us 10-ms 11-one_shot bit13-0: interval */ + t_u16 interval; + /** bit7-4: bandwidth. bit3-0: priority, ignored if non-WMM */ + t_u8 priority; + /** Destination MAC address */ + t_u8 dst_mac[MLAN_MAC_ADDR_LENGTH]; + /** Source MAC address */ + t_u8 src_mac[MLAN_MAC_ADDR_LENGTH]; +} wifi_auto_null_tx_t; +#endif + +#if defined(RW610) && (CONFIG_ANT_DETECT) +#define NORMAL_DETECT_MODE 0 +#define QUICK_DETECT_MODE 1 +#define PCB_DETECT_MODE 2 +#define PCB_DETECT_MODE_CHECK_DEVICE_COUNT 2 +#define ANT_DETECT_MAX_SCAN_ENTRY 5 +#define MAX_ANTENNA_PORT_NUM 4 +typedef PACK_START struct _scan_result_entry_t +{ + char ssid[33]; + unsigned int ssid_len; + char bssid[6]; + unsigned int channel; + unsigned char rssi; +} PACK_END scan_result_entry_t; + +typedef PACK_START struct _wlan_ant_info_t +{ + uint8_t scan_done; + unsigned char avg_rssi; + uint8_t entry_idx; + scan_result_entry_t scan_entry[ANT_DETECT_MAX_SCAN_ENTRY]; +} PACK_END wlan_ant_scan_info_t; + +typedef PACK_START struct _cfg_scan_channel_list_t +{ + uint8_t num_channels; + uint8_t chan_number[ANT_DETECT_MAX_CHANNEL_LIST]; +} PACK_END cfg_scan_channel_list_t; + +typedef PACK_START struct _wlan_ant_detect_data_t +{ + uint8_t detect_mode; + int detect_done; + uint16_t current_ant; + uint8_t ant_port_count; + uint16_t best_ant; + uint16_t next_best_ant; + cfg_scan_channel_list_t *channel_list; + wlan_ant_scan_info_t scan_info[MAX_ANTENNA_PORT_NUM]; +} PACK_END wlan_ant_detect_data_t; +#endif + +#endif /* __WIFI_DECL_H__ */ diff --git a/mcux/middleware/wifi_nxp/incl/wifidriver/wifi.h b/mcux/middleware/wifi_nxp/incl/wifidriver/wifi.h new file mode 100644 index 000000000..d88d87460 --- /dev/null +++ b/mcux/middleware/wifi_nxp/incl/wifidriver/wifi.h @@ -0,0 +1,2016 @@ +/* + * Copyright 2008-2024 NXP + * + * SPDX-License-Identifier: BSD-3-Clause + * + */ + +/** @file wifi.h + * + * @brief This file contains interface to wifi driver + */ + +#ifndef __WIFI_H__ +#define __WIFI_H__ + +#include + +#include "nxp_wifi.h" + +#if !(defined(SD8801) || defined(RW610)) +#define CONFIG_GTK_REKEY_OFFLOAD 1 +#endif + +#if defined(SD9177) +#define CONFIG_TCP_ACK_ENH 1 +#define CONFIG_FW_VDLL 1 +#if !CONFIG_WIFI_CAPA +#undef CONFIG_WIFI_CAPA +#define CONFIG_WIFI_CAPA 1 +#endif + +#if CONFIG_11AX +#if !CONFIG_11K +#define CONFIG_11K 1 +#endif +#if !CONFIG_11V +#define CONFIG_11V 1 +#endif +#endif +#endif + +#include +#include +#include +#include + +#define WIFI_NXP_EVENT_GET_WIPHY_NUM_BANDS 2 + +#define WIFI_REG8(x) (*(volatile unsigned char *)(x)) +#define WIFI_REG16(x) (*(volatile unsigned short *)(x)) +#define WIFI_REG32(x) (*(volatile unsigned int *)(x)) + +#define WIFI_WRITE_REG8(reg, val) (WIFI_REG8(reg) = (val)) +#define WIFI_WRITE_REG16(reg, val) (WIFI_REG16(reg) = (val)) +#define WIFI_WRITE_REG32(reg, val) (WIFI_REG32(reg) = (val)) + +#ifdef RW610 +#define WLAN_CAU_ENABLE_ADDR (0x45004008U) +#define WLAN_CAU_TEMPERATURE_ADDR (0x4500400CU) +#define WLAN_CAU_TEMPERATURE_FW_ADDR (0x41382490U) +#define WLAN_FW_WAKE_STATUS_ADDR (0x40031068U) +#endif + +#ifdef RW610 +#define RW610_PACKAGE_TYPE_QFN 0 +#define RW610_PACKAGE_TYPE_CSP 1 +#define RW610_PACKAGE_TYPE_BGA 2 +#endif + +#define WIFI_COMMAND_RESPONSE_WAIT_MS 20000 + +#define BANDWIDTH_20MHZ 1U +#define BANDWIDTH_40MHZ 2U +#if CONFIG_11AC +#define BANDWIDTH_80MHZ 3U +#endif + +#define MAX_NUM_CHANS_IN_NBOR_RPT 6U + +/** BIT value */ +#ifndef MBIT +#define MBIT(x) (((t_u32)1) << (x)) +#endif + +#define WIFI_MGMT_DIASSOC MBIT(10) +#define WIFI_MGMT_AUTH MBIT(11) +#define WIFI_MGMT_DEAUTH MBIT(12) +/** BITMAP for Action frame */ +#define WIFI_MGMT_ACTION MBIT(13) + +extern t_u8 wifi_tx_status; +extern t_u8 wifi_tx_block_cnt; +extern t_u8 wifi_rx_status; +extern t_u8 wifi_rx_block_cnt; + +extern int16_t g_bcn_nf_last; +extern uint8_t g_rssi; +extern uint16_t g_data_nf_last; +extern uint16_t g_data_snr_last; + +#if CONFIG_WIFI_RECOVERY +extern bool wifi_recovery_enable; +extern t_u16 wifi_recovery_cnt; +#endif +extern bool wifi_shutdown_enable; + +/** WiFi Error Code */ +enum +{ + WM_E_WIFI_ERRNO_START = MOD_ERROR_START(MOD_WIFI), + /** The Firmware download operation failed. */ + WIFI_ERROR_FW_DNLD_FAILED, + /** The Firmware ready register not set. */ + WIFI_ERROR_FW_NOT_READY, + /** The WiFi card not found. */ + WIFI_ERROR_CARD_NOT_DETECTED, + /** The WiFi Firmware not found. */ + WIFI_ERROR_FW_NOT_DETECTED, +#if CONFIG_XZ_DECOMPRESSION + /** The WiFi Firmware XZ decompression failed. */ + WIFI_ERROR_FW_XZ_FAILED, +#endif +}; + +/** WiFi driver TX/RX data status */ +enum +{ + /** Data in running status */ + WIFI_DATA_RUNNING = 0, + /** Data in block status */ + WIFI_DATA_BLOCK = 1, +}; + +typedef enum +{ + MGMT_RSN_IE = 48, +#if CONFIG_11K + MGMT_RRM_ENABLED_CAP = 70, +#endif + MGMT_VENDOR_SPECIFIC_221 = 221, + MGMT_WPA_IE = MGMT_VENDOR_SPECIFIC_221, + MGMT_WPS_IE = MGMT_VENDOR_SPECIFIC_221, + MGMT_MBO_IE = MGMT_VENDOR_SPECIFIC_221, +} IEEEtypes_ElementId_t; + +typedef struct wifi_uap_client_disassoc +{ + int reason_code; + t_u8 sta_addr[MLAN_MAC_ADDR_LENGTH]; +} wifi_uap_client_disassoc_t; + +/** + * Initialize Wi-Fi driver module. + * + * Performs SDIO init, downloads Wi-Fi Firmware, creates Wi-Fi Driver + * and command response processor thread. + * + * Also creates mutex, and semaphores used in command and data synchronizations. + * + * \param[in] fw_start_addr address of stored Wi-Fi Firmware. + * \param[in] size Size of Wi-Fi Firmware. + * + * \return WM_SUCCESS on success or -WM_FAIL on error. + * + */ +int wifi_init(const uint8_t *fw_start_addr, const size_t size); + +/** + * Initialize Wi-Fi driver module for FCC Certification. + * + * Performs SDIO init, downloads Wi-Fi Firmware, creates Wi-Fi Driver + * and command response processor thread. + * + * Also creates mutex, and semaphores used in command and data synchronizations. + * + * \param[in] fw_start_addr address of stored Manufacturing Wi-Fi Firmware. + * \param[in] size Size of Manufacturing Wi-Fi Firmware. + * + * \return WM_SUCCESS on success or -WM_FAIL on error. + * + */ +int wifi_init_fcc(const uint8_t *fw_start_addr, const size_t size); + +/** + * Deinitialize Wi-Fi driver module. + * + * Performs SDIO deinit, send shutdown command to Wi-Fi Firmware, deletes + * Wi-Fi Driver and command processor thread. + * + * Also deletes mutex and semaphores used in command and data synchronizations. + * + */ +void wifi_deinit(void); +#ifdef RW610 +/** + * This API can be used to destroy all wifi driver tasks. + */ +void wifi_destroy_wifidriver_tasks(void); +/** + * This API can be used to get IMU task lock. + */ +int wifi_imu_get_task_lock(void); +/** + * This API can be used to put IMU task lock. + */ +int wifi_imu_put_task_lock(void); +/** + * This API can be used to judge if wifi firmware is hang. + */ +bool wifi_fw_is_hang(void); +/** + * This API can be used to send shutdown command to FW. + */ +int wifi_send_shutdown_cmd(void); +#endif +/** + * This API can be used to set wifi driver tx status. + * + * @param[in] status Status to set for TX + */ +void wifi_set_tx_status(t_u8 status); + +/** + * This API can be used to set wifi driver rx status. + * + * @param[in] status Status to set for RX + * + */ +void wifi_set_rx_status(t_u8 status); + +/** + * This API can be used to reset mgmt_ie_index_bitmap. + */ +void reset_ie_index(); + +#if !CONFIG_WIFI_RX_REORDER +/** + * Register Data callback function with Wi-Fi Driver to receive + * DATA from SDIO. + * + * This callback function is used to send data received from Wi-Fi + * firmware to the networking stack. + * + * @param[in] data_input_callback Function that needs to be called + * + * @return WM_SUCCESS + */ +int wifi_register_data_input_callback(void (*data_input_callback)(const uint8_t interface, + const uint8_t *buffer, + const uint16_t len)); + +/** Deregister Data callback function from Wi-Fi Driver */ +void wifi_deregister_data_input_callback(void); +#else +int wifi_register_gen_pbuf_from_data2_callback(void *(*gen_pbuf_from_data2)(t_u8 *payload, + t_u16 datalen, + void **p_payload)); + +void wifi_deregister_gen_pbuf_from_data2_callback(void); +#endif + +#if FSL_USDHC_ENABLE_SCATTER_GATHER_TRANSFER + +int wifi_register_get_rxbuf_desc_callback(void *(*wifi_get_rxbuf_desc)(t_u16 rx_len)); + +void wifi_deregister_get_rxbuf_desc_callback(void); + +#endif + +/** + * Register Data callback function with Wi-Fi Driver to receive + * processed AMSDU DATA from Wi-Fi driver. + * + * This callback function is used to send data received from Wi-Fi + * firmware to the networking stack. + * + * @param[in] amsdu_data_input_callback Function that needs to be called + * + * @return WM_SUCESS + * + */ +int wifi_register_amsdu_data_input_callback(void (*amsdu_data_input_callback)(uint8_t interface, + uint8_t *buffer, + uint16_t len)); + +/** Deregister Data callback function from Wi-Fi Driver */ +void wifi_deregister_amsdu_data_input_callback(void); + +int wifi_register_deliver_packet_above_callback(void (*deliver_packet_above_callback)(void *rxpd, + uint8_t interface, + void *lwip_pbuf)); + +void wifi_deregister_deliver_packet_above_callback(void); + +int wifi_register_wrapper_net_is_ip_or_ipv6_callback(bool (*wrapper_net_is_ip_or_ipv6_callback)(const t_u8 *buffer)); + +void wifi_deregister_wrapper_net_is_ip_or_ipv6_callback(void); + +#if CONFIG_WMM +int wifi_add_to_bypassq(const t_u8 interface, void *pkt, t_u32 len); +#endif + +/** + * Wi-Fi Driver low level output function. + * + * Data received from upper layer is passed to Wi-Fi Driver for transmission. + * + * \param[in] interface Interface on which DATA frame will be transmitted. + * 0 for Station interface, 1 for uAP interface and 2 for Wi-Fi + * Direct interface. + * \param[in] buffer A pointer pointing to DATA frame. + * \param[in] len Length of DATA frame. + * \param[in] pkt_prio Priority for.sending packet. + * \param[in] tid TID for tx. + * + * \return WM_SUCCESS on success or -WM_E_NOMEM if memory is not available + * or -WM_E_BUSY if SDIO is busy. + * + */ +int wifi_low_level_output(const uint8_t interface, + const uint8_t *buffer, + const uint16_t len +#if CONFIG_WMM + , + uint8_t pkt_prio, + uint8_t tid +#endif +); + +/** + * API to enable packet retries at wifi driver level. + * + * This API sets retry count which will be used by wifi driver to retry packet + * transmission in case there was failure in earlier attempt. Failure may + * happen due to SDIO write port un-availability or other failures in SDIO + * write operation. + * + * \note Default value of retry count is zero. + * + * \param[in] count No of retry attempts. + * + */ +void wifi_set_packet_retry_count(const int count); + +/** + * This API can be used to enable AMPDU support on the go + * when station is a transmitter. + */ +void wifi_sta_ampdu_tx_enable(void); + +/** + * This API can be used to disable AMPDU support on the go + * when station is a transmitter. + */ +void wifi_sta_ampdu_tx_disable(void); + +/** + * This API can be used to set tid to enable AMPDU support on the go + * when station is a transmitter. + * @param[in] tid tid value + */ +void wifi_sta_ampdu_tx_enable_per_tid(t_u8 tid); + +/** + * This API can be used to check if tid to enable AMPDU is allowed + * when station is a transmitter. + * @param[in] tid tid value + * @return MTRUE or MFALSE + */ +t_u8 wifi_sta_ampdu_tx_enable_per_tid_is_allowed(t_u8 tid); + +/** + * This API can be used to enable AMPDU support on the go + * when station is a receiver. + */ +void wifi_sta_ampdu_rx_enable(void); + +/** + * This API can be used to set tid to enable AMPDU support on the go + * when station is a receiver. + * @param[in] tid tid value + */ +void wifi_sta_ampdu_rx_enable_per_tid(t_u8 tid); + +/** + * This API can be used to check if tid to enable AMPDU is allowed + * when station is a receiver. + * @param[in] tid tid value + * @return MTRUE or MFALSE + */ +t_u8 wifi_sta_ampdu_rx_enable_per_tid_is_allowed(t_u8 tid); + +/** + * This API can be used to enable AMPDU support on the go + * when uap is a receiver. + */ +void wifi_uap_ampdu_rx_enable(void); + +/** + * This API can be used to set tid to enable AMPDU support on the go + * when uap is a receiver. + * @param[in] tid tid value + */ +void wifi_uap_ampdu_rx_enable_per_tid(t_u8 tid); + +/** + * This API can be used to check if tid to enable AMPDU is allowed + * when uap is a receiver. + * @param[in] tid tid value + * @return MTRUE or MFALSE + */ +t_u8 wifi_uap_ampdu_rx_enable_per_tid_is_allowed(t_u8 tid); + +/** + * This API can be used to disable AMPDU support on the go + * when uap is a receiver. + */ +void wifi_uap_ampdu_rx_disable(void); + +/** + * This API can be used to enable AMPDU support on the go + * when uap is a transmitter. + */ +void wifi_uap_ampdu_tx_enable(void); + +/** + * This API can be used to set tid to enable AMPDU support on the go + * when uap is a transmitter. + * @param[in] tid tid value + */ +void wifi_uap_ampdu_tx_enable_per_tid(t_u8 tid); + +/** + * This API can be used to check if tid to enable AMPDU is allowed + * when uap is a transmitter. + * @param[in] tid tid value + * @return MTRUE or MFALSE + */ +t_u8 wifi_uap_ampdu_tx_enable_per_tid_is_allowed(t_u8 tid); + +/** + * This API can be used to disable AMPDU support on the go + * when uap is a transmitter. + */ +void wifi_uap_ampdu_tx_disable(void); + +/** + * This API can be used to disable AMPDU support on the go + * when station is a receiver. + */ +void wifi_sta_ampdu_rx_disable(void); + +/** + * Get the device sta MAC address + * + * @param[out] mac_addr Mac address + * + * @return WM_SUCESS + */ +int wifi_get_device_mac_addr(wifi_mac_addr_t *mac_addr); + +/** + * Get the device uap MAC address + * + * @param[out] mac_addr_uap Mac address + * + * @return WM_SUCESS + */ +int wifi_get_device_uap_mac_addr(wifi_mac_addr_t *mac_addr_uap); + +/** + * Get the cached string representation of the wlan firmware extended version. + * + * @param[in] fw_ver_ext Firmware Version Extended + * + * @return WM_SUCCESS + */ +int wifi_get_device_firmware_version_ext(wifi_fw_version_ext_t *fw_ver_ext); + +/** + * Get the timestamp of the last command sent to the firmware + * + * @return Timestamp in millisec of the last command sent + */ +unsigned wifi_get_last_cmd_sent_ms(void); + +uint32_t wifi_get_value1(void); + +uint8_t *wifi_get_outbuf(uint32_t *outbuf_len); + +#if CONFIG_WIFI_TX_PER_TRACK +int wifi_set_tx_pert(void *cfg, mlan_bss_type bss_type); +#endif + +#if CONFIG_TX_RX_HISTOGRAM +int wifi_set_txrx_histogram(void *cfg, t_u8 *data); +#endif + +#if CONFIG_ROAMING +int wifi_config_roaming(const int enable, uint8_t *rssi_low); +#endif +#if CONFIG_BG_SCAN +int wifi_config_bgscan_and_rssi(const char *ssid); +mlan_status wifi_stop_bgscan(); +#endif + +/** + * This will update the last command sent variable value to current + * time. This is used for power management. + */ +void wifi_update_last_cmd_sent_ms(void); + +/** + * Register an event queue with the wifi driver to receive events + * + * The list of events which can be received from the wifi driver are + * enumerated in the file wifi_events.h + * + * @param[in] event_queue The queue to which wifi driver will post events. + * + * @note Only one queue can be registered. If the registered queue needs to + * be changed unregister the earlier queue first. + * + * @return Standard SDK return codes + */ +int wifi_register_event_queue(osa_msgq_handle_t event_queue); + +/** + * Unregister an event queue from the wifi driver. + * + * @param[in] event_queue The queue to which was registered earlier with + * the wifi driver. + * + * @return Standard SDK return codes + */ +int wifi_unregister_event_queue(osa_msgq_handle_t event_queue); + +/** Get scan list + * + * @param[in] index Index + * @param[out] desc Descriptor of type \ref wifi_scan_result2 + * + * @return WM_SUCCESS on success or error code. + * + */ +int wifi_get_scan_result(unsigned int index, struct wifi_scan_result2 **desc); + +/** + * Get the count of elements in the scan list + * + * @param[in,out] count Pointer to a variable which will hold the count after + * this call returns + * + * @warning The count returned by this function is the current count of the + * elements. A scan command given to the driver or some other background + * event may change this count in the wifi driver. Thus when the API + * \ref wifi_get_scan_result is used to get individual elements of the scan + * list, do not assume that it will return exactly 'count' number of + * elements. Your application should not consider such situations as a + * major event. + * + * @return Standard SDK return codes. + */ +int wifi_get_scan_result_count(unsigned *count); + +/** + * Returns the current STA list connected to our uAP + * + * This function gets its information after querying the firmware. It will + * block till the response is received from firmware or a timeout. + * + * @param[in, out] list After this call returns this points to the + * structure \ref wifi_sta_list_t allocated by the callee. This is variable + * length structure and depends on count variable inside it. The caller + * needs to free this buffer after use.. If this function is unable to + * get the sta list, the value of list parameter will be NULL + * + * \note The caller needs to explicitly free the buffer returned by this + * function. + * + * @return void + */ +int wifi_uap_bss_sta_list(wifi_sta_list_t **list); + +/** + * Dsiconnect ex-sta which is connected to in-uap. + * + * \param[in] mac_addr Mac address of external station. + * \param[in] reason_code Deauth reason code. + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wifi_sta_deauth(uint8_t *mac_addr, uint16_t reason_code); + +#if CONFIG_RX_ABORT_CFG +/** + * Set/Get Rx abort config + * + * \param[in] cfg User configurations. + * \param[in] action Set/Get + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wifi_set_get_rx_abort_cfg(void *cfg, t_u16 action); +#endif + +#if CONFIG_RX_ABORT_CFG_EXT +/** + * Set/Get Rx abort config ext + * + * \param[in] cfg User configurations. + * \param[in] action Set/Get + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wifi_set_get_rx_abort_cfg_ext(void *cfg, t_u16 action); +#endif + +#if CONFIG_CCK_DESENSE_CFG +/** + * Set/Get CCK Desense config + * + * \param[in] cfg User configurations. + * \param[in] action Set/Get + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wifi_set_get_cck_desense_cfg(void *cfg, t_u16 action); +#endif + +#ifdef WLAN_LOW_POWER_ENABLE +void wifi_enable_low_pwr_mode(); +#endif + +/** Set wifi calibration data in firmware. + * + * This function may be used to set wifi calibration data in firmware. + * + * @param[in] cdata The calibration data + * @param[in] clen Length of calibration data + * + */ +void wifi_set_cal_data(const uint8_t *cdata, const unsigned int clen); + +/** Set wifi MAC address in firmware at load time. + * + * This function may be used to set wifi MAC address in firmware. + * + * @param[in] mac The new MAC Address + * + */ +void wifi_set_mac_addr(uint8_t *mac); + +/** Set wifi MAC address in firmware at run time. + * + * This function may be used to set wifi MAC address in firmware as per passed bss type. + * + * @param[in] mac The new MAC Address + * @param[in] bss_type BSS Type + * + */ +void _wifi_set_mac_addr(const uint8_t *mac, mlan_bss_type bss_type); + +#if CONFIG_WMM_UAPSD +int wifi_wmm_qos_cfg(t_u8 *qos_cfg, t_u8 action); +int wifi_sleep_period(unsigned int *sleep_period, int action); +#endif + +#if CONFIG_WIFI_TX_BUFF +/** + * Check whether the tx buffer size setting is reasonable. + * + * \param[in] buf_size The tx buffer size + * + */ +bool wifi_calibrate_tx_buf_size(uint16_t buf_size); +void wifi_recfg_tx_buf_size(uint16_t buf_size); +void _wifi_recfg_tx_buf_size(uint16_t buf_size, mlan_bss_type bss_type); +#endif +#if CONFIG_P2P +int wifi_register_wfd_event_queue(osa_msgq_handle_t event_queue); +int wifi_unregister_wfd_event_queue(osa_msgq_handle_t event_queue); +void wifi_wfd_event(bool peer_event, bool action_frame, void *data); +int wifi_wfd_start(char *ssid, int security, char *passphrase, int channel); +int wifi_wfd_stop(void); + +/** + * Returns the current STA list connected to our WFD + * + * This function gets its information after querying the firmware. It will + * block till the response is received from firmware or a timeout. + * + * @param[in, out] list After this call returns this points to the + * structure \ref sta_list_t allocated by the callee. This is variable + * length structure and depends on count variable inside it. The caller + * needs to free this buffer after use.. If this function is unable to + * get the sta list, the value of list parameter will be NULL + * + * \note The caller needs to explicitly free the buffer returned by this + * function. + * + * @return void + */ +int wifi_wfd_bss_sta_list(sta_list_t **list); + +int wifi_get_wfd_mac_address(void); +int wifi_wfd_ps_inactivity_sleep_enter(unsigned int ctrl_bitmap, + unsigned int inactivity_to, + unsigned int min_sleep, + unsigned int max_sleep, + unsigned int min_awake, + unsigned int max_awake); + +int wifi_wfd_ps_inactivity_sleep_exit(); +int wifidirectapcmd_sys_config(); +void wifidirectcmd_config(); +#endif + +int wifi_get_wpa_ie_in_assoc(uint8_t *wpa_ie); + +/** Add Multicast Filter by MAC Address + * + * Multicast filters should be registered with the WiFi driver for IP-level + * multicast addresses to work. This API allows for registration of such filters + * with the WiFi driver. + * + * If multicast-mapped MAC address is 00:12:23:34:45:56 then pass mac_addr as + * below: + * mac_add[0] = 0x00 + * mac_add[1] = 0x12 + * mac_add[2] = 0x23 + * mac_add[3] = 0x34 + * mac_add[4] = 0x45 + * mac_add[5] = 0x56 + * + * \param[in] mac_addr multicast mapped MAC address + * + * \return 0 on Success or else Error + */ +int wifi_add_mcast_filter(uint8_t *mac_addr); + +/** Remove Multicast Filter by MAC Address + * + * This function removes multicast filters for the given multicast-mapped + * MAC address. If multicast-mapped MAC address is 00:12:23:34:45:56 + * then pass mac_addr as below: + * mac_add[0] = 0x00 + * mac_add[1] = 0x12 + * mac_add[2] = 0x23 + * mac_add[3] = 0x34 + * mac_add[4] = 0x45 + * mac_add[5] = 0x56 + * + * \param[in] mac_addr multicast mapped MAC address + * + * \return 0 on Success or else Error + */ +int wifi_remove_mcast_filter(uint8_t *mac_addr); + +/** Get Multicast Mapped Mac address from IPv4 + * + * This function will generate Multicast Mapped MAC address from IPv4 + * Multicast Mapped MAC address will be in following format: + * 1) Higher 24-bits filled with IANA Multicast OUI (01-00-5E) + * 2) 24th bit set as Zero + * 3) Lower 23-bits filled with IP address (ignoring higher 9bits). + * + * \param[in] ipaddr ipaddress(input) + * \param[in] mac_addr multicast mapped MAC address(output) + * + */ +void wifi_get_ipv4_multicast_mac(uint32_t ipaddr, uint8_t *mac_addr); + +#if CONFIG_IPV6 +/** Get Multicast Mapped Mac address from IPv6 address + * + * This function will generate Multicast Mapped MAC address from IPv6 address. + * Multicast Mapped MAC address will be in following format: + * 1) Higher 16-bits filled with IANA Multicast OUI (33-33) + * 2) Lower 32-bits filled with last 4 bytes of IPv6 address + * + * \param[in] ipaddr last 4 bytes of IPv6 address + * \param[in] mac_addr multicast mapped MAC address + * + */ +void wifi_get_ipv6_multicast_mac(uint32_t ipaddr, uint8_t *mac_addr); +#endif /* CONFIG_IPV6 */ + +#ifdef STREAM_2X2 +int wifi_set_11n_cfg(uint16_t httxcfg); +int wifi_set_11ac_cfg(uint32_t vhtcap, uint16_t tx_mcs_map, uint16_t rx_mcs_map); +#endif + +#ifdef STREAM_2X2 +int wifi_set_antenna(t_u8 tx_antenna, t_u8 rx_antenna); +#else +#ifndef RW610 +int wifi_set_antenna(t_u32 ant_mode, t_u16 evaluate_time); +int wifi_get_antenna(t_u32 *ant_mode, t_u16 *evaluate_time, t_u16 *current_antenna); +#else +int wifi_set_antenna(t_u32 ant_mode, t_u16 evaluate_time, t_u8 evaluate_mode); +int wifi_get_antenna(t_u32 *ant_mode, t_u16 *evaluate_time, t_u8 *evaluate_mode, t_u16 *current_antenna); +#endif +#endif + +void wifi_process_hs_cfg_resp(t_u8 *cmd_res_buffer); +enum wifi_event_reason wifi_process_ps_enh_response(t_u8 *cmd_res_buffer, t_u16 *ps_event, t_u16 *action); + +int wifi_uap_rates_getset(uint8_t action, char *rates, uint8_t num_rates); +int wifi_uap_sta_ageout_timer_getset(uint8_t action, uint32_t *sta_ageout_timer); +int wifi_uap_ps_sta_ageout_timer_getset(uint8_t action, uint32_t *ps_sta_ageout_timer); +typedef enum +{ + REG_MAC = 1, + REG_BBP, + REG_RF, + REG_CAU +} wifi_reg_t; + +int wifi_mem_access(uint16_t action, uint32_t addr, uint32_t *value); +/* + * This function is supposed to be called after scan is complete from wlc + * manager. + */ +void wifi_scan_process_results(void); + +/** + * Get the wifi region code + * + * This function will return one of the following values in the region_code + * variable.\n + * 0x10 : US FCC\n + * 0x20 : CANADA\n + * 0x30 : EU\n + * 0x32 : FRANCE\n + * 0x40 : JAPAN\n + * 0x41 : JAPAN\n + * 0x50 : China\n + * 0xfe : JAPAN\n + * 0xff : Special\n + * + * @param[out] region_code Region Code + * + * @return Standard WMSDK return codes. + */ +int wifi_get_region_code(t_u32 *region_code); + +/** + * Set the wifi region code. + * + * This function takes one of the values from the following array.\n + * 0x10 : US FCC\n + * 0x20 : CANADA\n + * 0x30 : EU\n + * 0x32 : FRANCE\n + * 0x40 : JAPAN\n + * 0x41 : JAPAN\n + * 0x50 : China\n + * 0xfe : JAPAN\n + * 0xff : Special\n + * + * @param[in] region_code Region Code + * + * @return Standard WMSDK return codes. + */ +int wifi_set_region_code(t_u32 region_code); + +/** + * Set/Get country code + * \param[in] alpha2 country code in 3bytes string, 2bytes country code and 1byte 0 + * WW : World Wide Safe + * US : US FCC + * CA : IC Canada + * SG : Singapore + * EU : ETSI + * AU : Australia + * KR : Republic Of Korea + * FR : France + * JP : Japan + * CN : China + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wifi_set_country_code(const char *alpha2); +int wifi_get_country_code(char *alpha2); +int wifi_set_country_ie_ignore(uint8_t *ignore); + +/** + * Get the uAP channel number + * + * + * @param[in] channel Pointer to channel number. Will be initialized by + * callee + * @return Standard WMSDK return code + */ +int wifi_get_uap_channel(int *channel); + +/** + * Get/Set the uAP mfpc and mfpr + * + * @param[in] action + * + * \param[in, out] mfpc Management Frame Protection Capable (MFPC) + * 1: Management Frame Protection Capable + * 0: Management Frame Protection not Capable + * \param[in, out] mfpr Management Frame Protection Required (MFPR) + * 1: Management Frame Protection Required + * 0: Management Frame Protection Optional + * + * @return cmd response status + */ +int wifi_uap_pmf_getset(uint8_t action, uint8_t *mfpc, uint8_t *mfpr); + +/** + * enable/disable 80211d domain feature for the uAP. + * + * @note This API only set 80211d domain feature. + * The actual application will happen only during + * starting phase of uAP. So, if the uAP is already started then the + * configuration will not apply till uAP re-start. + * + * @return WM_SUCCESS on success or error code. + * + */ +int wifi_uap_enable_11d_support(); +bool wifi_11d_is_channel_allowed(int channel); +wifi_sub_band_set_t *get_sub_band_from_region_code(int region_code, t_u8 *nr_sb); +#if CONFIG_5GHz_SUPPORT +wifi_sub_band_set_t *get_sub_band_from_region_code_5ghz(int region_code, t_u8 *nr_sb); +#endif + +int wifi_enable_11d_support(); +int wifi_enable_uap_11d_support(); +int wifi_disable_11d_support(); +int wifi_disable_uap_11d_support(); + +#ifdef OTP_CHANINFO +int wifi_get_fw_region_and_cfp_tables(void); +void wifi_free_fw_region_and_cfp_tables(void); +#endif +#if CONFIG_COMPRESS_TX_PWTBL +int wifi_set_region_power_cfg(const t_u8 *data, t_u16 len); +#endif +int wifi_set_txbfcap(unsigned int tx_bf_cap); +int wifi_set_htcapinfo(unsigned int htcapinfo); +int wifi_set_httxcfg(unsigned short httxcfg); +void wifi_uap_set_httxcfg(const t_u16 ht_tx_cfg); +int wifi_uap_set_httxcfg_int(unsigned short httxcfg); +int wifi_get_tx_power(t_u32 *power_level); +int wifi_set_tx_power(t_u32 power_level); +int wrapper_wlan_cmd_get_hw_spec(void); +/* fixme: These need to be removed later after complete mlan integration */ +void set_event_chanswann(void); +void clear_event_chanswann(void); +void wifi_set_ps_cfg(t_u16 multiple_dtims, + t_u16 bcn_miss_timeout, + t_u16 local_listen_interval, + t_u16 adhoc_wake_period, + t_u16 mode, + t_u16 delay_to_ps); +int wifi_send_hs_cfg_cmd(mlan_bss_type interface, t_u32 ipv4_addr, t_u16 action, t_u32 conditions); +#if CONFIG_HOST_SLEEP +int wifi_cancel_host_sleep(mlan_bss_type interface); +#endif +bool wrapper_wlan_11d_support_is_enabled(void); +void wrapper_wlan_11d_clear_parsedtable(void); +void wrapper_clear_media_connected_event(void); +int wifi_uap_ps_inactivity_sleep_exit(mlan_bss_type type); +int wifi_uap_ps_inactivity_sleep_enter(mlan_bss_type type, + unsigned int ctrl_bitmap, + unsigned int min_sleep, + unsigned int max_sleep, + unsigned int inactivity_to, + unsigned int min_awake, + unsigned int max_awake); +int wifi_enter_ieee_power_save(void); +int wifi_exit_ieee_power_save(void); +#if (CONFIG_WNM_PS) +int wifi_enter_wnm_power_save(t_u16 wnm_sleep_time); +int wifi_exit_wnm_power_save(void); +#endif +int wifi_enter_deepsleep_power_save(void); +int wifi_exit_deepsleep_power_save(void); +int wifi_set_power_save_mode(void); +int wifi_get_wakeup_reason(t_u16 *hs_wakeup_reason); +void send_sleep_confirm_command(mlan_bss_type interface); +void wifi_configure_listen_interval(int listen_interval); +void wifi_configure_delay_to_ps(unsigned int timeout_ms); +unsigned short wifi_get_listen_interval(); +unsigned int wifi_get_delay_to_ps(); +void wifi_configure_null_pkt_interval(unsigned int null_pkt_interval); +int wrapper_wifi_assoc( + const unsigned char *bssid, int wlan_security, bool is_wpa_tkip, unsigned int owe_trans_mode, bool is_ft); +#if CONFIG_WIFI_UAP_WORKAROUND_STICKY_TIM +void wifi_uap_enable_sticky_bit(const uint8_t *mac_addr); +#endif /* CONFIG_WIFI_UAP_WORKAROUND_STICKY_TIM */ +bool wifi_get_xfer_pending(void); +void wifi_set_xfer_pending(bool xfer_val); +int wrapper_wlan_cmd_11n_ba_stream_timeout(void *saved_event_buff); + +int wifi_set_txratecfg(wifi_ds_rate ds_rate, mlan_bss_type bss_type); +int wifi_get_txratecfg(wifi_ds_rate *ds_rate, mlan_bss_type bss_type); +void wifi_wake_up_card(uint32_t *resp); +void wifi_tx_card_awake_lock(void); +void wifi_tx_card_awake_unlock(void); +#ifdef RW610 +uint32_t wifi_get_board_type(); +#endif +#if CONFIG_WPA2_ENTP +void wifi_scan_enable_wpa2_enterprise_ap_only(); +#endif + +int wrapper_wlan_11d_enable(t_u32 state); +int wrapper_wlan_uap_11d_enable(t_u32 state); + +int wifi_11h_enable(void); + +int wrapper_wlan_cmd_11n_addba_rspgen(void *saved_event_buff); + +int wrapper_wlan_cmd_11n_delba_rspgen(void *saved_event_buff); + +int wrapper_wlan_ecsa_enable(void); + +int wifi_uap_start(mlan_bss_type type, + char *ssid, + uint8_t *mac_addr, + int security, + int key_mgmt, + char *passphrase, + char *password, + int channel, + wifi_scan_chan_list_t scan_chan_list, + uint8_t pwe_derivation, + uint8_t transition_disable, + bool mfpc, +#if CONFIG_WIFI_DTIM_PERIOD + bool mfpr, + uint8_t dtim +#else + bool mfpr +#endif +); + +int wrapper_wlan_sta_ampdu_enable( +#if CONFIG_WMM + t_u8 tid +#endif +); + +int wrapper_wlan_uap_ampdu_enable(uint8_t *addr +#if CONFIG_WMM + , + t_u8 tid +#endif +); + +#if CONFIG_WLAN_BRIDGE +/** Enable Bridge mode in WLAN firmware. + * + * \param[in] auto_link, Whether enable auto link for in-sta of bridge mode. + * \param[in] hidden_ssid, Whether enable hidden_ssid for in-AP of bridge mode. + * \param[in] cfg, Bridge configuration structure holding enable, auto_link, + * hidden_ssid, EX-AP SSID, Passphrase, Bridge SSID and Passphrase. + * + * \return WM_SUCCESS if operation is successful. + * \return -WM_FAIL if operation is failed. + */ +int wifi_enable_bridge_mode(wifi_bridge_cfg_t *cfg); + +/** Disable Bridge mode in WLAN firmware. + * + * \return WM_SUCCESS if operation is successful. + * \return -WM_FAIL if operation is failed. + */ +int wifi_disable_bridge_mode(); + +/** Get Bridge configuration from WLAN firmware. + * + * \param[out] cfg Bridge configuration structure where EX-AP SSID, + * Passphrase, Bridge SSID and Passphrase will get copied. + * + * \return WM_SUCCESS if operation is successful. + * \return -WM_FAIL if operation is failed. + */ +int wifi_get_bridge_mode_config(wifi_bridge_cfg_t *cfg); + +/** + * Reconfigure TX buffer size during bridge mode operation. + * + * \param[in] buf_size Buffer size to configure. + * + * \return WM_SUCCESS if operation is successful. + * \return -WM_FAIL is operation is failed. + */ +int wifi_config_bridge_tx_buf(uint16_t buf_size); +#endif + +#if CONFIG_WIFI_GET_LOG +/** WiFi Statistics counter */ +typedef PACK_START struct +{ + /** Multicast transmitted frame count */ + t_u32 mcast_tx_frame; + /** Failure count */ + t_u32 failed; + /** Retry count */ + t_u32 retry; + /** Multi entry count */ + t_u32 multi_retry; + /** Duplicate frame count */ + t_u32 frame_dup; + /** RTS success count */ + t_u32 rts_success; + /** RTS failure count */ + t_u32 rts_failure; + /** Ack failure count */ + t_u32 ack_failure; + /** Rx fragmentation count */ + t_u32 rx_frag; + /** Multicast Tx frame count */ + t_u32 mcast_rx_frame; + /** FCS error count */ + t_u32 fcs_error; + /** Tx frame count */ + t_u32 tx_frame; + /** WEP ICV error count */ + t_u32 wep_icv_error[4]; + /** beacon recv count */ + t_u32 bcn_rcv_cnt; + /** beacon miss count */ + t_u32 bcn_miss_cnt; + /** received amsdu count*/ + t_u32 amsdu_rx_cnt; + /** received msdu count in amsdu*/ + t_u32 msdu_in_rx_amsdu_cnt; + /** tx amsdu count*/ + t_u32 amsdu_tx_cnt; + /** tx msdu count in amsdu*/ + t_u32 msdu_in_tx_amsdu_cnt; + /** Tx frag count */ + t_u32 tx_frag_cnt; + /** Qos Tx frag count */ + t_u32 qos_tx_frag_cnt[8]; + /** Qos failed count */ + t_u32 qos_failed_cnt[8]; + /** Qos retry count */ + t_u32 qos_retry_cnt[8]; + /** Qos multi retry count */ + t_u32 qos_multi_retry_cnt[8]; + /** Qos frame dup count */ + t_u32 qos_frm_dup_cnt[8]; + /** Qos rts success count */ + t_u32 qos_rts_suc_cnt[8]; + /** Qos rts failure count */ + t_u32 qos_rts_failure_cnt[8]; + /** Qos ack failure count */ + t_u32 qos_ack_failure_cnt[8]; + /** Qos Rx frag count */ + t_u32 qos_rx_frag_cnt[8]; + /** Qos Tx frame count */ + t_u32 qos_tx_frm_cnt[8]; + /** Qos discarded frame count */ + t_u32 qos_discarded_frm_cnt[8]; + /** Qos mpdus Rx count */ + t_u32 qos_mpdus_rx_cnt[8]; + /** Qos retry rx count */ + t_u32 qos_retries_rx_cnt[8]; + /** CMACICV errors count */ + t_u32 cmacicv_errors; + /** CMAC replays count */ + t_u32 cmac_replays; + /** mgmt CCMP replays count */ + t_u32 mgmt_ccmp_replays; + /** TKIP ICV errors count */ + t_u32 tkipicv_errors; + /** TKIP replays count */ + t_u32 tkip_replays; + /** CCMP decrypt errors count */ + t_u32 ccmp_decrypt_errors; + /** CCMP replays count */ + t_u32 ccmp_replays; + /** Tx amsdu count */ + t_u32 tx_amsdu_cnt; + /** failed amsdu count */ + t_u32 failed_amsdu_cnt; + /** retry amsdu count */ + t_u32 retry_amsdu_cnt; + /** multi-retry amsdu count */ + t_u32 multi_retry_amsdu_cnt; + /** Tx octets in amsdu count */ + t_u64 tx_octets_in_amsdu_cnt; + /** amsdu ack failure count */ + t_u32 amsdu_ack_failure_cnt; + /** Rx amsdu count */ + t_u32 rx_amsdu_cnt; + /** Rx octets in amsdu count */ + t_u64 rx_octets_in_amsdu_cnt; + /** Tx ampdu count */ + t_u32 tx_ampdu_cnt; + /** tx mpdus in ampdu count */ + t_u32 tx_mpdus_in_ampdu_cnt; + /** tx octets in ampdu count */ + t_u64 tx_octets_in_ampdu_cnt; + /** ampdu Rx count */ + t_u32 ampdu_rx_cnt; + /** mpdu in Rx ampdu count */ + t_u32 mpdu_in_rx_ampdu_cnt; + /** Rx octets ampdu count */ + t_u64 rx_octets_in_ampdu_cnt; + /** ampdu delimiter CRC error count */ + t_u32 ampdu_delimiter_crc_error_cnt; + /** Rx Stuck Related Info*/ + /** Rx Stuck Issue count */ + t_u32 rx_stuck_issue_cnt[2]; + /** Rx Stuck Recovery count */ + t_u32 rx_stuck_recovery_cnt; + /** Rx Stuck TSF */ + t_u64 rx_stuck_tsf[2]; + /** Tx Watchdog Recovery Related Info */ + /** Tx Watchdog Recovery count */ + t_u32 tx_watchdog_recovery_cnt; + /** Tx Watchdog TSF */ + t_u64 tx_watchdog_tsf[2]; + /** Channel Switch Related Info */ + /** Channel Switch Announcement Sent */ + t_u32 channel_switch_ann_sent; + /** Channel Switch State */ + t_u32 channel_switch_state; + /** Register Class */ + t_u32 reg_class; + /** Channel Number */ + t_u32 channel_number; + /** Channel Switch Mode */ + t_u32 channel_switch_mode; + /** Reset Rx Mac Recovery Count */ + t_u32 rx_reset_mac_recovery_cnt; + /** ISR2 Not Done Count*/ + t_u32 rx_Isr2_NotDone_Cnt; + /** GDMA Abort Count */ + t_u32 gdma_abort_cnt; + /** Rx Reset MAC Count */ + t_u32 g_reset_rx_mac_cnt; + // Ownership error counters + /*Error Ownership error count*/ + t_u32 dwCtlErrCnt; + /*Control Ownership error count*/ + t_u32 dwBcnErrCnt; + /*Control Ownership error count*/ + t_u32 dwMgtErrCnt; + /*Control Ownership error count*/ + t_u32 dwDatErrCnt; + /*BIGTK MME good count*/ + t_u32 bigtk_mmeGoodCnt; + /*BIGTK Replay error count*/ + t_u32 bigtk_replayErrCnt; + /*BIGTK MIC error count*/ + t_u32 bigtk_micErrCnt; + /*BIGTK MME not included count*/ + t_u32 bigtk_mmeNotFoundCnt; +} PACK_END wifi_pkt_stats_t; + +int wifi_get_log(wifi_pkt_stats_t *stats, mlan_bss_type bss_type); +#endif + +int wifi_set_packet_filters(wifi_flt_cfg_t *flt_cfg); + +int wifi_uap_stop(); +#if CONFIG_WPA_SUPP_AP +int wifi_uap_do_acs(const int *freq_list); +#endif + +#if CONFIG_WIFI_CAPA +/** + * Set uAP capability + * + * User can set uAP capability of 11ax/11ac/11n/legacy. Default is 11ax. + * + * @param[in] wlan_capa uAP capability bitmap. + * 1111 - 11AX + * 0111 - 11AC + * 0011 - 11N + * 0001 - legacy + * + */ +void wifi_uap_config_wifi_capa(uint8_t wlan_capa); +void wifi_get_fw_info(mlan_bss_type type, t_u16 *fw_bands); +#endif +int wifi_get_data_rate(wifi_ds_rate *ds_rate, mlan_bss_type bss_type); + +int wifi_uap_set_bandwidth(const t_u8 bandwidth); + +t_u8 wifi_uap_get_bandwidth(); + +int wifi_uap_get_pmfcfg(t_u8 *mfpc, t_u8 *mfpr); + +int wifi_uap_get_pmfcfg(t_u8 *mfpc, t_u8 *mfpr); + +#if CONFIG_WIFI_RTS_THRESHOLD +int wifi_set_rts(int rts, mlan_bss_type bss_type); +#endif + +#if CONFIG_WIFI_FRAG_THRESHOLD +int wifi_set_frag(int frag, mlan_bss_type bss_type); +#endif + +#if CONFIG_11R +bool wifi_same_ess_ft(); +#endif + +#if CONFIG_11K_OFFLOAD +int wifi_11k_cfg(int enable_11k); +int wifi_11k_neighbor_req(); +#endif + +#if CONFIG_11K +#define BEACON_REPORT_BUF_SIZE 1400 + +/* Reporting Detail values */ +enum wlan_rrm_beacon_reporting_detail +{ + WLAN_RRM_REPORTING_DETAIL_NONE = 0, + WLAN_RRM_REPORTING_DETAIL_AS_REQUEST = 1, + WLAN_RRM_REPORTING_DETAIL_ALL_FIELDS_AND_ELEMENTS = 2, +}; + +typedef struct _wlan_rrm_beacon_report_data +{ + t_u8 token; + t_u8 ssid[MLAN_MAX_SSID_LENGTH]; + t_u8 ssid_length; + t_u8 bssid[MLAN_MAC_ADDR_LENGTH]; + t_u8 channel[MAX_CHANNEL_LIST]; + t_u8 channel_num; + t_u8 last_ind; + t_u16 duration; + enum wlan_rrm_beacon_reporting_detail report_detail; + t_u8 bits_field[32]; +} wlan_rrm_beacon_report_data; + +typedef struct _wlan_rrm_scan_cb_param +{ + wlan_rrm_beacon_report_data rep_data; + t_u8 dialog_tok; + t_u8 dst_addr[MLAN_MAC_ADDR_LENGTH]; + t_u8 protect; +} wlan_rrm_scan_cb_param; + +int wifi_host_11k_cfg(int enable_11k); + +int wifi_host_11k_neighbor_req(const char *ssid); +#endif + +#if CONFIG_11V +int wifi_host_11v_bss_trans_query(t_u8 query_reason); +#endif + +#if (CONFIG_11K) || (CONFIG_11V) +/* Neighbor List Mode values */ +enum wlan_nlist_mode +{ +#if (CONFIG_11K) + WLAN_NLIST_11K = 1, +#endif +#if (CONFIG_11V) + WLAN_NLIST_11V = 2, + WLAN_NLIST_11V_PREFERRED = 3, +#endif +}; + +#define MAX_NEIGHBOR_AP_LIMIT 6U + +typedef struct _wlan_rrm_neighbor_ap_t +{ + char ssid[MLAN_MAX_SSID_LENGTH]; + t_u8 bssid[MLAN_MAX_SSID_LENGTH]; + t_u8 bssidInfo[32]; + int op_class; + int channel; + int phy_type; + int freq; +} wlan_rrm_neighbor_ap_t; + +typedef struct _wlan_neighbor_report_t +{ + wlan_rrm_neighbor_ap_t neighbor_ap[MAX_NEIGHBOR_AP_LIMIT]; + int neighbor_cnt; +} wlan_rrm_neighbor_report_t; + +typedef struct _wlan_nlist_report_param +{ + enum wlan_nlist_mode nlist_mode; + t_u8 num_channels; + t_u8 channels[MAX_NUM_CHANS_IN_NBOR_RPT]; +#if (CONFIG_11V) + t_u8 btm_mode; + t_u8 bssid[MLAN_MAC_ADDR_LENGTH]; + t_u8 dialog_token; + t_u8 dst_addr[MLAN_MAC_ADDR_LENGTH]; + t_u8 protect; +#endif +} wlan_nlist_report_param; +#endif + +int wifi_clear_mgmt_ie(mlan_bss_type bss_type, IEEEtypes_ElementId_t index, int mgmt_bitmap_index); + +#if CONFIG_UAP_STA_MAC_ADDR_FILTER +int wifi_set_sta_mac_filter(int filter_mode, int mac_count, unsigned char *mac_addr); +#endif + +int wifi_set_auto_arp(t_u32 *ipv4_addr); + +int wifi_tcp_keep_alive(wifi_tcp_keep_alive_t *keep_alive, t_u8 *src_mac, t_u32 src_ip); + +#if CONFIG_CLOUD_KEEP_ALIVE +int wifi_cloud_keep_alive(wifi_cloud_keep_alive_t *keep_alive, t_u16 action, t_u8 *enable); +#endif + +#if CONFIG_HOST_SLEEP +int wifi_set_packet_filters(wifi_flt_cfg_t *flt_cfg); +int wakelock_get(void); +int wakelock_put(void); +int wakelock_isheld(void); +void wifi_print_wakeup_reason(t_u16 hs_wakeup_reason); +void wifi_clear_wakeup_reason(void); +#endif + +int wifi_raw_packet_send(const t_u8 *packet, t_u32 length); + +int wifi_raw_packet_recv(t_u8 **data, t_u32 *pkt_type); + +#if CONFIG_11AX +int wifi_set_11ax_tx_omi(const mlan_bss_type bss_type, + const t_u16 tx_omi, + const t_u8 tx_option, + const t_u8 num_data_pkts); +int wifi_set_11ax_tol_time(const t_u32 tol_time); +int wifi_set_11ax_rutxpowerlimit(const void *rutx_pwr_cfg, uint32_t rutx_pwr_cfg_len); +int wifi_set_11ax_rutxpowerlimit_legacy(const wifi_rutxpwrlimit_t *ru_pwr_cfg); +int wifi_get_11ax_rutxpowerlimit_legacy(wifi_rutxpwrlimit_t *ru_pwr_cfg); +/** Set 11ax config params + * + * \param[in, out] ax_config 11AX config parameters to be sent to Firmware + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wifi_set_11ax_cfg(wifi_11ax_config_t *ax_config); + +#if CONFIG_11AX_TWT +/** Set btwt config params + * + * \param[in] btwt_config Broadcast TWT setup parameters to be sent to Firmware + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wifi_set_btwt_cfg(const wifi_btwt_config_t *btwt_config); + +/** Set twt setup config params + * + * \param[in] twt_setup TWT Setup parameters to be sent to Firmware + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wifi_set_twt_setup_cfg(const wifi_twt_setup_config_t *twt_setup); + +/** Set twt teardown config params + * + * \param[in] teardown_config TWT Teardown parameters to be sent to Firmware + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wifi_set_twt_teardown_cfg(const wifi_twt_teardown_config_t *teardown_config); + +/** Get twt report + * + * \param[out] twt_report TWT Report parameters to be sent to Firmware + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wifi_get_twt_report(wifi_twt_report_t *twt_report); + +/** Twt information + * + * \param[out] twt_report TWT Information + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wifi_twt_information(wifi_twt_information_t *information); +#endif /* CONFIG_11AX_TWT */ +#endif + +#if CONFIG_WIFI_CLOCKSYNC +int wifi_set_clocksync_cfg(const wifi_clock_sync_gpio_tsf_t *tsf_latch, mlan_bss_type bss_type); +int wifi_get_tsf_info(wifi_tsf_info_t *tsf_info); +#endif /* CONFIG_WIFI_CLOCKSYNC */ + +#if CONFIG_RF_TEST_MODE + +int wifi_set_rf_test_mode(void); + +int wifi_unset_rf_test_mode(void); + +int wifi_set_rf_channel(const uint8_t channel); + +int wifi_set_rf_radio_mode(const uint8_t mode); + +int wifi_get_rf_channel(uint8_t *channel); + +int wifi_get_rf_radio_mode(uint8_t *mode); + +int wifi_set_rf_band(const uint8_t band); + +int wifi_get_rf_band(uint8_t *band); + +int wifi_set_rf_bandwidth(const uint8_t bandwidth); + +int wifi_get_rf_bandwidth(uint8_t *bandwidth); + +int wifi_get_rf_per(uint32_t *rx_tot_pkt_count, uint32_t *rx_mcast_bcast_count, uint32_t *rx_pkt_fcs_error); + +int wifi_set_rf_tx_cont_mode(const uint32_t enable_tx, + const uint32_t cw_mode, + const uint32_t payload_pattern, + const uint32_t cs_mode, + const uint32_t act_sub_ch, + const uint32_t tx_rate); + +int wifi_set_rf_tx_antenna(const uint8_t antenna); + +int wifi_get_rf_tx_antenna(uint8_t *antenna); + +int wifi_set_rf_rx_antenna(const uint8_t antenna); + +int wifi_get_rf_rx_antenna(uint8_t *antenna); + +int wifi_set_rf_tx_power(const uint32_t power, const uint8_t mod, const uint8_t path_id); + +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); + +int wifi_rf_trigger_frame_cfg(uint32_t Enable_tx, + uint32_t Standalone_hetb, + uint8_t FRAME_CTRL_TYPE, + uint8_t FRAME_CTRL_SUBTYPE, + uint16_t FRAME_DURATION, + uint64_t TriggerType, + uint64_t UlLen, + uint64_t MoreTF, + uint64_t CSRequired, + uint64_t UlBw, + uint64_t LTFType, + uint64_t LTFMode, + uint64_t LTFSymbol, + uint64_t UlSTBC, + uint64_t LdpcESS, + uint64_t ApTxPwr, + uint64_t PreFecPadFct, + uint64_t PeDisambig, + uint64_t SpatialReuse, + uint64_t Doppler, + uint64_t HeSig2, + uint32_t AID12, + uint32_t RUAllocReg, + uint32_t RUAlloc, + uint32_t UlCodingType, + uint32_t UlMCS, + uint32_t UlDCM, + uint32_t SSAlloc, + uint8_t UlTargetRSSI, + uint8_t MPDU_MU_SF, + uint8_t TID_AL, + uint8_t AC_PL, + uint8_t Pref_AC); + +int wifi_set_rf_tx_frame(const uint32_t enable, + const uint32_t data_rate, + const uint32_t frame_pattern, + const uint32_t frame_length, + const uint16_t adjust_burst_sifs, + const uint32_t burst_sifs_in_us, + const uint32_t short_preamble, + const uint32_t act_sub_ch, + const uint32_t short_gi, + const uint32_t adv_coding, + const uint32_t tx_bf, + const uint32_t gf_mode, + const uint32_t stbc, + const uint8_t *bssid); + +int wifi_set_rf_otp_mac_addr(uint8_t *mac); + +int wifi_get_rf_otp_mac_addr(uint8_t *mac); + +int wifi_set_rf_otp_cal_data(const uint8_t *cal_data, uint32_t cal_data_len); + +int wifi_get_rf_otp_cal_data(uint8_t *cal_data); +#endif +#if CONFIG_WIFI_FW_DEBUG +/** This function registers callbacks which are used to generate FW Dump on USB + * device. + * + * \param[in] wifi_usb_mount_cb Callback to mount usb device. + * \param[in] wifi_usb_file_open_cb Callback to open file on usb device for FW dump. + * \param[in] wifi_usb_file_write_cb Callback to write FW dump data to opened file. + * \param[in] wifi_usb_file_close_cb Callback to close FW dump file. + * + */ +void wifi_register_fw_dump_cb(int (*wifi_usb_mount_cb)(), + int (*wifi_usb_file_open_cb)(char *test_file_name), + int (*wifi_usb_file_write_cb)(uint8_t *data, size_t data_len), + int (*wifi_usb_file_close_cb)()); +#endif + +#if CONFIG_WMM +void wifi_wmm_init(); +t_u32 wifi_wmm_get_pkt_prio(void *buf, t_u8 *tid); +t_u8 wifi_wmm_get_packet_cnt(void); +/* handle EVENT_TX_DATA_PAUSE */ +void wifi_handle_event_data_pause(void *data); +void wifi_wmm_tx_stats_dump(int bss_type); +#endif /* CONFIG_WMM */ + +int wifi_set_rssi_low_threshold(uint8_t *low_rssi); + +#if CONFIG_HEAP_DEBUG +/** + * Show os mem alloc and free info. + * + */ +void wifi_show_os_mem_stat(); +#endif + +#if CONFIG_WPS2 +/** + * enable/disable WPS session + * + * \param[in] option -- 1 is WPS session START, 0 is WPS session END + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wifi_send_wps_cfg_cmd(int option); + +int wps_low_level_output(const uint8_t interface, const uint8_t *buf, const uint16_t len); + +#endif /* CONFIG_WPS2 */ + +#if CONFIG_1AS +mlan_status raw_wlan_xmit_pkt(t_u8 *buffer, t_u32 txlen, t_u8 interface, t_u32 tx_control); +#endif + +#if CONFIG_MULTI_CHAN +/** + * Set multi-channel stayed time in us. + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wifi_set_mc_cfg(uint32_t channel_time); + +/** + * Get multi-channel stayed time in us. + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wifi_get_mc_cfg(uint32_t *channel_time); + +/** + * Set multi-channel status disable/enable. + * \param[in] status status disable/enable + * 0-disable, 1-enable + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wifi_set_mc_policy(const int status); +/** + * Get multi-channel status disable/enable. + * + * \return status 0-disable, 1-enable. + */ +int wifi_get_mc_policy(void); + +/** + * Set multi-channel config. + * \param[in] num array length of drcs_cfg[] + * \param[in] drcs multi-channel config, maybe an array + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wifi_set_mc_cfg_ext(const wifi_drcs_cfg_t *drcs, const int num); + +/** + * Get multi-channel config. + * \param[in] num array length of drcs_cfg[] + * \param[out] drcs multi-channel config, maybe an array + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wifi_get_mc_cfg_ext(wifi_drcs_cfg_t *drcs, int num); +#endif + +/** + *Frame Tx - Injecting Wireless frames from Host + * + * This function is used to Inject Wireless frames from application + * directly. + * + * \note All injected frames will be sent on station interface. Application + * needs minimum of 2 KBytes stack for successful operation. + * Also application have to take care of allocating buffer for 802.11 Wireless + * frame (Header + Data) and freeing allocated buffer. Also this + * API may not work when Power Save is enabled on station interface. + * + * \param[in] bss_type The interface on which management frame needs to be send. + * \param[in] buff Buffer holding 802.11 Wireless frame (Header + Data). + * \param[in] len Length of the 802.11 Wireless frame. + * + * \return WM_SUCCESS on success or error code. + * + **/ + +int wifi_inject_frame(const enum wlan_bss_type bss_type, const uint8_t *buff, const size_t len); + +int wifi_supp_inject_frame(const unsigned int bss_type, const uint8_t *buff, const size_t len); +#if CONFIG_WPA_SUPP +void wifi_is_wpa_supplicant_input(const uint8_t interface, const uint8_t *buffer, const uint16_t len); +void wifi_wpa_supplicant_eapol_input(const uint8_t interface, + const uint8_t *src_addr, + const uint8_t *buffer, + const uint16_t len); +int wifi_nxp_get_wiphy(const unsigned int bss_type); +int wifi_nxp_get_conn_info(uint16_t *beacon_interval, uint8_t *dtim_period, bool *twt_capable); +t_u8 wifi_get_sec_channel_offset(unsigned int chan); +int wifi_nxp_scan_res_get(void); +int wifi_nxp_survey_res_get(void); +int wifi_nxp_set_default_scan_ies(const u8 *ies, size_t ies_len); +void wifi_nxp_reset_scan_flag(); +#endif + +#if CONFIG_1AS +/** + * Get correlated time + * \param[out] host time and fw time in ns + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wifi_get_fw_timestamp(wifi_correlated_time_t *time); + +/** + * request DOT1AS slave state machine + * \param[in] bss_type interface index + * \param[in] peer_mac destination mac address of timing measurement request frame + * \param[in] trigger 1-start, 0-stop timing measurement procedure + */ +void wifi_request_timing_measurement(int bss_type, t_u8 *peer_mac, t_u8 trigger); + +/** + * start DOT1AS master state machine + * \param[in] bss_type interface index + * \param[in] peer_mac destination mac address of timing measurement frame + * \param[in] num_of_tm number of timing measurement frames + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wifi_start_timing_measurement(int bss_type, t_u8 *peer_mac, uint8_t num_of_tm); + +/** + * end DOT1AS master state machine report + * \param[out] bss_type interface index + */ +void wifi_end_timing_measurement(int bss_type); +#endif +#if CONFIG_DRIVER_MBO +int wifi_host_mbo_cfg(int enable_mbo); +int wifi_mbo_preferch_cfg(t_u8 ch0, t_u8 pefer0, t_u8 ch1, t_u8 pefer1); +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); +#endif + +#if CONFIG_ECSA + +/** + * Send the ecsa config parameter to FW by TLV. + * + *\param[in] block_tx 0 -- no need to block traffic,1 -- need block traffic. + *\param[in] oper_class Operating class according to IEEE std802.11 spec, when 0 is used, only CSA IE will be used. + *\param[in] channel The channel will switch to. + *\param[in] switch_count Channel switch time to send ECSA ie. + *\param[in] band_width Channel width switch to(optional),only for 5G channels. + *\param[in] ecsa True need to get operclass by band_width and channel, Otherwise, no need + * + * \return WM_SUCCESS if successful otherwise failure. + */ +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); + +/** + * Send the ecsa config parameter to FW by action. + * + *\param[in] block_tx 0 -- no need to block traffic,1 -- need block traffic. + *\param[in] oper_class Operating class according to IEEE std802.11 spec, when 0 is used, only CSA IE will be used. + *\param[in] channel The channel will switch to. + *\param[in] switch_count Channel switch time to send ECSA ie. + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wifi_set_action_ecsa_cfg(t_u8 block_tx, t_u8 oper_class, t_u8 channel, t_u8 switch_count); + +/** + * Record the ECSA blcok tx time. + * + *\param[in] switch_count FW expire at switch_count*beacon_period,and then switch to new_channel. + * + * \return void. + */ +void set_ecsa_block_tx_time(t_u8 switch_count); + +/** + * Get the blcok tx time when need to block traffic. + * + * \return blcok tx time. + */ +t_u8 get_ecsa_block_tx_time(); + +/** + * Record whether block tx is required. + * + *\param[in] flag Flag is true, if block tx is required,otherwise, flag is false. + * + * \return void. + */ +void set_ecsa_block_tx_flag(bool block_tx); + +/** + * Get the block tx status. + * + * \return true block tx is required, false not required. + */ +bool get_ecsa_block_tx_flag(); + +void wifi_put_ecsa_sem(void); + +/** wifi_ecsa_status_control */ +typedef struct _wifi_ecsa_status_control +{ + /** block tx required*/ + bool required; + /** block time of one detect period*/ + t_u8 block_time; + /** Semaphore to wait ECSA complete */ + OSA_SEMAPHORE_HANDLE_DEFINE(ecsa_sem); +} wifi_ecsa_status_control; +#endif + +typedef struct _wifi_ecsa_info +{ + t_u8 bss_type; + t_u8 band_config; + /** channel */ + t_u8 channel; +} wifi_ecsa_info; + +#ifdef RW610 +#if CONFIG_HOST_SLEEP +extern int wakeup_by; +#define WAKEUP_BY_WLAN 0x1 +#define WAKEUP_BY_RTC 0x2 +#define WAKEUP_BY_PIN1 0x4 +#endif +#endif + +#if CONFIG_CSI +/** + * Send the csi config parameter to FW. + * + *\param[in] csi_params Csi config parameter + * \return WM_SUCCESS if successful otherwise failure. + */ +int wifi_csi_cfg(wifi_csi_config_params_t *csi_params); +int register_csi_user_callback(int (*csi_data_recv_callback)(void *buffer, size_t len)); +int unregister_csi_user_callback(void); +void csi_local_buff_init(); +void csi_save_data_to_local_buff(void *data); +void csi_deliver_data_to_user(); + +typedef struct _csi_local_buff_statu +{ + t_u8 write_index; + t_u8 read_index; + t_u8 valid_data_cnt; + /** Semaphore to protect data parameters */ + OSA_SEMAPHORE_HANDLE_DEFINE(csi_data_sem); +} csi_local_buff_statu; + +extern int csi_event_cnt; +extern t_u64 csi_event_data_len; +#endif +#if CONFIG_NET_MONITOR +/** + * Send the net monitor config parameter to FW. + * + *\param[in] monitor Monitor config parameter. + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wifi_net_monitor_cfg(wifi_net_monitor_t *monitor); + +/** + * Register user callback to receive monitor data. + * + *\param[in] monitor_cb User callback function. + * + * \return void. + */ +void register_monitor_user_callback(int (*monitor_cb)(void *frame, t_u16 len)); + +/** + * Deregister user callback for monitor feature. + * + * \return void. + */ +void deregister_monitor_user_callback(); + +/** + * Record the status when start monitor. + * + *\param[in] flag Flag is true, when in monitor mode,otherwise, flag is false. + * + * \return void. + */ +void set_monitor_flag(bool flag); + +/** + * Get the monitor status to determine if it is in monitor mode. + * + * \return true in monitor mode, false in other modes. + */ +bool get_monitor_flag(); + +#endif + +int wifi_send_mgmt_auth_request(const t_u8 channel, + const t_u8 auth_alg, + const t_u8 *auth_seq_num, + const t_u8 *status_code, + const t_u8 *dest, + const t_u8 *sae_data, + const t_u16 sae_data_len); +int wifi_send_scan_cmd(t_u8 bss_mode, + const t_u8 *specific_bssid, + const char *ssid, + uint8_t ssid_num, + const t_u8 num_channels, + const wifi_scan_channel_list_t *chan_list, + const t_u8 num_probes, +#if CONFIG_SCAN_WITH_RSSIFILTER + const t_s16 rssi_threshold, +#endif +#if CONFIG_SCAN_CHANNEL_GAP + const t_u16 scan_chan_gap, +#endif + const bool keep_previous_scan, + const bool active_scan_triggered); +int wifi_deauthenticate(uint8_t *bssid); + +#if CONFIG_TURBO_MODE +int wifi_get_turbo_mode(t_u8 *mode); +int wifi_get_uap_turbo_mode(t_u8 *mode); +int wifi_set_turbo_mode(t_u8 mode); +int wifi_set_uap_turbo_mode(t_u8 mode); +#endif + +#if CONFIG_WPA_SUPP_AP +t_u16 wifi_get_default_ht_capab(); +t_u32 wifi_get_default_vht_capab(); + +void wifi_uap_client_assoc(t_u8 *sta_addr, unsigned char is_11n_enabled); +void wifi_uap_client_deauth(t_u8 *sta_addr); + +#endif +/** + * @brief This function converts region string to region code + * + * @param region_string Region string + * + * @return Region code + */ +t_u8 region_string_2_region_code(t_u8 *region_string); + +#if CONFIG_COEX_DUTY_CYCLE +int wifi_single_ant_duty_cycle(t_u16 enable, t_u16 nbTime, t_u16 wlanTime); +int wifi_dual_ant_duty_cycle(t_u16 enable, t_u16 nbTime, t_u16 wlanTime, t_u16 wlanBlockTime); +#endif + +#ifdef RW610 +/* get CAU module temperature and write to firmware */ +void wifi_cau_temperature_enable(void); +int wifi_cau_temperature_write_to_firmware(void); +int32_t wifi_get_temperature(void); +#endif + +#if (CONFIG_WIFI_IND_RESET) && (CONFIG_WIFI_IND_DNLD) +int wifi_set_indrst_cfg(const wifi_indrst_cfg_t *indrst_cfg, mlan_bss_type bss_type); +int wifi_get_indrst_cfg(wifi_indrst_cfg_t *indrst_cfg, mlan_bss_type bss_type); +int wifi_test_independent_reset(); +int wifi_trigger_oob_indrst(); +#endif + +#if CONFIG_WIFI_BOOT_SLEEP +int wifi_boot_sleep(uint16_t action, uint16_t *enable); +#endif + +#if CONFIG_AUTO_NULL_TX +int wifi_auto_null_tx(wifi_auto_null_tx_t *auto_null_tx, mlan_bss_type bss_type); +#endif + +#if CONFIG_WPA_SUPP +void hostapd_connected_sta_list(wifi_sta_info_t *si, wifi_sta_list_t *sl); +#endif +bool wifi_is_remain_on_channel(void); + +#endif /* __WIFI_H__ */ diff --git a/mcux/middleware/wifi_nxp/incl/wifidriver/wifi_events.h b/mcux/middleware/wifi_nxp/incl/wifidriver/wifi_events.h new file mode 100644 index 000000000..a16720d79 --- /dev/null +++ b/mcux/middleware/wifi_nxp/incl/wifidriver/wifi_events.h @@ -0,0 +1,241 @@ +/* + * Copyright 2008-2024 NXP + * + * SPDX-License-Identifier: BSD-3-Clause + * + */ + +/*! \file wifi_events.h + * \brief Wi-Fi events + */ + +#ifndef __WIFI_EVENTS_H__ +#define __WIFI_EVENTS_H__ + +#include + +/** Wifi events */ +enum wifi_event +{ + /** uAP Started */ + WIFI_EVENT_UAP_STARTED = 0, + /** uAP Client Assoc */ + WIFI_EVENT_UAP_CLIENT_ASSOC, + /** uAP Client connected */ + WIFI_EVENT_UAP_CLIENT_CONN, + /** uAP Client De-authentication */ + WIFI_EVENT_UAP_CLIENT_DEAUTH, + /** uAP Network Address Configuration */ + WIFI_EVENT_UAP_NET_ADDR_CONFIG, + /** uAP Stopped */ + WIFI_EVENT_UAP_STOPPED, + /** uAP Last */ + WIFI_EVENT_UAP_LAST, + /* All the uAP related events need to be above and STA related events + * below */ + /** Scan start event when scan is started */ + WIFI_EVENT_SCAN_START, + /** Scan Result */ + WIFI_EVENT_SCAN_RESULT, + /** Survey Result Get */ + WIFI_EVENT_SURVEY_RESULT_GET, + /** Get hardware spec */ + WIFI_EVENT_GET_HW_SPEC, + /** Association */ + WIFI_EVENT_ASSOCIATION, +#if CONFIG_WPA_SUPP +#if CONFIG_AUTO_RECONNECT + /** Association Notify */ + WIFI_EVENT_ASSOCIATION_NOTIFY, +#endif +#endif + /** PMK */ + WIFI_EVENT_PMK, + /** Authentication */ + WIFI_EVENT_AUTHENTICATION, + /** Disassociation */ + WIFI_EVENT_DISASSOCIATION, + /** De-authentication */ + WIFI_EVENT_DEAUTHENTICATION, + /** Link Loss */ + WIFI_EVENT_LINK_LOSS, + /* WiFi RSSI Low Event */ + WIFI_EVENT_RSSI_LOW, + /** Firmware Hang event */ + WIFI_EVENT_FW_HANG, + /** Firmware Reset event */ + WIFI_EVENT_FW_RESET, +#if CONFIG_SUBSCRIBE_EVENT_SUPPORT + /* WiFi RSSI High Event */ + WIFI_EVENT_RSSI_HIGH, + /* WiFi SRN Low Event */ + WIFI_EVENT_SNR_LOW, + /* WiFi SNR High Event */ + WIFI_EVENT_SNR_HIGH, + /* WiFi Max Fail Event */ + WIFI_EVENT_MAX_FAIL, + /* WiFi Beacon miised Event */ + WIFI_EVENT_BEACON_MISSED, + /* WiFi Data RSSI Low Event */ + WIFI_EVENT_DATA_RSSI_LOW, + /* WiFi Data RSSI High Event */ + WIFI_EVENT_DATA_RSSI_HIGH, + /* WiFi Data SNR Low Event */ + WIFI_EVENT_DATA_SNR_LOW, + /* WiFi Data SNR High Event */ + WIFI_EVENT_DATA_SNR_HIGH, + /* WiFi Link Quality Event */ + WIFI_EVENT_FW_LINK_QUALITY, + /* WiFi Pre Beacon Lost Event */ + WIFI_EVENT_FW_PRE_BCN_LOST, +#endif +#if CONFIG_HOST_SLEEP + /* Host sleep activated */ + WIFI_EVENT_HS_ACTIVATED, + /** HS configuration */ + WIFI_EVENT_HS_CONFIG, + /* Sleep confirm done */ + WIFI_EVENT_SLEEP_CONFIRM_DONE, +#endif + /** Network station address configuration */ + WIFI_EVENT_NET_STA_ADDR_CONFIG, + /** Network interface configuration */ + WIFI_EVENT_NET_INTERFACE_CONFIG, + /** WEP configuration */ + WIFI_EVENT_WEP_CONFIG, + /** STA MAC address configuration */ + WIFI_EVENT_STA_MAC_ADDR_CONFIG, + /** UAP MAC address configuration */ + WIFI_EVENT_UAP_MAC_ADDR_CONFIG, + /** Network DHCP configuration */ + WIFI_EVENT_NET_DHCP_CONFIG, + /** Supplicant PMK */ + WIFI_EVENT_SUPPLICANT_PMK, + /** Sleep */ + WIFI_EVENT_SLEEP, + /** IEEE PS */ + WIFI_EVENT_IEEE_PS, + /** Deep Sleep */ + WIFI_EVENT_DEEP_SLEEP, + /** WNM ps */ + WIFI_EVENT_WNM_PS, + /** IEEE and Deep Sleep */ + WIFI_EVENT_IEEE_DEEP_SLEEP, + /** WNM and Deep Sleep */ + WIFI_EVENT_WNM_DEEP_SLEEP, + /** PS Invalid */ + WIFI_EVENT_PS_INVALID, + /** Error Multicast */ + WIFI_EVENT_ERR_MULTICAST, + /** error Unicast */ + WIFI_EVENT_ERR_UNICAST, + /** 802.11K/11V neighbor report */ + WIFI_EVENT_NLIST_REPORT, + /* Add Block Ack */ + /** 802.11N add block ack */ + WIFI_EVENT_11N_ADDBA, + /** 802.11N block Ack stream timeout */ + WIFI_EVENT_11N_BA_STREAM_TIMEOUT, + /** 802.11n Delete block add */ + WIFI_EVENT_11N_DELBA, + /** 802.11n aggregation control */ + WIFI_EVENT_11N_AGGR_CTRL, + /** Channel Switch Announcement */ + WIFI_EVENT_CHAN_SWITCH_ANN, + /** Channel Switch */ + WIFI_EVENT_CHAN_SWITCH, +#if CONFIG_IPV6 + /** IPv6 address state change */ + WIFI_EVENT_NET_IPV6_CONFIG, +#endif +#if CONFIG_WLAN_BRIDGE + /** Auto link switch network */ + WIFI_EVENT_AUTOLINK_NETWORK_SWITCHED, +#endif + /* Background Scan Report */ + WIFI_EVENT_BG_SCAN_REPORT, + /* Background Scan Stop */ + WIFI_EVENT_BG_SCAN_STOPPED, + /* Event to indicate RX Management Frame */ + WIFI_EVENT_MGMT_FRAME, + /* Event to indicate remain on channel started */ + WIFI_EVENT_REMAIN_ON_CHANNEL, + /* Event to indicate Management tx status */ + WIFI_EVENT_MGMT_TX_STATUS, +#if CONFIG_CSI + /* Recv csi data */ + WIFI_EVENT_CSI, +#endif +#if (CONFIG_11MC) || (CONFIG_11AZ) + /* Event to trigger or stop ftm*/ + WIFI_EVENT_FTM_COMPLETE, +#if CONFIG_WLS_CSI_PROC + WIFI_EVENT_WLS_CSI, +#endif +#endif + /** Event to set region power*/ + WIFI_EVENT_REGION_POWER_CFG, + /** Event to indicate end of Wi-Fi events */ + WIFI_EVENT_LAST, + /* other events can be added after this, however this must + be the last event in the wifi module */ +}; + +/** WiFi Event Reason */ +enum wifi_event_reason +{ + /** Success */ + WIFI_EVENT_REASON_SUCCESS, + /** Timeout */ + WIFI_EVENT_REASON_TIMEOUT, + /** Failure */ + WIFI_EVENT_REASON_FAILURE, +}; + +/** Network wireless BSS Type */ +enum wlan_bss_type +{ + /** Station */ + WLAN_BSS_TYPE_STA = 0, + /** uAP */ + WLAN_BSS_TYPE_UAP = 1, +#if CONFIG_P2P + /** WiFi Direct */ + WLAN_BSS_TYPE_WIFIDIRECT = 2, +#endif + /** Any */ + WLAN_BSS_TYPE_ANY = 0xff, +}; + +/** Network wireless BSS Role */ +enum wlan_bss_role +{ + /** Infrastructure network. The system will act as a station connected + * to an Access Point. */ + WLAN_BSS_ROLE_STA = 0, + /** uAP (micro-AP) network. The system will act as an uAP node to + * which other Wireless clients can connect. */ + WLAN_BSS_ROLE_UAP = 1, + /** Either Infrastructure network or micro-AP network */ + WLAN_BSS_ROLE_ANY = 0xff, +}; + +/** This enum defines various wakeup events + * for which wakeup will occur */ +enum wifi_wakeup_event_t +{ + /** Wakeup on broadcast */ + WIFI_WAKE_ON_ALL_BROADCAST = 1, + /** Wakeup on unicast */ + WIFI_WAKE_ON_UNICAST = 1 << 1, + /** Wakeup on MAC event */ + WIFI_WAKE_ON_MAC_EVENT = 1 << 2, + /** Wakeup on multicast */ + WIFI_WAKE_ON_MULTICAST = 1 << 3, + /** Wakeup on ARP broadcast */ + WIFI_WAKE_ON_ARP_BROADCAST = 1 << 4, + /** Wakeup on receiving a management frame */ + WIFI_WAKE_ON_MGMT_FRAME = 1 << 6, +}; + +#endif /*__WIFI_EVENTS_H__*/ diff --git a/mcux/middleware/wifi_nxp/incl/wifidriver/wifi_nxp.h b/mcux/middleware/wifi_nxp/incl/wifidriver/wifi_nxp.h new file mode 100644 index 000000000..4ae56ccdd --- /dev/null +++ b/mcux/middleware/wifi_nxp/incl/wifidriver/wifi_nxp.h @@ -0,0 +1,73 @@ +/** @file wifi_nxp.h + * + * @brief This file provides Core Wi-Fi definition for wpa supplicant RTOS driver. + * + * Copyright 2008-2024 NXP + * + * SPDX-License-Identifier: BSD-3-Clause + * + */ + +#ifndef __WIFI_NXP_H__ +#define __WIFI_NXP_H__ + +#include +#include +#if CONFIG_WPA_SUPP +#include + +typedef struct zep_wpa_supp_dev_callbk_fns rtos_wpa_supp_dev_callbk_fns; + +#if CONFIG_WPA_SUPP_AP +typedef struct zep_hostapd_dev_callbk_fns rtos_hostapd_dev_callbk_fns; +#endif + +typedef struct zep_wpa_supp_dev_ops rtos_wpa_supp_dev_ops; + +struct wifi_nxp_ctx_rtos +{ + const struct netif *iface_ctx; + void *supp_drv_if_ctx; + + void *hapd_drv_if_ctx; + unsigned int bss_type; + + bool scan_in_progress; + uint64_t scan_start_tsf; + uint8_t scan_start_tsf_bssid[ETH_ALEN]; + + unsigned int assoc_freq; + uint8_t attempt_bssid[ETH_ALEN]; + uint8_t assoc_bssid[ETH_ALEN]; + bool associated; + bool uap_started; + bool hostapd; + rtos_wpa_supp_dev_callbk_fns supp_callbk_fns; + bool supp_called_remain_on_chan; + unsigned int remain_on_channel_freq; + unsigned int remain_on_channel_duration; + bool remain_on_chan_is_canceled; +#if CONFIG_WPA_SUPP_AP + rtos_hostapd_dev_callbk_fns hostapd_callbk_fns; +#endif + int mgmt_tx_status; + uint8_t *last_mgmt_tx_data; + size_t last_mgmt_tx_data_len; + bool ft_roaming; + struct wpa_driver_set_key_params *key_params; +}; + +int wifi_supp_init(void); +void wifi_supp_deinit(void); +int monitor_start(void); +void monitor_stop(void); +void wifi_scan_start(struct wifi_message *msg); +void wifi_scan_done(struct wifi_message *msg); +void wifi_process_remain_on_channel(struct wifi_message *msg); +void wifi_process_mgmt_tx_status(struct wifi_message *msg); +void wifi_scan_result_get(struct wifi_message *msg); +void wifi_survey_result_get(struct wifi_message *msg); + +#endif /* CONFIG_WPA_SUPP */ + +#endif /* __WIFI_NXP_H__ */ diff --git a/mcux/middleware/wifi_nxp/incl/wlcmgr/wlan.h b/mcux/middleware/wifi_nxp/incl/wlcmgr/wlan.h new file mode 100644 index 000000000..3ea998da0 --- /dev/null +++ b/mcux/middleware/wifi_nxp/incl/wlcmgr/wlan.h @@ -0,0 +1,7189 @@ +/* + * Copyright 2008-2024 NXP + * + * SPDX-License-Identifier: BSD-3-Clause + * + */ + +/*! \file wlan.h + * \brief WLAN Connection Manager + * + * The WLAN Connection Manager (WLCMGR) is one of the core components that + * provides WiFi-level functionality like scanning for networks, + * starting a network (Access Point) and associating / disassociating with + * other wireless networks. The WLCMGR manages two logical interfaces, + * the station interface and the micro-AP interface. + * Both these interfaces can be active at the same time. + * + * \section wlan_usage Usage + * + * The WLCMGR is initialized by calling \ref wlan_init() and started by + * calling \ref wlan_start(), one of the arguments of this function is a + * callback handler. Many of the WLCMGR tasks are asynchronous in nature, + * and the events are provided by invoking the callback handler. + * The various usage scenarios of the WLCMGR are outlined below: + * + * - Scanning: A call to wlan_scan() initiates an asynchronous scan of + * the nearby wireless networks. The results are reported via the callback + * handler. + * - Network Profiles: Starting / stopping wireless interfaces or + * associating / disassociating with other wireless networks is managed + * through network profiles. The network profiles record details about the + * wireless network like the SSID, type of security, security passphrase + * among other things. The network profiles can be managed by means of the + * \ref wlan_add_network() and \ref wlan_remove_network() calls. + * - Association: The \ref wlan_connect() and \ref wlan_disconnect() + * calls can be used to manage connectivity with other wireless networks + * (Access Points). These calls manage the station interface of the system. + * - Starting a Wireless Network: The \ref wlan_start_network() + * and \ref wlan_stop_network() calls can be used to start/stop + * our own (micro-AP) network. These calls manage + * the micro-AP interface of the system. + * + * @cond uml_diag + * + * \section WLCMGR_station_sm Station State Machine + * + * The WLAN Connection Manager station state diagram is as shown below. The Yellow boxes + * indicate the various states. The top half is the name of the state, and the + * bottom half consists of any code that is executed on entering that + * state. Labels on the transitions indicate when that particular transition is + * taken. + * + * @startuml{station.jpg} + * + * [*] --> Initializing + * Initializing: net_wlan_init() + * Initializing -down-> Idle : Success + * + * Idle -right-> Scanning : wlan_connect(WPA/WPA2/Mixed/Open) + * Idle -left-> Configuring : wlan_connect(WEP) + * Idle -down-> Scanning_User: wlan_scan() + * + * Scanning_User: report_scan_results() + * Scanning_User -up-> Idle: scan_success + * + * Scanning: handle_scan_results() + * Scanning -left-> Scanning : scan_success + * Scanning -down-> Associating: Success + * Configuring: wifi_send_wep_key_material_cmd() + * Configuring -down-> Scanning: Success + * + * Associating: configure_security(), wifi_assoc() + * Associating -down->Associated: assoc_success + * Associating -up->Scanning: assoc_failure + * + * Associated -down-> Requesting_Address: authentication_success + * Associated -up-> Idle: authentication_failure, disassociation, deauthentication + * + * Requesting_Address: net_configure_address() + * Requesting_Address -down-> Connected: static_ip + * Requesting_Address -left-> Obtaining_Address: dhcp_ip + * + * Obtaining_Address: dhcp_start() + * Obtaining_Address -down-> Connected: dhcp_success + * Obtaining_Address -up-> Idle: dhcp_failure + * + * Connected: net_configure_dns() + * Connected -up-> Idle: lins_loss, channel_switch, wlan_disconnect() + * + * @enduml + * + * \section WLCMGR_uap_sm Micro-AP State Machine + * + * The WLAN Connection Manager micro-AP state diagram is as shown below. The Yellow boxes + * indicate the various states. The top half is the name of the state, and the + * bottom half consists of any code that is executed on entering that + * state. Labels on the transitions indicate when that particular transition is + * taken. + * + * @startuml{uap.jpg} + * + * [*] --> Initializing + * Initializing: net_wlan_init() + * Initializing -down-> Configured: wlan_start_network() + * + * Configured: do_start() + * Configured -down-> Started: up_started + * + * Started: net_configure_address() + * Started -down-> Up: uap_addr_config + * + * Up -up-> Initializing: wlan_stop_network() + * Started -up-> Initializing: wlan_stop_network() + * + * @enduml + * + * @endcond + */ + +#ifndef __WLAN_H__ +#define __WLAN_H__ +#include + +#include +#include +#include +#include +#include + +#define WLAN_DRV_VERSION "v1.3.r49.z_up.p8" + +#if CONFIG_WPA2_ENTP +#include +#endif + +#define ARG_UNUSED(x) (void)(x) +/* Configuration */ + +#if !CONFIG_WLAN_KNOWN_NETWORKS +#define CONFIG_WLAN_KNOWN_NETWORKS 5U +#endif + +#include +#define wlcm_e(...) wmlog_e("wlcm", ##__VA_ARGS__) +#define wlcm_w(...) wmlog_w("wlcm", ##__VA_ARGS__) + +#if CONFIG_WLCMGR_DEBUG +#define wlcm_d(...) wmlog("wlcm", ##__VA_ARGS__) +#else +#define wlcm_d(...) +#endif /* ! CONFIG_WLCMGR_DEBUG */ + +#if (defined(configSUPPORT_STATIC_ALLOCATION) && (configSUPPORT_STATIC_ALLOCATION > 0U)) && \ + !((defined(configSUPPORT_DYNAMIC_ALLOCATION) && (configSUPPORT_DYNAMIC_ALLOCATION == 1U))) + +#if CONFIG_WPA_SUPP +#error "Static memory allocation is not supported for wpa supplicant " +#endif + +#endif + +/** Action GET */ +#define ACTION_GET (0U) +/** Action SET */ +#define ACTION_SET (1) + +/** Maximum SSID length */ +#ifndef IEEEtypes_SSID_SIZE +#define IEEEtypes_SSID_SIZE 32U +#endif /* IEEEtypes_SSID_SIZE */ + +/** MAC Address length */ +#ifndef IEEEtypes_ADDRESS_SIZE +#define IEEEtypes_ADDRESS_SIZE 6 +#endif /* IEEEtypes_ADDRESS_SIZE */ + +#if CONFIG_HOST_SLEEP +#if CONFIG_POWER_MANAGER +extern osa_msg_handle_t mon_thread_event_queue; +#endif +#endif + +#define WLAN_REASON_CODE_PREV_AUTH_NOT_VALID 2U + +typedef enum +{ + BSS_INFRASTRUCTURE = 1, + BSS_INDEPENDENT, + BSS_ANY +} IEEEtypes_Bss_t; + +/* The possible types of Basic Service Sets */ + +/** The number of times that the WLAN Connection Manager will look for a + * network before giving up. */ +#if CONFIG_MAX_RESCAN_LIMIT +#define WLAN_RESCAN_LIMIT CONFIG_MAX_RESCAN_LIMIT +#else +#if CONFIG_WPA_SUPP +#define WLAN_RESCAN_LIMIT 30U +#else +#if CONFIG_P2P +#define WLAN_RESCAN_LIMIT 10U +#else +#define WLAN_RESCAN_LIMIT 5U +#endif /* CONFIG_P2P */ +#endif /* CONFIG_WPA_SUPP */ +#endif /* CONFIG_MAX_RESCAN_LIMIT */ + +#define WLAN_11D_SCAN_LIMIT 3U +/** The number of times that the WLAN Connection Manager will attempt a + * reconnection with the network before giving up. */ +#define WLAN_RECONNECT_LIMIT 5U +/** The minimum length for network names, see \ref wlan_network. This must + * be between 1 and \ref WLAN_NETWORK_NAME_MAX_LENGTH */ +#define WLAN_NETWORK_NAME_MIN_LENGTH 1U +/** The space reserved for storing network names, \ref wlan_network */ +#define WLAN_NETWORK_NAME_MAX_LENGTH 32U +/** The space reserved for storing PSK (password) phrases. */ +/* Min WPA2 passphrase can be upto 8 ASCII chars */ +#define WLAN_PSK_MIN_LENGTH 8U +/** Max WPA2 passphrase can be upto 63 ASCII chars or 64 hexadecimal digits*/ +#define WLAN_PSK_MAX_LENGTH 65U +/** Min WPA3 password can be upto 8 ASCII chars */ +#define WLAN_PASSWORD_MIN_LENGTH 8U +/** Max WPA3 password can be upto 255 ASCII chars */ +#define WLAN_PASSWORD_MAX_LENGTH 255U +/** Max WPA2 Enterprise identity can be upto 256 characters */ +#define IDENTITY_MAX_LENGTH 64U +/** Max WPA2 Enterprise password can be upto 256 unicode characters */ +#define PASSWORD_MAX_LENGTH 128U +/** Max identities for EAP server users */ +#define MAX_USERS 8U +/** Encryption key for EAP-FAST PAC-Opaque values. This key must be a secret, random value. It is configured as a + * 16-octet value in hex format. */ +#define PAC_OPAQUE_ENCR_KEY_MAX_LENGTH 33U +/** A-ID indicates the identity of the authority that issues PACs. The A-ID should be unique across all issuing servers. + * A-ID to be 16 octets in length */ +#define A_ID_MAX_LENGTH 33U +/** MAX CA Cert hash len */ +#define HASH_MAX_LENGTH 40U +/** MAX domain len */ +#define DOMAIN_MATCH_MAX_LENGTH 64U + +#if CONFIG_WLAN_KNOWN_NETWORKS +/** The size of the list of known networks maintained by the WLAN + Connection Manager */ +#define WLAN_MAX_KNOWN_NETWORKS CONFIG_WLAN_KNOWN_NETWORKS +#else +#error "CONFIG_WLAN_KNOWN_NETWORKS is not defined" +#endif /* CONFIG_WLAN_KNOWN_NETWORKS */ +/** Length of a pairwise master key (PMK). It's always 256 bits (32 Bytes) */ +#define WLAN_PMK_LENGTH 32 + +#if CONFIG_WMM_UAPSD +#define WMM_UAPSD_QOS_INFO 0x0F +#define WMM_UAPSD_SLEEP_PERIOD 20 +#endif + +#if CONFIG_UAP_STA_MAC_ADDR_FILTER + +/* Max number of sta filter list can be upto 16 */ +#define WLAN_MAX_STA_FILTER_NUM 16 + +/* The length of wlan mac address */ +#define WLAN_MAC_ADDR_LENGTH 6 +#endif + +/* Error Codes */ + +/** The operation was successful. */ +#define WLAN_ERROR_NONE 0 +/** The operation failed due to an error with one or more parameters. */ +#define WLAN_ERROR_PARAM 1 +/** The operation could not be performed because there is not enough memory. */ +#define WLAN_ERROR_NOMEM 2 +/** The operation could not be performed in the current system state. */ +#define WLAN_ERROR_STATE 3 +/** The operation failed due to an internal error. */ +#define WLAN_ERROR_ACTION 4 +/** The operation to change power state could not be performed*/ +#define WLAN_ERROR_PS_ACTION 5 +/** The requested feature is not supported*/ +#define WLAN_ERROR_NOT_SUPPORTED 6 + +/* + * HOST_WAKEUP_GPIO_PIN / CARD_WAKEUP_GPIO_PIN + * + * this GPIO PIN number defines the default config. This is chip + * specific, and a compile time setting depending on the system + * board level build! + */ +#if defined(SD8997) || defined(SD9098) || defined(SD9064) || defined(RW610) +#define HOST_WAKEUP_GPIO_PIN 12 +#define CARD_WAKEUP_GPIO_PIN 13 +#elif defined(SD9177) +#define HOST_WAKEUP_GPIO_PIN 17 +#define CARD_WAKEUP_GPIO_PIN 16 +#elif defined(SD9097) +#if defined(SD9097_V0) +#define CARD_WAKEUP_GPIO_PIN 7 +#elif defined(SD9097_V1) +#define HOST_WAKEUP_GPIO_PIN 12 +#define CARD_WAKEUP_GPIO_PIN 3 +#endif +#elif defined(WIFI_88W8987_BOARD_MURATA_1ZM_M2) || defined(WIFI_IW416_BOARD_MURATA_1XK_M2) +#define HOST_WAKEUP_GPIO_PIN 2 +#define CARD_WAKEUP_GPIO_PIN 16 +#else +#define HOST_WAKEUP_GPIO_PIN 1 +#define CARD_WAKEUP_GPIO_PIN 16 +#endif + +#define WLAN_MGMT_DIASSOC MBIT(10) +#define WLAN_MGMT_AUTH MBIT(11) +#define WLAN_MGMT_DEAUTH MBIT(12) +/** BITMAP for Action frame */ +#define WLAN_MGMT_ACTION MBIT(13) + +#if CONFIG_WMM_UAPSD +#define WMM_UAPSD_QOS_INFO 0x0F +#define WMM_UAPSD_SLEEP_PERIOD 20 +#endif + +#define WLAN_KEY_MGMT_IEEE8021X MBIT(0) +#define WLAN_KEY_MGMT_PSK MBIT(1) +#define WLAN_KEY_MGMT_NONE MBIT(2) +#define WLAN_KEY_MGMT_IEEE8021X_NO_WPA MBIT(3) +#define WLAN_KEY_MGMT_WPA_NONE MBIT(4) +#define WLAN_KEY_MGMT_FT_IEEE8021X MBIT(5) +#define WLAN_KEY_MGMT_FT_PSK MBIT(6) +#define WLAN_KEY_MGMT_IEEE8021X_SHA256 MBIT(7) +#define WLAN_KEY_MGMT_PSK_SHA256 MBIT(8) +#define WLAN_KEY_MGMT_WPS MBIT(9) +#define WLAN_KEY_MGMT_SAE MBIT(10) +#define WLAN_KEY_MGMT_FT_SAE MBIT(11) +#define WLAN_KEY_MGMT_WAPI_PSK MBIT(12) +#define WLAN_KEY_MGMT_WAPI_CERT MBIT(13) +#define WLAN_KEY_MGMT_CCKM MBIT(14) +#define WLAN_KEY_MGMT_OSEN MBIT(15) +#define WLAN_KEY_MGMT_IEEE8021X_SUITE_B MBIT(16) +#define WLAN_KEY_MGMT_IEEE8021X_SUITE_B_192 MBIT(17) +#define WLAN_KEY_MGMT_FILS_SHA256 MBIT(18) +#define WLAN_KEY_MGMT_FILS_SHA384 MBIT(19) +#define WLAN_KEY_MGMT_FT_FILS_SHA256 MBIT(20) +#define WLAN_KEY_MGMT_FT_FILS_SHA384 MBIT(21) +#define WLAN_KEY_MGMT_OWE MBIT(22) +#define WLAN_KEY_MGMT_DPP MBIT(23) +#define WLAN_KEY_MGMT_FT_IEEE8021X_SHA384 MBIT(24) +#define WLAN_KEY_MGMT_PASN MBIT(25) +#define WLAN_KEY_MGMT_SAE_EXT_KEY MBIT(26) + +#define WLAN_KEY_MGMT_FT \ + (WLAN_KEY_MGMT_FT_PSK | WLAN_KEY_MGMT_FT_IEEE8021X | WLAN_KEY_MGMT_FT_IEEE8021X_SHA384 | WLAN_KEY_MGMT_FT_SAE | \ + WLAN_KEY_MGMT_FT_FILS_SHA256 | WLAN_KEY_MGMT_FT_FILS_SHA384) + +#if CONFIG_WPA_SUPP + +#define WLAN_CIPHER_NONE MBIT(0) +#define WLAN_CIPHER_WEP40 MBIT(1) +#define WLAN_CIPHER_WEP104 MBIT(2) +#define WLAN_CIPHER_TKIP MBIT(3) +#define WLAN_CIPHER_CCMP MBIT(4) +#define WLAN_CIPHER_AES_128_CMAC MBIT(5) +#define WLAN_CIPHER_GCMP MBIT(6) +#define WLAN_CIPHER_SMS4 MBIT(7) +#define WLAN_CIPHER_GCMP_256 MBIT(8) +#define WLAN_CIPHER_CCMP_256 MBIT(9) +#define WLAN_CIPHER_BIP_GMAC_128 MBIT(11) +#define WLAN_CIPHER_BIP_GMAC_256 MBIT(12) +#define WLAN_CIPHER_BIP_CMAC_256 MBIT(13) +#define WLAN_CIPHER_GTK_NOT_USED MBIT(14) + +#endif + +/** Enum for wlan errors*/ +enum wm_wlan_errno +{ + WM_E_WLAN_ERRNO_BASE = MOD_ERROR_START(MOD_WLAN), + /** The Firmware download operation failed. */ + WLAN_ERROR_FW_DNLD_FAILED, + /** The Firmware ready register not set. */ + WLAN_ERROR_FW_NOT_READY, + /** The WiFi card not found. */ + WLAN_ERROR_CARD_NOT_DETECTED, + /** The WiFi Firmware not found. */ + WLAN_ERROR_FW_NOT_DETECTED, + /** BSSID not found in scan list */ + WLAN_BSSID_NOT_FOUND_IN_SCAN_LIST, +}; + +/* Events and States */ + +/** WLAN Connection Manager event reason */ +enum wlan_event_reason +{ + /** The WLAN Connection Manager has successfully connected to a network and + * is now in the \ref WLAN_CONNECTED state. */ + WLAN_REASON_SUCCESS, + /** The WLAN Connection Manager has successfully authenticated to a network and + * is now in the \ref WLAN_ASSOCIATED state. */ + WLAN_REASON_AUTH_SUCCESS, + /** The WLAN Connection Manager has successfully associated to a network and + * is now in the \ref WLAN_ASSOCIATED state. */ + WLAN_REASON_ASSOC_SUCCESS, + /** The WLAN Connection Manager failed to connect before actual + * connection attempt with AP due to incorrect wlan network profile. + * or The WLAN Connection Manager failed to reconnect to previously connected + * network and it is now in the \ref WLAN_DISCONNECTED state.*/ + WLAN_REASON_CONNECT_FAILED, + /** The WLAN Connection Manager could not find the network that it was + * connecting to and it is now in the \ref WLAN_DISCONNECTED state. */ + WLAN_REASON_NETWORK_NOT_FOUND, +#if CONFIG_BG_SCAN + /** The WLAN Connection Manager could not find the network in bg scan during roam attempt that it was + * connecting to and it is now in the \ref WLAN_CONNECTED state with previous AP. */ + WLAN_REASON_BGSCAN_NETWORK_NOT_FOUND, +#endif + /** The WLAN Connection Manager failed to authenticate with the network + * and is now in the \ref WLAN_DISCONNECTED state. */ + WLAN_REASON_NETWORK_AUTH_FAILED, + /** DHCP lease has been renewed.*/ + WLAN_REASON_ADDRESS_SUCCESS, + /** The WLAN Connection Manager failed to obtain an IP address + * or TCP stack configuration has failed or the IP address + * configuration was lost due to a DHCP error. The system is + * now in the \ref WLAN_DISCONNECTED state. */ + WLAN_REASON_ADDRESS_FAILED, + /** The WLAN Connection Manager has lost the link to the current network. */ + WLAN_REASON_LINK_LOST, + /** The WLAN Connection Manager has received a deauthentication or disassociation frame */ + WLAN_REASON_DISCONNECTED, + /** The WLAN Connection Manager has received the channel switch + * announcement from the current network. */ + WLAN_REASON_CHAN_SWITCH, + /** The WLAN Connection Manager has disconnected from the WPS network + * (or has canceled a connection attempt) by request and is now in the + * WLAN_DISCONNECTED state. */ + WLAN_REASON_WPS_DISCONNECT, + /** The WLAN Connection Manager has disconnected from the current network + * (or has canceled a connection attempt) by request and is now in the + * WLAN_DISCONNECTED state. */ + WLAN_REASON_USER_DISCONNECT, + /** The WLAN Connection Manager is initialized and is ready for use. + * That is, it's now possible to scan or to connect to a network. */ + WLAN_REASON_INITIALIZED, + /** The WLAN Connection Manager has failed to initialize and is therefore + * not running. It is not possible to scan or to connect to a network. The + * WLAN Connection Manager should be stopped and started again via + * wlan_stop() and wlan_start() respectively. */ + WLAN_REASON_INITIALIZATION_FAILED, +#if (CONFIG_WIFI_IND_DNLD) + /** The WLAN Connection Manager has entered in hang mode. */ + WLAN_REASON_FW_HANG, + /** The WLAN Connection Manager has reset fw successfully. */ + WLAN_REASON_FW_RESET, +#endif + /** The WLAN Connection Manager has entered power save mode. */ + WLAN_REASON_PS_ENTER, + /** The WLAN Connection Manager has exited from power save mode. */ + WLAN_REASON_PS_EXIT, + /** The WLAN Connection Manager has started uAP */ + WLAN_REASON_UAP_SUCCESS, + /** A wireless client has joined uAP's BSS network */ + WLAN_REASON_UAP_CLIENT_ASSOC, + /** A wireless client has auhtenticated and connected to uAP's BSS network */ + WLAN_REASON_UAP_CLIENT_CONN, + /** A wireless client has left uAP's BSS network */ + WLAN_REASON_UAP_CLIENT_DISSOC, + /** The WLAN Connection Manager has failed to start uAP */ + WLAN_REASON_UAP_START_FAILED, + /** The WLAN Connection Manager has failed to stop uAP */ + WLAN_REASON_UAP_STOP_FAILED, + /** The WLAN Connection Manager has stopped uAP */ + WLAN_REASON_UAP_STOPPED, + /** The WLAN Connection Manager has received subscribed RSSI low event on station interface as per configured + threshold and frequency. If CONFIG_11K, CONFIG_11V, CONFIG_11R or CONFIG_ROAMING enabled then RSSI low event is + processed internally.*/ + WLAN_REASON_RSSI_LOW, +#if CONFIG_SUBSCRIBE_EVENT_SUPPORT + /** The WLAN Connection Manager has received subscribed RSSI high event on station interface as per configured + threshold and frequency. */ + WLAN_REASON_RSSI_HIGH, + /** The WLAN Connection Manager has received subscribed SNR low event on station interface as per configured + threshold and frequency. */ + WLAN_REASON_SNR_LOW, + /** The WLAN Connection Manager has received subscribed SNR high event on station interface as per configured + threshold and frequency. */ + WLAN_REASON_SNR_HIGH, + /** The WLAN Connection Manager has received subscribed Max fail event on station interface as per configured + threshold and frequency. */ + WLAN_REASON_MAX_FAIL, + /** The WLAN Connection Manager has received subscribed Beacon missed fail event on station interface as per + configured threshold and frequency. */ + WLAN_REASON_BEACON_MISSED, + /** The WLAN Connection Manager has received subscribed Data RSSI low event on station interface as per configured + threshold and frequency. */ + WLAN_REASON_DATA_RSSI_LOW, + /** The WLAN Connection Manager has received subscribed Data RSSI high event on station interface as per configured + threshold and frequency. */ + WLAN_REASON_DATA_RSSI_HIGH, + /** The WLAN Connection Manager has received subscribed Data SNR low event on station interface as per configured + threshold and frequency. */ + WLAN_REASON_DATA_SNR_LOW, + /** The WLAN Connection Manager has received subscribed Data SNR high event on station interface as per configured + threshold and frequency. */ + WLAN_REASON_DATA_SNR_HIGH, + /** The WLAN Connection Manager has received subscribed LINK QUALITY event on station interface as per configured + link_snr threshold and frequency, link_rate threshold and frequency, link_tx_latency threshold and frequency*/ + WLAN_REASON_LINK_QUALITY, + /** The WLAN Connection Manager has received subscribed Pre beacon lost event on station interface as per configured + threshold and frequency. */ + WLAN_REASON_PRE_BEACON_LOST, +#endif +#if CONFIG_NCP_BRIDGE + /** Scan is done */ + WLAN_REASON_SCAN_DONE, + /** WPS session is done */ + WLAN_REASON_WPS_SESSION_DONE, +#endif +}; + +/** Wakeup events for which wakeup will occur */ +enum wlan_wakeup_event_t +{ + /** Wakeup on broadcast */ + WAKE_ON_ALL_BROADCAST = 1, + /** Wakeup on unicast */ + WAKE_ON_UNICAST = 1 << 1, + /** Wakeup on MAC event */ + WAKE_ON_MAC_EVENT = 1 << 2, + /** Wakeup on multicast */ + WAKE_ON_MULTICAST = 1 << 3, + /** Wakeup on ARP broadcast */ + WAKE_ON_ARP_BROADCAST = 1 << 4, + /** Wakeup on receiving a management frame */ + WAKE_ON_MGMT_FRAME = 1 << 6, +}; + +/** WLAN station/micro-AP/Wi-Fi Direct Connection/Status state */ +enum wlan_connection_state +{ + /** The WLAN Connection Manager is not connected and no connection attempt + * is in progress. It is possible to connect to a network or scan. */ + WLAN_DISCONNECTED, + /** The WLAN Connection Manager is not connected but it is currently + * attempting to connect to a network. It is not possible to scan at this + * time. It is possible to connect to a different network. */ + WLAN_CONNECTING, + /** The WLAN Connection Manager is not connected but associated. */ + WLAN_ASSOCIATED, + /** The WLAN Connection Manager is not connected but authenticated. */ + WLAN_AUTHENTICATED, + /** The WLAN Connection Manager is connected. It is possible to scan and + * connect to another network at this time. Information about the current + * network configuration is available. */ + WLAN_CONNECTED, + /** The WLAN Connection Manager has started uAP */ + WLAN_UAP_STARTED, + /** The WLAN Connection Manager has stopped uAP */ + WLAN_UAP_STOPPED, + /** The WLAN Connection Manager is not connected and network scan + * is in progress. */ + WLAN_SCANNING, + /** The WLAN Connection Manager is not connected and network association + * is in progress. */ + WLAN_ASSOCIATING, +}; + +/* Data Structures */ + +/** Station Power save mode */ +typedef enum wlan_ps_mode +{ + /** Active mode */ + WLAN_ACTIVE = 0, + /** IEEE power save mode */ + WLAN_IEEE, + /** Deep sleep power save mode */ + WLAN_DEEP_SLEEP, + /** IEEE and Deep sleep power save mode */ + WLAN_IEEE_DEEP_SLEEP, +#if CONFIG_WNM_PS + /** WNM power save mode */ + WLAN_WNM, + /** WNM and Deep sleep power save mode */ + WLAN_WNM_DEEP_SLEEP, +#endif +} wlan_ps_mode; + +enum wlan_ps_state +{ + PS_STATE_AWAKE = 0, + PS_STATE_PRE_SLEEP, + PS_STATE_SLEEP_CFM, + PS_STATE_SLEEP +}; + +typedef enum _ENH_PS_MODES +{ + GET_PS = 0, + SLEEP_CONFIRM = 5, + EXT_PS_PARAM = 6, +#if (CONFIG_WNM_PS) + DIS_WNM_PS = 0xfc, + EN_WNM_PS = 0xfd, +#endif + DIS_AUTO_PS = 0xfe, + EN_AUTO_PS = 0xff, +} ENH_PS_MODES; + +typedef enum _Host_Sleep_Action +{ + HS_CONFIGURE = 0x0001, + HS_ACTIVATE = 0x0002, +} Host_Sleep_Action; + +#if (CONFIG_WNM_PS) +typedef PACK_START struct +{ + uint8_t action; + uint8_t result; +} PACK_END wnm_sleep_result_t; +#endif + +#if CONFIG_CSI +enum wlan_csi_opt +{ + CSI_FILTER_OPT_ADD = 0, + CSI_FILTER_OPT_DELETE, + CSI_FILTER_OPT_CLEAR, + CSI_FILTER_OPT_DUMP, +}; +#endif + +#if CONFIG_NET_MONITOR +enum wlan_monitor_opt +{ + MONITOR_FILTER_OPT_ADD_MAC = 0, + MONITOR_FILTER_OPT_DELETE_MAC, + MONITOR_FILTER_OPT_CLEAR_MAC, + MONITOR_FILTER_OPT_DUMP, +}; +#endif + +#if (CONFIG_11MC) || (CONFIG_11AZ) +#define FTM_ACTION_START 1 +#define FTM_ACTION_STOP 2 + +#define PROTO_DOT11AZ_NTB 1 +#define PROTO_DOT11AZ_TB 2 +#define PROTO_DOT11MC 0 + +/* DOT11MC CFG */ +/* Burst Duration + 0 - 1: Reserved + 2: 250 micro seconds + 3: 500 micro seconds + 4: 1 ms + 5: 2 ms + 6: 4 ms + 7: 8 ms + 8: 16 ms + 9: 32 ms + 10: 64 ms + 11: 128 ms + 12-14 reserved*/ +#define BURST_DURATION 11 +/* Burst Period in units of 100 milli seconds */ +#define BURST_PERIOD 10 +/* FTM frames per burst */ +#define FTM_PER_BURST 5 +/* Indicates minimum time between consecutive Fine Timing Measurement frames. It is specified in in units of 100 micro + * seconds. */ +#define MIN_DELTA 60 +/* ASAP */ +#define IS_ASAP 1 +/* Bandwidth + 9 - HT20 + 10 - VHT20 + 11 - HT40 + 12 - VHT40 + 13 - VHT80 */ +#define BW 13 /* RW610 only allows 20M bandwidth */ +/*Indicates how many burst instances are requested for the FTM session */ +#define BURST_EXP 3 + +/* LCI */ +#define LCI_REQUEST 1 +#define LCI_LATITIUDE -33.8570095 +#define LCI_LONGITUDE 151.2152005 +#define LCI_LATITUDE_UNCERTAINITY 18 +#define LCI_LONGITUDE_UNCERTAINITY 18 +#define LCI_ALTITUDE 11.2 +#define LCI_ALTITUDE_UNCERTAINITY 15 +#define Z_INFO 0 + +/* CIVIC */ +#define CIVIC_REQUEST 1 +#define CIVIC_LOCATION 1 +#define CIVIC_LOCATION_TYPE 1 +#define CIVIC_COUNTRY_CODE 0 /* US */ +#define CIVIC_ADDRESS_TYPE 22 +#define CIVIC_ADDRESS "#123" + +/* DOT11AZ CFG */ +#define FORMAT_BW 2 /* RW610 only allows 20M bandwidth */ +/*Maximum number of space-time streams to be used in DL/UL NDP frames in the session upto 80MHz*/ +#define MAX_I2R_STS_UPTO80 0 /* RW610 only allows to send 1 N_STS*/ +#define MAX_R2I_STS_UPTO80 0 +/* Measurement freq in Hz to calculate measurement interval*/ +#define AZ_MEASUREMENT_FREQ 4 /* in 0.1 Hz increments */ +#define AZ_NUMBER_OF_MEASUREMENTS 6 +#define I2R_LMR_FEEDBACK 0 /* allow RSTA to request I2R reporting */ + +#define FOR_RANGING 0 + +/** Structure of FTM_SESSION_CFG_NTB_RANGING / FTM_SESSION_CFG_TB_RANGING TLV data*/ +typedef struct _ranging_11az_cfg +{ + /** Indicates the channel BW for session*/ + /*0: HE20, 1: HE40, 2: HE80, 3: HE80+80, 4: HE160, 5:HE160_SRF*/ + t_u8 format_bw; + /** indicates for bandwidths less than or equal to 80 MHz the maximum number of space-time streams to be used in + * DL/UL NDP frames in the session*/ + t_u8 max_i2r_sts_upto80; + /**indicates for bandwidths less than or equal to 80 MHz the maximum number of space-time streams to be used in + * DL/UL NDP frames in the session*/ + t_u8 max_r2i_sts_upto80; + /**Specify measurement freq in Hz to calculate measurement interval*/ + t_u8 az_measurement_freq; + /**Indicates the number of measurements to be done for session*/ + t_u8 az_number_of_measurements; + /** Initator lmr feedback */ + t_u8 i2r_lmr_feedback; + /**Include location civic request (Expect location civic from responder)*/ + t_u8 civic_req; + /**Include LCI request (Expect LCI info from responder)*/ + t_u8 lci_req; +} ranging_11az_cfg_t; + +typedef struct _location_cfg_info +{ + /** known Latitude uncertainty*/ + t_u8 lat_unc; + /** known Longitude uncertainty*/ + t_u8 long_unc; + /** Known Altitude uncertainty*/ + t_u8 alt_unc; + /**Include LCI request (Expect LCI info from responder)*/ + t_u8 lci_req; + /** known longitude*/ + double longitude; + /** known Latitude*/ + double latitude; + /** known altitude*/ + double altitude; +} location_cfg_info_t; + +typedef struct _location_civic_rep +{ + /**Civic location type*/ + t_u8 civic_location_type; + /**Civic address type*/ + t_u8 civic_address_type; + /**Civic address length*/ + t_u8 civic_address_length; + /**Include LCI request (Expect LCI info from responder)*/ + t_u8 civic_req; + /**Country code*/ + t_u16 country_code; +} location_civic_rep_t; + +/** Structure of FTM_SESSION_CFG TLV data*/ +typedef struct _ftm_11mc_nego_cfg +{ + /** Indicates how many burst instances are requested for the FTM session*/ + t_u8 burst_exponent; + /** Indicates the duration of a burst instance*/ + t_u8 burst_duration; + /**Minimum time between consecutive FTM frames*/ + t_u8 min_delta_FTM; + /**ASAP/non-ASAP casel*/ + t_u8 is_ASAP; + /**Number of FTMs per burst*/ + t_u8 per_burst_FTM; + /**FTM channel spacing: HT20/HT40/VHT80/... */ + t_u8 channel_spacing; + /**Indicates the interval between two consecutive burst instances*/ + t_u16 burst_period; +} ftm_11mc_nego_cfg_t; +#endif + +/** Scan Result */ +struct wlan_scan_result +{ + /** The network SSID, represented as a NULL-terminated C string of 0 to 32 + * characters. If the network has a hidden SSID, this will be the empty + * string. + */ + char ssid[33]; + /** SSID length */ + unsigned int ssid_len; + /** The network BSSID, represented as a 6-byte array. */ + char bssid[6]; + /** The network channel. */ + unsigned int channel; + /** The network wireless type. */ + enum wlan_bss_type type; + /** The network wireless mode. */ + enum wlan_bss_role role; + + /* network features */ + /** The network supports 802.11N. This is set to 0 if the network does not + * support 802.11N or if the system does not have 802.11N support enabled. */ + unsigned dot11n : 1; +#if CONFIG_11AC + /** The network supports 802.11AC. This is set to 0 if the network does not + * support 802.11AC or if the system does not have 802.11AC support enabled. */ + unsigned dot11ac : 1; +#endif +#if CONFIG_11AX + /** The network supports 802.11AX. This is set to 0 if the network does not + * support 802.11AX or if the system does not have 802.11AX support enabled. */ + unsigned dot11ax : 1; +#endif + + /** The network supports WMM. This is set to 0 if the network does not + * support WMM or if the system does not have WMM support enabled. */ + unsigned wmm : 1; +#if (CONFIG_WPA_SUPP_WPS) || (CONFIG_WPS2) + /** The network supports WPS. This is set to 0 if the network does not + * support WPS or if the system does not have WPS support enabled. */ + unsigned wps : 1; + /** WPS Type PBC/PIN */ + unsigned int wps_session; +#endif + /** The network uses WEP security. */ + unsigned wep : 1; + /** The network uses WPA security. */ + unsigned wpa : 1; + /** The network uses WPA2 security */ + unsigned wpa2 : 1; + /** The network uses WPA2 SHA256 security */ + unsigned wpa2_sha256 : 1; +#if CONFIG_DRIVER_OWE + /** The network uses OWE security */ + unsigned owe : 1; +#endif + /** The network uses WPA3 SAE security */ + unsigned wpa3_sae : 1; + /** The network uses WPA2 Enterprise security */ + unsigned wpa2_entp : 1; + /** The network uses WPA2 Enterprise SHA256 security */ + unsigned wpa2_entp_sha256 : 1; + /** The network uses WPA3 Enterprise SHA256 security */ + unsigned wpa3_1x_sha256 : 1; + /** The network uses WPA3 Enterprise SHA384 security */ + unsigned wpa3_1x_sha384 : 1; +#if CONFIG_11R + /** The network uses FT 802.1x security (For internal use only)*/ + unsigned ft_1x : 1; + /** The network uses FT 892.1x SHA384 security */ + unsigned ft_1x_sha384 : 1; + /** The network uses FT PSK security (For internal use only)*/ + unsigned ft_psk : 1; + /** The network uses FT SAE security (For internal use only)*/ + unsigned ft_sae : 1; +#endif + /** The signal strength of the beacon */ + unsigned char rssi; + /** The network SSID, represented as a NULL-terminated C string of 0 to 32 + * characters. If the network has a hidden SSID, this will be the empty + * string. + */ + char trans_ssid[33]; + /** SSID length */ + unsigned int trans_ssid_len; + /** The network BSSID, represented as a 6-byte array. */ + char trans_bssid[6]; + + /** Beacon Period */ + uint16_t beacon_period; + + /** DTIM Period */ + uint8_t dtim_period; + + /** MFPC bit of AP*/ + t_u8 ap_mfpc; + /** MFPR bit of AP*/ + t_u8 ap_mfpr; + /** PWE bit of AP*/ + t_u8 ap_pwe; + +#if CONFIG_11K + /** Neigbort report support (For internal use only)*/ + bool neighbor_report_supported; +#endif +#if CONFIG_11V + /** bss transition support (For internal use only)*/ + bool bss_transition_supported; +#endif +}; + +typedef enum +{ + Band_2_4_GHz = 0, + Band_5_GHz = 1, + Band_4_GHz = 2, + +} ChanBand_e; + +#define NUM_CHAN_BAND_ENUMS 3 + +typedef enum +{ + ChanWidth_20_MHz = 0, + ChanWidth_10_MHz = 1, + ChanWidth_40_MHz = 2, + ChanWidth_80_MHz = 3, +} ChanWidth_e; + +typedef enum +{ + SECONDARY_CHAN_NONE = 0, + SECONDARY_CHAN_ABOVE = 1, + SECONDARY_CHAN_BELOW = 3, + // reserved 2, 4~255 +} Chan2Offset_e; + +typedef enum +{ + MANUAL_MODE = 0, + ACS_MODE = 1, +} ScanMode_e; + +typedef PACK_START struct +{ + ChanBand_e chanBand : 2; + ChanWidth_e chanWidth : 2; + Chan2Offset_e chan2Offset : 2; + ScanMode_e scanMode : 2; +} PACK_END BandConfig_t; + +typedef PACK_START struct +{ + BandConfig_t bandConfig; + uint8_t chanNum; + +} PACK_END ChanBandInfo_t; + +#if CONFIG_WLAN_BRIDGE +/*auto link switch network info*/ +typedef PACK_START struct _Event_AutoLink_SW_Node_t +{ + /** No of bytes in packet including this field */ + uint16_t length; + /** Type: Event (3) */ + uint16_t type; + /** Event ID */ + uint16_t event_id; + /** BSS index number for multiple BSS support */ + uint8_t bss_index; + /** BSS type */ + uint8_t bss_type; + /*peer mac address*/ + uint8_t peer_mac_addr[MLAN_MAC_ADDR_LENGTH]; + /*associated channel band info*/ + ChanBandInfo_t chanBand; + /*security type*/ + uint8_t secutype; + /*multicast cipher*/ + uint16_t mcstcipher; + /*unicast cipher*/ + uint16_t ucstcipher; + /*peer ssid info*/ + /* tlv type*/ + uint16_t type_ssid; + /** Header length */ + uint16_t len_ssid; + /*ssid info*/ + uint8_t ssid[1]; +} PACK_END Event_AutoLink_SW_Node_t; +#endif + +#if CONFIG_5GHz_SUPPORT +#define DFS_REC_HDR_LEN (8) +#define DFS_REC_HDR_NUM (10) +#define BIN_COUNTER_LEN (7) + +typedef PACK_START struct _Event_Radar_Detected_Info +{ + t_u32 detect_count; + t_u8 reg_domain; /*1=fcc, 2=etsi, 3=mic*/ + t_u8 main_det_type; /*0=none, 1=pw(chirp), 2=pri(radar)*/ + t_u16 pw_chirp_type; + t_u8 pw_chirp_idx; + t_u8 pw_value; + t_u8 pri_radar_type; + t_u8 pri_binCnt; + t_u8 binCounter[BIN_COUNTER_LEN]; + t_u8 numDfsRecords; + t_u8 dfsRecordHdrs[DFS_REC_HDR_NUM][DFS_REC_HDR_LEN]; + t_u32 reallyPassed; +} PACK_END Event_Radar_Detected_Info; +#endif + +/** Network security types*/ +enum wlan_security_type +{ + /** The network does not use security. */ + WLAN_SECURITY_NONE, + /** The network uses WEP security with open key. */ + WLAN_SECURITY_WEP_OPEN, + /** The network uses WEP security with shared key. */ + WLAN_SECURITY_WEP_SHARED, + /** The network uses WPA security with PSK. */ + WLAN_SECURITY_WPA, + /** The network uses WPA2 security with PSK. */ + WLAN_SECURITY_WPA2, + /** The network uses WPA/WPA2 mixed security with PSK */ + WLAN_SECURITY_WPA_WPA2_MIXED, +#if CONFIG_11R + /** The network uses WPA2 security with PSK FT. */ + WLAN_SECURITY_WPA2_FT, +#endif + /** The network uses WPA3 security with SAE. */ + WLAN_SECURITY_WPA3_SAE, +#if CONFIG_WPA_SUPP +#if CONFIG_11R + /** The network uses WPA3 security with SAE FT. */ + WLAN_SECURITY_WPA3_FT_SAE, +#endif +#endif + /** The network uses WPA3 security with SAE EXT KEY. */ + WLAN_SECURITY_WPA3_SAE_EXT_KEY, + /** The network uses WPA2/WPA3 SAE mixed security with PSK. */ + WLAN_SECURITY_WPA2_WPA3_SAE_MIXED, +#if CONFIG_DRIVER_OWE + /** The network uses OWE only security without Transition mode support. */ + WLAN_SECURITY_OWE_ONLY, +#endif +#if (CONFIG_WPA_SUPP_CRYPTO_ENTERPRISE) || (CONFIG_WPA2_ENTP) + /** The network uses WPA2 Enterprise EAP-TLS security + * The identity field in \ref wlan_network structure is used */ + WLAN_SECURITY_EAP_TLS, +#endif +#if CONFIG_WPA_SUPP_CRYPTO_ENTERPRISE +#if CONFIG_EAP_TLS + /** The network uses WPA2 Enterprise EAP-TLS SHA256 security + * The identity field in \ref wlan_network structure is used */ + WLAN_SECURITY_EAP_TLS_SHA256, +#if CONFIG_11R + /** The network uses WPA2 Enterprise EAP-TLS FT security + * The identity field in \ref wlan_network structure is used */ + WLAN_SECURITY_EAP_TLS_FT, + /** The network uses WPA2 Enterprise EAP-TLS FT SHA384 security + * The identity field in \ref wlan_network structure is used */ + WLAN_SECURITY_EAP_TLS_FT_SHA384, +#endif +#endif +#if CONFIG_EAP_TTLS + /** The network uses WPA2 Enterprise EAP-TTLS security + * The identity field in \ref wlan_network structure is used */ + WLAN_SECURITY_EAP_TTLS, +#endif +#if CONFIG_EAP_MSCHAPV2 + /** The network uses WPA2 Enterprise EAP-TTLS-MSCHAPV2 security + * The anonymous identity, identity and password fields in + * \ref wlan_network structure are used */ + WLAN_SECURITY_EAP_TTLS_MSCHAPV2, +#endif +#endif +#if (CONFIG_WPA_SUPP_CRYPTO_ENTERPRISE) || (CONFIG_PEAP_MSCHAPV2) || (CONFIG_WPA2_ENTP) + /** The network uses WPA2 Enterprise EAP-PEAP-MSCHAPV2 security + * The anonymous identity, identity and password fields in + * \ref wlan_network structure are used */ + WLAN_SECURITY_EAP_PEAP_MSCHAPV2, +#endif +#if CONFIG_WPA_SUPP_CRYPTO_ENTERPRISE +#if CONFIG_EAP_PEAP +#if CONFIG_EAP_TLS + /** The network uses WPA2 Enterprise EAP-PEAP-TLS security + * The anonymous identity, identity and password fields in + * \ref wlan_network structure are used */ + WLAN_SECURITY_EAP_PEAP_TLS, +#endif +#if CONFIG_EAP_GTC + /** The network uses WPA2 Enterprise EAP-PEAP-GTC security + * The anonymous identity, identity and password fields in + * \ref wlan_network structure are used */ + WLAN_SECURITY_EAP_PEAP_GTC, +#endif +#endif +#if CONFIG_EAP_FAST +#if CONFIG_EAP_MSCHAPV2 + /** The network uses WPA2 Enterprise EAP-FAST-MSCHAPV2 security + * The anonymous identity, identity and password fields in + * \ref wlan_network structure are used */ + WLAN_SECURITY_EAP_FAST_MSCHAPV2, +#endif +#if CONFIG_EAP_GTC + /** The network uses WPA2 Enterprise EAP-FAST-GTC security + * The anonymous identity, identity and password fields in + * \ref wlan_network structure are used */ + WLAN_SECURITY_EAP_FAST_GTC, +#endif +#endif +#if CONFIG_EAP_SIM + /** The network uses WPA2 Enterprise EAP-SIM security + * The identity and password fields in + * \ref wlan_network structure are used */ + WLAN_SECURITY_EAP_SIM, +#endif +#if CONFIG_EAP_AKA + /** The network uses WPA2 Enterprise EAP-AKA security + * The identity and password fields in + * \ref wlan_network structure are used */ + WLAN_SECURITY_EAP_AKA, +#endif +#if CONFIG_EAP_AKA_PRIME + /** The network uses WPA2 Enterprise EAP-AKA-PRIME security + * The identity and password fields in + * \ref wlan_network structure are used */ + WLAN_SECURITY_EAP_AKA_PRIME, +#endif +#endif +#if CONFIG_WPA_SUPP_DPP + /** The network uses DPP security with NAK(Net Access Key) */ + WLAN_SECURITY_DPP, +#endif + /** The network can use any security method. This is often used when + * the user only knows the name and passphrase but not the security + * type. */ + WLAN_SECURITY_WILDCARD, +}; + +#if CONFIG_WPA_SUPP_CRYPTO_ENTERPRISE +#if CONFIG_EAP_TLS +/** EAP TLS Cipher types*/ +enum eap_tls_cipher_type +{ + EAP_TLS_NONE, + /** EAP TLS with ECDH & ECDSA with p384 */ + EAP_TLS_ECC_P384, + /** EAP TLS with ECDH & RSA with > 3K */ + EAP_TLS_RSA_3K, +}; +#endif +#endif + +/** Wlan Cipher structure */ +struct wlan_cipher +{ + /** 1 bit value can be set for none */ + uint16_t none : 1; + /** 1 bit value can be set for wep40 */ + uint16_t wep40 : 1; + /** 1 bit value can be set for wep104 */ + uint16_t wep104 : 1; + /** 1 bit value can be set for tkip */ + uint16_t tkip : 1; + /** 1 bit valuecan be set for ccmp */ + uint16_t ccmp : 1; + /** 1 bit valuecan be set for aes 128 cmac */ + uint16_t aes_128_cmac : 1; + /** 1 bit value can be set for gcmp */ + uint16_t gcmp : 1; + /** 1 bit value can be set for sms4 */ + uint16_t sms4 : 1; + /** 1 bit value can be set for gcmp 256 */ + uint16_t gcmp_256 : 1; + /** 1 bit valuecan be set for ccmp 256 */ + uint16_t ccmp_256 : 1; + /** 1 bit is reserved */ + uint16_t rsvd : 1; + /** 1 bit value can be set for bip gmac 128 */ + uint16_t bip_gmac_128 : 1; + /** 1 bit value can be set for bip gmac 256 */ + uint16_t bip_gmac_256 : 1; + /** 1 bit value can be set for bip cmac 256 */ + uint16_t bip_cmac_256 : 1; + /** 1 bit valuecan be set for gtk not used */ + uint16_t gtk_not_used : 1; + /** 4 bits are reserved */ + uint16_t rsvd2 : 2; +}; + +static inline int is_valid_security(int security) +{ + /*Currently only these modes are supported */ + if ((security == WLAN_SECURITY_NONE) || (security == WLAN_SECURITY_WEP_OPEN) || (security == WLAN_SECURITY_WPA) || + (security == WLAN_SECURITY_WPA2) || +#if CONFIG_11R + (security == WLAN_SECURITY_WPA2_FT) || +#endif + (security == WLAN_SECURITY_WPA_WPA2_MIXED) || +#if CONFIG_WPA_SUPP_CRYPTO_ENTERPRISE +#if CONFIG_EAP_TLS + (security == WLAN_SECURITY_EAP_TLS) || (security == WLAN_SECURITY_EAP_TLS_SHA256) || +#if CONFIG_11R + (security == WLAN_SECURITY_EAP_TLS_FT) || (security == WLAN_SECURITY_EAP_TLS_FT_SHA384) || +#endif +#endif +#if CONFIG_EAP_TTLS + (security == WLAN_SECURITY_EAP_TTLS) || +#if CONFIG_EAP_MSCHAPV2 + (security == WLAN_SECURITY_EAP_TTLS_MSCHAPV2) || +#endif +#endif +#if CONFIG_EAP_PEAP +#if CONFIG_EAP_MSCHAPV2 + (security == WLAN_SECURITY_EAP_PEAP_MSCHAPV2) || +#endif +#if CONFIG_EAP_TLS + (security == WLAN_SECURITY_EAP_PEAP_TLS) || +#endif +#if CONFIG_EAP_GTC + (security == WLAN_SECURITY_EAP_PEAP_GTC) || +#endif +#endif +#if CONFIG_EAP_FAST +#if CONFIG_EAP_MSCHAPV2 + (security == WLAN_SECURITY_EAP_FAST_MSCHAPV2) || +#endif +#if CONFIG_EAP_GTC + (security == WLAN_SECURITY_EAP_FAST_GTC) || +#endif +#endif +#if CONFIG_EAP_SIM + (security == WLAN_SECURITY_EAP_SIM) || +#endif +#if CONFIG_EAP_AKA + (security == WLAN_SECURITY_EAP_AKA) || +#endif +#if CONFIG_EAP_AKA_PRIME + (security == WLAN_SECURITY_EAP_AKA_PRIME) || +#endif +#else +#if CONFIG_WPA2_ENTP + (security == WLAN_SECURITY_EAP_TLS) || +#endif +#if CONFIG_PEAP_MSCHAPV2 + (security == WLAN_SECURITY_EAP_PEAP_MSCHAPV2) || +#endif +#endif /* CONFIG_WPA_SUPP_CRYPTO_ENTERPRISE */ +#if CONFIG_DRIVER_OWE + (security == WLAN_SECURITY_OWE_ONLY) || +#endif + (security == WLAN_SECURITY_WPA3_SAE) || (security == WLAN_SECURITY_WPA2_WPA3_SAE_MIXED) || +#if CONFIG_WPA_SUPP +#if CONFIG_11R + (security == WLAN_SECURITY_WPA3_FT_SAE) || +#endif +#endif + (security == WLAN_SECURITY_WPA3_SAE_EXT_KEY) || (security == WLAN_SECURITY_WILDCARD)) + { + return 1; + } + return 0; +} + +#if CONFIG_WPA_SUPP_CRYPTO_ENTERPRISE +static inline int is_ep_valid_security(int security) +{ + /*Currently only these modes are supported */ + if ( +#if CONFIG_EAP_TLS + (security == WLAN_SECURITY_EAP_TLS) || (security == WLAN_SECURITY_EAP_TLS_SHA256) || +#if CONFIG_11R + (security == WLAN_SECURITY_EAP_TLS_FT) || (security == WLAN_SECURITY_EAP_TLS_FT_SHA384) || +#endif +#endif +#if CONFIG_EAP_TTLS + (security == WLAN_SECURITY_EAP_TTLS) || +#if CONFIG_EAP_MSCHAPV2 + (security == WLAN_SECURITY_EAP_TTLS_MSCHAPV2) || +#endif +#endif +#if CONFIG_EAP_PEAP +#if CONFIG_EAP_MSCHAPV2 + (security == WLAN_SECURITY_EAP_PEAP_MSCHAPV2) || +#endif +#if CONFIG_EAP_TLS + (security == WLAN_SECURITY_EAP_PEAP_TLS) || +#endif +#if CONFIG_EAP_GTC + (security == WLAN_SECURITY_EAP_PEAP_GTC) || +#endif +#endif +#if CONFIG_EAP_FAST +#if CONFIG_EAP_MSCHAPV2 + (security == WLAN_SECURITY_EAP_FAST_MSCHAPV2) || +#endif +#if CONFIG_EAP_GTC + (security == WLAN_SECURITY_EAP_FAST_GTC) || +#endif +#endif +#if CONFIG_EAP_SIM + (security == WLAN_SECURITY_EAP_SIM) || +#endif +#if CONFIG_EAP_AKA + (security == WLAN_SECURITY_EAP_AKA) || +#endif +#if CONFIG_EAP_AKA_PRIME + (security == WLAN_SECURITY_EAP_AKA_PRIME) || +#endif + false) + { + return 1; + } + return 0; +} +#endif + +/** Network security configuration */ +struct wlan_network_security +{ + /** Type of network security to use specified by enum + * wlan_security_type. */ + enum wlan_security_type type; + /** Key management type */ + int key_mgmt; + /** Type of network security Group Cipher suite used internally*/ + struct wlan_cipher mcstCipher; + /** Type of network security Pairwise Cipher suite used internally*/ + struct wlan_cipher ucstCipher; +#if CONFIG_WPA_SUPP + /** Proactive Key Caching */ + unsigned pkc : 1; + /** Type of network security Group Cipher suite */ + int group_cipher; + /** Type of network security Pairwise Cipher suite */ + int pairwise_cipher; + /** Type of network security Pairwise Cipher suite */ + int group_mgmt_cipher; +#endif + /** Is PMF required */ + bool is_pmf_required; + /** Pre-shared key (network password). For WEP networks this is a hex byte + * sequence of length psk_len, for WPA and WPA2 networks this is an ASCII + * pass-phrase of length psk_len. This field is ignored for networks with no + * security. */ + char psk[WLAN_PSK_MAX_LENGTH]; + /** Length of the WEP key or WPA/WPA2 pass phrase, \ref WLAN_PSK_MIN_LENGTH to \ref + * WLAN_PSK_MAX_LENGTH. Ignored for networks with no security. */ + uint8_t psk_len; + /** WPA3 SAE password, for WPA3 SAE networks this is an ASCII + * password of length password_len. This field is ignored for networks with no + * security. */ + char password[WLAN_PASSWORD_MAX_LENGTH + 1]; + /** Length of the WPA3 SAE Password, \ref WLAN_PASSWORD_MIN_LENGTH to \ref + * WLAN_PASSWORD_MAX_LENGTH. Ignored for networks with no security. */ + size_t password_len; + /** SAE Groups */ + char *sae_groups; + /** PWE derivation */ + uint8_t pwe_derivation; + /** transition disable */ + uint8_t transition_disable; +#if CONFIG_DRIVER_OWE + /** OWE Groups */ + char *owe_groups; +#endif + /** Pairwise Master Key. When pmk_valid is set, this is the PMK calculated + * from the PSK for WPA/PSK networks. If pmk_valid is not set, this field + * is not valid. When adding networks with \ref wlan_add_network, users + * can initialize pmk and set pmk_valid in lieu of setting the psk. After + * successfully connecting to a WPA/PSK network, users can call \ref + * wlan_get_current_network to inspect pmk_valid and pmk. Thus, the pmk + * value can be populated in subsequent calls to \ref wlan_add_network. + * This saves the CPU time required to otherwise calculate the PMK. + */ + char pmk[WLAN_PMK_LENGTH]; + + /** Flag reporting whether pmk is valid or not. */ + bool pmk_valid; + /** Management Frame Protection Capable (MFPC) */ + bool mfpc; + /** Management Frame Protection Required (MFPR) */ + bool mfpr; +#if CONFIG_WLAN_BRIDGE + /** Pre-shared key (network password) for bridge uap.*/ + char bridge_psk[WLAN_PSK_MAX_LENGTH]; + /** Length of the WEP key or WPA/WPA2 pass phrase for bridge uap, \ref WLAN_PSK_MIN_LENGTH + * to \ref WLAN_PSK_MAX_LENGTH. Ignored for networks with no security. */ + char bridge_psk_len; + /** Pairwise Master Key for bridge network */ + char bridge_pmk[WLAN_PMK_LENGTH]; + /** Flag reporting whether bridge pmk is valid or not. */ + bool bridge_pmk_valid; +#endif +#if CONFIG_WPA_SUPP_CRYPTO_ENTERPRISE + /** WPA3 Enterprise mode */ + unsigned wpa3_sb : 1; + /** WPA3 Enterprise Suite B 192 mode */ + unsigned wpa3_sb_192 : 1; + /** PEAP version */ + unsigned eap_ver : 1; +#if CONFIG_EAP_PEAP + /** PEAP label */ + unsigned peap_label : 1; + /** crypto_binding option can be used to control \ref WLAN_SECURITY_EAP_PEAP_MSCHAPV2, \ref + * WLAN_SECURITY_EAP_PEAP_TLS and \ref WLAN_SECURITY_EAP_PEAP_GTC version 0 cryptobinding behavior: 0 = do not use + * cryptobinding (default) 1 = use cryptobinding if server supports it 2 = require cryptobinding */ + uint8_t eap_crypto_binding; +#endif +#if (CONFIG_EAP_SIM) || (CONFIG_EAP_AKA) || (CONFIG_EAP_AKA_PRIME) + /** eap_result_ind=1 can be used to enable \ref WLAN_SECURITY_EAP_SIM, \ref WLAN_SECURITY_EAP_AKA and \ref + * WLAN_SECURITY_EAP_AKA_PRIME to use protected result indication.*/ + unsigned eap_result_ind : 1; +#endif +#if CONFIG_EAP_TLS + /** Cipher for EAP TLS */ + unsigned char tls_cipher; +#endif + /** Identity string for EAP */ + char identity[IDENTITY_MAX_LENGTH]; + /** Anonymous identity string for EAP */ + char anonymous_identity[IDENTITY_MAX_LENGTH]; + /** Password string for EAP. This field can include + * either the plaintext password (using ASCII or + * hex string) */ + char eap_password[PASSWORD_MAX_LENGTH]; + /** CA cert blob in PEM/DER format */ + unsigned char *ca_cert_data; + /** CA cert blob len */ + size_t ca_cert_len; + /** Client cert blob in PEM/DER format */ + unsigned char *client_cert_data; + /** Client cert blob len */ + size_t client_cert_len; + /** Client key blob */ + unsigned char *client_key_data; + /** Client key blob len */ + size_t client_key_len; + /** Client key password */ + char client_key_passwd[PASSWORD_MAX_LENGTH]; + /** CA cert HASH */ + char ca_cert_hash[HASH_MAX_LENGTH]; + /** Domain */ + char domain_match[DOMAIN_MATCH_MAX_LENGTH]; + /** Domain Suffix */ + char domain_suffix_match[DOMAIN_MATCH_MAX_LENGTH]; /*suffix max length same as full domain name length*/ + /** CA cert2 blob in PEM/DER format */ + unsigned char *ca_cert2_data; + /** CA cert2 blob len */ + size_t ca_cert2_len; + /** Client cert2 blob in PEM/DER format */ + unsigned char *client_cert2_data; + /** Client cert2 blob len */ + size_t client_cert2_len; + /** Client key2 blob */ + unsigned char *client_key2_data; + /** Client key2 blob len */ + size_t client_key2_len; + /** Client key2 password */ + char client_key2_passwd[PASSWORD_MAX_LENGTH]; +#if CONFIG_WPA_SUPP_AP +#if CONFIG_WPA_SUPP_CRYPTO_AP_ENTERPRISE + /** DH params blob */ + unsigned char *dh_data; + /** DH params blob len */ + size_t dh_len; + /** Server cert blob in PEM/DER format */ + unsigned char *server_cert_data; + /** Server cert blob len */ + size_t server_cert_len; + /** Server key blob */ + unsigned char *server_key_data; + /** Server key blob len */ + size_t server_key_len; + /** Server key password */ + char server_key_passwd[PASSWORD_MAX_LENGTH]; + /** Number of EAP users */ + size_t nusers; + /** User Identities */ + char identities[MAX_USERS][IDENTITY_MAX_LENGTH]; + /** User Passwords */ + char passwords[MAX_USERS][PASSWORD_MAX_LENGTH]; +#if CONFIG_EAP_FAST + /** Encryption key for EAP-FAST PAC-Opaque values */ + char pac_opaque_encr_key[PAC_OPAQUE_ENCR_KEY_MAX_LENGTH]; + /** EAP-FAST authority identity (A-ID) */ + char a_id[A_ID_MAX_LENGTH]; + /** EAP-FAST provisioning modes: + * 0 = provisioning disabled + * 1 = only anonymous provisioning allowed + * 2 = only authenticated provisioning allowed + * 3 = both provisioning modes allowed (default) + */ + uint8_t fast_prov; +#endif +#endif +#endif +#elif (CONFIG_WPA2_ENTP) + /** TLS client cert configuration */ + wm_mbedtls_cert_t tls_cert; + /** mbedtls_ssl_config handle */ + mbedtls_ssl_config *wlan_ctx; + /** mbedtls_ssl_context handle */ + mbedtls_ssl_context *wlan_ssl; +#endif +#if CONFIG_WPA_SUPP_DPP + unsigned char *dpp_connector; + unsigned char *dpp_c_sign_key; + unsigned char *dpp_net_access_key; +#endif +}; + +/* Configuration for wireless scanning */ +#define MAX_CHANNEL_LIST 6 +struct wifi_scan_params_t +{ + uint8_t *bssid; + char *ssid; + int channel[MAX_CHANNEL_LIST]; + IEEEtypes_Bss_t bss_type; + int scan_duration; + int split_scan_delay; +}; + +#if CONFIG_WIFI_GET_LOG +/** Wi-Fi firmware stat from \ref wifi_pkt_stats_t + */ +typedef wifi_pkt_stats_t wlan_pkt_stats_t; +#endif + +/** Configuration for Wireless scan channel list from + * \ref wifi_scan_channel_list_t + */ +typedef wifi_scan_channel_list_t wlan_scan_channel_list_t; +/** Configuration for wireless scanning parameters v2 from + * \ref wifi_scan_params_v2_t + */ +typedef wifi_scan_params_v2_t wlan_scan_params_v2_t; + +#if CONFIG_TBTT_OFFSET +/** Configuration for Wireless TBTT Offset stats from + * \ref wifi_tbtt_offset_t + */ +typedef wifi_tbtt_offset_t wlan_tbtt_offset_t; +#endif + +/** Configuration for Wireless Calibration data from + * \ref wifi_cal_data_t + */ +typedef wifi_cal_data_t wlan_cal_data_t; + +#if CONFIG_AUTO_RECONNECT +/** Configuration for Auto reconnect configuration from + * \ref wifi_auto_reconnect_config_t + */ +typedef wifi_auto_reconnect_config_t wlan_auto_reconnect_config_t; +#endif + +/** Configuration for Memory Efficient Filters in Wi-Fi firmware from + * \ref wifi_flt_cfg_t + */ +typedef wifi_flt_cfg_t wlan_flt_cfg_t; + +/** Configuration for wowlan pattern parameters from + * \ref wifi_wowlan_ptn_cfg_t + */ +typedef wifi_wowlan_ptn_cfg_t wlan_wowlan_ptn_cfg_t; +/** Configuration for TCP Keep alive parameters from + * \ref wifi_tcp_keep_alive_t + */ +typedef wifi_tcp_keep_alive_t wlan_tcp_keep_alive_t; +#if CONFIG_NAT_KEEP_ALIVE +/** Configuration for NAT Keep alive parameters from + * \ref wifi_nat_keep_alive_t + */ +typedef wifi_nat_keep_alive_t wlan_nat_keep_alive_t; +#endif + +#if CONFIG_CLOUD_KEEP_ALIVE +/** Configuration for Cloud Keep alive parameters from + * \ref wifi_cloud_keep_alive_t + */ +typedef wifi_cloud_keep_alive_t wlan_cloud_keep_alive_t; +#endif + +/** Configuration for TX Rate and Get data rate from + * \ref wifi_ds_rate + */ +typedef wifi_ds_rate wlan_ds_rate; +/** Configuration for ED MAC Control parameters from + * \ref wifi_ed_mac_ctrl_t + */ +typedef wifi_ed_mac_ctrl_t wlan_ed_mac_ctrl_t; +/** Configuration for Band from + * \ref wifi_bandcfg_t + */ +typedef wifi_bandcfg_t wlan_bandcfg_t; +/** Configuration for CW Mode parameters from + * \ref wifi_cw_mode_ctrl_t + */ +typedef wifi_cw_mode_ctrl_t wlan_cw_mode_ctrl_t; +/** Configuration for Channel list from + * \ref wifi_chanlist_t + */ +typedef wifi_chanlist_t wlan_chanlist_t; +/** Configuration for TX Pwr Limit from + * \ref wifi_txpwrlimit_t + */ +typedef wifi_txpwrlimit_t wlan_txpwrlimit_t; +#ifdef SD8801 +/** Statistic of External Coex from + * \ref wifi_ext_coex_config_t + */ +typedef wifi_ext_coex_stats_t wlan_ext_coex_stats_t; +/** Configuration for External Coex from + * \ref wifi_ext_coex_config_t + */ +typedef wifi_ext_coex_config_t wlan_ext_coex_config_t; +#endif + +#if CONFIG_11AX +/** Configuration for RU TX Pwr Limit from + * \ref wifi_rutxpwrlimit_t + */ +typedef wifi_rutxpwrlimit_t wlan_rutxpwrlimit_t; +/** Configuration for 11AX capabilities + * \ref wifi_11ax_config_t + */ +typedef wifi_11ax_config_t wlan_11ax_config_t; +#if CONFIG_11AX_TWT +/** Configuration for TWT Setup + * \ref wifi_twt_setup_config_t + */ +typedef wifi_twt_setup_config_t wlan_twt_setup_config_t; +/** Configuration for TWT Teardown + * \ref wifi_twt_teardown_config_t + */ +typedef wifi_twt_teardown_config_t wlan_twt_teardown_config_t; +/** Configuration for Broadcast TWT Setup + * \ref wifi_btwt_config_t + */ +typedef wifi_btwt_config_t wlan_btwt_config_t; +/** Configuration for TWT Report + * \ref wifi_twt_report_t + */ +typedef wifi_twt_report_t wlan_twt_report_t; +/** Configuration for TWT Information + * \ref wifi_twt_information_t + */ +typedef wifi_twt_information_t wlan_twt_information_t; +#endif /* CONFIG_11AX_TWT */ +#if CONFIG_MMSF +#define WLAN_AMPDU_DENSITY 0x30 +#define WLAN_AMPDU_MMSF 0x6 +#endif +#endif +#if CONFIG_WIFI_CLOCKSYNC +/** Configuration for Clock Sync GPIO TSF latch + * \ref wifi_clock_sync_gpio_tsf_t + */ +typedef wifi_clock_sync_gpio_tsf_t wlan_clock_sync_gpio_tsf_t; +/** Configuration for TSF info + * \ref wifi_tsf_info_t + */ +typedef wifi_tsf_info_t wlan_tsf_info_t; +#endif + +#if CONFIG_MULTI_CHAN +/** Configuration for multi-channel switch + * \ref wifi_drcs_cfg_t + */ +typedef wifi_drcs_cfg_t wlan_drcs_cfg_t; +#endif + +typedef wifi_mgmt_frame_t wlan_mgmt_frame_t; + +#if CONFIG_1AS +/** Dot1as correlated time + * \ref wifi_correlated_time_t + */ +typedef wifi_correlated_time_t wlan_correlated_time_t; + +/** Dot1as timing measurement info + * \ref wifi_dot1as_info_t + */ +typedef wifi_dot1as_info_t wlan_dot1as_info_t; +#endif + +#if CONFIG_CSI +/** Configuration for Csi Config Params from + * \ref wifi_csi_config_params_t + */ +typedef wifi_csi_config_params_t wlan_csi_config_params_t; +#endif + +#if CONFIG_NET_MONITOR +/** Configuration for Net monitor from + * \ref wifi_net_monitor_t + */ +typedef wifi_net_monitor_t wlan_net_monitor_t; +#endif + +#if (CONFIG_WIFI_IND_RESET) && (CONFIG_WIFI_IND_DNLD) +/** Configuration for GPIO independent reset + * \ref wifi_indrst_cfg_t + */ +typedef wifi_indrst_cfg_t wlan_indrst_cfg_t; +#endif + +#if CONFIG_11AX +/** Configuration for TX Rate Setting from + * \ref txrate_setting + */ +typedef txrate_setting wlan_txrate_setting; +#endif + +#ifdef STA_SUPPORT +/** Configuration for RSSI information + * \ref wifi_rssi_info_t + */ +typedef wifi_rssi_info_t wlan_rssi_info_t; +#endif + +#if CONFIG_EXTERNAL_COEX_PTA +#define MIN_SAMP_TIMING 20 +#define MAX_SAMP_TIMING 200 +#define COEX_PTA_FEATURE_ENABLE 1 +#define COEX_PTA_FEATURE_DISABLE 0 +#define POL_GRANT_PIN_HIGH 0 +#define POL_GRANT_PIN_LOW 1 +#define STATE_INPUT_DISABLE 0 +#define STATE_PTA_PIN 1 +#define STATE_PRIORITY_PIN 2 +#define SAMPLE_TIMING_VALUE 100 +#define EXT_COEX_PTA_INTERFACE 5 +#define EXT_COEX_WCI2_INTERFACE 6 +#define EXT_COEX_WCI2_GPIO_INTERFACE 7 + +typedef struct _external_coex_pta_cfg +{ + /** Enable: 0x01, Disable: 0x00 */ + t_u8 enabled; + /** Enable ExtWifiBtArb: 0x01, Disable ExWifiBtArb: 0x00 */ + t_u8 ext_WifiBtArb; + /** Active high: 0x00, Active low: 0x01 */ + t_u8 polGrantPin; + /** Enable PriPtaInt: 0x01, Disable PriPtaInt: 0x00 */ + t_u8 enable_PriPtaInt; + /** State input disable: 0x00, State info is from state pin: 0x01, State info is sampled on priority pin: 0x02 */ + t_u8 enable_StatusFromPta; + /** Timing to sample Priority bit */ + t_u16 setPriSampTiming; + /** Timing to sample Tx/Rx info */ + t_u16 setStateInfoSampTiming; + /** Enable external traffic Tx/Rx Priority: 0x01, Disable external traffic Tx/Rx Priority: 0x00 */ + t_u8 extRadioTrafficPrio; + /** Enable wci-2 interface: 0x01, Disable wci-2 interface: 0x00 */ + t_u8 extCoexHwIntWci2; +} ext_coex_pta_cfg; +#endif + +int verify_scan_duration_value(int scan_duration); +int verify_scan_channel_value(int channel); +int verify_split_scan_delay(int delay); +int set_scan_params(struct wifi_scan_params_t *wifi_scan_params); +int get_scan_params(struct wifi_scan_params_t *wifi_scan_params); +int wlan_get_current_rssi(short *rssi); +int wlan_get_current_nf(void); + +/** Address types to be used by the element wlan_ip_config.addr_type below + */ +enum address_types +{ + /** static IP address */ + ADDR_TYPE_STATIC = 0, + /** Dynamic IP address*/ + ADDR_TYPE_DHCP = 1, + /** Link level address */ + ADDR_TYPE_LLA = 2, +}; + +/** This data structure represents an IPv4 address */ +struct ipv4_config +{ + /** Set to \ref ADDR_TYPE_DHCP to use DHCP to obtain the IP address or + * \ref ADDR_TYPE_STATIC to use a static IP. In case of static IP + * address ip, gw, netmask and dns members must be specified. When + * using DHCP, the ip, gw, netmask and dns are overwritten by the + * values obtained from the DHCP server. They should be zeroed out if + * not used. */ + enum address_types addr_type; + /** The system's IP address in network order. */ + unsigned address; + /** The system's default gateway in network order. */ + unsigned gw; + /** The system's subnet mask in network order. */ + unsigned netmask; + /** The system's primary dns server in network order. */ + unsigned dns1; + /** The system's secondary dns server in network order. */ + unsigned dns2; +}; + +#if CONFIG_IPV6 +/** This data structure represents an IPv6 address */ +struct ipv6_config +{ + /** The system's IPv6 address in network order. */ + unsigned address[4]; + /** The address type: linklocal, site-local or global. */ + unsigned char addr_type; + /** The state of IPv6 address (Tentative, Preferred, etc). */ + unsigned char addr_state; +}; +#endif + +/** Network IP configuration. + * + * This data structure represents the network IP configuration + * for IPv4 as well as IPv6 addresses + */ +struct wlan_ip_config +{ +#if CONFIG_IPV6 + /** The network IPv6 address configuration that should be + * associated with this interface. */ + struct ipv6_config ipv6[CONFIG_MAX_IPV6_ADDRESSES]; + /** The network IPv6 valid addresses count */ + size_t ipv6_count; +#endif + /** The network IPv4 address configuration that should be + * associated with this interface. */ + struct ipv4_config ipv4; +}; + +/** WLAN Network Profile + * + * This data structure represents a WLAN network profile. It consists of an + * arbitrary name, WiFi configuration, and IP address configuration. + * + * Every network profile is associated with one of the two interfaces. The + * network profile can be used for the station interface (i.e. to connect to an + * Access Point) by setting the role field to \ref + * WLAN_BSS_ROLE_STA. The network profile can be used for the micro-AP + * interface (i.e. to start a network of our own.) by setting the mode field to + * \ref WLAN_BSS_ROLE_UAP. + * + * If the mode field is \ref WLAN_BSS_ROLE_STA, either of the SSID or + * BSSID fields are used to identify the network, while the other members like + * channel and security settings characterize the network. + * + * If the mode field is \ref WLAN_BSS_ROLE_UAP, the SSID, channel and security + * fields are used to define the network to be started. + * + * In both the above cases, the address field is used to determine the type of + * address assignment to be used for this interface. + */ +struct wlan_network +{ +#if CONFIG_WPA_SUPP + /** Identifier for network profile */ + int id; + /* wps_network marks the network is for wps*/ + int wps_network; +#endif + /** The name of this network profile. Each network profile that is + * added to the WLAN Connection Manager must have a unique name. */ + char name[WLAN_NETWORK_NAME_MAX_LENGTH + 1]; + /** The network SSID, represented as a C string of up to 32 characters + * in length. + * If this profile is used in the micro-AP mode, this field is + * used as the SSID of the network. + * If this profile is used in the station mode, this field is + * used to identify the network. Set the first byte of the SSID to NULL + * (a 0-length string) to use only the BSSID to find the network. + */ + char ssid[IEEEtypes_SSID_SIZE + 1]; +#if CONFIG_WLAN_BRIDGE + /*The network SSID for bridge uap*/ + char bridge_ssid[IEEEtypes_SSID_SIZE + 1]; +#endif + /** The network BSSID, represented as a 6-byte array. + * If this profile is used in the micro-AP mode, this field is + * ignored. + * If this profile is used in the station mode, this field is + * used to identify the network. Set all 6 bytes to 0 to use any BSSID, + * in which case only the SSID will be used to find the network. + */ + char bssid[IEEEtypes_ADDRESS_SIZE]; + /** The channel for this network. + * + * If this profile is used in micro-AP mode, this field + * specifies the channel to start the micro-AP interface on. Set this + * to 0 for auto channel selection. + * + * If this profile is used in the station mode, this constrains the + * channel on which the network to connect should be present. Set this + * to 0 to allow the network to be found on any channel. */ + unsigned int channel; + /** The secondary channel offset **/ + uint8_t sec_channel_offset; + /** The ACS band if set channel to 0. **/ + uint16_t acs_band; + /** RSSI */ + int rssi; +#if CONFIG_SCAN_WITH_RSSIFILTER + /** Rssi threshold */ + short rssi_threshold; +#endif +#if CONFIG_WPA_SUPP + /** HT capabilities */ + unsigned short ht_capab; +#if CONFIG_11AC + /** VHT capabilities */ + unsigned int vht_capab; + /** VHT bandwidth */ + unsigned char vht_oper_chwidth; +#endif +#if CONFIG_11AX + /** HE bandwidth */ + unsigned char he_oper_chwidth; +#endif +#endif + /** BSS type */ + enum wlan_bss_type type; + /** The network wireless mode enum wlan_bss_role. Set this + * to specify what type of wireless network mode to use. + * This can either be \ref WLAN_BSS_ROLE_STA for use in + * the station mode, or it can be \ref WLAN_BSS_ROLE_UAP + * for use in the micro-AP mode. */ + enum wlan_bss_role role; + /** The network security configuration specified by struct + * wlan_network_security for the network. */ + struct wlan_network_security security; + /** The network IP address configuration specified by struct + * wlan_ip_config that should be associated with this interface. */ + struct wlan_ip_config ip; +#if CONFIG_WPA2_ENTP + char identity[IDENTITY_MAX_LENGTH]; +#if CONFIG_PEAP_MSCHAPV2 + char anonymous_identity[IDENTITY_MAX_LENGTH]; + char password[PASSWORD_MAX_LENGTH]; +#endif +#endif + + /* Private Fields */ + + /** + * If set to 1, the ssid field contains the specific SSID for this + * network. + * The WLAN Connection Manager will only connect to networks whose SSID + * matches. If set to 0, the ssid field contents are not used when + * deciding whether to connect to a network, the BSSID field is used + * instead and any network whose BSSID matches is accepted. + * + * This field will be set to 1 if the network is added with the SSID + * specified (not an empty string), otherwise it is set to 0. + */ + unsigned ssid_specific : 1; +#if CONFIG_DRIVER_OWE + /** + * If set to 1, the ssid field contains the transitional SSID for this + * network. + */ + unsigned trans_ssid_specific : 1; +#endif + /** If set to 1, the bssid field contains the specific BSSID for this + * network. The WLAN Connection Manager will not connect to any other + * network with the same SSID unless the BSSID matches. If set to 0, the + * WLAN Connection Manager will connect to any network whose SSID matches. + * + * This field will be set to 1 if the network is added with the BSSID + * specified (not set to all zeroes), otherwise it is set to 0. */ + unsigned bssid_specific : 1; + /** + * If set to 1, the channel field contains the specific channel for this + * network. The WLAN Connection Manager will not look for this network on + * any other channel. If set to 0, the WLAN Connection Manager will look + * for this network on any available channel. + * + * This field will be set to 1 if the network is added with the channel + * specified (not set to 0), otherwise it is set to 0. */ + unsigned channel_specific : 1; + /** + * If set to 0, any security that matches is used. This field is + * internally set when the security type parameter above is set to + * WLAN_SECURITY_WILDCARD. + */ + unsigned security_specific : 1; +#if CONFIG_WPS2 + /** This indicates this network is used as an internal network for + * WPS */ + unsigned wps_specific : 1; +#endif + + /** The network supports 802.11N. (For internal use only) */ + unsigned dot11n : 1; +#if CONFIG_11AC + /** The network supports 802.11AC. (For internal use only) */ + unsigned dot11ac : 1; +#endif +#if CONFIG_11AX + /** The network supports 802.11AX. (For internal use only) */ + unsigned dot11ax : 1; +#endif + +#if CONFIG_11R + /** Mobility Domain ID */ + uint16_t mdid; + /** The network uses FT 802.1x security (For internal use only)*/ + unsigned ft_1x : 1; + /** The network uses FT PSK security (For internal use only)*/ + unsigned ft_psk : 1; + /** The network uses FT SAE security (For internal use only)*/ + unsigned ft_sae : 1; +#endif +#if CONFIG_DRIVER_OWE + /** OWE Transition mode */ + unsigned int owe_trans_mode; + /** The network transitional SSID, represented as a C string of up to 32 characters + * in length. + * + * This field is used internally. + */ + char trans_ssid[IEEEtypes_SSID_SIZE + 1]; + /** Transitional SSID length + * + * This field is used internally. + */ + unsigned int trans_ssid_len; +#endif + /** Beacon period of associated BSS */ + uint16_t beacon_period; + /** DTIM period of associated BSS */ + uint8_t dtim_period; +#if CONFIG_WIFI_CAPA + /** Wireless capabilities of uAP network 802.11n, 802.11ac or/and 802.11ax*/ + uint8_t wlan_capa; +#endif +#if CONFIG_11V + /** BTM mode */ + uint8_t btm_mode; + /** bss transition support (For internal use only)*/ + bool bss_transition_supported; +#endif +#if CONFIG_11K + /** Neighbor report support (For internal use only)*/ + bool neighbor_report_supported; +#endif +}; + +struct wlan_ieeeps_config +{ + /** PS null interval in seconds */ + t_u32 ps_null_interval; + /** Multiple DTIM interval */ + t_u32 multiple_dtim_interval; + /** Listen interval */ + t_u32 listen_interval; + /** Adhoc awake period */ + t_u32 adhoc_awake_period; + /** Beacon miss timeout in milliseconds */ + t_u32 bcn_miss_timeout; + /** Delay to PS in milliseconds */ + t_s32 delay_to_ps; + /** PS mode */ + t_u32 ps_mode; +}; + +#if CONFIG_WIFI_TX_PER_TRACK +/** Tx Per Tracking Structure + * Driver sets tx per tracking statistic to fw. + * Fw will check tx packet error rate periodically and + * report PER to host if per is high. + */ +struct wlan_tx_pert_info +{ + /** Enable/Disable tx per tracking */ + t_u8 tx_pert_check; + /** Check period(unit sec) */ + t_u8 tx_pert_check_peroid; + /** (Fail TX packet)/(Total TX packet) ratio(unit 10%) + * default: 5 + */ + t_u8 tx_pert_check_ratio; + /** A watermark of check number(default 5) */ + t_u16 tx_pert_check_num; +}; +#endif +#if defined(RW610) +typedef enum +{ + CLI_DISABLE_WIFI, + CLI_ENABLE_WIFI, + CLI_RESET_WIFI, +} cli_reset_option; +#endif + +enum wlan_mon_task_event +{ + HOST_SLEEP_HANDSHAKE = 1, + HOST_SLEEP_EXIT, + WIFI_RECOVERY_REQ, +}; + +#if CONFIG_HOST_SLEEP +enum wlan_hostsleep_state +{ + HOST_SLEEP_DISABLE, + HOST_SLEEP_ONESHOT, + HOST_SLEEP_PERIODIC, +}; + +#define WLAN_HOSTSLEEP_SUCCESS 1 +#define WLAN_HOSTSLEEP_IN_PROCESS 2 +#define WLAN_HOSTSLEEP_FAIL 3 +#endif + +#if CONFIG_TX_RX_HISTOGRAM +struct wlan_txrx_histogram_info +{ + /** Enable or disable */ + t_u8 enable; + /** Choose to get TX, RX or both */ + t_u16 action; +}; + +#define FLAG_TX_HISTOGRAM 0x01 +#define FLAG_RX_HISTOGRAM 0x02 +#define DISABLE_TX_RX_HISTOGRAM 0x00 +#define ENABLE_TX_RX_HISTOGRAM 0x01 +#define GET_TX_RX_HISTOGRAM 0x02 + +/** TX histiogram ht statistic parameters */ +typedef struct _tx_pkt_ht_rate_info +{ + /** tx packet counter of MCS0~MCS15 */ + t_u32 htmcs_txcnt[16]; + /** tx packet's short GI counter of MCS0~MCS15 */ + t_u32 htsgi_txcnt[16]; + /** tx STBC packet counter of MCS0~MCS15 */ + t_u32 htstbcrate_txcnt[16]; +} tx_pkt_ht_rate_info; +/** TX histiogram vht statistic parameters */ +typedef struct _tx_pkt_vht_rate_info +{ + /** tx packet counter of MCS0~MCS9 */ + t_u32 vhtmcs_txcnt[10]; + /** tx packet's short GI counter of MCS0~MCS9 */ + t_u32 vhtsgi_txcnt[10]; + /** tx STBC packet counter of MCS0~MCS9 */ + t_u32 vhtstbcrate_txcnt[10]; +} tx_pkt_vht_rate_info; +/** TX histiogram he statistic parameters */ +typedef struct _tx_pkt_he_rate_info +{ + /** tx packet counter of MCS0~MCS11 */ + t_u32 hemcs_txcnt[12]; + /** tx STBC packet counter of MCS0~MCS11 */ + t_u32 hestbcrate_txcnt[12]; +} tx_pkt_he_rate_info; +/** TX histogram statistic parameters*/ +typedef struct _tx_pkt_rate_info +{ + /** tx packet counter of every NSS, NSS=1,2 */ + t_u32 nss_txcnt[2]; + /** tx packet counter of every bandwith */ + t_u32 bandwidth_txcnt[3]; + /** different preamble tx packet counter */ + t_u32 preamble_txcnt[4]; + /** tx packet counter of using LDPC coding */ + t_u32 ldpc_txcnt; + /** transmitted RTS counter */ + t_u32 rts_txcnt; + /** RSSI of ack */ + t_s32 ack_RSSI; +} tx_pkt_rate_info; +/** RX histiogram ht statistic parameters */ +typedef struct _rx_pkt_ht_rate_info +{ + /** Rx packet counter of MCS0~MCS15 */ + t_u32 htmcs_rxcnt[16]; + /** Rx packet's short GI counter of MCS0~MCS15 */ + t_u32 htsgi_rxcnt[16]; + /** Rx STBC packet counter of MCS0~MCS15 */ + t_u32 htstbcrate_rxcnt[16]; +} rx_pkt_ht_rate_info; +/** RX histiogram vht statistic parameters */ +typedef struct _rx_pkt_vht_rate_info +{ + /** Rx packet counter of MCS0~MCS9 */ + t_u32 vhtmcs_rxcnt[10]; + /** Rx packet's short GI counter of MCS0~MCS9 */ + t_u32 vhtsgi_rxcnt[10]; + /** Rx STBC packet counter of MCS0~MCS9 */ + t_u32 vhtstbcrate_rxcnt[10]; +} rx_pkt_vht_rate_info; +/** RX histiogram he statistic parameters */ +typedef struct _rx_pkt_he_rate_info +{ + /** Rx packet counter of MCS0~MCS11 */ + t_u32 hemcs_rxcnt[12]; + /** Rx STBC packet counter of MCS0~MCS11 */ + t_u32 hestbcrate_rxcnt[12]; +} rx_pkt_he_rate_info; +/** RX histogram statistic parameters*/ +typedef struct _rx_pkt_rate_info +{ + /** Rx packet counter of every NSS, NSS=1,2 */ + t_u32 nss_rxcnt[2]; + /** Received packet counter which using STBC */ + t_u32 nsts_rxcnt; + /** Rx packet counter of every bandwith */ + t_u32 bandwidth_rxcnt[3]; + /** Different preamble Rx packet counter */ + t_u32 preamble_rxcnt[6]; + /** VHT SIGA2 LDPC bit*/ + t_u32 ldpc_txbfcnt[2]; + /** Average RSSI */ + t_s32 rssi_value[2]; + /** RSSI value of path A */ + t_s32 rssi_chain0[4]; + /** RSSI value of path B */ + t_s32 rssi_chain1[4]; +} rx_pkt_rate_info; +#endif + +#if CONFIG_TX_AMPDU_PROT_MODE +#define TX_AMPDU_RTS_CTS 0 +#define TX_AMPDU_CTS_2_SELF 1 +#define TX_AMPDU_DISABLE_PROTECTION 2 +#define TX_AMPDU_DYNAMIC_RTS_CTS 3 + +/** tx_ampdu_prot_mode parameters */ +typedef struct _tx_ampdu_prot_mode_para +{ + /** set prot mode */ + int mode; +} tx_ampdu_prot_mode_para; +#endif + +typedef wifi_uap_client_disassoc_t wlan_uap_client_disassoc_t; + +#if CONFIG_INACTIVITY_TIMEOUT_EXT +typedef wifi_inactivity_to_t wlan_inactivity_to_t; +#endif + +/* WLAN Connection Manager API */ + +/** Initialize the SDIO driver and create the wifi driver thread. + * + * \param[in] fw_start_addr Start address of the WLAN firmware. + * \param[in] size Size of the WLAN firmware. + * + * \return WM_SUCCESS if the WLAN Connection Manager service has + * initialized successfully. + * \return Negative value if initialization failed. + */ +int wlan_init(const uint8_t *fw_start_addr, const size_t size); + +/** Start the WLAN Connection Manager service. + * + * This function starts the WLAN Connection Manager. + * + * \note The status of the WLAN Connection Manager is notified asynchronously + * through the callback, \a cb, with a WLAN_REASON_INITIALIZED event + * (if initialization succeeded) or WLAN_REASON_INITIALIZATION_FAILED + * (if initialization failed). + * + * \note If the WLAN Connection Manager fails to initialize, the caller should + * stop WLAN Connection Manager via wlan_stop() and try wlan_start() again. + * + * \param[in] cb A pointer to a callback function that handles WLAN events. All + * further WLCMGR events will be notified in this callback. Refer to enum + * \ref wlan_event_reason for the various events for which this callback is called. + * + * \return WM_SUCCESS if the WLAN Connection Manager service has started + * successfully. + * \return -WM_E_INVAL if the \a cb pointer is NULL. + * \return -WM_FAIL if an internal error occurred. + * \return WLAN_ERROR_STATE if the WLAN Connection Manager is already running. + */ +int wlan_start(int (*cb)(enum wlan_event_reason reason, void *data)); + +/** Stop the WLAN Connection Manager service. + * + * This function stops the WLAN Connection Manager, causing station interface + * to disconnect from the currently connected network and stop the + * micro-AP interface. + * + * \return WM_SUCCESS if the WLAN Connection Manager service has been + * stopped successfully. + * \return WLAN_ERROR_STATE if the WLAN Connection Manager was not + * running. + */ +int wlan_stop(void); + +/** Deinitialize SDIO driver, send shutdown command to WLAN firmware + * and delete the wifi driver thread. + * \param action Additional action to be taken with deinit + * WLAN_ACTIVE: no action to be taken + */ +void wlan_deinit(int action); + +#if CONFIG_WPS2 +/** Generate valid PIN for WPS session. + * + * This function generate PIN for WPS PIN session. + * + * \param[in] pin A pointer to WPS pin to be generated. + */ +void wlan_wps_generate_pin(uint32_t *pin); + +/** Start WPS PIN session. + * + * This function starts WPS PIN session. + * + * \param[in] pin Pin for WPS session. + * + * \return WM_SUCCESS if the pin entered is valid. + * \return -WM_FAIL if invalid pin entered. + */ +int wlan_start_wps_pin(uint32_t pin); + +/** Start WPS PBC session. + * + * This function starts WPS PBC session. + * + * \return WM_SUCCESS if successful + */ +int wlan_start_wps_pbc(void); +/** + * Set None/WPS/802.1x session. + * + *\param[in] session 0 -- PROV_NON_SESSION_ATTEMPT, 1 -- PROV_WPS_SESSION_ATTEMPT, 2 -- PROV_ENTP_SESSION_ATTEMPT. + */ +void wlan_set_prov_session(int session); + +/** + * Get connect session type. + * + * \return 0 -- PROV_NON_SESSION_ATTEMPT, 1 -- PROV_WPS_SESSION_ATTEMPT, 2 -- PROV_ENTP_SESSION_ATTEMPT. + */ +int wlan_get_prov_session(void); +#endif + +/** Stop and Remove all wireless network profiles. + * + * \return WM_SUCCESS if successful. + */ +int wlan_remove_all_network_profiles(void); + +#if defined(RW610) +/** Reset driver. + * \param ResetOption option including enable, disable or reset wifi driver + * can be chosen. + */ +void wlan_reset(cli_reset_option ResetOption); +/** Stop and Remove all wireless network (Access Point). + * + * \return WM_SUCCESS if successful. + */ +int wlan_remove_all_networks(void); + +/** + * This API destroy all tasks. + */ +void wlan_destroy_all_tasks(void); +/** Retrieve the status information of if wlan started. + * + * \return TRUE if started. + * \return FALSE if not started. + */ +int wlan_is_started(); + +#endif // RW610 + +#if CONFIG_NCP_BRIDGE +/** uap provisioning deinit callback function */ +void wlan_register_uap_prov_deinit_cb(int (*cb)(void)); +/** uap provisioning cleanup callback function */ +void wlan_register_uap_prov_cleanup_cb(void (*cb)(void)); +/** Stop all wireless network. + * + * \return WM_SUCCESS if successful. + */ +int wlan_stop_all_networks(void); +#endif + +#if CONFIG_RX_ABORT_CFG +struct wlan_rx_abort_cfg +{ + /** Enable/Disable Rx abort config */ + t_u8 enable; + /** Rx weak RSSI pkt threshold */ + int rssi_threshold; +}; +#endif + +#if CONFIG_RX_ABORT_CFG_EXT +struct wlan_rx_abort_cfg_ext +{ + /** Enable/disable dyn rx abort on weak pkt rssi */ + int enable; + /** specify rssi margin */ + int rssi_margin; + /** specify ceil rssi threshold */ + int ceil_rssi_threshold; + /** specify floor rssi threshold */ + int floor_rssi_threshold; + /** current dynamic rssi threshold */ + int current_dynamic_rssi_threshold; + /** rssi config: default or user configured */ + int rssi_default_config; + /** EDMAC status */ + int edmac_enable; +}; +#endif + +#if CONFIG_CCK_DESENSE_CFG +#define CCK_DESENSE_MODE_DISABLED 0 +#define CCK_DESENSE_MODE_DYNAMIC 1 +#define CCK_DESENSE_MODE_DYN_ENH 2 + +struct wlan_cck_desense_cfg +{ + /** cck desense mode: 0:disable 1:normal 2:dynamic */ + t_u16 mode; + /** specify rssi margin */ + int margin; + /** specify ceil rssi threshold */ + int ceil_thresh; + /** cck desense "on" interval count */ + int num_on_intervals; + /** cck desense "off" interval count */ + int num_off_intervals; +}; +#endif +#if CONFIG_RX_ABORT_CFG +/** + * Set/Get RX abort configure to/from Fw. + * + * \param[in,out] cfg A pointer to information buffer + * \param[in] action Command action: GET or SET + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_set_get_rx_abort_cfg(struct wlan_rx_abort_cfg *cfg, t_u16 action); +#endif + +#if CONFIG_RX_ABORT_CFG_EXT +/** + * Set Dynamic RX abort config to Fw. + * + * \param[in] cfg A pointer to information buffer + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_set_rx_abort_cfg_ext(const struct wlan_rx_abort_cfg_ext *cfg); + +/** + * Get Dynamic RX abort config from Fw. + * + * \param[in,out] cfg A pointer to information buffer + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_get_rx_abort_cfg_ext(struct wlan_rx_abort_cfg_ext *cfg); +#endif + +#if CONFIG_CCK_DESENSE_CFG +/** + * Set/Get CCK Desense configure to/from Fw. + * + * \param[in,out] cfg A pointer to information buffer + * \param[in] action Command action: GET or SET + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_set_get_cck_desense_cfg(struct wlan_cck_desense_cfg *cfg, t_u16 action); +#endif + +/** WLAN initialize micro-AP network information + * + * This API intializes a default micro-AP network. The network ssid, passphrase + * is initialized to NULL. Channel is set to auto. The IP Address of the + * micro-AP interface is 192.168.10.1/255.255.255.0. Network name is set to + * 'uap-network'. + * + * \param[out] net Pointer to the initialized micro-AP network + */ +void wlan_initialize_uap_network(struct wlan_network *net); + +/** WLAN initialize station network information + * + * This API intializes a default station network. The network ssid, passphrase + * is initialized to NULL. Channel is set to auto. + * + * \param[out] net Pointer to the initialized micro-AP network + */ +void wlan_initialize_sta_network(struct wlan_network *net); + +/** Add a network profile to the list of known networks. + * + * This function copies the contents of \a network to the list of known + * networks in the WLAN Connection Manager. The network's 'name' field must be + * unique and between \ref WLAN_NETWORK_NAME_MIN_LENGTH and \ref + * WLAN_NETWORK_NAME_MAX_LENGTH characters. The network must specify at least + * an SSID or BSSID. The WLAN Connection Manager may store up to + * WLAN_MAX_KNOWN_NETWORKS networks. + * + * \note Profiles for the station interface may be added only when the station + * interface is in the \ref WLAN_DISCONNECTED or \ref WLAN_CONNECTED state. + * + * \note This API can be used to add profiles for station or + * micro-AP interfaces. + * + * \param[in] network A pointer to the \ref wlan_network that will be copied + * to the list of known networks in the WLAN Connection Manager + * successfully. + * + * \return WM_SUCCESS if the contents pointed to by \a network have been + * added to the WLAN Connection Manager. + * \return -WM_E_INVAL if \a network is NULL or the network name + * is not unique or the network name length is not valid + * or network security is \ref WLAN_SECURITY_WPA3_SAE but + * Management Frame Protection Capable is not enabled. + * in \ref wlan_network_security field. if network security type is + * \ref WLAN_SECURITY_WPA or \ref WLAN_SECURITY_WPA2 or \ref + * WLAN_SECURITY_WPA_WPA2_MIXED, but the passphrase length is less + * than 8 or greater than 63, or the psk length equal to 64 but not + * hexadecimal digits. if network security type is \ref WLAN_SECURITY_WPA3_SAE, + * but the password length is less than 8 or greater than 255. + * if network security type is \ref WLAN_SECURITY_WEP_OPEN or + * \ref WLAN_SECURITY_WEP_SHARED. + * \return -WM_E_NOMEM if there was no room to add the network. + * \return WLAN_ERROR_STATE if the WLAN Connection Manager + * was running and not in the \ref WLAN_DISCONNECTED, + * \ref WLAN_ASSOCIATED or \ref WLAN_CONNECTED state. + */ +int wlan_add_network(struct wlan_network *network); + +/** Remove a network profile from the list of known networks. + * + * This function removes a network (identified by its name) from the WLAN + * Connection Manager, disconnecting from that network if connected. + * + * \note This function is asynchronous if it is called while the WLAN + * Connection Manager is running and connected to the network to be removed. + * In that case, the WLAN Connection Manager will disconnect from the network + * and generate an event with reason \ref WLAN_REASON_USER_DISCONNECT. This + * function is synchronous otherwise. + * + * \note This API can be used to remove profiles for station or + * micro-AP interfaces. Station network will not be removed if it is + * in \ref WLAN_CONNECTED state and uAP network will not be removed + * if it is in \ref WLAN_UAP_STARTED state. + * + * \param[in] name A pointer to the string representing the name of the + * network to remove. + * + * \return WM_SUCCESS if the network named \a name was removed from the + * WLAN Connection Manager successfully. Otherwise, + * the network is not removed. + * \return WLAN_ERROR_STATE if the WLAN Connection Manager was + * running and the station interface was not in the \ref + * WLAN_DISCONNECTED state. + * \return -WM_E_INVAL if \a name is NULL or the network was not found in + * the list of known networks. + * \return -WM_FAIL if an internal error occurred + * while trying to disconnect from the network specified for + * removal. + */ +int wlan_remove_network(const char *name); + +/** Connect to a wireless network (Access Point). + * + * When this function is called, WLAN Connection Manager starts connection attempts + * to the network specified by \a name. The connection result will be notified + * asynchronously to the WLCMGR callback when the connection process has + * completed. + * + * When connecting to a network, the event refers to the connection + * attempt to that network. + * + * Calling this function when the station interface is in the \ref + * WLAN_DISCONNECTED state will, if successful, cause the interface to + * transition into the \ref WLAN_CONNECTING state. If the connection attempt + * succeeds, the station interface will transition to the \ref WLAN_CONNECTED state, + * otherwise it will return to the \ref WLAN_DISCONNECTED state. If this + * function is called while the station interface is in the \ref + * WLAN_CONNECTING or \ref WLAN_CONNECTED state, the WLAN Connection Manager + * will first cancel its connection attempt or disconnect from the network, + * respectively, and generate an event with reason \ref + * WLAN_REASON_USER_DISCONNECT. This will be followed by a second event that + * reports the result of the new connection attempt. + * + * If the connection attempt was successful the WLCMGR callback is notified + * with the event \ref WLAN_REASON_SUCCESS, while if the connection attempt + * fails then either of the events, \ref WLAN_REASON_NETWORK_NOT_FOUND, \ref + * WLAN_REASON_NETWORK_AUTH_FAILED, \ref WLAN_REASON_CONNECT_FAILED + * or \ref WLAN_REASON_ADDRESS_FAILED are reported as appropriate. + * + * \param[in] name A pointer to a string representing the name of the network + * to connect to. + * + * \return WM_SUCCESS if a connection attempt was started successfully + * \return WLAN_ERROR_STATE if the WLAN Connection Manager was not running. + * \return -WM_E_INVAL if there are no known networks to connect to + * or the network specified by \a name is not in the list + * of known networks or network \a name is NULL. + * \return -WM_FAIL if an internal error has occurred. + */ +int wlan_connect(char *name); + +/** Connect to a wireless network (Access Point) with options. + * + * When this function is called, WLAN Connection Manager starts connection attempts + * to the network specified by \a name. The connection result will be notified + * asynchronously to the WLCMGR callback when the connection process has + * completed. + * + * When connecting to a network, the event refers to the connection + * attempt to that network. + * + * Calling this function when the station interface is in the \ref + * WLAN_DISCONNECTED state will, if successful, cause the interface to + * transition into the \ref WLAN_CONNECTING state. If the connection attempt + * succeeds, the station interface will transition to the \ref WLAN_CONNECTED state, + * otherwise it will return to the \ref WLAN_DISCONNECTED state. If this + * function is called while the station interface is in the \ref + * WLAN_CONNECTING or \ref WLAN_CONNECTED state, the WLAN Connection Manager + * will first cancel its connection attempt or disconnect from the network, + * respectively, and generate an event with reason \ref + * WLAN_REASON_USER_DISCONNECT. This will be followed by a second event that + * reports the result of the new connection attempt. + * + * If the connection attempt was successful the WLCMGR callback is notified + * with the event \ref WLAN_REASON_SUCCESS, while if the connection attempt + * fails then either of the events, \ref WLAN_REASON_NETWORK_NOT_FOUND, \ref + * WLAN_REASON_NETWORK_AUTH_FAILED, \ref WLAN_REASON_CONNECT_FAILED + * or \ref WLAN_REASON_ADDRESS_FAILED are reported as appropriate. + * + * \param[in] name A pointer to a string representing the name of the network + * to connect to. + * \param[in] skip_dfs Option to skip DFS channel when doing scan. + * + * \return WM_SUCCESS if a connection attempt was started successfully + * \return WLAN_ERROR_STATE if the WLAN Connection Manager was not running. + * \return -WM_E_INVAL if there are no known networks to connect to + * or the network specified by \a name is not in the list + * of known networks or network \a name is NULL. + * \return -WM_FAIL if an internal error has occurred. + */ +int wlan_connect_opt(char *name, bool skip_dfs); + +/** Reassociate to a wireless network (Access Point). + * + * When this function is called, WLAN Connection Manager starts reassociation + * attempts using same SSID as currently connected network . + * The connection result will be notified asynchronously to the WLCMGR + * callback when the connection process has completed. + * + * When connecting to a network, the event refers to the connection + * attempt to that network. + * + * Calling this function when the station interface is in the \ref + * WLAN_DISCONNECTED state will have no effect. + * + * Calling this function when the station interface is in the \ref + * WLAN_CONNECTED state will, if successful, cause the interface to + * reassociate to another network(AP). + * + * If the connection attempt was successful the WLCMGR callback is notified + * with the event \ref WLAN_REASON_SUCCESS, while if the connection attempt + * fails then either of the events, \ref WLAN_REASON_NETWORK_AUTH_FAILED, + * \ref WLAN_REASON_CONNECT_FAILED or \ref WLAN_REASON_ADDRESS_FAILED + * are reported as appropriate. + * + * \return WM_SUCCESS if a reassociation attempt was started successfully + * \return WLAN_ERROR_STATE if the WLAN Connection Manager was not running. + * or WLAN Connection Manager was not in \ref WLAN_CONNECTED state. + * \return -WM_E_INVAL if there are no known networks to connect to + * \return -WM_FAIL if an internal error has occurred. + */ +int wlan_reassociate(); + +/** Disconnect from the current wireless network (Access Point). + * + * When this function is called, the WLAN Connection Manager attempts to disconnect + * the station interface from its currently connected network (or cancel an in-progress + * connection attempt) and return to the \ref WLAN_DISCONNECTED state. Calling + * this function has no effect if the station interface is already + * disconnected. + * + * \note This is an asynchronous function and successful disconnection will be + * notified using the \ref WLAN_REASON_USER_DISCONNECT. + * + * \return WM_SUCCESS if successful + * \return WLAN_ERROR_STATE otherwise + */ +int wlan_disconnect(void); + +/** Start a wireless network (Access Point). + * + * When this function is called, the WLAN Connection Manager starts the network + * specified by \a name. The network with the specified \a name must be + * first added using \ref wlan_add_network and must be a micro-AP network with + * a valid SSID. + * + * \note The WLCMGR callback is asynchronously notified of the status. On + * success, the event \ref WLAN_REASON_UAP_SUCCESS is reported, while on + * failure, the event \ref WLAN_REASON_UAP_START_FAILED is reported. + * + * \param[in] name A pointer to string representing the name of the network + * to connect to. + * + * \return WM_SUCCESS if successful. + * \return WLAN_ERROR_STATE if in power save state or uAP already running. + * \return -WM_E_INVAL if \a name was NULL or the network \a + * name was not found or it not have a specified SSID. + */ +int wlan_start_network(const char *name); + +/** Stop a wireless network (Access Point). + * + * When this function is called, the WLAN Connection Manager stops the network + * specified by \a name. The specified network must be a valid micro-AP + * network that has already been started. + * + * \note The WLCMGR callback is asynchronously notified of the status. On + * success, the event \ref WLAN_REASON_UAP_STOPPED is reported, while on + * failure, the event \ref WLAN_REASON_UAP_STOP_FAILED is reported. + * + * \param[in] name A pointer to a string representing the name of the network + * to stop. + * + * \return WM_SUCCESS if successful. + * \return WLAN_ERROR_STATE if uAP is in power save state. + * \return -WM_E_INVAL if \a name was NULL or the network \a + * name was not found or that the network \a name is not a micro-AP + * network or it is a micro-AP network but does not have a specified + * SSID. + */ +int wlan_stop_network(const char *name); + +/** Retrieve the wireless MAC address of station interface. + * + * This function copies the MAC address of the station interface to sta mac address and uAP interface to uap mac + * address. + * + * \param[out] dest A pointer to a 6-byte array where the MAC address will be + * copied. + * + * \return WM_SUCCESS if the MAC address was copied. + * \return -WM_E_INVAL if \a sta_mac or uap_mac is NULL. + */ +int wlan_get_mac_address(uint8_t *dest); + +/** Retrieve the wireless MAC address of micro-AP interface. + * + * This function copies the MAC address of the wireless interface to + * the 6-byte array pointed to by \a dest. In the event of an error, nothing + * is copied to \a dest. + * + * \param[out] dest A pointer to a 6-byte array where the MAC address will be + * copied. + * + * \return WM_SUCCESS if the MAC address was copied. + * \return -WM_E_INVAL if \a dest is NULL. + */ +int wlan_get_mac_address_uap(uint8_t *dest); + +/** Retrieve the IP address configuration of the station interface. + * + * This function retrieves the IP address configuration + * of the station interface and copies it to the memory + * location pointed to by \a addr. + * + * \note This function may only be called when the station interface is in the + * \ref WLAN_CONNECTED state. + * + * \param[out] addr A pointer to the \ref wlan_ip_config. + * + * \return WM_SUCCESS if successful. + * \return -WM_E_INVAL if \a addr is NULL. + * \return WLAN_ERROR_STATE if the WLAN Connection Manager was not running or was + * not in the \ref WLAN_CONNECTED state. + * \return -WM_FAIL if an internal error + * occurred when retrieving IP address information from the + * TCP stack. + */ +int wlan_get_address(struct wlan_ip_config *addr); + +/** Retrieve the IP address of micro-AP interface. + * + * This function retrieves the current IP address configuration of micro-AP + * and copies it to the memory location pointed to by \a addr. + * + * \note This function may only be called when the micro-AP interface is in the + * \ref WLAN_UAP_STARTED state. + * + * \param[out] addr A pointer to the \ref wlan_ip_config. + * + * \return WM_SUCCESS if successful. + * \return -WM_E_INVAL if \a addr is NULL. + * \return WLAN_ERROR_STATE if the WLAN Connection Manager was not running or + * the micro-AP interface was not in the \ref WLAN_UAP_STARTED state. + * \return -WM_FAIL if an internal error + * occurred when retrieving IP address information from the + * TCP stack. + */ +int wlan_get_uap_address(struct wlan_ip_config *addr); + +/** Retrieve the channel of micro-AP interface. + * + * This function retrieves the channel number of micro-AP + * and copies it to the memory location pointed to by \a channel. + * + * \note This function may only be called when the micro-AP interface is in the + * \ref WLAN_UAP_STARTED state. + * + * \param[out] channel A pointer to variable that stores channel number. + * + * \return WM_SUCCESS if successful. + * \return -WM_E_INVAL if \a channel is NULL. + * \return -WM_FAIL if an internal error has occurred. + */ +int wlan_get_uap_channel(int *channel); + +/** Retrieve the current network configuration of station interface. + * + * This function retrieves the current network configuration of station + * interface when the station interface is in the \ref WLAN_CONNECTED + * state. + * + * \param[out] network A pointer to the \ref wlan_network. + * + * \return WM_SUCCESS if successful. + * \return -WM_E_INVAL if \a network is NULL. + * \return WLAN_ERROR_STATE if the WLAN Connection Manager was + * not running or not in the \ref WLAN_CONNECTED state. + */ +int wlan_get_current_network(struct wlan_network *network); + +/** Retrieve the current network ssid of station interface. + * + * This function retrieves the current network ssid of station + * interface when the station interface is in the \ref WLAN_CONNECTED + * state. + * + * \param[out] ssid A pointer to the ssid. + * + * \return WM_SUCCESS if successful. + * \return -WM_E_INVAL if \a network is NULL. + * \return WLAN_ERROR_STATE if the WLAN Connection Manager was + * not running or not in the \ref WLAN_CONNECTED state. + */ +int wlan_get_current_network_ssid(char *ssid); + +/** Retrieve the current network bssid of station interface. + * + * This function retrieves the current network bssid of station + * interface when the station interface is in the \ref WLAN_CONNECTED + * state. + * + * \param[out] bssid A pointer to the bssid. + * + * \return WM_SUCCESS if successful. + * \return -WM_E_INVAL if \a network is NULL. + * \return WLAN_ERROR_STATE if the WLAN Connection Manager was + * not running or not in the \ref WLAN_CONNECTED state. + */ +int wlan_get_current_network_bssid(char *bssid); + +/** Retrieve the current network configuration of micro-AP interface. + * + * This function retrieves the current network configuration of micro-AP + * interface when the micro-AP interface is in the \ref WLAN_UAP_STARTED state. + * + * \param[out] network A pointer to the \ref wlan_network. + * + * \return WM_SUCCESS if successful. + * \return -WM_E_INVAL if \a network is NULL. + * \return WLAN_ERROR_STATE if the WLAN Connection Manager was + * not running or not in the \ref WLAN_UAP_STARTED state. + */ +int wlan_get_current_uap_network(struct wlan_network *network); + +/** Retrieve the current network ssid of micro-AP interface. + * + * This function retrieves the current network ssid of micro-AP + * interface when the micro-AP interface is in the \ref WLAN_UAP_STARTED state. + * + * \param[out] ssid A pointer to the ssid. + * + * \return WM_SUCCESS if successful. + * \return -WM_E_INVAL if \a network is NULL. + * \return WLAN_ERROR_STATE if the WLAN Connection Manager was + * not running or not in the \ref WLAN_UAP_STARTED state. + */ +int wlan_get_current_uap_network_ssid(char *ssid); + +#if CONFIG_SCAN_WITH_RSSIFILTER +int wlan_set_rssi_threshold(int rssithr); +#endif + +/** Retrieve the status information of the micro-AP interface. + * + * \return TRUE if micro-AP interface is in \ref WLAN_UAP_STARTED state. + * \return FALSE otherwise. + */ +bool is_uap_started(void); + +/** Retrieve the status information of the station interface. + * + * \return TRUE if station interface is in \ref WLAN_CONNECTED state. + * \return FALSE otherwise. + */ +bool is_sta_connected(void); + +/** Retrieve the status information of the ipv4 network of station interface. + * + * \return TRUE if ipv4 network of station interface is in \ref WLAN_CONNECTED + * state. + * \return FALSE otherwise. + */ +bool is_sta_ipv4_connected(void); + +#if CONFIG_IPV6 +/** Retrieve the status information of the ipv6 network of station interface. + * + * \return TRUE if ipv6 network of station interface is in \ref WLAN_CONNECTED + * state. + * \return FALSE otherwise. + */ +bool is_sta_ipv6_connected(void); +#endif + +/** Retrieve the information about a known network using \a index. + * + * This function retrieves the contents of a network at \a index in the + * list of known networks maintained by the WLAN Connection Manager and + * copies it to the location pointed to by \a network. + * + * \note \ref wlan_get_network_count() may be used to retrieve the number + * of known networks. \ref wlan_get_network() may be used to retrieve + * information about networks at \a index 0 to one minus the number of networks. + * + * \note This function may be called regardless of whether the WLAN Connection + * Manager is running. Calls to this function are synchronous. + * + * \param[in] index The index of the network to retrieve. + * \param[out] network A pointer to the \ref wlan_network where the network + * configuration for the network at \a index will be copied. + * + * \returns WM_SUCCESS if successful. + * \return -WM_E_INVAL if \a network is NULL or \a index is out of range. + */ +int wlan_get_network(unsigned int index, struct wlan_network *network); + +/** Retrieve information about a known network using \a name. + * + * This function retrieves the contents of a named network in the + * list of known networks maintained by the WLAN Connection Manager and + * copies it to the location pointed to by \a network. + * + * \note This function may be called regardless of whether the WLAN Connection + * Manager is running. Calls to this function are synchronous. + * + * \param[in] name The name of the network to retrieve. + * \param[out] network A pointer to the \ref wlan_network where the network + * configuration for the network having name as \a name will be copied. + * + * \return WM_SUCCESS if successful. + * \return -WM_E_INVAL if \a network is NULL or \a name is NULL. + */ +int wlan_get_network_byname(char *name, struct wlan_network *network); + +/** Retrieve the number of networks known to the WLAN Connection Manager. + * + * This function retrieves the number of known networks in the list maintained + * by the WLAN Connection Manager and copies it to \a count. + * + * \note This function may be called regardless of whether the WLAN Connection + * Manager is running. Calls to this function are synchronous. + * + * \param[out] count A pointer to the memory location where the number of + * networks will be copied. + * + * \return WM_SUCCESS if successful. + * \return -WM_E_INVAL if \a count is NULL. + */ +int wlan_get_network_count(unsigned int *count); + +/** Retrieve the connection state of station interface. + * + * This function retrieves the connection state of station interface, which is + * one of \ref WLAN_DISCONNECTED, \ref WLAN_CONNECTING, \ref WLAN_ASSOCIATED + * or \ref WLAN_CONNECTED. + * + * \param[out] state A pointer to the \ref wlan_connection_state where the + * current connection state will be copied. + * + * \return WM_SUCCESS if successful. + * \return -WM_E_INVAL if \a state is NULL + * \return WLAN_ERROR_STATE if the WLAN Connection Manager was not running. + */ +int wlan_get_connection_state(enum wlan_connection_state *state); + +/** Retrieve the connection state of micro-AP interface. + * + * This function retrieves the connection state of micro-AP interface, which is + * one of \ref WLAN_UAP_STARTED, or \ref WLAN_UAP_STOPPED. + * + * \param[out] state A pointer to the \ref wlan_connection_state where the + * current connection state will be copied. + * + * \return WM_SUCCESS if successful. + * \return -WM_E_INVAL if \a state is NULL + * \return WLAN_ERROR_STATE if the WLAN Connection Manager was not running. + */ +int wlan_get_uap_connection_state(enum wlan_connection_state *state); + +/** Scan for wireless networks. + * + * When this function is called, the WLAN Connection Manager starts scan + * for wireless networks. On completion of the scan the WLAN Connection Manager + * will call the specified callback function \a cb. The callback function can then + * retrieve the scan results by using the \ref wlan_get_scan_result() function. + * + * \note This function may only be called when the station interface is in the + * \ref WLAN_DISCONNECTED or \ref WLAN_CONNECTED state. Scanning is disabled + * in the \ref WLAN_CONNECTING state. + * + * \note This function will block until it can issue a scan request if called + * while another scan is in progress. + * + * \param[in] cb A pointer to the function that will be called to handle scan + * results when they are available. + * + * \return WM_SUCCESS if successful. + * \return -WM_E_NOMEM if failed to allocated memory for \ref + * wlan_scan_params_v2_t structure. + * \return -WM_E_INVAL if \a cb scan result callack functio pointer is NULL. + * \return WLAN_ERROR_STATE if the WLAN Connection Manager was + * not running or not in the \ref WLAN_DISCONNECTED or \ref + * WLAN_CONNECTED states. + * \return -WM_FAIL if an internal error has occurred and + * the system is unable to scan. + */ +int wlan_scan(int (*cb)(unsigned int count)); + +/** Scan for wireless networks using options provided. + * + * When this function is called, the WLAN Connection Manager starts scan + * for wireless networks. On completion of the scan the WLAN Connection Manager + * will call the specified callback function \a cb. The callback function + * can then retrieve the scan results by using the \ref wlan_get_scan_result() + * function. + * + * \note This function may only be called when the station interface is in the + * \ref WLAN_DISCONNECTED or \ref WLAN_CONNECTED state. Scanning is disabled + * in the \ref WLAN_CONNECTING state. + * + * \note This function will block until it can issue a scan request if called + * while another scan is in progress. + * + * \param[in] t_wlan_scan_param A \ref wlan_scan_params_v2_t structure holding + * a pointer to function that will be called + * to handle scan results when they are available, + * SSID of a wireless network, BSSID of a wireless network, + * number of channels with scan type information and number of + * probes. + * + * \return WM_SUCCESS if successful. + * \return -WM_E_NOMEM if failed to allocated memory for \ref + * wlan_scan_params_v2_t structure. + * \return -WM_E_INVAL if \a cb scan result callack function pointer is NULL. + * \return WLAN_ERROR_STATE if the WLAN Connection Manager was + * not running or not in the \ref WLAN_DISCONNECTED or \ref + * WLAN_CONNECTED states. + * \return -WM_FAIL if an internal error has occurred and + * the system is unable to scan. + */ +int wlan_scan_with_opt(wlan_scan_params_v2_t t_wlan_scan_param); + +/** Retrieve a scan result. + * + * This function may be called to retrieve scan results when the WLAN + * Connection Manager has finished scanning. It must be called from within the + * scan result callback (see \ref wlan_scan()) as scan results are valid + * only in that context. The callback argument 'count' provides the number + * of scan results that may be retrieved and \ref wlan_get_scan_result() may + * be used to retrieve scan results at \a index 0 through that number. + * + * \note This function may only be called in the context of the scan results + * callback. + * + * \note Calls to this function are synchronous. + * + * \param[in] index The scan result to retrieve. + * \param[out] res A pointer to the \ref wlan_scan_result where the scan + * result information will be copied. + * + * \return WM_SUCCESS if successful. + * \return -WM_E_INVAL if \a res is NULL + * \return WLAN_ERROR_STATE if the WLAN Connection Manager + * was not running + * \return -WM_FAIL if the scan result at \a + * index could not be retrieved (that is, \a index + * is out of range). + */ +int wlan_get_scan_result(unsigned int index, struct wlan_scan_result *res); + +#ifdef WLAN_LOW_POWER_ENABLE +/** + * Enable Low Power Mode in Wireless Firmware. + * + * \note When low power mode is enabled, the output power will be clipped at + * ~+10dBm and the expected PA current is expected to be in the 80-90 mA + * range for b/g/n modes. + * + * This function may be called to enable low power mode in firmware. + * This should be called before \ref wlan_init() function. + * + * \return WM_SUCCESS if the call was successful. + * \return -WM_FAIL if failed. + * + */ +int wlan_enable_low_pwr_mode(); +#endif + +/** + * Configure ED MAC mode for Station in Wireless Firmware. + * + * \note When ed mac mode is enabled, + * Wireless Firmware will behave following way: + * + * when background noise had reached -70dB or above, + * WiFi chipset/module should hold data transmitting + * until condition is removed. + * It is applicable for both 5GHz and 2.4GHz bands. + * + * \param[in] wlan_ed_mac_ctrl Struct with following parameters + * ed_ctrl_2g 0 - disable EU adaptivity for 2.4GHz band + * 1 - enable EU adaptivity for 2.4GHz band + * + * ed_offset_2g 0 - Default Energy Detect threshold (Default: 0x9) + * offset value range: 0x80 to 0x7F + * + * \note If 5GH enabled then add following parameters + * + * ed_ctrl_5g 0 - disable EU adaptivity for 5GHz band + * 1 - enable EU adaptivity for 5GHz band + * + * ed_offset_5g 0 - Default Energy Detect threshold(Default: 0xC) + * offset value range: 0x80 to 0x7F + * + * \return WM_SUCCESS if the call was successful. + * \return -WM_FAIL if failed. + * + */ +int wlan_set_ed_mac_mode(wlan_ed_mac_ctrl_t wlan_ed_mac_ctrl); + +/** + * Configure ED MAC mode for Micro AP in Wireless Firmware. + * + * \note When ed mac mode is enabled, + * Wireless Firmware will behave following way: + * + * when background noise had reached -70dB or above, + * WiFi chipset/module should hold data transmitting + * until condition is removed. + * It is applicable for both 5GHz and 2.4GHz bands. + * + * \param[in] wlan_ed_mac_ctrl Struct with following parameters + * ed_ctrl_2g 0 - disable EU adaptivity for 2.4GHz band + * 1 - enable EU adaptivity for 2.4GHz band + * + * ed_offset_2g 0 - Default Energy Detect threshold (Default: 0x9) + * offset value range: 0x80 to 0x7F + * + * \note If 5GH enabled then add following parameters + * + * ed_ctrl_5g 0 - disable EU adaptivity for 5GHz band + * 1 - enable EU adaptivity for 5GHz band + * + * ed_offset_5g 0 - Default Energy Detect threshold(Default: 0xC) + * offset value range: 0x80 to 0x7F + * + * \return WM_SUCCESS if the call was successful. + * \return -WM_FAIL if failed. + * + */ +int wlan_set_uap_ed_mac_mode(wlan_ed_mac_ctrl_t wlan_ed_mac_ctrl); + +/** + * This API can be used to get current ED MAC MODE configuration for Station. + * + * \param[out] wlan_ed_mac_ctrl A pointer to \ref wlan_ed_mac_ctrl_t + * with parameters mentioned in above set API. + * + * \return WM_SUCCESS if the call was successful. + * \return -WM_FAIL if failed. + * + */ +int wlan_get_ed_mac_mode(wlan_ed_mac_ctrl_t *wlan_ed_mac_ctrl); + +/** + * This API can be used to get current ED MAC MODE configuration for Micro AP. + * + * \param[out] wlan_ed_mac_ctrl A pointer to \ref wlan_ed_mac_ctrl_t + * with parameters mentioned in above set API. + * + * \return WM_SUCCESS if the call was successful. + * \return -WM_FAIL if failed. + * + */ +int wlan_get_uap_ed_mac_mode(wlan_ed_mac_ctrl_t *wlan_ed_mac_ctrl); + +/** Set wireless calibration data in WLAN firmware. + * + * This function may be called to set wireless calibration data in firmware. + * This should be call before \ref wlan_init() function. + * + * \param[in] cal_data The calibration data buffer + * \param[in] cal_data_size Size of calibration data buffer. + * + */ +void wlan_set_cal_data(const uint8_t *cal_data, const unsigned int cal_data_size); + +/** Set wireless MAC Address in WLAN firmware. + * + * This function may be called to set wireless MAC Address in firmware. + * This should be call before \ref wlan_init() function. + * When called after wlan init done, the incoming mac is treated as the sta mac address directly. And mac[4] plus 1 the + * modifed mac as the UAP mac address. + * + * \param[in] mac The MAC Address in 6 byte array format like + * uint8_t mac[] = { 0x00, 0x50, 0x43, 0x21, 0x19, 0x6E}; + * + * \return WM_SUCCESS if the call was successful. + * \return -WM_FAIL if failed. + */ +int wlan_set_mac_addr(uint8_t *mac); + +/** Set wireless MAC Address for STA in WLAN firmware. + * + * This function may be called to set wireless MAC Address in firmware. + * This should be call before \ref wlan_init() function. + * When called after wlan init done, it will set only STA MAC adderess. + * + * \param[in] mac The MAC Address in 6 byte array format like + * uint8_t mac[] = { 0x00, 0x50, 0x43, 0x21, 0x19, 0x6E}; + * + * \return WM_SUCCESS if the call was successful. + * \return -WM_FAIL if failed. + */ +int wlan_set_sta_mac_addr(uint8_t *mac); + +/** Set wireless MAC Address for uAP in WLAN firmware. + * + * This function may be called to set wireless MAC Address in firmware. + * This should be call before \ref wlan_init() function. + * When called after wlan init done, it will set only uAP MAC address. + * + * \param[in] mac The MAC Address in 6 byte array format like + * uint8_t mac[] = { 0x00, 0x50, 0x43, 0x21, 0x19, 0x6E}; + * + * \return WM_SUCCESS if the call was successful. + * \return -WM_FAIL if failed. + */ +int wlan_set_uap_mac_addr(uint8_t *mac); + +#if CONFIG_WMM_UAPSD +/** Set QOS info in WLAN firmware. + * + * \param[in] qos_info UAPSD QOS info. + * \param[in] action Set/get action. + * + * \return WM_SUCCESS if the call was successful. + * \return -WM_FAIL if failed. + */ +int wlan_wmm_uapsd_qosinfo(t_u8 *qos_info, t_u8 action); +/** Enable/disable UAPSD in WLAN firmware. + * + * \param[in] uapsd_enable Enable/disable UAPSD. + * + * \return WM_SUCCESS if the call was successful. + * \return -WM_FAIL if failed. + */ +int wlan_set_wmm_uapsd(t_u8 uapsd_enable); +/** Set/get UAPSD sleep period in WLAN firmware. + * + * \param[in] sleep_period UAPSD sleep period. + * \param[in] action Set/get action. + * + * \return WM_SUCCESS if the call was successful. + * \return -WM_FAIL if failed. + */ +int wlan_sleep_period(unsigned int *sleep_period, t_u8 action); +/** Check if UAPSD is enabled or not. + * + * \return true if UAPSD is enabled. + * \return false if UAPSD is disabled. + */ +t_u8 wlan_is_wmm_uapsd_enabled(void); +#endif + +#if CONFIG_WIFI_TX_BUFF +/** Reconfigure wifi tx buffer size in WLAN firmware. + * + * This function may be called to reconfigure wifi tx buffer size in firmware. + * This should be call before \ref wlan_init() function. + * + * \param[in] buf_size The new buffer size + * + * \param[in] bss_type 0: STA, 1: uAP + * + */ +void wlan_recfg_tx_buf_size(uint16_t buf_size, mlan_bss_type bss_type); +#endif + +#if CONFIG_WIFI_TX_PER_TRACK +/** Set Tx PER tracking config. + * This function may be called to set Tx PER tracking in firmware. + * + * \param[in] tx_pert User configured parameters of Tx PER tracking + * period, ratio and number of tx packets. + * + * \param[in] bss_type BSS type for STA or uAP. + * + * \return WM_SUCCESS if the call was successful. + * \return -WM_FAIL if failed. + */ +void wlan_set_tx_pert(struct wlan_tx_pert_info *tx_pert, mlan_bss_type bss_type); +#endif + +#if CONFIG_TX_RX_HISTOGRAM +/** Set Tx Rx histogram config. + * This function may be called to set Tx Rx histogram config. + * + * \param[in] txrx_histogram User configured parameters of Tx Rx histogram + * including enable and action. + * \param[out] data Tx Rx histogram data from fw. + */ +void wlan_set_txrx_histogram(struct wlan_txrx_histogram_info *txrx_histogram, t_u8 *data); +#endif + +#if CONFIG_ROAMING +/** Set soft roaming config. + * + * This function may be called to enable/disable soft roaming + * by specifying the RSSI threshold. + * + * \note RSSI Threshold setting for soft roaming: + * The provided RSSI low threshold value is used to subscribe + * RSSI low event from firmware, on reception of this event + * background scan is started in firmware with same RSSI + * threshold to find out APs with better signal strength than + * RSSI threshold. + * + * If AP is found then roam attempt is initiated, otherwise + * background scan started again till limit reaches to + * BG_SCAN_LIMIT. + * + * If still AP is not found then WLAN connection manager sends + * \ref WLAN_REASON_BGSCAN_NETWORK_NOT_FOUND event to + * application. In this case, + * if application again wants to use soft roaming then it + * can call this API again or use + * \ref wlan_set_rssi_low_threshold API to set RSSI low + * threshold again. + * + * \param[in] enable Enable/disable roaming. + * \param[in] rssi_low_threshold RSSI low threshold value + * + * \return WM_SUCCESS if the call was successful. + * \return -WM_FAIL if failed. + */ +int wlan_set_roaming(const int enable, const uint8_t rssi_low_threshold); + +int wlan_get_roaming_status(); + +/** Subscribe RSSI LOW event in firmware if roaming is enabled. + */ +void wlan_subscribe_rssi_low_event(); +#endif + +#if CONFIG_HOST_SLEEP +#ifdef RW610 +#if CONFIG_MEF_CFG +/** Wowlan configure. + * This function may be called to config host sleep in firmware. + * + * \param[in] is_mef Flag to indicate use MEF condition or not. + * \param[in] wake_up_conds Bit map of default condition. + * + * \return WM_SUCCESS if the call was successful. + * \return -WM_FAIL if failed. + */ +int wlan_wowlan_config(uint8_t is_mef, t_u32 wake_up_conds); +#else +/** Wowlan configure. + * This function may be called to config host sleep in firmware. + * + * \param[in] wake_up_conds Bit map of default condition. + * + * \return WM_SUCCESS if the call was successful. + * \return -WM_FAIL if failed. + */ +int wlan_wowlan_config(t_u32 wake_up_conds); +#endif + +/** Host sleep configure. + * This function may be called to config host sleep in firmware. + * + * \param[in] is_manual Flag to indicate host enter low power mode with power manager or by command. + * \param[in] is_periodic Flag to indicate host enter low power periodically or once with power manager. + */ +void wlan_config_host_sleep(bool is_manual, t_u8 is_periodic); + +/** This function sent host sleep events to mon_thread + * \param[in] id Event ID. + * \param[in] data Pointer to event msg. + */ +status_t wlan_hs_send_event(int id, void *data); +#endif /*RW610*/ + +/** Cancel host sleep. + * This function may be called to cancel host sleep in firmware. + */ +void wlan_cancel_host_sleep(); + +/** Clear host sleep configurations in driver. + * This function clears all the host sleep related configures in driver. + */ +void wlan_clear_host_sleep_config(); + +/** This function set multicast MEF entry + * + * \param[in] mef_action To be 0--discard and not wake host, 1--discard and wake host 3--allow and wake host. + * \return WM_SUCCESS if the call was successful. + * \return -WM_FAIL if failed. + */ +int wlan_set_multicast(t_u8 mef_action); +#endif + +/** Set configuration parameters of IEEE power save mode. + * + * \param [in] ps_cfg : powersave configuratiuon includes multiple parameters. + * \return WM_SUCCESS if the call was successful. + * \return -WM_FAIL if failed. + */ +int wlan_set_ieeeps_cfg(struct wlan_ieeeps_config *ps_cfg); + +/** Set configuration parameters of IEEE power save mode. + * + * \param [in] ps_cfg : powersave configuratiuon includes multiple parameters. + * \return WM_SUCCESS if the call was successful. + * \return -WM_FAIL if failed. + */ +int wlan_set_ieeeps_cfg(struct wlan_ieeeps_config *ps_cfg); + +/** Configure Listen interval of IEEE power save mode. + * + * \note Delivery Traffic Indication Message (DTIM): + * It is a concept in 802.11 + * It is a time duration after which AP will send out buffered + * BROADCAST / MULTICAST data and stations connected to the AP + * should wakeup to take this broadcast / multicast data. + + * \note Traffic Indication Map (TIM): + * It is a bitmap which the AP sends with each beacon. + * The bitmap has one bit each for a station connected to AP. + * + * \note Each station is recognized by an Association Id (AID). + * If AID is say 1 bit number 1 is set in the bitmap if + * unicast data is present with AP in its buffer for station with AID = 1 + * Ideally AP does not buffer any unicast data it just sends + * unicast data to the station on every beacon when station + * is not sleeping.\n + * When broadcast data / multicast data is to be send AP sets bit 0 + * of TIM indicating broadcast / multicast.\n + * The occurrence of DTIM is defined by AP.\n + * Each beacon has a number indicating period at which DTIM occurs.\n + * The number is expressed in terms of number of beacons.\n + * This period is called DTIM Period / DTIM interval.\n + * For example:\n + * If AP has DTIM period = 3 the stations connected to AP + * have to wake up (if they are sleeping) to receive + * broadcast /multicast data on every third beacon.\n + * Generic:\n + * When DTIM period is X + * AP buffers broadcast data / multicast data for X beacons. + * Then it transmits the data no matter whether station is awake or not.\n + * Listen interval:\n + * This is time interval on station side which indicates when station + * will be awake to listen i.e. accept data.\n + * Long listen interval:\n + * It comes into picture when station sleeps (IEEEPS) and it does + * not want to wake up on every DTIM + * So station is not worried about broadcast data/multicast data + * in this case.\n + * This should be a design decision what should be chosen + * Firmware suggests values which are about 3 times DTIM + * at the max to gain optimal usage and reliability.\n + * In the IEEEPS power save mode, the WiFi firmware goes to sleep and + * periodically wakes up to check if the AP has any pending packets for it. A + * longer listen interval implies that the WiFi card stays in power save for a + * longer duration at the cost of additional delays while receiving data. + * Please note that choosing incorrect value for listen interval will + * causes poor response from device during data transfer. + * Actual listen interval selected by firmware is equal to closest DTIM.\n + * For e.g.:-\n + * AP beacon period : 100 ms\n + * AP DTIM period : 2\n + * Application request value: 500ms\n + * Actual listen interval = 400ms (This is the closest DTIM). + * Actual listen interval set will be a multiple of DTIM closest to but + * lower than the value provided by the application.\n + * + * \note This API can be called before/after association. + * The configured listen interval will be used in subsequent association + * attempt. + * + * \param [in] listen_interval Listen interval as below\n + * 0 : Unchanged,\n + * -1 : Disable,\n + * 1-49: Value in beacon intervals,\n + * >= 50: Value in TUs\n + */ +void wlan_configure_listen_interval(int listen_interval); + +void wlan_configure_delay_to_ps(unsigned int timeout_ms); + +unsigned short wlan_get_listen_interval(); + +unsigned int wlan_get_delay_to_ps(); + +bool wlan_is_power_save_enabled(); + +/** Configure Null packet interval of IEEE power save mode. + * + * \note In IEEEPS station sends a NULL packet to AP to indicate that + * the station is alive and AP should not kick it off. + * If null packet is not send some APs may disconnect station + * which might lead to a loss of connectivity. + * The time is specified in seconds. + * Default value is 30 seconds. + * + * \note This API should be called before configuring IEEEPS + * + * \param [in] time_in_secs : -1 Disables null packet transmission, + * 0 Null packet interval is unchanged, + * n Null packet interval in seconds. + */ +void wlan_configure_null_pkt_interval(int time_in_secs); + +#ifdef STREAM_2X2 +/** This function sets current antenna. + * + * \param[in] ant Antenna + * Valid values are 1, 2 and 65535. + * 1: Set Antenna 1, + * 2: Set Antenna 2, + * 65535: Set Antenna diversity. + * + * \return WM_SUCCESS if successful. + * \return WLAN_ERROR_STATE if unsuccessful. + */ +int wlan_set_current_ant(uint8_t tx_antenna, uint8_t rx_antenna); +#else +#ifndef RW610 +/** This API can be used to set the mode of Tx/Rx antenna. + * If SAD is enabled, this API can also used to set SAD antenna + * evaluate time interval(antenna mode must be antenna diversity + * when set SAD evaluate time interval). + * + * \param[in] ant Antenna valid values are 1, 2 and 65535 + * 1 : Tx/Rx antenna 1 + * 2 : Tx/Rx antenna 2 + * 0xFFFF: Tx/Rx antenna diversity + * \param[in] evaluate_time + * SAD evaluate time interval, default value is 6s(0x1770). + * + * \return WM_SUCCESS if successful. + * \return WLAN_ERROR_STATE if unsuccessful. + * + */ +int wlan_set_antcfg(uint32_t ant, uint16_t evaluate_time); + +/** This API can be used to get the mode of Tx/Rx antenna. + * If SAD is enabled, this API can also used to get SAD antenna + * evaluate time interval(antenna mode must be antenna diversity + * when set SAD evaluate time interval). + * + * \param[out] ant pointer to antenna variable. + * \param[out] evaluate_time pointer to evaluate_time variable for SAD. + * \param[out] current_antenna pointer to current antenna. + * + * \return WM_SUCCESS if successful. + * \return WLAN_ERROR_STATE if unsuccessful. + */ +int wlan_get_antcfg(uint32_t *ant, uint16_t *evaluate_time, uint16_t *current_antenna); +#else +/** This API can be used to set the mode of Tx/Rx antenna. + * If SAD is enabled, this API can also used to set SAD antenna + * evaluate time interval(antenna mode must be antenna diversity + * when set SAD evaluate time interval). + * + * \param[in] ant Antenna valid values are 1, 2 and 65535 + * 1 : Tx/Rx antenna 1 + * 2 : Tx/Rx antenna 2 + * 0xFFFF: Tx/Rx antenna diversity + * \param[in] evaluate_time + * SAD evaluate time interval, default value is 6s(0x1770). + * \param[in] evaluate_mode + * 0: PCB Ant + Ext Ant0 + * 1: Ext Ant0 + Ext Ant1 + * 2: PCB Ant + Ext Ant1 + * 0xFF: Default divisity mode. + * + * \return WM_SUCCESS if successful. + * \return WLAN_ERROR_STATE if unsuccessful. + * + */ +int wlan_set_antcfg(uint32_t ant, uint16_t evaluate_time, uint8_t evaluate_mode); + +/** This API can be used to get the mode of Tx/Rx antenna. + * If SAD is enabled, this API can also used to get SAD antenna + * evaluate time interval(antenna mode must be antenna diversity + * when set SAD evaluate time interval). + * + * \param[out] ant pointer to antenna variable. + * \param[out] evaluate_time pointer to evaluate_time variable for SAD. + * \param[out] current_mode pointer to evaluate_mode. + * \param[out] current_antenna pointer to current antenna. + * + * \return WM_SUCCESS if successful. + * \return WLAN_ERROR_STATE if unsuccessful. + */ +int wlan_get_antcfg(uint32_t *ant, uint16_t *evaluate_time, uint8_t *evaluate_mode, uint16_t *current_antenna); +#endif /*RW610*/ +#endif + +/** Get the wifi firmware version extension string. + * + * \note This API does not allocate memory for pointer. + * It just returns pointer of WLCMGR internal static + * buffer. So no need to free the pointer by caller. + * + * \return wifi firmware version extension string pointer stored in + * WLCMGR + */ +char *wlan_get_firmware_version_ext(void); + +/** Use this API to print wlan driver and firmware extended version. + */ +void wlan_version_extended(void); + +/** + * Use this API to get the TSF from Wi-Fi firmware. + * + * \param[in] tsf_high Pointer to store TSF higher 32bits. + * \param[in] tsf_low Pointer to store TSF lower 32bits. + * + * \return WM_SUCCESS if operation is successful. + * \return -WM_FAIL if command fails. + * + */ +int wlan_get_tsf(uint32_t *tsf_high, uint32_t *tsf_low); + +/** Enable IEEEPS with Host Sleep Configuration + * + * When enabled, it opportunistically puts the wireless card into IEEEPS mode. + * Before putting the Wireless card in power + * save this also sets the hostsleep configuration on the card as + * specified. This makes the card generate a wakeup for the processor if + * any of the wakeup conditions are met. + * + * \param[in] wakeup_conditions conditions to wake the host. This should + * be a logical OR of the conditions in \ref wlan_wakeup_event_t. + * Typically devices would want to wake up on + * \ref WAKE_ON_ALL_BROADCAST, + * \ref WAKE_ON_UNICAST, + * \ref WAKE_ON_MAC_EVENT. + * \ref WAKE_ON_MULTICAST, + * \ref WAKE_ON_ARP_BROADCAST, + * \ref WAKE_ON_MGMT_FRAME + * + * \return WM_SUCCESS if the call was successful. + * \return -WM_FAIL otherwise. + * + */ +int wlan_ieeeps_on(unsigned int wakeup_conditions); + +/** Turn off IEEE Power Save mode. + * + * \note This call is asynchronous. The system will exit the power-save mode + * only when all requisite conditions are met. + * + * \return WM_SUCCESS if the call was successful. + * \return -WM_FAIL otherwise. + * + */ +int wlan_ieeeps_off(void); + +#if (CONFIG_WNM_PS) +/** Enable WNM with Host Sleep Configuration + * + * When enabled, it opportunistically puts the wireless card into IEEEPS mode. + * Before putting the Wireless card in power + * save this also sets the hostsleep configuration on the card as + * specified. This makes the card generate a wakeup for the processor if + * any of the wakeup conditions are met. + * + * \param[in] wakeup_conditions conditions to wake the host. This should + * be a logical OR of the conditions in \ref wlan_wakeup_event_t. + * Typically devices would want to wake up on + * \ref WAKE_ON_ALL_BROADCAST, + * \ref WAKE_ON_UNICAST, + * \ref WAKE_ON_MAC_EVENT. + * \ref WAKE_ON_MULTICAST, + * \ref WAKE_ON_ARP_BROADCAST, + * \ref WAKE_ON_MGMT_FRAME + * \param[in] wnm_sleep_time wnm sleep interval.(number of dtims) + * + * \return WM_SUCCESS if the call was successful. + * \return -WM_FAIL otherwise. + * + */ +int wlan_wnmps_on(unsigned int wakeup_conditions, t_u16 wnm_sleep_time); + +/** Turn off WNM Power Save mode. + * + * \note This call is asynchronous. The system will exit the power-save mode + * only when all requisite conditions are met. + * + * \return WM_SUCCESS if the call was successful. + * \return -WM_FAIL otherwise. + * + */ +int wlan_wnmps_off(void); +#endif + +/** Turn on Deep Sleep Power Save mode. + * + * \note This call is asynchronous. The system will enter the power-save mode + * only when all requisite conditions are met. For example, wlan should be + * disconnected for this to work. + * + * \return WM_SUCCESS if the call was successful. + * \return -WM_FAIL otherwise. + * + */ +int wlan_deepsleepps_on(void); + +/** Turn off Deep Sleep Power Save mode. + * + * \note This call is asynchronous. The system will exit the power-save mode + * only when all requisite conditions are met. + * + * \return WM_SUCCESS if the call was successful. + * \return -WM_FAIL otherwise. + * + */ +int wlan_deepsleepps_off(void); + +/** + * Use this API to configure the TCP Keep alive parameters in Wi-Fi firmware. + * \ref wlan_tcp_keep_alive_t provides the parameters which are available + * for configuration. + * + * \note To reset current TCP Keep alive configuration just pass the reset with + * value 1, all other parameters are ignored in this case. + * + * \note Please note that this API must be called after successful connection + * and before putting Wi-Fi card in IEEE power save mode. + * + * \param[in] keep_alive A pointer to \ref wlan_tcp_keep_alive_t + * with following parameters. + * enable Enable keep alive + * reset Reset keep alive + * timeout Keep alive timeout + * interval Keep alive interval + * max_keep_alives Maximum keep alives + * dst_mac Destination MAC address + * dst_ip Destination IP + * dst_tcp_port Destination TCP port + * src_tcp_port Source TCP port + * seq_no Sequence number + * + * \return WM_SUCCESS if operation is successful. + * \return -WM_FAIL if command fails. + */ +int wlan_tcp_keep_alive(wlan_tcp_keep_alive_t *keep_alive); + +#if CONFIG_NAT_KEEP_ALIVE +/** + * Use this API to configure the NAT Keep alive parameters in Wi-Fi firmware. + * \ref wlan_nat_keep_alive_t provides the parameters which are available + * for configuration. + * + * \note Please note that this API must be called after successful connection + * and before putting Wi-Fi card in IEEE power save mode. + * + * \param[in] nat_keep_alive A pointer to \ref wlan_nat_keep_alive_t + * with following parameters. + * interval nat keep alive interval + * dst_mac Destination MAC address + * dst_ip Destination IP + * dst_port Destination port + * + * \return WM_SUCCESS if operation is successful. + * \return -WM_FAIL if command fails. + */ +int wlan_nat_keep_alive(wlan_nat_keep_alive_t *nat_keep_alive); +#endif + +/** + * Use this API to get the beacon period of associated BSS. + * + * \return beacon_period if operation is successful. + * \return 0 if command fails. + */ +uint16_t wlan_get_beacon_period(void); + +/** + * Use this API to get the dtim period of associated BSS. + * + * \return dtim_period if operation is successful. + * \return 0 if DTIM IE Is not found in AP's Probe response. + * \note This API should not be called from WLAN event handler + * registered by application during \ref wlan_start. + */ +uint8_t wlan_get_dtim_period(void); + +/** + * Use this API to get the current tx and rx rates along with + * bandwidth and guard interval information if rate is 11N. + * + * \param[in] ds_rate A pointer to structure which will have + * tx, rx rate information along with bandwidth and guard + * interval information. + * + * \param[in] bss_type 0: STA, 1: uAP + * + * \note If rate is greater than 11 then it is 11N rate and from 12 + * MCS0 rate starts. The bandwidth mapping is like value 0 is for + * 20MHz, 1 is 40MHz, 2 is for 80MHz. + * The guard interval value zero means Long otherwise Short. + * + * \return WM_SUCCESS if operation is successful. + * \return -WM_FAIL if command fails. + */ +int wlan_get_data_rate(wlan_ds_rate *ds_rate, mlan_bss_type bss_type); + +/** + * Use this API to get the set management frame protection parameters for sta. + * + * \param[out] mfpc: Management Frame Protection Capable (MFPC) + * 1: Management Frame Protection Capable + * 0: Management Frame Protection not Capable + * \param[out] mfpr: Management Frame Protection Required (MFPR) + * 1: Management Frame Protection Required + * 0: Management Frame Protection Optional + * + * \return WM_SUCCESS if operation is successful. + * \return -WM_FAIL if command fails. + */ +int wlan_get_pmfcfg(uint8_t *mfpc, uint8_t *mfpr); + +/** + * Use this API to get the set management frame protection parameters for Uap. + * + * \param[out] mfpc: Management Frame Protection Capable (MFPC) + * 1: Management Frame Protection Capable + * 0: Management Frame Protection not Capable + * \param[out] mfpr: Management Frame Protection Required (MFPR) + * 1: Management Frame Protection Required + * 0: Management Frame Protection Optional + * + * \return WM_SUCCESS if operation is successful. + * \return -WM_FAIL if command fails. + */ +int wlan_uap_get_pmfcfg(uint8_t *mfpc, uint8_t *mfpr); + +#if CONFIG_TBTT_OFFSET +/** + * Use this API to get the min, max and avg TBTT offset values + * from Wi-Fi firmware. + * + * \param[in] tbtt_offset A pointer to \ref wlan_tbtt_offset_t which will hold + * min, max and avg TBTT offset values. + * + * \return WM_SUCCESS if operation is successful. + * \return -WM_FAIL if command fails. + */ +int wlan_get_tbtt_offset_stats(wlan_tbtt_offset_t *tbtt_offset); +#endif /* CONFIG_TBTT_OFFSET */ + +/** + * Use this API to set packet filters in Wi-Fi firmware. + * + * \param[in] flt_cfg A pointer to structure which holds the + * the packet filters in same way as given below.\n + * + * MEF Configuration command\n + * mefcfg={\n + * Criteria: bit0-broadcast, bit1-unicast, bit3-multicast\n + * Criteria=2 Unicast frames are received during hostsleepmode\n + * NumEntries=1 Number of activated MEF entries\n + * mef_entry_0: example filters to match TCP destination port 80 send by 192.168.0.88 pkt or magic pkt.\n + * mef_entry_0={\n + * mode: bit0--hostsleep mode, bit1--non hostsleep mode\n + * mode=1 HostSleep mode\n + * action: 0--discard and not wake host, 1--discard and wake host 3--allow and wake host\n + * action=3 Allow and Wake host\n + * filter_num=3 Number of filter\n + * RPN only support "&&" and "||" operator,space can not be removed between operator.\n + * RPN=Filter_0 && Filter_1 || Filter_2\n + * Byte comparison filter's type is 0x41,Decimal comparison filter's type is 0x42,\n + * Bit comparison filter's type is 0x43\n + * Filter_0 is decimal comparison filter, it always with type=0x42\n + * Decimal filter always has type, pattern, offset, numbyte 4 field\n + * Filter_0 will match rx pkt with TCP destination port 80\n + * Filter_0={\n + * type=0x42 decimal comparison filter\n + * pattern=80 80 is the decimal constant to be compared\n + * offset=44 44 is the byte offset of the field in RX pkt to be compare\n + * numbyte=2 2 is the number of bytes of the field\n + * }\n + * Filter_1 is Byte comparison filter, it always with type=0x41\n + * Byte filter always has type, byte, repeat, offset 4 filed\n + * Filter_1 will match rx pkt send by IP address 192.168.0.88\n + * Filter_1={\n + * type=0x41 Byte comparison filter\n + * repeat=1 1 copies of 'c0:a8:00:58'\n + * byte=c0:a8:00:58 'c0:a8:00:58' is the byte sequence constant with each byte\n + * in hex format, with ':' as delimiter between two byte.\n + * offset=34 34 is the byte offset of the equal length field of rx'd pkt.\n + * }\n + * Filter_2 is Magic packet, it will looking for 16 contiguous copies of '00:50:43:20:01:02' from\n + * the rx pkt's offset 14\n + * Filter_2={\n + * type=0x41 Byte comparison filter\n + * repeat=16 16 copies of '00:50:43:20:01:02'\n + * byte=00:50:43:20:01:02 # '00:50:43:20:01:02' is the byte sequence constant\n + * offset=14 14 is the byte offset of the equal length field of rx'd pkt.\n + * }\n + * }\n + * }\n + * Above filters can be set by filling values in following way in \ref wlan_flt_cfg_t structure.\n + * wlan_flt_cfg_t flt_cfg;\n + * uint8_t byte_seq1[] = {0xc0, 0xa8, 0x00, 0x58};\n + * uint8_t byte_seq2[] = {0x00, 0x50, 0x43, 0x20, 0x01, 0x02};\n + *\n + * memset(&flt_cfg, 0, sizeof(wlan_flt_cfg_t));\n + *\n + * flt_cfg.criteria = 2;\n + * flt_cfg.nentries = 1;\n + *\n + * flt_cfg.mef_entry.mode = 1;\n + * flt_cfg.mef_entry.action = 3;\n + *\n + * flt_cfg.mef_entry.filter_num = 3;\n + *\n + * flt_cfg.mef_entry.filter_item[0].type = TYPE_DNUM_EQ;\n + * flt_cfg.mef_entry.filter_item[0].pattern = 80;\n + * flt_cfg.mef_entry.filter_item[0].offset = 44;\n + * flt_cfg.mef_entry.filter_item[0].num_bytes = 2;\n + *\n + * flt_cfg.mef_entry.filter_item[1].type = TYPE_BYTE_EQ;\n + * flt_cfg.mef_entry.filter_item[1].repeat = 1;\n + * flt_cfg.mef_entry.filter_item[1].offset = 34;\n + * flt_cfg.mef_entry.filter_item[1].num_byte_seq = 4;\n + * memcpy(flt_cfg.mef_entry.filter_item[1].byte_seq, byte_seq1, 4);\n + * flt_cfg.mef_entry.rpn[1] = RPN_TYPE_AND;\n + *\n + * flt_cfg.mef_entry.filter_item[2].type = TYPE_BYTE_EQ;\n + * flt_cfg.mef_entry.filter_item[2].repeat = 16;\n + * flt_cfg.mef_entry.filter_item[2].offset = 14;\n + * flt_cfg.mef_entry.filter_item[2].num_byte_seq = 6;\n + * memcpy(flt_cfg.mef_entry.filter_item[2].byte_seq, byte_seq2, 6);\n + * flt_cfg.mef_entry.rpn[2] = RPN_TYPE_OR;\n + * + * + * \return WM_SUCCESS if operation is successful. + * \return -WM_FAIL if command fails. + */ +int wlan_set_packet_filters(wlan_flt_cfg_t *flt_cfg); + +/** + * Use this API to enable ARP Offload in Wi-Fi firmware + * + * \return WM_SUCCESS if operation is successful. + * \return -WM_FAIL if command fails. + */ +int wlan_set_auto_arp(void); + +#if CONFIG_AUTO_PING +/** + * Use this API to enable Ping Offload in Wi-Fi firmware. + * + * \return WM_SUCCESS if operation is successful. + * \return -WM_FAIL if command fails. + */ +int wlan_set_auto_ping(); +#endif /* CONFIG_AUTO_PING */ + +/** + * Use this API to enable WOWLAN on magic pkt rx in Wi-Fi firmware + * + * \param[in] ptn_cfg A pointer to \ref wlan_wowlan_ptn_cfg_t containing Wake on WLAN pattern configuration + * + *\return WM_SUCCESS if operation is successful. + *\return -WM_FAIL if command fails + */ +int wlan_wowlan_cfg_ptn_match(wlan_wowlan_ptn_cfg_t *ptn_cfg); +/** + * Use this API to enable NS Offload in Wi-Fi firmware. + * + * \return WM_SUCCESS if operation is successful. + * \return -WM_FAIL if command fails. + */ +int wlan_set_ipv6_ns_offload(); + +#if CONFIG_HOST_SLEEP + +/** WLCMGR host sleep pre configuration */ +void wlan_hs_pre_cfg(void); + +/** WLCMGR host sleep post configuration */ +void wlan_hs_post_cfg(void); + +/** + * Use this API to configure host sleep params in Wi-Fi firmware. + * + * \param[in] wakeup_condition bit 0: WAKE_ON_ALL_BROADCAST + * bit 1: WAKE_ON_UNICAST + * bit 2: WAKE_ON_MAC_EVENT + * bit 3: WAKE_ON_MULTICAST + * bit 4: WAKE_ON_ARP_BROADCAST + * bit 6: WAKE_ON_MGMT_FRAME + * All bit 0 discard and not wakeup host + * + * \return WM_SUCCESS if operation is successful. + * \return -WM_FAIL if command fails. + */ +int wlan_send_host_sleep(uint32_t wakeup_condition); + +/** + * Use this API to get host sleep wakeup reason from Wi-Fi firmware. + * + * \param[out] hs_wakeup_reason wakeupReason: + * 0: unknown + * 1: Broadcast data matched + * 2: Multicast data matched + * 3: Unicast data matched + * 4: Maskable event matched + * 5. Non-maskable event matched + * 6: Non-maskable condition matched (EAPoL rekey) + * 7: Magic pattern matched + * Others: reserved. (set to 0) + * + * \return WM_SUCCESS if operation is successful. + * \return -WM_FAIL if command fails. + */ +int wlan_get_wakeup_reason(uint16_t *hs_wakeup_reason); +#endif + +/** + * Use this API to get the BSSID of associated BSS. + * + * \param[in] bssid A pointer to array to store the BSSID. + * + * \return WM_SUCCESS if operation is successful. + * \return -WM_FAIL if command fails. + */ +int wlan_get_current_bssid(uint8_t *bssid); + +/** + * Use this API to get the channel number of associated BSS. + * + * \return channel number if operation is successful. + * \return 0 if command fails. + */ +uint8_t wlan_get_current_channel(void); + +#if CONFIG_WIFI_GET_LOG +/** + * Use this API to get the various statistics of sta from Wi-Fi firmware like + * number of beacons received, missed and so on. + * + * \param[in] stats A pointer to structure where stats collected from Wi-Fi firmware + * will be copied. + * \note Please explore the elements of the \ref wlan_pkt_stats_t strucutre for + * more information on stats. + * + * \return WM_SUCCESS if operation is successful. + * \return -WM_FAIL if command fails. + */ +int wlan_get_log(wlan_pkt_stats_t *stats); + +/** + * Use this API to get the various statistics of uap from Wi-Fi firmware like + * number of beacons received, missed and so on. + * + * \param[in] stats A pointer to structure where stats collected from Wi-Fi firmware + * will be copied. + * \note Please explore the elements of the \ref wlan_pkt_stats_t strucutre for + * more information on stats. + * + * \return WM_SUCCESS if operation is successful. + * \return -WM_FAIL if command fails. + */ +int wlan_uap_get_log(wlan_pkt_stats_t *stats); +#endif + +/** Get station interface power save mode. + * + * \param[out] ps_mode A pointer to \ref wlan_ps_mode where station interface + * power save mode will be stored. + * + * \return WM_SUCCESS if successful. + * \return -WM_E_INVAL if \a ps_mode was NULL. + */ +int wlan_get_ps_mode(enum wlan_ps_mode *ps_mode); + +/** Send message to WLAN Connection Manager thread. + * + * \param[in] event An event from \ref wifi_event. + * \param[in] reason A reason code. + * \param[in] data A pointer to data buffer associated with event. + * + * \return WM_SUCCESS if successful. + * \return -WM_FAIL if failed. + */ +int wlan_wlcmgr_send_msg(enum wifi_event event, enum wifi_event_reason reason, void *data); + +/** Register WFA basic WLAN CLI commands + * + * This function registers basic WLAN CLI commands like showing + * version information, MAC address + * + * \note This function can only be called by the application after + * \ref wlan_init() called. + * + * \return WLAN_ERROR_NONE if the CLI commands were registered or + * \return WLAN_ERROR_ACTION if they were not registered (for example + * if this function was called while the CLI commands were already + * registered). + */ +int wlan_wfa_basic_cli_init(void); + +/** Unregister WFA basic WLAN CLI commands + * + * This function unregisters basic WLAN CLI commands like showing + * version information, MAC address + * + * \note This function can only be called by the application after + * \ref wlan_init() called. + * + * \return WLAN_ERROR_NONE if the CLI commands were unregistered or + * \return WLAN_ERROR_ACTION if they were not unregistered + */ +int wlan_wfa_basic_cli_deinit(void); + +/** Register basic WLAN CLI commands + * + * This function registers basic WLAN CLI commands like showing + * version information, MAC address + * + * \note This function can only be called by the application after + * \ref wlan_init() called. + * + * \note This function gets called by \ref wlan_cli_init(), hence + * only one function out of these two functions should be called in + * the application. + * + * \return WLAN_ERROR_NONE if the CLI commands were registered or + * \return WLAN_ERROR_ACTION if they were not registered (for example + * if this function was called while the CLI commands were already + * registered). + */ +int wlan_basic_cli_init(void); + +/** Unregister basic WLAN CLI commands + * + * This function unregisters basic WLAN CLI commands like showing + * version information, MAC address + * + * \note This function can only be called by the application after + * \ref wlan_init() called. + * + * \note This function gets called by \ref wlan_cli_init(), hence + * only one function out of these two functions should be called in + * the application. + * + * \return WLAN_ERROR_NONE if the CLI commands were unregistered or + * \return WLAN_ERROR_ACTION if they were not unregistered (for example + * if this function was called while the CLI commands were already + * registered). + */ +int wlan_basic_cli_deinit(void); + +/** Register WLAN CLI commands. + * + * Try to register the WLAN CLI commands with the CLI subsystem. This + * function is available for the application for use. + * + * \note This function can only be called by the application after \ref wlan_init() + * called. + * + * \note This function internally calls \ref wlan_basic_cli_init(), hence + * only one function out of these two functions should be called in + * the application. + * + * \return WM_SUCCESS if the CLI commands were registered or + * \return -WM_FAIL if they were not (for example if this function + * was called while the CLI commands were already registered). + */ +int wlan_cli_init(void); + +/** Unregister WLAN CLI commands. + * + * Try to unregister the WLAN CLI commands with the CLI subsystem. This + * function is available for the application for use. + * + * \note This function can only be called by the application after \ref wlan_init() + * called. + * + * \note This function internally calls \ref wlan_basic_cli_deinit(), hence + * only one function out of these two functions should be called in + * the application. + * + * \return WM_SUCCESS if the CLI commands were unregistered or + * \return -WM_FAIL if they were not (for example if this function + * was called while the CLI commands were already unregistered). + */ +int wlan_cli_deinit(void); + +/** Register WLAN enhanced CLI commands. + * + * Register the WLAN enhanced CLI commands like set or get tx-power, + * tx-datarate, tx-modulation etc with the CLI subsystem. + * + * \note This function can only be called by the application after \ref wlan_init() + * called. + * + * \return WM_SUCCESS if the CLI commands were registered or + * \return -WM_FAIL if they were not (for example if this function + * was called while the CLI commands were already registered). + */ +int wlan_enhanced_cli_init(void); + +/** Unregister WLAN enhanced CLI commands. + * + * Unregister the WLAN enhanced CLI commands like set or get tx-power, + * tx-datarate, tx-modulation etc with the CLI subsystem. + * + * \note This function can only be called by the application after \ref wlan_init() + * called. + * + * \return WM_SUCCESS if the CLI commands were unregistered or + * \return -WM_FAIL if they were not unregistered. + */ + +int wlan_enhanced_cli_deinit(void); + +#if CONFIG_RF_TEST_MODE +/** Register WLAN Test Mode CLI commands. + * + * Register the WLAN Test Mode CLI commands like set or get channel, + * band, bandwidth, PER and more with the CLI subsystem. + * + * \note This function can only be called by the application after \ref wlan_init() + * called. + * + * \return WM_SUCCESS if the CLI commands were registered or + * \return -WM_FAIL if they were not (for example if this function + * was called while the CLI commands were already registered). + */ +int wlan_test_mode_cli_init(void); + +/** Unregister WLAN Test Mode CLI commands. + * + * Unregister the WLAN Test Mode CLI commands like set or get channel, + * band, bandwidth, PER and more with the CLI subsystem. + * + * \note This function can only be called by the application after \ref wlan_init() + * called. + * + * \return WM_SUCCESS if the CLI commands were unregistered or + * \return -WM_FAIL if they were not unregistered + */ +int wlan_test_mode_cli_deinit(void); +#endif + +/** + * Get maximum number of WLAN firmware supported stations that + * will be allowed to connect to the uAP. + * + * \return Maximum number of WLAN firmware supported stations. + * + * \note Get operation is allowed in any uAP state. + */ +unsigned int wlan_get_uap_supported_max_clients(void); + +/** + * Get current maximum number of stations that + * will be allowed to connect to the uAP. + * + * \param[out] max_sta_num A pointer to variable where current maximum + * number of stations of uAP interface will be stored. + * + * \return WM_SUCCESS if successful. + * \return -WM_FAIL if unsuccessful. + * + * \note Get operation is allowed in any uAP state. + */ +int wlan_get_uap_max_clients(unsigned int *max_sta_num); + +/** + * Set maximum number of stations that will be allowed to connect to the uAP. + * + * \param[in] max_sta_num Number of maximum stations for uAP. + * + * \return WM_SUCCESS if successful. + * \return -WM_FAIL if unsuccessful. + * + * \note Set operation in not allowed in \ref WLAN_UAP_STARTED state. + */ +int wlan_set_uap_max_clients(unsigned int max_sta_num); + +/** + * This API can be used to configure some of parameters in HTCapInfo IE + * (such as Short GI, Channel BW, and Green field support) + * + * \param[in] htcapinfo This is a bitmap and should be used as following\n + * Bit 29: Green field enable/disable\n + * Bit 26: Rx STBC Support enable/disable. (As we support\n + * single spatial stream only 1 bit is used for Rx STBC)\n + * Bit 25: Tx STBC support enable/disable.\n + * Bit 24: Short GI in 40 Mhz enable/disable\n + * Bit 23: Short GI in 20 Mhz enable/disable\n + * Bit 22: Rx LDPC enable/disable\n + * Bit 17: 20/40 Mhz enable disable.\n + * Bit 8: Enable/disable 40Mhz Intolarent bit in ht capinfo.\n + * 0 will reset this bit and 1 will set this bit in\n + * htcapinfo attached in assoc request.\n + * All others are reserved and should be set to 0.\n + * + * \return WM_SUCCESS if successful. + * \return -WM_FAIL if unsuccessful. + * + */ +int wlan_set_htcapinfo(unsigned int htcapinfo); + +/** + * This API can be used to configure various 11n specific configuration + * for transmit (such as Short GI, Channel BW and Green field support) + * + * \param[in] httxcfg This is a bitmap and should be used as following\n + * Bit 15-10: Reserved set to 0\n + * Bit 9-8: Rx STBC set to 0x01\n + * BIT9 BIT8 Description\n + * 0 0 No spatial streams\n + * 0 1 One spatial streams supported\n + * 1 0 Reserved\n + * 1 1 Reserved\n + * Bit 7: STBC enable/disable\n + * Bit 6: Short GI in 40 Mhz enable/disable\n + * Bit 5: Short GI in 20 Mhz enable/disable\n + * Bit 4: Green field enable/disable\n + * Bit 3-2: Reserved set to 1\n + * Bit 1: 20/40 Mhz enable disable.\n + * Bit 0: LDPC enable/disable\n + * + * When Bit 1 is set then firmware could transmit in 20Mhz or 40Mhz based\n + * on rate adaptation. When this bit is reset then firmware will only\n + * transmit in 20Mhz.\n + * + * + * \return WM_SUCCESS if successful. + * \return -WM_FAIL if unsuccessful. + * + */ +int wlan_set_httxcfg(unsigned short httxcfg); + +/** + * This API can be used to set the transmit data rate. + * + * \note The data rate can be set only after association. + * + * \param[in] ds_rate struct contains following fields + * sub_command It should be WIFI_DS_RATE_CFG + * and rate_cfg should have following parameters.\n + * rate_format - This parameter specifies + * the data rate format used + * in this command\n + * 0: LG\n + * 1: HT\n + * 2: VHT\n + * 0xff: Auto\n + * + * index - This parameter specifies the rate or MCS index\n + * If rate_format is 0 (LG),\n + * 0 1 Mbps\n + * 1 2 Mbps\n + * 2 5.5 Mbps\n + * 3 11 Mbps\n + * 4 6 Mbps\n + * 5 9 Mbps\n + * 6 12 Mbps\n + * 7 18 Mbps\n + * 8 24 Mbps\n + * 9 36 Mbps\n + * 10 48 Mbps\n + * 11 54 Mbps\n + * If rate_format is 1 (HT),\n + * 0 MCS0\n + * 1 MCS1\n + * 2 MCS2\n + * 3 MCS3\n + * 4 MCS4\n + * 5 MCS5\n + * 6 MCS6\n + * 7 MCS7\n + * If STREAM_2X2\n + * 8 MCS8\n + * 9 MCS9\n + * 10 MCS10\n + * 11 MCS11\n + * 12 MCS12\n + * 13 MCS13\n + * 14 MCS14\n + * 15 MCS15\n + * If rate_format is 2 (VHT),\n + * 0 MCS0\n + * 1 MCS1\n + * 2 MCS2\n + * 3 MCS3\n + * 4 MCS4\n + * 5 MCS5\n + * 6 MCS6\n + * 7 MCS7\n + * 8 MCS8\n + * 9 MCS9\n + * nss - This parameter specifies the NSS.\n + * It is valid only for VHT\n + * If rate_format is 2 (VHT),\n + * 1 NSS1\n + * 2 NSS2\n + * + * \param[in] bss_type 0: STA, 1: uAP + * + * \return WM_SUCCESS if successful. + * \return -WM_FAIL if unsuccessful. + * + */ +int wlan_set_txratecfg(wlan_ds_rate ds_rate, mlan_bss_type bss_type); + +/** + * This API can be used to get the transmit data rate. + * + * \param[in] ds_rate A pointer to \ref wlan_ds_rate where Tx Rate + * configuration will be stored. + * \param[in] bss_type 0: STA, 1: uAP + * + * \return WM_SUCCESS if successful. + * \return -WM_FAIL if unsuccessful. + * + */ +int wlan_get_txratecfg(wlan_ds_rate *ds_rate, mlan_bss_type bss_type); + +/** + * Get Station interface transmit power + * + * \param[out] power_level Transmit power level. + * \return WM_SUCCESS if successful. + * \return -WM_FAIL if unsuccessful. + * + */ +int wlan_get_sta_tx_power(t_u32 *power_level); + +/** + * Set Station interface transmit power + * + * \param[in] power_level Transmit power level. + * + * \return WM_SUCCESS if successful. + * \return -WM_FAIL if unsuccessful. + * + */ +int wlan_set_sta_tx_power(t_u32 power_level); + +/** + * Set World Wide Safe Mode Tx Power Limits + * + * \return WM_SUCCESS if successful. + * \return -WM_FAIL if unsuccessful. + * + */ +int wlan_set_wwsm_txpwrlimit(void); + +#ifndef RW610 +/** + * Get wlan region code from tx power config + * + * \return wlan region code in string format. + * + */ +const char *wlan_get_wlan_region_code(void); +#endif + +/** + * Get Management IE for given BSS type (interface) and index. + * + * \param[in] bss_type 0: STA, 1: uAP + * \param[in] index IE index. + * + * \param[out] buf Buffer to store requested IE data. + * \param[out] buf_len To store length of IE data. + * + * \return WM_SUCCESS if successful. + * \return -WM_FAIL if unsuccessful. + * + */ +int wlan_get_mgmt_ie(enum wlan_bss_type bss_type, IEEEtypes_ElementId_t index, void *buf, unsigned int *buf_len); + +/** + * Set Management IE for given BSS type (interface) and index. + * + * \param[in] bss_type 0: STA, 1: uAP + * \param[in] id Type/ID of Management IE. + * \param[in] buf Buffer containing IE data. + * \param[in] buf_len Length of IE data. + * + * \return IE index if successful. + * \return -WM_FAIL if unsuccessful. + * + */ +int wlan_set_mgmt_ie(enum wlan_bss_type bss_type, IEEEtypes_ElementId_t id, void *buf, unsigned int buf_len); + +#ifdef SD8801 +/** + * Get External Radio Coex statistics. + * + * \param[out] ext_coex_stats A pointer to structure to get coex statistics. + * + * \return WM_SUCCESS if successful. + * \return -WM_FAIL if unsuccessful. + * + */ +int wlan_get_ext_coex_stats(wlan_ext_coex_stats_t *ext_coex_stats); + +/** + * Set External Radio Coex configuration. + * + * \param[in] ext_coex_config to apply coex configuration. + * + * \return IE index if successful. + * \return -WM_FAIL if unsuccessful. + * + */ +int wlan_set_ext_coex_config(const wlan_ext_coex_config_t ext_coex_config); +#endif + +/** + * Clear Management IE for given BSS type (interface) and index. + * + * \param[in] bss_type 0: STA, 1: uAP + * \param[in] index IE index. + * \param[in] mgmt_bitmap_index mgmt bitmap index. + * + * \return WM_SUCCESS if successful. + * \return -WM_FAIL if unsuccessful. + * + */ +int wlan_clear_mgmt_ie(enum wlan_bss_type bss_type, IEEEtypes_ElementId_t index, int mgmt_bitmap_index); + +/** + * Get current status of 11d support. + * + * \return true if 11d support is enabled by application. + * \return false if not enabled. + * + */ +bool wlan_get_11d_enable_status(void); + +/** + * Get current RSSI and Signal to Noise ratio from WLAN firmware. + * + * \param[in] rssi A pointer to variable to store current RSSI + * \param[in] snr A pointer to variable to store current SNR. + * + * \return WM_SUCCESS if successful. + */ +int wlan_get_current_signal_strength(short *rssi, int *snr); + +/** + * Get average RSSI and Signal to Noise ratio from WLAN firmware. + * + * \param[in] rssi A pointer to variable to store current RSSI + * \param[in] snr A pointer to variable to store current SNR. + * + * \return WM_SUCCESS if successful. + */ +int wlan_get_average_signal_strength(short *rssi, int *snr); + +/** + * This API is is used to set/cancel the remain on channel configuration. + * + * \note When status is false, channel and duration parameters are + * ignored. + * + * \param[in] bss_type The interface to set channel bss_type 0: STA, 1: uAP + * \param[in] status false : Cancel the remain on channel configuration + * true : Set the remain on channel configuration + * \param[in] channel The channel to configure + * \param[in] duration The duration for which to + * remain on channel in milliseconds. + * + * \return WM_SUCCESS on success or error code. + * + */ +int wlan_remain_on_channel(const enum wlan_bss_type bss_type, + const bool status, + const uint8_t channel, + const uint32_t duration); + +/** + * Get User Data from OTP Memory + * + * \param[in] buf Pointer to buffer where data will be stored + * \param[in] len Number of bytes to read + * + * \return WM_SUCCESS if user data read operation is successful. + * \return -WM_E_INVAL if buf is not valid or of insufficient size. + * \return -WM_FAIL if user data field is not present or command fails. + */ +int wlan_get_otp_user_data(uint8_t *buf, uint16_t len); + +/** + * Get calibration data from WLAN firmware + * + * \param[out] cal_data Pointer to calibration data structure where + * calibration data and it's length will be stored. + * + * \return WM_SUCCESS if cal data read operation is successful. + * \return -WM_E_INVAL if cal_data is not valid. + * \return -WM_FAIL if command fails. + * + * \note The user of this API should free the allocated buffer for + * calibration data. + */ +int wlan_get_cal_data(wlan_cal_data_t *cal_data); + +#if CONFIG_COMPRESS_TX_PWTBL +/** + * Set the compressed Tx PWR Limit configuration. + * + * \param[in] data A pointer to TX PWR Limit configuration. + * \param[in] len Length of TX PWR Limit configuration. + * + * \return WM_SUCCESS on success, error otherwise. + * + */ +int wlan_set_region_power_cfg(const t_u8 *data, t_u16 len); +#endif + +/** + * Set the Channel List and TRPC channel configuration. + * + * \param[in] chanlist A poiner to \ref wlan_chanlist_t Channel List configuration. + * \param[in] txpwrlimit A pointer to \ref wlan_txpwrlimit_t TX PWR Limit configuration. + * + * \return WM_SUCCESS on success, error otherwise. + * + */ +int wlan_set_chanlist_and_txpwrlimit(wlan_chanlist_t *chanlist, wlan_txpwrlimit_t *txpwrlimit); + +/** + * Set the Channel List configuration. + * + * \param[in] chanlist A pointer to \ref wlan_chanlist_t Channel List configuration. + * + * \return WM_SUCCESS on success, error otherwise. + * + * \note If Region Enforcement Flag is enabled in the OTP then this API will + * not take effect. + */ +int wlan_set_chanlist(wlan_chanlist_t *chanlist); + +/** + * Get the Channel List configuration. + * + * \param[out] chanlist A pointer to \ref wlan_chanlist_t Channel List configuration. + * + * \return WM_SUCCESS on success, error otherwise. + * + * \note The \ref wlan_chanlist_t struct allocates memory for a maximum of 54 + * channels. + * + */ +int wlan_get_chanlist(wlan_chanlist_t *chanlist); + +/** + * Set the TRPC channel configuration. + * + * \param[in] txpwrlimit A pointer to \ref wlan_txpwrlimit_t TX PWR Limit configuration. + * + * \return WM_SUCCESS on success, error otherwise. + * + */ +int wlan_set_txpwrlimit(wlan_txpwrlimit_t *txpwrlimit); + +/** + * Get the TRPC channel configuration. + * + * \param[in] subband Where subband is:\n + * 0x00 2G subband (2.4G: channel 1-14)\n + * 0x10 5G subband0 (5G: channel 36,40,44,48,\n + * 52,56,60,64)\n + * 0x11 5G subband1 (5G: channel 100,104,108,112,\n + * 116,120,124,128,\n + * 132,136,140,144)\n + * 0x12 5G subband2 (5G: channel 149,153,157,161,165,172)\n + * 0x13 5G subband3 (5G: channel 183,184,185,187,188,\n + * 189, 192,196;\n + * 5G: channel 7,8,11,12,16,34)\n + * + * \param[out] txpwrlimit A pointer to \ref wlan_txpwrlimit_t TX PWR + * Limit configuration structure where Wi-Fi firmware + * configuration will get copied. + * + * \return WM_SUCCESS on success, error otherwise. + * + * \note application can use print_txpwrlimit API to print the + * content of the txpwrlimit structure. + */ +int wlan_get_txpwrlimit(wifi_SubBand_t subband, wifi_txpwrlimit_t *txpwrlimit); + +#if CONFIG_AUTO_RECONNECT +/** + * Enable Auto Reconnect feature in WLAN firmware. + * + * \param[in] auto_reconnect_config Auto Reconnect configuration + * structure holding following parameters: + * 1. reconnect counter(0x1-0xff) - The number of times the WLAN + * firmware retries connection attempt with AP. + * The value 0xff means retry forever. + * (default 0xff). + * 2. reconnect interval(0x0-0xff) - Time gap in seconds between + * each connection attempt (default 10). + * 3. flags - Bit 0: + * Set to 1: Firmware should report link-loss to host + * if AP rejects authentication/association + * while reconnecting. + * Set to 0: Default behaviour: Firmware does not report + * link-loss to host on AP rejection and + * continues internally. + * Bit 1-15: Reserved. + * + * \return WM_SUCCESS if operation is successful. + * \return -WM_FAIL if command fails. + * + */ +int wlan_auto_reconnect_enable(wlan_auto_reconnect_config_t auto_reconnect_config); + +/** + * Disable Auto Reconnect feature in WLAN firmware. + * + * \return WM_SUCCESS if operation is successful. + * \return -WM_FAIL if command fails. + * + */ +int wlan_auto_reconnect_disable(void); + +/** + * Get Auto Reconnect configuration from WLAN firmware. + * + * \param[out] auto_reconnect_config Auto Reconnect configuration + * structure where response from WLAN firmware will + * get stored. + * + * \return WM_SUCCESS if operation is successful. + * \return -WM_E_INVAL if auto_reconnect_config is not valid. + * \return -WM_FAIL if command fails. + * + */ +int wlan_get_auto_reconnect_config(wlan_auto_reconnect_config_t *auto_reconnect_config); +#endif +/** + * Set Reassociation Control in WLAN Connection Manager + * \note Reassociation is enabled by default in the WLAN Connection Manager. + * + * \param[in] reassoc_control Reassociation enable/disable + * + */ +void wlan_set_reassoc_control(bool reassoc_control); + +/** API to set the beacon period of uAP + * + *\param[in] beacon_period Beacon period in TU (1 TU = 1024 micro seconds) + * + *\note Please call this API before calling uAP start API. + * + */ +void wlan_uap_set_beacon_period(const uint16_t beacon_period); + +/** API to set the bandwidth of uAP + * + *\param[in] bandwidth Wi-Fi AP Bandwidth (20MHz/40MHz) + 1: 20 MHz 2: 40 MHz 3: 80 MHz + * + *\return WM_SUCCESS if successful otherwise failure. + *\return -WM_FAIL if command fails. + * + *\note Please call this API before calling uAP start API. + *\note Default bandwidth setting is 40 MHz. + * + */ +int wlan_uap_set_bandwidth(const uint8_t bandwidth); + +/** API to Get the bandwidth of uAP + * + *\param[out] bandwidth Wi-Fi AP Bandwidth (20MHz/40MHz) + 1: 20 MHz 2: 40 MHz 3: 80 MHz + * + *\return WM_SUCCESS if successful otherwise failure. + *\return -WM_FAIL if command fails. + * + *\note Please call this API before calling uAP start API. + * + */ +int wlan_uap_get_bandwidth(uint8_t *bandwidth); + +/** API to control SSID broadcast capability of uAP + * + * This API enables/disables the SSID broadcast feature + * (also known as the hidden SSID feature). When broadcast SSID + * is enabled, the AP responds to probe requests from client stations + * that contain null SSID. When broadcast SSID is disabled, the AP + * does not respond to probe requests that contain null SSID and + * generates beacons that contain null SSID. + * + *\param[in] hidden_ssid Hidden SSID control + * hidden_ssid=0: broadcast SSID in beacons. + * hidden_ssid=1: send empty SSID (length=0) in beacon. + * hidden_ssid=2: clear SSID (ACSII 0), but keep the original length + * + *\return WM_SUCCESS if successful otherwise failure. + *\return -WM_FAIL if command fails. + * + *\note Please call this API before calling uAP start API. + * + */ +int wlan_uap_set_hidden_ssid(const t_u8 hidden_ssid); + +/** API to control the deauth during uAP channel switch + * + *\param[in] enable 0 -- Wi-Fi firmware will use default behaviour. + * 1 -- Wi-Fi firmware will not send deauth packet + * when uap move to another channel. + * + *\note Please call this API before calling uAP start API. + * + */ +void wlan_uap_ctrl_deauth(const bool enable); + +/** API to enable channel switch announcement functionality on uAP. + * + *\note Please call this API before calling uAP start API. Also + * note that 11N should be enabled on uAP. The channel switch announcement IE + * is transmitted in 7 beacons before the channel switch, during a station + * connection attempt on a different channel with Ex-AP. + * + */ +void wlan_uap_set_ecsa(void); + +/** API to set the HT Capability Information of uAP + * + *\param[in] ht_cap_info - This is a bitmap and should be used as following\n + * Bit 15: L Sig TxOP protection - reserved, set to 0 \n + * Bit 14: 40 MHz intolerant - reserved, set to 0 \n + * Bit 13: PSMP - reserved, set to 0 \n + * Bit 12: DSSS Cck40MHz mode\n + * Bit 11: Maximal AMSDU size - reserved, set to 0 \n + * Bit 10: Delayed BA - reserved, set to 0 \n + * Bits 9:8: Rx STBC - reserved, set to 0 \n + * Bit 7: Tx STBC - reserved, set to 0 \n + * Bit 6: Short GI 40 MHz\n + * Bit 5: Short GI 20 MHz\n + * Bit 4: GF preamble\n + * Bits 3:2: MIMO power save - reserved, set to 0 \n + * Bit 1: SuppChanWidth - set to 0 for 2.4 GHz band \n + * Bit 0: LDPC coding - reserved, set to 0 \n + * + *\note Please call this API before calling uAP start API. + * + */ +void wlan_uap_set_htcapinfo(const uint16_t ht_cap_info); + +/** + * This API can be used to configure various 11n specific configuration + * for transmit (such as Short GI, Channel BW and Green field support) + * for uAP interface. + * + * \param[in] httxcfg This is a bitmap and should be used as following\n + * Bit 15-8: Reserved set to 0\n + * Bit 7: STBC enable/disable\n + * Bit 6: Short GI in 40 Mhz enable/disable\n + * Bit 5: Short GI in 20 Mhz enable/disable\n + * Bit 4: Green field enable/disable\n + * Bit 3-2: Reserved set to 1\n + * Bit 1: 20/40 Mhz enable disable.\n + * Bit 0: LDPC enable/disable\n + * + * When Bit 1 is set then firmware could transmit in 20Mhz or 40Mhz based\n + * on rate adaptation. When this bit is reset then firmware will only\n + * transmit in 20Mhz.\n + * + *\note Please call this API before calling uAP start API. + * + */ +void wlan_uap_set_httxcfg(unsigned short httxcfg); + +/** + * This API can be used to enable AMPDU support on the go + * when station is a transmitter. + * + * \note By default the station AMPDU TX support is on if + * configuration option is enabled in defconfig. + */ +void wlan_sta_ampdu_tx_enable(void); + +/** + * This API can be used to disable AMPDU support on the go + * when station is a transmitter. + * + *\note By default the station AMPDU RX support is on if + * configuration option is enabled in defconfig. + * + */ +void wlan_sta_ampdu_tx_disable(void); + +/** + * This API can be used to enable AMPDU support on the go + * when station is a receiver. + */ +void wlan_sta_ampdu_rx_enable(void); + +/** + * This API can be used to disable AMPDU support on the go + * when station is a receiver. + */ +void wlan_sta_ampdu_rx_disable(void); + +/** + * This API can be used to enable AMPDU support on the go + * when uap is a transmitter. + * + * \note By default the uap AMPDU TX support is on if + * configuration option is enabled in defconfig. + */ +void wlan_uap_ampdu_tx_enable(void); + +/** + * This API can be used to disable AMPDU support on the go + * when uap is a transmitter. + * + *\note By default the uap AMPDU RX support is on if + * configuration option is enabled in defconfig. + * + */ +void wlan_uap_ampdu_tx_disable(void); + +/** + * This API can be used to enable AMPDU support on the go + * when uap is a receiver. + */ +void wlan_uap_ampdu_rx_enable(void); + +/** + * This API can be used to disable AMPDU support on the go + * when uap is a receiver. + */ +void wlan_uap_ampdu_rx_disable(void); + +#if CONFIG_WIFI_AMPDU_CTRL +/** + * This API can be used to set tid of AMPDU support on the go + * when sta is a transmitter. + *\param[in] tid tid value. + */ +void wlan_sta_ampdu_tx_enable_per_tid(t_u8 tid); + +/** + * This API can be used to set tid of AMPDU support on the go + * when sta is a receiver. + *\param[in] tid tid value. + */ +void wlan_sta_ampdu_rx_enable_per_tid(t_u8 tid); + +/** + * This API can be used to set tid of AMPDU support on the go + * when uap is a transmitter. + *\param[in] tid tid value. + */ +void wlan_uap_ampdu_tx_enable_per_tid(t_u8 tid); + +/** + * This API can be used to set tid of AMPDU support on the go + * when uap is a receiver. + *\param[in] tid tid value. + */ +void wlan_uap_ampdu_rx_enable_per_tid(t_u8 tid); +#endif + +/** + * Set number of channels and channel number used during automatic + * channel selection of uAP. + * + *\param[in] scan_chan_list A structure holding the number of channels and + * channel numbers. + * + *\note Please call this API before uAP start API in order to set the user + * defined channels, otherwise it will have no effect. There is no need + * to call this API every time before uAP start, if once set same channel + * configuration will get used in all upcoming uAP start call. If user + * wish to change the channels at run time then it make sense to call + * this API before every uAP start API. + */ +void wlan_uap_set_scan_chan_list(wifi_scan_chan_list_t scan_chan_list); + +#if CONFIG_WPA2_ENTP + +/** + * Use this API if application want to allow station + * connection to WPA2 Enterprise ap profiles only. + * + * If called the in scan result only the WPA2 Enterprise AP + * will be listed and station network profile only with WPA2 + * Enterprise security will be allowed to add to network profile + * list. + */ +void wlan_enable_wpa2_enterprise_ap_only(); +#endif + +#if CONFIG_WIFI_RTS_THRESHOLD +/** + * Set the rts threshold of sta in WLAN firmware. + * + * \param[in] rts the value of rts threshold configuration. + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_set_rts(int rts); + +/** + * Set the rts threshold of uap in WLAN firmware. + * + * \param[in] rts the value of rts threshold configuration. + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_set_uap_rts(int rts); +#endif + +#if CONFIG_WIFI_FRAG_THRESHOLD +/** + * Set the fragment threshold of sta in WLAN firmware. + * + * \param[in] frag the value of fragment threshold configuration. + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_set_frag(int frag); + +/** + * Set the fragment threshold of uap in WLAN firmware. + * + * \param[in] frag the value of fragment threshold configuration. + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_set_uap_frag(int frag); +#endif + +#if CONFIG_11K_OFFLOAD +/** + * enable/disable 11k feature in WLAN firmware. + * + * \param[in] enable_11k the value of 11k configuration. + * + */ +int wlan_11k_cfg(int enable_11k); + +/** + * send 11k neighbor request in WLAN firmware. + * + * \return WM_SUCCESS if successful otherwise failure. + * + */ +int wlan_11k_neighbor_req(void); +#endif + +#if CONFIG_UAP_STA_MAC_ADDR_FILTER +/** + * Set the sta mac filter in Wi-Fi firmware. + * + * \param[in] filter_mode channel filter mode (disable/white/black list) + * \param[in] mac_count the count of mac list + * \param[in] mac_addr the pointer to mac address list + * + * \return WM_SUCCESS if successful otherwise failure. + * + */ +int wlan_set_sta_mac_filter(int filter_mode, int mac_count, unsigned char *mac_addr); +#endif + +static inline void print_mac(const char *mac) +{ + (void)PRINTF("%02X:%02X:%02X:%02X:%02X:%02X ", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); +} + +#if CONFIG_RF_TEST_MODE + +/** + * Set the RF Test Mode on in Wi-Fi firmware. + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_set_rf_test_mode(void); + +/** + * UnSet the RF Test Mode on in Wi-Fi firmware. + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_unset_rf_test_mode(void); + +/** + * Set the RF Channel in Wi-Fi firmware. + * + * \note Please call \ref wlan_set_rf_test_mode API before using this API. + * + * \param[in] channel The channel number to be set in Wi-Fi firmware. + * + * \return WM_SUCCESS if successful otherwise failure. + * + */ +int wlan_set_rf_channel(const uint8_t channel); + +/** + * Set the RF radio mode in Wi-Fi firmware. + * + * \note Please call \ref wlan_set_rf_test_mode API before using this API. + * + * \param[in] mode The radio mode number to be set in Wi-Fi firmware. + * + * \return WM_SUCCESS if successful otherwise failure. + * + */ +int wlan_set_rf_radio_mode(const uint8_t mode); + +/** + * Get the RF Channel from Wi-Fi firmware. + * + * \note Please call \ref wlan_set_rf_test_mode API before using this API. + * + * \param[out] channel A Pointer to a variable where channel number to get. + * + * \return WM_SUCCESS if successful otherwise failure. + * + */ +int wlan_get_rf_channel(uint8_t *channel); + +/** + * Get the RF Radio mode from Wi-Fi firmware. + * + * \note Please call \ref wlan_set_rf_test_mode API before using this API. + * + * \param[out] mode A Pointer to a variable where radio mode number to get. + * + * \return WM_SUCCESS if successful otherwise failure. + * + */ +int wlan_get_rf_radio_mode(uint8_t *mode); + +/** + * Set the RF Band in Wi-Fi firmware. + * + * \note Please call \ref wlan_set_rf_test_mode API before using this API. + * + * \param[in] band The bandwidth to be set in Wi-Fi firmware. + * + * \return WM_SUCCESS if successful otherwise failure. + * + */ +int wlan_set_rf_band(const uint8_t band); + +/** + * Get the RF Band from Wi-Fi firmware. + * + * \note Please call \ref wlan_set_rf_test_mode API before using this API. + * + * \param[out] band A Pointer to a variable where RF Band is to be stored. + * + * \return WM_SUCCESS if successful otherwise failure. + * + */ +int wlan_get_rf_band(uint8_t *band); + +/** + * Set the RF Bandwidth in Wi-Fi firmware. + * + * \note Please call \ref wlan_set_rf_test_mode API before using this API. + * + * \param[in] bandwidth The bandwidth to be set in Wi-Fi firmware. + * + * \return WM_SUCCESS if successful otherwise failure. + * + */ +int wlan_set_rf_bandwidth(const uint8_t bandwidth); + +/** + * Get the RF Bandwidth from Wi-Fi firmware. + * + * \note Please call \ref wlan_set_rf_test_mode API before using this API. + * + * \param[out] bandwidth A Pointer to a variable where bandwidth to get. + * + * \return WM_SUCCESS if successful otherwise failure. + * + */ +int wlan_get_rf_bandwidth(uint8_t *bandwidth); + +/** + * Get the RF PER from Wi-Fi firmware. + * + * \note Please call \ref wlan_set_rf_test_mode API before using this API. + * + * \param[out] rx_tot_pkt_count A Pointer to a variable where Rx Total packet count to get. + * \param[out] rx_mcast_bcast_count A Pointer to a variable where Rx Total Multicast/Broadcast packet count to get. + * \param[out] rx_pkt_fcs_error A Pointer to a variable where Rx Total packet count with FCS error to get. + * + * \return WM_SUCCESS if successful otherwise failure. + * + */ +int wlan_get_rf_per(uint32_t *rx_tot_pkt_count, uint32_t *rx_mcast_bcast_count, uint32_t *rx_pkt_fcs_error); + +/** + * Set the RF Tx continuous mode in Wi-Fi firmware. + * + * \note Please call \ref wlan_set_rf_test_mode API before using this API. + * + * \param[in] enable_tx Enable Tx. + * \param[in] cw_mode Set CW Mode. + * \param[in] payload_pattern Set Payload Pattern. + * \param[in] cs_mode Set CS Mode. + * \param[in] act_sub_ch Act Sub Ch + * \param[in] tx_rate Set Tx Rate. + * + * \return WM_SUCCESS if successful otherwise failure. + * + */ +int wlan_set_rf_tx_cont_mode(const uint32_t enable_tx, + const uint32_t cw_mode, + const uint32_t payload_pattern, + const uint32_t cs_mode, + const uint32_t act_sub_ch, + const uint32_t tx_rate); + +/** + * Set the RF HE TB TX in Wi-Fi firmware. + * + * \note Please call \ref wlan_set_rf_test_mode API before using this API. + * + * \param[in] enable Enable/Disable trigger response mode + * \param[in] qnum AXQ to be used for the trigger response frame + * \param[in] aid AID of the peer to which response is to be generated + * \param[in] axq_mu_timer MU timer for the AXQ on which response is sent + * \param[in] tx_power TxPwr to be configured for the response + * + * \return WM_SUCCESS if successful otherwise failure. + * + */ +int wlan_cfg_rf_he_tb_tx(uint16_t enable, uint16_t qnum, uint16_t aid, uint16_t axq_mu_timer, int16_t tx_power); + +/** + * Set the RF Trigger Frame Config in Wi-Fi firmware. + * + * \note Please call \ref wlan_set_rf_test_mode API before using this API. + * + * \param[in] Enable_tx Enable or Disable trigger frame transmission. + * \param[in] Standalone_hetb Enable or Disable Standalone HE TB support. + * \param[in] FRAME_CTRL_TYPE Frame control type. + * \param[in] FRAME_CTRL_SUBTYPE Frame control subtype. + * \param[in] FRAME_DURATION Max Duration time. + * \param[in] TriggerType Identifies the Trigger frame variant and its encoding. + * \param[in] UlLen Indicates the value of the L-SIG LENGTH field of the solicited HE TB PPDU. + * \param[in] MoreTF Indicates whether a subsequent Trigger frame is scheduled for transmission. + * \param[in] CSRequired Required to use ED to sense the medium and to consider the medium state and the NAV in + * determining whether to respond. \param[in] UlBw Indicates the bandwidth in the HE-SIG-A field of the HE TB PPDU. + * \param[in] LTFType Indicates the LTF type of the HE TB PPDU response. + * \param[in] LTFMode Indicates the LTF mode for an HE TB PPDU. + * \param[in] LTFSymbol Indicates the number of LTF symbols present in the HE TB PPDU. + * \param[in] UlSTBC Indicates the status of STBC encoding for the solicited HE TB PPDUs. + * \param[in] LdpcESS Indicates the status of the LDPC extra symbol segment. + * \param[in] ApTxPwr Indicates the AP’s combined transmit power at the transmit antenna connector of all the antennas + * used to transmit the triggering PPDU. \param[in] PreFecPadFct Indicates the pre-FEC padding factor. \param[in] + * PeDisambig Indicates PE disambiguity. \param[in] SpatialReuse Carries the values to be included in the Spatial Reuse + * fields in the HE-SIG-A field of the solicited HE TB PPDUs. \param[in] Doppler Indicate that a midamble is present in + * the HE TB PPDU. \param[in] HeSig2 Carries the value to be included in the Reserved field in the HE-SIG-A2 subfield of + * the solicited HE TB PPDUs. \param[in] AID12 If set to 0 allocates one or more contiguous RA-RUs for associated STAs. + * \param[in] RUAllocReg RUAllocReg. + * \param[in] RUAlloc Identifies the size and the location of the RU. + * \param[in] UlCodingType Indicates the code type of the solicited HE TB PPDU. + * \param[in] UlMCS Indicates the HE-MCS of the solicited HE TB PPDU. + * \param[in] UlDCM Indicates DCM of the solicited HE TB PPDU. + * \param[in] SSAlloc Indicates the spatial streams of the solicited HE TB PPDU. + * \param[in] UlTargetRSSI Indicates the expected receive signal power. + * \param[in] MPDU_MU_SF Used for calculating the value by which the minimum MPDU start spacing is multiplied. + * \param[in] TID_AL Indicates the MPDUs allowed in an A-MPDU carried in the HE TB PPDU and the maximum number of TIDs + * that can be aggregated by the STA in the A-MPDU. \param[in] AC_PL Reserved. \param[in] Pref_AC Indicates the lowest + * AC that is recommended for aggregation of MPDUs in the A-MPDU contained in the HE TB PPDU sent as a response to the + * Trigger frame. + * + * \return WM_SUCCESS if successful otherwise failure. + * + */ +int wlan_rf_trigger_frame_cfg(uint32_t Enable_tx, + uint32_t Standalone_hetb, + uint8_t FRAME_CTRL_TYPE, + uint8_t FRAME_CTRL_SUBTYPE, + uint16_t FRAME_DURATION, + uint64_t TriggerType, + uint64_t UlLen, + uint64_t MoreTF, + uint64_t CSRequired, + uint64_t UlBw, + uint64_t LTFType, + uint64_t LTFMode, + uint64_t LTFSymbol, + uint64_t UlSTBC, + uint64_t LdpcESS, + uint64_t ApTxPwr, + uint64_t PreFecPadFct, + uint64_t PeDisambig, + uint64_t SpatialReuse, + uint64_t Doppler, + uint64_t HeSig2, + uint32_t AID12, + uint32_t RUAllocReg, + uint32_t RUAlloc, + uint32_t UlCodingType, + uint32_t UlMCS, + uint32_t UlDCM, + uint32_t SSAlloc, + uint8_t UlTargetRSSI, + uint8_t MPDU_MU_SF, + uint8_t TID_AL, + uint8_t AC_PL, + uint8_t Pref_AC); + +/** + * Set the RF Tx Antenna in Wi-Fi firmware. + * + * \note Please call \ref wlan_set_rf_test_mode API before using this API. + * + * \param[in] antenna The Tx antenna to be set in Wi-Fi firmware. + * + * \return WM_SUCCESS if successful otherwise failure. + * + */ +int wlan_set_rf_tx_antenna(const uint8_t antenna); + +/** + * Get the RF Tx Antenna from Wi-Fi firmware. + * + * \note Please call \ref wlan_set_rf_test_mode API before using this API. + * + * \param[out] antenna A Pointer to a variable where Tx antenna is to be stored. + * + * \return WM_SUCCESS if successful otherwise failure. + * + */ +int wlan_get_rf_tx_antenna(uint8_t *antenna); + +/** + * Set the RF Rx Antenna in Wi-Fi firmware. + * + * \note Please call \ref wlan_set_rf_test_mode API before using this API. + * + * \param[in] antenna The Rx antenna to be set in Wi-Fi firmware. + * + * \return WM_SUCCESS if successful otherwise failure. + * + */ +int wlan_set_rf_rx_antenna(const uint8_t antenna); + +/** + * Get the RF Rx Antenna from Wi-Fi firmware. + * + * \note Please call \ref wlan_set_rf_test_mode API before using this API. + * + * \param[out] antenna A Pointer to a variable where Rx antenna is to be stored. + * + * \return WM_SUCCESS if successful otherwise failure. + * + */ +int wlan_get_rf_rx_antenna(uint8_t *antenna); + +/** + * Set the RF Tx Power in Wi-Fi firmware. + * + * \note Please call \ref wlan_set_rf_test_mode API before using this API. + * + * \param[in] power The RF Tx Power to be set in Wi-Fi firmware. + * For RW610, 20M bandwidth max linear output power is 20db per data sheet. + * \param[in] mod The modulation to be set in Wi-Fi firmware. + * \param[in] path_id The Path ID to be set in Wi-Fi firmware. + * + * \return WM_SUCCESS if successful otherwise failure. + * + */ +int wlan_set_rf_tx_power(const uint32_t power, const uint8_t mod, const uint8_t path_id); + +/** + * Set the RF Tx Frame in Wi-Fi firmware. + * + * \note Please call \ref wlan_set_rf_test_mode API before using this API. + * + * \param[in] enable Enable/Disable RF Tx Frame + * \param[in] data_rate Rate Index corresponding to legacy/HT/VHT rates + * \param[in] frame_pattern Payload Pattern + * \param[in] frame_length Payload Length + * \param[in] adjust_burst_sifs Enabl/Disable Adjust Burst SIFS3 Gap + * \param[in] burst_sifs_in_us Burst SIFS in us + * \param[in] short_preamble Enable/Disable Short Preamble + * \param[in] act_sub_ch Enable/Disable Active SubChannel + * \param[in] short_gi Short Guard Interval + * \param[in] adv_coding Enable/Disable Adv Coding + * \param[in] tx_bf Enable/Disable Beamforming + * \param[in] gf_mode Enable/Disable GreenField Mode + * \param[in] stbc Enable/Disable STBC + * \param[in] bssid BSSID + * + * \return WM_SUCCESS if successful otherwise failure. + * + */ +int wlan_set_rf_tx_frame(const uint32_t enable, + const uint32_t data_rate, + const uint32_t frame_pattern, + const uint32_t frame_length, + const uint16_t adjust_burst_sifs, + const uint32_t burst_sifs_in_us, + const uint32_t short_preamble, + const uint32_t act_sub_ch, + const uint32_t short_gi, + const uint32_t adv_coding, + const uint32_t tx_bf, + const uint32_t gf_mode, + const uint32_t stbc, + const uint8_t *bssid); + +/** + * Set the RF OTP MAC address in Wi-Fi firmware. + * + * \note Please call \ref wlan_set_rf_test_mode API before using this API. + * + * \param[in] mac A Pointer to a variable where OTP MAC address is to be stored. + * + * \return WM_SUCCESS if successful otherwise failure. + * + */ +int wlan_set_rf_otp_mac_addr(uint8_t *mac); + +/** + * Get the RF OTP MAC address from Wi-Fi firmware. + * + * \note Please call \ref wlan_set_rf_test_mode API before using this API. + * + * \param[out] mac A Pointer to a variable where OTP MAC address is to be stored. + * + * \return WM_SUCCESS if successful otherwise failure. + * + */ +int wlan_get_rf_otp_mac_addr(uint8_t *mac); + +/** + * Set the RF OTP cal data in Wi-Fi firmware. + * + * \note Please call \ref wlan_set_rf_test_mode API before using this API. + * + * \param[in] cal_data A Pointer to a variable where OTP cal data is to be stored. + * \param[in] cal_data_len The length of OTP cal data. + * + * \return WM_SUCCESS if successful otherwise failure. + * + */ +int wlan_set_rf_otp_cal_data(const uint8_t *cal_data, uint32_t cal_data_len); + +/** + * Get the RF OTP cal data from Wi-Fi firmware. + * + * \note Please call \ref wlan_set_rf_test_mode API before using this API. + * + * \param[out] cal_data A Pointer to a variable where OTP cal data is to be stored. + * + * \return WM_SUCCESS if successful otherwise failure. + * + */ +int wlan_get_rf_otp_cal_data(uint8_t *cal_data); +#endif +#if CONFIG_WIFI_FW_DEBUG +/** This function registers callbacks which are used to generate FW Dump on USB + * device. + * + * \param[in] wlan_usb_init_cb Callback to initialize usb device. + * \param[in] wlan_usb_mount_cb Callback to mount usb device. + * \param[in] wlan_usb_file_open_cb Callback to open file on usb device for FW dump. + * \param[in] wlan_usb_file_write_cb Callback to write FW dump data to opened file. + * \param[in] wlan_usb_file_close_cb Callback to close FW dump file. + * + */ +void wlan_register_fw_dump_cb(void (*wlan_usb_init_cb)(void), + int (*wlan_usb_mount_cb)(), + int (*wlan_usb_file_open_cb)(char *test_file_name), + int (*wlan_usb_file_write_cb)(uint8_t *data, size_t data_len), + int (*wlan_usb_file_close_cb)()); + +#endif + +#if CONFIG_WIFI_EU_CRYPTO +#define EU_CRYPTO_DATA_MAX_LENGTH 1300U +#define EU_CRYPTO_KEY_MAX_LENGTH 32U +#define EU_CRYPTO_KEYIV_MAX_LENGTH 32U +#define EU_CRYPTO_NONCE_MAX_LENGTH 14U +#define EU_CRYPTO_AAD_MAX_LENGTH 32U + +/** Set Crypto RC4 algorithm encrypt command param. + * + * \param[in] Key key + * \param[in] KeyLength The maximum key length is 32. + * \param[in] KeyIV KeyIV + * \param[in] KeyIVLength The maximum keyIV length is 32. + * \param[in] Data Data + * \param[in] DataLength The maximum Data length is 1300. + * + * \return WM_SUCCESS if successful. + * \return -WM_E_PERM if not supported. + * \return -WM_FAIL if failure. + * + * \note If the function returns WM_SUCCESS, the data in the memory pointed to by Data is overwritten by the encrypted + * data. The value of DataLength is updated to the encrypted data length. The length of the encrypted data is the same + * as the origin DataLength. + */ +int wlan_set_crypto_RC4_encrypt( + const t_u8 *Key, const t_u16 KeyLength, const t_u8 *KeyIV, const t_u16 KeyIVLength, t_u8 *Data, t_u16 *DataLength); + +/** Set Crypto RC4 algorithm decrypt command param. + * + * \param[in] Key key + * \param[in] KeyLength The maximum key length is 32. + * \param[in] KeyIV KeyIV + * \param[in] KeyIVLength The maximum keyIV length is 32. + * \param[in] Data Data + * \param[in] DataLength The maximum Data length is 1300. + * \return WM_SUCCESS if successful. + * \return -WM_E_PERM if not supported. + * \return -WM_FAIL if failure. + * + * \note If the function returns WM_SUCCESS, the data in the memory pointed to by Data is overwritten by the decrypted + * data. The value of DataLength is updated to the decrypted data length. The length of the decrypted data is the same + * as the origin DataLength. + */ +int wlan_set_crypto_RC4_decrypt( + const t_u8 *Key, const t_u16 KeyLength, const t_u8 *KeyIV, const t_u16 KeyIVLength, t_u8 *Data, t_u16 *DataLength); + +/** Set Crypto AES_ECB algorithm encrypt command param. + * + * \param[in] Key key + * \param[in] KeyLength The maximum key length is 32. + * \param[in] KeyIV KeyIV + * \param[in] KeyIVLength The maximum keyIV length is 32. + * \param[in] Data Data + * \param[in] DataLength The maximum Data length is 1300. + * \return WM_SUCCESS if successful. + * \return -WM_E_PERM if not supported. + * \return -WM_FAIL if failure. + * + * \note If the function returns WM_SUCCESS, the data in the memory pointed to by Data is overwritten by the encrypted + * data. The value of DataLength is updated to the encrypted data length. The length of the encrypted data is the same + * as the origin DataLength. + */ +int wlan_set_crypto_AES_ECB_encrypt( + const t_u8 *Key, const t_u16 KeyLength, const t_u8 *KeyIV, const t_u16 KeyIVLength, t_u8 *Data, t_u16 *DataLength); + +/** Set Crypto AES_ECB algorithm decrypt command param. + * + * \param[in] Key key + * \param[in] KeyLength The maximum key length is 32. + * \param[in] KeyIV KeyIV + * \param[in] KeyIVLength The maximum keyIV length is 32. + * \param[in] Data Data + * \param[in] DataLength The maximum Data length is 1300. + * \return WM_SUCCESS if successful. + * \return -WM_E_PERM if not supported. + * \return -WM_FAIL if failure. + * + * \note If the function returns WM_SUCCESS, the data in the memory pointed to by Data is overwritten by the decrypted + * data. The value of DataLength is updated to the decrypted data length. The length of the decrypted data is the same + * as the origin DataLength. + */ +int wlan_set_crypto_AES_ECB_decrypt( + const t_u8 *Key, const t_u16 KeyLength, const t_u8 *KeyIV, const t_u16 KeyIVLength, t_u8 *Data, t_u16 *DataLength); + +/** Set Crypto AES_WRAP algorithm encrypt command param. + * + * \param[in] Key key + * \param[in] KeyLength The maximum key length is 32. + * \param[in] KeyIV KeyIV + * \param[in] KeyIVLength The maximum keyIV length is 32. + * \param[in] Data Data + * \param[in] DataLength The maximum Data length is 1300. + * \return WM_SUCCESS if successful. + * \return -WM_E_PERM if not supported. + * \return -WM_FAIL if failure. + * + * \note If the function returns WM_SUCCESS, the data in the memory pointed to by Data is overwritten by the encrypted + * data. The value of DataLength is updated to the encrypted data length. The encrypted data is 8 bytes more than the + * original data. Therefore, the address pointed to by Data needs to reserve enough space. + */ +int wlan_set_crypto_AES_WRAP_encrypt( + const t_u8 *Key, const t_u16 KeyLength, const t_u8 *KeyIV, const t_u16 KeyIVLength, t_u8 *Data, t_u16 *DataLength); + +/** Set Crypto AES_WRAP algorithm decrypt command param. + * + * \param[in] Key key + * \param[in] KeyLength The maximum key length is 32. + * \param[in] KeyIV KeyIV + * \param[in] KeyIVLength The maximum keyIV length is 32. + * \param[in] Data Data + * \param[in] DataLength The maximum Data length is 1300. + * \return WM_SUCCESS if successful. + * \return -WM_E_PERM if not supported. + * \return -WM_FAIL if failure. + * + * \note If the function returns WM_SUCCESS, the data in the memory pointed to by Data is overwritten by the decrypted + * data. The value of DataLength is updated to the decrypted data length. The decrypted data is 8 bytes less than the + * original data. + */ +int wlan_set_crypto_AES_WRAP_decrypt( + const t_u8 *Key, const t_u16 KeyLength, const t_u8 *KeyIV, const t_u16 KeyIVLength, t_u8 *Data, t_u16 *DataLength); + +/** Set Crypto AES_CCMP algorithm encrypt command param. + * + * \param[in] Key key + * \param[in] KeyLength The maximum key length is 32. + * \param[in] AAD AAD + * \param[in] AADLength The maximum AAD length is 32. + * \param[in] Nonce Nonce + * \param[in] NonceLength The maximum Nonce length is 14. + * \param[in] Data Data + * \param[in] DataLength The maximum Data length is 1300. + * \return WM_SUCCESS if successful. + * \return -WM_E_PERM if not supported. + * \return -WM_FAIL if failure. + * + * \note If the function returns WM_SUCCESS, the data in the memory pointed to by Data is overwritten by the encrypted + * data. The value of DataLength is updated to the encrypted data length. The encrypted data is 8 or 16 bytes more than + * the original data. Therefore, the address pointed to by Data needs to reserve enough space. + */ +int wlan_set_crypto_AES_CCMP_encrypt(const t_u8 *Key, + const t_u16 KeyLength, + const t_u8 *AAD, + const t_u16 AADLength, + const t_u8 *Nonce, + const t_u16 NonceLength, + t_u8 *Data, + t_u16 *DataLength); + +/** Set Crypto AES_CCMP algorithm decrypt command param. + * + * \param[in] Key key + * \param[in] KeyLength The maximum key length is 32. + * \param[in] AAD AAD + * \param[in] AADLength The maximum AAD length is 32. + * \param[in] Nonce Nonce + * \param[in] NonceLength The maximum Nonce length is 14. + * \param[in] Data Data + * \param[in] DataLength The maximum Data length is 1300. + * \return WM_SUCCESS if successful. + * \return -WM_E_PERM if not supported. + * \return -WM_FAIL if failure. + * + * \note If the function returns WM_SUCCESS, the data in the memory pointed to by Data is overwritten by the decrypted + * data. The value of DataLength is updated to the decrypted data length. The decrypted data is 8 or 16 bytes less than + * the original data. + */ +int wlan_set_crypto_AES_CCMP_decrypt(const t_u8 *Key, + const t_u16 KeyLength, + const t_u8 *AAD, + const t_u16 AADLength, + const t_u8 *Nonce, + const t_u16 NonceLength, + t_u8 *Data, + t_u16 *DataLength); + +/** Set Crypto AES_GCMP algorithm encrypt command param. + * + * \param[in] Key key + * \param[in] KeyLength The maximum key length is 32. + * \param[in] AAD AAD + * \param[in] AADLength The maximum AAD length is 32. + * \param[in] Nonce Nonce + * \param[in] NonceLength The maximum Nonce length is 14. + * \param[in] Data Data + * \param[in] DataLength The maximum Data length is 1300. + * \return WM_SUCCESS if successful. + * \return -WM_E_PERM if not supported. + * \return -WM_FAIL if failure. + * + * \note If the function returns WM_SUCCESS, the data in the memory pointed to by Data is overwritten by the encrypted + * data. The value of DataLength is updated to the encrypted data length. The encrypted data is 16 bytes more than the + * original data. Therefore, the address pointed to by Data needs to reserve enough space. + */ +int wlan_set_crypto_AES_GCMP_encrypt(const t_u8 *Key, + const t_u16 KeyLength, + const t_u8 *AAD, + const t_u16 AADLength, + const t_u8 *Nonce, + const t_u16 NonceLength, + t_u8 *Data, + t_u16 *DataLength); + +/** Set Crypto AES_CCMP algorithm decrypt command param. + * + * \param[in] Key key + * \param[in] KeyLength The maximum key length is 32. + * \param[in] AAD AAD + * \param[in] AADLength The maximum AAD length is 32. + * \param[in] Nonce Nonce + * \param[in] NonceLength The maximum Nonce length is 14. + * \param[in] Data Data + * \param[in] DataLength The maximum Data length is 1300. + * \return WM_SUCCESS if successful. + * \return -WM_E_PERM if not supported. + * \return -WM_FAIL if failure. + * + * \note If the function returns WM_SUCCESS, the data in the memory pointed to by Data is overwritten by the decrypted + * data. The value of DataLength is updated to the decrypted data length. The decrypted data is 16 bytes less than the + * original data. + */ +int wlan_set_crypto_AES_GCMP_decrypt(const t_u8 *Key, + const t_u16 KeyLength, + const t_u8 *AAD, + const t_u16 AADLength, + const t_u8 *Nonce, + const t_u16 NonceLength, + t_u8 *Data, + t_u16 *DataLength); +#endif + +#if CONFIG_WIFI_MEM_ACCESS +/** This function reads/writes adapter memory location value. + * + *\param[in] action 0 -- read, 1 -- write + *\param[in] addr Specifies the memory address that is to be read/write. + *\param[in/out] value Value if specified, stand for write action, then that value will be written to that + *offset in the specified register. Value should be specified in hexadecimal. Otherwise, it stands for read action, the + *value is updated with read value. + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_mem_access(uint16_t action, uint32_t addr, uint32_t *value); +#endif + +#if CONFIG_WIFI_BOOT_SLEEP +/** This function get/set wlan boot sleep enable status. + * + *\param[in] action 0 -- get, 1 -- set + *\param[in/out] enable If action is get then enable value is used to store firmware returned Value otherwise it + *is set in firmware. + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_boot_sleep(uint16_t action, uint16_t *enable); +#endif + +/** + * This function sends the host command to f/w and copies back response to caller provided buffer in case of + * success Response from firmware is not parsed by this function but just copied back to the caller buffer. + * + * \param[in] cmd_buf Buffer containing the host command with header + * \param[in] cmd_buf_len length of valid bytes in cmd_buf + * \param[out] host_resp_buf Caller provided buffer, in case of success command response is copied to this + * buffer Can be same as cmd_buf \param[in] resp_buf_len resp_buf's allocated length \param[out] reqd_resp_len + * length of valid bytes in response buffer if successful otherwise invalid. \return WM_SUCCESS in + * case of success. \return WM_E_INBIG in case cmd_buf_len is bigger than the commands that can be + * handled by driver. \return WM_E_INSMALL in case cmd_buf_len is smaller than the minimum length. + * Minimum length is atleast the length of command header. Please see Note for same. \return WM_E_OUTBIG in case the + * resp_buf_len is not sufficient to copy response from firmware. reqd_resp_len is updated with the response size. + * \return WM_E_INVAL in case cmd_buf_len and resp_buf_len have invalid values. + * \return WM_E_NOMEM in case cmd_buf, resp_buf and reqd_resp_len are NULL + * \note Brief on the Command Header: Start 8 bytes of cmd_buf should have these values set. + * Firmware would update resp_buf with these 8 bytes at the start.\n + * 2 bytes : Command.\n + * 2 bytes : Size.\n + * 2 bytes : Sequence number.\n + * 2 bytes : Result.\n + * Rest of buffer length is Command/Response Body. + */ + +int wlan_send_hostcmd( + const void *cmd_buf, uint32_t cmd_buf_len, void *host_resp_buf, uint32_t resp_buf_len, uint32_t *reqd_resp_len); + +#if CONFIG_11AX +/** + * This function is used to set HTC parameter. + * + * \param[in] count + * \param[in] vht + * \param[in] he + * \param[in] rxNss + * \param[in] channelWidth + * \param[in] ulMuDisable + * \param[in] txNSTS + * \param[in] erSuDisable + * \param[in] dlResoundRecomm + * \param[in] ulMuDataDisable + * + * \return WM_SUCCESS if operation is successful, otherwise failure + */ +int wlan_send_debug_htc(const uint8_t count, + const uint8_t vht, + const uint8_t he, + const uint8_t rxNss, + const uint8_t channelWidth, + const uint8_t ulMuDisable, + const uint8_t txNSTS, + const uint8_t erSuDisable, + const uint8_t dlResoundRecomm, + const uint8_t ulMuDataDisable); + +/** + * This function is used to enable/disable HTC. + * + * \param[in] option 1 => Enable; 0 => Disable + * + * \return WM_SUCCESS if operation is successful, otherwise failure + */ +int wlan_enable_disable_htc(uint8_t option); +#endif + +#if CONFIG_11AX +/** + * Use this API to set the set 11AX Tx OMI. + * + * \param[in] interface Interface type STA or uAP. + * \param[in] tx_omi value to be sent to Firmware + * \param[in] tx_option value to be sent to Firmware + * 1: send OMI in QoS data. + * \param[in] num_data_pkts value to be sent to Firmware + * num_data_pkts is applied only if OMI is sent in QoS data frame. + * It specifies the number of consecutive data frames containing the OMI. + * Minimum value is 1 + * Maximum value is 16 + * + * \return WM_SUCCESS if operation is successful. + * \return -WM_FAIL if command fails. + */ +int wlan_set_11ax_tx_omi(const t_u8 interface, const t_u16 tx_omi, const t_u8 tx_option, const t_u8 num_data_pkts); +/** + * Set 802_11 AX OBSS Narrow Bandwidth RU Tolerance Time + * In uplink transmission, AP sends a trigger frame to all the stations that will be involved in the upcoming + *transmission, and then these stations transmit Trigger-based(TB) PPDU in response to the trigger frame. If STA + *connects to AP which channel is set to 100,STA doesn't support 26 tones RU. The API should be called when station is + *in disconnected state. + * + * + * \param[in] tol_time Valid range [1...3600] + * tolerance time is in unit of seconds. + * STA periodically check AP's beacon for ext cap bit79 (OBSS Narrow bandwidth RU in ofdma tolerance support) + * and set 20 tone RU tolerance time if ext cap bit79 is not set + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_set_11ax_tol_time(const t_u32 tol_time); +/** + * Use this API to set the RU tx power limit. + * + * \param[in] rutx_pwr_cfg 11AX rutxpwr of sub-bands to be sent to Firmware. + * \param[in] rutx_pwr_cfg_len Size of rutx_pwr_cfg buffer. + * + * \return WM_SUCCESS if operation is successful. + * \return -WM_FAIL if command fails. + */ +int wlan_set_11ax_rutxpowerlimit(const void *rutx_pwr_cfg, uint32_t rutx_pwr_cfg_len); + +/** + * Use this API to set the RU tx power limit by channel based approach. + * + * \param[in] ru_pwr_cfg 11AX rutxpwr of channels to be sent to Firmware. + * + * \return WM_SUCCESS if operation is successful. + * \return -WM_FAIL if command fails. + */ +int wlan_set_11ax_rutxpowerlimit_legacy(const wlan_rutxpwrlimit_t *ru_pwr_cfg); + +/** + * Use this API to get the RU tx power limit by channel based approach. + * + * \param[in] ru_pwr_cfg 11AX rutxpwr of channels to be get from Firmware + * + * \return WM_SUCCESS if operation is successful. + * \return -WM_FAIL if command fails. + */ +int wlan_get_11ax_rutxpowerlimit_legacy(wlan_rutxpwrlimit_t *ru_pwr_cfg); + +/** Set 11ax config params + * + * \param[in, out] ax_config 11AX config parameters to be sent to Firmware + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_set_11ax_cfg(wlan_11ax_config_t *ax_config); + +/** Get default 11ax config params + * + * \return 11AX config parameters default array. + */ +uint8_t *wlan_get_11ax_cfg(); + +#if CONFIG_11AX_TWT +/** Set btwt config params + * + * \param[in] btwt_config Broadcast TWT Setup parameters to be sent to Firmware + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_set_btwt_cfg(const wlan_btwt_config_t *btwt_config); + +/** Get btwt config params + * + * \return Broadcast TWT Setup parameters default config array. + */ +uint8_t *wlan_get_btwt_cfg(); + +/** Set twt setup config params + * + * \param[in] twt_setup TWT Setup parameters to be sent to Firmware + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_set_twt_setup_cfg(const wlan_twt_setup_config_t *twt_setup); + +/** Get twt setup config params + * + * \return TWT Setup parameters default array. + */ +uint8_t *wlan_get_twt_setup_cfg(); + +/** Set twt teardown config params + * + * \param[in] teardown_config TWT Teardown parameters sent to Firmware + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_set_twt_teardown_cfg(const wlan_twt_teardown_config_t *teardown_config); + +/** Get twt teardown config params + * + * \return TWT Teardown parameters default array + */ +uint8_t *wlan_get_twt_teardown_cfg(); + +/** Get twt report + * + * \param[out] twt_report TWT Report parameter. + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_get_twt_report(wlan_twt_report_t *twt_report); + +/** Twt information + * + * \param[out] twt_information TWT information. + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_twt_information(wlan_twt_information_t *twt_information); +#endif /* CONFIG_11AX_TWT */ + +#if CONFIG_MMSF +/** + * Set 11AX AMPDU Density config. + * \param[in] enable 0 - Disbale MMSF; 1 - Enable MMSF + * \param[in] Density ampdu Density value. Default value is 0x30. + * \param[in] MMSF ampdu MMSF value. Default value is 0x6. + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_set_mmsf(const t_u8 enable, const t_u8 Density, const t_u8 MMSF); + +/** + * Get 11AX AMPDU Density config. + * \param[out] enable 0 - Disbale MMSF; 1 - Enable MMSF + * \param[out] Density ampdu Density value. Default value is 0x30. + * \param[out] MMSF ampdu MMSF value. Default value is 0x6. + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_get_mmsf(t_u8 *enable, t_u8 *Density, t_u8 *MMSF); +#endif +#endif /* CONFIG_11AX */ + +#if CONFIG_WIFI_RECOVERY +int wlan_recovery_test(void); +#endif + +#if CONFIG_WIFI_CLOCKSYNC +/** Set Clock Sync GPIO based TSF + * + * \param[in] tsf_latch Clock Sync TSF latch parameters to be sent to Firmware + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_set_clocksync_cfg(const wlan_clock_sync_gpio_tsf_t *tsf_latch); +/** Get TSF info from firmware using GPIO latch + * + * \param[out] tsf_info TSF info parameter received from Firmware + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_get_tsf_info(wlan_tsf_info_t *tsf_info); +#endif /* CONFIG_WIFI_CLOCKSYNC */ + +#if CONFIG_HEAP_DEBUG +/** + * Show os mem alloc and free info. + * + */ +void wlan_show_os_mem_stat(); +#endif + +#if CONFIG_MULTI_CHAN +/** + * Set multi-channel status disable/enable. + * \param[in] status multi channel status + * 0-disable, 1-enable + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_set_multi_chan_status(const int status); + +/** + * Get multi-channel status disable/enable. + * \param[out] status multi channel status + * 0-disable, 1-enable + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_get_multi_chan_status(int *status); + +/** + * Set multi-channel config. + * \param[in] num array length of drcs_cfg[] + * \param[in] drcs_cfg multi-channel config, maybe an array + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_set_drcs_cfg(const wlan_drcs_cfg_t *drcs_cfg, const int num); + +/** + * Get multi-channel config. + * \param[in] num array length of drcs_cfg[] + * \param[out] drcs_cfg multi-channel config, maybe an array + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_get_drcs_cfg(wlan_drcs_cfg_t *drcs_cfg, int num); +#endif + +#if CONFIG_11R +/** + * Start FT roaming : This API is used to initiate fast BSS transition based + * roaming. + * + * \param[in] bssid BSSID of AP to roam + * \param[in] channel Channel of AP to roam + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_ft_roam(const t_u8 *bssid, const t_u8 channel); +#endif + +/** + * This API can be used to start/stop the management frame forwards + * to host through datapath. + * + * \param[in] bss_type The interface from which management frame needs to be + * collected 0: STA, 1: uAP + + * \param[in] mgmt_subtype_mask Management Subtype Mask + * If Bit X is set in mask, it means that IEEE Management Frame + * SubTyoe X is to be filtered and passed through to host. + * Bit Description + * [31:14] Reserved + * [13] Action frame + * [12:9] Reserved + * [8] Beacon + * [7:6] Reserved + * [5] Probe response + * [4] Probe request + * [3] Reassociation response + * [2] Reassociation request + * [1] Association response + * [0] Association request + * Support multiple bits set. + * 0 = stop forward frame + * 1 = start forward frame + *\param[in] rx_mgmt_callback The receive callback where the received management + * frames are passed. + * + * \return WM_SUCCESS if operation is successful. + * \return -WM_FAIL if command fails. + * + * \note Pass Management Subtype Mask all zero to disable all the management + * frame forward to host. + */ +int wlan_rx_mgmt_indication(const enum wlan_bss_type bss_type, + const uint32_t mgmt_subtype_mask, + int (*rx_mgmt_callback)(const enum wlan_bss_type bss_type, + const wlan_mgmt_frame_t *frame, + const size_t len)); + +#if CONFIG_WMM +void wlan_wmm_tx_stats_dump(int bss_type); +#endif + +#if CONFIG_SCAN_CHANNEL_GAP +/** + * Set scan channel gap. + * \param[in] scan_chan_gap Time gap to be used between two consecutive channels scan. + * + */ +void wlan_set_scan_channel_gap(unsigned scan_chan_gap); +#endif + +#if CONFIG_11K +/** + * enable/disable host 11k feature + * + * \param[in] enable_11k the value of 11k configuration. + * \return WM_SUCCESS if successful otherwise failure. + * + */ +int wlan_host_11k_cfg(int enable_11k); + +bool wlan_get_host_11k_status(); +int wlan_set_host_11k_status(int enable_11k); + +/** + * host send neighbor report request + * + * \param[in] ssid the SSID for neighbor report + * \note ssid parameter is optional + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_host_11k_neighbor_req(const char *ssid); +#endif + +#if CONFIG_11V +/** + * host send bss transition management query + * + * \param[in] query_reason BTM request query reason code + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_host_11v_bss_trans_query(t_u8 query_reason); +#endif + +#if !CONFIG_WPA_SUPP +#if CONFIG_DRIVER_MBO +/** + * enable/disable MBO feature + * + * \param[in] enable_mbo the value of mbo configuration. + * \return WM_SUCCESS if successful otherwise failure. + * + */ +int wlan_host_mbo_cfg(int enable_mbo); + +/** + * mbo channel operation preference configuration + * + * \param[in] ch0 channel number. + * \param[in] prefer0 operation preference for ch0. + * \param[in] ch1 channel number. + * \param[in] prefer1 operation preference for ch1. + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_mbo_peferch_cfg(t_u8 ch0, t_u8 pefer0, t_u8 ch1, t_u8 pefer1); +#endif +#endif + +#if (CONFIG_11MC) || (CONFIG_11AZ) +/** + * start or stop ftm based on the command from cli. + * \param[in] action 1: start ftm 2: stop ftm. + * \param[in] loop_cnt number of ftm sessions to run repeatedly ( default:1, 0:non-stop, n>1: n times). + * \param[in] mac Mac address of the peer with whom FTM session is required. + * \param[in] channel Channel on which FTM must be started. + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_ftm_start_stop(const t_u16 action, const t_u8 loop_cnt, const t_u8 *mac, const t_u8 channel); + +/** + * Config ftm protocol. + * \param[in] protocol 0:Dot11mc, 1:Dot11az_ntb, 2:Dot11az_tb + * \param[in] ftm_ranging_cfg FTM ranging config + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_ftm_cfg(const t_u8 protocol, ranging_11az_cfg_t *ftm_ranging_cfg); + +int wlan_ftm_11mc_cfg(ftm_11mc_nego_cfg_t *ftm_11mc_nego_cfg); + +int wlan_ftm_location_cfg(location_cfg_info_t *ftm_location_cfg); + +int wlan_ftm_civic_cfg(location_civic_rep_t *ftm_civic_cfg); +#endif + +#if CONFIG_WPA_SUPP +#if (CONFIG_11AX && defined(CONFIG_MBO)) +/** + * Multi Band Operation (MBO) non-preferred channels + * + * A space delimited list of non-preferred channels where each channel is a colon delimited list of values. + * + * Format: + * + * non_pref_chan=oper_class:chan:preference:reason + * Example: + * + * non_pref_chan=81:5:10:2 81:1:0:2 81:9:0:2 + * + * \param[in] non_pref_chan list of non-preferred channels. + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_mbo_peferch_cfg(const char *non_pref_chan); + +/** + * MBO set Cellular Data Capabilities + * + * \param[in] cell_capa 1 = Cellular data connection available + * 2 = Cellular data connection not available + * 3 = Not cellular capable (default) + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_mbo_set_cell_capa(t_u8 cell_capa); + +/** + * Optimized Connectivity Experience (OCE) + * + * \param[in] oce Enable OCE features + * 1 = Enable OCE in non-AP STA mode (default; disabled if the driver + * does not indicate support for OCE in STA mode). + * 2 = Enable OCE in STA-CFON mode. + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_mbo_set_oce(t_u8 oce); +#endif + +/** + * Opportunistic Key Caching (also known as Proactive Key Caching) default + * This parameter can be used to set the default behavior for the + * proactive_key_caching parameter. By default, OKC is disabled unless enabled + * with the global okc=1 parameter or with the per-network + * pkc(proactive_key_caching)=1 parameter. With okc=1, OKC is enabled by default, but + * can be disabled with per-network pkc(proactive_key_caching)=0 parameter. + * + * \param[in] okc Enable Opportunistic Key Caching + * + * 0 = Disable OKC (default) + * 1 = Enable OKC + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_set_okc(t_u8 okc); + +/** + * Dump text list of entries in PMKSA cache + * + * \param[out] buf Buffer to save PMKSA cache text list + * \param[in] buflen length of the buffer + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_pmksa_list(char *buf, size_t buflen); + +/** + * Flush PTKSA cache entries + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_pmksa_flush(); + +/** + * Set wpa supplicant scan interval in seconds + * + * \param[in] scan_int Scan interval in seconds + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_set_scan_interval(int scan_int); +#endif + +#if CONFIG_1AS +/** + * Get correlated time + * + * \param[out] host time and fw time in ns + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_get_fw_timestamp(wlan_correlated_time_t *time); + +/** + * start DOT1AS master state machine + * + * \param[in] bss_type 0: STA, 1: uAP + * \param[in] peer_mac destination mac address of timing measurement frame + * \param[in] num_of_tm number of timing measurement frames + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_start_timing_measurement(int bss_type, t_u8 *peer_mac, uint8_t num_of_tm); + +/** + * end DOT1AS master state machine report + * \param[out] info dot1as related info + */ +void wlan_end_timing_measurement(wlan_dot1as_info_t *info); + +/** + * request DOT1AS slave state machine + * + * \param[in] bss_type 0: STA, 1: uAP + * \param[in] peer_mac destination mac address of timing measurement request frame + * \param[in] trigger 1-start, 0-stop timing measurement procedure + */ +void wlan_request_timing_measurement(int bss_type, t_u8 *peer_mac, t_u8 trigger); + +/** + * report DOT1AS slave state machine info + * \param[out] info dot1as related info + */ +void wlan_report_timing_measurement(wlan_dot1as_info_t *info); +#endif + +#if CONFIG_ECSA +/** + * Send the ecsa config parameter to FW. + * + *\param[in] block_tx 0 -- no need to block traffic,1 -- need block traffic. + *\param[in] oper_class Operating class according to IEEE std802.11 spec, refer to Annex E, + * when 0 is used, automatically get operclass through band_width and channel. + *\param[in] channel The channel will switch to. + *\param[in] switch_count Channel switch time to send ECSA ie, unit is 110ms. + *\param[in] band_width Channel width switch to(optional), only for 5G channels. + * Depends on the hardware capabilities, when the hardware does not support, it will + *automatically downgrade. Redfinch support 20M. 0 -- 20MHZ, 1 -- 40M above, 3 -- 40M below, 4 -- 80M, 5 -- 160M + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_uap_set_ecsa_cfg(t_u8 block_tx, t_u8 oper_class, t_u8 channel, t_u8 switch_count, t_u8 band_width); +#endif + +#if CONFIG_SUBSCRIBE_EVENT_SUPPORT + +/*Type enum definition of subscribe event*/ +typedef enum +{ + /** Event Id for subscribe event rssi low */ + EVENT_SUB_RSSI_LOW = 0, + /** Event Id for subscribe event rssi high */ + EVENT_SUB_RSSI_HIGH, + /** Event Id for subscribe event snr low */ + EVENT_SUB_SNR_LOW, + /** Event Id for subscribe event snr high */ + EVENT_SUB_SNR_HIGH, + /** Event Id for subscribe event max fail */ + EVENT_SUB_MAX_FAIL, + /** Event Id for subscribe event beacon missed */ + EVENT_SUB_BEACON_MISSED, + /** Event Id for subscribe event data rssi low */ + EVENT_SUB_DATA_RSSI_LOW, + /** Event Id for subscribe event data rssi high */ + EVENT_SUB_DATA_RSSI_HIGH, + /** Event Id for subscribe event data snr low */ + EVENT_SUB_DATA_SNR_LOW, + /** Event Id for subscribe event data snr high */ + EVENT_SUB_DATA_SNR_HIGH, + /** Event Id for subscribe event link quality */ + EVENT_SUB_LINK_QUALITY, + /** Event Id for subscribe event pre_beacon_lost */ + EVENT_SUB_PRE_BEACON_LOST, + /** Fail event id */ + MAX_EVENT_ID, +} sub_event_id; + +/** Type definition of wlan_ds_subscribe_evt for subscribe events */ +typedef wifi_ds_subscribe_evt wlan_ds_subscribe_evt; + +/** + * Subscribe specified event from the Wi-Fi firmware. Wi-Fi firmware will report the registered event to driver upon + * configured report conditions are met. \param[in] event_id event to register as per \ref sub_event_id \param[in] + * thresh_value threshold value (dBm) \param[in] freq event frequency 0--report once, 1--report everytime happened, N -- + * report only happened > N consecutive times. + */ +int wlan_set_subscribe_event(unsigned int event_id, unsigned int thresh_value, unsigned int freq); +/** + * Get all subscribed events from Wi-Fi firmware along with threshold value and report frequency. + * \param[in] sub_evt A pointer to \ref wlan_ds_subscribe_evt to store the events data. + */ +int wlan_get_subscribe_event(wlan_ds_subscribe_evt *sub_evt); +/** + * cancel the subscribe event to firmware + * \param[in] event_id event id to clear as per \ref sub_event_id + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_clear_subscribe_event(unsigned int event_id); +/** + * subscibe link quality event + * \param[in] event_id event id to clear as per \ref sub_event_id + * \param[in] link_snr link quality snr value + * \param[in] link_snr_freq link quality snr freq + * \param[in] link_rate link quality rate + * \param[in] link_rate_freq link quality rate freq + * \param[in] link_tx_latency link quality write lantency + * \param[in] link_tx_lantency_freq link quality write lantency freq + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_set_threshold_link_quality(unsigned int evend_id, + unsigned int link_snr, + unsigned int link_snr_freq, + unsigned int link_rate, + unsigned int link_rate_freq, + unsigned int link_tx_latency, + unsigned int link_tx_lantency_freq); +#endif + +#if CONFIG_TSP +/** + * get TSP(Thermal Safeguard Protection) configuration. + * TSP algorithm moniters PA Tj and primarily backs off data throughput. + * \param[out] enable enable/disable tsp algothrim + * \param[out] back_off power back off [0...20]dB + * \param[out] highThreshold high threshold [0...300]°C + * \param[out] lowThreshold low threshold [0...300]°C + * High Threshold must be greater than Low Threshold. + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_get_tsp_cfg(t_u16 *enable, + t_u32 *back_off, + t_u32 *highThreshold, + t_u32 *lowThreshold, + t_u32 *dutycycstep, + t_u32 *dutycycmin, + int *highthrtemp, + int *lowthrtemp, + int *currCAUTemp, + int *currRFUTemp); +/** + * set TSP(Thermal Safeguard Protection) configuration. + * TSP algorithm moniters PA Tj and primarily backs off data throughput. + * \param[in] enable enable/disable tsp algothrim + * \param[in] back_off power back off [0...20]dB + * \param[in] highThreshold high threshold [0...300]°C + * \param[in] lowThreshold low threshold [0...300]°C + * High Threshold must be greater than Low Threshold. + * \return WM_SUCCESS if successful otherwise failure. + */ + +int wlan_set_tsp_cfg(t_u16 enable, + t_u32 back_off, + t_u32 highThreshold, + t_u32 lowThreshold, + t_u32 dutycycstep, + t_u32 dutycycmin, + int highthrtemp, + int lowthrtemp); +#endif + +#if CONFIG_WIFI_REG_ACCESS +/** This function reads/writes adapter registers value. + * + *\param[in] type Register type: 1 -- MAC, 2 -- BBP, 3 -- RF. + *\param[in] action 0 -- read, 1 -- write + *\param[in] offset Specifies the offset location that is to be read/write. + *\param[in/out] value Value if specified, stand for write action, then that value will be written to that + *offset in the specified register. Value should be specified in hexadecimal. Otherwise, it stands for read action, the + *value is updated with read value. + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_reg_access(wifi_reg_t type, uint16_t action, uint32_t offset, uint32_t *value); +#endif + +#if CONFIG_TX_AMPDU_PROT_MODE +/** + * Set/Get Tx ampdu prot mode. + * + * \param[in, out] prot_mode Tx ampdu prot mode + * \param[in] action Command action + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_tx_ampdu_prot_mode(tx_ampdu_prot_mode_para *prot_mode, t_u16 action); +#endif + +struct wlan_message +{ + t_u16 id; + void *data; +}; + +#if CONFIG_MEF_CFG +enum wlan_mef_type +{ + MEF_TYPE_DELETE = 0, + MEF_TYPE_PING, + MEF_TYPE_ARP, + MEF_TYPE_MULTICAST, + MEF_TYPE_IPV6_NS, + MEF_TYPE_END, +}; +/** This function set auto ARP configuration. + * + * \param[in] mef_action To be 0--discard and not wake host, 1--discard and wake host 3--allow and wake host. + * + * \return WM_SUCCESS if successful otherwise failure. + * + */ +int wlan_mef_set_auto_arp(t_u8 mef_action); +/** This function set auto ping configuration. + * + * \param[in] mef_action To be 0--discard and not wake host, 1--discard and wake host 3--allow and wake host. + * + * \return WM_SUCCESS if successful otherwise failure. + * + */ +int wlan_mef_set_auto_ping(t_u8 mef_action); +/** This function set/delete mef entries configuration. + * + * \param[in] type MEF type: MEF_TYPE_DELETE, MEF_TYPE_AUTO_PING, MEF_TYPE_AUTO_ARP + * \param[in] mef_action To be 0--discard and not wake host, 1--discard and wake host 3--allow and wake host. + * + * \return WM_SUCCESS if the call was successful. + * \return -WM_FAIL if failed. + */ +int wlan_config_mef(int type, t_u8 mef_action); +/** + * Use this API to enable IPv6 Neighbor Solicitation offload in Wi-Fi firmware + * + * \param[in] mef_action 0--discard and not wake host, 1--discard and wake host 3--allow and wake host. + * + * \return WM_SUCCESS if operation is successful. + * \return -WM_FAIL if command fails. + */ +int wlan_set_ipv6_ns_mef(t_u8 mef_action); +#endif + +#if CONFIG_CSI +/** + * Send the csi config parameter to FW. + * + *\param[in] csi_params Csi config parameter + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_csi_cfg(wlan_csi_config_params_t *csi_params); + +/** This function registers callback which are used to deliver CSI data to user. + * + * \param[in] csi_data_recv_callback Callback to deliver CSI data and max data length is 768 bytes. + * Pls save data as soon as possible in callback + * Type of callback return vale is int. + * + * Memory layout of buffer: + * size(byte) items + * 2 buffer len[bit 0:12] + * 2 CSI signature, 0xABCD fixed + * 4 User defined HeaderID + * 2 Packet info + * 2 Frame control field for the received packet + * 8 Timestamp when packet received + * 6 Received Packet Destination MAC Address + * 6 Received Packet Source MAC Address + * 1 RSSI for antenna A + * 1 RSSI for antenna B + * 1 Noise floor for antenna A + * 1 Noise floor for antenna B + * 1 Rx signal strength above noise floor + * 1 Channel + * 2 user defined Chip ID + * 4 Reserved + * 4 CSI data length in DWORDs + * CSI data + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_register_csi_user_callback(int (*csi_data_recv_callback)(void *buffer, size_t len)); + +/** This function unregisters callback which are used to deliver CSI data to user. + * + * \return WM_SUCCESS if successful + */ +int wlan_unregister_csi_user_callback(void); +#endif + +#if (CONFIG_11K) || (CONFIG_11V) || (CONFIG_11R) || (CONFIG_ROAMING) +/** + * Use this API to set the RSSI threshold value for low RSSI event subscription. + * When RSSI falls below this threshold firmware will generate the low RSSI event to driver. + * This low RSSI event is used when either of CONFIG_11R, CONFIG_11K, CONFIG_11V or CONFIG_ROAMING is enabled. + * NOTE: By default rssi low threshold is set at -70 dbm + * + * \param[in] threshold Threshold rssi value to be set + * + */ +void wlan_set_rssi_low_threshold(uint8_t threshold); +#endif + +#if CONFIG_WPA_SUPP +#if CONFIG_WPA_SUPP_WPS +/** Generate valid PIN for WPS session. + * + * This function generate PIN for WPS PIN session. + * + * \param[in] pin A pointer to WPS pin to be generated. + */ +void wlan_wps_generate_pin(uint32_t *pin); + +/** Start WPS PIN session. + * + * This function starts WPS PIN session. + * + * \param[in] pin Pin for WPS session. + * + * \return WM_SUCCESS if the pin entered is valid. + * \return -WM_FAIL if invalid pin entered. + */ +int wlan_start_wps_pin(const char *pin); + +/** Start WPS PBC session. + * + * This function starts WPS PBC session. + * + * \return WM_SUCCESS if successful + * \return -WM_FAIL if invalid pin entered. + * + */ +int wlan_start_wps_pbc(void); + +/** Cancel WPS session. + * + * This function cancels ongoing WPS session. + * + * \return WM_SUCCESS if successful + * \return -WM_FAIL if invalid pin entered. + * + */ +int wlan_wps_cancel(void); + +#if CONFIG_WPA_SUPP_AP +/** Start WPS PIN session. + * + * This function starts AP WPS PIN session. + * + * \param[in] pin Pin for WPS session. + * + * \return WM_SUCCESS if the pin entered is valid. + * \return -WM_FAIL if invalid pin entered. + */ +int wlan_start_ap_wps_pin(const char *pin); + +/** Start WPS PBC session. + * + * This function starts AP WPS PBC session. + * + * \return WM_SUCCESS if successful + * \return -WM_FAIL if invalid pin entered. + * + */ +int wlan_start_ap_wps_pbc(void); + +/** Cancel AP's WPS session. + * + * This function cancels ongoing WPS session. + * + * \return WM_SUCCESS if successful + * \return -WM_FAIL if invalid pin entered. + * + */ +int wlan_wps_ap_cancel(void); +#endif +#endif +#endif + +#if (CONFIG_WPA2_ENTP) || (CONFIG_WPA_SUPP_CRYPTO_ENTERPRISE) +#define FILE_TYPE_NONE 0 +#define FILE_TYPE_ENTP_CA_CERT 1 +#define FILE_TYPE_ENTP_CLIENT_CERT 2 +#define FILE_TYPE_ENTP_CLIENT_KEY 3 +#define FILE_TYPE_ENTP_CA_CERT2 4 +#define FILE_TYPE_ENTP_CLIENT_CERT2 5 +#define FILE_TYPE_ENTP_CLIENT_KEY2 6 + +#if CONFIG_WPA_SUPP_AP +#define FILE_TYPE_ENTP_SERVER_CERT 8 +#define FILE_TYPE_ENTP_SERVER_KEY 9 +#define FILE_TYPE_ENTP_DH_PARAMS 10 +#endif + +/** This function specifies the enterprise certificate file + * This function must be used before adding network profile. It will store certificate data + * in "wlan" global structure. When adding new network profile, it will be get by + * wlan_get_entp_cert_files(), and put into profile security structure after mbedtls parse. + * + * \param[in] cert_type certificate file type: + * 1 -- FILE_TYPE_ENTP_CA_CERT, + * 2 -- FILE_TYPE_ENTP_CLIENT_CERT, + * 3 -- FILE_TYPE_ENTP_CLIENT_KEY. + * \param[in] data raw data + * \param[in] data_len size of raw data + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_set_entp_cert_files(int cert_type, t_u8 *data, t_u32 data_len); + +/** This function get enterprise certificate data from "wlan" global structure * + * \param[in] cert_type certificate file type: + * 1 -- FILE_TYPE_ENTP_CA_CERT, + * 2 -- FILE_TYPE_ENTP_CLIENT_CERT, + * 3 -- FILE_TYPE_ENTP_CLIENT_KEY. + * \param[in] data raw data + * + * \return size of raw data + */ +t_u32 wlan_get_entp_cert_files(int cert_type, t_u8 **data); + +/** This function free the temporary memory of enterprise certificate data + * After add new enterprise network profile, the certificate data has been parsed by mbedtls into another data, which + * can be freed. + * + */ +void wlan_free_entp_cert_files(void); +#endif + +#if CONFIG_NET_MONITOR +/** + * Send the net monitor config parameter to FW. + * + *\param[in] monitor Monitor config parameter + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_net_monitor_cfg(wlan_net_monitor_t *monitor); + +/** This function registers callback which are used to deliver monitor data to user. + * + * \param[in] monitor_data_recv_callback Callback to deliver monitor data and data length to user. + * Memory layout of buffer: + * offset(byte) items + * 0 rssi + * 1 802.11 mac header + * 1 + 'size of 802.11 mac header' frame body + * + * \return void + */ +void wlan_register_monitor_user_callback(int (*monitor_data_recv_callback)(void *buffer, t_u16 data_len)); + +/** This function deregisters monitor callback. + * + * \return void + */ +void wlan_deregister_net_monitor_user_callback(); +#endif + +#if CONFIG_WIFI_CAPA +/** Check if 11n(2G or 5G) is supported by hardware or not. + * + * \param[in] channel Channel number. + * + * \return true if 11n is supported or false if not. + */ +uint8_t wlan_check_11n_capa(unsigned int channel); + +/** Check if 11ac(2G or 5G) is supported by hardware or not. + * + * \param[in] channel Channel number. + * + * \return true if 11ac is supported or false if not. + */ +uint8_t wlan_check_11ac_capa(unsigned int channel); + +/** Check if 11ax(2G or 5G) is supported by hardware or not. + * + * \param[in] channel Channel number. + * + * \return true if 11ax is supported or false if not. + */ +uint8_t wlan_check_11ax_capa(unsigned int channel); +#endif + +#if (CONFIG_IPS) +/** + * Config IEEE power save mode(IPS).If the option is 1, the ips hardware listens to beacon frames after WLAN CPU enters + * power save mode. When there is work needed to done by WLAN CPU, WLAN CPU will be woken up by ips hardware. \param[in] + * option 0/1 disable/enable ips + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_set_ips(int option); +#endif + +#ifdef STA_SUPPORT +/** + * Get rssi information. + * \param[out] signal rssi infomation get report buffer + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_get_signal_info(wlan_rssi_info_t *signal); +#endif + +#if (CONFIG_COMPRESS_TX_PWTBL) +/** + * set region power table + * \param[in] region_code region code + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_set_rg_power_cfg(t_u16 region_code); +#endif + +#if CONFIG_TURBO_MODE +/** + * Get Turbo mode. + * \param[out] mode turbo mode + * 0: disable turbo mode + * 1: turbo mode 1 + * 2: turbo mode 2 + * 3: turbo mode 3 + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_get_turbo_mode(t_u8 *mode); + +/** + * Get UAP Turbo mode. + * \param[out] mode turbo mode + * 0: disable turbo mode + * 1: turbo mode 1 + * 2: turbo mode 2 + * 3: turbo mode 3 + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_get_uap_turbo_mode(t_u8 *mode); + +/** + * Set Turbo mode. + * \param[in] mode turbo mode + * 0: disable turbo mode + * 1: turbo mode 1 + * 2: turbo mode 2 + * 3: turbo mode 3 + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_set_turbo_mode(t_u8 mode); + +/** + * Set UAP Turbo mode. + * \param[in] mode turbo mode + * 0: disable turbo mode + * 1: turbo mode 1 + * 2: turbo mode 2 + * 3: turbo mode 3 + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_set_uap_turbo_mode(t_u8 mode); +#endif + +/** + * set ps configuration. + * Currently only used to modify multiple dtim. + * \param[in] multiple_dtims num dtims, range [1,20] + * \param[in] bcn_miss_timeout becaon miss interval + * \param[in] local_listen_interval local listen interval + * \param[in] adhoc_wake_period adhoc awake period + * \param[in] mode mode - (0x01 - firmware to automatically choose PS_POLL or NULL mode, + * 0x02 - PS_POLL, + * 0x03 - NULL mode ) + * \param[in] delay_to_ps Delay to PS in milliseconds + */ +void wlan_set_ps_cfg(t_u16 multiple_dtims, + t_u16 bcn_miss_timeout, + t_u16 local_listen_interval, + t_u16 adhoc_wake_period, + t_u16 mode, + t_u16 delay_to_ps); + +#if CONFIG_CLOUD_KEEP_ALIVE +/** + * Save start cloud keep alive parameters + * + * \param[in] cloud_keep_alive cloud keep alive information + * \param[in] src_port Source port + * \param[in] dst_port Destination port + * \param[in] seq_number Sequence number + * \param[in] ack_number Acknowledgement number + * \param[in] enable Enable + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_save_cloud_keep_alive_params(wlan_cloud_keep_alive_t *cloud_keep_alive, + t_u16 src_port, + t_u16 dst_port, + t_u32 seq_number, + t_u32 ack_number, + t_u8 enable); + +/** + * Get cloud keep alive status for given destination ip and port + * + * \param[in] dst_ip Destination ip address + * \param[in] dst_port Destination port + * + * \return 1 if enabled otherwise 0. + */ +int wlan_cloud_keep_alive_enabled(t_u32 dst_ip, t_u16 dst_port); + +/** + * Start cloud keep alive + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_start_cloud_keep_alive(void); +/** + * Stop cloud keep alive + * \param[in] cloud_keep_alive cloud keep alive information + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_stop_cloud_keep_alive(wlan_cloud_keep_alive_t *cloud_keep_alive); +#endif + +/** + * Set country code + * + * \note This API should be called after WLAN is initialized + * but before starting uAP interface. + * + * \param[in] alpha2 country code in 3 octets string, 2 octets country code and 1 octet environment + * 2 octets country code supported: + * WW : World Wide Safe + * US : US FCC + * CA : IC Canada + * SG : Singapore + * EU : ETSI + * AU : Australia + * KR : Republic Of Korea + * FR : France + * JP : Japan + * CN : China + * + * For the third octet, STA is always 0. + * For uAP environment: + * All environments of the current frequency band and country (default) + * alpha2[2]=0x20 + * Outdoor environment only + * alpha2[2]=0x4f + * Indoor environment only + * alpha2[2]=0x49 + * Noncountry entity (country_code=XX) + * alpha[2]=0x58 + * IEEE 802.11 standard Annex E table indication: 0x01 .. 0x1f + * Annex E, Table E-4 (Global operating classes) + * alpha[2]=0x04 + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_set_country_code(const char *alpha2); + +/** Set ignore region code + * + * \param[in] ignore 0: Don't ignore 1: ignore + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_set_country_ie_ignore(uint8_t *ignore); + +/** Set region code + * + * \param[in] region_code + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_set_region_code(unsigned int region_code); + +/** Get region code + * + * \param[out] region_code pointer + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_get_region_code(unsigned int *region_code); + +const chan_freq_power_t *wlan_get_regulatory_domain(uint8_t chan_freq, int *cfp_no); + +/** Set STA/uAP 80211d feature enable/disable + * + * \param[in] bss_type 0: STA, 1: uAP + * \param[in] state 0: disable, 1: enable + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_set_11d_state(int bss_type, int state); + +#if CONFIG_COEX_DUTY_CYCLE +/** + * Set single ant duty cycle. + * \param[in] enable + * \param[in] nbTime + * \param[in] wlanTime + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_single_ant_duty_cycle(t_u16 enable, t_u16 nbTime, t_u16 wlanTime); + +/** + * Set dual ant duty cycle. + * \param[in] enable + * \param[in] nbTime + * \param[in] wlanTime + * \param[in] wlanBlockTime + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_dual_ant_duty_cycle(t_u16 enable, t_u16 nbTime, t_u16 wlanTime, t_u16 wlanBlockTime); +#endif + +#if CONFIG_EXTERNAL_COEX_PTA +/** + * Set external coex pta parameters. + * \param[in] coex_pta_config + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_external_coex_pta_cfg(ext_coex_pta_cfg coex_pta_config); +#endif + +#if CONFIG_IMD3_CFG +/** + * Set imd validation parameters. + * \param[in] imd3_value disable imd3: imd3_value = 0; + * enable imd3: low 4 bits: enable, high 4 bits: isolation index. + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_imd3_cfg(t_u8 imd3_value); +#endif + +#if CONFIG_UAP_STA_MAC_ADDR_FILTER +int wlan_host_set_sta_mac_filter(int filter_mode, int mac_count, unsigned char *mac_addr); +#endif + +#if (CONFIG_WIFI_IND_RESET) && (CONFIG_WIFI_IND_DNLD) +/** + * Set GPIO independent reset configuration + * + * \param[in] indrst_cfg GPIO independent reset config to be sent to Firmware + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_set_indrst_cfg(const wifi_indrst_cfg_t *indrst_cfg); + +/* Get GPIO independent reset configuration + * + * \param[out] indrst_cfg GPIO independent reset config set in Firmware + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_get_indrst_cfg(wifi_indrst_cfg_t *indrst_cfg); + +/** Test Independent Firmware reset + * + * This function will either send cmd that will cause timeout in firmware or + * send GPIO pulse that will cause out of band reset in firmware as per configuration + * int earlier \ref wlan_set_indrst_cfg API. + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_independent_reset(); + +#endif + +int wlan_set_network_ip_byname(char *name, struct wlan_ip_config *ip); + +#if CONFIG_INACTIVITY_TIMEOUT_EXT +/** + * Get/Set inactivity timeout extend + * \param[in] inac_to + * \param[in] action + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_sta_inactivityto(wlan_inactivity_to_t *inac_to, t_u16 action); +#endif + +#ifdef RW610 +/** + * Get board temperature. + * \return board temperature. + */ +int32_t wlan_get_temperature(void); +#endif + +#if CONFIG_CPU_LOADING +/** + * Set parameters for cpu loading test. + * + * \param[in] start 0 stop test, 1 start test. + * \param[in] number The number of cpu loading test. + * \param[in] period The period of cpu loading test. + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_cpu_loading(uint8_t start, uint32_t number, uint8_t period); +#endif + +#if CONFIG_AUTO_NULL_TX +/** Configuration for auto null tx parameters from + * \ref wifi_auto_null_tx_t + */ +typedef wifi_auto_null_tx_t wlan_auto_null_tx_t; + +/** + * Start/Stop auto tx null + * + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_auto_null_tx(wlan_auto_null_tx_t *auto_null_tx, mlan_bss_type bss_type); +#endif + +/** + * allocate a copy of a string + * + */ +char *wlan_string_dup(const char *s); + +/** + * Get board type. + * + * \return board type. + */ +uint32_t wlan_get_board_type(); + +#if UAP_SUPPORT +/** + * Disconnect to sta which is connected with internal uap. + * + * \param[in] sta_addr sta mac address + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_uap_disconnect_sta(uint8_t *sta_addr); + +/** + * Set ageout timer for sta + * + * \param[in] sta_ageout_time sta ageout time (100ms) + * \return WM_SUCCESS if successful otherwise failure. + */ +int wlan_uap_set_sta_ageout_timer(uint32_t sta_ageout_time); +#endif + +#if CONFIG_WIFI_NM_WPA_SUPPLICANT +int wlan_supp_dpp_listen(int bss_type, int enable); +#endif +#endif /* __WLAN_H__ */ diff --git a/mcux/middleware/wifi_nxp/incl/wlcmgr/wlan_11d.h b/mcux/middleware/wifi_nxp/incl/wlcmgr/wlan_11d.h new file mode 100644 index 000000000..f3901190f --- /dev/null +++ b/mcux/middleware/wifi_nxp/incl/wlcmgr/wlan_11d.h @@ -0,0 +1,55 @@ +/* + * Copyright 2008-2024 NXP + * + * SPDX-License-Identifier: BSD-3-Clause + * + */ + +/*! \file wlan_11d.h + * \brief WLAN module 11d API + */ + +#ifndef __WLAN_11D_H__ +#define __WLAN_11D_H__ + +#include + +/** Enable 11D support in WLAN Driver. + * + * \note This API should be called after WLAN is initialized + * but before starting uAP or making any connection attempts on station + * interface. + * + * \param[in] state 1: enable, 0: disable + * + * \return -WM_FAIL if operation was failed. + * \return WM_SUCCESS if operation was successful. + */ +static inline int wlan_enable_11d(int state) +{ + if (state) + return wifi_enable_11d_support(); + else + return wifi_disable_11d_support(); +} + +/** Enable 11D support in WLAN Driver for uap interface. + * + * \note This API should be called after WLAN is initialized + * but before starting uAP or making any connection attempts on station + * interface. + * + * \param[in] state 1: enable, 0: disable + * + * \return -WM_FAIL if operation was failed. + * \return WM_SUCCESS if operation was successful. + */ +static inline int wlan_enable_uap_11d(int state) +{ + if (state) + return wifi_enable_uap_11d_support(); + else + return wifi_disable_uap_11d_support(); +} + +#endif /* __WLAN_11D_H__ */ diff --git a/mcux/middleware/wifi_nxp/incl/wlcmgr/wlan_features.h b/mcux/middleware/wifi_nxp/incl/wlcmgr/wlan_features.h new file mode 100644 index 000000000..04da724d2 --- /dev/null +++ b/mcux/middleware/wifi_nxp/incl/wlcmgr/wlan_features.h @@ -0,0 +1,32 @@ +/* + * Copyright 2021-2024 NXP + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#if CONFIG_WIFI_FEATURES +/** Register WLAN Features CLI commands. + * + * Register the WLAN Features CLI commands offload and hostwake features. + * + * \note This function can only be called by the application after \ref wlan_init() + * called. + * + * \return WM_SUCCESS if the CLI commands were registered or + * \return -WM_FAIL if they were not (for example if this function + * was called while the CLI commands were already registered). + */ +int wlan_features_cli_init(void); + +/** Unregister WLAN Features CLI commands. + * + * Unegister the WLAN Features CLI commands offload and hostwake features. + * + * \note This function can only be called by the application after \ref wlan_init() + * called. + * + * \return WM_SUCCESS if the CLI commands were unregistered or + * \return -WM_FAIL if they were not unregistered + */ +int wlan_features_cli_deinit(void); +#endif diff --git a/mcux/middleware/wifi_nxp/incl/wlcmgr/wlan_mcu_mem_access_cli.h b/mcux/middleware/wifi_nxp/incl/wlcmgr/wlan_mcu_mem_access_cli.h new file mode 100644 index 000000000..1ce0d5a8a --- /dev/null +++ b/mcux/middleware/wifi_nxp/incl/wlcmgr/wlan_mcu_mem_access_cli.h @@ -0,0 +1,26 @@ +/* + * Copyright 2008-2024 NXP + * + * SPDX-License-Identifier: BSD-3-Clause + * + */ + +/*! \file wlan_mcu_mem_access_cli.h + * \brief MCU Mem Read/Write. + */ + +#if CONFIG_MCU_MEM_ACCESS + +/** Register MCU mem read/write CLI commands + * This function registers MCU mem read/write CLI commands + * + * \note This function gets called by \ref wlan_cli_init(). + * + * \return WLAN_ERROR_NONE if the CLI commands were registered or + * \return WLAN_ERROR_ACTION if they were not registered (for example + * if this function was called while the CLI commands were already + * registered). + */ +int mcu_mem_access_init(void); + +#endif /*CONFIG_MCU_MEM_ACCESS */ diff --git a/mcux/middleware/wifi_nxp/incl/wlcmgr/wlan_tests.h b/mcux/middleware/wifi_nxp/incl/wlcmgr/wlan_tests.h new file mode 100644 index 000000000..23bc88f51 --- /dev/null +++ b/mcux/middleware/wifi_nxp/incl/wlcmgr/wlan_tests.h @@ -0,0 +1,73 @@ +/* Copyright 2008-2024 NXP + * + * SPDX-License-Identifier: BSD-3-Clause + * + */ + +/*! \file wlan_tests.h + * \brief WLAN Connection Manager Tests + */ + +#ifndef __WLAN_TESTS_H__ +#define __WLAN_TESTS_H__ + +#if CONFIG_11AX +/* index enum of cfgs */ +enum +{ + TEST_WLAN_11AX_CFG, +#if CONFIG_11AX_TWT + TEST_WLAN_BCAST_TWT, + TEST_WLAN_TWT_SETUP, + TEST_WLAN_TWT_TEARDOWN, +#endif /* CONFIG_11AX_TWT */ +}; + +/* + * Structs for mutiple config data in freeRTOS, split cfg to various param modules. + * Modify cfg data by param index + * test_cfg_param_t param module of cfg + * test_cfg_table_t cfg table for all the param modules of a cfg + */ +typedef struct +{ + /* name of param */ + const char *name; + /* offset in cfg data */ + int offset; + int len; + const char *notes; +} test_cfg_param_t; + +typedef struct +{ + /* name of cfg */ + const char *name; + /* point of stored data for sending cmd, stored in Little-Endian */ + uint8_t *data; + /* len of data */ + int len; + /* point of list for all the params */ + const test_cfg_param_t *param_list; + /* total number of params */ + int param_num; +} test_cfg_table_t; + +/* + * Cfg table process + * syntax: "wlan-11axcfg