1 /* 2 * Copyright (c) 2024 Nordic Semiconductor ASA 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 /** @file 8 * 9 * @addtogroup nrf_wifi_api_common FMAC API common 10 * @{ 11 * 12 * @brief Header containing API declarations for the 13 * FMAC IF Layer of the Wi-Fi driver. 14 */ 15 #ifndef __FMAC_API_COMMON_H__ 16 #define __FMAC_API_COMMON_H__ 17 18 #include "osal_api.h" 19 #include "common/hal_api_common.h" 20 #include "host_rpu_sys_if.h" 21 #include "fmac_cmd_common.h" 22 #include "fmac_structs_common.h" 23 24 #include <patch_info.h> 25 26 #define MIN(a, b) (((a) < (b)) ? (a) : (b)) 27 28 /** 29 * @brief De-initialize the UMAC IF layer. 30 * @param fpriv Pointer to the context of the UMAC IF layer. 31 * 32 * This function de-initialize the UMAC IF layer of the RPU WLAN FullMAC 33 * driver. It does the following: 34 * - De-initializes the HAL layer. 35 * - Frees the context for the UMAC IF layer. 36 */ 37 void nrf_wifi_fmac_deinit(struct nrf_wifi_fmac_priv *fpriv); 38 39 40 /** 41 * @brief Removes a RPU instance. 42 * @param fmac_dev_ctx Pointer to the context of the RPU instance to be removed. 43 * 44 * This is a wrapper function which frees the memory for 45 * an RPU instance at the UMAC layer. 46 */ 47 void nrf_wifi_fmac_dev_rem(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx); 48 49 50 /** 51 * @brief Validate the firmware header. 52 * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device. 53 * @param info Pointer to the address where the firmware information needs to be copied. 54 * @return Command execution status 55 */ 56 enum nrf_wifi_status nrf_wifi_validate_fw_header(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx, 57 struct nrf70_fw_image_info *info); 58 59 /** 60 * @brief Parse the Firmware(s) to be loaded to the RPU WLAN device. 61 * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device, 62 * which was passed as \p fmac_dev_ctx parameter via the 63 * \p add_dev_callbk_fn() callback function. 64 * @param fw_data Pointer to the address where the firmware data is available. 65 * @param fw_size Size of the firmware data. 66 * @param fw_info Pointer to the address where the firmware information needs to be copied. 67 * @return Command execution status 68 */ 69 enum nrf_wifi_status nrf_wifi_fmac_fw_parse(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx, 70 const void *fw_data, 71 unsigned int fw_size, 72 struct nrf_wifi_fmac_fw_info *fw_info); 73 74 75 /** 76 * @brief Reset the processors in the RPU WLAN device. 77 * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device, 78 * which was passed as \p fmac_dev_ctx parameter via the 79 * \p add_dev_callbk_fn() callback function. 80 * 81 * This function resets the processors in the RPU WLAN device. 82 * 83 * @return Command execution status 84 */ 85 enum nrf_wifi_status nrf_wifi_fmac_fw_reset(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx); 86 87 /** 88 * @brief Boot the Firmware(s) to the RPU WLAN device. 89 * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device, 90 * which was passed as \p fmac_dev_ctx parameter via the 91 * \p add_dev_callbk_fn() callback function. 92 * 93 * This function boots the FullMAC firmware(s) to the RPU WLAN device and waits 94 * for the boot to complete and validate the boot signature. 95 * 96 * @return Command execution status 97 */ 98 enum nrf_wifi_status nrf_wifi_fmac_fw_boot(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx); 99 100 /** 101 * @brief Load a chunk of the Firmware to the RPU WLAN device. 102 * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device, 103 * which was passed as \p fmac_dev_ctx parameter via the 104 * \p add_dev_callbk_fn() callback function. 105 * @param rpu_proc RPU processor type. 106 * @param fw_chunk Pointer to the address where the firmware chunk information is available. 107 * 108 * This function loads a chunk of the firmware to the RPU WLAN device. 109 * 110 * @return Command execution status 111 */ 112 enum nrf_wifi_status nrf_wifi_fmac_fw_chunk_load(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx, 113 enum RPU_PROC_TYPE rpu_proc, 114 struct nrf_wifi_fmac_fw_chunk_info *fw_chunk); 115 116 /** 117 * @brief Loads the Firmware(s) to the RPU WLAN device. 118 * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device, 119 * which was passed as \p fmac_dev_ctx parameter via the 120 * \p add_dev_callbk_fn() callback function. 121 * @param fmac_fw Information about the FullMAC firmware(s) to be loaded. 122 * 123 * This function loads the FullMAC firmware(s) to the RPU WLAN device. 124 * 125 * @return Command execution status 126 */ 127 enum nrf_wifi_status nrf_wifi_fmac_fw_load(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx, 128 struct nrf_wifi_fmac_fw_info *fmac_fw); 129 130 131 /** 132 * @brief Get FW versions from the RPU. 133 * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device. 134 * @param fw_ver Pointer to the address where the FW versions needs to be copied. 135 * 136 * This function is used to get Firmware versions from the RPU. 137 * 138 * @return Command execution status 139 */ 140 enum nrf_wifi_status nrf_wifi_fmac_ver_get(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx, 141 unsigned int *fw_ver); 142 143 /** 144 * @brief Configure HE LTF and GI parameters. 145 * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device. 146 * @param he_ltf HE LTF parameter which will be configured in RPU. 147 * @param he_gi HE GI parameter which will be configured in RPU. 148 * @param enabled enable/disable HE LTF and GI parameter configured. 149 * 150 * This function is used to send a command to RPU 151 * to configure HE LTF and GI parameters in RPU. 152 * 153 * @return Command execution status 154 */ 155 enum nrf_wifi_status nrf_wifi_fmac_conf_ltf_gi(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx, 156 unsigned char he_ltf, 157 unsigned char he_gi, 158 unsigned char enabled); 159 160 161 /** 162 * @brief Configure SR coexistence parameters in RPU. 163 * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device. 164 * @param cmd SR coexistence parameters which will be configured in RPU. 165 * @param cmd_len Command length. 166 * 167 * This function is used to send a command to RPU to configure 168 * SR coexistence parameters in RPU. 169 * 170 * @return Command execution status 171 */ 172 enum nrf_wifi_status nrf_wifi_fmac_conf_srcoex(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx, 173 void *cmd, unsigned int cmd_len); 174 175 176 /** 177 * @brief Set the Multicast filter address. 178 * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device. 179 * @param if_idx Index of the interface whose state needs to be changed. 180 * @param mcast_info Multicast information to be set. 181 * 182 * This function is used to send a command (%NRF_WIFI_UMAC_CMD_MCAST_FILTER) to 183 * instruct the firmware to set the multicast filter address to an interface 184 * with index \p if_idx and parameters specified by \p mcast_info. 185 * 186 * @return Command execution status 187 */ 188 enum nrf_wifi_status nrf_wifi_sys_fmac_set_mcast_addr(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx, 189 unsigned char if_idx, 190 struct nrf_wifi_umac_mcast_cfg *mcast_info); 191 192 193 /** 194 * @brief Fetch MAC address from OTP. 195 * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device. 196 * @param vif_idx Interface index for which the MAC address is to be fetched. 197 * @param mac_addr Pointer to the address where the MAC address needs to be copied. 198 * 199 * This function is used to fetch MAC address from the OTP. 200 * 201 * @return Command execution status 202 */ 203 enum nrf_wifi_status nrf_wifi_fmac_otp_mac_addr_get(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx, 204 unsigned char vif_idx, 205 unsigned char *mac_addr); 206 207 208 /** 209 * @brief Set regulatory domain in RPU. 210 * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device. 211 * @param reg_info Pointer to the address where the regulatory domain information. 212 * needs to be copied. 213 * This function is used to set regulatory domain in the RPU. 214 * 215 * @return Command execution status 216 */ 217 enum nrf_wifi_status nrf_wifi_fmac_set_reg(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx, 218 struct nrf_wifi_fmac_reg_info *reg_info); 219 220 /** 221 * @brief Get regulatory domain from RPU. 222 * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device. 223 * @param reg_info Pointer to the address where the regulatory domain information. 224 * needs to be copied. 225 * This function is used to get regulatory domain from the RPU. 226 * 227 * @return Command execution status 228 */ 229 enum nrf_wifi_status nrf_wifi_fmac_get_reg(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx, 230 struct nrf_wifi_fmac_reg_info *reg_info); 231 232 /** 233 * @brief Get the current power save information. 234 * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device. 235 * @param if_idx Index of the interface on which power management is to be set. 236 * 237 * This function is used to send a command 238 * to RPU to Enable/Disable WLAN Power management. 239 * 240 * @return Command execution status 241 */ 242 enum nrf_wifi_status nrf_wifi_sys_fmac_get_power_save_info(void *fmac_dev_ctx, 243 unsigned char if_idx); 244 245 /** 246 * @brief Issue a request to reset stats of the RPU. 247 * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device. 248 * 249 * This function is used to send a command to 250 * instruct the firmware to reset current RPU statistics. 251 * 252 * @return Command execution status 253 */ 254 enum nrf_wifi_status nrf_wifi_fmac_stats_reset(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx); 255 256 /** 257 * @} 258 */ 259 #endif /* __FMAC_API_COMMON_H__ */ 260