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 FMAC API
10  * @{
11  *
12  * @brief Header containing API declarations for the
13  * FMAC IF Layer of the Wi-Fi driver.
14  */
15 
16 #ifndef __FMAC_API_H__
17 #define __FMAC_API_H__
18 
19 #include "osal_api.h"
20 #include "host_rpu_umac_if.h"
21 #include "host_rpu_data_if.h"
22 #include "host_rpu_sys_if.h"
23 
24 #include "system/fmac_structs.h"
25 #include "system/fmac_cmd.h"
26 #include "system/fmac_event.h"
27 #include "system/fmac_vif.h"
28 #include "system/fmac_bb.h"
29 #include "common/fmac_api_common.h"
30 
31 
32 
33 /**
34  * @brief Initialize the UMAC IF layer in the system mode of operation.
35  *
36  * @param data_config Pointer to configuration of data queues.
37  * @param rx_buf_pools Pointer to configuration of Rx queue buffers.
38  *		       See rx_buf_pool_params
39  * @param callbk_fns Pointer to callback functions for addressing events
40  *                   from the UMAC layer. e.g. callback function to process
41  *                   packet received from RPU firmware, scan result etc
42  *
43  * This function initializes the UMAC IF layer. It does the following:
44  *	    - Creates and initializes the context for the UMAC IF layer.
45  *	    - Initializes the HAL layer.
46  *	    - Initializes the OS abstraction Layer.
47  *	    - Initializes TX queue token sizes.
48  *	    - Initializes the RX buffer pool.
49  *
50  * @return Pointer to the context of the UMAC IF layer.
51  */
52 struct nrf_wifi_fmac_priv *nrf_wifi_sys_fmac_init(struct nrf_wifi_data_config_params *data_config,
53 						  struct rx_buf_pool_params *rx_buf_pools,
54 						  struct nrf_wifi_fmac_callbk_fns *callbk_fns);
55 
56 /**
57  * @brief Issue a scan request to the RPU firmware.
58  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
59  * @param if_idx Index of the interface on which the scan is to be performed.
60  * @param scan_info The parameters needed by the RPU for scan operation.
61  *
62  * This function is used to send a command to:
63  *	    Instruct the RPU firmware to trigger a scan. The scan can be performed in two
64  *	    modes:
65  *
66  *	    Auto Mode (%AUTO_SCAN):
67  *             In this mode, the host does not need to specify any scan specific
68  *          parameters. The RPU firmware will perform the scan on all the channels
69  *          permitted by and abiding by the regulations imposed by the
70  *          WORLD (common denominator of all regulatory domains) regulatory domain.
71  *          The scan will be performed using the wildcard SSID.
72  *
73  *	    Channel Map Mode (%CHANNEL_MAPPING_SCAN):
74  *             In this mode the host can have fine grained control over the scan
75  *          specific parameters to be used (for example, Passive/Active scan selection,
76  *          Number of probe requests per active scan, Channel list to scan,
77  *          Permanence on each channel, SSIDs to scan etc.). This mode expects
78  *          the regulatory restrictions to be taken care by the invoker of the
79  *          API.
80  *
81  *@retval	NRF_WIFI_STATUS_SUCCESS On success
82  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
83  */
84 enum nrf_wifi_status nrf_wifi_sys_fmac_scan(void *fmac_dev_ctx,
85 					unsigned char if_idx,
86 					struct nrf_wifi_umac_scan_info *scan_info);
87 
88 
89 /**
90  * @brief Issue a scan results request to the RPU firmware.
91  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
92  * @param if_idx Index of the interface on which the scan results are to be fetched.
93  * @param scan_type The scan type (i.e. DISPLAY or CONNECT scan).
94  *
95  * This function is used to send a command to:
96  *	- Instruct the RPU firmware to return the results of a scan.
97  *	- scan_type defines if the scan is performed for a
98  *	  connection request (SCAN_CONNECT) or to display the
99  *	  scan results to user (SCAN_DISPLAY)
100  *
101  *@retval	NRF_WIFI_STATUS_SUCCESS On success
102  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
103  */
104 enum nrf_wifi_status nrf_wifi_sys_fmac_scan_res_get(void *fmac_dev_ctx,
105 						unsigned char if_idx,
106 						int scan_type);
107 
108 /**
109  * @brief Issue abort of an ongoing scan to the RPU firmware.
110  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
111  * @param if_idx Index of the interface on which the ongoing scan is to be aborted.
112  *
113  * This function is used to send a command to:
114  *	- Instruct the RPU firmware to abort an ongoing scan request
115  *	- The \p if_idx provides the interface index on which the ongoing scan is
116  *	  to be aborted
117  *
118  *@retval	NRF_WIFI_STATUS_SUCCESS On success
119  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
120  */
121 enum nrf_wifi_status nrf_wifi_sys_fmac_abort_scan(void *fmac_dev_ctx,
122 						unsigned char if_idx);
123 
124 #if defined(NRF70_STA_MODE) || defined(__DOXYGEN__)
125 /**
126  * @brief Issue an 802.11 authentication request to the RPU firmware.
127  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
128  * @param if_idx Index of the interface on which the authentication is to be
129  *	         performed.
130  * @param auth_info The parameters needed by the RPU firmware to generate
131  *                  the authentication request.
132  *
133  * This function is used to send a command to:
134  *	    - Instruct the RPU firmware to initiate an authentication
135  *	      request to an AP on the interface identified with \p if_idx.
136  *
137  *@retval	NRF_WIFI_STATUS_SUCCESS On success
138  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
139  */
140 enum nrf_wifi_status nrf_wifi_sys_fmac_auth(void *fmac_dev_ctx,
141 					unsigned char if_idx,
142 					struct nrf_wifi_umac_auth_info *auth_info);
143 
144 
145 /**
146  * @brief Issue an 802.11 de-authentication request to the RPU firmware.
147  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
148  * @param if_idx Index of the interface on which the de-authentication is to be
149  *          performed.
150  * @param deauth_info De-authentication specific information required by the RPU firmware.
151  *
152  * This function is used to send a command to:
153  *	    - Instruct the RPU firmware to initiate a de-authentication notification to an AP
154  *	      on the interface identified with \p if_idx.
155  *
156  *@retval	NRF_WIFI_STATUS_SUCCESS On success
157  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
158  */
159 enum nrf_wifi_status nrf_wifi_sys_fmac_deauth(void *fmac_dev_ctx,
160 					  unsigned char if_idx,
161 					  struct nrf_wifi_umac_disconn_info *deauth_info);
162 
163 
164 /**
165  * @brief Issue an 802.11 association request to the RPU firmware.
166  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
167  * @param if_idx Index of the interface on which the association is to be
168  *           performed.
169  * @param assoc_info The parameters needed by the RPU firmware to generate the association
170  *           request.
171  *
172  * This function is used to send a command to:
173  *	    - Instruct the RPU firmware to initiate a association request to an AP on the
174  *	      interface identified with \p if_idx.
175  *
176  *@retval	NRF_WIFI_STATUS_SUCCESS On success
177  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
178  */
179 enum nrf_wifi_status nrf_wifi_sys_fmac_assoc(void *fmac_dev_ctx,
180 					 unsigned char if_idx,
181 					 struct nrf_wifi_umac_assoc_info *assoc_info);
182 
183 
184 /**
185  * @brief Issue an 802.11 disassociation request to the RPU firmware.
186  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
187  * @param if_idx Index of the interface on which the disassociation is to be
188  *	         performed.
189  * @param disassoc_info Disassociation specific information required by the RPU firmware.
190  *
191  * This function is used to send a command to:
192  *	    - Instruct the RPU firmware to initiate a disassociation notification to an AP
193  *	      on the interface identified with \p if_idx.
194  *
195  *@retval	NRF_WIFI_STATUS_SUCCESS On success
196  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
197  */
198 enum nrf_wifi_status nrf_wifi_sys_fmac_disassoc(void *fmac_dev_ctx,
199 					    unsigned char if_idx,
200 					    struct nrf_wifi_umac_disconn_info *disassoc_info);
201 
202 
203 /**
204  * @brief Add an 802.11 security key into the RPU security database.
205  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
206  * @param if_idx Index of the interface on which the key is to be added.
207  * @param key_info Key specific information which needs to be passed to the RPU firmware.
208  * @param mac_addr MAC address of the peer with which the key is associated.
209  *
210  * This function is used to send a command to:
211  *	    - Instruct the RPU firmware to add a key to its security database.
212  *	      The key is for the peer identified by \p mac_addr on the
213  *	      interface identified with \p if_idx.
214  *
215  *@retval	NRF_WIFI_STATUS_SUCCESS On success
216  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
217  */
218 enum nrf_wifi_status nrf_wifi_sys_fmac_add_key(void *fmac_dev_ctx,
219 					   unsigned char if_idx,
220 					   struct nrf_wifi_umac_key_info *key_info,
221 					   const char *mac_addr);
222 
223 
224 /**
225  * @brief Delete an 802.11 key from the RPU security database.
226  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
227  * @param if_idx Index of the interface for which the key is to be deleted.
228  * @param key_info Key specific information which needs to be passed to the RPU firmware.
229  * @param mac_addr MAC address of the peer with which the key is associated.
230  *
231  * This function is used to send a command to:
232  *	    - Instruct the RPU firmware to delete a key from its security database.
233  *	    - The key is for the peer identified by \p mac_addr on the
234  *	      interface identified with \p if_idx.
235  *
236  *@retval	NRF_WIFI_STATUS_SUCCESS On success
237  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
238  */
239 enum nrf_wifi_status nrf_wifi_sys_fmac_del_key(void *fmac_dev_ctx,
240 					   unsigned char if_idx,
241 					   struct nrf_wifi_umac_key_info *key_info,
242 					   const char *mac_addr);
243 
244 
245 /**
246  * @brief Set a key as a default for data or management
247  *	  traffic in the RPU security database.
248  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
249  * @param if_idx Index of the interface on which the key is to be set.
250  * @param key_info Key specific information which needs to be passed to the RPU firmware.
251  *
252  * This function is used to send a command to:
253  *	    - Instruct the RPU firmware to set a key as a default key in its security database.
254  *	    - The key is either for data or management traffic and is classified based on
255  *	      the flags element set in \p key_info parameter.
256  *
257  *@retval	NRF_WIFI_STATUS_SUCCESS On success
258  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
259  */
260 enum nrf_wifi_status nrf_wifi_sys_fmac_set_key(void *fmac_dev_ctx,
261 					   unsigned char if_idx,
262 					   struct nrf_wifi_umac_key_info *key_info);
263 
264 
265 /**
266  * @brief Set BSS parameters for an AP mode interface in the RPU firmware.
267  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
268  * @param if_idx Index of the interface on which the BSS parameters are to be set.
269  * @param bss_info BSS specific parameters which need to be passed to the RPU firmware.
270  *
271  * This function is used to send a command to:
272  *	    - Instruct the RPU firmware to set the BSS parameter for an AP mode interface.
273  *
274  *@retval	NRF_WIFI_STATUS_SUCCESS On success
275  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
276  */
277 enum nrf_wifi_status nrf_wifi_sys_fmac_set_bss(void *fmac_dev_ctx,
278 					   unsigned char if_idx,
279 					   struct nrf_wifi_umac_bss_info *bss_info);
280 
281 
282 /**
283  * @brief Update the Beacon Template.
284  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
285  * @param if_idx Index of the interface on which the Beacon Template is to be updated.
286  * @param data Beacon Template which need to be passed to the RPU firmware.
287  *
288  * This function is used to send a command to:
289  *	    - Instruct the RPU firmware to update beacon template for an AP mode interface.
290  *
291  *@retval	NRF_WIFI_STATUS_SUCCESS On success
292  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
293  */
294 enum nrf_wifi_status nrf_wifi_sys_fmac_chg_bcn(void *fmac_dev_ctx,
295 					   unsigned char if_idx,
296 					   struct nrf_wifi_umac_set_beacon_info *data);
297 
298 /**
299  * @brief Start a SoftAP.
300  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
301  * @param if_idx Index of the interface on which the SoftAP is to be started.
302  * @param ap_info AP operation specific parameters which need to be passed to the RPU firmware.
303  *
304  * This function is used to send a command to:
305  *	    - Instruct the RPU firmware to start a SoftAP on an interface identified with
306  *	      \p if_idx.
307  *
308  *@retval	NRF_WIFI_STATUS_SUCCESS On success
309  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
310  */
311 enum nrf_wifi_status nrf_wifi_sys_fmac_start_ap(void *fmac_dev_ctx,
312 					    unsigned char if_idx,
313 					    struct nrf_wifi_umac_start_ap_info *ap_info);
314 
315 
316 /**
317  * @brief Stop a SoftAP.
318  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
319  * @param if_idx Index of the interface on which the SoftAP is to be stopped.
320  *
321  * This function is used to send a command to:
322  *	    - Instruct the RPU firmware to stop a SoftAP on an interface identified with
323  *	      \p if_idx.
324  *
325  *@retval	NRF_WIFI_STATUS_SUCCESS On success
326  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
327  */
328 enum nrf_wifi_status nrf_wifi_sys_fmac_stop_ap(void *fmac_dev_ctx,
329 					   unsigned char if_idx);
330 
331 
332 /**
333  * @brief Start P2P mode on an interface.
334  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
335  * @param if_idx Index of the interface on which the P2P mode is to be started.
336  *
337  * This function is used to send a command to:
338  *	    - Instruct the RPU firmware to start P2P mode on an interface identified with
339  *            \p if_idx.
340  *
341  *@retval	NRF_WIFI_STATUS_SUCCESS On success
342  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
343  */
344 enum nrf_wifi_status nrf_wifi_sys_fmac_p2p_dev_start(void *fmac_dev_ctx,
345 						 unsigned char if_idx);
346 
347 
348 /**
349  * @brief Start P2P mode on an interface.
350  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
351  * @param if_idx Index of the interface on which the P2P mode is to be started.
352  *
353  * This function is used to send a command to:
354  *	    - Instruct the RPU firmware to start P2P mode on an interface identified with
355  *	     \p if_idx.
356  *
357  *@retval	NRF_WIFI_STATUS_SUCCESS On success
358  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
359  */
360 enum nrf_wifi_status nrf_wifi_sys_fmac_p2p_dev_stop(void *fmac_dev_ctx,
361 						unsigned char if_idx);
362 
363 /**
364  * @brief Start p2p remain on channel.
365  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
366  * @param if_idx Index of the interface to be kept on channel and stay there.
367  * @param roc_info Contains channel and time in ms to stay on.
368  *
369  * This function is used to send a command to:
370  *	    - Instruct the RPU firmware to put p2p device in
371  *	      listen state for a duration.
372  *
373  *@retval	NRF_WIFI_STATUS_SUCCESS On success
374  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
375  */
376 enum nrf_wifi_status nrf_wifi_sys_fmac_p2p_roc_start(void *fmac_dev_ctx,
377 						 unsigned char if_idx,
378 						 struct remain_on_channel_info *roc_info);
379 
380 /**
381  * @brief Stop p2p remain on channel.
382  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
383  * @param if_idx Index of the interface to be kept on channel and stay there.
384  * @param cookie cancel p2p listen state of the matching cookie.
385  *
386  * This function is used to send a command to:
387  *          - Instruct the RPU firmware to put p2p device out
388  *	      of listen state.
389  *
390  *@retval	NRF_WIFI_STATUS_SUCCESS On success
391  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
392  */
393 enum nrf_wifi_status nrf_wifi_sys_fmac_p2p_roc_stop(void *fmac_dev_ctx,
394 						unsigned char if_idx,
395 						unsigned long long cookie);
396 
397 /**
398  * @brief Transmit a management frame.
399  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
400  * @param if_idx Index of the interface on which the frame is to be
401  *               transmitted.
402  * @param mgmt_tx_info Information regarding the management frame to be
403  *                     transmitted.
404  *
405  * This function is used to send a command to:
406  *          - Instruct the RPU firmware to transmit a management frame.
407  *
408  *@retval	NRF_WIFI_STATUS_SUCCESS On success
409  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
410  */
411 enum nrf_wifi_status nrf_wifi_sys_fmac_mgmt_tx(void *fmac_dev_ctx,
412 					   unsigned char if_idx,
413 					   struct nrf_wifi_umac_mgmt_tx_info *mgmt_tx_info);
414 
415 
416 /**
417  * @brief Remove a station.
418  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
419  * @param if_idx Index of the interface on which the STA is connected.
420  * @param del_sta_info Information regarding the station to be removed.
421  *
422  * This function is used to send a command to:
423  *          - Instruct the RPU firmware to remove a station entry and send a
424  *	      de-authentication/disassociation frame to the station.
425  *
426  *@retval	NRF_WIFI_STATUS_SUCCESS On success
427  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
428  */
429 enum nrf_wifi_status nrf_wifi_sys_fmac_del_sta(void *fmac_dev_ctx,
430 					   unsigned char if_idx,
431 					   struct nrf_wifi_umac_del_sta_info *del_sta_info);
432 
433 
434 /**
435  * @brief Indicate a new STA connection to the RPU firmware.
436  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
437  * @param if_idx Index of the interface on which the STA is connected.
438  * @param add_sta_info Information regarding the new station.
439  *
440  * This function is used to indicate to the RPU firmware that a new STA has
441  *	    successfully connected to the AP.
442  *
443  *@retval	NRF_WIFI_STATUS_SUCCESS On success
444  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
445  */
446 enum nrf_wifi_status nrf_wifi_sys_fmac_add_sta(void *fmac_dev_ctx,
447 					   unsigned char if_idx,
448 					   struct nrf_wifi_umac_add_sta_info *add_sta_info);
449 
450 /**
451  * @brief Indicate changes to STA connection parameters to the RPU firmware.
452  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
453  * @param if_idx Index of the interface on which the STA is connected.
454  * @param chg_sta_info Information regarding updates to the station parameters.
455  *
456  * This function is used to indicate changes in the connected STA parameters
457  *	    to the RPU firmware.
458  *
459  *@retval	NRF_WIFI_STATUS_SUCCESS On success
460  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
461  */
462 enum nrf_wifi_status nrf_wifi_sys_fmac_chg_sta(void *fmac_dev_ctx,
463 					   unsigned char if_idx,
464 					   struct nrf_wifi_umac_chg_sta_info *chg_sta_info);
465 
466 
467 
468 /**
469  * @brief Register the mgmt frame type which needs to be sent up to the host by the RPU firmware.
470  *
471  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
472  * @param if_idx Index of the interface from which the received frame is to be
473  *               sent up.
474  * @param frame_info Information regarding the management frame to be sent up.
475  *
476  * This function is used to send a command to:
477  *	    - Instruct the RPU firmware to pass frames matching that type/subtype to be
478  *	    passed upto the host driver.
479  *
480  *@retval	NRF_WIFI_STATUS_SUCCESS On success
481  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
482  */
483 enum nrf_wifi_status nrf_wifi_sys_fmac_mgmt_frame_reg(void *fmac_dev_ctx,
484 						  unsigned char if_idx,
485 						  struct nrf_wifi_umac_mgmt_frame_info *frame_info);
486 
487 #endif /* NRF70_STA_MODE */
488 /**
489  * @brief Get unused MAC address from base mac address.
490  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
491  * @param addr Memory to copy the mac address to.
492  *
493  *@retval	NRF_WIFI_STATUS_SUCCESS On success
494  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
495  */
496 enum nrf_wifi_status nrf_wifi_sys_fmac_mac_addr(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx,
497 					    unsigned char *addr);
498 
499 
500 /**
501  * @brief Add a new virtual interface.
502  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
503  * @param os_vif_ctx Pointer to VIF context that the UMAC IF passes
504  *                   up the stack during invocation of callback functions like
505  *                   rx_frm_callbk_fn() etc.
506  * @param vif_info Information regarding the interface to be added.
507  *
508  * This function is used to send a command to:
509  *	    - Instruct the RPU firmware to add a new interface with parameters specified by
510  *             \p vif_info.
511  *
512  * @return Index (maintained by the UMAC IF layer) of the VIF that was added.
513  *         In case of error MAX_NUM_VIFS will be returned.
514  */
515 unsigned char nrf_wifi_sys_fmac_add_vif(void *fmac_dev_ctx,
516 				    void *os_vif_ctx,
517 				    struct nrf_wifi_umac_add_vif_info *vif_info);
518 
519 
520 /**
521  * @brief Deletes a virtual interface.
522  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
523  * @param if_idx Index of the interface to be deleted.
524  *
525  * This function is used to send a command to:
526  *     - Instruct the RPU firmware to delete an interface which was added using
527  *       \p nrf_wifi_sys_fmac_add_vif.
528  *
529  *@retval	NRF_WIFI_STATUS_SUCCESS On success
530  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
531  */
532 enum nrf_wifi_status nrf_wifi_sys_fmac_del_vif(void *fmac_dev_ctx,
533 					   unsigned char if_idx);
534 
535 /**
536  * @brief Change the attributes of an interface.
537  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
538  * @param if_idx Index of the interface on which the functionality is to be
539  *               bound.
540  * @param vif_info Interface specific information which needs to be passed to the
541  *                 RPU firmware.
542  *
543  * This function is used to change the attributes of an interface identified
544  *     with \p if_idx.
545  *
546  *@retval	NRF_WIFI_STATUS_SUCCESS On success
547  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
548  */
549 enum nrf_wifi_status nrf_wifi_sys_fmac_chg_vif(void *fmac_dev_ctx,
550 					   unsigned char if_idx,
551 					   struct nrf_wifi_umac_chg_vif_attr_info *vif_info);
552 
553 
554 /**
555  * @brief Change the state of a virtual interface.
556  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
557  * @param if_idx Index of the interface whose state needs to be changed.
558  * @param vif_info State information to be changed for the interface.
559  *
560  * This function is used to send a command to:
561  *     - Instruct the RPU firmware to change the state of an interface identified by an index
562  *       \p if_idx and parameters specified by \p vif_info.
563  *     - The different states that can be configured are
564  *         - NRF_WIFI_FMAC_IF_OP_STATE_DOWN
565  *         - NRF_WIFI_FMAC_IF_OP_STATE_UP
566  *
567  *@retval	NRF_WIFI_STATUS_SUCCESS On success
568  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
569  */
570 enum nrf_wifi_status nrf_wifi_sys_fmac_chg_vif_state(void *fmac_dev_ctx,
571 						 unsigned char if_idx,
572 						 struct nrf_wifi_umac_chg_vif_state_info *vif_info);
573 
574 
575 /**
576  * @brief Set MAC address on interface.
577  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
578  * @param if_idx Index of the interface whose MAC address is to be changed.
579  * @param mac_addr MAC address to set.
580  *
581  * This function is used to set the MAC address of an interface identified
582  *	    with \p if_idx.
583  *
584  *@retval	NRF_WIFI_STATUS_SUCCESS On success
585  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
586  */
587 enum nrf_wifi_status nrf_wifi_sys_fmac_set_vif_macaddr(void *fmac_dev_ctx,
588 						   unsigned char if_idx,
589 						   unsigned char *mac_addr);
590 
591 /**
592  * @brief Transmit a frame to the RPU.
593  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
594  * @param if_idx Index of the interface on which the frame is to be
595  *               transmitted.
596  * @param netbuf Pointer to the OS specific network buffer.
597  *
598  * This function takes care of transmitting a frame to the RPU firmware.
599  * It does the following:
600  *
601  *	- Queues the frames to a transmit queue.
602  *	- Based on token availability, sends one or more frames to the RPU using
603  *	  the command for transmission.
604  *	- The firmware sends an event once the command has
605  *	  been processed to indicate whether the frame(s) have been
606  *	  transmitted/aborted.
607  *	- The driver can cleanup the frame buffers after receiving this event.
608  *
609  *@retval	NRF_WIFI_STATUS_SUCCESS On success
610  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
611  */
612 enum nrf_wifi_status nrf_wifi_fmac_start_xmit(void *fmac_dev_ctx,
613 					      unsigned char if_idx,
614 					      void *netbuf);
615 
616 /**
617  * @brief Inform the RPU firmware that host is going to suspend state.
618  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
619  *
620  * This function is used to send a command to:
621  *	    - Inform the RPU firmware that host is going to suspend state.
622  *
623  *@retval	NRF_WIFI_STATUS_SUCCESS On success
624  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
625  */
626 enum nrf_wifi_status nrf_wifi_fmac_suspend(void *fmac_dev_ctx);
627 
628 
629 /**
630  * @brief Notify RPU firmware that host has resumed from a suspended state.
631  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
632  *
633  * This function is used to send a command to:
634  *	    - Inform the RPU firmware that host has resumed from a suspended state.
635  *
636  *@retval	NRF_WIFI_STATUS_SUCCESS On success
637  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
638  */
639 enum nrf_wifi_status nrf_wifi_fmac_resume(void *fmac_dev_ctx);
640 
641 
642 /**
643  * @brief Get tx power
644  *
645  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
646  * @param if_idx VIF index.
647  *
648  * This function is used to send a command to:
649  *	    - Get the transmit power on a particular interface given
650  *	      by \p if_idx.
651  *
652  *@retval	NRF_WIFI_STATUS_SUCCESS On success
653  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
654  */
655 enum nrf_wifi_status nrf_wifi_sys_fmac_get_tx_power(void *fmac_dev_ctx,
656 						unsigned int if_idx);
657 
658 /**
659  * @brief Get channel definition.
660  *
661  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
662  * @param if_idx VIF index.
663  *
664  * This function is used to send a command to:
665  *	    - Get the channel configured on a particular interface given by /p if_idx.
666  *
667  *@retval	NRF_WIFI_STATUS_SUCCESS On success
668  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
669  */
670 enum nrf_wifi_status nrf_wifi_sys_fmac_get_channel(void *fmac_dev_ctx,
671 					       unsigned int if_idx);
672 
673 /**
674  * @brief Get station statistics
675  *
676  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
677  * @param if_idx: VIF index.
678  * @param mac MAC address of the station.
679  *
680  * This function is used to send a command to:
681  *	    - Get station statistics using a MAC address.
682  *
683  *@retval	NRF_WIFI_STATUS_SUCCESS On success
684  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
685  */
686 enum nrf_wifi_status nrf_wifi_sys_fmac_get_station(void *fmac_dev_ctx,
687 					       unsigned int if_idx,
688 					       unsigned char *mac);
689 
690 
691 /* @brief Get interface statistics
692  *
693  * @param dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
694  * @param if_idx VIF index.
695  *
696  * This function is used to send a command to:
697  *	    - Get interface statistics using interface index \p if_idx.
698  *
699  *@retval	NRF_WIFI_STATUS_SUCCESS On success
700  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
701  */
702 enum nrf_wifi_status nrf_wifi_sys_fmac_get_interface(void *dev_ctx,
703 					       unsigned int if_idx);
704 
705 
706 /**
707  * @brief Configure WLAN power management.
708  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
709  * @param if_idx Index of the interface on which power management is to be set.
710  * @param state Enable/Disable of WLAN power management.
711  *
712  * This function is used to send a command to:
713  *	     - The RPU firmware to Enable/Disable WLAN Power management.
714  *
715  *@retval	NRF_WIFI_STATUS_SUCCESS On success
716  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
717  */
718 enum nrf_wifi_status nrf_wifi_sys_fmac_set_power_save(void *fmac_dev_ctx,
719 						  unsigned char if_idx,
720 						  bool state);
721 
722 /**
723  * @brief Configure WLAN U-APSD queue.
724  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
725  * @param if_idx Index of the interface on which power management is to be set.
726  * @param uapsd_queue Queue to be set for U-APSD.
727  *
728  * This function is used to send a command (%NRF_WIFI_UMAC_CMD_CONFIG_UAPSD) to:
729  *	    - The RPU firmware to set a U-APSD queue value.
730  *
731  *@retval	NRF_WIFI_STATUS_SUCCESS On success
732  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
733  */
734 enum nrf_wifi_status nrf_wifi_sys_fmac_set_uapsd_queue(void *fmac_dev_ctx,
735 						   unsigned char if_idx,
736 						   unsigned int uapsd_queue);
737 
738 /**
739  * @brief Configure Power save timeout.
740  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
741  * @param if_idx Index of the interface on which power management is to be set.
742  * @param ps_timeout Power save inactivity time.
743  *
744  * This function is used to send a command (%NRF_WIFI_UMAC_CMD_SET_POWER_SAVE_TIMEOUT) to:
745  *          - The RPU firmware to set power save inactivity time.
746  *
747  *@retval	NRF_WIFI_STATUS_SUCCESS On success
748  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
749  */
750 enum nrf_wifi_status nrf_wifi_sys_fmac_set_power_save_timeout(void *fmac_dev_ctx,
751 							  unsigned char if_idx,
752 							  int ps_timeout);
753 
754 /**
755  * @brief Configure qos_map of for data
756  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
757  * @param if_idx Index of the interface on which the qos map be set.
758  * @param qos_info qos_map information.
759  *
760  * This function is used to send a command to:
761  *	    - The RPU firmware to set QOS map information.
762  *
763  *@retval	NRF_WIFI_STATUS_SUCCESS On success
764  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
765  */
766 enum nrf_wifi_status nrf_wifi_sys_fmac_set_qos_map(void *fmac_dev_ctx,
767 					       unsigned char if_idx,
768 					       struct nrf_wifi_umac_qos_map_info *qos_info);
769 
770 /**
771  * @brief Configure WoWLAN.
772  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
773  * @param var Wakeup trigger condition.
774  *
775  * This function is used to send a command to the RPU firmware to:
776  *	    - Configure wakeup trigger condition in RPU.
777  *
778  *@retval	NRF_WIFI_STATUS_SUCCESS On success
779  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
780  */
781 enum nrf_wifi_status nrf_wifi_fmac_set_wowlan(void *fmac_dev_ctx,
782 					      unsigned int var);
783 
784 /**
785  * @brief Get PHY configuration.
786  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
787  * @param if_idx Index of the interface on which the CMD needs to be sent.
788  *
789  * This function is used to get PHY configuration from the RPU firmware.
790  *
791  *@retval	NRF_WIFI_STATUS_SUCCESS On success
792  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
793  */
794 enum nrf_wifi_status nrf_wifi_sys_fmac_get_wiphy(void *fmac_dev_ctx, unsigned char if_idx);
795 
796 /**
797  * @brief Register to get MGMT frames.
798  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
799  * @param if_idx Index of the interface on which the CMD needs to be sent.
800  * @param frame_info Information regarding the management frame.
801  *
802  * Register with the RPU firmware to receive specific MGMT frames from the RPU to the host side.
803  *
804  *@retval	NRF_WIFI_STATUS_SUCCESS On success
805  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
806  */
807 enum nrf_wifi_status nrf_wifi_sys_fmac_register_frame(void *fmac_dev_ctx, unsigned char if_idx,
808 						  struct nrf_wifi_umac_mgmt_frame_info *frame_info);
809 
810 /**
811  * @brief Set wiphy parameters
812  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
813  * @param if_idx Index of the interface on which the CMD needs to be sent.
814  * @param wiphy_info wiphy parameters
815  *
816  * This function is used to send a command to the RPU firmware to:
817  *	    - Configure parameters interface specific parameters on an interface identified
818  *	      by \p if_idx
819  *
820  *@retval	NRF_WIFI_STATUS_SUCCESS On success
821  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
822  */
823 
824 enum nrf_wifi_status nrf_wifi_sys_fmac_set_wiphy_params(void *fmac_dev_ctx,
825 						 unsigned char if_idx,
826 						 struct nrf_wifi_umac_set_wiphy_info *wiphy_info);
827 
828 /**
829  * @brief TWT setup command
830  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
831  * @param if_idx Index of the interface on which the TWT parameters be set.
832  * @param twt_info TWT parameters.
833  *
834  * This function is used to send a command to the RPU firmware to:
835  *	    - Configure TWT setup specific parameters.
836  *
837  *@retval	NRF_WIFI_STATUS_SUCCESS On success
838  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
839  */
840 enum nrf_wifi_status nrf_wifi_sys_fmac_twt_setup(void *fmac_dev_ctx,
841 					     unsigned char if_idx,
842 					     struct nrf_wifi_umac_config_twt_info *twt_info);
843 
844 /**
845  * @brief TWT teardown command
846  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
847  * @param if_idx Index of the interface on which the TWT parameters are to be set.
848  * @param twt_info TWT parameters.
849  *
850  * This function is used to send a command to the RPU firmware to:
851  *	    - Tear down an existing TWT session.
852  *
853  *@retval	NRF_WIFI_STATUS_SUCCESS On success
854  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
855  */
856 enum nrf_wifi_status nrf_wifi_sys_fmac_twt_teardown(void *fmac_dev_ctx,
857 						unsigned char if_idx,
858 						struct nrf_wifi_umac_config_twt_info *twt_info);
859 
860 /**
861  * @brief Get connection info from RPU
862  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
863  * @param if_idx Index of the interface.
864  *
865  * This function is used to send a command to the RPU firmware to:
866  *	    - Fetch connection information.
867  *
868  *@retval	NRF_WIFI_STATUS_SUCCESS On success
869  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
870  */
871 enum nrf_wifi_status nrf_wifi_sys_fmac_get_conn_info(void *fmac_dev_ctx,
872 						unsigned char if_idx);
873 
874 /**
875  * @brief Adds a RPU instance.
876  * @param fpriv Pointer to the context of the UMAC IF layer.
877  * @param os_dev_ctx Pointer to the OS specific context of the RPU instance.
878  *
879  * This function adds an RPU instance. This function will return the
880  *	    pointer to the context of the RPU instance. This pointer will need to be
881  *	    supplied while invoking further device specific APIs,
882  *	    for example, nrf_wifi_sys_fmac_scan() etc.
883  *
884  * @return Pointer to the context of the RPU instance.
885  */
886 struct nrf_wifi_fmac_dev_ctx *nrf_wifi_sys_fmac_dev_add(struct nrf_wifi_fmac_priv *fpriv,
887 							void *os_dev_ctx);
888 
889 
890 /**
891  * @brief Initialize an RPU instance.
892  * @param fmac_dev_ctx Pointer to the context of the RPU instance to be removed.
893  * @param sleep_type Type of RPU sleep.
894  * @param phy_calib PHY calibration flags to be passed to the RPU.
895  * @param op_band Operating band of the RPU.
896  * @param beamforming Enable/disable Wi-Fi beamforming.
897  * @param tx_pwr_ctrl_params TX power control parameters to be passed to the RPU.
898  * @param tx_pwr_ceil_params TX power ceil parameters for both frequency bands.
899  * @param board_params Board parameters to be passed to the RPU.
900  * @param country_code Country code to be set for regularity domain.
901  *
902  * This function initializes the firmware of an RPU instance. The following is addressed
903  *              - BAL layer device initialization
904  *              - HAL layer device initialization
905  *              - FW initialization and PHY calibration data is sent to PHY
906  *              - RX and TX buffers are initialized, tasklets assigned
907  *
908  * @retval	NRF_WIFI_STATUS_SUCCESS On success
909  * @retval	NRF_WIFI_STATUS_FAIL On failure to execute command
910  */
911 enum nrf_wifi_status nrf_wifi_sys_fmac_dev_init(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx,
912 #if defined(NRF_WIFI_LOW_POWER) || defined(__DOXYGEN__)
913 					    int sleep_type,
914 #endif /* NRF_WIFI_LOW_POWER */
915 					    unsigned int phy_calib,
916 					    enum op_band op_band,
917 					    bool beamforming,
918 					    struct nrf_wifi_tx_pwr_ctrl_params *tx_pwr_ctrl_params,
919 					    struct nrf_wifi_tx_pwr_ceil_params *tx_pwr_ceil_params,
920 					    struct nrf_wifi_board_params *board_params,
921 					    unsigned char *country_code);
922 
923 
924 /**
925  * @brief De-initialize a RPU instance.
926  * @param fmac_dev_ctx Pointer to the context of the RPU instance to be removed.
927  *
928  * This function de-initializes the firmware of an RPU instance.
929  *		- RPU UMAC deinitialization command is executed
930  *		- RX and TX is deallocated for firmware via UMAC command
931  */
932 void nrf_wifi_sys_fmac_dev_deinit(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx);
933 
934 /**
935  * @brief Configure WLAN listen interval.
936  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
937  * @param if_idx Index of the interface on which power management is to be set.
938  * @param listen_interval listen interval to be configured.
939  *
940  * This function is used to send a command to RPU to configure listen interval.
941  * Refer section 9.4.1.6 is 802.11-2020 standard for details on listen interval
942  *
943  *@retval	NRF_WIFI_STATUS_SUCCESS On success
944  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
945  */
946 enum nrf_wifi_status nrf_wifi_sys_fmac_set_listen_interval(void *fmac_dev_ctx,
947 							unsigned char if_idx,
948 							unsigned short listen_interval);
949 
950 /**
951  * @brief Configure WLAN PS wakeup mode to DTIM interval or listen interval.
952  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
953  * @param if_idx Index of the interface on which power management is to be set.
954  * @param ps_wakeup_mode Enable listen interval based ps(default is DTIM based)
955  *
956  * This function is used to configure PS wakeup mode,  PS wakeup mode can be
957  *         configured to:
958  *            - DTIM interval based PS mode
959  *            - Listen interval based PS mode
960  *         Default mode is set to DTIM interval based PS mode
961  *
962  *@retval	NRF_WIFI_STATUS_SUCCESS On success
963  *@retval	NRF_WIFI_STATUS_FAIL On failure to execute command
964  */
965 enum nrf_wifi_status nrf_wifi_sys_fmac_set_ps_wakeup_mode(void *fmac_dev_ctx,
966 							unsigned char if_idx,
967 							bool ps_wakeup_mode);
968 
969 /**
970  * @brief Configure power save exit strategy.
971  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
972  * @param if_idx Index of the interface on which power management is to be set.
973  * @param ps_exit_strategy PS exit strategy to be configured in RPU.
974  *
975  * This function is used to send a command to RPU
976  * to configure PS exit strategy in RPU.
977  *
978  * @return Command execution status
979  */
980 enum nrf_wifi_status nrf_wifi_sys_fmac_set_ps_exit_strategy(
981 						void *fmac_dev_ctx,
982 						unsigned char if_idx,
983 						unsigned int ps_exit_strategy);
984 
985 #ifdef NRF70_RAW_DATA_TX
986 /**
987  * @brief Transmit a raw unaltered frame to the RPU.
988  * @param dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
989  * @param if_idx Index of the interface on which the frame is to be
990  *               transmitted.
991  * @param net_packet Pointer to the OS specific network buffer.
992  *
993  * This function takes care of transmitting a frame to the RPU firmware.
994  * It does the following:
995  *
996  *     - Queues the frames to a transmit queue.
997  *     - Based on token availability, sends one or more frames to the RPU using
998  *       the command for transmission.
999  *     - The firmware sends an event once the command has
1000  *       been processed to indicate whether the frame has been
1001  *       transmitted/aborted.
1002  *     - The driver cleans up the frame buffer(s) after receiving this event.
1003  *
1004  *@retval      NRF_WIFI_STATUS_SUCCESS On success
1005  *@retval      NRF_WIFI_STATUS_FAIL On failure
1006  */
1007 enum nrf_wifi_status nrf_wifi_fmac_start_rawpkt_xmit(void *dev_ctx,
1008 						     unsigned char if_idx,
1009 						     void *net_packet);
1010 #endif /* NRF70_RAW_DATA_TX */
1011 
1012 /**
1013  * @brief Check if a valid mode is being set.
1014  * @param mode The mode value attempted to be configured.
1015  *
1016  * This function checks the mode value attempted to be configured
1017  * is a valid mode as supported by the driver. If the mode is valid,
1018  * the mode will be configured to the lower layers, else an error value
1019  * will be flagged.
1020  *
1021  *@retval      NRF_WIFI_STATUS_SUCCESS On success
1022  *@retval      NRF_WIFI_STATUS_FAIL On failure
1023  */
1024 enum nrf_wifi_status nrf_wifi_check_mode_validity(unsigned char mode);
1025 
1026 #if defined(NRF_WIFI_RPU_RECOVERY) || defined(__DOXYGEN__)
1027 /** @cond INTERNAL_HIDDEN */
1028 enum nrf_wifi_status nrf_wifi_sys_fmac_rpu_recovery_callback(void *mac_dev_ctx,
1029 						void *event_data,
1030 						unsigned int len);
1031 /** @endcond */
1032 #endif /* CONFIG_NRF_RPU_RECOVERY */
1033 
1034 /**
1035  * @brief Get the RF parameters to be programmed to the RPU.
1036  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
1037  * @param rf_params Pointer to the address where the RF params information needs to be copied.
1038  *
1039  * This function is used to fetch RF parameters information from the RPU and
1040  *	    update the default RF parameter with the OTP values. The updated RF
1041  *	    parameters are then returned in the \p f_params.
1042  *
1043  * @return Command execution status
1044  */
1045 enum nrf_wifi_status nrf_wifi_sys_fmac_rf_params_get(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx,
1046 						     struct nrf_wifi_phy_rf_params *rf_params);
1047 
1048 #ifdef NRF70_SYSTEM_WITH_RAW_MODES
1049 /**
1050  * @brief Set the current mode of operation
1051  * @param dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
1052  * @param if_idx Index of the interface on which mode is to be set.
1053  * @param mode Value to be set for the interface.
1054  *
1055  * This function is used to send a command
1056  *         to RPU to set mode of operation
1057  *
1058  * @retval      NRF_WIFI_STATUS_SUCCESS On success
1059  * @retval      NRF_WIFI_STATUS_FAIL On failure
1060  */
1061 enum nrf_wifi_status nrf_wifi_sys_fmac_set_mode(void *dev_ctx,
1062 						unsigned char if_idx,
1063 						unsigned char mode);
1064 #endif
1065 
1066 #if defined(NRF70_RAW_DATA_TX) || defined(NRF70_RAW_DATA_RX)
1067 /**
1068  * @brief Set the current channel
1069  * @param dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
1070  * @param if_idx Index of the interface on which mode is to be set.
1071  * @param channel Value to be set for the interface.
1072  *
1073  * This function is used to send a command
1074  *         to RPU to set current channel of operation
1075  *
1076  * @retval      NRF_WIFI_STATUS_SUCCESS On success
1077  * @retval      NRF_WIFI_STATUS_FAIL On failure
1078  */
1079 enum nrf_wifi_status nrf_wifi_sys_fmac_set_channel(void *dev_ctx,
1080 						   unsigned char if_idx,
1081 						   unsigned int channel);
1082 
1083 #endif /* NRF70_RAW_DATA_TX || NRF70_RAW_DATA_RX */
1084 
1085 #if defined(NRF70_RAW_DATA_RX) || defined(NRF70_PROMISC_DATA_RX)
1086 /**
1087  * @brief Set packet filter settings
1088  * @param dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
1089  * @param filter Value to be set for the interface.
1090  * @param if_idx Index of the interface on which mode is to be set.
1091  * @param buffer_size Size of packet capture length.
1092  *
1093  * This function is used to send a command
1094  *         to RPU to set filter setting for sniffer operation
1095  *
1096  * @return Command execution status
1097  */
1098 enum nrf_wifi_status nrf_wifi_sys_fmac_set_packet_filter(void *dev_ctx,
1099 							 unsigned char filter,
1100 							 unsigned char if_idx,
1101 							 unsigned short buffer_size);
1102 #endif /* NRF70_RAW_DATA_RX || NRF70_PROMISC_DATA_RX */
1103 
1104 #if defined(NRF70_UTIL) || defined(__DOXYGEN__)
1105 enum nrf_wifi_status nrf_wifi_sys_fmac_set_tx_rate(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx,
1106 						   unsigned char rate_flag,
1107 						   int data_rate);
1108 #if defined(NRF_WIFI_LOW_POWER) || defined(__DOXYGEN__)
1109 /**
1110  * @brief Get the RPU power save status from host perspective.
1111  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
1112  * @param rpu_ps_ctrl_state Pointer to the address where the current RPU power save state
1113  *			    from host perspective needs to be copied.
1114  *
1115  * This function is used to fetch the RPU power save status
1116  *	    from host perspective.
1117  *
1118  * @return Command execution status
1119  */
1120 enum nrf_wifi_status nrf_wifi_sys_fmac_get_host_rpu_ps_ctrl_state(void *fmac_dev_ctx,
1121 								  int *rpu_ps_ctrl_state);
1122 #endif /* NRF_WIFI_LOW_POWER */
1123 #endif /* NRF70_UTIL */
1124 
1125 /**
1126  * @brief Configure HE LTF and GI parameters.
1127  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
1128  * @param he_ltf HE LTF parameter which will be configured in RPU.
1129  * @param he_gi HE GI parameter which will be configured in RPU.
1130  * @param enabled enable/disable HE LTF and GI parameter configured.
1131  *
1132  * This function is used to send a command to RPU
1133  *	    to configure HE LTF and GI parameters in RPU.
1134  *
1135  * @return Command execution status
1136  */
1137 enum nrf_wifi_status nrf_wifi_sys_fmac_conf_ltf_gi(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx,
1138 						   unsigned char he_ltf,
1139 						   unsigned char he_gi,
1140 						   unsigned char enabled);
1141 
1142 
1143 /**
1144  * @brief Issue a request to get stats from the RPU.
1145  * @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
1146  * @param op_mode RPU operation mode.
1147  * @param stats Pointer to memory where the stats are to be copied.
1148  *
1149  * This function is used to send a command to
1150  *	    instruct the firmware to return the current RPU statistics. The RPU will
1151  *	    send the event with the current statistics.
1152  *
1153  * @return Command execution status
1154  */
1155 enum nrf_wifi_status nrf_wifi_sys_fmac_stats_get(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx,
1156 						 enum rpu_op_mode op_mode,
1157 						 struct rpu_sys_op_stats *stats);
1158 
1159 /**
1160  * @}
1161  */
1162 #endif /* __FMAC_API_H__ */
1163