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_fmac_off_raw_tx_api FMAC offloaded raw tx API 10 * @{ 11 * 12 * @brief Header containing API declarations for FMAC IF Layer of the Wi-Fi driver. 13 */ 14 15 #ifndef __FMAC_API_H__ 16 #define __FMAC_API_H__ 17 18 #include "host_rpu_sys_if.h" 19 #include "common/fmac_api_common.h" 20 #include "offload_raw_tx/fmac_structs.h" 21 #include "util.h" 22 23 24 /** 25 * @brief Initialize the UMAC IF layer. 26 * 27 * This function initializes the UMAC IF layer of the RPU WLAN FullMAC driver. 28 * It does the following: 29 * - Creates and initializes the context for the UMAC IF layer. 30 * - Initialize the OS abstraction Layer 31 * - Initialize the HAL layer. 32 * - Registers the driver to the underlying Operating System. 33 * 34 * @return Pointer to the context of the UMAC IF layer. 35 */ 36 struct nrf_wifi_fmac_priv *nrf_wifi_off_raw_tx_fmac_init(void); 37 38 /** 39 * @brief Adds a RPU instance. 40 * @param fpriv Pointer to the context of the UMAC IF layer. 41 * @param os_dev_ctx Pointer to the OS specific context of the RPU instance. 42 * 43 * This function adds an RPU instance. This function will return the 44 * pointer to the context of the RPU instance. This pointer will need to be 45 * supplied while invoking further device specific APIs, 46 * for example, nrf_wifi_sys_fmac_scan() etc. 47 * 48 * @return Pointer to the context of the RPU instance. 49 */ 50 struct nrf_wifi_fmac_dev_ctx *nrf_wifi_off_raw_tx_fmac_dev_add(struct nrf_wifi_fmac_priv *fpriv, 51 void *os_dev_ctx); 52 53 54 /** 55 * @brief Initialize a RPU instance. 56 * @param fmac_dev_ctx Pointer to the context of the RPU instance to be removed. 57 * @param sleep_type Type of RPU sleep. 58 * @param phy_calib PHY calibration flags to be passed to the RPU. 59 * @param op_band Operating band of the RPU. 60 * @param beamforming Enable/disable Wi-Fi beamforming. 61 * @param tx_pwr_ctrl TX power control parameters to be passed to the RPU. 62 * @param tx_pwr_ceil_params TX power ceiling parameters to be passed to the RPU. 63 * @param board_params Board parameters to be passed to the RPU. 64 * @param country_code Country code to be set for regularity domain. 65 * 66 * This function initializes the firmware of an RPU instance. 67 * 68 * @retval NRF_WIFI_STATUS_SUCCESS On Success 69 * @retval NRF_WIFI_STATUS_FAIL On failure to execute command 70 */ 71 enum nrf_wifi_status nrf_wifi_off_raw_tx_fmac_dev_init( 72 struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx, 73 #if defined(NRF_WIFI_LOW_POWER) || defined(__DOXYGEN__) 74 int sleep_type, 75 #endif /* NRF_WIFI_LOW_POWER */ 76 unsigned int phy_calib, 77 enum op_band op_band, 78 bool beamforming, 79 struct nrf_wifi_tx_pwr_ctrl_params *tx_pwr_ctrl, 80 struct nrf_wifi_tx_pwr_ceil_params *tx_pwr_ceil_params, 81 struct nrf_wifi_board_params *board_params, 82 unsigned char *country_code); 83 84 /** 85 * @brief Configure the offloaded raw TX parameters. 86 * @param fmac_dev_ctx Pointer to the context of the RPU instance to be removed. 87 * @param off_ctrl_params Offloaded raw tx control information. 88 * @param off_tx_params Offloaded raw tx parameters. 89 * 90 * This function configures offloaded raw TX. 91 * 92 * @retval NRF_WIFI_STATUS_SUCCESS On Success 93 * @retval NRF_WIFI_STATUS_FAIL On failure to execute command 94 */ 95 enum nrf_wifi_status nrf_wifi_off_raw_tx_fmac_conf(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx, 96 struct nrf_wifi_offload_ctrl_params *off_ctrl_params, 97 struct nrf_wifi_offload_tx_ctrl *off_tx_params); 98 99 /** 100 * @brief Start the offloaded raw TX. 101 * @param fmac_dev_ctx Pointer to the context of the RPU instance. 102 * 103 * This function starts offloaded raw TX. 104 * 105 * @retval NRF_WIFI_STATUS_SUCCESS On Success 106 * @retval NRF_WIFI_STATUS_FAIL On failure to execute command 107 */ 108 enum nrf_wifi_status nrf_wifi_off_raw_tx_fmac_start(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx); 109 110 /** 111 * @brief Stop the offloaded raw TX. 112 * @param fmac_dev_ctx Pointer to the context of the RPU instance to be removed. 113 * 114 * This function stops offloaded raw TX. 115 * 116 * @retval NRF_WIFI_STATUS_SUCCESS On Success 117 * @retval NRF_WIFI_STATUS_FAIL On failure to execute command 118 */ 119 enum nrf_wifi_status nrf_wifi_off_raw_tx_fmac_stop(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx); 120 121 /** 122 * @brief Get the RF parameters to be programmed to the RPU. 123 * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device. 124 * @param rf_params Pointer to the address where the RF params information needs to be copied. 125 * 126 * This function is used to fetch RF parameters information from the RPU and 127 * update the default RF parameter with the OTP values. The updated RF 128 * parameters are then returned in the \p f_params. 129 * 130 * @return Command execution status 131 */ 132 enum nrf_wifi_status nrf_wifi_off_raw_tx_fmac_rf_params_get( 133 struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx, 134 struct nrf_wifi_phy_rf_params *rf_params); 135 136 /** 137 * @brief Issue a request to get stats from the RPU. 138 * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device. 139 * @param op_mode RPU operation mode. 140 * @param stats Pointer to memory where the stats are to be copied. 141 * 142 * This function is used to send a command to 143 * instruct the firmware to return the current RPU statistics. The RPU will 144 * send the event with the current statistics. 145 * 146 * @return Command execution status 147 */ 148 enum nrf_wifi_status nrf_wifi_off_raw_tx_fmac_stats_get(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx, 149 enum rpu_op_mode op_mode, 150 struct rpu_off_raw_tx_op_stats *stats); 151 152 /** 153 * @} 154 */ 155 #endif /* __FMAC_API_H__ */ 156