diff --git a/CMakeLists.txt b/CMakeLists.txt index da0b3422f4..a0eece4f0f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,3 +21,4 @@ add_subdirectory_ifdef(CONFIG_GZLL gzll) add_subdirectory_ifdef(CONFIG_NRF_DM nrf_dm) add_subdirectory_ifdef(CONFIG_NRF_FUEL_GAUGE nrf_fuel_gauge) add_subdirectory_ifdef(CONFIG_SW_CODEC_LC3_T2_SOFTWARE lc3) +add_subdirectory_ifdef(CONFIG_NRF71_WIFI nrf71_wifi) diff --git a/Kconfig.nrfxlib b/Kconfig.nrfxlib index 7c85d1341d..3459762262 100644 --- a/Kconfig.nrfxlib +++ b/Kconfig.nrfxlib @@ -17,5 +17,6 @@ rsource "gzll/Kconfig" rsource "nrf_dm/Kconfig" rsource "lc3/Kconfig" rsource "nrf_fuel_gauge/Kconfig" +rsource "nrf71_wifi/Kconfig" endmenu diff --git a/nrf71_wifi/CMakeLists.txt b/nrf71_wifi/CMakeLists.txt new file mode 100644 index 0000000000..23d2bca88c --- /dev/null +++ b/nrf71_wifi/CMakeLists.txt @@ -0,0 +1 @@ +zephyr_include_directories(include) diff --git a/nrf71_wifi/Kconfig b/nrf71_wifi/Kconfig new file mode 100644 index 0000000000..ea5810e402 --- /dev/null +++ b/nrf71_wifi/Kconfig @@ -0,0 +1,12 @@ +# +# Copyright (c) 2025 Nordic Semiconductor +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# +menu "nrf71_Wi-Fi firmware interface library" + +config NRF71_WIFI + bool + default y if NRF71_ON_IPC + +endmenu diff --git a/nrf71_wifi/include/nrf71_wifi_common.h b/nrf71_wifi/include/nrf71_wifi_common.h new file mode 100755 index 0000000000..a60bf73570 --- /dev/null +++ b/nrf71_wifi/include/nrf71_wifi_common.h @@ -0,0 +1,2709 @@ +/* + * + *Copyright (c) 2024 Nordic Semiconductor ASA + * + *SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * @addtogroup nrf_wifi_fw_if Wi-Fi driver and firmware interface + * @{ + * @brief System interface between host and RPU + */ + +#ifndef __HOST_RPU_SYS_IF_H__ +#define __HOST_RPU_SYS_IF_H__ + +#include "common/pack_def.h" + +#define NRF_WIFI_RF_PARAMS_SIZE 200 +#define NRF_WIFI_RF_PARAMS_CONF_SIZE 42 + +#define MAX_NUM_OF_RX_QUEUES 3 +#define NRF_WIFI_MAX_SAP_CLIENTS 4 +#define RPU_DATA_CMD_SIZE_MAX_RX 8 + +#define NRF_WIFI_RPU_PWR_DATA_TYPE_LFC_ERR 0 +#define NRF_WIFI_RPU_PWR_DATA_TYPE_VBAT_MON 1 +#define NRF_WIFI_RPU_PWR_DATA_TYPE_TEMP 2 +#define NRF_WIFI_RPU_PWR_DATA_TYPE_ALL 3 +#define NRF_WIFI_RPU_PWR_DATA_TYPE_MAX 4 + +#define NRF_WIFI_ETH_ADDR_LEN 6 +#define NRF_WIFI_COUNTRY_CODE_LEN 2 +#define MAX_TX_AGG_SIZE 16 +#define MAX_RX_BUFS_PER_EVNT 64 + +#define AGGR_DISABLE 0 +#define AGGR_ENABLE 1 + +#define NRF_WIFI_UMAC_VER(version) (((version)&0xFF000000) >> 24) +#define NRF_WIFI_UMAC_VER_MAJ(version) (((version)&0x00FF0000) >> 16) +#define NRF_WIFI_UMAC_VER_MIN(version) (((version)&0x0000FF00) >> 8) +#define NRF_WIFI_UMAC_VER_EXTRA(version) (((version)&0x000000FF) >> 0) + +/** + * struct host_rpu_msg_hdr - Common header included in each command/event. + * @len: Length of the message. + * @resubmit: Flag to indicate whether the recipient is expected to resubmit + * the cmd/event address back to the trasmitting entity. + * + * This structure encapsulates the common information included at the start of + * each command/event exchanged with the RPU. + */ + +struct host_rpu_msg_hdr { + unsigned int len; + unsigned int resubmit; +} __NRF_WIFI_PKD; + +/** + * @brief This enum defines the different categories of messages that can be exchanged between + * the Host and the RPU. + * + */ +enum nrf_wifi_host_rpu_msg_type { + /** System interface messages */ + NRF_WIFI_HOST_RPU_MSG_TYPE_SYSTEM, + /** Unused */ + NRF_WIFI_HOST_RPU_MSG_TYPE_SUPPLICANT, + /** Data path messages */ + NRF_WIFI_HOST_RPU_MSG_TYPE_DATA, + /** Control path messages */ + NRF_WIFI_HOST_RPU_MSG_TYPE_UMAC +}; +/** + * @brief This structure defines the common message header used to encapsulate each message + * exchanged between the Host and UMAC. + * + */ + +struct host_rpu_msg { + /** Header */ + struct host_rpu_msg_hdr hdr; + /** Type of the RPU message see &enum nrf_wifi_host_rpu_msg_type */ + signed int type; + /** Actual message */ + signed char msg[0]; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_PENDING_FRAMES_BITMAP_AC_VO (1 << 0) +#define NRF_WIFI_PENDING_FRAMES_BITMAP_AC_VI (1 << 1) +#define NRF_WIFI_PENDING_FRAMES_BITMAP_AC_BE (1 << 2) +#define NRF_WIFI_PENDING_FRAMES_BITMAP_AC_BK (1 << 3) + +#define USE_PROTECTION_NONE 0 +#define USE_PROTECTION_RTS 1 +#define USE_PROTECTION_CTS2SELF 2 + +#define USE_SHORT_PREAMBLE 0 +#define DONT_USE_SHORT_PREAMBLE 1 + +#define MARK_RATE_AS_MCS_INDEX 0x80 +#define MARK_RATE_AS_RATE 0x00 + +#define ENABLE_GREEN_FIELD 0x01 +#define ENABLE_CHNL_WIDTH_40MHZ 0x02 +#define ENABLE_SGI 0x04 +#define ENABLE_11N_FORMAT 0x08 +#define ENABLE_VHT_FORMAT 0x10 +#define ENABLE_CHNL_WIDTH_80MHZ 0x20 + +#define MAX_MGMT_BUFS 16 + +#define MAX_RF_CALIB_DATA 900 + +#define PHY_THRESHOLD_NORMAL (-65) +#define PHY_THRESHOLD_PROD_MODE (-93) + +#define MAX_TX_STREAMS 1 +#define MAX_RX_STREAMS 1 + +#define MAX_NUM_VIFS 2 +#define MAX_NUM_STAS 2 +#define MAX_NUM_APS 1 + +/** + * @brief This enum provides a list of different operating modes. + * + */ +enum rpu_op_mode { + /** Radio test mode is used for performing radio tests using + * continuous Tx/Rx on a configured channel at a particular rate or power. + */ + RPU_OP_MODE_RADIO_TEST, + /** In this mode different types of calibration like RF calibration can be performed */ + RPU_OP_MODE_FCM, + /** Regular mode of operation */ + RPU_OP_MODE_REG, + /** Debug mode can be used to control certain parameters like TX rate + * in order to debug functional issues. + */ + RPU_OP_MODE_DBG, + /** Highest mode number currently defined */ + RPU_OP_MODE_MAX +}; + +/** + * @brief This enum defines various types of statistics. + */ +enum rpu_stats_type { + /** All statistics includes PHY, LMAC & UMAC */ + RPU_STATS_TYPE_ALL, + /** Host statistics */ + RPU_STATS_TYPE_HOST, + /** UMAC statistics */ + RPU_STATS_TYPE_UMAC, + /** LMAC statistics*/ + RPU_STATS_TYPE_LMAC, + /** PHY statistics */ + RPU_STATS_TYPE_PHY, + /** Offloaded Raw TX statistics */ + RPU_STATS_TYPE_OFFLOADED_RAW_TX, + /** Highest statistics type number currently defined */ + RPU_STATS_TYPE_MAX +}; + +/** + * @brief- Throughput mode + * Throughput mode to be used for transmitting the packet. + */ +enum rpu_tput_mode { + /** Legacy mode */ + RPU_TPUT_MODE_LEGACY, + /** High Throuput mode(11n) */ + RPU_TPUT_MODE_HT, + /** Very hight throughput(11ac) */ + RPU_TPUT_MODE_VHT, + /** HE SU mode */ + RPU_TPUT_MODE_HE_SU, + /** HE ER SU mode */ + RPU_TPUT_MODE_HE_ER_SU, + /** HE TB mode */ + RPU_TPUT_MODE_HE_TB, + /** Highest throughput mode currently defined */ + RPU_TPUT_MODE_MAX +}; + +/** + * @brief - System commands. + * + */ +enum nrf_wifi_sys_commands { + /** Command to initialize RPU and RPU responds with NRF_WIFI_EVENT_INIT_DONE */ + NRF_WIFI_CMD_INIT, + /** command to send a Tx packet in radiotest mode */ + NRF_WIFI_CMD_TX, + /** Unused */ + NRF_WIFI_CMD_IF_TYPE, + /** command to specify mode of operation */ + NRF_WIFI_CMD_MODE, + /** command to get statistics */ + NRF_WIFI_CMD_GET_STATS, + /** command to clear statistics */ + NRF_WIFI_CMD_CLEAR_STATS, + /** command to ENABLE/DISABLE receiving packets in radiotest mode */ + NRF_WIFI_CMD_RX, + /** Command to measure battery voltage and RPU responds with NRF_WIFI_EVENT_PWR_DATA */ + NRF_WIFI_CMD_PWR, + /** RPU De-initialization */ + NRF_WIFI_CMD_DEINIT, + /** Command for WIFI & SR coexistence */ + NRF_WIFI_CMD_SRCOEX, + /** Command to start RF test */ + NRF_WIFI_CMD_RF_TEST, + /** Configure HE_GI & HE_LTF */ + NRF_WIFI_CMD_HE_GI_LTF_CONFIG, + /** Command for getting UMAC memory statistics */ + NRF_WIFI_CMD_UMAC_INT_STATS, + /** Command for Setting the channel & Rf params in radiotest mode */ + NRF_WIFI_CMD_RADIO_TEST_INIT, + /** Command for setting country in radiotest mode */ + NRF_WIFI_CMD_RT_REQ_SET_REG, + /** Command to enable/disable fixed data rate in regular mode */ + NRF_WIFI_CMD_TX_FIX_DATA_RATE, + /** Command to set channel in promiscuous, monitor & packet injector mode */ + NRF_WIFI_CMD_CHANNEL, + /** Command to configure promiscuous mode, Monitor mode & packet injector mode */ + NRF_WIFI_CMD_RAW_CONFIG_MODE, + /** Command to configure promiscuous mode, Monitor mode filter*/ + NRF_WIFI_CMD_RAW_CONFIG_FILTER, + /** Command to configure packet injector mode or Raw Tx mode */ + NRF_WIFI_CMD_RAW_TX_PKT, + /** Command to reset interface statistics */ + NRF_WIFI_CMD_RESET_STATISTICS, + /** Command to configure raw tx offloading parameters */ + NRF_WIFI_CMD_OFFLOAD_RAW_TX_PARAMS, + /** Command to enable/disable raw tx offloading */ + NRF_WIFI_CMD_OFFLOAD_RAW_TX_CTRL, + /** Configure SGI/LGI */ + NRF_WIFI_CMD_GI_CONFIG, +}; + +/** + * @brief - Events from the RPU. + * + */ +enum nrf_wifi_sys_events { + /** Response to NRF_WIFI_CMD_PWR */ + NRF_WIFI_EVENT_PWR_DATA, + /** Response to NRF_WIFI_CMD_INIT */ + NRF_WIFI_EVENT_INIT_DONE, + /** Response to NRF_WIFI_CMD_GET_STATS */ + NRF_WIFI_EVENT_STATS, + /** Response to NRF_WIFI_CMD_DEINIT */ + NRF_WIFI_EVENT_DEINIT_DONE, + /** Response to NRF_WIFI_CMD_RF_TEST */ + NRF_WIFI_EVENT_RF_TEST, + /** Response to NRF_WIFI_CMD_SRCOEX. */ + NRF_WIFI_EVENT_COEX_CONFIG, + /** Response to NRF_WIFI_CMD_UMAC_INT_STATS */ + NRF_WIFI_EVENT_INT_UMAC_STATS, + /** Command status events for radio test commands*/ + NRF_WIFI_EVENT_RADIOCMD_STATUS, + /** Response to NRF_WIFI_CMD_CHANNEL */ + NRF_WIFI_EVENT_CHANNEL_SET_DONE, + /** Response to NRF_WIFI_CMD_RAW_CONFIG_MODE */ + NRF_WIFI_EVENT_MODE_SET_DONE, + /** Response to NRF_WIFI_CMD_RAW_CONFIG_FILTER */ + NRF_WIFI_EVENT_FILTER_SET_DONE, + /** Tx done event for the Raw Tx */ + NRF_WIFI_EVENT_RAW_TX_DONE, + /** Command status events for offloaded raw tx commands */ + NRF_WIFI_EVENT_OFFLOADED_RAWTX_STATUS, +}; + +/** + * @brief - Channel Bandwidth types. + * + **/ +enum rpu_ch_bw { + /** 20MHz bandwidth */ + RPU_CH_BW_20, + /** 40MHz bandwidth */ + RPU_CH_BW_40, + /** 80MHz bandwidth */ + RPU_CH_BW_MAX +}; + +/** + * @brief - This structure specifies the parameters required to configure a specific channel. + * + */ +struct chan_params { + /** Operating band see enum op_band */ + unsigned int op_band; + /** Primary channel number */ + unsigned int primary_num; + /** Channel bandwidth */ + unsigned char bw; + /** 20Mhz offset value */ + signed int sec_20_offset; + /** 40Mhz offset value */ + signed int sec_40_offset; +} __NRF_WIFI_PKD; + +/** + * @brief This structure specifies the parameters required to start or stop the RX (receive) + * operation in radiotest mode. + * + */ +struct rpu_conf_rx_radio_test_params { + /** Number of spatial streams supported. Currently unused. */ + unsigned char nss; + /* Input to the RF for operation */ + unsigned char rf_params[NRF_WIFI_RF_PARAMS_SIZE]; + /** An array containing RF and baseband control params */ + struct chan_params chan; + /** Copy OTP params to this memory */ + signed char phy_threshold; + /** Calibration bit map value. More information can be found in the phy_rf_params.h file. + */ + unsigned int phy_calib; + /** Start Rx : 1, Stop Rx :0 */ + unsigned char rx; +} __NRF_WIFI_PKD; + +/** + * @brief This structure specifies the UMAC (Upper MAC) RX (receive) debug parameters + * specifically designed for debugging purpose. + * + */ + +struct umac_rx_dbg_params { + /** Total lmac events received to UMAC */ + unsigned int lmac_events; + /** Total Rx events(LMAC_EVENT_RX) received in ISR */ + unsigned int rx_events; + /** Received coalised events from LMAC */ + unsigned int rx_coalesce_events; + /** Total Rx packets received from LMAC */ + unsigned int total_rx_pkts_from_lmac; + /** Maximum RX packets buffered at any point of time in UMAC.*/ + unsigned int max_refill_gap; + /** Difference between rx packets received from lmac and packets sent to host */ + unsigned int current_refill_gap; + /** Number of Packets queued to reorder buffer due to out of order */ + unsigned int out_of_order_mpdus; + /** Number of packets removed from reorder buffer */ + unsigned int reorder_free_mpdus; + /** Number of Rx packets resubmitted to LMAC by UMAC */ + unsigned int umac_consumed_pkts; + /** Number of Rx packets sent to Host for resubmiting */ + unsigned int host_consumed_pkts; + /** Total events posted to UMAC RX thread from LMAC */ + unsigned int rx_mbox_post; + /** Total events received to UMAC RX thread from LMAC */ + unsigned int rx_mbox_receive; + /** Number of packets received in out of order */ + unsigned int reordering_ampdu; + /** Messages posted to TX mbox from timer ISR */ + unsigned int timer_mbox_post; + /** Messages received from timer ISR */ + unsigned int timer_mbox_rcv; + /** Messages posted to TX mbox from work scheduler */ + unsigned int work_mbox_post; + /** Messages received from work scheduler */ + unsigned int work_mbox_rcv; + /** Messages posted to TX mbox from tasklet function */ + unsigned int tasklet_mbox_post; + /** Messages received from tasklet function */ + unsigned int tasklet_mbox_rcv; + /** Management frames sent to userspace */ + unsigned int userspace_offload_frames; + /** Number of times where requested buffer size is not available + * and allocated from next available memory buffer + */ + unsigned int alloc_buf_fail; + /** Total packets count in RX thread */ + unsigned int rx_packet_total_count; + /** Number of data packets received */ + unsigned int rx_packet_data_count; + /** Number of Qos data packets received */ + unsigned int rx_packet_qos_data_count; + /** Number of protected data packets received */ + unsigned int rx_packet_protected_data_count; + /** Number of management packets received */ + unsigned int rx_packet_mgmt_count; + /** Number of beacon packets received */ + unsigned int rx_packet_beacon_count; + /** Number of probe response packets received */ + unsigned int rx_packet_probe_resp_count; + /** Number of authentication packets received */ + unsigned int rx_packet_auth_count; + /** Number of deauthentication packets received */ + unsigned int rx_packet_deauth_count; + /** Number of assoc response packets received */ + unsigned int rx_packet_assoc_resp_count; + /** Number of disassociation packets received */ + unsigned int rx_packet_disassoc_count; + /** Number of action frames received */ + unsigned int rx_packet_action_count; + /** Number of probe request packets received */ + unsigned int rx_packet_probe_req_count; + /** Other management packets received */ + unsigned int rx_packet_other_mgmt_count; + /** Maximum coalised packets received from LMAC in any RX event */ + signed char max_coalesce_pkts; + /** Packets received with null skb pointer from LMAC */ + unsigned int null_skb_pointer_from_lmac; + /** Number of unexpected management packets received in coalesce event */ + unsigned int unexpected_mgmt_pkt; + /** Number of packets flushed from reorder buffer before going to sleep */ + unsigned int reorder_flush_pkt_count; + /** Unprotected error data frames received in security mode */ + unsigned int unsecured_data_error; + /** Packets received with null skb pointer from LMAC in coalesce event */ + unsigned int pkts_in_null_skb_pointer_event; +} __NRF_WIFI_PKD; + +/** + * @brief This structure specifies the UMAC TX (transmit) debug parameters used for + * debugging purposes. + * + */ +struct umac_tx_dbg_params { + /** Total number of tx commands received from host */ + unsigned int tx_cmd; + /** Non coalesce packets received */ + unsigned int tx_non_coalesce_pkts_rcvd_from_host; + /** coalesce packets received */ + unsigned int tx_coalesce_pkts_rcvd_from_host; + /** Maximum number of coalesce packets received in any + * TX command coalesce packets received + */ + unsigned int tx_max_coalesce_pkts_rcvd_from_host; + /** Maximum Tx commands currently in process at any point of time in UMAC */ + unsigned int tx_cmds_max_used; + /** Number of Tx commands that are currently in process in UMAC */ + unsigned int tx_cmds_currently_in_use; + /** Number of tx done events sent to host */ + unsigned int tx_done_events_send_to_host; + /** Number of tx done success packets sent to host */ + unsigned int tx_done_success_pkts_to_host; + /** Number of tx done failure packets sent to host */ + unsigned int tx_done_failure_pkts_to_host; + /** Number of packets received from host that needs to be encrypted */ + unsigned int tx_cmds_with_crypto_pkts_rcvd_from_host; + /** Number of packets received from host that need not to be encrypted */ + unsigned int tx_cmds_with_non_crypto_pkts_rcvd_from_host; + /** Number of broadcast packets received from host */ + unsigned int tx_cmds_with_broadcast_pkts_rcvd_from_host; + /** Number of multicast packets received from host */ + unsigned int tx_cmds_with_multicast_pkts_rcvd_from_host; + /** Number of unicast packets received from host */ + unsigned int tx_cmds_with_unicast_pkts_rcvd_from_host; + /** UMAC internal count */ + unsigned int xmit; + /** Number of addba requests sent */ + unsigned int send_addba_req; + /** Total ADD BA responses received from host */ + unsigned int addba_resp; + /** Total packets received in softmac tx function */ + unsigned int softmac_tx; + /** Number of packets generated internally in UMAC */ + unsigned int internal_pkts; + /** Number of packets Received from host */ + unsigned int external_pkts; + /** Total tx commmands sent to lmac */ + unsigned int tx_cmds_to_lmac; + /** Tx dones received from LMAC */ + unsigned int tx_dones_from_lmac; + /** Total commands sent to lmac in UMAC hal */ + unsigned int total_cmds_to_lmac; + /** Number of data packets sent */ + unsigned int tx_packet_data_count; + /** Number of management packets sent */ + unsigned int tx_packet_mgmt_count; + /** Number of beacon packets sent */ + unsigned int tx_packet_beacon_count; + /** Number of probe request packets sent */ + unsigned int tx_packet_probe_req_count; + /** Number of authentication packets sent */ + unsigned int tx_packet_auth_count; + /** Number of deauthentication packets sent */ + unsigned int tx_packet_deauth_count; + /** Number of association request packets sent */ + unsigned int tx_packet_assoc_req_count; + /** Number of disassociation packets sent */ + unsigned int tx_packet_disassoc_count; + /** Number of action packets sent */ + unsigned int tx_packet_action_count; + /** Other management packets sent */ + unsigned int tx_packet_other_mgmt_count; + /** Number of Non management packets sent */ + unsigned int tx_packet_non_mgmt_data_count; + +} __NRF_WIFI_PKD; + +/** + * @brief This structure specifies the UMAC command and event debug parameters used for + * debugging purpose. + * + */ +struct umac_cmd_evnt_dbg_params { + /** Number of command init received from host */ + unsigned char cmd_init; + /** Number of init_done events sent to host */ + unsigned char event_init_done; + /** Number of rf test command received from host */ + unsigned char cmd_rf_test; + /** Number of connect command received from host */ + unsigned char cmd_connect; + /** Number of get_stats command received from host */ + unsigned int cmd_get_stats; + /** Number of power save state events sent to host */ + unsigned int event_ps_state; + /** Unused*/ + unsigned int cmd_set_reg; + /** Number of get regulatory commands received from host */ + unsigned int cmd_get_reg; + /** Number of request set regulatory commands received from host */ + unsigned int cmd_req_set_reg; + /** Number of trigger scan commands received from host */ + unsigned int cmd_trigger_scan; + /** Number of scan done events sent to host */ + unsigned int event_scan_done; + /** Number of get scan commands received from the host to get scan results */ + unsigned int cmd_get_scan; + /** Number of scan commands sent to LMAC */ + unsigned int umac_scan_req; + /** Number of scan complete events received from LMAC */ + unsigned int umac_scan_complete; + /** Number of scan requests received from host when previous scan is in progress */ + unsigned int umac_scan_busy; + /** Number of authentication requests received from host */ + unsigned int cmd_auth; + /** Number of association requests received from host */ + unsigned int cmd_assoc; + /** Number of deauthentication requests received from host */ + unsigned int cmd_deauth; + /** Number of register frame commands received from host to register + * a management frame type which should be passed to host + */ + unsigned int cmd_register_frame; + /** Number of command frames from host which will be used for + * transmitting management frames + */ + unsigned int cmd_frame; + /** Number of delete key commands from host */ + unsigned int cmd_del_key; + /** Number of new key commands received from host */ + unsigned int cmd_new_key; + /** Number of set key commands received from host */ + unsigned int cmd_set_key; + /** Number of get key commands received from host */ + unsigned int cmd_get_key; + /** Number of beacon hint events sent to host */ + unsigned int event_beacon_hint; + /** Number of regulatory change events sent to host when regulatory change command + * received from host such as in response to command NL80211_CMD_REG_CHANGE + */ + unsigned int event_reg_change; + /** Number of regulatory change events sent to host other than + * host request for regulatory change + */ + unsigned int event_wiphy_reg_change; + /** Number of set station commands received from host */ + unsigned int cmd_set_station; + /** Number of new station commands received from host */ + unsigned int cmd_new_station; + /** Number of del station commands received from host */ + unsigned int cmd_del_station; + /** Number of new interface commands received from host */ + unsigned int cmd_new_interface; + /** Number of set interface commands received from host */ + unsigned int cmd_set_interface; + /** Number of get interface commands received from host */ + unsigned int cmd_get_interface; + /** Number of set_ifflags commands received from host */ + unsigned int cmd_set_ifflags; + /** Number of set_ifflags events sent to host */ + unsigned int cmd_set_ifflags_done; + /** Number of set bss command received from host */ + unsigned int cmd_set_bss; + /** Number of set wiphy command received from host */ + unsigned int cmd_set_wiphy; + /** Number of start access point command received from host */ + unsigned int cmd_start_ap; + /** Number of power save configuration commands sent to LMAC */ + unsigned int LMAC_CMD_PS; + /** Current power save state configured to LMAC through LMAC_CMD_PS command */ + unsigned int CURR_STATE; +} __NRF_WIFI_PKD; + +/** + * @brief This structure specifies the UMAC interface debug parameters used for debugging purpose. + * + */ +struct nrf_wifi_interface_stats { + /** Number of unicast packets sent */ + unsigned int tx_unicast_pkt_count; + /** Number of multicast packets sent */ + unsigned int tx_multicast_pkt_count; + /** Number of broadcast packets sent */ + unsigned int tx_broadcast_pkt_count; + /** Number of tx data bytes sent */ + unsigned int tx_bytes; + /** Number of unicast packets received */ + unsigned int rx_unicast_pkt_count; + /** Number of multicast packets received */ + unsigned int rx_multicast_pkt_count; + /** Number of broadcast packets received */ + unsigned int rx_broadcast_pkt_count; + /** Number of beacon packets received */ + unsigned int rx_beacon_success_count; + /** Number of beacon packets missed */ + unsigned int rx_beacon_miss_count; + /** Number of rx data bytes received */ + unsigned int rx_bytes; + /** Number of packets with checksum mismatch received */ + unsigned int rx_checksum_error_count; + /** Number of duplicate packets received */ + unsigned int replay_attack_drop_cnt; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines the UMAC debug statistics. It contains the necessary parameters + * and fields used to gather and present debugging statistics within the UMAC layer. + * + */ +struct rpu_umac_stats { + /** Transmit debug statistics @ref umac_tx_dbg_params */ + struct umac_tx_dbg_params tx_dbg_params; + /** Receive debug statistics @ref umac_rx_dbg_params */ + struct umac_rx_dbg_params rx_dbg_params; + /** Command Event debug statistics @ref umac_cmd_evnt_dbg_params */ + struct umac_cmd_evnt_dbg_params cmd_evnt_dbg_params; + /** Interface debug parameters @ref nrf_wifi_interface_stats */ + struct nrf_wifi_interface_stats interface_data_stats; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines the LMAC debug parameters. + * + */ +struct rpu_lmac_stats { + /** Number of reset command counts from UMAC */ + unsigned int reset_cmd_cnt; + /** Number of reset complete events sent to UMAC */ + unsigned int reset_complete_event_cnt; + /** Number of events unable to generate */ + unsigned int unable_gen_event; + /** Number of channel program commands from UMAC */ + unsigned int ch_prog_cmd_cnt; + /** Number of channel program done events to UMAC */ + unsigned int channel_prog_done; + /** Number of Tx commands from UMAC */ + unsigned int tx_pkt_cnt; + /** Number of Tx done events to UMAC */ + unsigned int tx_pkt_done_cnt; + /** Unused */ + unsigned int scan_pkt_cnt; + /** Number of internal Tx packets */ + unsigned int internal_pkt_cnt; + /** Number of Tx dones for internal packets */ + unsigned int internal_pkt_done_cnt; + /** Number of acknowledgment responses */ + unsigned int ack_resp_cnt; + /** Number of transmit timeouts */ + unsigned int tx_timeout; + /** Number of deaggregation ISRs */ + unsigned int deagg_isr; + /** Number of deaggregation input descriptor empties */ + unsigned int deagg_inptr_desc_empty; + /** Number of deaggregation circular buffer full events */ + unsigned int deagg_circular_buffer_full; + /** Number of LMAC received ISRs */ + unsigned int lmac_rxisr_cnt; + /** Number of received packets decrypted */ + unsigned int rx_decryptcnt; + /** Number of packet decryption failures during processing */ + unsigned int process_decrypt_fail; + /** Number of RX event preparation failures */ + unsigned int prepa_rx_event_fail; + /** Number of RX core pool full counts */ + unsigned int rx_core_pool_full_cnt; + /** Number of RX MPDU CRC successes */ + unsigned int rx_mpdu_crc_success_cnt; + /** Number of RX MPDU CRC failures */ + unsigned int rx_mpdu_crc_fail_cnt; + /** Number of RX OFDM CRC successes */ + unsigned int rx_ofdm_crc_success_cnt; + /** Number of RX OFDM CRC failures */ + unsigned int rx_ofdm_crc_fail_cnt; + /** Number of RX DSSS CRC successes */ + unsigned int rxDSSSCrcSuccessCnt; + /** Number of RX DSSS CRC failures */ + unsigned int rxDSSSCrcFailCnt; + /** Number of RX crypto start counts */ + unsigned int rx_crypto_start_cnt; + /** Number of RX crypto done counts */ + unsigned int rx_crypto_done_cnt; + /** Number of RX event buffer full counts */ + unsigned int rx_event_buf_full; + /** Number of RX external RAM buffer full counts */ + unsigned int rx_extram_buf_full; + /** Number of scan requests receive from UMAC */ + unsigned int scan_req; + /** Number of scan complete events sent to UMAC */ + unsigned int scan_complete; + /** Number of scan abort requests */ + unsigned int scan_abort_req; + /** Number of scan abort complete events */ + unsigned int scan_abort_complete; + /** Number of internal buffer pool null counts */ + unsigned int internal_buf_pool_null; + /** RPU hardware lockup event detection count */ + unsigned int rpu_hw_lockup_count; + /** RPU hardware lockup recovery completed count */ + unsigned int rpu_hw_lockup_recovery_done; + /** Number of Signal quality indication commands from host */ + unsigned int SQICmdsCnt; + /** Signal Qualidy Idication event from lmac */ + unsigned int SQIEventsCnt; + /** Configured sleep type */ + unsigned int SleepType; + /** Number of warm boot /sleep cycles in RPU */ + unsigned int warmBootCnt; +} __NRF_WIFI_PKD; + + +/** + * @brief This structure defines the PHY (Physical Layer) debug statistics. + * + */ +struct rpu_phy_stats { + /** Rssi average value received from LMAC */ + signed char rssi_avg; + /** Unused */ + unsigned char pdout_val; + /** Number of OFDM CRC Pass packets */ + unsigned int ofdm_crc32_pass_cnt; + /** Number of OFDM CRC Fail packets */ + unsigned int ofdm_crc32_fail_cnt; + /** Number of DSSS CRC Pass packets */ + unsigned int dsss_crc32_pass_cnt; + /** Number of DSSS CRC Fail packets */ + unsigned int dsss_crc32_fail_cnt; +} __NRF_WIFI_PKD; + + +/** + * @brief The UMAC header structure for system commands and events defines the format + * used to transmit and receive system-level commands and events. + * + */ +struct nrf_wifi_sys_head { + /** Command/Event id */ + unsigned int cmd_event; + /** message length */ + unsigned int len; +} __NRF_WIFI_PKD; + +/** Feature Disable */ +#define NRF_WIFI_FEATURE_DISABLE 0 +/** Feature Enable */ +#define NRF_WIFI_FEATURE_ENABLE 1 + +/** + * @brief The maximum Rx (receive) A-MPDU size in KB. + * + */ +enum max_rx_ampdu_size { + /** 8KB AMPDU Size */ + MAX_RX_AMPDU_SIZE_8KB, + /** 16KB AMPDU Size */ + MAX_RX_AMPDU_SIZE_16KB, + /** 32KB AMPDU Size */ + MAX_RX_AMPDU_SIZE_32KB, + /** 64KB AMPDU Size */ + MAX_RX_AMPDU_SIZE_64KB +}; + +/** + * @brief This structure specifies the configuration parameters used for configuring + * data-related settings. + * + */ + +struct nrf_wifi_data_config_params { + /** rate_protection_type:0->NONE, 1->RTS/CTS, 2->CTS2SELF */ + unsigned char rate_protection_type; + /** Aggregation is enabled(NRF_WIFI_FEATURE_ENABLE) or + * disabled(NRF_WIFI_FEATURE_DISABLE) + */ + unsigned char aggregation; + /** WMM is enabled(NRF_WIFI_FEATURE_ENABLE) or + * disabled(NRF_WIFI_FEATURE_DISABLE) + */ + unsigned char wmm; + /** Max number of aggregated TX sessions */ + unsigned char max_num_tx_agg_sessions; + /** Max number of aggregated RX sessions */ + unsigned char max_num_rx_agg_sessions; + /** maximum aggregation size */ + unsigned char max_tx_aggregation; + /** Reorder buffer size (1 to 64) */ + unsigned char reorder_buf_size; + /** Max RX AMPDU size (8/16/32/64 KB), see &enum max_rx_ampdu_size */ + signed int max_rxampdu_size; +} __NRF_WIFI_PKD; + +/** + * @brief This structure specifies the parameters that need to be provided for the command + * NRF_WIFI_CMD_INIT for all modes. The NRF_WIFI_CMD_INIT command is typically used to + * initialize the Wi-Fi module and prepare it for further communication. + * + */ +struct nrf_wifi_sys_params { + /** enable rpu sleep */ + unsigned int sleep_enable; + /** Normal/FTM mode */ + unsigned int hw_bringup_time; + /** Antenna Configuration, applicable only for 1x1 */ + unsigned int sw_bringup_time; + /** Internal tuning parameter */ + unsigned int bcn_time_out; + /** Set to 1 if rpu is expected to perform sleep clock calibration */ + unsigned int calib_sleep_clk; + /** calib bit map value. More info can be found in phy_rf_params.h NRF_WIFI_DEF_PHY_CALIB */ + unsigned int phy_calib; + /** MAC address of the interface. Not applicable to Radio Test mode */ + unsigned char mac_addr[NRF_WIFI_ETH_ADDR_LEN]; + /** An array containing RF & baseband control params */ + unsigned char rf_params[NRF_WIFI_RF_PARAMS_SIZE]; + /** Indicates whether the rf_params has a valid value */ + unsigned char rf_params_valid; +} __NRF_WIFI_PKD; + + +/** + * @brief This structure defines the parameters used to control the transmit (TX) power. + * + */ + +struct nrf_wifi_tx_pwr_ctrl_params { + /** Antenna gain for 2.4 GHz band */ + unsigned char ant_gain_2g; + /** Antenna gain for 5 GHz band (5150 MHz - 5350 MHz) */ + unsigned char ant_gain_5g_band1; + /** Antenna gain for 5 GHz band (5470 MHz - 5730 MHz) */ + unsigned char ant_gain_5g_band2; + /** Antenna gain for 5 GHz band (5730 MHz - 5895 MHz) */ + unsigned char ant_gain_5g_band3; +} __NRF_WIFI_PKD; + +/** + * @brief This enum defines different types of operating bands in 6G + * Inband scanning. + */ +enum scan_type_6g { + /** Active scan : PSC channels scanning */ + ACTIVE_PSC, + /** Passive scan : Unsolicited probe responses*/ + UNSOLIC_PROBE_RESPONSE, + /** Passive scan : Fast Initial Link Setup Frames */ + FILS +}; +/** + * @brief This enum defines different types of operating bands. + * + */ +enum op_band { + /** All bands */ + BAND_ALL, + /** 2.4Ghz band */ + BAND_24G, + /** 5 GHz band */ + BAND_5G, + /** 6 GHz band */ + BAND_6G, + /** 2.4Ghz & 5GHz band */ + BAND_DUAL +}; + +/** + * @brief This enum defines keep alive state + * + */ +enum nrf_wifi_keep_alive_status { + /** Keep alive feature disabled */ + KEEP_ALIVE_DISABLED = 0, + /** Keep alive feature enabled */ + KEEP_ALIVE_ENABLED = 1 +}; + +/** + * @brief This enum specifies the type of frames used to retrieve buffered data + * from the AP in power save mode. + */ +enum ps_exit_strategy { + /** Uses an intelligent algo and decide whether to + * stay or exit power save mode to receive buffered frames. + */ + INT_PS = 0, + /** Exits power save mode for every TIM */ + EVERY_TIM +}; + +struct rx_buf_pool_params { + unsigned short buf_sz; + unsigned short num_bufs; +} __NRF_WIFI_PKD; + +struct temp_vbat_config { + unsigned int temp_based_calib_en; + unsigned int temp_calib_bitmap; + unsigned int vbat_calibp_bitmap; + unsigned int temp_vbat_mon_period; + int vth_very_low; + int vth_low; + int vth_hi; + int temp_threshold; + int vbat_threshold; +} __NRF_WIFI_PKD; + +#define TWT_EXTEND_SP_EDCA 0x1 +#define DISABLE_DFS_CHANNELS 0x2 + +/** + * @brief This structure defines the command responsible for initializing the UMAC. + * After the host driver brings up, the host sends NRF_WIFI_CMD_INIT to the RPU. + * The RPU then performs the initialization and responds with NRF_WIFI_EVENT_INIT_DONE + * once the initialization is completed. + * + */ + +struct nrf_wifi_cmd_sys_init { + /** umac header, @ref nrf_wifi_sys_head */ + struct nrf_wifi_sys_head sys_head; + /** id of the interface */ + unsigned int wdev_id; + /** @ref nrf_wifi_sys_params */ + struct nrf_wifi_sys_params sys_params; + /** LMAC Rx buffs pool params, @ref rx_buf_pool_params */ + struct rx_buf_pool_params rx_buf_pools[MAX_NUM_OF_RX_QUEUES]; + /** Data configuration params, @ref nrf_wifi_data_config_params */ + struct nrf_wifi_data_config_params data_config_params; + /** Calibration trigger control info based on battery voltage and temperature changes. + * @ref temp_vbat_config from lmac_if_common.h + */ + struct temp_vbat_config temp_vbat_config_params; + /** Country code to set */ + unsigned char country_code[NRF_WIFI_COUNTRY_CODE_LEN]; + /** Operating band see enum op_band */ + unsigned int op_band; + /** Offload mgmt buffer refill to UMAC when enabled */ + unsigned char mgmt_buff_offload; + /** Enable features from driver config */ + unsigned int feature_flags; + /** To deactivate beamforming, By default the RPU enables the beamforming feature. + * If a user wishes to turn it off, they should set this parameter to 1. + */ + unsigned int disable_beamforming; + /** The RPU uses this value (in seconds) to decide how long to wait + * without receiving beacons before disconnection. + */ + unsigned int discon_timeout; + /** RPU uses QoS null frame or PS-Poll frame to retrieve buffered frames + * from the AP in power save @ref ps_exit_strategy. + */ + unsigned char ps_exit_strategy; + /** The RPU uses this value to configure watchdog timer */ + unsigned int watchdog_timer_val; + /** The RPU uses this value to decide whether keep alive + * feature is enabled or not see enum keep_alive_status + */ + unsigned char keep_alive_enable; + /** The RPU uses this value(in seconds) for periodicity of the keep + * alive frame. + */ + unsigned int keep_alive_period; + /** The RPU uses this value to define the limit on display scan BSS entries. + * By default, the limit is set to 250 in scan-only mode and 150 in regular mode. + * If this value is greater than 0, it overrides the default limits. + */ + unsigned int display_scan_bss_limit; + /** The RPU uses this value to enable/disable priority window for Wi-Fi scan + * in the case of coexistence with Short Range radio. + */ + unsigned int coex_disable_ptiwin_for_wifi_scan; + /** The RPU uses this value to enable : 1 or disable : 0 the transmission of + * beacon and probe responses to the host when mgmt buffer offloading is enabled. + */ + unsigned char raw_scan_enable; + /** The RPU uses this value for the number of PS-POLL failures + * to switch from ps-poll power save mode to QoS null-based + * power save mode. + * MIN: 10 (default), MAX: 0xfffffffe. + * Set to 0xffffffff to disable this feature. + */ + unsigned int max_ps_poll_fail_cnt; + /** Enables or disables RX STBC in HT mode. + * By default, RX STBC is enabled. + */ + unsigned int stbc_enable_in_ht; + /* Enables(1) or Disables(0) Dynamic bandwidth signalling control */ + unsigned int dbs_war_ctrl; + /* Enables(1) or Disables(0) Dynamic ED*/ + unsigned int dynamic_ed; + /** The RPU uses this value to enable/disable priority window for Wi-Fi scan + * in the case of coexistence with Short Range radio. + */ + unsigned int inband_scan_type; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines the command used to de-initialize the RPU. + * + */ + +struct nrf_wifi_cmd_sys_deinit { + /** umac header, @ref nrf_wifi_sys_head */ + struct nrf_wifi_sys_head sys_head; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_HE_GI_800NS 0 +#define NRF_WIFI_HE_GI_1600NS 1 +#define NRF_WIFI_HE_GI_3200NS 2 + +#define NRF_WIFI_HE_LTF_3200NS 0 +#define NRF_WIFI_HE_LTF_6400NS 1 +#define NRF_WIFI_HE_LTF_12800NS 2 + +/** + * @brief This structure defines the command used to configure + * High-Efficiency Guard Interval(HE-GI) and High-Efficiency Long Training Field (HE-LTF). + * + * HE-GI duration determines the guard interval length used in the HE transmission. + * HE-LTF is used for channel estimation and signal detection in HE transmissions. + * + */ + +struct nrf_wifi_cmd_he_gi_ltf_config { + /** umac header, see &nrf_wifi_sys_head */ + struct nrf_wifi_sys_head sys_head; + /** wdev interface id */ + unsigned char wdev_id; + /** HE GI type (NRF_WIFI_HE_GI_800NS/NRF_WIFI_HE_GI_1600NS/NRF_WIFI_HE_GI_3200NS) */ + unsigned char he_gi_type; + /** HE LTF (NRF_WIFI_HE_LTF_3200NS/NRF_WIFI_HE_LTF_6400NS/NRF_WIFI_HE_LTF_12800NS) */ + unsigned char he_ltf; + /** Fixed HE GI & LTF values can be enabled and disabled */ + unsigned char enable; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_DISABLE 0 +#define NRF_WIFI_ENABLE 1 +/** + * @brief This enum represents the different types of preambles used. + * Preambles are sequences of known symbols transmitted before the actual + * data transmission to enable synchronization, channel estimation, and + * frame detection at the receiver. + * + */ +enum rpu_pkt_preamble { + /** Short preamble packet */ + RPU_PKT_PREAMBLE_SHORT, + /** Long preamble packet */ + RPU_PKT_PREAMBLE_LONG, + /** mixed preamble packet */ + RPU_PKT_PREAMBLE_MIXED, + /** Highest preamble type currently defined */ + RPU_PKT_PREAMBLE_MAX, +}; + +struct nrf_wifi_cmd_mode { + struct nrf_wifi_sys_head sys_head; + signed int mode; + +} __NRF_WIFI_PKD; +/** + * @brief This structure describes different Physical Layer (PHY) configuration parameters used + * in RF test and Radio test scenarios. These parameters are specific to testing and evaluating + * the performance of the radio hardware. + * + */ +struct rpu_conf_params { + /** Unused. Number of spatial streams supported. Support is there for 1x1 only. */ + unsigned char nss; + /** Unused */ + unsigned char antenna_sel; + /** An array containing RF & baseband control params */ + unsigned char rf_params[NRF_WIFI_RF_PARAMS_SIZE]; + /** Not required */ + unsigned char tx_pkt_chnl_bw; + /** WLAN packet formats. 0->Legacy 1->HT 2->VHT 3->HE(SU) 4->HE(ERSU) and 5->HE(TB) */ + unsigned char tx_pkt_tput_mode; + /** Short Guard enable/disable */ + unsigned char tx_pkt_sgi; + /** Not required */ + unsigned char tx_pkt_nss; + /** Preamble type. 0->short, 1->Long and 2->Mixed */ + unsigned char tx_pkt_preamble; + /** Not used */ + unsigned char tx_pkt_stbc; + /** 0->BCC 1->LDPC. Supporting only BCC in nRF7002 */ + unsigned char tx_pkt_fec_coding; + /** Valid MCS number between 0 to 7 */ + signed char tx_pkt_mcs; + /** Legacy rate to be used in Mbps (1, 2, 5.5, 11, 6, 9, 12, 18, 24, 36, 48, 54) */ + signed char tx_pkt_rate; + /** Copy OTP params to this memory */ + signed char phy_threshold; + /** Calibration bit map value. refer NRF_WIFI_DEF_PHY_CALIB */ + unsigned int phy_calib; + /** Radio test mode or System mode selection */ + signed int op_mode; + /** Channel related info viz, channel, bandwidth, primary 20 offset */ + struct chan_params chan; + /** Value of 0 means continuous transmission.Greater than 1 is invalid */ + unsigned char tx_mode; + /** Number of packets to be transmitted. Any number above 0. + * Set -1 for continuous transmission + */ + signed int tx_pkt_num; + /** Length of the packet (in bytes) to be transmitted */ + unsigned short tx_pkt_len; + /** Desired TX power in dBm in the range 0 dBm to 21 dBm in steps of 1 dBm */ + unsigned int tx_power; + /** Transmit WLAN packet */ + unsigned char tx; + /** Receive WLAN packet */ + unsigned char rx; + /** Not required */ + unsigned char aux_adc_input_chain_id; + /** Unused */ + unsigned char agg; + /** Select HE LTF type viz, 0->1x, 1->2x and 2->4x */ + unsigned char he_ltf; + /** Select HE LTF type viz, 0->0.8us, 1->1.6us and 2->3.2us */ + unsigned char he_gi; + /** Not required */ + unsigned char set_he_ltf_gi; + /** Not required */ + unsigned char power_save; + /** Not required */ + unsigned int rts_threshold; + /** Not required */ + unsigned int uapsd_queue; + /** Interval between TX packets in us (Min: 200, Max: 200000, Default: 200) */ + unsigned int tx_pkt_gap_us; + /** Configure WLAN antenna switch(0-separate/1-shared) */ + unsigned char wlan_ant_switch_ctrl; + /** Switch to control the SR antenna or shared WiFi antenna */ + unsigned char sr_ant_switch_ctrl; + /** Resource unit (RU) size (26,52,106 or 242) */ + unsigned char ru_tone; + /** Location of resource unit (RU) in 20 MHz spectrum */ + unsigned char ru_index; + /** Desired tone frequency to be transmitted */ + signed char tx_tone_freq; + /** RX LNA gain */ + unsigned char lna_gain; + /** RX BB gain */ + unsigned char bb_gain; + /** Number of RX samples to be captured */ + unsigned short int capture_length; + /** Capture timeout in seconds */ + unsigned short int capture_timeout; + /** Configure WLAN to bypass regulatory */ + unsigned char bypass_regulatory; + /** Two letter country code (00: Default for WORLD) */ + unsigned char country_code[NRF_WIFI_COUNTRY_CODE_LEN]; + /** Contention window value to be configured */ + unsigned int tx_pkt_cw; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines the command used to configure the RPU with different + * PHY configuration parameters specifically designed for RF test and Radio test scenarios. + * The command is intended to set up the RPU for testing and evaluating the performance + * of the radio hardware. + * + */ + +struct nrf_wifi_cmd_mode_params { + /** UMAC header, See &struct nrf_wifi_sys_head */ + struct nrf_wifi_sys_head sys_head; + /** configuration parameters of different modes see &union rpu_conf_params */ + struct rpu_conf_params conf; + /** Packet length */ + unsigned short pkt_length[MAX_TX_AGG_SIZE]; + /** Packet ddr pointer */ + unsigned int ddr_ptrs[MAX_TX_AGG_SIZE]; +} __NRF_WIFI_PKD; + +/** + * @brief This structure represents the parameters required to initialize a radio test. + * + */ +struct nrf_wifi_radio_test_init_info { + /** An array containing RF & baseband control params */ + unsigned char rf_params[NRF_WIFI_RF_PARAMS_SIZE]; + /** Channel related info viz, channel, bandwidth, primary 20 offset */ + struct chan_params chan; + /** Phy threshold value to be sent to LMAC in channel programming */ + signed char phy_threshold; + /** Calibration bit map value. refer phy_rf_params.h NRF_WIFI_DEF_PHY_CALIB */ + unsigned int phy_calib; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines the command used to initialize a radio test. + * + */ +struct nrf_wifi_cmd_radio_test_init { + /** UMAC header, @ref nrf_wifi_sys_head*/ + struct nrf_wifi_sys_head sys_head; + /** radiotest init configuration parameters @ref nrf_wifi_radio_test_init_info */ + struct nrf_wifi_radio_test_init_info conf; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines the command used to enable or disable the reception (Rx). + * It allows controlling the radio hardware's receive functionality to start or stop listening + * for incoming data frames. + */ + +struct nrf_wifi_cmd_rx { + /** UMAC header, @ref nrf_wifi_sys_head */ + struct nrf_wifi_sys_head sys_head; + /** rx configuration parameters @ref rpu_conf_rx_radio_test_params */ + struct rpu_conf_rx_radio_test_params conf; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines the command used to retrieve statistics from the RPU. + * + */ +struct nrf_wifi_cmd_get_stats { + /** UMAC header, @ref nrf_wifi_sys_head*/ + struct nrf_wifi_sys_head sys_head; + /** Statistics type &enum rpu_stats_type */ + signed int stats_type; + /** Production mode or FCM mode */ + signed int op_mode; +} __NRF_WIFI_PKD; + +/** + * @brief This structure represents the channel parameters to configure specific channel. + * + */ +struct nrf_wifi_cmd_set_channel { + /** UMAC header, @ref nrf_wifi_sys_head. */ + struct nrf_wifi_sys_head sys_head; + /** Interface index. */ + unsigned char if_index; + /** channel parameters, @ref chan_params. */ + struct chan_params chan; +} __NRF_WIFI_PKD; + +/** + * @brief This enum represents different types of filters used. + */ + +enum wifi_packet_filter { + /** Support management, data and control packet sniffing. */ + NRF_WIFI_PACKET_FILTER_ALL = 0x1, + /** Support only sniffing of management packets. */ + NRF_WIFI_PACKET_FILTER_MGMT = 0x2, + /** Support only sniffing of data packets. */ + NRF_WIFI_PACKET_FILTER_DATA = 0x4, + /** Support only sniffing of control packets. */ + NRF_WIFI_PACKET_FILTER_CTRL = 0x8, +}; + +/** + * @brief This structure defines the command used to configure + * promiscuous mode/Monitor mode/Packet injector mode. + */ +struct nrf_wifi_cmd_raw_config_mode { + /** UMAC header, @ref nrf_wifi_sys_head. */ + struct nrf_wifi_sys_head sys_head; + /** Interface index. */ + unsigned char if_index; + /** Wireless device operating mode. */ + unsigned char op_mode; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines the command used to configure + * filters and capture length in promiscuous and monitor modes. + */ +struct nrf_wifi_cmd_raw_config_filter { + /** UMAC header, @ref nrf_wifi_sys_head. */ + struct nrf_wifi_sys_head sys_head; + /** Interface index. */ + unsigned char if_index; + /** Wireless device operating mode filters for Promiscuous/Monitor modes. */ + unsigned char filter; + /** capture length. */ + unsigned short capture_len; +} __NRF_WIFI_PKD; + +/** + * @brief This enum represents the queues used to segregate the TX frames depending on + * their QoS categories. A separate queue is used for Beacon frames / frames + * transmitted during DTIM intervals. + */ + +enum UMAC_QUEUE_NUM { + /** Queue for frames belonging to the "Background" Access Category. */ + UMAC_AC_BK = 0, + /** Queue for frames belonging to the "Best-Effort" Access Category. */ + UMAC_AC_BE, + /** Queue for frames belonging to the "Video" Access Category. */ + UMAC_AC_VI, + /** Queue for frames belonging to the "Voice" Access Category. */ + UMAC_AC_VO, + /** Queue for frames belonging to the "Beacon" Access Category. */ + UMAC_AC_BCN, + /** Maximum number of transmit queues supported. */ + UMAC_AC_MAX_CNT +}; + +/** + * @brief This structure defines the raw tx parameters used in packet injector mode. + * + */ +struct nrf_wifi_raw_tx_pkt { + /** Queue number will be BK, BE, VI, VO and BCN refer UMAC_QUEUE_NUM. */ + unsigned char queue_num; + /** Descriptor identifier or token identifier. */ + unsigned char desc_num; + /** Number of times a packet should be transmitted at each possible rate. */ + unsigned char rate_retries; + /** refer see &enum rpu_tput_mode. */ + unsigned char rate_flags; + /** rate: legacy rates: 1,2,55,11,6,9,12,18,24,36,48,54 + * 11N VHT HE : MCS index 0 to 7. + **/ + unsigned char rate; + + /** AGGR_DISABLE(0)/AGGR_ENABLE(1) */ + unsigned char aggregation; + /** Number of frames in this command */ + unsigned char num_frames; + /** Packet lengths of frames */ + unsigned short pkt_length[MAX_TX_AGG_SIZE]; + /** Starting Physical address of each frame in Ext-RAM after dma_mapping */ + unsigned int frame_ddr_pointer[MAX_TX_AGG_SIZE]; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines the command used to configure packet injector mode. + * + */ +struct nrf_wifi_cmd_raw_tx { + /** UMAC header, @ref nrf_wifi_sys_head. */ + struct nrf_wifi_sys_head sys_head; + /** Interface index. */ + unsigned char if_index; + /** Raw tx packet information. */ + struct nrf_wifi_raw_tx_pkt raw_tx_info; +} __NRF_WIFI_PKD; + +/** + * @brief This enum provides a list of different raw tx offloading types. + */ +enum nrf_wifi_offload_rawtx_ctrl_type { + NRF_WIFI_OFFLOAD_TX_STOP, + NRF_WIFI_OFFLOAD_TX_START, + NRF_WIFI_OFFLOAD_TX_CONFIG, +}; + +/** + * @brief This structure defines the offloaded raw tx control information. + * + */ +struct nrf_wifi_offload_ctrl_params +{ + /** Time interval in micro seconds */ + unsigned int period_in_us; + /** Transmit power in dBm ( 0 to 20) */ + int tx_pwr; + /** Channel number */ + struct chan_params chan; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_ENABLE_HE_SU 0x40 +#define NRF_WIFI_ENABLE_HE_ER_SU 0x80 + +/** + * @brief This structure defines the offloading raw tx parameters + * + */ +struct nrf_wifi_offload_tx_ctrl +{ + /** Packet lengths of frames, min 26 bytes and max 600 bytes */ + unsigned int pkt_length; + /** Rate preamble type (USE_SHORT_PREAMBLE/DONT_USE_SHORT_PREAMBLE) */ + unsigned int rate_preamble_type; + /** Number of times a packet should be transmitted at each possible rate */ + unsigned int rate_retries; + /** Rate: legacy rates: 1,2,55,11,6,9,12,18,24,36,48,54 + * 11N VHT HE: MCS index 0 to 7. + */ + unsigned int rate; + /** Refer see &enum rpu_tput_mode */ + unsigned int rate_flags; + /** HE GI type (NRF_WIFI_HE_GI_800NS/NRF_WIFI_HE_GI_1600NS/NRF_WIFI_HE_GI_3200NS) */ + unsigned char he_gi_type; + /** HE LTF (NRF_WIFI_HE_LTF_3200NS/NRF_WIFI_HE_LTF_6400NS/NRF_WIFI_HE_LTF_12800NS) */ + unsigned char he_ltf; + /** Payload pointer */ + unsigned int pkt_ram_ptr; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines the command used for offloading Raw tx + * + */ +struct nrf_wifi_cmd_offload_raw_tx_params { + /** UMAC header, @ref nrf_wifi_sys_head */ + struct nrf_wifi_sys_head sys_head; + /** Id of the interface */ + unsigned int wdev_id; + /** Offloaded raw tx control information, @ref nrf_wifi_offload_ctrl_params */ + struct nrf_wifi_offload_ctrl_params ctrl_info; + /** Offloaded raw tx params, @ref nrf_wifi_offload_tx_ctrl */ + struct nrf_wifi_offload_tx_ctrl tx_params; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines the command used for offloading Raw tx + * + */ +struct nrf_wifi_cmd_offload_raw_tx_ctrl { + /** UMAC header, @ref nrf_wifi_sys_head */ + struct nrf_wifi_sys_head sys_head; + /** Id of the interface */ + unsigned int wdev_id; + /** Offloading type @ref nrf_wifi_offload_rawtx_ctrl_type */ + unsigned char ctrl_type; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines an event that indicates set channel command done. + * + */ +struct nrf_wifi_event_set_channel { + /** UMAC header, @ref nrf_wifi_sys_head. */ + struct nrf_wifi_sys_head sys_head; + /** Interface index. */ + unsigned char if_index; + /** channel number. */ + struct chan_params chan; + /** status of the set channel command, success(0)/Fail(-1). */ + int status; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines an event that indicates set raw config + * mode command done. + * + */ +struct nrf_wifi_event_raw_config_mode { + /** UMAC header, @ref nrf_wifi_sys_head. */ + struct nrf_wifi_sys_head sys_head; + /** Interface index. */ + unsigned char if_index; + /** Operating mode. */ + unsigned char op_mode; + /** status of the set raw config mode command, success(0)/Fail(-1). */ + int status; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines an event that indicates set raw config + * filter command done. + * + */ +struct nrf_wifi_event_raw_config_filter { + /** UMAC header, @ref nrf_wifi_sys_head. */ + struct nrf_wifi_sys_head sys_head; + /** Interface index. */ + unsigned char if_index; + /** mode filter configured. */ + unsigned char filter; + /** capture len configured. */ + unsigned short capture_len; + /** status of the set raw filter command, success(0)/Fail(-1). */ + int status; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines an event that indicates the Raw tx done. + * + */ +struct nrf_wifi_event_raw_tx_done { + /** UMAC header, @ref nrf_wifi_sys_head. */ + struct nrf_wifi_sys_head sys_head; + /** descriptor number. */ + unsigned char desc_num; + /** status of the raw tx packet command, success(0)/Fail(-1). */ + int status; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines the command used to clear or reset statistics. + * + * + */ +struct nrf_wifi_cmd_clear_stats { + /** UMAC header, @ref nrf_wifi_sys_head */ + struct nrf_wifi_sys_head sys_head; + /** Type of statistics to clear &enum rpu_stats_type */ + signed int stats_type; +} __NRF_WIFI_PKD; + +/** + * @brief This structure represents the command used to obtain power monitor information + * specific to different data types. + * + */ +struct nrf_wifi_cmd_pwr { + /** UMAC header, @ref nrf_wifi_sys_head */ + struct nrf_wifi_sys_head sys_head; + /** Type of Control info that host need */ + signed int data_type; +} __NRF_WIFI_PKD; + +/** + * @brief Structure for coexistence (coex) switch configuration. + * + */ +struct coex_wlan_switch_ctrl { + /** Host to coexistence manager message id */ + signed int rpu_msg_id; + /** Switch configuration value */ + signed int switch_A; +} __NRF_WIFI_PKD; + +/** + * @brief The structure represents the command used to configure the Wi-Fi side shared switch + * for SR coexistence. + * + */ +struct nrf_wifi_cmd_srcoex { + /** UMAC header, @ref nrf_wifi_sys_head */ + struct nrf_wifi_sys_head sys_head; + /** Switch configuration data */ + struct coex_wlan_switch_ctrl conf; +} __NRF_WIFI_PKD; + +/** + * @brief The structure defines the parameters used to configure the coexistence hardware. + * + */ + +struct rpu_cmd_coex_config_info { + /** Length of coexistence configuration data */ + unsigned int len; + /** Coexistence configuration data */ + unsigned char coex_cmd[0]; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines the command used to configure the coexistence hardware. + * + */ +struct nrf_wifi_cmd_coex_config { + /** UMAC header, @ref nrf_wifi_sys_head */ + struct nrf_wifi_sys_head sys_head; + /** Coexistence configuration data. @ref rpu_cmd_coex_config_info */ + struct rpu_cmd_coex_config_info coex_config_info; +} __NRF_WIFI_PKD; + +/** + * @brief This structure describes the coexistence configuration data received + * in the NRF_WIFI_EVENT_COEX_CONFIG event. + * + */ +struct rpu_evnt_coex_config_info { + /** Length of coexistence configuration data */ + unsigned int len; + /** Coexistence configuration data */ + unsigned char coex_event[0]; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines the event used to represent coexistence configuration. + * + */ +struct nrf_wifi_event_coex_config { + /** UMAC header, @ref nrf_wifi_sys_head */ + struct nrf_wifi_sys_head sys_head; + /** Coexistence configuration data in the event. @ref rpu_evnt_coex_config_info */ + struct rpu_evnt_coex_config_info coex_config_info; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines the command used to fix the transmission (Tx) data rate. + * The command allows setting a specific data rate for data transmission, ensuring that the + * system uses the designated rate instead of dynamically adapting to changing channel conditions. + * + */ + +struct nrf_wifi_cmd_fix_tx_rate { + /** UMAC header, @ref nrf_wifi_sys_head */ + struct nrf_wifi_sys_head sys_head; + /** refer see &enum rpu_tput_mode */ + unsigned char rate_flags; + /** fixed_rate: -1 Disable fixed rate and use ratecontrol selected rate + * fixed rate: >0 legacy rates: 1,2,55,11,6,9,12,18,24,36,48,54 + * 11N VHT HE : MCS index 0 to 7. + */ + int fixed_rate; +} __NRF_WIFI_PKD; + +/** + * @brief This structure describes rf test command information. + * + */ +struct rpu_cmd_rftest_info { + /** length of the rf test command */ + unsigned int len; + /** Rf test command data */ + unsigned char rfcmd[0]; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines the command used for RF (Radio Frequency) testing. + * RF test commands are specifically designed to configure and control the radio hardware + * for conducting tests and evaluating its performance in various scenarios. + * + */ +struct nrf_wifi_cmd_rftest { + /** UMAC header, @ref nrf_wifi_sys_head */ + struct nrf_wifi_sys_head sys_head; + /** @ref rpu_cmd_rftest_info */ + struct rpu_cmd_rftest_info rf_test_info; +} __NRF_WIFI_PKD; + +/** + * @brief This structure describes rf test event information. + * + */ +struct rpu_evnt_rftest_info { + /** length of the rf test event */ + unsigned int len; + /** Rf test event data */ + unsigned char rfevent[0]; +} __NRF_WIFI_PKD; + +/** + * @brief This structure describes the event generated during RF (Radio Frequency) testing. + * + */ +struct nrf_wifi_event_rftest { + /** UMAC header, @ref nrf_wifi_sys_head */ + struct nrf_wifi_sys_head sys_head; + /** @ref rpu_evnt_rftest_info */ + struct rpu_evnt_rftest_info rf_test_info; +} __NRF_WIFI_PKD; + +/** + * @brief This structure is a comprehensive combination of all the firmware statistics + * that the RPU (Radio Processing Unit) can provide in System mode. + * + */ +struct rpu_sys_fw_stats { + /** PHY statistics @ref rpu_phy_stats */ + struct rpu_phy_stats phy; + /** LMAC statistics @ref rpu_lmac_stats */ + struct rpu_lmac_stats lmac; + /** UMAC statistics @ref rpu_umac_stats */ + struct rpu_umac_stats umac; +} __NRF_WIFI_PKD; + +/** + * @brief This structure is a comprehensive combination of all the firmware statistics + * that the RPU (Radio Processing Unit) can provide in Radio test mode. + * + */ +struct rpu_rt_fw_stats { + /** PHY statistics @ref rpu_phy_stats */ + struct rpu_phy_stats phy; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines the Offloaded raw tx debug statistics. + * + */ +struct rpu_off_raw_tx_fw_stats { + unsigned int offload_raw_tx_state; + unsigned int offload_raw_tx_cnt; + unsigned int offload_raw_tx_complete_cnt; + unsigned int warm_boot_cnt; +} __NRF_WIFI_PKD; + + +/** + * @brief This structure represents the event that provides RPU statistics in response + * to the command NRF_WIFI_CMD_GET_STATS in a wireless communication system in System + * mode. + * + * The NRF_WIFI_CMD_GET_STATS command is used to request various statistics from the RPU. + * + */ + +struct nrf_wifi_sys_umac_event_stats { + /** UMAC header, @ref nrf_wifi_sys_head */ + struct nrf_wifi_sys_head sys_head; + /** All the statistics that the firmware can provide @ref rpu_sys_fw_stats*/ + struct rpu_sys_fw_stats fw; +} __NRF_WIFI_PKD; + + +/** + * @brief This structure represents the event that provides RPU statistics in response + * to the command NRF_WIFI_CMD_GET_STATS in a wireless communication system in Radio + * test mode. + * + * The NRF_WIFI_CMD_GET_STATS command is used to request various statistics from the RPU. + * + */ + +struct nrf_wifi_rt_umac_event_stats { + /** UMAC header, @ref nrf_wifi_sys_head */ + struct nrf_wifi_sys_head sys_head; + /** All the statistics that the firmware can provide @ref rpu_rt_fw_stats*/ + struct rpu_rt_fw_stats fw; +} __NRF_WIFI_PKD; + + +/** + * @brief This structure represents the event that provides RPU statistics in response + * to the command NRF_WIFI_CMD_GET_STATS in a wireless communication system in Offloaded + * raw TX mode. + * + * The NRF_WIFI_CMD_GET_STATS command is used to request various statistics from the RPU. + * + */ + +struct nrf_wifi_off_raw_tx_umac_event_stats { + /** UMAC header, @ref nrf_wifi_sys_head */ + struct nrf_wifi_sys_head sys_head; + /** All the statistics that the firmware can provide @ref rpu_off_raw_tx_fw_stats*/ + struct rpu_off_raw_tx_fw_stats fw; +} __NRF_WIFI_PKD; + + +/** + * @brief This enum defines various command status values that can occur + * during radio tests and offloaded raw transmissions. + */ +enum nrf_wifi_cmd_status { + /** Command success */ + NRF_WIFI_UMAC_CMD_SUCCESS = 1, + /** Invalid channel error */ + NRF_WIFI_UMAC_INVALID_CHNL, + /** Invalid power error wrt configured regulatory domain */ + NRF_WIFI_UMAC_INVALID_TXPWR +}; + +/** + * @brief This structure defines an event that indicates the error status values that may occur + * during a radio test. It serves as a response to the radio test commands. + * + */ +struct nrf_wifi_umac_event_err_status { + /** UMAC header, @ref nrf_wifi_sys_head */ + struct nrf_wifi_sys_head sys_head; + /** status of the command, Fail/success &enum nrf_wifi_radio_test_err_status */ + unsigned int status; +} __NRF_WIFI_PKD; + +/** + * @brief This structure represents the UMAC initialization done event. + * The event is sent by the RPU (Radio Processing Unit) in response to + * the NRF_WIFI_CMD_INIT command, indicating that the RPU initialization + * process has been completed successfully. + */ + +struct nrf_wifi_event_init_done { + /** UMAC header, @ref nrf_wifi_sys_head */ + struct nrf_wifi_sys_head sys_head; +} __NRF_WIFI_PKD; + +/** + * @brief structure for UMAC memory pool information. + * + */ +struct pool_data_to_host { + /** Size of the memory buffer */ + unsigned int buffer_size; + /** Number of pool items available for the above memory buffer */ + unsigned char num_pool_items; + /** Maximum pools allocated at any point of time */ + unsigned char items_num_max_allocated; + /** Currently allocated pools */ + unsigned char items_num_cur_allocated; + /** Total number of pool allocated */ + unsigned int items_num_total_allocated; + /** Number of times this memory pool is full */ + unsigned int items_num_not_allocated; +} __NRF_WIFI_PKD; + +/** + * @brief This structure represents the event that provides UMAC (Upper MAC) internal + * memory statistics in response to the NRF_WIFI_CMD_UMAC_INT_STATS command. + * + */ +struct umac_int_stats { + /** UMAC header, @ref nrf_wifi_sys_head */ + struct nrf_wifi_sys_head sys_head; + /** See @ref pool_data_to_host */ + struct pool_data_to_host scratch_dynamic_memory_info[56]; + /** See @ref pool_data_to_host */ + struct pool_data_to_host retention_dynamic_memory_info[56]; +} __NRF_WIFI_PKD; + +/** + * @brief This structure represents the event that indicates the completion of UMAC + * deinitialization. The RPU sends this event as a response to the NRF_WIFI_CMD_DEINIT + * command, signaling that the UMAC has been successfully deinitialized. + */ + +struct nrf_wifi_event_deinit_done { + /** UMAC header, @ref nrf_wifi_sys_head */ + struct nrf_wifi_sys_head sys_head; +} __NRF_WIFI_PKD; + +/** + * @brief This structure describes the command for reset of interface statistics. + * + */ +struct nrf_wifi_cmd_reset_stats { + /** UMAC header, @ref nrf_wifi_sys_head */ + struct nrf_wifi_sys_head sys_head; +} __NRF_WIFI_PKD; + +struct nrf_wifi_cmd_gi_config { + /** umac header, see &nrf_wifi_sys_head */ + struct nrf_wifi_sys_head sys_head; + /** Fixed Guard Interval Setting: 1 = Enable fixed guard interval, 0 = Disable (adaptive) */ + unsigned char is_guard_interval_fixed; + /* Guard Interval Type: 1 = Long Guard Interval (LGI), 0 = Short Guard Interval (SGI) */ + unsigned char guard_interval_type; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_LMAC_MAX_RX_BUFS 256 + + +#define HW_SLEEP_ENABLE 2 +#define SW_SLEEP_ENABLE 1 +#define SLEEP_DISABLE 0 +#define HW_DELAY 25000 +#define SW_DELAY 5000 +#define BCN_TIMEOUT 20000 +#define CALIB_SLEEP_CLOCK_ENABLE 1 +#define ACTIVE_SCAN_DURATION 50 +#define PASSIVE_SCAN_DURATION 130 +#define WORKING_CH_SCAN_DURATION 50 +#define CHNL_PROBE_CNT 2 + +#define PKT_TYPE_MPDU 0 +#define PKT_TYPE_MSDU_WITH_MAC 1 +#define PKT_TYPE_MSDU 2 + +#define NRF_WIFI_RPU_PWR_STATUS_SUCCESS 0 +#define NRF_WIFI_RPU_PWR_STATUS_FAIL -1 + +/** + * struct lmac_prod_stats : used to get the production mode stats + **/ + +/* Events */ +#define MAX_RSSI_SAMPLES 10 +struct lmac_prod_stats { + /*Structure that holds all the debug information in LMAC*/ + unsigned int resetCmdCnt; + unsigned int resetCompleteEventCnt; + unsigned int unableGenEvent; + unsigned int chProgCmdCnt; + unsigned int channelProgDone; + unsigned int txPktCnt; + unsigned int txPktDoneCnt; + unsigned int scanPktCnt; + unsigned int internalPktCnt; + unsigned int internalPktDoneCnt; + unsigned int ackRespCnt; + unsigned int txTimeout; + unsigned int deaggIsr; + unsigned int deaggInptrDescEmpty; + unsigned int deaggCircularBufferFull; + unsigned int lmacRxisrCnt; + unsigned int rxDecryptcnt; + unsigned int processDecryptFail; + unsigned int prepaRxEventFail; + unsigned int rxCorePoolFullCnt; + unsigned int rxMpduCrcSuccessCnt; + unsigned int rxMpduCrcFailCnt; + unsigned int rxOfdmCrcSuccessCnt; + unsigned int rxOfdmCrcFailCnt; + unsigned int rxDSSSCrcSuccessCnt; + unsigned int rxDSSSCrcFailCnt; + unsigned int rxCryptoStartCnt; + unsigned int rxCryptoDoneCnt; + unsigned int rxEventBufFull; + unsigned int rxExtramBufFull; + unsigned int scanReq; + unsigned int scanComplete; + unsigned int scanAbortReq; + unsigned int scanAbortComplete; + unsigned int internalBufPoolNull; + unsigned int rpuLockupCnt; + unsigned int rpuLockupRecoveryDone; + unsigned int SQICmdsCnt; + unsigned int SQIEventsCnt; + unsigned int SleepType; + unsigned int warmBootCnt; +}; + +/** + * struct phy_prod_stats : used to get the production mode stats + **/ +struct phy_prod_stats { + unsigned int ofdm_crc32_pass_cnt; + unsigned int ofdm_crc32_fail_cnt; + unsigned int dsss_crc32_pass_cnt; + unsigned int dsss_crc32_fail_cnt; + char averageRSSI; +}; + +union rpu_stats { + struct lmac_prod_stats lmac_stats; + struct phy_prod_stats phy_stats; +}; + + +struct hpqmQueue { + unsigned int pop_addr; + unsigned int push_addr; + unsigned int idNum; + unsigned int status_addr; + unsigned int status_mask; +} __NRF_WIFI_PKD; + + +struct INT_HPQ { + unsigned int id; + /* The head and tail values are relative + * to the start of the + * HWQM register block. + */ + unsigned int head; + unsigned int tail; +} __NRF_WIFI_PKD; + + + +/** + * struct lmac_fw_config_params:lmac firmware config params + * @boot_status: lmac firmware boot status. LMAC will set to + * 0x5a5a5a5a after completing boot process. + * @rpu_config_name: rpu config name. this is a string and + * expected sting is explorer or whisper + * @rpu_config_number: rpu config number + * @HP_lmac_to_host_isr_en: lmac register addres to enable ISR to Host + * @HP_lmac_to_host_isr_clear: Address to Clear host ISR + * @HP_set_lmac_isr: Address to set ISR to lmac Clear host ISR + * @FreeCmdPtrQ: queue which contains Free GRAM pointers for + * commands. + * @cmdPtrQ: Command pointer queue. Host should pick gram + * pointer from FreeCmdPtrQ. Populate command in + * GRAM and submit back to this queue for RPU. + * @eventPtrQ: Event pointer queue. Host should pick gram + * event pointer in isr + * @version: lmac firmware version + * + * + */ +struct lmac_fw_config_params { + unsigned int boot_status; + unsigned int version; + unsigned int lmacRxBufferAddr; + unsigned int lmacRxMaxDescCnt; + unsigned int lmacRxDescSize; + unsigned char rpu_config_name[16]; + unsigned char rpu_config_number[8]; + unsigned int numRX; + unsigned int numTX; + #define FREQ_2_4_GHZ 1 + #define FREQ_5_GHZ 2 + unsigned int bands; + unsigned int sysFrequencyInMhz; + struct hpqmQueue FreeCmdPtrQ; + struct hpqmQueue cmdPtrQ; + struct hpqmQueue eventPtrQ; + struct hpqmQueue freeEventPtrQ; + struct hpqmQueue SKBGramPtrQ_1; + struct hpqmQueue SKBGramPtrQ_2; + struct hpqmQueue SKBGramPtrQ_3; + unsigned int HP_lmac_to_host_isr_en; + unsigned int HP_lmac_to_host_isr_clear; + unsigned int HP_set_lmac_isr; + + #define NUM_32_QUEUES 4 + struct INT_HPQ hpq32[NUM_32_QUEUES]; + +} __NRF_WIFI_PKD; + +/** + * @brief This enum represents different types of operation modes. + */ +enum wifi_operation_modes { + /** STA mode setting enable. */ + NRF_WIFI_STA_MODE = 0x1, + /** Monitor mode setting enable. */ + NRF_WIFI_MONITOR_MODE = 0x2, + /** TX injection mode setting enable. */ + NRF_WIFI_TX_INJECTION_MODE = 0x4, + /** Promiscuous mode setting enable. */ + NRF_WIFI_PROMISCUOUS_MODE = 0x8, + /** AP mode setting enable. */ + NRF_WIFI_AP_MODE = 0x10, + /** STA-AP mode setting enable. */ + NRF_WIFI_STA_AP_MODE = 0x20, + /** Max limit check based on current modes supported. */ + WIFI_MODE_LIMIT_CHK = 0x2f, +}; + +#define NRF_WIFI_DEF_RF_PARAMS "0000000000001C00000000000000004030303838383838380000000050EC000000000000000000000000214365003F032424001000002800323500000C7608017D8105010071630300EED501001F6F00003B350100F52E0000E35E0000B7B6000066EFFEFFB5F60000896200007A840200E28FFCFF08080808040A140100000000A1A101FA000000680150003B0207262D2D28281A120A140E0600" + +#define NRF_WIFI_RF_PARAMS_OFF_RESV_1 0 +#define NRF_WIFI_RF_PARAMS_OFF_CALIB_X0 6 +#define NRF_WIFI_RF_PARAMS_OFF_CALIB_PDADJM7 7 +#define NRF_WIFI_RF_PARAMS_OFF_CALIB_PDADJM0 11 +#define NRF_WIFI_RF_PARAMS_OFF_CALIB_PWR2G 15 +#define NRF_WIFI_RF_PARAMS_OFF_CALIB_PWR2GM0M7 16 +#define NRF_WIFI_RF_PARAMS_OFF_CALIB_PWR5GM7 18 +#define NRF_WIFI_RF_PARAMS_OFF_CALIB_PWR5GM0 21 +#define NRF_WIFI_RF_PARAMS_OFF_CALIB_RXGNOFF 24 +#define NRF_WIFI_RF_PARAMS_OFF_CALIB_MAX_TEMP 28 +#define NRF_WIFI_RF_PARAMS_OFF_CALIB_MIN_TEMP 29 +#define NRF_WIFI_RF_PARAMS_OFF_CALIB_TXP_BOFF_2GH 30 +#define NRF_WIFI_RF_PARAMS_OFF_CALIB_TXP_BOFF_2GL 31 +#define NRF_WIFI_RF_PARAMS_OFF_CALIB_TXP_BOFF_5GH 32 +#define NRF_WIFI_RF_PARAMS_OFF_CALIB_TXP_BOFF_5GL 33 +#define NRF_WIFI_RF_PARAMS_OFF_CALIB_TXP_BOFF_V 34 +#define NRF_WIFI_RF_PARAMS_OFF_CALIB_RESV_2 37 + +#define NRF_WIFI_PHY_CALIB_FLAG_RXDC 1 +#define NRF_WIFI_PHY_CALIB_FLAG_TXDC 2 +#define NRF_WIFI_PHY_CALIB_FLAG_TXPOW 0 +#define NRF_WIFI_PHY_CALIB_FLAG_TXIQ 8//8 +#define NRF_WIFI_PHY_CALIB_FLAG_RXIQ 16//16 +#define NRF_WIFI_PHY_CALIB_FLAG_DPD 32 +#define NRF_WIFI_PHY_CALIB_FLAG_ENHANCED_TXDC 64 + +#define NRF_WIFI_PHY_SCAN_CALIB_FLAG_RXDC (1<<16) +#define NRF_WIFI_PHY_SCAN_CALIB_FLAG_TXDC (2<<16) +#define NRF_WIFI_PHY_SCAN_CALIB_FLAG_TXPOW (0<<16) +#define NRF_WIFI_PHY_SCAN_CALIB_FLAG_TXIQ (0<<16) +#define NRF_WIFI_PHY_SCAN_CALIB_FLAG_RXIQ (0<<16) +#define NRF_WIFI_PHY_SCAN_CALIB_FLAG_DPD (0<<16) +#define NRF_WIFI_LP_PHY_CALIB_FLAG_RXDC (1<<24) + +#define NRF_WIFI_DEF_PHY_CALIB (NRF_WIFI_PHY_CALIB_FLAG_RXDC |\ + NRF_WIFI_PHY_CALIB_FLAG_TXDC |\ + NRF_WIFI_PHY_CALIB_FLAG_RXIQ |\ + NRF_WIFI_PHY_CALIB_FLAG_TXIQ |\ + NRF_WIFI_PHY_CALIB_FLAG_TXPOW |\ + NRF_WIFI_PHY_CALIB_FLAG_DPD |\ + NRF_WIFI_PHY_CALIB_FLAG_ENHANCED_TXDC |\ + NRF_WIFI_PHY_SCAN_CALIB_FLAG_RXDC |\ + NRF_WIFI_PHY_SCAN_CALIB_FLAG_TXDC |\ + NRF_WIFI_PHY_SCAN_CALIB_FLAG_RXIQ |\ + NRF_WIFI_PHY_SCAN_CALIB_FLAG_TXIQ |\ + NRF_WIFI_PHY_SCAN_CALIB_FLAG_TXPOW |\ + NRF_WIFI_PHY_SCAN_CALIB_FLAG_DPD |\ + NRF_WIFI_LP_PHY_CALIB_FLAG_RXDC) + +/* Temperature based calibration params */ +#define NRF_WIFI_DEF_PHY_TEMP_CALIB (NRF_WIFI_PHY_CALIB_FLAG_RXDC |\ + NRF_WIFI_PHY_CALIB_FLAG_TXDC |\ + NRF_WIFI_PHY_CALIB_FLAG_ENHANCED_TXDC |\ + NRF_WIFI_PHY_CALIB_FLAG_RXIQ |\ + NRF_WIFI_PHY_CALIB_FLAG_TXIQ |\ + NRF_WIFI_PHY_CALIB_FLAG_TXPOW |\ + NRF_WIFI_PHY_CALIB_FLAG_DPD) + + +#define NRF_WIFI_TEMP_CALIB_PERIOD (1024 * 1024) /* micro seconds */ +#define NRF_WIFI_TEMP_CALIB_THRESHOLD (40) +#define NRF_WIFI_TEMP_CALIB_ENABLE 0 + +/* Battery voltage changes base calibrations and voltage thresholds */ +#define NRF_WIFI_DEF_PHY_VBAT_CALIB (NRF_WIFI_PHY_CALIB_FLAG_DPD) +#define NRF_WIFI_VBAT_VERYLOW (3) /* Corresponds to (2.5+3*0.07)=2.71V */ +#define NRF_WIFI_VBAT_LOW (6) /* Correspond to (2.5+6*0.07)=2.92V */ +#define NRF_WIFI_VBAT_HIGH (12) /* Correspond to (2.5+12*0.07)=3.34V */ + +#define VBAT_OFFSET_MILLIVOLT (2500) +#define VBAT_SCALING_FACTOR (70) + +enum ANT_GAIN_OFFSETS { + ANT_GAIN_2G_OFST = 181, + ANT_GAIN_5G_BAND1_OFST, + ANT_GAIN_5G_BAND2_OFST, + ANT_GAIN_5G_BAND3_OFST, + NUM_ANT_GAIN = 4 +}; + + +enum nrf_wifi_rf_test { + NRF_WIFI_RF_TEST_RX_ADC_CAP, + NRF_WIFI_RF_TEST_RX_STAT_PKT_CAP, + NRF_WIFI_RF_TEST_RX_DYN_PKT_CAP, + NRF_WIFI_RF_TEST_TX_TONE, + NRF_WIFI_RF_TEST_DPD, + NRF_WIFI_RF_TEST_RF_RSSI, + NRF_WIFI_RF_TEST_SLEEP, + NRF_WIFI_RF_TEST_GET_TEMPERATURE, + NRF_WIFI_RF_TEST_XO_CALIB, + NRF_WIFI_RF_TEST_XO_TUNE, + NRF_WIFI_RF_TEST_GET_BAT_VOLT, + NRF_WIFI_RF_TEST_TX_PATTERN, + NRF_WIFI_RF_TEST_GET_STATS, + NRF_WIFI_RF_TEST_SET_REGS, + NRF_WIFI_RF_TEST_READ_REGS, + NRF_WIFI_RF_TEST_SET_MEM, + NRF_WIFI_RF_TEST_READ_MEM, + NRF_WIFI_RF_TEST_MAX, +}; + +enum nrf_wifi_rf_test_event { + NRF_WIFI_RF_TEST_EVENT_RX_ADC_CAP, + NRF_WIFI_RF_TEST_EVENT_RX_STAT_PKT_CAP, + NRF_WIFI_RF_TEST_EVENT_RX_DYN_PKT_CAP, + NRF_WIFI_RF_TEST_EVENT_TX_TONE_START, + NRF_WIFI_RF_TEST_EVENT_DPD_ENABLE, + NRF_WIFI_RF_TEST_EVENT_RF_RSSI, + NRF_WIFI_RF_TEST_EVENT_SLEEP, + NRF_WIFI_RF_TEST_EVENT_TEMP_MEAS, + NRF_WIFI_RF_TEST_EVENT_XO_CALIB, + NRF_WIFI_RF_TEST_EVENT_XO_TUNE, + NRF_WIFI_RF_TEST_EVENT_GET_BAT_VOLT, + NRF_WIFI_RF_TEST_EVENT_TX_PATTERN, + NRF_WIFI_RF_TEST_EVENT_GET_STATS, + NRF_WIFI_RF_TEST_EVENT_SET_REGS, + NRF_WIFI_RF_TEST_EVENT_READ_REGS, + NRF_WIFI_RF_TEST_EVENT_SET_MEM, + NRF_WIFI_RF_TEST_EVENT_READ_MEM, + NRF_WIFI_RF_TEST_EVENT_MAX, +}; + +#define MAX_REGS_CONF 8 +#define MAX_MEM_CONF 8 + +/* Holds the RX capture related info */ +struct nrf_wifi_rf_test_capture_params { + unsigned char test; + + /* Number of samples to be captured. */ + unsigned short int cap_len; + + /* Capture timeout in seconds. */ + unsigned short int cap_time; + + /* Capture status codes: + *0: Capture successful after WLAN packet detection + *1: Capture failed after WLAN packet detection + *2: Capture timedout as no WLAN packets are detected + */ + unsigned char capture_status; + + /* LNA Gain to be configured. It is a 3 bit value. The mapping is, + * '0' = 24dB + * '1' = 18dB + * '2' = 12dB + * '3' = 0dB + * '4' = -12dB + */ + unsigned char lna_gain; + + /* Baseband Gain to be configured. It is a 5 bit value. + * It supports 64dB range.The increment happens lineraly 2dB/step + */ + unsigned char bb_gain; +} __NRF_WIFI_PKD; + +/* Struct to hold the events from RF test SW. */ +struct nrf_wifi_rf_test_capture_meas { + unsigned char test; + + /* Mean of I samples. Format: Q.11 */ + signed short mean_I; + + /* Mean of Q samples. Format: Q.11 */ + signed short mean_Q; + + /* RMS of I samples */ + unsigned int rms_I; + + /* RMS of Q samples */ + unsigned int rms_Q; +} __NRF_WIFI_PKD; + +/* Holds the transmit related info */ +struct nrf_wifi_rf_test_tx_params { + unsigned char test; + + /* Desired tone frequency in MHz in steps of 1 MHz from -10 MHz to +10 MHz. */ + signed char tone_freq; + + /* Desired TX power in the range -16 dBm to +24 dBm. + * in steps of 2 dBm + */ + signed char tx_pow; + + /* Set 1 for staring tone transmission. */ + unsigned char enabled; +} __NRF_WIFI_PKD; + +struct nrf_wifi_rf_test_transmit_samples { + unsigned char test; + unsigned char enabled; +} __NRF_WIFI_PKD; + + +struct nrf_wifi_rf_test_dpd_params { + unsigned char test; + unsigned char enabled; + +} __NRF_WIFI_PKD; + +struct nrf_wifi_temperature_params { + unsigned char test; + + /** Current measured temperature */ + signed int temperature; + + /** Temperature measurment status. + * 0: Reading successful + * 1: Reading failed + */ + unsigned int readTemperatureStatus; +} __NRF_WIFI_PKD; + +struct nrf_wifi_rf_get_rf_rssi { + unsigned char test; + unsigned char lna_gain; + unsigned char bb_gain; + unsigned char agc_status_val; +} __NRF_WIFI_PKD; + +struct nrf_wifi_rf_test_xo_calib { + unsigned char test; + + /* XO value in the range between 0 to 127 */ + unsigned char xo_val; + +} __NRF_WIFI_PKD; + +struct nrf_wifi_rf_get_xo_value { + unsigned char test; + + /* Optimal XO value computed. */ + unsigned char xo_value; +} __NRF_WIFI_PKD; + + +struct nrf_wifi_rf_test_enter_sleep { + unsigned char test; + unsigned char enabled; + +} __NRF_WIFI_PKD; + +/* Structure to hold battery voltage parameters */ +struct nrf_wifi_bat_volt_params { + unsigned char test; + + /** Measured battery voltage in volts. */ + unsigned char voltage; + + /** Status of the voltage measurement command. + * 0: Reading successful + * 1: Reading failed + */ + unsigned int cmd_status; +} __NRF_WIFI_PKD; + +/** + * @struct nrf_wifi_rf_get_rx_debug_stats + * @brief Holds debug statistics related to the RX. + */ +struct nrf_wifi_rf_get_rx_debug_stats +{ + unsigned char test; + + /** + * @todo Refactor the code to use the WLAN_PHY_RX_STATS_T structure. + * + * The current implementation uses individual structure members that are + * already present in WLAN_PHY_RX_STATS_T. To improve maintainability + * and reduce redundancy, consider replacing the individual members with + * this unified structure. + */ + + unsigned int edCnt; + unsigned int ofdmCrc32PassCnt; + unsigned int ofdmCrc32FailCnt; + unsigned int dsssCrc32PassCnt; + unsigned int dsssCrc32FailCnt; + unsigned int ofdmCorrPassCnt; + unsigned int dsssCorrPassCnt; + unsigned int ofdmLtfCorrFailCnt; + unsigned int ofdmLsigFailCnt; + unsigned int ofdmHtsigAFailCnt; + unsigned int ofdmVhtsigAFailCnt; + unsigned int ofdmVhtsigBFailCnt; + unsigned int ofdmHesigAFailCnt; + unsigned int ofdmHesigBFailCnt; + unsigned int ofdmUsigFailCnt; + unsigned int ofdmEhtsigFailCnt; + unsigned int ofdmzeroLenMpduCnt; + unsigned int ofdminvalidDelimiterCnt; + unsigned int dsssSyncFailCnt; + unsigned int dsssFsyncFailCnt; + unsigned int dsssSfdFailCnt; + unsigned int dsssHdrFailCnt; + unsigned int lgPktCnt; + unsigned int htPktCnt; + unsigned int vhtPktCnt; + unsigned int heSuPktCnt; + unsigned int heMuPktCnt; + unsigned int heErSuPktCnt; + unsigned int heTbPktCnt; + unsigned int ehtMuPktCnt; + unsigned int popCnt; + unsigned int midPacketCnt; + unsigned int lowEnergyEventCnt; + unsigned int unSupportedCnt; + unsigned int otherStaPktCnt; + unsigned int vhtNdpCnt; + unsigned int hesuNdpCnt; + unsigned int ehtNdpCnt; + unsigned int ofdmS2lTimeOutFailCnt; + unsigned int spatialReuseCnt; +} __NRF_WIFI_PKD; + +/** + * @struct nrf_wifi_rf_config_regs + * @brief Holds configuration details for RPU registers. + */ +struct nrf_wifi_rf_config_regs { + /** Test identifier */ + unsigned char test; + + /** Number of registers to be configured */ + unsigned char num_regs; + + /** Array to store register values */ + unsigned int reg_val[MAX_REGS_CONF]; + + /** Array to store register addresses */ + unsigned int reg_addr[MAX_REGS_CONF]; + +} __NRF_WIFI_PKD; + +/** + * @struct nrf_wifi_rf_config_mem + * @brief Holds memory configuration details for RPU. + */ +struct nrf_wifi_rf_config_mem { + /** Test identifier */ + unsigned char test; + + /** Number of memory locations to be configured */ + unsigned char num_memory_loc; + + /** Array to store memory values */ + unsigned int mem_val[MAX_MEM_CONF]; + + /** Array to store memory addresses */ + unsigned int mem_addr[MAX_MEM_CONF]; + +} __NRF_WIFI_PKD; + +/* TODO: Below OTP + PCB loss won't work for nRF71, but added + * here to avoid code churn. Need to revisit this. + */ +#define NUM_PCB_LOSS_OFFSET 4 + +/** The byte offsets of RF parameters indicate the start offset + * of PCB loss for 2.4 GHz and 5 GHz bands. + */ +enum PCB_LOSS_BYTE_OFFSETS { + PCB_LOSS_BYTE_2G_OFST = 185, + PCB_LOSS_BYTE_5G_BAND1_OFST, + PCB_LOSS_BYTE_5G_BAND2_OFST, + PCB_LOSS_BYTE_5G_BAND3_OFST +}; + +/** The byte offsets of RF parameters indicate the start offset + * of band edge backoffs for different frame formats and + * different sub-bands of 2.4 GHz and 5 GHz frequency band. + */ +enum EDGE_BACKOFF_OFFSETS { + BAND_2G_LW_ED_BKF_DSSS_OFST = 155, + BAND_2G_LW_ED_BKF_HT_OFST, + BAND_2G_LW_ED_BKF_HE_OFST, + BAND_2G_UW_ED_BKF_DSSS_OFST, + BAND_2G_UW_ED_BKF_HT_OFST, + BAND_2G_UW_ED_BKF_HE_OFST, + BAND_UNII_1_LW_ED_BKF_HT_OFST, + BAND_UNII_1_LW_ED_BKF_HE_OFST, + BAND_UNII_1_UW_ED_BKF_HT_OFST, + BAND_UNII_1_UW_ED_BKF_HE_OFST, + BAND_UNII_2A_LW_ED_BKF_HT_OFST, + BAND_UNII_2A_LW_ED_BKF_HE_OFST, + BAND_UNII_2A_UW_ED_BKF_HT_OFST, + BAND_UNII_2A_UW_ED_BKF_HE_OFST, + BAND_UNII_2C_LW_ED_BKF_HT_OFST, + BAND_UNII_2C_LW_ED_BKF_HE_OFST, + BAND_UNII_2C_UW_ED_BKF_HT_OFST, + BAND_UNII_2C_UW_ED_BKF_HE_OFST, + BAND_UNII_3_LW_ED_BKF_HT_OFST, + BAND_UNII_3_LW_ED_BKF_HE_OFST, + BAND_UNII_3_UW_ED_BKF_HT_OFST, + BAND_UNII_3_UW_ED_BKF_HE_OFST, + BAND_UNII_4_LW_ED_BKF_HT_OFST, + BAND_UNII_4_LW_ED_BKF_HE_OFST, + BAND_UNII_4_UW_ED_BKF_HT_OFST, + BAND_UNII_4_UW_ED_BKF_HE_OFST, + NUM_EDGE_BACKOFF = 26 +}; + + +/* Size of XO calibration value stored in the OTP field CALIB_XO */ +#define OTP_SZ_CALIB_XO 1 + +/* Byte offsets of XO calib value in CALIB_XO field in the OTP */ +#define OTP_OFF_CALIB_XO 0 + +/* Masks to program bit fields in REGION_DEFAULTS field in the OTP */ +#define QSPI_KEY_FLAG_MASK ~(1U<<0) +#define MAC0_ADDR_FLAG_MASK ~(1U<<1) +#define MAC1_ADDR_FLAG_MASK ~(1U<<2) +#define CALIB_XO_FLAG_MASK ~(1U<<3) + +/* RF register address to facilitate OTP access */ +#define OTP_VOLTCTRL_ADDR 0x19004 +/* Voltage value to be written into the above RF register for OTP write access */ +#define OTP_VOLTCTRL_2V5 0x3b +/* Voltage value to be written into the above RF register for OTP read access */ +#define OTP_VOLTCTRL_1V8 0xb + +#define OTP_POLL_ADDR 0x01B804 +#define OTP_WR_DONE 0x1 +#define OTP_READ_VALID 0x2 +#define OTP_READY 0x4 + + +#define OTP_RWSBMODE_ADDR 0x01B800 +#define OTP_READ_MODE 0x1 +#define OTP_BYTE_WRITE_MODE 0x42 + + +#define OTP_RDENABLE_ADDR 0x01B810 +#define OTP_READREG_ADDR 0x01B814 + +#define OTP_WRENABLE_ADDR 0x01B808 +#define OTP_WRITEREG_ADDR 0x01B80C + +#define OTP_TIMING_REG1_ADDR 0x01B820 +#define OTP_TIMING_REG1_VAL 0x0 +#define OTP_TIMING_REG2_ADDR 0x01B824 +#define OTP_TIMING_REG2_VAL 0x030D8B + +#define OTP_FRESH_FROM_FAB 0xFFFFFFFF +#define OTP_PROGRAMMED 0x00000000 +#define OTP_ENABLE_PATTERN 0x50FA50FA +#define OTP_INVALID 0xDEADBEEF + +#define FT_PROG_VER_MASK 0xF0000 + +/** + * @struct nrf_wifi_board_params + * @brief This structure defines board dependent parameters like PCB loss. + * + */ +struct nrf_wifi_board_params { + /** PCB loss for 2.4 GHz band */ + unsigned char pcb_loss_2g; + /** PCB loss for 5 GHz band (5150 MHz - 5350 MHz) */ + unsigned char pcb_loss_5g_band1; + /** PCB loss for 5 GHz band (5470 MHz - 5730 MHz) */ + unsigned char pcb_loss_5g_band2; + /** PCB loss for 5 GHz band (5730 MHz - 5895 MHz) */ + unsigned char pcb_loss_5g_band3; +} __NRF_WIFI_PKD; + +/** + * @struct host_rpu_umac_info + * @brief This structure represents the information related to UMAC. + * + */ +struct host_rpu_umac_info { + /** Boot status signature */ + unsigned int boot_status; + /** UMAC version */ + unsigned int version; + /** OTP params */ + unsigned int info_part; + /** OTP params */ + unsigned int info_variant; + /** OTP params */ + unsigned int info_lromversion; + /** OTP params */ + unsigned int info_uromversion; + /** OTP params */ + unsigned int info_uuid[4]; + /** OTP params */ + unsigned int info_spare0; + /** OTP params */ + unsigned int info_spare1; + /** OTP params */ + unsigned int mac_address0[2]; + /** OTP params */ + unsigned int mac_address1[2]; + /** OTP params */ + unsigned int calib[9]; +} __NRF_WIFI_PKD; + +/** + * @brief Structure to hold OTP region information. + * + */ +struct nrf_wifi_fmac_otp_info { + /** OTP region information. */ + struct host_rpu_umac_info info; + /** Flags indicating which OTP regions are valid. */ + unsigned int flags; +}; + + +/** XO adjustment value */ +struct nrf_wifi_xo_freq_offset { + unsigned char xo_freq_offset; +} __NRF_WIFI_PKD; + +/** Power detector adjustment factor for MCS7 */ +struct nrf_wifi_pd_adst_val { + /** PD adjustment value corresponding to Channel 7 */ + signed char pd_adjt_lb_chan; + /** PD adjustment value corresponding to Channel 36 */ + signed char pd_adjt_hb_low_chan; + /** PD adjustment value corresponding to Channel 100 */ + signed char pd_adjt_hb_mid_chan; + /** PD adjustment value corresponding to Channel 165 */ + signed char pd_adjt_hb_high_chan; +} __NRF_WIFI_PKD; + +/** TX power systematic offset is the difference between set power + * and the measured power + */ +struct nrf_wifi_tx_pwr_systm_offset { + /** Systematic adjustment value corresponding to Channel 7 */ + signed char syst_off_lb_chan; + /** Systematic adjustment value corresponding to Channel 36 */ + signed char syst_off_hb_low_chan; + /** Systematic adjustment value corresponding to Channel 100 */ + signed char syst_off_hb_mid_chan; + /** Systematic adjustment value corresponding to Channel 165 */ + signed char syst_off_hb_high_chan; +} __NRF_WIFI_PKD; + +/** Max TX power value for which both EVM and SEM pass */ +struct nrf_wifi_tx_pwr_ceil { + /** Max output power for 11b for channel 7 */ + signed char max_dsss_pwr; + /** Max output power for MCS7 for channel 7 */ + signed char max_lb_mcs7_pwr; + /** Max output power for MCS0 for channel 7 */ + signed char max_lb_mcs0_pwr; + /** Max output power for MCS7 for channel 36 */ + signed char max_hb_low_chan_mcs7_pwr; + /** Max output power for MCS7 for channel 100 */ + signed char max_hb_mid_chan_mcs7_pwr; + /** Max output power for MCS7 for channel 165 */ + signed char max_hb_high_chan_mcs7_pwr; + /** Max output power for MCS0 for channel 36 */ + signed char max_hb_low_chan_mcs0_pwr; + /** Max output power for MCS0 for channel 100 */ + signed char max_hb_mid_chan_mcs0_pwr; + /** Max output power for MCS0 for channel 165 */ + signed char max_hb_high_chan_mcs0_pwr; +} __NRF_WIFI_PKD; + +/** RX gain adjustment offsets */ +struct nrf_wifi_rx_gain_offset { + /** Channel 7 */ + signed char rx_gain_lb_chan; + /** Channel 36 */ + signed char rx_gain_hb_low_chan; + /** Channel 100 */ + signed char rx_gain_hb_mid_chan; + /** Channel 165 */ + signed char rx_gain_hb_high_chan; +} __NRF_WIFI_PKD; + +/** Voltage and temperature dependent backoffs */ +struct nrf_wifi_temp_volt_depend_params { + /** Maximum chip temperature in centigrade */ + signed char max_chip_temp; + /** Minimum chip temperature in centigrade */ + signed char min_chip_temp; + /** TX power backoff at high temperature in 2.4GHz */ + signed char lb_max_pwr_bkf_hi_temp; + /** TX power backoff at low temperature in 2.4GHz */ + signed char lb_max_pwr_bkf_low_temp; + /** TX power backoff at high temperature in 5GHz */ + signed char hb_max_pwr_bkf_hi_temp; + /** TX power backoff at low temperature in 5GHz */ + signed char hb_max_pwr_bkf_low_temp; + /** Voltage back off value in LowBand when VBAT< VBAT_VERYLOW */ + signed char lb_vbt_lt_vlow; + /** Voltage back off value in HighBand when VBAT< VBAT_VERYLOW */ + signed char hb_vbt_lt_vlow; + /** Voltage back off value in LowBand when VBAT< VBAT_LOW */ + signed char lb_vbt_lt_low; + /** Voltage back off value in HighBand when VBAT< VBAT_LOW */ + signed char hb_vbt_lt_low; + /** Reserved bytes */ + signed char reserved[4]; +} __NRF_WIFI_PKD; + +/** The top-level structure holds substructures, + * each containing information related to the + * first 42 bytes of RF parameters. + */ +struct nrf_wifi_phy_rf_params { + unsigned char reserved[6]; + struct nrf_wifi_xo_freq_offset xo_offset; + struct nrf_wifi_pd_adst_val pd_adjust_val; + struct nrf_wifi_tx_pwr_systm_offset syst_tx_pwr_offset; + struct nrf_wifi_tx_pwr_ceil max_pwr_ceil; + struct nrf_wifi_rx_gain_offset rx_gain_offset; + struct nrf_wifi_temp_volt_depend_params temp_volt_backoff; + unsigned char phy_params[NRF_WIFI_RF_PARAMS_SIZE - NRF_WIFI_RF_PARAMS_CONF_SIZE]; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines the parameters used to control the max transmit (TX) power + * in both frequency bands for different data rates. + */ + + struct nrf_wifi_tx_pwr_ceil_params { + /** Maximum power permitted while transmitting DSSS rates in 2.4G band. + * Resolution is 0.25dBm. + */ + unsigned char max_pwr_2g_dsss; + /** Maximum power permitted while transmitting MCS0 rate in 2.4G band. + * Resolution is 0.25dBm. + */ + unsigned char max_pwr_2g_mcs0; + /** Maximum power permitted while transmitting MCS7 rate in 2.4G band. + * Resolution is 0.25dBm. + */ + unsigned char max_pwr_2g_mcs7; + +#ifndef NRF70_2_4G_ONLY + /** Maximum power permitted while transmitting MCS0 rate in 5G lowband. + * Low band corresponds to ch: 36 to 64 Resolution is 0.25dBm. + */ + unsigned char max_pwr_5g_low_mcs0; + /** Maximum power permitted while transmitting MCS7 rate in 5G lowband. + * Low band corresponds to ch: 36 to 64, resolution is 0.25dBm. + */ + unsigned char max_pwr_5g_low_mcs7; + /** Maximum power permitted while transmitting MCS0 rate in 5G midband. + * Mid band corresponds to ch: 96 to 132, resolution is 0.25dBm. + */ + unsigned char max_pwr_5g_mid_mcs0; + /** Maximum power permitted while transmitting MCS7 rate in 5G midband. + * Mid band corresponds to ch: 96 to 132, resolution is 0.25dBm. + */ + unsigned char max_pwr_5g_mid_mcs7; + /** Maximum power permitted while transmitting MCS0 rate in 5G highband. + * High band corresponds to ch: 136 to 177, resolution is 0.25dBm. + */ + unsigned char max_pwr_5g_high_mcs0; + /** Maximum power permitted while transmitting MCS7 rate in 5G highband. + * High band corresponds to ch: 136 to 177, resolution is 0.25dBm. + */ + unsigned char max_pwr_5g_high_mcs7; +#endif /* NRF70_2_4G_ONLY */ +} __NRF_WIFI_PKD; + +/** + * @} + */ +#endif /* __HOST_RPU_SYS_IF_H__ */ diff --git a/nrf71_wifi/include/nrf71_wifi_ctrl.h b/nrf71_wifi/include/nrf71_wifi_ctrl.h new file mode 100755 index 0000000000..d439c22505 --- /dev/null +++ b/nrf71_wifi/include/nrf71_wifi_ctrl.h @@ -0,0 +1,3884 @@ +/* + * + *Copyright (c) 2024 Nordic Semiconductor ASA + * + *SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * @addtogroup nrf_wifi_fw_if Wi-Fi driver and firmware interface + * @{ + * @brief Control interface between host and RPU + */ + +#ifndef __HOST_RPU_UMAC_IF_H +#define __HOST_RPU_UMAC_IF_H + +#include "nrf71_wifi_common.h" + +#define MAX_NRF_WIFI_UMAC_CMD_SIZE 400 +#define RPU_DATA_CMD_SIZE_MAX_TX 148 +/** + * @brief The host can send the following commands to the RPU. + * + */ +enum nrf_wifi_umac_commands { + /** Trigger a new scan nrf_wifi_umac_cmd_scan */ + NRF_WIFI_UMAC_CMD_TRIGGER_SCAN, + /** Request for scan results nrf_wifi_umac_cmd_get_scan_results */ + NRF_WIFI_UMAC_CMD_GET_SCAN_RESULTS, + /** Send authentication request to AP nrf_wifi_umac_cmd_auth */ + NRF_WIFI_UMAC_CMD_AUTHENTICATE, + /** Send associate request to AP nrf_wifi_umac_cmd_assoc */ + NRF_WIFI_UMAC_CMD_ASSOCIATE, + /** Send deauthentication request to AP nrf_wifi_umac_cmd_disconn */ + NRF_WIFI_UMAC_CMD_DEAUTHENTICATE, + /** Set wiphy parameters nrf_wifi_umac_cmd_set_wiphy */ + NRF_WIFI_UMAC_CMD_SET_WIPHY, + /** Add new key nrf_wifi_umac_cmd_key */ + NRF_WIFI_UMAC_CMD_NEW_KEY, + /** Delete key nrf_wifi_umac_cmd_key */ + NRF_WIFI_UMAC_CMD_DEL_KEY, + /** Set default key to use nrf_wifi_umac_cmd_set_key */ + NRF_WIFI_UMAC_CMD_SET_KEY, + /** Unused */ + NRF_WIFI_UMAC_CMD_GET_KEY, + /** Unused */ + NRF_WIFI_UMAC_CMD_NEW_BEACON, + /** Change the beacon on an AP interface nrf_wifi_umac_cmd_set_beacon */ + NRF_WIFI_UMAC_CMD_SET_BEACON, + /** Set the BSS nrf_wifi_umac_cmd_set_bss */ + NRF_WIFI_UMAC_CMD_SET_BSS, + /** Start soft AP operation on an AP interface nrf_wifi_umac_cmd_start_ap */ + NRF_WIFI_UMAC_CMD_START_AP, + /** Stop soft AP operation nrf_wifi_umac_cmd_stop_ap */ + NRF_WIFI_UMAC_CMD_STOP_AP, + /** Create new interface nrf_wifi_umac_cmd_add_vif */ + NRF_WIFI_UMAC_CMD_NEW_INTERFACE, + /** Change interface configuration nrf_wifi_umac_cmd_chg_vif_attr*/ + NRF_WIFI_UMAC_CMD_SET_INTERFACE, + /** Delete interface nrf_wifi_umac_cmd_del_vif */ + NRF_WIFI_UMAC_CMD_DEL_INTERFACE, + /** Change interface flags nrf_wifi_umac_cmd_chg_vif_state */ + NRF_WIFI_UMAC_CMD_SET_IFFLAGS, + /** Add a new station nrf_wifi_umac_cmd_add_sta */ + NRF_WIFI_UMAC_CMD_NEW_STATION, + /** Delete station nrf_wifi_umac_cmd_del_sta */ + NRF_WIFI_UMAC_CMD_DEL_STATION, + /** Change station info nrf_wifi_umac_cmd_chg_sta */ + NRF_WIFI_UMAC_CMD_SET_STATION, + /** Get station info nrf_wifi_umac_cmd_get_sta */ + NRF_WIFI_UMAC_CMD_GET_STATION, + /** Start the P2P device nrf_wifi_cmd_start_p2p */ + NRF_WIFI_UMAC_CMD_START_P2P_DEVICE, + /** Stop the P2P device nrf_wifi_umac_cmd_stop_p2p_dev */ + NRF_WIFI_UMAC_CMD_STOP_P2P_DEVICE, + /** Remain awake on the specified channel nrf_wifi_umac_cmd_remain_on_channel */ + NRF_WIFI_UMAC_CMD_REMAIN_ON_CHANNEL, + /** Cancel a pending ROC duration nrf_wifi_umac_cmd_cancel_remain_on_channel */ + NRF_WIFI_UMAC_CMD_CANCEL_REMAIN_ON_CHANNEL, + /** Unused */ + NRF_WIFI_UMAC_CMD_SET_CHANNEL, + /** Unused */ + NRF_WIFI_UMAC_CMD_RADAR_DETECT, + /** Whitelist filter based on frame types nrf_wifi_umac_cmd_mgmt_frame_reg */ + NRF_WIFI_UMAC_CMD_REGISTER_FRAME, + /** Send a management frame nrf_wifi_umac_cmd_mgmt_tx */ + NRF_WIFI_UMAC_CMD_FRAME, + /** Unused */ + NRF_WIFI_UMAC_CMD_JOIN_IBSS, + /** Unused */ + NRF_WIFI_UMAC_CMD_WIN_STA_CONNECT, + /** Power save Enable/Disable nrf_wifi_umac_cmd_set_power_save */ + NRF_WIFI_UMAC_CMD_SET_POWER_SAVE, + /** Unused */ + NRF_WIFI_UMAC_CMD_SET_WOWLAN, + /** Unused */ + NRF_WIFI_UMAC_CMD_SUSPEND, + /** Unused */ + NRF_WIFI_UMAC_CMD_RESUME, + /** QOS map nrf_wifi_umac_cmd_set_qos_map */ + NRF_WIFI_UMAC_CMD_SET_QOS_MAP, + /** Get Channel info nrf_wifi_umac_cmd_get_channel */ + NRF_WIFI_UMAC_CMD_GET_CHANNEL, + /** Get Tx power level nrf_wifi_umac_cmd_get_tx_power */ + NRF_WIFI_UMAC_CMD_GET_TX_POWER, + /** Get interface nrf_wifi_cmd_get_interface */ + NRF_WIFI_UMAC_CMD_GET_INTERFACE, + /** Get Wiphy info nrf_wifi_cmd_get_wiphy */ + NRF_WIFI_UMAC_CMD_GET_WIPHY, + /** Get hardware address nrf_wifi_cmd_get_ifhwaddr */ + NRF_WIFI_UMAC_CMD_GET_IFHWADDR, + /** Set hardware address nrf_wifi_cmd_set_ifhwaddr */ + NRF_WIFI_UMAC_CMD_SET_IFHWADDR, + /** Get regulatory domain nrf_wifi_umac_cmd_get_reg */ + NRF_WIFI_UMAC_CMD_GET_REG, + /** Unused */ + NRF_WIFI_UMAC_CMD_SET_REG, + /** Set regulatory domain nrf_wifi_cmd_req_set_reg */ + NRF_WIFI_UMAC_CMD_REQ_SET_REG, + /** Config UAPSD nrf_wifi_umac_cmd_config_uapsd */ + NRF_WIFI_UMAC_CMD_CONFIG_UAPSD, + /** Config TWT nrf_wifi_umac_cmd_config_twt */ + NRF_WIFI_UMAC_CMD_CONFIG_TWT, + /** Teardown TWT nrf_wifi_umac_cmd_teardown_twt */ + NRF_WIFI_UMAC_CMD_TEARDOWN_TWT, + /** Abort scan nrf_wifi_umac_cmd_abort_scan */ + NRF_WIFI_UMAC_CMD_ABORT_SCAN, + /** Multicast filter nrf_wifi_umac_cmd_mcast_filter */ + NRF_WIFI_UMAC_CMD_MCAST_FILTER, + /** Change macaddress nrf_wifi_umac_cmd_change_macaddr */ + NRF_WIFI_UMAC_CMD_CHANGE_MACADDR, + /** Set powersave timeout nrf_wifi_umac_cmd_set_power_save_timeout */ + NRF_WIFI_UMAC_CMD_SET_POWER_SAVE_TIMEOUT, + /** Get connection information nrf_wifi_umac_cmd_conn_info */ + NRF_WIFI_UMAC_CMD_GET_CONNECTION_INFO, + /** Get power save information nrf_wifi_umac_cmd_get_power_save_info */ + NRF_WIFI_UMAC_CMD_GET_POWER_SAVE_INFO, + /** Set listen interval nrf_wifi_umac_cmd_set_listen_interval */ + NRF_WIFI_UMAC_CMD_SET_LISTEN_INTERVAL, + /** Configure extended power save nrf_wifi_umac_cmd_config_extended_ps */ + NRF_WIFI_UMAC_CMD_CONFIG_EXTENDED_PS, + /** Configure quiet period nrf_wifi_umac_cmd_config_quiet_period */ + NRF_WIFI_UMAC_CMD_CONFIG_QUIET_PERIOD, + /** Command to specify power save exit strategy */ + NRF_WIFI_UMAC_CMD_PS_EXIT_STRATEGY, + /** Command to program Rx buffers to RPU */ + NRF_WIFI_UMAC_CMD_CONFIG_RX_BUF, +}; + + /** + * @brief The host can receive the following events from the RPU. + * + */ + +enum nrf_wifi_umac_events { + NRF_WIFI_UMAC_EVENT_UNSPECIFIED = 256, + /** Indicate scan started nrf_wifi_umac_event_trigger_scan */ + NRF_WIFI_UMAC_EVENT_TRIGGER_SCAN_START, + /** Unused */ + NRF_WIFI_UMAC_EVENT_SCAN_ABORTED, + /** Indicate scan done nrf_wifi_umac_event_scan_done */ + NRF_WIFI_UMAC_EVENT_SCAN_DONE, + /** Scan result event nrf_wifi_umac_event_new_scan_results */ + NRF_WIFI_UMAC_EVENT_SCAN_RESULT, + /** Authentication status nrf_wifi_umac_event_mlme */ + NRF_WIFI_UMAC_EVENT_AUTHENTICATE, + /** Association status nrf_wifi_umac_event_mlme*/ + NRF_WIFI_UMAC_EVENT_ASSOCIATE, + /** Unused */ + NRF_WIFI_UMAC_EVENT_CONNECT, + /** Station deauth event nrf_wifi_umac_event_mlme */ + NRF_WIFI_UMAC_EVENT_DEAUTHENTICATE, + /** Station disassoc event nrf_wifi_umac_event_mlme */ + NRF_WIFI_UMAC_EVENT_DISASSOCIATE, + /** Station added indication nrf_wifi_umac_event_new_station */ + NRF_WIFI_UMAC_EVENT_NEW_STATION, + /** Station added indication nrf_wifi_umac_event_new_station */ + NRF_WIFI_UMAC_EVENT_DEL_STATION, + /** Station info indication nrf_wifi_umac_event_new_station */ + NRF_WIFI_UMAC_EVENT_GET_STATION, + /** remain on channel event nrf_wifi_event_remain_on_channel */ + NRF_WIFI_UMAC_EVENT_REMAIN_ON_CHANNEL, + /** Unused */ + NRF_WIFI_UMAC_EVENT_CANCEL_REMAIN_ON_CHANNEL, + /** Unused */ + NRF_WIFI_UMAC_EVENT_DISCONNECT, + /** RX management frame nrf_wifi_umac_event_mlme */ + NRF_WIFI_UMAC_EVENT_FRAME, + /** Cookie mapping for NRF_WIFI_UMAC_CMD_FRAME nrf_wifi_umac_event_cookie_rsp */ + NRF_WIFI_UMAC_EVENT_COOKIE_RESP, + /** TX management frame transmitted nrf_wifi_umac_event_mlme */ + NRF_WIFI_UMAC_EVENT_FRAME_TX_STATUS, + /** nrf_wifi_umac_event_vif_state */ + NRF_WIFI_UMAC_EVENT_IFFLAGS_STATUS, + /** Send Tx power nrf_wifi_umac_event_get_tx_power */ + NRF_WIFI_UMAC_EVENT_GET_TX_POWER, + /** Send Channel info nrf_wifi_umac_event_get_channel */ + NRF_WIFI_UMAC_EVENT_GET_CHANNEL, + /** nrf_wifi_umac_event_set_interface */ + NRF_WIFI_UMAC_EVENT_SET_INTERFACE, + /** nrf_wifi_umac_event_mlme */ + NRF_WIFI_UMAC_EVENT_UNPROT_DEAUTHENTICATE, + /** nrf_wifi_umac_event_mlme */ + NRF_WIFI_UMAC_EVENT_UNPROT_DISASSOCIATE, + /** nrf_wifi_interface_info */ + NRF_WIFI_UMAC_EVENT_NEW_INTERFACE, + /** nrf_wifi_event_get_wiphy */ + NRF_WIFI_UMAC_EVENT_NEW_WIPHY, + /** Unused */ + NRF_WIFI_UMAC_EVENT_GET_IFHWADDR, + /** Get regulatory nrf_wifi_reg */ + NRF_WIFI_UMAC_EVENT_GET_REG, + /** Unused */ + NRF_WIFI_UMAC_EVENT_SET_REG, + /** Unused */ + NRF_WIFI_UMAC_EVENT_REQ_SET_REG, + /** Unused */ + NRF_WIFI_UMAC_EVENT_GET_KEY, + /** Unused */ + NRF_WIFI_UMAC_EVENT_BEACON_HINT, + /** Unused */ + NRF_WIFI_UMAC_EVENT_REG_CHANGE, + /** Unused */ + NRF_WIFI_UMAC_EVENT_WIPHY_REG_CHANGE, + /** Display scan result nrf_wifi_umac_event_new_scan_display_results */ + NRF_WIFI_UMAC_EVENT_SCAN_DISPLAY_RESULT, + /** nrf_wifi_umac_event_cmd_status */ + NRF_WIFI_UMAC_EVENT_CMD_STATUS, + /** nrf_wifi_umac_event_new_scan_results */ + NRF_WIFI_UMAC_EVENT_BSS_INFO, + /** Send TWT response information nrf_wifi_umac_cmd_config_twt */ + NRF_WIFI_UMAC_EVENT_CONFIG_TWT, + /** Send TWT teardown information nrf_wifi_umac_cmd_teardown_twt */ + NRF_WIFI_UMAC_EVENT_TEARDOWN_TWT, + /** Send block or unblock state nrf_wifi_umac_event_twt_sleep */ + NRF_WIFI_UMAC_EVENT_TWT_SLEEP, + /** Unused */ + NRF_WIFI_UMAC_EVENT_COALESCING, + /** Unused */ + NRF_WIFI_UMAC_EVENT_MCAST_FILTER, + /** send connection information nrf_wifi_umac_event_conn_info. */ + NRF_WIFI_UMAC_EVENT_GET_CONNECTION_INFO, + /** nrf_wifi_umac_event_power_save_info */ + NRF_WIFI_UMAC_EVENT_GET_POWER_SAVE_INFO +}; + +/** + * @brief Represents the values that can be used to specify the frequency band. + * + */ + +enum nrf_wifi_band { + /** 2.4 GHz ISM band */ + NRF_WIFI_BAND_2GHZ, + /** Around 5 GHz band (4.9 - 5.7 GHz) */ + NRF_WIFI_BAND_5GHZ, + /** 6 GHz band (5.9 -6.4 GHz) */ + NRF_WIFI_BAND_6GHZ, + /** Unused */ + NRF_WIFI_BAND_60GHZ, + /** Invalid */ + NRF_WIFI_BAND_INVALID +}; + +/** + * @brief Enable or Disable Management Frame Protection. + * + */ +enum nrf_wifi_mfp { + /** Management frame protection not used */ + NRF_WIFI_MFP_NO, + /** Management frame protection required */ + NRF_WIFI_MFP_REQUIRED, +}; + +/** + * @brief Enumerates the various categories of security keys. + * + */ +enum nrf_wifi_key_type { + /** Group (broadcast/multicast) key */ + NRF_WIFI_KEYTYPE_GROUP, + /** Pairwise (unicast/individual) key */ + NRF_WIFI_KEYTYPE_PAIRWISE, + /** Peer key (DLS) */ + NRF_WIFI_KEYTYPE_PEERKEY, + /** Number of defined key types */ + NUM_NRF_WIFI_KEYTYPES +}; + +/** + * @brief Enumerates the various types of authentication mechanisms. + * + */ +enum nrf_wifi_auth_type { + /** Open System authentication */ + NRF_WIFI_AUTHTYPE_OPEN_SYSTEM, + /** Shared Key authentication (WEP only) */ + NRF_WIFI_AUTHTYPE_SHARED_KEY, + /** Fast BSS Transition (IEEE 802.11r) */ + NRF_WIFI_AUTHTYPE_FT, + /** Network EAP (some Cisco APs and mainly LEAP) */ + NRF_WIFI_AUTHTYPE_NETWORK_EAP, + /** Simultaneous authentication of equals */ + NRF_WIFI_AUTHTYPE_SAE, + /** Internal */ + __NRF_WIFI_AUTHTYPE_NUM, + /** Maximum valid auth algorithm */ + NRF_WIFI_AUTHTYPE_MAX = __NRF_WIFI_AUTHTYPE_NUM, + /** Determine automatically (if necessary by trying multiple times) */ + NRF_WIFI_AUTHTYPE_AUTOMATIC +}; + +/** + * @brief Represents the interface's status concerning this BSS (Basic Service Set). + * + */ +enum nrf_wifi_bss_status { + /** + * Authenticated with this BSS + * Note that this is no longer used since cfg80211 no longer + * keeps track of whether or not authentication was done with + * a given BSS. + */ + NRF_WIFI_BSS_STATUS_AUTHENTICATED, + /** Associated with this BSS */ + NRF_WIFI_BSS_STATUS_ASSOCIATED, + /** Joined to this IBSS */ + NRF_WIFI_BSS_STATUS_IBSS_JOINED, +}; + +/** + * @brief Enumerates the various categories of channels. + * + */ +enum nrf_wifi_channel_type { + /** 20 MHz, non-HT channel */ + NRF_WIFI_CHAN_NO_HT, + /** 20 MHz HT channel */ + NRF_WIFI_CHAN_HT20, + /** HT40 channel, secondary channel below the control channel */ + NRF_WIFI_CHAN_HT40MINUS, + /** HT40 channel, secondary channel above the control channel */ + NRF_WIFI_CHAN_HT40PLUS +}; + +/** + * @brief Enumerates the various channel widths available. + * + */ +enum nrf_wifi_chan_width { + /** 20 MHz, non-HT channel */ + NRF_WIFI_CHAN_WIDTH_20_NOHT, + /** 20 MHz HT channel */ + NRF_WIFI_CHAN_WIDTH_20, + /** 40 MHz channel, the NRF_WIFI_ATTR_CENTER_FREQ1 must be provided as well */ + NRF_WIFI_CHAN_WIDTH_40, + /** 80 MHz channel, the NRF_WIFI_ATTR_CENTER_FREQ1 must be provided as well */ + NRF_WIFI_CHAN_WIDTH_80, + /** 80+80 MHz channel, the NRF_WIFI_ATTR_CENTER_FREQ1 and + * NRF_WIFI_ATTR_CENTER_FREQ2 must be provided as well + */ + NRF_WIFI_CHAN_WIDTH_80P80, + /** 160 MHz channel, the NRF_WIFI_ATTR_CENTER_FREQ1 must be provided as well */ + NRF_WIFI_CHAN_WIDTH_160, + /** 5 MHz OFDM channel */ + NRF_WIFI_CHAN_WIDTH_5, + /** 10 MHz OFDM channel */ + NRF_WIFI_CHAN_WIDTH_10, +}; + +/** + * @brief Interface types based on functionality. + * + */ +enum nrf_wifi_iftype { + /** Unspecified type, driver decides */ + NRF_WIFI_IFTYPE_UNSPECIFIED, + /** Not Supported */ + NRF_WIFI_IFTYPE_ADHOC, + /** Managed BSS member */ + NRF_WIFI_IFTYPE_STATION, + /** Access point */ + NRF_WIFI_IFTYPE_AP, + /** Not Supported */ + NRF_WIFI_IFTYPE_AP_VLAN, + /** Not Supported */ + NRF_WIFI_IFTYPE_WDS, + /** Not Supported */ + NRF_WIFI_IFTYPE_MONITOR, + /** Not Supported */ + NRF_WIFI_IFTYPE_MESH_POINT, + /** P2P client */ + NRF_WIFI_IFTYPE_P2P_CLIENT, + /** P2P group owner */ + NRF_WIFI_IFTYPE_P2P_GO, + /** P2P device use the NRF_WIFI_UMAC_CMD_START_P2P_DEVICE & + * NRF_WIFI_UMAC_CMD_STOP_P2P_DEVICE commands to create and destroy one + */ + NRF_WIFI_IFTYPE_P2P_DEVICE, + /** Not Supported */ + NRF_WIFI_IFTYPE_OCB, + /** Tx Packet injector mode. */ + NRF_WIFI_TX_INJECTOR, + /** Station + Tx Packet injector mode. */ + NRF_WIFI_STA_TX_INJECTOR, + /** Monitor + Tx Packet injector mode. */ + NRF_WIFI_MONITOR_TX_INJECTOR, + /** Station + Promiscuous mode. */ + NRF_WIFI_STA_PROMISC, + /** Station + Promiscuous mode + TX Packet injector. */ + NRF_WIFI_STA_PROMISC_TX_INJECTOR, + /** Highest interface type number currently defined */ + NUM_NRF_WIFI_IFTYPES, + /** Number of defined interface types */ + NRF_WIFI_IFTYPE_MAX = NUM_NRF_WIFI_IFTYPES - 1 +}; + +/** + * @brief Powersave state. + * + */ +enum nrf_wifi_ps_state { + /** powersave is disabled */ + NRF_WIFI_PS_DISABLED, + /** powersave is enabled */ + NRF_WIFI_PS_ENABLED, +}; + +/** + * @brief WLAN security types. + * + */ +enum nrf_wifi_security_type { + /** OPEN */ + NRF_WIFI_OPEN, + /** WEP */ + NRF_WIFI_WEP, + /** WPA */ + NRF_WIFI_WPA, + /** WPA2 */ + NRF_WIFI_WPA2, + /** WAPI */ + NRF_WIFI_WAPI, + /** Enterprise mode */ + NRF_WIFI_EAP, + /** FT 8021X */ + NRF_WIFI_FT_EAP, + /** Enterprise tls SHA256 */ + NRF_WIFI_EAP_TLS_SHA256, + /** WPA2 SHA256 */ + NRF_WIFI_WPA2_256, + /** WPA3 */ + NRF_WIFI_WPA3, + /** 8021X SUITE-B SHA256 */ + NRF_WIFI_EAP_SUITEB_SHA256, + /** 8021X SUITE-B SHA384 */ + NRF_WIFI_EAP_SUITEB_SHA384, + /** FT 8021X SHA384 */ + NRF_WIFI_FT_EAP_SHA384, + /** FT PSK SHA384 */ + NRF_WIFI_FT_PSK_SHA384, + /** PSK SHA384 */ + NRF_WIFI_PSK_SHA384, + /** Enhanced Open: Opportunistic wirelesss encryption */ + NRF_WIFI_OWE, +}; + +/** + * @brief Denotes the originator of a regulatory domain request. + * + */ +enum nrf_wifi_reg_initiator { + /** Core queried CRDA for a dynamic world regulatory domain */ + NRF_WIFI_REGDOM_SET_BY_CORE, + /** User asked the wireless core to set the regulatory domain */ + NRF_WIFI_REGDOM_SET_BY_USER, + /** + * A wireless drivers has hinted to the wireless core it thinks + * its knows the regulatory domain we should be in + */ + NRF_WIFI_REGDOM_SET_BY_DRIVER, + /** + * the wireless core has received an + * 802.11 country information element with regulatory information it + * thinks we should consider. cfg80211 only processes the country + * code from the IE, and relies on the regulatory domain information + * structure passed by userspace (CRDA) from our wireless-regdb + * If a channel is enabled but the country code indicates it should + * be disabled we disable the channel and re-enable it upon disassociation + */ + NRF_WIFI_REGDOM_SET_BY_COUNTRY_IE, +}; + +/** + * @brief Specifies the type of regulatory domain. + * + */ +enum nrf_wifi_reg_type { + /** + * the regulatory domain set is one that pertains + * to a specific country. When this is set you can count on the + * ISO / IEC 3166 alpha2 country code being valid. + * + */ + NRF_WIFI_REGDOM_TYPE_COUNTRY, + /** the regulatory set domain is the world regulatory domain */ + NRF_WIFI_REGDOM_TYPE_WORLD, + /** + * the regulatory domain set is a custom + * driver specific world regulatory domain. These do not apply system-wide + * and are only applicable to the individual devices which have requested + * them to be applied. + */ + NRF_WIFI_REGDOM_TYPE_CUSTOM_WORLD, + /** + * the regulatory domain set is the product + * of an intersection between two regulatory domains -- the previously + * set regulatory domain on the system and the last accepted regulatory + * domain request to be processed. + */ + NRF_WIFI_REGDOM_TYPE_INTERSECTION, +}; + +#define NRF_WIFI_MAX_SSID_LEN 32 + +/** + * @brief This structure provides details about the SSID. + * + */ + +struct nrf_wifi_ssid { + /** length of SSID */ + unsigned char nrf_wifi_ssid_len; + /** SSID string */ + unsigned char nrf_wifi_ssid[NRF_WIFI_MAX_SSID_LEN]; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_MAX_IE_LEN 400 + +/** + * @brief This structure contains data related to the Information Elements (IEs). + * + */ + +struct nrf_wifi_ie { + /** length of IE */ + unsigned short ie_len; + /** Information element data */ + signed char ie[NRF_WIFI_MAX_IE_LEN]; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_MAX_SEQ_LENGTH 256 + +/** + * @brief Transmit key sequence number. + * + */ + +struct nrf_wifi_seq { + /** Length of the seq parameter */ + signed int nrf_wifi_seq_len; + /** Key sequence number data */ + unsigned char nrf_wifi_seq[NRF_WIFI_MAX_SEQ_LENGTH]; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_MAX_KEY_LENGTH 256 + +/** + * @brief This structure holds information related to a security key. + * + */ + +struct nrf_wifi_key { + /** Length of the key data */ + unsigned int nrf_wifi_key_len; + /** Key data */ + unsigned char nrf_wifi_key[NRF_WIFI_MAX_KEY_LENGTH]; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_MAX_SAE_DATA_LENGTH 256 + +/** + * @brief This structure represents SAE elements in Authentication frame. + * + */ + +struct nrf_wifi_sae { + /** Length of SAE element data */ + signed int sae_data_len; + /** SAE element data */ + unsigned char sae_data[NRF_WIFI_MAX_SAE_DATA_LENGTH]; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_MAX_FRAME_LEN 400 + +/** + * @brief This structure defines the frame that is intended for transmission. + * + */ + +struct nrf_wifi_frame { + /** Length of the frame */ + signed int frame_len; + /** frame data */ + signed char frame[NRF_WIFI_MAX_FRAME_LEN]; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_INDEX_IDS_WDEV_ID_VALID (1 << 0) +#define NRF_WIFI_INDEX_IDS_IFINDEX_VALID (1 << 1) +#define NRF_WIFI_INDEX_IDS_WIPHY_IDX_VALID (1 << 2) + +/** + * @brief This structure contains details about the interface information. + * + */ + +struct nrf_wifi_index_ids { + /** Indicate which properties below are set */ + unsigned int valid_fields; + /** wdev id */ + signed int ifaceindex; + /** Unused */ + signed int nrf_wifi_wiphy_idx; + /** Unused */ + unsigned long long wdev_id; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_SUPP_RATES_BAND_VALID (1 << 0) +#define NRF_WIFI_MAX_SUPP_RATES 60 + +/** + * @brief This structure provides information about the rate parameters. + * + */ + +struct nrf_wifi_supp_rates { + /** Indicate which of the following parameters are valid */ + unsigned int valid_fields; + /** Frequency band, see &enum nrf_wifi_band */ + signed int band; + /** Number of values in rates parameter */ + signed int nrf_wifi_num_rates; + /** List of supported rates as defined by IEEE 802.11 7.3.2.2 */ + unsigned char rates[NRF_WIFI_MAX_SUPP_RATES]; +} __NRF_WIFI_PKD; + +/** + * @brief This structure contains details about a channel's information. + * + */ +struct nrf_wifi_channel { + /** band this channel belongs to */ + signed int band; + /** center frequency in MHz */ + unsigned int center_frequency; + /** channel flags from see &enum nrf_wifi_channel_flags */ + unsigned int nrf_wifi_flags; + /** maximum antenna gain in dBi */ + signed int nrf_wifi_max_antenna_gain; + /** maximum transmission power (in dBm) */ + signed int nrf_wifi_max_power; + /** maximum regulatory transmission power (in dBm) */ + signed int nrf_wifi_max_reg_power; + /** channel flags at registration time, used by regulatory + * code to support devices with additional restrictions + */ + unsigned int nrf_wifi_orig_flags; + /** internal use */ + signed int nrf_wifi_orig_mag; + /** internal use */ + signed int nrf_wifi_orig_mpwr; + /** hardware-specific value for the channel */ + unsigned short hw_value; + /** helper to regulatory code to indicate when a beacon + * has been found on this channel. Use regulatory_hint_found_beacon() + * to enable this, this is useful only on 5 GHz band. + */ + signed char nrf_wifi_beacon_found; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_SCAN_MAX_NUM_SSIDS 2 +/** 25 more chaanels in 6 GHz upto U-NII-5*/ +#define NRF_WIFI_SCAN_MAX_NUM_FREQUENCIES 89 +#define MAX_NUM_CHANNELS 42 + +#define NRF_WIFI_SCAN_BAND_2GHZ (1 << 0) +#define NRF_WIFI_SCAN_BAND_5GHZ (1 << 1) +#define NRF_WIFI_SCAN_BAND_6GHZ (1 << 2) + +/** + * @brief This structure provides details about the parameters required for a scan request. + * + */ +struct nrf_wifi_scan_params { + /** If 0x1, RPU force passive scan on all channels */ + unsigned short passive_scan; + /** Number of ssid's in scan_ssids parameter */ + unsigned char num_scan_ssids; + /** Specific SSID's to scan for */ + struct nrf_wifi_ssid scan_ssids[NRF_WIFI_SCAN_MAX_NUM_SSIDS]; + /** used to send probe requests at non CCK rate in 2GHz band */ + unsigned char no_cck; + /** Bitmap of bands to be scanned. Value Zero will scan both 2.4 and 5 GHZ */ + unsigned char bands; + /** Information element(s) data nrf_wifi_ie*/ + struct nrf_wifi_ie ie; + /** MAC address */ + unsigned char mac_addr[NRF_WIFI_ETH_ADDR_LEN]; + /** Max scan duration in active scan. If zero rpu programs 50msec */ + unsigned short dwell_time_active; + /** Max scan duration in passive scan. If zero rpu programs 150msec */ + unsigned short dwell_time_passive; + /** Number of channels to be scanned */ + unsigned short num_scan_channels; + /** If true, skip local and IANA Unicast reserved MACs **/ + unsigned char skip_local_admin_macs; + /** specific channels to be scanned */ + unsigned int center_frequency[0]; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_HT_CAPABILITY_VALID (1 << 0) +#define NRF_WIFI_HT_CAPABILITY_MASK_VALID (1 << 1) +#define NRF_WIFI_VHT_CAPABILITY_VALID (1 << 2) +#define NRF_WIFI_VHT_CAPABILITY_MASK_VALID (1 << 3) + +#define NRF_WIFI_CMD_HT_VHT_CAPABILITY_DISABLE_HT (1 << 0) +#define NRF_WIFI_HT_VHT_CAPABILITY_MAX_SIZE 256 + +/** + * @brief This structure contains specific information about the VHT (Very High Throughput) + * and HT ((High Throughput)) capabilities. + * + */ + +struct nrf_wifi_ht_vht_capabilities { + /** Indicate which of the following parameters are valid */ + unsigned int valid_fields; + /** Indicate which capabilities have been specified */ + unsigned short nrf_wifi_flags; + /** HT Capability information element (from association request when + * used with NRF_WIFI_UMAC_CMD_NEW_STATION). + */ + unsigned char ht_capability[NRF_WIFI_HT_VHT_CAPABILITY_MAX_SIZE]; + /** Specify which bits of the ht_capability are masked */ + unsigned char ht_capability_mask[NRF_WIFI_HT_VHT_CAPABILITY_MAX_SIZE]; + /** VHT Capability information element */ + unsigned char vht_capability[NRF_WIFI_HT_VHT_CAPABILITY_MAX_SIZE]; + /** Specify which bits in vht_capability to which attention should be paid */ + unsigned char vht_capability_mask[NRF_WIFI_HT_VHT_CAPABILITY_MAX_SIZE]; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_SIGNAL_TYPE_NONE 1 +#define NRF_WIFI_SIGNAL_TYPE_MBM 2 +#define NRF_WIFI_SIGNAL_TYPE_UNSPEC 3 + +/** + * @brief This structure represents information related to the signal strength. + * + */ + +struct nrf_wifi_signal { + /** MBM or unspecified */ + unsigned int signal_type; + + /** signal */ + union { + /** If MBM signal strength of probe response/beacon + * in mBm (100 * dBm) (s32) + */ + unsigned int mbm_signal; + /** If unspecified signal strength of the probe response/beacon + * in unspecified units, scaled to 0..100 (u8). + */ + unsigned char unspec_signal; + } __NRF_WIFI_PKD signal; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_WPA_VERSION_1 (1 << 0) +#define NRF_WIFI_WPA_VERSION_2 (1 << 1) + +#define NRF_WIFI_CONNECT_COMMON_INFO_MAC_ADDR_VALID (1 << 0) +#define NRF_WIFI_CONNECT_COMMON_INFO_MAC_ADDR_HINT_VALID (1 << 1) +#define NRF_WIFI_CONNECT_COMMON_INFO_FREQ_VALID (1 << 2) +#define NRF_WIFI_CONNECT_COMMON_INFO_FREQ_HINT_VALID (1 << 3) +#define NRF_WIFI_CONNECT_COMMON_INFO_BG_SCAN_PERIOD_VALID (1 << 4) +#define NRF_WIFI_CONNECT_COMMON_INFO_SSID_VALID (1 << 5) +#define NRF_WIFI_CONNECT_COMMON_INFO_WPA_IE_VALID (1 << 6) +#define NRF_WIFI_CONNECT_COMMON_INFO_WPA_VERSIONS_VALID (1 << 7) +#define NRF_WIFI_CONNECT_COMMON_INFO_CIPHER_SUITES_PAIRWISE_VALID (1 << 8) +#define NRF_WIFI_CONNECT_COMMON_INFO_CIPHER_SUITE_GROUP_VALID (1 << 9) +#define NRF_WIFI_CONNECT_COMMON_INFO_AKM_SUITES_VALID (1 << 10) +#define NRF_WIFI_CONNECT_COMMON_INFO_USE_MFP_VALID (1 << 11) +#define NRF_WIFI_CONNECT_COMMON_INFO_CONTROL_PORT_ETHER_TYPE (1 << 12) +#define NRF_WIFI_CONNECT_COMMON_INFO_CONTROL_PORT_NO_ENCRYPT (1 << 13) + +#define NRF_WIFI_MAX_NR_AKM_SUITES 2 + +#define NRF_WIFI_CMD_CONNECT_COMMON_INFO_USE_RRM (1 << 14) +#define NRF_WIFI_CONNECT_COMMON_INFO_PREV_BSSID (1 << 15) +#define NRF_WIFI_CONNECT_COMMON_INFO_SECURITY (1 << 16) +/** + * @brief This structure contains parameters related to the connection. + * + */ + +struct nrf_wifi_connect_common_info { + /** Indicate which of the following parameters are valid */ + unsigned int valid_fields; + /** Frequency of the selected channel in MHz */ + unsigned int frequency; + /** Frequency of the recommended initial BSS */ + unsigned int freq_hint; + /** Indicates which WPA version(s) */ + unsigned int wpa_versions; + /** Number of pairwise cipher suites */ + signed int num_cipher_suites_pairwise; + /** For crypto settings, indicates which pairwise cipher suites are used */ + unsigned int cipher_suites_pairwise[7]; + /** For crypto settings, indicates which group cipher suite is used */ + unsigned int cipher_suite_group; + /** Number of groupwise cipher suites */ + unsigned int num_akm_suites; + /** Indicate which key management algorithm(s) to use */ + unsigned int akm_suites[NRF_WIFI_MAX_NR_AKM_SUITES]; + /** Whether management frame protection (IEEE 802.11w) is used for the association */ + signed int use_mfp; + /** Flag for indicating whether the current connection + * shall support Radio Resource Measurements (11k) + */ + unsigned int nrf_wifi_flags; + /** Background scan period in seconds or 0 to disable background scan */ + unsigned short bg_scan_period; + /** MAC address */ + unsigned char mac_addr[NRF_WIFI_ETH_ADDR_LEN]; + /** MAC address recommendation as initial BSS */ + unsigned char mac_addr_hint[NRF_WIFI_ETH_ADDR_LEN]; + /** SSID (binary attribute, 0..32 octets) */ + struct nrf_wifi_ssid ssid; + /** IE's nrf_wifi_ie */ + struct nrf_wifi_ie wpa_ie; + /** VHT Capability information element nrf_wifi_ht_vht_capabilities */ + struct nrf_wifi_ht_vht_capabilities ht_vht_capabilities; + /** A 16-bit value indicating the ethertype that will be used for key negotiation. + * If it is not specified, the value defaults to 0x888E. + */ + unsigned short control_port_ether_type; + /** When included along with control_port_ether_type, indicates that the custom + * ethertype frames used for key negotiation must not be encrypted. + */ + unsigned char control_port_no_encrypt; + /** Indicating whether user space controls IEEE 802.1X port, If set, the RPU will + * assume that the port is unauthorized until authorized by user space. + * Otherwise, port is marked authorized by default in station mode. + */ + signed char control_port; + /** previous BSSID, used to specify a request to reassociate + * within an ESS that is, to use Reassociate Request frame (with the value of + * this attribute in the Current AP address field) instead of Association + * Request frame which is used for the initial association to an ESS. + */ + unsigned char prev_bssid[NRF_WIFI_ETH_ADDR_LEN]; + /** Bss max idle timeout value in sec which will be encapsulated into + * BSS MAX IDLE IE in assoc request frame. + */ + unsigned short maxidle_insec; + +} __NRF_WIFI_PKD; + +#define NRF_WIFI_BEACON_DATA_MAX_HEAD_LEN 256 +#define NRF_WIFI_BEACON_DATA_MAX_TAIL_LEN 512 +#define NRF_WIFI_BEACON_DATA_MAX_PROBE_RESP_LEN 400 + +/** + * @brief This structure provides information about beacon and probe data. + * + */ + +struct nrf_wifi_beacon_data { + /** length of head */ + unsigned int head_len; + /** length of tail */ + unsigned int tail_len; + /** length of probe response template (probe_resp) */ + unsigned int probe_resp_len; + /** head portion of beacon (before TIM IE) or %NULL if not changed */ + unsigned char head[NRF_WIFI_BEACON_DATA_MAX_HEAD_LEN]; + /** tail portion of beacon (after TIM IE) or %NULL if not changed */ + unsigned char tail[NRF_WIFI_BEACON_DATA_MAX_TAIL_LEN]; + /** probe response template */ + unsigned char probe_resp[NRF_WIFI_BEACON_DATA_MAX_PROBE_RESP_LEN]; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_STA_FLAG_INVALID (1 << 0) +#define NRF_WIFI_STA_FLAG_AUTHORIZED (1 << 1) +#define NRF_WIFI_STA_FLAG_SHORT_PREAMBLE (1 << 2) +#define NRF_WIFI_STA_FLAG_WME (1 << 3) +#define NRF_WIFI_STA_FLAG_MFP (1 << 4) +#define NRF_WIFI_STA_FLAG_AUTHENTICATED (1 << 5) +#define NRF_WIFI_STA_FLAG_TDLS_PEER (1 << 6) +#define NRF_WIFI_STA_FLAG_ASSOCIATED (1 << 7) + +/** + * @brief This structure provides information regarding station flags. + * + */ + +struct nrf_wifi_sta_flag_update { + /** Mask of station flags to set */ + unsigned int nrf_wifi_mask; + /** Values to set them to. NRF_WIFI_STA_FLAG_AUTHORIZED */ + unsigned int nrf_wifi_set; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_RATE_INFO_BITRATE_VALID (1 << 0) +#define NRF_WIFI_RATE_INFO_BITRATE_COMPAT_VALID (1 << 1) +#define NRF_WIFI_RATE_INFO_BITRATE_MCS_VALID (1 << 2) +#define NRF_WIFI_RATE_INFO_BITRATE_VHT_MCS_VALID (1 << 3) +#define NRF_WIFI_RATE_INFO_BITRATE_VHT_NSS_VALID (1 << 4) + +#define NRF_WIFI_RATE_INFO_0_MHZ_WIDTH (1 << 0) +#define NRF_WIFI_RATE_INFO_5_MHZ_WIDTH (1 << 1) +#define NRF_WIFI_RATE_INFO_10_MHZ_WIDTH (1 << 2) +#define NRF_WIFI_RATE_INFO_40_MHZ_WIDTH (1 << 3) +#define NRF_WIFI_RATE_INFO_80_MHZ_WIDTH (1 << 4) +#define NRF_WIFI_RATE_INFO_160_MHZ_WIDTH (1 << 5) +#define NRF_WIFI_RATE_INFO_SHORT_GI (1 << 6) +#define NRF_WIFI_RATE_INFO_80P80_MHZ_WIDTH (1 << 7) + +/** + * @brief This structure contains information about rate parameters. + * + */ + +struct nrf_wifi_rate_info { + /** Valid fields with in this structure */ + unsigned int valid_fields; + /** bitrate */ + unsigned int bitrate; + /** Bitrate compatible */ + unsigned short bitrate_compat; + /** Modulation and Coding Scheme(MCS) */ + unsigned char nrf_wifi_mcs; + /** MCS related to VHT */ + unsigned char vht_mcs; + /** NSS related to VHT */ + unsigned char vht_nss; + /** Rate flags NRF_WIFI_RATE_INFO_0_MHZ_WIDTH */ + unsigned int nrf_wifi_flags; + +} __NRF_WIFI_PKD; + +#define NRF_WIFI_BSS_PARAM_FLAGS_CTS_PROT (1<<0) +#define NRF_WIFI_BSS_PARAM_FLAGS_SHORT_PREAMBLE (1<<1) +#define NRF_WIFI_BSS_PARAM_FLAGS_SHORT_SLOT_TIME (1<<2) + +/** + * @brief This structure provides information about the Basic Service Set (BSS) + * parameters for the attached station. + * + */ +struct nrf_wifi_sta_bss_parameters { + /** bitfields of flags NRF_WIFI_BSS_PARAM_FLAGS_CTS_PROT */ + unsigned char nrf_wifi_flags; + /** DTIM period for the BSS */ + unsigned char dtim_period; + /** beacon interval */ + unsigned short beacon_interval; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_STA_INFO_CONNECTED_TIME_VALID (1 << 0) +#define NRF_WIFI_STA_INFO_INACTIVE_TIME_VALID (1 << 1) +#define NRF_WIFI_STA_INFO_RX_BYTES_VALID (1 << 2) +#define NRF_WIFI_STA_INFO_TX_BYTES_VALID (1 << 3) +#define NRF_WIFI_STA_INFO_CHAIN_SIGNAL_VALID (1 << 4) +#define NRF_WIFI_STA_INFO_CHAIN_SIGNAL_AVG_VALID (1 << 5) +#define NRF_WIFI_STA_INFO_TX_BITRATE_VALID (1 << 6) +#define NRF_WIFI_STA_INFO_RX_BITRATE_VALID (1 << 7) +#define NRF_WIFI_STA_INFO_STA_FLAGS_VALID (1 << 8) + +#define NRF_WIFI_STA_INFO_LLID_VALID (1 << 9) +#define NRF_WIFI_STA_INFO_PLID_VALID (1 << 10) +#define NRF_WIFI_STA_INFO_PLINK_STATE_VALID (1 << 11) +#define NRF_WIFI_STA_INFO_SIGNAL_VALID (1 << 12) +#define NRF_WIFI_STA_INFO_SIGNAL_AVG_VALID (1 << 13) +#define NRF_WIFI_STA_INFO_RX_PACKETS_VALID (1 << 14) +#define NRF_WIFI_STA_INFO_TX_PACKETS_VALID (1 << 15) +#define NRF_WIFI_STA_INFO_TX_RETRIES_VALID (1 << 16) +#define NRF_WIFI_STA_INFO_TX_FAILED_VALID (1 << 17) +#define NRF_WIFI_STA_INFO_EXPECTED_THROUGHPUT_VALID (1 << 18) +#define NRF_WIFI_STA_INFO_BEACON_LOSS_COUNT_VALID (1 << 19) +#define NRF_WIFI_STA_INFO_LOCAL_PM_VALID (1 << 20) +#define NRF_WIFI_STA_INFO_PEER_PM_VALID (1 << 21) +#define NRF_WIFI_STA_INFO_NONPEER_PM_VALID (1 << 22) +#define NRF_WIFI_STA_INFO_T_OFFSET_VALID (1 << 23) +#define NRF_WIFI_STA_INFO_RX_DROPPED_MISC_VALID (1 << 24) +#define NRF_WIFI_STA_INFO_RX_BEACON_VALID (1 << 25) +#define NRF_WIFI_STA_INFO_RX_BEACON_SIGNAL_AVG_VALID (1 << 26) +#define NRF_WIFI_STA_INFO_STA_BSS_PARAMS_VALID (1 << 27) +#define NRF_WIFI_IEEE80211_MAX_CHAINS 4 + +/** + * @brief This structure contains information about a Station (STA). + * + */ + +struct nrf_wifi_sta_info { + /** Valid fields with in this structure */ + unsigned int valid_fields; + /** time since the station is last connected */ + unsigned int connected_time; + /** time since last activity, in msec */ + unsigned int inactive_time; + /** total received bytes from this station */ + unsigned int rx_bytes; + /** total transmitted bytes to this station */ + unsigned int tx_bytes; + /** per-chain signal mask value */ + unsigned int chain_signal_mask; + /** per-chain signal strength of last PPDU */ + unsigned char chain_signal[NRF_WIFI_IEEE80211_MAX_CHAINS]; + /** per-chain signal strength average mask value */ + unsigned int chain_signal_avg_mask; + /** per-chain signal strength average */ + unsigned char chain_signal_avg[NRF_WIFI_IEEE80211_MAX_CHAINS]; + /**nrf_wifi_rate_info */ + struct nrf_wifi_rate_info tx_bitrate; + /**nrf_wifi_rate_info */ + struct nrf_wifi_rate_info rx_bitrate; + /** Not used */ + unsigned short llid; + /** Not used */ + unsigned short plid; + /** Not used */ + unsigned char plink_state; + /** signal strength of last received PPDU, in dbm */ + signed int signal; + /** signal strength average, in dbm */ + signed int signal_avg; + /** total received packet from this station */ + unsigned int rx_packets; + /** total transmitted packets to this station */ + unsigned int tx_packets; + /** total retries to this station */ + unsigned int tx_retries; + /** total failed packets to this station */ + unsigned int tx_failed; + /** expected throughput in kbps */ + unsigned int expected_throughput; + /** count of times beacon loss was detected */ + unsigned int beacon_loss_count; + /** Not used */ + unsigned int local_pm; + /** Not used */ + unsigned int peer_pm; + /** Not used */ + unsigned int nonpeer_pm; + /** station flags nrf_wifi_sta_flag_update */ + struct nrf_wifi_sta_flag_update sta_flags; + /** timing offset with respect to this STA */ + unsigned long long t_offset; + /** count of times other(non beacon) loss was detected */ + unsigned long long rx_dropped_misc; + /** count of times beacon */ + unsigned long long rx_beacon; + /** average of beacon signal */ + long long rx_beacon_signal_avg; + /** Station connected BSS params. nrf_wifi_sta_bss_parameters */ + struct nrf_wifi_sta_bss_parameters bss_param; +} __NRF_WIFI_PKD; + +/** + * @brief The command header expected by UMAC to handle requests from the control interface. + * + */ + +struct nrf_wifi_umac_hdr { + /** unused */ + unsigned int portid; + /** unused */ + unsigned int seq; + /** UMAC command/event value see &enum nrf_wifi_umac_commands + * see &enum nrf_wifi_umac_events + */ + unsigned int cmd_evnt; + /** unused */ + signed int rpu_ret_val; + /** Interface information nrf_wifi_index_ids */ + struct nrf_wifi_index_ids ids; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_KEY_VALID (1 << 0) +#define NRF_WIFI_KEY_TYPE_VALID (1 << 1) +#define NRF_WIFI_KEY_IDX_VALID (1 << 2) +#define NRF_WIFI_SEQ_VALID (1 << 3) +#define NRF_WIFI_CIPHER_SUITE_VALID (1 << 4) +#define NRF_WIFI_KEY_INFO_VALID (1 << 5) + +#define NRF_WIFI_KEY_DEFAULT (1 << 0) +#define NRF_WIFI_KEY_DEFAULT_TYPES (1 << 1) +#define NRF_WIFI_KEY_DEFAULT_MGMT (1 << 2) +#define NRF_WIFI_KEY_DEFAULT_TYPE_UNICAST (1 << 3) +#define NRF_WIFI_KEY_DEFAULT_TYPE_MULTICAST (1 << 4) + +/** + * @brief This structure contains information about a security key. + * + */ + +struct nrf_wifi_umac_key_info { + /** Indicate which of the following parameters are valid */ + unsigned int valid_fields; + /** Key cipher suite (as defined by IEEE 802.11 section 7.3.2.25.1) */ + unsigned int cipher_suite; + /** Specify what a key should be set as default as example NRF_WIFI_KEY_DEFAULT_MGMT */ + unsigned short nrf_wifi_flags; + /** Key Type, see &enum nrf_wifi_key_type */ + signed int key_type; + /** Key data nrf_wifi_key */ + struct nrf_wifi_key key; + /** Transmit key sequence number (IV/PN) for TKIP and CCMP keys, + * each six bytes in little endian nrf_wifi_seq + */ + struct nrf_wifi_seq seq; + /** Key ID (0-3) */ + unsigned char key_idx; +} __NRF_WIFI_PKD; + + + +/** + * @brief This enum describes the different types of scan. + * + */ +enum scan_reason { + /** scan for display purpose in user space */ + SCAN_DISPLAY = 0, + /** scan for connection purpose */ + SCAN_CONNECT +}; + +/** + * @brief This structure contains details about scan request information. + * + */ +struct nrf_wifi_umac_scan_info { + /** scan type see &enum scan_reason */ + signed int scan_reason; + /** scan parameters nrf_wifi_scan_params */ + struct nrf_wifi_scan_params scan_params; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines a command scan request. + * + */ + +struct nrf_wifi_umac_cmd_scan { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** nrf_wifi_umac_scan_info */ + struct nrf_wifi_umac_scan_info info; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines a command to abort a scan request. + * + */ + +struct nrf_wifi_umac_cmd_abort_scan { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; +} __NRF_WIFI_PKD; + +/** + * @brief TThis structure defines a command to request scan results. + * This command should be executed only if we have received a + * NRF_WIFI_UMAC_EVENT_SCAN_DONE event for a previous scan. + * + */ + +struct nrf_wifi_umac_cmd_get_scan_results { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** scan type see &enum scan_reason */ + signed int scan_reason; +} __NRF_WIFI_PKD; + +/** + * @brief This structure provides details about the "Scan Done" event. + * + */ +struct nrf_wifi_umac_event_scan_done { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** status, 0=Scan successful & 1=Scan aborted */ + signed int status; + /** scan type see &enum scan_reason */ + unsigned int scan_type; +} __NRF_WIFI_PKD; + + +#define MCAST_ADDR_ADD 0 +#define MCAST_ADDR_DEL 1 + +/** + * @brief This structure represents the parameters used to configure the multicast address filter. + * + */ +struct nrf_wifi_umac_mcast_cfg { + /** Add (0) or Delete (1) */ + unsigned int type; + /** multicast address to be added/deleted */ + unsigned char mac_addr[NRF_WIFI_ETH_ADDR_LEN]; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines a command used to set multicast (mcast) addresses. + * + */ +struct nrf_wifi_umac_cmd_mcast_filter { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** nrf_wifi_umac_mcast_cfg */ + struct nrf_wifi_umac_mcast_cfg info; +} __NRF_WIFI_PKD; + + +/** + * @brief This structure represents the parameters used to change the MAC address. + * + */ + +struct nrf_wifi_umac_change_macaddr_info { + /** MAC address to be set */ + unsigned char mac_addr[NRF_WIFI_ETH_ADDR_LEN]; +} __NRF_WIFI_PKD; +/** + * @brief This structure describes command to change MAC address. + * This has to be used only when the interface is down. + * + */ +struct nrf_wifi_umac_cmd_change_macaddr { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** nrf_wifi_umac_change_macaddr_info */ + struct nrf_wifi_umac_change_macaddr_info macaddr_info; +} __NRF_WIFI_PKD; + + + +#define NRF_WIFI_CMD_AUTHENTICATE_KEY_INFO_VALID (1 << 0) +#define NRF_WIFI_CMD_AUTHENTICATE_BSSID_VALID (1 << 1) +#define NRF_WIFI_CMD_AUTHENTICATE_FREQ_VALID (1 << 2) +#define NRF_WIFI_CMD_AUTHENTICATE_SSID_VALID (1 << 3) +#define NRF_WIFI_CMD_AUTHENTICATE_IE_VALID (1 << 4) +#define NRF_WIFI_CMD_AUTHENTICATE_SAE_VALID (1 << 5) + +#define NRF_WIFI_CMD_AUTHENTICATE_LOCAL_STATE_CHANGE (1 << 0) + +/** + * @brief This structure specifies the parameters to be used when sending an authentication request. + * + */ + +struct nrf_wifi_umac_auth_info { + /** Frequency of the selected channel in MHz */ + unsigned int frequency; + /** Flag attribute to indicate that a command is requesting a local + * authentication/association state change without invoking actual management + * frame exchange. This can be used with NRF_WIFI_UMAC_CMD_AUTHENTICATE + * NRF_WIFI_UMAC_CMD_DEAUTHENTICATE. + */ + unsigned short nrf_wifi_flags; + /** Authentication type. see &enum nrf_wifi_auth_type */ + signed int auth_type; + /** Key information */ + struct nrf_wifi_umac_key_info key_info; + /** SSID (binary attribute, 0..32 octets) */ + struct nrf_wifi_ssid ssid; + /** Information element(s) data */ + struct nrf_wifi_ie ie; + /** SAE elements in Authentication frames. This starts + * with the Authentication transaction sequence number field. + */ + struct nrf_wifi_sae sae; + /** MAC address (various uses) */ + unsigned char nrf_wifi_bssid[NRF_WIFI_ETH_ADDR_LEN]; + /** The following parameters will be used to construct bss database in case of + * cfg80211 offload to host case. + */ + /** scanning width */ + signed int scan_width; + /** Signal strength */ + signed int nrf_wifi_signal; + /** Received elements from beacon or probe response */ + signed int from_beacon; + /** BSS information element data */ + struct nrf_wifi_ie bss_ie; + /** BSS capability */ + unsigned short capability; + /** Beacon interval(ms) */ + unsigned short beacon_interval; + /** Beacon tsf */ + unsigned long long tsf; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines a command used to send an authentication request. + * + */ + +struct nrf_wifi_umac_cmd_auth { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** Indicate which of the following parameters are valid */ + unsigned int valid_fields; + /** Information to be passed in the authentication command nrf_wifi_umac_auth_info */ + struct nrf_wifi_umac_auth_info info; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_CMD_ASSOCIATE_MAC_ADDR_VALID (1 << 0) + + +/** + * @brief This structure specifies the parameters to be used when sending an association request. + * + */ + +struct nrf_wifi_umac_cmd_assoc { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** Indicate which of the following parameters are valid */ + unsigned int valid_fields; + /** nrf_wifi_connect_common_info */ + struct nrf_wifi_connect_common_info connect_common_info; + /** + * Previous BSSID, to be used by in ASSOCIATE commands to specify + * using a reassociate frame. + */ + unsigned char mac_addr[NRF_WIFI_ETH_ADDR_LEN]; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_CMD_MLME_MAC_ADDR_VALID (1 << 0) +#define NRF_WIFI_CMD_MLME_LOCAL_STATE_CHANGE (1 << 0) + +/** + * @brief This structure specifies the parameters to be passed while sending a + * deauthentication request (NRF_WIFI_UMAC_CMD_DEAUTHENTICATE). + * + */ + +struct nrf_wifi_umac_disconn_info { + /** Indicates that a command is requesting a local deauthentication/disassociation + * state change without invoking actual management frame exchange. + */ + unsigned short nrf_wifi_flags; + /** Reason code for disassociation or deauthentication */ + unsigned short reason_code; + /** MAC address (various uses) */ + unsigned char mac_addr[NRF_WIFI_ETH_ADDR_LEN]; +} __NRF_WIFI_PKD; + +/** + * @brief This structure specifies the parameters to be used when sending a disconnect request. + * + */ + +struct nrf_wifi_umac_cmd_disconn { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** Indicate which of the following parameters are valid */ + unsigned int valid_fields; + /** nrf_wifi_umac_disconn_info */ + struct nrf_wifi_umac_disconn_info info; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_CMD_NEW_INTERFACE_USE_4ADDR_VALID (1 << 0) +#define NRF_WIFI_CMD_NEW_INTERFACE_MAC_ADDR_VALID (1 << 1) +#define NRF_WIFI_CMD_NEW_INTERFACE_IFTYPE_VALID (1 << 2) +#define NRF_WIFI_CMD_NEW_INTERFACE_IFNAME_VALID (1 << 3) + +/** + * @brief This structure contains the information to be passed to the RPU + * to create a new virtual interface using the NRF_WIFI_UMAC_CMD_NEW_INTERFACE command. + * + */ +struct nrf_wifi_umac_add_vif_info { + /** Interface type, see enum nrf_wifi_sys_iftype */ + signed int iftype; + /** Use 4-address frames on a virtual interface */ + signed int nrf_wifi_use_4addr; + /** Unused */ + unsigned int mon_flags; + /** MAC Address */ + unsigned char mac_addr[NRF_WIFI_ETH_ADDR_LEN]; + /** Interface name */ + signed char ifacename[16]; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines a command used to create a new virtual interface + * using the NRF_WIFI_UMAC_CMD_NEW_INTERFACE command. + * + */ + +struct nrf_wifi_umac_cmd_add_vif { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** Indicate which of the following parameters are valid */ + unsigned int valid_fields; + /** VIF specific information to be passed to the RPU nrf_wifi_umac_add_vif_info */ + struct nrf_wifi_umac_add_vif_info info; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines a command used to delete a virtual interface. + * However, this command is not allowed on the default interface. + * + */ + +struct nrf_wifi_umac_cmd_del_vif { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_FRAME_MATCH_MAX_LEN 8 + +/** + * @brief This structure represents the data of management frame that must be matched for + * processing in userspace. + * + */ + +struct nrf_wifi_umac_frame_match { + /** Length of data */ + unsigned int frame_match_len; + /** Data to match */ + unsigned char frame_match[NRF_WIFI_FRAME_MATCH_MAX_LEN]; +} __NRF_WIFI_PKD; + +/** + * @brief This structure contains information about the type of management frame + * that should be passed to the driver for processing in userspace. + * + */ + +struct nrf_wifi_umac_mgmt_frame_info { + /** Frame type/subtype */ + unsigned short frame_type; + /** Match information Refer &struct nrf_wifi_umac_frame_match */ + struct nrf_wifi_umac_frame_match frame_match; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines a command to inform the RPU to register a management frame, + * which must not be filtered by the RPU and should instead be passed to the host for + * userspace processing. + * + */ + +struct nrf_wifi_umac_cmd_mgmt_frame_reg { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** + * Management frame specific information to be passed to the RPU. + * nrf_wifi_umac_mgmt_frame_info + */ + struct nrf_wifi_umac_mgmt_frame_info info; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_CMD_KEY_MAC_ADDR_VALID (1 << 0) + +/** + * @brief This structure represents command to add a new key. + * + */ + +struct nrf_wifi_umac_cmd_key { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** Indicate which of the following parameters are valid */ + unsigned int valid_fields; + /** Key information. nrf_wifi_umac_key_info */ + struct nrf_wifi_umac_key_info key_info; + /** MAC address associated with the key */ + unsigned char mac_addr[NRF_WIFI_ETH_ADDR_LEN]; + /* Peer Key DB index */ + unsigned char peerDBIndex; + +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines a command that is used to add a new key. + * + */ + +struct nrf_wifi_umac_cmd_set_key { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** Key information , nrf_wifi_umac_key_info */ + struct nrf_wifi_umac_key_info key_info; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_CMD_SET_BSS_CTS_VALID (1 << 0) +#define NRF_WIFI_CMD_SET_BSS_PREAMBLE_VALID (1 << 1) +#define NRF_WIFI_CMD_SET_BSS_SLOT_VALID (1 << 2) +#define NRF_WIFI_CMD_SET_BSS_HT_OPMODE_VALID (1 << 3) +#define NRF_WIFI_CMD_SET_BSS_AP_ISOLATE_VALID (1 << 4) +#define NRF_WIFI_CMD_SET_BSS_P2P_CTWINDOW_VALID (1 << 5) +#define NRF_WIFI_CMD_SET_BSS_P2P_OPPPS_VALID (1 << 6) + +#define NRF_WIFI_BASIC_MAX_SUPP_RATES 32 + +/** + * @brief This structure contains parameters that describe the BSS (Basic Service Set) information. + * + */ + +struct nrf_wifi_umac_bss_info { + /** P2P GO Client Traffic Window, used with + * the START_AP and SET_BSS commands. + */ + unsigned int p2p_go_ctwindow; + /** P2P GO opportunistic PS, used with the + * START_AP and SET_BSS commands. This can have the values 0 or 1; + * if not given in START_AP 0 is assumed, if not given in SET_BSS + * no change is made. + */ + unsigned int p2p_opp_ps; + /** Number of basic rate elements */ + unsigned int num_basic_rates; + /** HT operation mode */ + unsigned short ht_opmode; + /** Whether CTS protection is enabled (0 or 1) */ + unsigned char nrf_wifi_cts; + /** Whether short preamble is enabled (0 or 1) */ + unsigned char preamble; + /** Whether short slot time enabled (0 or 1) */ + unsigned char nrf_wifi_slot; + /** (AP mode) Do not forward traffic between stations connected to this BSS */ + unsigned char ap_isolate; + /** Basic rates, array of basic rates in format defined by IEEE 802.11 7.3.2.2 */ + unsigned char basic_rates[NRF_WIFI_BASIC_MAX_SUPP_RATES]; +} __NRF_WIFI_PKD; + +/** + * @brief This structure represents a command used to set BSS (Basic Service Set) parameters. + * + */ + +struct nrf_wifi_umac_cmd_set_bss { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** Indicate which of the following parameters are valid */ + unsigned int valid_fields; + /** BSS specific information to be passed to the RPU nrf_wifi_umac_bss_info */ + struct nrf_wifi_umac_bss_info bss_info; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_SET_FREQ_PARAMS_FREQ_VALID (1 << 0) +#define NRF_WIFI_SET_FREQ_PARAMS_CHANNEL_WIDTH_VALID (1 << 1) +#define NRF_WIFI_SET_FREQ_PARAMS_CENTER_FREQ1_VALID (1 << 2) +#define NRF_WIFI_SET_FREQ_PARAMS_CENTER_FREQ2_VALID (1 << 3) +#define NRF_WIFI_SET_FREQ_PARAMS_CHANNEL_TYPE_VALID (1 << 4) + +/** + * @brief This structure contains information about frequency parameters. + * + */ + +struct freq_params { + /** Indicate which of the following parameters are valid */ + unsigned int valid_fields; + /** Value in MHz */ + signed int frequency; + /** Width of the channel @see &enu nrf_wifi_chan_width */ + signed int channel_width; + /** Unused */ + signed int center_frequency1; + /** Unused */ + signed int center_frequency2; + /** Type of channel see &enum nrf_wifi_channel_type */ + signed int channel_type; +} __NRF_WIFI_PKD; + +/** + * @brief This structure contains information about transmit queue parameters. + * + */ + +struct nrf_wifi_txq_params { + /** Transmit oppurtunity */ + unsigned short txop; + /** Minimum contention window */ + unsigned short cwmin; + /** Maximum contention window */ + unsigned short cwmax; + /** Arbitration interframe spacing */ + unsigned char aifs; + /** Access category */ + unsigned char ac; + +} __NRF_WIFI_PKD; + +/** + * @brief Types of transmit power settings. + * + */ + +enum nrf_wifi_tx_power_type { + /** Automatically determine transmit power */ + NRF_WIFI_TX_POWER_AUTOMATIC, + /** Limit TX power by the mBm parameter */ + NRF_WIFI_TX_POWER_LIMITED, + /** Fix TX power to the mBm parameter */ + NRF_WIFI_TX_POWER_FIXED, +}; + +#define NRF_WIFI_TX_POWER_SETTING_TYPE_VALID (1 << 0) +#define NRF_WIFI_TX_POWER_SETTING_TX_POWER_LEVEL_VALID (1 << 1) + +/** + * @brief This structure contains the parameters related to the transmit power setting. + * + */ + +struct nrf_wifi_tx_power_setting { + /** Indicate which of the following parameters are valid */ + unsigned int valid_fields; + /** Power value type, see nrf_wifi_tx_power_type */ + signed int type; + /** Transmit power level in signed mBm units */ + signed int tx_power_level; + +} __NRF_WIFI_PKD; + +#define NRF_WIFI_CMD_SET_WIPHY_FREQ_PARAMS_VALID (1 << 0) +#define NRF_WIFI_CMD_SET_WIPHY_TXQ_PARAMS_VALID (1 << 1) +#define NRF_WIFI_CMD_SET_WIPHY_RTS_THRESHOLD_VALID (1 << 2) +#define NRF_WIFI_CMD_SET_WIPHY_FRAG_THRESHOLD_VALID (1 << 3) +#define NRF_WIFI_CMD_SET_WIPHY_TX_POWER_SETTING_VALID (1 << 4) +#define NRF_WIFI_CMD_SET_WIPHY_ANTENNA_TX_VALID (1 << 5) +#define NRF_WIFI_CMD_SET_WIPHY_ANTENNA_RX_VALID (1 << 6) +#define NRF_WIFI_CMD_SET_WIPHY_RETRY_SHORT_VALID (1 << 7) +#define NRF_WIFI_CMD_SET_WIPHY_RETRY_LONG_VALID (1 << 8) +#define NRF_WIFI_CMD_SET_WIPHY_COVERAGE_CLASS_VALID (1 << 9) +#define NRF_WIFI_CMD_SET_WIPHY_WIPHY_NAME_VALID (1 << 10) + +/** + * @brief This structure contains information about the configuration parameters + * needed to set up and configure the wireless Physical Layer. + * + */ + +struct nrf_wifi_umac_set_wiphy_info { + /** RTS threshold, TX frames with length larger than or equal to this use RTS/CTS handshake + * allowed range: 0..65536, disable with -1. + */ + int rts_threshold; + /** Fragmentation threshold, maximum length in octets for frames. + * allowed range: 256..8000, disable fragmentation with (u32)-1. + */ + unsigned int frag_threshold; + /** Bitmap of allowed antennas for transmitting. This can be used to mask out + * antennas which are not attached or should not be used for transmitting. + * If an antenna is not selected in this bitmap the hardware is not allowed + * to transmit on this antenna. + */ + unsigned int antenna_tx; + /** Bitmap of allowed antennas for receiving. This can be used to mask out antennas + * which are not attached or should not be used for receiving. If an antenna is + * not selected in this bitmap the hardware should not be configured to receive + * on this antenna. + */ + unsigned int antenna_rx; + /** Frequency information of the a channel see &struct freq_params */ + struct freq_params freq_params; + /** TX queue parameters nrf_wifi_txq_params */ + struct nrf_wifi_txq_params txq_params; + /** Tx power settings nrf_wifi_tx_power_setting nrf_wifi_tx_power_setting */ + struct nrf_wifi_tx_power_setting tx_power_setting; + /** TX retry limit for frames whose length is less than or equal to the RTS threshold + * allowed range: 1..255. + */ + unsigned char retry_short; + /** TX retry limit for frames whose length is greater than the RTS threshold + * allowed range: 1..255. + */ + unsigned char retry_long; + /** Unused */ + unsigned char coverage_class; + /** WIPHY name (used for renaming) */ + signed char wiphy_name[32]; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines the command to set the wireless PHY configuration. + * + */ + +struct nrf_wifi_umac_cmd_set_wiphy { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** Indicates which of the following parameters are valid */ + unsigned int valid_fields; + /** nrf_wifi_umac_set_wiphy_info */ + struct nrf_wifi_umac_set_wiphy_info info; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_CMD_DEL_STATION_MAC_ADDR_VALID (1 << 0) +#define NRF_WIFI_CMD_DEL_STATION_MGMT_SUBTYPE_VALID (1 << 1) +#define NRF_WIFI_CMD_DEL_STATION_REASON_CODE_VALID (1 << 2) + +/** + * @brief This structure contains the parameters to delete a station. + * + */ + +struct nrf_wifi_umac_del_sta_info { + /** MAC address of the station */ + unsigned char mac_addr[NRF_WIFI_ETH_ADDR_LEN]; + /** Management frame subtype */ + unsigned char mgmt_subtype; + /** Reason code for DEAUTHENTICATION and DISASSOCIATION */ + unsigned short reason_code; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines the command to delete a station. + * + */ + +struct nrf_wifi_umac_cmd_del_sta { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** Indicate which of the following parameters are valid */ + unsigned int valid_fields; + /** Information regarding the station to be deleted nrf_wifi_umac_del_sta_info */ + struct nrf_wifi_umac_del_sta_info info; +} __NRF_WIFI_PKD; + +/** + * @brief This structure contains the information required for obtaining station details. + * + */ + +struct nrf_wifi_umac_get_sta_info { + /** MAC address of the station */ + unsigned char mac_addr[NRF_WIFI_ETH_ADDR_LEN]; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines the command to get station information. + * + */ + +struct nrf_wifi_umac_cmd_get_sta { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** Information regarding the station to get nrf_wifi_umac_get_sta_info */ + struct nrf_wifi_umac_get_sta_info info; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_EXT_CAPABILITY_MAX_LEN 32 + +/** + * @brief Extended capability information. + */ + +struct nrf_wifi_ext_capability { + /** length */ + unsigned int ext_capability_len; + /** Extended capability info*/ + unsigned char ext_capability[NRF_WIFI_EXT_CAPABILITY_MAX_LEN]; + +} __NRF_WIFI_PKD; + +#define NRF_WIFI_SUPPORTED_CHANNELS_MAX_LEN 89 + +/** + * @brief Supported channels. + */ + +struct nrf_wifi_supported_channels { + /** number of channels */ + unsigned int supported_channels_len; + /** channels info */ + unsigned char supported_channels[NRF_WIFI_SUPPORTED_CHANNELS_MAX_LEN]; + +} __NRF_WIFI_PKD; + +#define NRF_WIFI_OPER_CLASSES_MAX_LEN 64 + +/** + * @brief Operating classes information. + */ +struct nrf_wifi_supported_oper_classes { + /** length */ + unsigned int supported_oper_classes_len; + /** oper_class info*/ + unsigned char supported_oper_classes[NRF_WIFI_OPER_CLASSES_MAX_LEN]; + +} __NRF_WIFI_PKD; + +#define NRF_WIFI_STA_FLAGS2_MAX_LEN 64 + +/** + * @brief Station flags. + */ + +struct nrf_wifi_sta_flags2 { + /** length */ + unsigned int sta_flags2_len; + /** flags */ + unsigned char sta_flags2[NRF_WIFI_STA_FLAGS2_MAX_LEN]; + +} __NRF_WIFI_PKD; + +#define NRF_WIFI_CMD_SET_STATION_SUPP_RATES_VALID (1 << 0) +#define NRF_WIFI_CMD_SET_STATION_AID_VALID (1 << 1) +#define NRF_WIFI_CMD_SET_STATION_PEER_AID_VALID (1 << 2) +#define NRF_WIFI_CMD_SET_STATION_STA_CAPABILITY_VALID (1 << 3) +#define NRF_WIFI_CMD_SET_STATION_EXT_CAPABILITY_VALID (1 << 4) +#define NRF_WIFI_CMD_SET_STATION_STA_VLAN_VALID (1 << 5) +#define NRF_WIFI_CMD_SET_STATION_HT_CAPABILITY_VALID (1 << 6) +#define NRF_WIFI_CMD_SET_STATION_VHT_CAPABILITY_VALID (1 << 7) +#define NRF_WIFI_CMD_SET_STATION_OPMODE_NOTIF_VALID (1 << 9) +#define NRF_WIFI_CMD_SET_STATION_SUPPORTED_CHANNELS_VALID (1 << 10) +#define NRF_WIFI_CMD_SET_STATION_SUPPORTED_OPER_CLASSES_VALID (1 << 11) +#define NRF_WIFI_CMD_SET_STATION_STA_FLAGS2_VALID (1 << 12) +#define NRF_WIFI_CMD_SET_STATION_STA_WME_UAPSD_QUEUES_VALID (1 << 13) +#define NRF_WIFI_CMD_SET_STATION_STA_WME_MAX_SP_VALID (1 << 14) +#define NRF_WIFI_CMD_SET_STATION_LISTEN_INTERVAL_VALID (1 << 15) + +/** + * @brief This structure represents the information needed to update a station entry + * in the RPU. + * + */ + +struct nrf_wifi_umac_chg_sta_info { + /** Listen interval as defined by IEEE 802.11 7.3.1.6 */ + signed int nrf_wifi_listen_interval; + /** Unused */ + unsigned int sta_vlan; + /** AID or zero for no change */ + unsigned short aid; + /** Unused */ + unsigned short nrf_wifi_peer_aid; + /** Station capability */ + unsigned short sta_capability; + /** Unused */ + unsigned short spare; + /** Supported rates in IEEE 802.11 format nrf_wifi_supp_rates */ + struct nrf_wifi_supp_rates supp_rates; + /** Extended capabilities of the station nrf_wifi_ext_capability */ + struct nrf_wifi_ext_capability ext_capability; + /** Supported channels in IEEE 802.11 format nrf_wifi_supported_channels */ + struct nrf_wifi_supported_channels supported_channels; + /** Supported oper classes in IEEE 802.11 format nrf_wifi_supported_oper_classes */ + struct nrf_wifi_supported_oper_classes supported_oper_classes; + /** station flags mask/set nrf_wifi_sta_flag_update nrf_wifi_sta_flag_update */ + struct nrf_wifi_sta_flag_update sta_flags2; + /** HT capabilities of station */ + unsigned char ht_capability[NRF_WIFI_HT_VHT_CAPABILITY_MAX_SIZE]; + /** VHT capabilities of station */ + unsigned char vht_capability[NRF_WIFI_HT_VHT_CAPABILITY_MAX_SIZE]; + /** Station mac address */ + unsigned char mac_addr[NRF_WIFI_ETH_ADDR_LEN]; + /** Information if operating mode field is used */ + unsigned char opmode_notif; + /** Bitmap of queues configured for uapsd. Same format + * as the AC bitmap in the QoS info field. + */ + unsigned char wme_uapsd_queues; + /** Max Service Period. same format as the MAX_SP in the + * QoS info field (but already shifted down). + */ + unsigned char wme_max_sp; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines the command for updating the parameters of a station entry. + * + */ + +struct nrf_wifi_umac_cmd_chg_sta { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** Indicate which of the following parameters are valid */ + unsigned int valid_fields; + /** nrf_wifi_umac_chg_sta_info */ + struct nrf_wifi_umac_chg_sta_info info; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_CMD_NEW_STATION_SUPP_RATES_VALID (1 << 0) +#define NRF_WIFI_CMD_NEW_STATION_AID_VALID (1 << 1) +#define NRF_WIFI_CMD_NEW_STATION_PEER_AID_VALID (1 << 2) +#define NRF_WIFI_CMD_NEW_STATION_STA_CAPABILITY_VALID (1 << 3) +#define NRF_WIFI_CMD_NEW_STATION_EXT_CAPABILITY_VALID (1 << 4) +#define NRF_WIFI_CMD_NEW_STATION_STA_VLAN_VALID (1 << 5) +#define NRF_WIFI_CMD_NEW_STATION_HT_CAPABILITY_VALID (1 << 6) +#define NRF_WIFI_CMD_NEW_STATION_VHT_CAPABILITY_VALID (1 << 7) +#define NRF_WIFI_CMD_NEW_STATION_OPMODE_NOTIF_VALID (1 << 9) +#define NRF_WIFI_CMD_NEW_STATION_SUPPORTED_CHANNELS_VALID (1 << 10) +#define NRF_WIFI_CMD_NEW_STATION_SUPPORTED_OPER_CLASSES_VALID (1 << 11) +#define NRF_WIFI_CMD_NEW_STATION_STA_FLAGS2_VALID (1 << 12) +#define NRF_WIFI_CMD_NEW_STATION_STA_WME_UAPSD_QUEUES_VALID (1 << 13) +#define NRF_WIFI_CMD_NEW_STATION_STA_WME_MAX_SP_VALID (1 << 14) +#define NRF_WIFI_CMD_NEW_STATION_LISTEN_INTERVAL_VALID (1 << 15) +#define NRF_WIFI_MLD_ADDR_VALID (1<<16) + +/** + * @brief This structure describes the parameters for adding a new station entry to the RPU. + * + */ + +struct nrf_wifi_umac_add_sta_info { + /** Listen interval as defined by IEEE 802.11 7.3.1.6 */ + signed int nrf_wifi_listen_interval; + /** Unused */ + unsigned int sta_vlan; + /** AID or zero for no change */ + unsigned short aid; + /** Unused */ + unsigned short nrf_wifi_peer_aid; + /** Station capability */ + unsigned short sta_capability; + /** Unused */ + unsigned short spare; + /** Supported rates in IEEE 802.11 format nrf_wifi_supp_rates */ + struct nrf_wifi_supp_rates supp_rates; + /** Extended capabilities of the station nrf_wifi_ext_capability */ + struct nrf_wifi_ext_capability ext_capability; + /** Supported channels in IEEE 802.11 format nrf_wifi_supported_channels */ + struct nrf_wifi_supported_channels supported_channels; + /** Supported oper classes in IEEE 802.11 format nrf_wifi_supported_oper_classes */ + struct nrf_wifi_supported_oper_classes supported_oper_classes; + /** station flags mask/set nrf_wifi_sta_flag_update */ + struct nrf_wifi_sta_flag_update sta_flags2; + /** HT capabilities of station */ + unsigned char ht_capability[NRF_WIFI_HT_VHT_CAPABILITY_MAX_SIZE]; + /** VHT capabilities of station */ + unsigned char vht_capability[NRF_WIFI_HT_VHT_CAPABILITY_MAX_SIZE]; + /** Station mac address */ + unsigned char mac_addr[NRF_WIFI_ETH_ADDR_LEN]; + /** Information if operating mode field is used */ + unsigned char opmode_notif; + /** Bitmap of queues configured for uapsd. same format + * as the AC bitmap in the QoS info field. + */ + unsigned char wme_uapsd_queues; + /** Max Service Period. same format as the MAX_SP in the + * QoS info field (but already shifted down). + */ + unsigned char wme_max_sp; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines the command for adding a new station entry. + * + */ + +struct nrf_wifi_umac_cmd_add_sta { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** Indicate which of the following parameters are valid */ + unsigned int valid_fields; + /** nrf_wifi_umac_add_sta_info */ + struct nrf_wifi_umac_add_sta_info info; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_CMD_BEACON_INFO_BEACON_INTERVAL_VALID (1 << 0) +#define NRF_WIFI_CMD_BEACON_INFO_AUTH_TYPE_VALID (1 << 1) +#define NRF_WIFI_CMD_BEACON_INFO_VERSIONS_VALID (1 << 2) +#define NRF_WIFI_CMD_BEACON_INFO_CIPHER_SUITE_GROUP_VALID (1 << 3) +#define NRF_WIFI_CMD_BEACON_INFO_INACTIVITY_TIMEOUT_VALID (1 << 4) +#define NRF_WIFI_CMD_BEACON_INFO_FREQ_PARAMS_VALID (1 << 5) + +#define NRF_WIFI_CMD_BEACON_INFO_PRIVACY (1 << 0) +#define NRF_WIFI_CMD_BEACON_INFO_CONTROL_PORT_NO_ENCRYPT (1 << 1) +#define NRF_WIFI_CMD_BEACON_INFO_P2P_CTWINDOW_VALID (1 << 6) +#define NRF_WIFI_CMD_BEACON_INFO_P2P_OPPPS_VALID (1 << 7) + +/** + * @brief This structure describes the parameters required to be passed to the RPU when + * initiating a SoftAP (Soft Access Point). + * + */ + +struct nrf_wifi_umac_start_ap_info { + /** Beacon frame interval */ + unsigned short beacon_interval; + /** DTIM count */ + unsigned char dtim_period; + /** Send beacons with wildcard sssid */ + signed int hidden_ssid; + /** Authentication type, see &enum nrf_wifi_auth_type */ + signed int auth_type; + /** Unused */ + signed int smps_mode; + /** Beacon info flags */ + unsigned int nrf_wifi_flags; + /** Beacon frame, nrf_wifi_beacon_data */ + struct nrf_wifi_beacon_data beacon_data; + /** SSID string, nrf_wifi_ssid */ + struct nrf_wifi_ssid ssid; + /** Connect params, nrf_wifi_connect_common_info */ + struct nrf_wifi_connect_common_info connect_common_info; + /** Channel info, see &struct freq_params */ + struct freq_params freq_params; + /** Time to stop ap after inactivity period */ + unsigned short inactivity_timeout; + /** P2P GO Client Traffic Window */ + unsigned char p2p_go_ctwindow; + /** Opportunistic power save allows P2P Group Owner to save power + * when all its associated clients are sleeping. + */ + unsigned char p2p_opp_ps; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines the command for starting the SoftAP using + * NRF_WIFI_UMAC_CMD_NEW_BEACON and NRF_WIFI_UMAC_CMD_START_AP. + * + */ + +struct nrf_wifi_umac_cmd_start_ap { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** Indicate which of the following parameters are valid */ + unsigned int valid_fields; + /** Parameters that need to be passed to the RPU when starting a SoftAP. + * nrf_wifi_umac_start_ap_info + */ + struct nrf_wifi_umac_start_ap_info info; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines the command used to stop Soft AP operation. + * + */ + +struct nrf_wifi_umac_cmd_stop_ap { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; +} __NRF_WIFI_PKD; + +/** + * @brief This structure represents the parameters that must be passed to the RPU when + * configuring Beacon and Probe response data. + * + */ + +struct nrf_wifi_umac_set_beacon_info { + /** Beacon frame, nrf_wifi_beacon_data */ + struct nrf_wifi_beacon_data beacon_data; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines the command for setting the beacon data using + * NRF_WIFI_UMAC_CMD_SET_BEACON. + * + */ + +struct nrf_wifi_umac_cmd_set_beacon { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** nrf_wifi_umac_set_beacon_info */ + struct nrf_wifi_umac_set_beacon_info info; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_SET_INTERFACE_IFTYPE_VALID (1 << 0) +#define NRF_WIFI_SET_INTERFACE_USE_4ADDR_VALID (1 << 1) + +/** + * @brief This structure contains the information that needs to be provided to the RPU + * when modifying the attributes of a virtual interface. + * + */ + +struct nrf_wifi_umac_chg_vif_attr_info { + /** Interface type, see &enum nrf_wifi_iftype */ + signed int iftype; + /** Unused */ + signed int nrf_wifi_use_4addr; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines the command used to change the interface. + * + */ + +struct nrf_wifi_umac_cmd_chg_vif_attr { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** Indicate which of the following parameters are valid */ + unsigned int valid_fields; + /** Interface attributes to be changed nrf_wifi_umac_chg_vif_attr_info */ + struct nrf_wifi_umac_chg_vif_attr_info info; +} __NRF_WIFI_PKD; + +#define IFACENAMSIZ 16 + +/** + * @brief This structure contains the information that needs to be passed to the RPU + * when changing the interface state, specifically when bringing it up or down + * + */ + +struct nrf_wifi_umac_chg_vif_state_info { + /** Interface state (1 = UP / 0 = DOWN) */ + signed int state; + /** Interface index */ + signed char if_index; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines the command used to change the interface state. + * + */ + +struct nrf_wifi_umac_cmd_chg_vif_state { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** nrf_wifi_umac_chg_vif_state_info */ + struct nrf_wifi_umac_chg_vif_state_info info; +} __NRF_WIFI_PKD; +/** + * @brief This structure defines an event-to-command mapping for NRF_WIFI_UMAC_CMD_SET_IFFLAGS. + * + */ + +struct nrf_wifi_umac_event_vif_state { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** Status to command NRF_WIFI_UMAC_CMD_SET_IFFLAGS */ + signed int status; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines the command used to start P2P (Peer-to-Peer) mode on an interface. + */ + +struct nrf_wifi_cmd_start_p2p { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; +} __NRF_WIFI_PKD; + +/** + * @brief This structure represents the command for stopping P2P mode on an interface. + * + */ + +struct nrf_wifi_umac_cmd_stop_p2p_dev { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_CMD_FRAME_FREQ_VALID (1 << 0) +#define NRF_WIFI_CMD_FRAME_DURATION_VALID (1 << 1) +#define NRF_WIFI_CMD_SET_FRAME_FREQ_PARAMS_VALID (1 << 2) + +#define NRF_WIFI_CMD_FRAME_OFFCHANNEL_TX_OK (1 << 0) +#define NRF_WIFI_CMD_FRAME_TX_NO_CCK_RATE (1 << 1) +#define NRF_WIFI_CMD_FRAME_DONT_WAIT_FOR_ACK (1 << 2) + +/** + * @brief This structure describes the parameters required to transmit a + * management frame from the host. + * + */ + +struct nrf_wifi_umac_mgmt_tx_info { + /** OFFCHANNEL_TX_OK, NO_CCK_RATE, DONT_WAIT_FOR_ACK */ + unsigned int nrf_wifi_flags; + /** Channel frequency */ + unsigned int frequency; + /** Duration field value */ + unsigned int dur; + /** Management frame to transmit, nrf_wifi_frame */ + struct nrf_wifi_frame frame; + /** Frequency configuration, see &struct freq_params */ + struct freq_params freq_params; + /** Identifier to be used for processing event, + * NRF_WIFI_UMAC_EVENT_FRAME_TX_STATUS. + */ + unsigned long long host_cookie; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines the command used to transmit a management frame. + * + */ + +struct nrf_wifi_umac_cmd_mgmt_tx { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** Indicate which of the following parameters are valid */ + unsigned int valid_fields; + /** Information about the management frame to be transmitted. + * nrf_wifi_umac_mgmt_tx_info + */ + struct nrf_wifi_umac_mgmt_tx_info info; +} __NRF_WIFI_PKD; + +/** + * @brief This structure represents the information regarding the power save state. + * + */ + +struct nrf_wifi_umac_set_power_save_info { + /** power save is disabled or enabled, see enum nrf_wifi_ps_state */ + signed int ps_state; +} __NRF_WIFI_PKD; + +/** + * @brief This structure represents the command used to enable or disable the power save + * functionality. + * + */ + +struct nrf_wifi_umac_cmd_set_power_save { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** Power save setting parameters. + * nrf_wifi_umac_set_power_save_info + */ + struct nrf_wifi_umac_set_power_save_info info; +} __NRF_WIFI_PKD; + +/** + * @brief This structure represents the command to configure power save timeout value. + * + */ + +struct nrf_wifi_umac_cmd_set_power_save_timeout { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** Timeout value in milli seconds + * if timeout < 0 RPU will set timeout to 100ms + */ + signed int timeout; +} __NRF_WIFI_PKD; + +/** + * @brief This structure represents the information of qos_map. + * + */ + +struct nrf_wifi_umac_qos_map_info { + /** length of qos_map info field */ + unsigned int qos_map_info_len; + /** contains qos_map info as received from stack */ + unsigned char qos_map_info[256]; +} __NRF_WIFI_PKD; + +/** + * @brief This structure represents the information related to the Quality of Service (QoS) map. + * + */ + +struct nrf_wifi_umac_cmd_set_qos_map { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** qos map info. nrf_wifi_umac_qos_map_info */ + struct nrf_wifi_umac_qos_map_info info; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines the command used to retrieve the transmit power information. + * + */ + +struct nrf_wifi_umac_cmd_get_tx_power { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines the command used to obtain the regulatory domain information. + * + */ + +struct nrf_wifi_umac_cmd_get_reg { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines the command used to retrieve channel information. + * + */ + +struct nrf_wifi_umac_cmd_get_channel { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_TWT_NEGOTIATION_TYPE_INDIVIDUAL 0 +#define NRF_WIFI_TWT_NEGOTIATION_TYPE_BROADCAST 2 + +/** + * @brief TWT setup commands and events. + * + */ + +enum nrf_wifi_twt_setup_cmd_type { + /** STA requests to join a TWT without specifying a target wake time */ + NRF_WIFI_REQUEST_TWT, + /** STA requests to join a TWT with specifying a target wake time and + * other params, these values can change during negotiation. + */ + NRF_WIFI_SUGGEST_TWT, + /** requests to join a TWT with demanded a target wake time + * and other params. STA rejects if AP not scheduling those params. + */ + NRF_WIFI_DEMAND_TWT, + /** Response to the STA request(suggest/demand), these may be different params */ + NRF_WIFI_GROUPING_TWT, + /** AP accept the STA requested params */ + NRF_WIFI_ACCEPT_TWT, + /** AP may suggest the params, these may be different from STA requested */ + NRF_WIFI_ALTERNATE_TWT, + /** AP may suggest the params, these may be different from STA requested */ + NRF_WIFI_DICTATE_TWT, + /** AP may reject the STA requested params */ + NRF_WIFI_REJECT_TWT, +}; + +#define NRF_WIFI_TWT_FLOW_TYPE_ANNOUNCED 0 +#define NRF_WIFI_TWT_FLOW_TYPE_UNANNOUNCED 1 + +#define NRF_WIFI_TWT_RESP_RECEIVED 0 +#define NRF_WIFI_TWT_RESP_NOT_RECEIVED 1 +#define NRF_WIFI_INVALID_TWT_WAKE_INTERVAL 3 + +/** + * @brief This structure describes the TWT information. + * + */ + +struct nrf_wifi_umac_config_twt_info { + /** TWT flow Id */ + unsigned char twt_flow_id; + /** Negotiation type + * NRF_WIFI_TWT_NEGOTIATION_TYPE_INDIVIDUAL or + * NRF_WIFI_TWT_NEGOTIATION_TYPE_BROADAST + */ + unsigned char neg_type; + /** see &enum nrf_wifi_twt_setup_cmd_type */ + signed int setup_cmd; + /** indicating AP to initiate a trigger frame (ps_poll/Null) before data transfer */ + unsigned char ap_trigger_frame; + /** 1->implicit(same negotiated values to be used), + * 0->AP sends new calculated TWT values for every service period. + */ + unsigned char is_implicit; + /** Whether STA has to send the PS-Poll/Null frame + * indicating that it's in wake period(NRF_WIFI_TWT_FLOW_TYPE_ANNOUNCED) + */ + unsigned char twt_flow_type; + /** wake interval exponent value */ + unsigned char twt_target_wake_interval_exponent; + /** wake interval mantissa value */ + unsigned short twt_target_wake_interval_mantissa; + /** start of the waketime value after successful TWT negotiation */ + unsigned long long target_wake_time; + /** min TWT wake duration */ + unsigned int nominal_min_twt_wake_duration; + /** dialog_token of twt frame */ + unsigned char dialog_token; + /** 0->not received 1->received */ + unsigned char twt_resp_status; + /** TWT early wake duration */ + unsigned int twt_wake_ahead_duration; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines the parameters required for setting up TWT session. + * + */ + +struct nrf_wifi_umac_cmd_config_twt { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** TWT configuration info nrf_wifi_umac_config_twt_info */ + struct nrf_wifi_umac_config_twt_info info; +} __NRF_WIFI_PKD; + +#define INVALID_TIME 1 +#define TRIGGER_NOT_RECEIVED 2 + +/** + * @brief This structure represents the TWT delete information. + * + */ + +struct nrf_wifi_umac_teardown_twt_info { + /** TWT flow Id */ + unsigned char twt_flow_id; + /** reason for teardown */ + unsigned char reason_code; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines the command used to delete or remove a TWT session + * + */ + +struct nrf_wifi_umac_cmd_teardown_twt { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** nrf_wifi_umac_teardown_twt_info */ + struct nrf_wifi_umac_teardown_twt_info info; +} __NRF_WIFI_PKD; + +#define TWT_BLOCK_TX 0 +#define TWT_UNBLOCK_TX 1 +/** + * @brief This structure represents the information related to Tx (transmit) block/unblock. + * + */ +struct twt_sleep_info { + /** value for blocking/unblocking TX + * (TWT_BLOCK_TX or TWT_UNBLOCK_TX) + */ + unsigned int type; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines an event used to indicate to the host whether to block or + * unblock Tx (transmit) packets in TWT communication. + * + */ + +struct nrf_wifi_umac_event_twt_sleep { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** twt_sleep_info */ + struct twt_sleep_info info; +} __NRF_WIFI_PKD; + +#define UAPSD_Q_MIN 0 +#define UAPSD_Q_MAX 15 +/** + * @brief This structure represents the information about UAPSD queues. + * + */ + +struct nrf_wifi_umac_uapsd_info { + /** UAPSD-Q value */ + unsigned int uapsd_queue; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines the command used to configure the UAPSD-Q value. + * + */ + +struct nrf_wifi_umac_cmd_config_uapsd { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** nrf_wifi_umac_uapsd_info */ + struct nrf_wifi_umac_uapsd_info info; +} __NRF_WIFI_PKD; + +/** + * @brief This structure represents the event used to indicate that a scan has started. + * + */ + +struct nrf_wifi_umac_event_trigger_scan { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** Indicate which of the following parameters are valid */ + unsigned int valid_fields; + /** Scan request control flags (u32). Bit values + * (NRF_WIFI_SCAN_FLAG_LOW_PRIORITY/NRF_WIFI_SCAN_FLAG_RANDOM_ADDR...) + */ + unsigned int nrf_wifi_scan_flags; + /** No.of ssids in scan request */ + unsigned char num_scan_ssid; + /** No.of frequencies in scan request */ + unsigned char num_scan_frequencies; + /** center frequencies */ + unsigned short scan_frequencies[NRF_WIFI_SCAN_MAX_NUM_FREQUENCIES]; + /** nrf_wifi_ssid */ + struct nrf_wifi_ssid scan_ssid[NRF_WIFI_SCAN_MAX_NUM_SSIDS]; + /** nrf_wifi_ie */ + struct nrf_wifi_ie ie; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_EVENT_NEW_SCAN_RESULTS_MAC_ADDR_VALID (1 << 0) +#define NRF_WIFI_EVENT_NEW_SCAN_RESULTS_IES_TSF_VALID (1 << 1) +#define NRF_WIFI_EVENT_NEW_SCAN_RESULTS_IES_VALID (1 << 2) +#define NRF_WIFI_EVENT_NEW_SCAN_RESULTS_BEACON_IES_TSF_VALID (1 << 3) +#define NRF_WIFI_EVENT_NEW_SCAN_RESULTS_BEACON_IES_VALID (1 << 4) +#define NRF_WIFI_EVENT_NEW_SCAN_RESULTS_BEACON_INTERVAL_VALID (1 << 5) +#define NRF_WIFI_EVENT_NEW_SCAN_RESULTS_SIGNAL_VALID (1 << 6) +#define NRF_WIFI_EVENT_NEW_SCAN_RESULTS_STATUS_VALID (1 << 7) +#define NRF_WIFI_EVENT_NEW_SCAN_RESULTS_BSS_PRESP_DATA (1 << 8) + +#define NRF_WIFI_NEW_SCAN_RESULTS_BSS_PRESP_DATA (1 << 0) + +/** + * @brief This structure serves as a response to the command NRF_WIFI_UMAC_CMD_GET_SCAN_RESULTS. + * It contains scan results for each entry. RPU sends multiple events of this type for every + * scan entry, and when umac_hdr->seq == 0, it indicates the last scan entry. + * + */ + +struct nrf_wifi_umac_event_new_scan_results { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** Indicate which of the following parameters are valid */ + unsigned int valid_fields; + /** Unused */ + unsigned int generation; + /** Frequency in MHz */ + unsigned int frequency; + /** Channel width of the control channel */ + unsigned int chan_width; + /** Age of this BSS entry in ms */ + unsigned int seen_ms_ago; + /** Unused */ + unsigned int nrf_wifi_flags; + /** Status, if this BSS is "used" */ + signed int status; + /** TSF of the received probe response/beacon (u64) */ + unsigned long long ies_tsf; + /** TSF of the last received beacon + * (not present if no beacon frame has been received yet). + */ + unsigned long long beacon_ies_tsf; + /** Beacon interval of BSS */ + unsigned short beacon_interval; + /** Capability field */ + unsigned short capability; + /** Signal strength, nrf_wifi_signal */ + struct nrf_wifi_signal signal; + /** BSSID of the BSS (6 octets) */ + unsigned char mac_addr[NRF_WIFI_ETH_ADDR_LEN]; + /** Indicates length of IE's present at the starting of ies[0] */ + unsigned int ies_len; + /** Indicates length of beacon_ies present after ies+ies_len */ + unsigned int beacon_ies_len; + /** contains raw information elements from the probe response/beacon. + * If beacon_ies are not present then the IEs here are from a Probe Response + * frame; otherwise they are from a Beacon frame. + */ + unsigned char ies[0]; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_802_11A (1 << 0) +#define NRF_WIFI_802_11B (1 << 1) +#define NRF_WIFI_802_11G (1 << 2) +#define NRF_WIFI_802_11N (1 << 3) +#define NRF_WIFI_802_11AC (1 << 4) +#define NRF_WIFI_802_11AX (1 << 5) + +#define NRF_WIFI_MFP_REQUIRED (1 << 0) +#define NRF_WIFI_MFP_CAPABLE (1 << 1) +/** + * @brief This structure represents the response for NRF_WIFI_UMAC_CMD_GET_SCAN_RESULTS. + * It contains the displayed scan result. + * + */ + +struct umac_display_results { + /** Network SSID nrf_wifi_ssid */ + struct nrf_wifi_ssid ssid; + /** BSSID of the BSS (6 octets) */ + unsigned char mac_addr[NRF_WIFI_ETH_ADDR_LEN]; + /** Network band of operation, refer &enum nrf_wifi_band */ + signed int nwk_band; + /** Network channel number */ + unsigned int nwk_channel; + /** Protocol type (NRF_WIFI_802_11A) */ + unsigned char protocol_flags; + /** Network security mode, refer &enum nrf_wifi_security_type */ + signed int security_type; + /** Beacon interval of the BSS */ + unsigned short beacon_interval; + /** Capability field */ + unsigned short capability; + /** Signal strength. Refer &struct nrf_wifi_signal */ + struct nrf_wifi_signal signal; + /** TWT support */ + unsigned char twt_support; + /** management frame protection NRF_WIFI_MFP_REQUIRED/NRF_WIFI_MFP_CAPABLE */ + unsigned char mfp_flag; + /** reserved */ + unsigned char reserved3; + /** reserved */ + unsigned char reserved4; +} __NRF_WIFI_PKD; + +#define DISPLAY_BSS_TOHOST_PEREVNT 8 + +/** + * @brief This structure serves as a response to the command NRF_WIFI_UMAC_CMD_GET_SCAN_RESULTS + * of display scan type. It contains a maximum of DISPLAY_BSS_TOHOST_PEREVENT scan results + * in each event. When umac_hdr->seq == 0, it indicates the last scan event. + * + */ + +struct nrf_wifi_umac_event_new_scan_display_results { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** Number of scan results in the current event */ + unsigned char event_bss_count; + /** Display scan results info umac_display_results */ + struct umac_display_results display_results[DISPLAY_BSS_TOHOST_PEREVNT]; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_EVENT_MLME_FRAME_VALID (1 << 0) +#define NRF_WIFI_EVENT_MLME_MAC_ADDR_VALID (1 << 1) +#define NRF_WIFI_EVENT_MLME_FREQ_VALID (1 << 2) +#define NRF_WIFI_EVENT_MLME_COOKIE_VALID (1 << 3) +#define NRF_WIFI_EVENT_MLME_RX_SIGNAL_DBM_VALID (1 << 4) +#define NRF_WIFI_EVENT_MLME_WME_UAPSD_QUEUES_VALID (1 << 5) +#define NRF_WIFI_EVENT_MLME_RXMGMT_FLAGS_VALID (1 << 6) +#define NRF_WIFI_EVENT_MLME_IE_VALID (1 << 7) +#define NRF_WIFI_EVENT_MLME_RXDEAUTH_FROM_AP (1 << 8) + +#define NRF_WIFI_EVENT_MLME_TIMED_OUT (1 << 0) +#define NRF_WIFI_EVENT_MLME_ACK (1 << 1) + +/** + * @brief This structure represent different responses received from the access point during + * various stages of the connection process like Authentication Response and Association Response. + * + */ + +struct nrf_wifi_umac_event_mlme { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** Indicate which of the following parameters are valid */ + unsigned int valid_fields; + /** Frequency of the channel in MHz */ + unsigned int frequency; + /** Signal strength in dBm */ + unsigned int rx_signal_dbm; + /** Indicate whether the frame was acked or timed out */ + unsigned int nrf_wifi_flags; + /** cookie identifier */ + unsigned long long cookie; + /** Frame data, including frame header and body nrf_wifi_frame */ + struct nrf_wifi_frame frame; + /** BSSID of the BSS */ + unsigned char mac_addr[NRF_WIFI_ETH_ADDR_LEN]; + /** Bitmap of uapsd queues */ + unsigned char wme_uapsd_queues; + /** Request(AUTH/ASSOC) ie length */ + unsigned int req_ie_len; + /** ie's */ + unsigned char req_ie[0]; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_CMD_SEND_STATION_ASSOC_REQ_IES_VALID (1 << 0) + +/** + * @brief This structure represents an event that is generated when a station is added or removed. + * + */ + +struct nrf_wifi_umac_event_new_station { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** Indicate if assoc_req ies is valid */ + unsigned int valid_fields; + /** set to 1: STA supports QoS/WME */ + unsigned char wme; + /** Set to 1 if STA is Legacy(a/b/g) */ + unsigned char is_sta_legacy; + /** Station mac address */ + unsigned char mac_addr[NRF_WIFI_ETH_ADDR_LEN]; + /** generation number */ + unsigned int generation; + /** Station information nrf_wifi_sta_info */ + struct nrf_wifi_sta_info sta_info; + /** nrf_wifi_ie */ + struct nrf_wifi_ie assoc_req_ies; + +} __NRF_WIFI_PKD; + +#define NRF_WIFI_CMD_COOKIE_RSP_COOKIE_VALID (1 << 0) +#define NRF_WIFI_CMD_COOKIE_RSP_MAC_ADDR_VALID (1 << 1) + +/** + * @brief This structure specifies the cookie response event, which is used to receive an + * RPU cookie associated with the host cookie passed during NRF_WIFI_UMAC_CMD_FRAME. + * + */ + +struct nrf_wifi_umac_event_cookie_rsp { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** Indicate if assoc_req ies is valid */ + unsigned int valid_fields; + /** Identifier passed during NRF_WIFI_UMAC_CMD_FRAME */ + unsigned long long host_cookie; + /** Cookie used to indicate TX done in NRF_WIFI_UMAC_EVENT_FRAME_TX_STATUS */ + unsigned long long cookie; + /** Mac address */ + unsigned char mac_addr[NRF_WIFI_ETH_ADDR_LEN]; + +} __NRF_WIFI_PKD; + +/** + * @brief This structure represents the event that corresponds to the command + * NRF_WIFI_UMAC_CMD_GET_TX_POWER. It is used to retrieve the transmit power + * information from the device + * + */ + +struct nrf_wifi_umac_event_get_tx_power { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** Tx power in dbm */ + signed int txpwr_level; + +} __NRF_WIFI_PKD; + +/** + * @brief This structure represents the response to the command NRF_WIFI_UMAC_CMD_SET_INTERFACE. + * It contains the necessary information indicating the result or status of the interface + * configuration operation after the command has been executed. + * + */ + +struct nrf_wifi_umac_event_set_interface { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** return value */ + signed int return_value; +} __NRF_WIFI_PKD; + +/** + * @brief channel flags. + * + * Channel flags set by the regulatory control code. + * + */ + +enum nrf_wifi_channel_flags { + /** This channel is disabled */ + CHAN_DISABLED = 1<<0, + /** do not initiate radiation, this includes sending probe requests or beaconing */ + CHAN_NO_IR = 1<<1, + /** Radar detection is required on this channel hole at 1<<2 */ + CHAN_RADAR = 1<<3, + /** extension channel above this channel is not permitted */ + CHAN_NO_HT40PLUS = 1<<4, + /** extension channel below this channel is not permitted */ + CHAN_NO_HT40MINUS = 1<<5, + /** OFDM is not allowed on this channel */ + CHAN_NO_OFDM = 1<<6, + /** If the driver supports 80 MHz on the band, + * this flag indicates that an 80 MHz channel cannot use this + * channel as the control or any of the secondary channels. + * This may be due to the driver or due to regulatory bandwidth + * restrictions. + */ + CHAN_NO_80MHZ = 1<<7, + /** If the driver supports 160 MHz on the band, + * this flag indicates that an 160 MHz channel cannot use this + * channel as the control or any of the secondary channels. + * This may be due to the driver or due to regulatory bandwidth + * restrictions. + */ + CHAN_NO_160MHZ = 1<<8, + /** NL80211_FREQUENCY_ATTR_INDOOR_ONLY */ + CHAN_INDOOR_ONLY = 1<<9, + /** NL80211_FREQUENCY_ATTR_GO_CONCURRENT */ + CHAN_GO_CONCURRENT = 1<<10, + /** 20 MHz bandwidth is not permitted on this channel */ + CHAN_NO_20MHZ = 1<<11, + /** 10 MHz bandwidth is not permitted on this channel */ + CHAN_NO_10MHZ = 1<<12, +}; + +/** + * @brief channel definition. + * + */ + +struct nrf_wifi_chan_definition { + /** Frequency of the selected channel in MHz */ + struct nrf_wifi_channel chan; + /** channel width */ + signed int width; + /** center frequency of first segment */ + unsigned int center_frequency1; + /** center frequency of second segment (only with 80+80 MHz) */ + unsigned int center_frequency2; +} __NRF_WIFI_PKD; + +/** + * @brief This structure represents channel information and serves as the event for the + * command NRF_WIFI_UMAC_CMD_GET_CHANNEL. + * + */ +struct nrf_wifi_umac_event_get_channel { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** Channel information.nrf_wifi_chan_definition */ + struct nrf_wifi_chan_definition chan_def; +} __NRF_WIFI_PKD; + +/** + * @brief This structure represents the command used to retrieve connection information. + * + */ +struct nrf_wifi_umac_cmd_conn_info { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; +} __NRF_WIFI_PKD; + +/* TODD: Review below later, for now to get build working */ +/** + * @brief Types of connection protected/un-protected. + * + */ + + enum nrf_wifi_conn_type { + /* Connection to be non-protected */ + NRF_WIFI_CONN_TYPE_OPEN, + /* Connection to be protected */ + NRF_WIFI_CONN_TYPE_SECURE, +}; + +/** + * @brief This structure specifies the parameters to be used when sending an association request. + * + */ + + struct nrf_wifi_umac_assoc_info { + /** Frequency of the selected channel in MHz */ + unsigned int center_frequency; + /** ssid nrf_wifi_ssid */ + struct nrf_wifi_ssid ssid; + /** MAC address (various uses) */ + unsigned char nrf_wifi_bssid[NRF_WIFI_ETH_ADDR_LEN]; + /** WPA information element data. nrf_wifi_ie */ + struct nrf_wifi_ie wpa_ie; + /** Whether management frame protection (IEEE 802.11w) is used for the association */ + unsigned char use_mfp; + /** Indicating whether user space controls IEEE 802.1X port. If set, the RPU will + * assume that the port is unauthorized until authorized by user space. + * Otherwise, port is marked authorized by default in station mode. + */ + signed char control_port; + /** Previous BSSID used in flag */ + unsigned int prev_bssid_flag; + /** Previous BSSID used in Re-assoc. */ + unsigned char prev_bssid[NRF_WIFI_ETH_ADDR_LEN]; + /** Bss max idle timeout value in sec wich will be encapsulated into + * BSS MAX IDLE IE in assoc request frame. + */ + unsigned short bss_max_idle_time; + /** Connection type */ + unsigned char conn_type; +} __NRF_WIFI_PKD; + + +enum link_mode { + NRF_WIFI_MODE_11B = 1, + NRF_WIFI_MODE_11A, + NRF_WIFI_MODE_11G, + NRF_WIFI_MODE_11N, + NRF_WIFI_MODE_11AC, + NRF_WIFI_MODE_11AX, + NRF_WIFI_MODE_11BE +}; + +/** + * @brief This structure represents the information related to the connection of a station. + * + */ + +struct nrf_wifi_umac_event_conn_info { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** Beacon interval */ + unsigned short beacon_interval; + /** DTIM interval */ + unsigned char dtim_interval; + /** Station association state */ + unsigned char associated; + /** TWT supported or not */ + unsigned char twt_capable; + /** Refer &enum link_mode */ + unsigned char linkmode; +} __NRF_WIFI_PKD; + + +/** + * @brief This structure defines the command used to retrieve power save information. + * + */ +struct nrf_wifi_umac_cmd_get_power_save_info { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines the command used to set the listen interval period. + * It determines how frequently a device wakes up to check for any pending data or traffic + * from the access point. By setting the listen interval, devices can adjust their power-saving + * behavior to balance power efficiency and responsiveness to incoming data. + * + */ +struct nrf_wifi_umac_cmd_set_listen_interval { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** listen interval */ + unsigned short listen_interval; +} __NRF_WIFI_PKD; + +/** + * @brief This structure represents the command used to enable or disable extended power save mode. + * When enabled, the RPU wakes up based on the listen interval, allowing the device to spend more + * time in a lower power state. When disabled, the RPU wakes up based on the DTIM period, which + * may require more frequent wake-ups but can provide better responsiveness for receiving + * multicast/broadcast traffic. + * + */ +struct nrf_wifi_umac_cmd_config_extended_ps { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** 1=enable 0=disable */ + unsigned char enable_extended_ps; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_MAX_TWT_FLOWS 8 +#define NRF_WIFI_PS_MODE_LEGACY 0 +#define NRF_WIFI_PS_MODE_WMM 1 + +/** + * @brief Given that most APs typically use a DTIM value of 3, + * we anticipate a minimum listen interval of 3 beacon intervals. + * + */ +#define NRF_WIFI_LISTEN_INTERVAL_MIN 3 + +/** + * @brief This structure represents an event that provides information about the RPU power save + * mode. It contains details regarding the current power save mode and its settings. + * + */ +struct nrf_wifi_umac_event_power_save_info { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** Power save mode. NRF_WIFI_PS_MODE_LEGACY/NRF_WIFI_PS_MODE_WMM */ + unsigned char ps_mode; + /** Power save enable flag */ + unsigned char enabled; + /** Extended power save ON(1)/OFF(0) */ + unsigned char extended_ps; + /** Is TWT responder */ + unsigned char twt_responder; + /** Power save timed out value */ + unsigned int ps_timeout; + /** Listen interval value */ + unsigned short listen_interval; + /** Power save exit strategy */ + unsigned char ps_exit_strategy; + /** Number TWT flows */ + unsigned char num_twt_flows; + /** TWT info of each flow nrf_wifi_umac_config_twt_info */ + struct nrf_wifi_umac_config_twt_info twt_flow_info[0]; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_EVENT_TRIGGER_SCAN_IE_VALID (1 << 0) +#define NRF_WIFI_EVENT_TRIGGER_SCAN_SCAN_FLAGS_VALID (1 << 1) +/** + * @brief This structure contains information relevant to the "Remain on Channel" operation. + * It is used to specify the details related to the duration and channel on which a device + * needs to stay without regular data transmission or reception. + * + */ + +struct remain_on_channel_info { + /** Amount of time to remain on specified channel */ + unsigned int dur; + /** Frequency configuration, see &struct freq_params */ + struct freq_params nrf_wifi_freq_params; + /** Identifier to be used for processing NRF_WIFI_UMAC_EVENT_COOKIE_RESP event */ + unsigned long long host_cookie; + /** Unused */ + unsigned long long cookie; + +} __NRF_WIFI_PKD; + +#define NRF_WIFI_CMD_ROC_FREQ_PARAMS_VALID (1 << 0) +#define NRF_WIFI_CMD_ROC_DURATION_VALID (1 << 1) +/** + * @brief This structure represents the command used to keep the device awake on the specified + * channel for a designated period. The command initiates the "Remain on Channel" operation. + * + */ + +struct nrf_wifi_umac_cmd_remain_on_channel { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** Indicate which of the following parameters are valid */ + unsigned int valid_fields; + /** Information about channel parameters.remain_on_channel_info */ + struct remain_on_channel_info info; + +} __NRF_WIFI_PKD; + +#define NRF_WIFI_CMD_CANCEL_ROC_COOKIE_VALID (1 << 0) +/** + * @brief This structure represents the command to cancel "Remain on Channel" operation. + * + */ +struct nrf_wifi_umac_cmd_cancel_remain_on_channel { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** Indicate which of the following parameters are valid */ + unsigned int valid_fields; + /** cookie to identify remain on channel */ + unsigned long long cookie; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_EVENT_ROC_FREQ_VALID (1 << 0) +#define NRF_WIFI_EVENT_ROC_COOKIE_VALID (1 << 1) +#define NRF_WIFI_EVENT_ROC_DURATION_VALID (1 << 2) +#define NRF_WIFI_EVENT_ROC_CH_TYPE_VALID (1 << 3) +/** + * @brief This structure represents the response to command "Remain on Channel". + * + */ + +struct nrf_wifi_event_remain_on_channel { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** Indicate which of the following parameters are valid */ + unsigned int valid_fields; + /** Frequency of the channel */ + unsigned int frequency; + /** duration that can be requested with the remain-on-channel operation(ms) */ + unsigned int dur; + /** see &enum nrf_wifi_channel_type */ + unsigned int ch_type; + /** cookie to identify remain on channel */ + unsigned long long cookie; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines the command used to retrieve interface information. + * + */ +struct nrf_wifi_cmd_get_interface { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_INTERFACE_INFO_CHAN_DEF_VALID (1 << 0) +#define NRF_WIFI_INTERFACE_INFO_SSID_VALID (1 << 1) +#define NRF_WIFI_INTERFACE_INFO_IFNAME_VALID (1 << 2) + +/** + * @brief This structure represents an event that contains information about a network interface. + * + */ + +struct nrf_wifi_interface_info { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** Indicate which of the following parameters are valid */ + unsigned int valid_fields; + /** Interface type, see &enum nrf_wifi_iftype */ + signed int nrf_wifi_iftype; + /** Interface name */ + signed char ifacename[IFACENAMSIZ]; + /** Mac address */ + unsigned char nrf_wifi_eth_addr[NRF_WIFI_ETH_ADDR_LEN]; + /** nrf_wifi_chan_definition */ + struct nrf_wifi_chan_definition chan_def; + /** nrf_wifi_ssid */ + struct nrf_wifi_ssid ssid; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_HT_MCS_MASK_LEN 10 +#define NRF_WIFI_HT_MCS_RES_LEN 3 + +/** + * @brief MCS information. + * + */ +struct nrf_wifi_event_mcs_info { + /** Highest supported RX rate */ + unsigned short nrf_wifi_rx_highest; + /** RX mask */ + unsigned char nrf_wifi_rx_mask[NRF_WIFI_HT_MCS_MASK_LEN]; + /** TX parameters */ + unsigned char nrf_wifi_tx_params; + /** reserved */ + unsigned char nrf_wifi_reserved[NRF_WIFI_HT_MCS_RES_LEN]; +} __NRF_WIFI_PKD; + +/** + * @brief This structure represents HT capability parameters. + * + */ +struct nrf_wifi_event_sta_ht_cap { + /** 1 indicates HT Supported */ + signed int nrf_wifi_ht_supported; + /** HT capabilities, as in the HT information IE */ + unsigned short nrf_wifi_cap; + /** MCS information. nrf_wifi_event_mcs_info */ + struct nrf_wifi_event_mcs_info mcs; + /** A-MPDU factor, as in 11n */ + unsigned char nrf_wifi_ampdu_factor; + /** A-MPDU density, as in 11n */ + unsigned char nrf_wifi_ampdu_density; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_CHAN_FLAG_FREQUENCY_ATTR_NO_IR (1 << 0) +#define NRF_WIFI_CHAN_FLAG_FREQUENCY_ATTR_NO_IBSS (1 << 1) +#define NRF_WIFI_CHAN_FLAG_FREQUENCY_ATTR_RADAR (1 << 2) +#define NRF_WIFI_CHAN_FLAG_FREQUENCY_ATTR_NO_HT40_MINUS (1 << 3) +#define NRF_WIFI_CHAN_FLAG_FREQUENCY_ATTR_NO_HT40_PLUS (1 << 4) +#define NRF_WIFI_CHAN_FLAG_FREQUENCY_ATTR_NO_80MHZ (1 << 5) +#define NRF_WIFI_CHAN_FLAG_FREQUENCY_ATTR_NO_160MHZ (1 << 6) +#define NRF_WIFI_CHAN_FLAG_FREQUENCY_ATTR_INDOOR_ONLY (1 << 7) +#define NRF_WIFI_CHAN_FLAG_FREQUENCY_ATTR_GO_CONCURRENT (1 << 8) +#define NRF_WIFI_CHAN_FLAG_FREQUENCY_ATTR_NO_20MHZ (1 << 9) +#define NRF_WIFI_CHAN_FLAG_FREQUENCY_ATTR_NO_10MHZ (1 << 10) +#define NRF_WIFI_CHAN_FLAG_FREQUENCY_DISABLED (1 << 11) + +#define NRF_WIFI_CHAN_DFS_VALID (1 << 12) +#define NRF_WIFI_CHAN_DFS_CAC_TIME_VALID (1 << 13) + +/** + * @brief This structure represents channel parameters. + */ +struct nrf_wifi_event_channel { + /** channel flags NRF_WIFI_CHAN_FLAG_FREQUENCY_ATTR_NO_IBSS */ + unsigned short nrf_wifi_flags; + /** maximum transmission power (in dBm) */ + signed int nrf_wifi_max_power; + /** DFS state time */ + unsigned int nrf_wifi_time; + /** DFS CAC time in ms */ + unsigned int dfs_cac_msec; + /** Channel parameters are valid or not 1=valid */ + signed char ch_valid; + /** Channel center frequency */ + unsigned short center_frequency; + /** Current dfs state */ + signed char dfs_state; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_EVENT_GET_WIPHY_FLAG_RATE_SHORT_PREAMBLE (1 << 0) +/** + * @brief This structure represents rate information. + */ +struct nrf_wifi_event_rate { + /** NRF_WIFI_EVENT_GET_WIPHY_FLAG_RATE_SHORT_PREAMBLE */ + unsigned short nrf_wifi_flags; + /** Bitrate in units of 100 kbps */ + unsigned short nrf_wifi_bitrate; +} __NRF_WIFI_PKD; +/** + * @brief VHT MCS information. + * + */ + +struct nrf_wifi_event_vht_mcs_info { + /** RX MCS map 2 bits for each stream, total 8 streams */ + unsigned short rx_mcs_map; + /** Indicates highest long GI VHT PPDU data rate + * STA can receive. Rate expressed in units of 1 Mbps. + * If this field is 0 this value should not be used to + * consider the highest RX data rate supported. + */ + unsigned short rx_highest; + /** TX MCS map 2 bits for each stream, total 8 streams */ + unsigned short tx_mcs_map; + /** Indicates highest long GI VHT PPDU data rate + * STA can transmit. Rate expressed in units of 1 Mbps. + * If this field is 0 this value should not be used to + * consider the highest TX data rate supported. + */ + unsigned short tx_highest; +} __NRF_WIFI_PKD; + +/** + * @brief This structure represents VHT capability parameters. + * + */ +struct nrf_wifi_event_sta_vht_cap { + /** 1 indicates VHT Supported */ + signed char nrf_wifi_vht_supported; + /** VHT capability info */ + unsigned int nrf_wifi_cap; + /** Refer nrf_wifi_event_vht_mcs_info */ + struct nrf_wifi_event_vht_mcs_info vht_mcs; +} __NRF_WIFI_PKD; + +/** + * @brief Frequency band information. + * + */ +struct nrf_wifi_event_supported_band { + /** No.of channels */ + unsigned short nrf_wifi_n_channels; + /** No.of bitrates */ + unsigned short nrf_wifi_n_bitrates; + /** Array of channels the hardware can operate in this band */ + struct nrf_wifi_event_channel channels[29]; + /** Array of bitrates the hardware can operate with in this band */ + struct nrf_wifi_event_rate bitrates[13]; + /** HT capabilities in this band */ + struct nrf_wifi_event_sta_ht_cap ht_cap; + /** VHT capabilities in this band */ + struct nrf_wifi_event_sta_vht_cap vht_cap; + /** the band this structure represents */ + signed char band; +} __NRF_WIFI_PKD; + +/** + * @brief Interface limits. + * + */ +struct nrf_wifi_event_iface_limit { + /** max interface limits */ + unsigned short nrf_wifi_max; + /** types */ + unsigned short nrf_wifi_types; +} __NRF_WIFI_PKD; + + +#define NRF_WIFI_EVENT_GET_WIPHY_VALID_RADAR_DETECT_WIDTHS (1 << 0) +#define NRF_WIFI_EVENT_GET_WIPHY_VALID_RADAR_DETECT_REGIONS (1 << 1) +#define NRF_WIFI_EVENT_GET_WIPHY_VALID_ (1 << 2) +/** + * @brief This structure defines an event that represents interface combinations. + * + */ +struct nrf_wifi_event_iface_combination { + /** channels count */ + unsigned int nrf_wifi_num_different_channels; + /** Unused */ + signed int beacon_int_infra_match; + /** nrf_wifi_event_iface_limit */ + struct nrf_wifi_event_iface_limit limits[2]; + /** Max interfaces */ + unsigned short nrf_wifi_max_interfaces; + /** Not used */ + unsigned char nrf_wifi_radar_detect_widths; + /** Not used */ + unsigned char nrf_wifi_n_limits; + /** Not used */ + unsigned char nrf_wifi_radar_detect_regions; + /** Not used */ + unsigned char comb_valid; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_EVENT_GET_WIPHY_IBSS_RSN (1 << 0) +#define NRF_WIFI_EVENT_GET_WIPHY_MESH_AUTH (1 << 1) +#define NRF_WIFI_EVENT_GET_WIPHY_AP_UAPSD (1 << 2) +#define NRF_WIFI_EVENT_GET_WIPHY_SUPPORTS_FW_ROAM (1 << 3) +#define NRF_WIFI_EVENT_GET_WIPHY_SUPPORTS_TDLS (1 << 4) +#define NRF_WIFI_EVENT_GET_WIPHY_TDLS_EXTERNAL_SETUP (1 << 5) +#define NRF_WIFI_EVENT_GET_WIPHY_CONTROL_PORT_ETHERTYPE (1 << 6) +#define NRF_WIFI_EVENT_GET_WIPHY_OFFCHANNEL_TX_OK (1 << 7) + +#define NRF_WIFI_GET_WIPHY_VALID_PROBE_RESP_OFFLOAD (1 << 0) +#define NRF_WIFI_GET_WIPHY_VALID_TX_ANT (1 << 1) +#define NRF_WIFI_GET_WIPHY_VALID_RX_ANT (1 << 2) +#define NRF_WIFI_GET_WIPHY_VALID_MAX_NUM_SCAN_SSIDS (1 << 3) +#define NRF_WIFI_GET_WIPHY_VALID_NUM_SCHED_SCAN_SSIDS (1 << 4) +#define NRF_WIFI_GET_WIPHY_VALID_MAX_MATCH_SETS (1 << 5) +#define NRF_WIFI_GET_WIPHY_VALID_MAC_ACL_MAX (1 << 6) +#define NRF_WIFI_GET_WIPHY_VALID_HAVE_AP_SME (1 << 7) +#define NRF_WIFI_GET_WIPHY_VALID_EXTENDED_CAPABILITIES (1 << 8) +#define NRF_WIFI_GET_WIPHY_VALID_MAX_AP_ASSOC_STA (1 << 9) +#define NRF_WIFI_GET_WIPHY_VALID_WIPHY_NAME (1 << 10) +#define NRF_WIFI_GET_WIPHY_VALID_EXTENDED_FEATURES (1 << 11) + +#define NRF_WIFI_EVENT_GET_WIPHY_MAX_CIPHER_COUNT 30 + +#define NRF_WIFI_INDEX_IDS_WIPHY_NAME 32 +#define NRF_WIFI_EVENT_GET_WIPHY_NUM_BANDS 4 + +#define EXTENDED_FEATURE_LEN 60 +#define DIV_ROUND_UP_NL(n, d) (((n) + (d)-1) / (d)) + +/** + * @brief This structure represents wiphy parameters. + * + */ +struct nrf_wifi_event_get_wiphy { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** Unused */ + unsigned int nrf_wifi_frag_threshold; + /** RTS threshold value */ + unsigned int nrf_wifi_rts_threshold; + /** Unused */ + unsigned int nrf_wifi_available_antennas_tx; + /** Unused */ + unsigned int nrf_wifi_available_antennas_rx; + /** Unused */ + unsigned int nrf_wifi_probe_resp_offload; + /** Unused */ + unsigned int tx_ant; + /** Unused */ + unsigned int rx_ant; + /** Unused */ + unsigned int split_start2_flags; + /** Maximum ROC duration */ + unsigned int max_remain_on_channel_duration; + /** Unused */ + unsigned int ap_sme_capa; + /** Unused */ + unsigned int features; + /** Unused */ + unsigned int max_acl_mac_addresses; + /** maximum number of associated stations supported in AP mode */ + unsigned int max_ap_assoc_sta; + /** supported cipher suites */ + unsigned int cipher_suites[NRF_WIFI_EVENT_GET_WIPHY_MAX_CIPHER_COUNT]; + /** wiphy flags NRF_WIFI_EVENT_GET_WIPHY_AP_UAPSD */ + unsigned int get_wiphy_flags; + /** valid parameters NRF_WIFI_GET_WIPHY_VALID_WIPHY_NAME */ + unsigned int params_valid; + /** Maximum scan IE length */ + unsigned short int max_scan_ie_len; + /** Unused */ + unsigned short int max_sched_scan_ie_len; + /** bit mask of interface value of see &enum nrf_wifi_iftype */ + unsigned short int interface_modes; + /** Unused */ + struct nrf_wifi_event_iface_combination iface_com[6]; + /** Unused */ + signed char supp_commands[40]; + /** Retry limit for short frames */ + unsigned char retry_short; + /** Retry limit for long frames */ + unsigned char retry_long; + /** Unused */ + unsigned char coverage_class; + /** Maximum ssids supported in scan */ + unsigned char max_scan_ssids; + /** Unused */ + unsigned char max_sched_scan_ssids; + /** Unused */ + unsigned char max_match_sets; + /** Unused */ + unsigned char n_cipher_suites; + /** Unused */ + unsigned char max_num_pmkids; + /** length of the extended capabilities */ + unsigned char extended_capabilities_len; + /** Extended capabilities */ + unsigned char extended_capabilities[10]; + /** Extended capabilities mask */ + unsigned char extended_capabilities_mask[10]; + /** Unused */ + unsigned char ext_features[DIV_ROUND_UP_NL(EXTENDED_FEATURE_LEN, 8)]; + /** Unused */ + unsigned char ext_features_len; + /** Unused */ + signed char num_iface_com; + /** Wiphy name */ + signed char wiphy_name[NRF_WIFI_INDEX_IDS_WIPHY_NAME]; + /** Supported bands info. nrf_wifi_event_supported_band */ + struct nrf_wifi_event_supported_band sband[NRF_WIFI_EVENT_GET_WIPHY_NUM_BANDS]; +} __NRF_WIFI_PKD; +/** + * @brief This structure represents the command used to retrieve Wireless PHY (wiphy) information. + * + */ +struct nrf_wifi_cmd_get_wiphy { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; +} __NRF_WIFI_PKD; + +/** + * @brief This structure represents the command to get hardware address. + * + */ +struct nrf_wifi_cmd_get_ifhwaddr { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** Interface name */ + signed char ifacename[IFACENAMSIZ]; +} __NRF_WIFI_PKD; + +/** + * @brief This structure represents the command used to retrieve the hardware address or + * MAC address of the device. + * + */ +struct nrf_wifi_cmd_set_ifhwaddr { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** Interface name */ + signed char ifacename[IFACENAMSIZ]; + /** Hardware address to be set */ + unsigned char nrf_wifi_hwaddr[NRF_WIFI_ETH_ADDR_LEN]; +} __NRF_WIFI_PKD; + +#define REG_RULE_FLAGS_VALID (1 << 0) +#define FREQ_RANGE_START_VALID (1 << 1) +#define FREQ_RANGE_END_VALID (1 << 2) +#define FREQ_RANGE_MAX_BW_VALID (1 << 3) +#define POWER_RULE_MAX_EIRP_VALID (1 << 4) + +#define NRF_WIFI_RULE_FLAGS_NO_OFDM (1<<0) +#define NRF_WIFI_RULE_FLAGS_NO_CCK (1<<1) +#define NRF_WIFI_RULE_FLAGS_NO_INDOOR (1<<2) +#define NRF_WIFI_RULE_FLAGS_NO_OUTDOOR (1<<3) +#define NRF_WIFI_RULE_FLAGS_DFS (1<<4) +#define NRF_WIFI_RULE_FLAGS_PTP_ONLY (1<<5) +#define NRF_WIFI_RULE_FLAGS_PTMP_ONLY (1<<6) +#define NRF_WIFI_RULE_FLAGS_NO_IR (1<<7) +#define NRF_WIFI_RULE_FLAGS_IBSS (1<<8) +#define NRF_WIFI_RULE_FLAGS_AUTO_BW (1<<11) +#define NRF_WIFI_RULE_FLAGS_IR_CONCURRENT (1<<12) +#define NRF_WIFI_RULE_FLAGS_NO_HT40MINUS (1<<13) +#define NRF_WIFI_RULE_FLAGS_NO_HT40PLUS (1<<14) +#define NRF_WIFI_RULE_FLAGS_NO_80MHZ (1<<15) +#define NRF_WIFI_RULE_FLAGS_NO_160MHZ (1<<16) + +/** + * @brief This structure represents the information related to the regulatory domain + * of a wireless device. The regulatory domain defines the specific rules and regulations + * that govern the usage of radio frequencies in a particular geographical region. + * + */ + +struct nrf_wifi_reg_rules { + /** Indicate which of the following parameters are valid */ + unsigned int valid_fields; + /** NRF_WIFI_RULE_FLAGS_NO_CCK and NRF_WIFI_RULE_FLAGS_NO_INDOOR */ + unsigned int rule_flags; + /** starting frequencry for the regulatory rule in KHz */ + unsigned int freq_range_start; + /** ending frequency for the regulatory rule in KHz */ + unsigned int freq_range_end; + /** maximum allowed bandwidth for this frequency range */ + unsigned int freq_range_max_bw; + /** maximum allowed EIRP mBm (100 * dBm) */ + unsigned int pwr_max_eirp; + +} __NRF_WIFI_PKD; + +/** + * @brief This structure represents channels information like maximum power, + * center frequency, channel supported and active or passive scan. + * + */ +struct nrf_wifi_get_reg_chn_info { + /** center frequency in MHz */ + unsigned int center_frequency; + /** maximum transmission power (in dBm) */ + unsigned int max_power; + /** Particular channel is supported or not */ + char supported; + /** Particular channel is supports passive scanning or not */ + char passive_channel; + /** Particular channel is dfs or not */ + char dfs; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_CMD_SET_REG_ALPHA2_VALID (1 << 0) +#define NRF_WIFI_CMD_SET_REG_RULES_VALID (1 << 1) +#define NRF_WIFI_CMD_SET_REG_DFS_REGION_VALID (1 << 2) + +#define MAX_NUM_REG_RULES 32 + +/** + * @brief This structure represents an event that contains regulatory domain information. + * + */ + +struct nrf_wifi_reg { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** Country code */ + unsigned char nrf_wifi_alpha2[NRF_WIFI_COUNTRY_CODE_LEN]; + /** Number of channel list information */ + unsigned int num_channels; + /** channels list information */ + struct nrf_wifi_get_reg_chn_info chn_info[0]; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_CMD_REQ_SET_REG_ALPHA2_VALID (1 << 0) +#define NRF_WIFI_CMD_REQ_SET_REG_USER_REG_HINT_TYPE_VALID (1 << 1) +#define NRF_WIFI_CMD_REQ_SET_REG_USER_REG_FORCE (1 << 2) +/** + * @brief This structure represents the command used to set the regulatory domain + * for a wireless device. It allows configuring the device to adhere to the rules + * and regulations specific to the geographical region in which it is operating. + * + */ +struct nrf_wifi_cmd_req_set_reg { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** Indicate which of the following parameters are valid */ + unsigned int valid_fields; + /** Type of regulatory hint passed from userspace */ + unsigned int nrf_wifi_user_reg_hint_type; + /** Country code */ + unsigned char nrf_wifi_alpha2[NRF_WIFI_COUNTRY_CODE_LEN]; +} __NRF_WIFI_PKD; + +/** + * @brief This structure represents the status code for a command. It is used to indicate + * the outcome or result of executing a specific command. The status code provides valuable + * information about the success, failure, or any errors encountered during the execution + * of the command, helping to understand the current state of the device. + * + */ +struct nrf_wifi_umac_event_cmd_status { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** Command id. see &enum nrf_wifi_umac_commands */ + unsigned int cmd_id; + /** Status codes */ + unsigned int cmd_status; +} __NRF_WIFI_PKD; + + + /** + * @brief This structure represents the command used to configure quiet period. + * + */ +struct nrf_wifi_umac_cmd_config_quiet_period { + /** Header nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** quiet period value in seconds */ + unsigned int quiet_period_in_sec; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines the command used to configure the power save exit + * strategy for retrieving buffered data from the AP in power save mode. + * + */ +struct nrf_wifi_cmd_ps_exit_strategy { + /** Header @ref nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** Power save exit strategy */ + unsigned char ps_exit_strategy; +} __NRF_WIFI_PKD; + +/** + * @brief This structure represents the information related to rx buffers. + * + */ + +struct nrf_wifi_rx_buf { + /** pointer to the rx buffer */ + unsigned int skb_pointer; + /** Descriptor value */ + unsigned short skb_desc_no; +}__NRF_WIFI_PKD; + +/** + * @brief This structure defines the command used to configure RX buffers. + * + */ + +struct nrf_wifi_cmd_rx_buf_info { + /** Header @ref nrf_wifi_umac_hdr */ + struct nrf_wifi_umac_hdr umac_hdr; + /** number of rx buffers */ + unsigned int rx_buf_num; + /** @ref nrf_wifi_rx_buf */ + struct nrf_wifi_rx_buf info[0]; +}__NRF_WIFI_PKD; + +/** + * struct nrf_wifi_umac_cmd_set_channel - Set channel configuration. + * @umac_hdr: UMAC command header. Refer &struct nrf_wifi_umac_hdr. + * @valid_fields: Indicate which of the following structure parameters are valid. + * @freq_params: Information related to channel parameters + * + * This structure represents the command to set the wireless channel configuration. + */ + +struct nrf_wifi_umac_cmd_set_channel { + struct nrf_wifi_umac_hdr umac_hdr; +#define NRF_WIFI_CMD_SET_CHANNEL_FREQ_PARAMS_VALID (1 << 0) + unsigned int valid_fields; + struct freq_params freq_params; +} __NRF_WIFI_PKD; + +struct nrf_wifi_event_send_beacon_hint { + struct nrf_wifi_umac_hdr umac_hdr; + struct nrf_wifi_event_channel channel_before; + struct nrf_wifi_event_channel channel_after; + +} __NRF_WIFI_PKD; +/** + * @brief This structure represents the event that is generated when the regulatory domain + * is modified or updated. It contains the new regulatory domain information. + * + */ +struct nrf_wifi_event_regulatory_change { + struct nrf_wifi_umac_hdr umac_hdr; + unsigned short nrf_wifi_flags; + signed int intr; + signed char regulatory_type; + unsigned char nrf_wifi_alpha2[2]; +} __NRF_WIFI_PKD; + + +struct nrf_wifi_cmd_get_ifindex { + struct nrf_wifi_umac_hdr umac_hdr; + signed char ifacename[IFACENAMSIZ]; +} __NRF_WIFI_PKD; + +#define TX_BUF_HEADROOM 52 + +/** + * @brief UMAC data interface commands and events. + * + */ +enum nrf_wifi_umac_data_commands { + /** Unused. */ + NRF_WIFI_CMD_MGMT_BUFF_CONFIG, + /** Transmit data packet @ref nrf_wifi_tx_buff */ + NRF_WIFI_CMD_TX_BUFF, + /** TX done event @ref nrf_wifi_tx_buff_done */ + NRF_WIFI_CMD_TX_BUFF_DONE, + /** RX packet event @ref nrf_wifi_rx_buff*/ + NRF_WIFI_CMD_RX_BUFF, + /** Event to indicate interface is operational + * @ref nrf_wifi_data_carrier_state + */ + NRF_WIFI_CMD_CARRIER_ON, + /** Event to indicate interface is non-operational + * @ref nrf_wifi_data_carrier_state + */ + NRF_WIFI_CMD_CARRIER_OFF, + /** Event to indicate softap client's power save mode + * If client is in power save mode, host should start buffering + * packets until it receives NRF_WIFI_CMD_PS_GET_FRAMES event. + */ + NRF_WIFI_CMD_PM_MODE, + /** Event to indicate to start sending buffered packets for + * softap client @ref nrf_wifi_sap_ps_get_frames. + */ + NRF_WIFI_CMD_PS_GET_FRAMES, +}; + +/** + * @brief Data interface Command and Event header. + * + */ +struct nrf_wifi_umac_head { + /** Command or Event id see &enum nrf_wifi_umac_data_commands */ + unsigned int cmd; + /** length */ + unsigned int len; + +} __NRF_WIFI_PKD; + +#define NRF_WIFI_TX_FLAGS_DSCP_TOS_MASK 0xFFFF +#define NRF_WIFI_TX_FLAGS_DSCP_TOS_SHIFT 0 +#define NRF_WIFI_TX_FLAGS_DSCP_TOS(x) (((x) << NRF_WIFI_TX_FLAGS_DSCP_TOS_SHIFT) & NRF_WIFI_TX_FLAGS_DSCP_TOS_MASK) + +enum nrf_wifi_tx_flags { + NRF_WIFI_TX_FLAG_TWT_EMERGENCY_TX = (1 << 31), + NRF_WIFI_TX_FLAG_CHKSUM_AVAILABLE = (1 << 30), +}; + +/** + * @brief Tx mac80211 header information. + * + */ +struct tx_mac_hdr_info { + /** Unused */ + signed int umac_fill_flags; + /** frame control */ + unsigned short fc; + /** source Mac header */ + unsigned char dest[6]; + /** destination Mac address */ + unsigned char src[6]; + /** Ethernet type */ + unsigned short etype; + /** Type of Service */ + unsigned int dscp_or_tos; + /** TX flags */ + unsigned int tx_flags; + /** more frames queued */ + unsigned char more_data; + /** End Of Service Period flag(applicable in U-APSD) */ + unsigned char eosp; +} __NRF_WIFI_PKD; + +/** + * @brief This structure provides the information of each packet in the tx command. + * + */ + +struct nrf_wifi_tx_buff_info { + /** Tx packet length */ + unsigned short pkt_length; + /** Tx packet address */ + unsigned int ddr_ptr; +} __NRF_WIFI_PKD; + +/** + * @brief This structure provides the parameters for the tx command. + * + */ +struct nrf_wifi_tx_buff { + /** Command header @ref nrf_wifi_umac_head */ + struct nrf_wifi_umac_head umac_head; + /** Interface id */ + unsigned char wdev_id; + /** Descriptor id */ + unsigned char tx_desc_num; + /** Common mac header for all packets in this command + * @ref tx_mac_hdr_info + */ + struct tx_mac_hdr_info mac_hdr_info; + /** HW checksum enable or disable bitmap */ + unsigned int csum_bitmap; + /** Pending buffer size at host to encode queue size + * in qos control field of mac header in TWT enable case + */ + unsigned int pending_buf_size; + /** Number of packets sending in this command */ + unsigned char num_tx_pkts; + /** Each packets information @ref nrf_wifi_tx_buff_info */ + struct nrf_wifi_tx_buff_info tx_buff_info[0]; +} __NRF_WIFI_PKD; + +#define NRF_WIFI_TX_STATUS_SUCCESS 0 +#define NRF_WIFI_TX_STATUS_FAILED 1 + +/** + * @brief This structure represents the Tx done event(NRF_WIFI_CMD_TX_BUFF_DONE). + * + */ +struct nrf_wifi_tx_buff_done { + /** Header @ref nrf_wifi_umac_head */ + struct nrf_wifi_umac_head umac_head; + /** Descriptor id */ + unsigned char tx_desc_num; + /** Number of packets in this Tx done event */ + unsigned char num_tx_status_code; + /** Frame sent time at Phy */ + unsigned char timestamp_t1[6]; + /** Frame ack received time at Phy */ + unsigned char timestamp_t4[6]; + /** Status of Tx packet. Maximum of MAX_TX_AGG_SIZE */ + unsigned char tx_status_code[0]; +} __NRF_WIFI_PKD; + +/** + * @brief This structure defines the type of received packet. + * + */ +enum nrf_wifi_rx_pkt_type { + /** The Rx packet is of type data */ + NRF_WIFI_RX_PKT_DATA, + /** RX packet is beacon or probe response */ + NRF_WIFI_RX_PKT_BCN_PRB_RSP, + /** Raw Rx packet */ + NRF_WIFI_RAW_RX_PKT +}; + +/** + * @brief This structure provides information about the parameters in the RX data event. + * + */ +struct nrf_wifi_rx_buff_info { + /** Descriptor id */ + unsigned short descriptor_id; + /** Rx packet length */ + unsigned short rx_pkt_len; + /** type PKT_TYPE_MPDU/PKT_TYPE_MSDU_WITH_MAC/PKT_TYPE_MSDU */ + unsigned char pkt_type; + /** Frame received time at Phy */ + unsigned char timestamp_t2[6]; + /** Ack sent time at Phy */ + unsigned char timestamp_t3[6]; +} __NRF_WIFI_PKD; + +/** + * @brief This structure represents RX data event(NRF_WIFI_CMD_RX_BUFF). + * + */ +struct nrf_wifi_rx_buff { + /** Header @ref nrf_wifi_umac_head */ + struct nrf_wifi_umac_head umac_head; + /** Rx packet type. see &enum nrf_wifi_rx_pkt_type */ + signed short rx_pkt_type; + /** Refer rpu_tput_mode */ + unsigned char rate_flags; + /** Rate: Legacy : 1, 2, 55, 6, 9, 11, 12, 18, 24, 36, 48, 54 + * 11N VHT HE : MCS index 0 to 7. + */ + unsigned char rate; + /** Interface id */ + unsigned char wdev_id; + /** Number of packets in this event */ + unsigned char rx_pkt_cnt; + /** Depricated */ + unsigned char reserved; + /** MAC header length. Same for all packets in this event */ + unsigned char mac_header_len; + /** Frequency on which this packet received */ + unsigned short frequency; + /** signal strength */ + signed short signal; + /** Information of each packet. @ref nrf_wifi_rx_buff_info */ + struct nrf_wifi_rx_buff_info rx_buff_info[0]; +} __NRF_WIFI_PKD; + +/** + * @brief This structure provides information about the carrier (interface) state. + * + */ +struct nrf_wifi_data_carrier_state { + /** Header @ref nrf_wifi_umac_head */ + struct nrf_wifi_umac_head umac_head; + /** Interface id */ + unsigned int wdev_id; + +} __NRF_WIFI_PKD; + +/** SoftAP client is in active mode */ +#define NRF_WIFI_CLIENT_ACTIVE 0 +/** SoftAP client is in power save mode */ +#define NRF_WIFI_CLIENT_PS_MODE 1 + +/** + * @brief This structure describes an event related to the power save state of the softap's client. + * When the client is in PS mode (NRF_WIFI_CLIENT_PS_MODE), the host should queue Tx packets. + * When the client is in wakeup mode (NRF_WIFI_CLIENT_ACTIVE), the host should send all + * buffered and upcoming Tx packets. + * + */ +struct nrf_wifi_sap_client_pwrsave { + /** Header @ref nrf_wifi_umac_head */ + struct nrf_wifi_umac_head umac_head; + /** Interface id */ + unsigned int wdev_id; + /** state NRF_WIFI_CLIENT_ACTIVE or NRF_WIFI_CLIENT_PS_MODE */ + unsigned char sta_ps_state; + /** STA MAC Address */ + unsigned char mac_addr[NRF_WIFI_ETH_ADDR_LEN]; + +} __NRF_WIFI_PKD; + +/** + * @brief This structure represents an event that instructs the host to transmit a specific + * number of frames that host queued when softap's client is in power save mode. + * This event is primarily used when Softap's client operates in legacy power save mode. + * In this scenario, the access point (AP) is required to send a single packet for every PS POLL + * frame it receives from the client. Additionally, this mechanism will also be utilized in + * UAPSD power save. + * + */ +struct nrf_wifi_sap_ps_get_frames { + /** Header @ref nrf_wifi_umac_head */ + struct nrf_wifi_umac_head umac_head; + /** Interface id */ + unsigned int wdev_id; + /** STA MAC Address */ + unsigned char mac_addr[NRF_WIFI_ETH_ADDR_LEN]; + /** Number of frames to be transmitted in this service period */ + signed char num_frames; + +} __NRF_WIFI_PKD; + +#endif /* __HOST_RPU_UMAC_IF_H */