Mistake on this page?
Report an issue in GitHub or email us
whd_wifi_api.h
Go to the documentation of this file.
1 /*
2  * Copyright 2020 Cypress Semiconductor Corporation
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 /** @file
19  * Prototypes of functions for controlling the Wi-Fi system
20  *
21  * This file provides prototypes for end-user functions which allow
22  * actions such as scanning for Wi-Fi networks, joining Wi-Fi
23  * networks, getting the MAC address, etc
24  *
25  */
26 
27 #include "whd.h"
28 #include "whd_types.h"
29 
30 #ifndef INCLUDED_WHD_WIFI_API_H
31 #define INCLUDED_WHD_WIFI_API_H
32 
33 #ifdef __cplusplus
34 extern "C"
35 {
36 #endif
37 
38 /******************************************************
39 * Function declarations
40 ******************************************************/
41 
42 /** @addtogroup wifi WHD Wi-Fi API
43  * APIs for controlling the Wi-Fi system
44  * @{
45  */
46 
47 /** @addtogroup wifimanagement WHD Wi-Fi Management API
48  * @ingroup wifi
49  * Initialisation and other management functions for WHD system
50  * @{
51  */
52 
53 /** Initialize an instance of the WHD driver
54  *
55  * @param whd_driver_ptr Pointer to Pointer to handle instance of the driver
56  * @param whd_init_config Pointer to configuration data that controls how the driver is initialized
57  * @param resource_ops Pointer to resource interface to provide resources to the driver initialization process
58  * @param buffer_ops Pointer to a buffer interface to provide buffer related services to the driver instance
59  * @param network_ops Pointer to a whd_netif_funcs_t to provide network stack services to the driver instance
60  *
61  * @return WHD_SUCCESS or Error code
62  */
63 extern uint32_t whd_init(whd_driver_t *whd_driver_ptr, whd_init_config_t *whd_init_config,
64  whd_resource_source_t *resource_ops, whd_buffer_funcs_t *buffer_ops,
65  whd_netif_funcs_t *network_ops);
66 /* @} */
67 /* @} */
68 
69 /** @addtogroup busapi WHD Bus API
70  * Allows WHD to operate with specific SDIO/SPI bus
71  * @{
72  */
73 
74 /** Attach the WLAN Device to a specific SDIO bus
75  *
76  * @param whd_driver Pointer to handle instance of the driver
77  * @param whd_config Configuration for SDIO bus
78  * @param sdio_obj The SDHC hardware interface, from the Level 3 CY HW APIs
79  *
80  * @return WHD_SUCCESS or Error code
81  */
82 extern uint32_t whd_bus_sdio_attach(whd_driver_t whd_driver, whd_sdio_config_t *whd_config, cyhal_sdio_t *sdio_obj);
83 
84 /** Detach the WLAN Device to a specific SDIO bus
85  *
86  * @param whd_driver Pointer to handle instance of the driver
87  */
89 
90 /** Attach the WLAN Device to a specific SPI bus
91  *
92  * @param whd_driver Pointer to handle instance of the driver
93  * @param whd_config Configuration for SPI bus
94  * @param spi_obj The SPI hardware interface, from the Level 3 CY HW APIs
95  *
96  * @return WHD_SUCCESS or Error code
97  */
98 extern uint32_t whd_bus_spi_attach(whd_driver_t whd_driver, whd_spi_config_t *whd_config, cyhal_spi_t *spi_obj);
99 
100 /** Detach the WLAN Device to a specific SPI bus
101  *
102  * @param whd_driver Pointer to handle instance of the driver
103  */
105 
106 /* @} */
107 
108 /** @addtogroup wifi WHD Wi-Fi API
109  * APIs for controlling the Wi-Fi system
110  * @{
111  */
112 
113 /** @addtogroup wifimanagement WHD Wi-Fi Management API
114  * @ingroup wifi
115  * Initialisation and other management functions for WHD system
116  * @{
117  */
118 
119 /**
120  * Turn on the Wi-Fi device
121  *
122  * Initialise Wi-Fi platform
123  * Program various WiFi parameters and modes
124  *
125  * @param whd_driver Pointer to handle instance of the driver
126  * @param ifpp Pointer to Pointer to handle instance of whd interface
127  *
128  * @return WHD_SUCCESS if initialization is successful, error code otherwise
129  */
130 extern uint32_t whd_wifi_on(whd_driver_t whd_driver, whd_interface_t *ifpp);
131 
132 /**
133  * Turn off the Wi-Fi device
134  *
135  * - De-Initialises the required parts of the hardware platform
136  * i.e. pins for SDIO/SPI, interrupt, reset, power etc.
137  *
138  * - De-Initialises the whd thread which arbitrates access
139  * to the SDIO/SPI bus
140  *
141  * @param ifp Pointer to handle instance of whd interface
142  *
143  * @return WHD_SUCCESS if deinitialization is successful, Error code otherwise
144  */
145 extern uint32_t whd_wifi_off(whd_interface_t ifp);
146 
147 /** Shutdown this instance of the wifi driver, freeing all used resources
148  *
149  * @param ifp Pointer to handle instance of whd interface
150  *
151  * @return WHD_SUCCESS or Error code
152  */
153 extern uint32_t whd_deinit(whd_interface_t ifp);
154 
155 /** Brings up the Wi-Fi core
156  *
157  * @param ifp Pointer to handle instance of whd interface
158  *
159  * @return WHD_SUCCESS or Error code
160  */
161 extern uint32_t whd_wifi_set_up(whd_interface_t ifp);
162 
163 /** Bring down the Wi-Fi core
164  *
165  * WARNING / NOTE:
166  * This brings down the Wi-Fi core and existing network connections will be lost.
167  *
168  * @param ifp Pointer to handle instance of whd interface
169  *
170  * @return WHD_SUCCESS or Error code
171  */
172 extern uint32_t whd_wifi_set_down(whd_interface_t ifp);
173 
174 /** Creates a secondary interface
175  *
176  * @param whd_drv Pointer to handle instance of the driver
177  * @param mac_addr MAC address for the interface
178  * @param ifpp Pointer to the whd interface pointer
179  *
180  * @return WHD_SUCCESS or Error code
181  */
182 extern uint32_t whd_add_secondary_interface(whd_driver_t whd_drv, whd_mac_t *mac_addr, whd_interface_t *ifpp);
183 /* @} */
184 
185 /** @addtogroup wifijoin WHD Wi-Fi Join, Scan and Halt API
186  * @ingroup wifi
187  * Wi-Fi APIs for join, scan & leave
188  * @{
189  */
190 
191 /** Scan result callback function pointer type
192  *
193  * @param result_ptr A pointer to the pointer that indicates where to put the next scan result
194  * @param user_data User provided data
195  * @param status Status of scan process
196  */
197 typedef void (*whd_scan_result_callback_t)(whd_scan_result_t **result_ptr, void *user_data, whd_scan_status_t status);
198 
199 /** Initiates a scan to search for 802.11 networks.
200  *
201  * This functions returns the scan results with limited sets of parameter in a buffer provided by the caller.
202  * It is also a blocking call. It is an simplified version of the whd_wifi_scan().
203  *
204  * @param ifp Pointer to handle instance of whd interface
205  * @param scan_result pointer to user requested records buffer.
206  * @param count No of records user is interested in.
207  * If 0 return the total record count.
208  *
209  * @note When scanning specific channels, devices with a strong signal strength on nearby channels may be detected
210  *
211  * @return record count or Error code
212  */
213 extern uint32_t whd_wifi_scan_synch(whd_interface_t ifp,
214  whd_sync_scan_result_t *scan_result,
215  uint32_t count
216  );
217 
218 /** Initiates a scan to search for 802.11 networks.
219  *
220  * The scan progressively accumulates results over time, and may take between 1 and 10 seconds to complete.
221  * The results of the scan will be individually provided to the callback function.
222  * Note: The callback function will be executed in the context of the WHD thread and so must not perform any
223  * actions that may cause a bus transaction.
224  *
225  * @param ifp Pointer to handle instance of whd interface
226  * @param scan_type Specifies whether the scan should be Active, Passive or scan Prohibited channels
227  * @param bss_type Specifies whether the scan should search for Infrastructure networks (those using
228  * an Access Point), Ad-hoc networks, or both types.
229  * @param optional_ssid If this is non-Null, then the scan will only search for networks using the specified SSID.
230  * @param optional_mac If this is non-Null, then the scan will only search for networks where
231  * the BSSID (MAC address of the Access Point) matches the specified MAC address.
232  * @param optional_channel_list If this is non-Null, then the scan will only search for networks on the
233  * specified channels - array of channel numbers to search, terminated with a zero
234  * @param optional_extended_params If this is non-Null, then the scan will obey the specifications about
235  * dwell times and number of probes.
236  * @param callback The callback function which will receive and process the result data.
237  * @param result_ptr Pointer to a pointer to a result storage structure.
238  * @param user_data user specific data that will be passed directly to the callback function
239  *
240  * @note - When scanning specific channels, devices with a strong signal strength on nearby channels may be detected
241  * - Callback must not use blocking functions, nor use WHD functions, since it is called from the context of the
242  * WHD thread.
243  * - The callback, result_ptr and user_data variables will be referenced after the function returns.
244  * Those variables must remain valid until the scan is complete.
245  *
246  * @return WHD_SUCCESS or Error code
247  */
248 extern uint32_t whd_wifi_scan(whd_interface_t ifp,
249  whd_scan_type_t scan_type,
250  whd_bss_type_t bss_type,
251  const whd_ssid_t *optional_ssid,
252  const whd_mac_t *optional_mac,
253  const uint16_t *optional_channel_list,
254  const whd_scan_extended_params_t *optional_extended_params,
256  whd_scan_result_t *result_ptr,
257  void *user_data);
258 
259 /** Abort a previously issued scan
260  *
261  * @param ifp Pointer to handle instance of whd interface
262  *
263  * @return WHD_SUCCESS or Error code
264  */
265 extern uint32_t whd_wifi_stop_scan(whd_interface_t ifp);
266 
267 /** Joins a Wi-Fi network
268  *
269  * Scans for, associates and authenticates with a Wi-Fi network.
270  * On successful return, the system is ready to send data packets.
271  *
272  * @param ifp Pointer to handle instance of whd interface
273  * @param ssid A null terminated string containing the SSID name of the network to join
274  * @param auth_type Authentication type
275  * @param security_key A byte array containing either the cleartext security key for WPA/WPA2/WPA3 secured networks
276  * @param key_length The length of the security_key in bytes.
277  *
278  * @note In case of WPA3/WPA2 transition mode, the security_key value is WPA3 password.
279  *
280  * @return WHD_SUCCESS when the system is joined and ready to send data packets
281  * Error code if an error occurred
282  */
283 extern uint32_t whd_wifi_join(whd_interface_t ifp, const whd_ssid_t *ssid, whd_security_t auth_type,
284  const uint8_t *security_key, uint8_t key_length);
285 
286 /** Joins a specific Wi-Fi network
287  *
288  * Associates and authenticates with a specific Wi-Fi access point.
289  * On successful return, the system is ready to send data packets.
290  *
291  * @param ifp Pointer to handle instance of whd interface
292  * @param ap A pointer to a whd_scan_result_t structure containing AP details and
293  * set ap.channel to 0 for unspecificed channel
294  * @param security_key A byte array containing either the cleartext security key for WPA/WPA2
295  * secured networks
296  * @param key_length The length of the security_key in bytes.
297  *
298  * @return WHD_SUCCESS when the system is joined and ready to send data packets
299  * Error code if an error occurred
300  */
301 extern uint32_t whd_wifi_join_specific(whd_interface_t ifp, const whd_scan_result_t *ap, const uint8_t *security_key,
302  uint8_t key_length);
303 
304 /* @} */
305 
306 /** @addtogroup wifiutilities WHD Wi-Fi Utility API
307  * @ingroup wifi
308  * Allows WHD to perform utility operations
309  * @{
310  */
311 
312 /** Set the current channel on the WLAN radio
313  *
314  * @note On most WLAN devices this will set the channel for both AP *AND* STA
315  * (since there is only one radio - it cannot be on two channels simulaneously)
316  *
317  * @param ifp Pointer to handle instance of whd interface
318  * @param channel The desired channel
319  *
320  * @return WHD_SUCCESS if the channel was successfully set
321  * Error code if the channel was not successfully set
322  */
323 extern uint32_t whd_wifi_set_channel(whd_interface_t ifp, uint32_t channel);
324 
325 /** Get the current channel on the WLAN radio
326  *
327  * @note On most WLAN devices this will get the channel for both AP *AND* STA
328  * (since there is only one radio - it cannot be on two channels simulaneously)
329  *
330  * @param ifp Pointer to handle instance of whd interface
331  * @param channel Pointer to receive the current channel
332  *
333  * @return WHD_SUCCESS if the channel was successfully retrieved
334  * Error code if the channel was not successfully retrieved
335  */
336 extern uint32_t whd_wifi_get_channel(whd_interface_t ifp, uint32_t *channel);
337 
338 /** Set the passphrase
339  *
340  * @param ifp Pointer to handle instance of whd interface
341  * @param security_key The security key (passphrase) which is to be set
342  * @param key_length length of the key
343  *
344  * @return WHD_SUCCESS when the key is set
345  * Error code if an error occurred
346  */
347 extern uint32_t whd_wifi_set_passphrase(whd_interface_t ifp, const uint8_t *security_key, uint8_t key_length);
348 
349 /** Set the SAE password
350  *
351  * @param ifp Pointer to handle instance of whd interface
352  * @param security_key The security key (password) which is to be set
353  * @param key_length length of the key
354  *
355  * @return WHD_SUCCESS when the key is set
356  * Error code if an error occurred
357  */
358 extern uint32_t whd_wifi_sae_password(whd_interface_t ifp, const uint8_t *security_key, uint8_t key_length);
359 
360 /** Enable WHD internal supplicant and set WPA2 passphrase in case of WPA3/WPA2 transition mode
361  *
362  * @param ifp Pointer to handle instance of whd interface
363  * @param security_key_psk The security key (passphrase) which is to be set
364  * @param psk_length length of the key
365  * @param auth_type Authentication type: @ref WHD_SECURITY_WPA3_WPA2_PSK
366  *
367  * @return WHD_SUCCESS when the supplicant variable and wpa2 passphrase is set
368  * Error code if an error occurred
369  */
370 extern uint32_t whd_wifi_enable_sup_set_passphrase(whd_interface_t ifp, const uint8_t *security_key_psk,
371  uint8_t psk_length, whd_security_t auth_type);
372 
373 
374 /** Enable WHD internal supplicant
375  *
376  * @param ifp Pointer to handle instance of whd interface
377  * @param auth_type Authentication type
378  *
379  * @return WHD_SUCCESS when the supplicant variable is set
380  * Error code if an error occurred
381  */
382 extern uint32_t whd_wifi_enable_supplicant(whd_interface_t ifp, whd_security_t auth_type);
383 
384 /** Retrieve the latest RSSI value
385  *
386  * @param ifp Pointer to handle instance of whd interface
387  * @param rssi The location where the RSSI value will be stored
388  *
389  * @return WHD_SUCCESS if the RSSI was successfully retrieved
390  * Error code if the RSSI was not retrieved
391  */
392 extern uint32_t whd_wifi_get_rssi(whd_interface_t ifp, int32_t *rssi);
393 
394 /** Retrieve the associated STA's RSSI value
395  *
396  * @param ifp : Pointer to handle instance of whd interface
397  * @param rssi : The location where the RSSI value will be stored
398  * @param client_mac : Pointer to associated client's MAC address
399  *
400  * @return WHD_SUCCESS : if the RSSI was successfully retrieved
401  * Error code : if the RSSI was not retrieved
402  */
403 extern uint32_t whd_wifi_get_ap_client_rssi(whd_interface_t ifp, int32_t *rssi, const whd_mac_t *client_mac);
404 
405 
406 /* @} */
407 
408 /** @addtogroup wifijoin WHD Wi-Fi Join, Scan and Halt API
409  * @ingroup wifi
410  * Wi-Fi APIs for join, scan & leave
411  * @{
412  */
413 /** Disassociates from a Wi-Fi network.
414  * Applicable only for STA role
415  *
416  * @param ifp Pointer to handle instance of whd interface.
417  *
418  * @return WHD_SUCCESS On successful disassociation from the AP
419  * Error code If an error occurred
420  */
421 extern uint32_t whd_wifi_leave(whd_interface_t ifp);
422 /* @} */
423 
424 /** @addtogroup wifiutilities WHD Wi-Fi Utility API
425  * @ingroup wifi
426  * Allows WHD to perform utility operations
427  * @{
428  */
429 
430 /** Retrieves the current Media Access Control (MAC) address
431  * (or Ethernet hardware address) of the 802.11 device
432  *
433  * @param ifp Pointer to handle instance of whd interface
434  * @param mac Pointer to a variable that the current MAC address will be written to
435  *
436  * @return WHD_SUCCESS or Error code
437  */
438 extern uint32_t whd_wifi_get_mac_address(whd_interface_t ifp, whd_mac_t *mac);
439 
440 /** Get the BSSID of the interface
441  *
442  * @param ifp Pointer to the whd_interface_t
443  * @param bssid Returns the BSSID address (mac address) if associated
444  *
445  * @return WHD_SUCCESS or Error code
446  */
447 extern uint32_t whd_wifi_get_bssid(whd_interface_t ifp, whd_mac_t *bssid);
448 /* @} */
449 
450 /** @addtogroup wifisoftap WHD Wi-Fi SoftAP API
451  * @ingroup wifi
452  * Wi-Fi APIs to perform SoftAP related functionalities
453  * @{
454  */
455 
456 /** Initialises an infrastructure WiFi network (SoftAP)
457  *
458  * @param ifp Pointer to handle instance of whd interface
459  * @param ssid A null terminated string containing the SSID name of the network to join
460  * @param auth_type Authentication type
461  * @param security_key A byte array containing the cleartext security key for the network
462  * @param key_length The length of the security_key in bytes.
463  * @param channel 802.11 channel number
464  *
465  * @return WHD_SUCCESS if successfully initialises an AP
466  * Error code if an error occurred
467  */
468 extern uint32_t whd_wifi_init_ap(whd_interface_t ifp, whd_ssid_t *ssid, whd_security_t auth_type,
469  const uint8_t *security_key, uint8_t key_length, uint8_t channel);
470 
471 /** Start the infrastructure WiFi network (SoftAP)
472  * using the parameter set by whd_wifi_init_ap() and optionaly by whd_wifi_manage_custom_ie()
473  *
474  * @return WHD_SUCCESS if successfully creates an AP
475  * Error code if an error occurred
476  */
477 extern uint32_t whd_wifi_start_ap(whd_interface_t ifp);
478 
479 /** Stops an existing infrastructure WiFi network
480  *
481  * @param ifp Pointer to handle instance of whd interface
482  *
483  * @return WHD_SUCCESS if the AP is successfully stopped or if the AP has not yet been brought up
484  * Error code if an error occurred
485  */
486 extern uint32_t whd_wifi_stop_ap(whd_interface_t ifp);
487 
488 
489 /** Get the maximum number of associations supported by AP interfaces
490  *
491  * @param ifp Pointer to handle instance of whd interface
492  * @param max_assoc The maximum number of associations supported by Soft AP interfaces.
493  *
494  * @return WHD_SUCCESS if the maximum number of associated clients was successfully read
495  * WHD_ERROR if the maximum number of associated clients was not successfully read
496  */
497 extern uint32_t whd_wifi_ap_get_max_assoc(whd_interface_t ifp, uint32_t *max_assoc);
498 
499 /** Gets the current number of active connections
500  *
501  * @param ifp Pointer to handle instance of whd interface
502  * @param client_list_buffer Buffer to store list of associated clients
503  * @param buffer_length Length of client list buffer
504  *
505  * @return WHD_SUCCESS if the active connections was successfully read
506  * WHD_ERROR if the active connections was not successfully read
507  */
508 extern uint32_t whd_wifi_get_associated_client_list(whd_interface_t ifp, void *client_list_buffer,
509  uint16_t buffer_length);
510 
511 /** Deauthenticates a STA which may or may not be associated to SoftAP
512  *
513  * @param ifp Pointer to handle instance of whd interface
514  * @param mac Pointer to a variable containing the MAC address to which the deauthentication will be sent
515  * NULL mac address will deauthenticate all the associated STAs
516  *
517  * @param reason Deauthentication reason code
518  *
519  * @return WHD_SUCCESS On successful deauthentication of the other STA
520  * WHD_ERROR If an error occurred
521  */
522 extern uint32_t whd_wifi_deauth_sta(whd_interface_t ifp, whd_mac_t *mac, whd_dot11_reason_code_t reason);
523 
524 /** Retrieves AP information
525  *
526  * @param ifp Pointer to handle instance of whd interface
527  * @param ap_info Returns a whd_bss_info_t structure containing AP details
528  * @param security Authentication type
529  *
530  * @return WHD_SUCCESS if the AP info was successfully retrieved
531  * Error code if the AP info was not successfully retrieved
532  */
533 extern uint32_t whd_wifi_get_ap_info(whd_interface_t ifp, whd_bss_info_t *ap_info, whd_security_t *security);
534 
535 /** Set the beacon interval.
536  *
537  * Note that the value needs to be set before ap_start in order to beacon interval to take effect.
538  *
539  * @param ifp Pointer to handle instance of whd interface
540  * @param interval Beacon interval in time units (Default: 100 time units = 102.4 ms)
541  *
542  * @return WHD_SUCCESS or Error code
543  */
544 extern uint32_t whd_wifi_ap_set_beacon_interval(whd_interface_t ifp, uint16_t interval);
545 
546 /** Set the DTIM interval.
547  *
548  * Note that the value needs to be set before ap_start in order to DTIM interval to take effect.
549  *
550  * @param ifp Pointer to handle instance of whd interface
551  * @param interval DTIM interval, in unit of beacon interval
552  *
553  * @return WHD_SUCCESS or Error code
554  */
555 extern uint32_t whd_wifi_ap_set_dtim_interval(whd_interface_t ifp, uint16_t interval);
556 /* @} */
557 
558 
559 /** @addtogroup wifipowersave WHD Wi-Fi Power Save API
560  * @ingroup wifi
561  * Wi-Fi functions for WLAN low power modes
562  * @{
563  */
564 
565 /** Enables powersave mode on specified interface without regard for throughput reduction
566  *
567  * This function enables (legacy) 802.11 PS-Poll mode and should be used
568  * to achieve the lowest power consumption possible when the Wi-Fi device
569  * is primarily passively listening to the network
570  *
571  * @param ifp Pointer to handle instance of whd interface
572  *
573  * @return WHD_SUCCESS or Error code
574  */
575 extern uint32_t whd_wifi_enable_powersave(whd_interface_t ifp);
576 
577 /** Enables powersave mode on specified interface while attempting to maximise throughput
578  *
579  *
580  * Network traffic is typically bursty. Reception of a packet often means that another
581  * packet will be received shortly afterwards (and vice versa for transmit).
582  *
583  * In high throughput powersave mode, rather then entering powersave mode immediately
584  * after receiving or sending a packet, the WLAN chip waits for a timeout period before
585  * returning to sleep.
586  *
587  * @param ifp Pointer to handle instance of whd interface
588  * @param return_to_sleep_delay The variable to set return to sleep delay.
589  * return to sleep delay must be set to a multiple of 10 and not equal to zero.
590  *
591  * @return WHD_SUCCESS if power save mode was successfully enabled
592  * Error code if power save mode was not successfully enabled
593  *
594  */
595 extern uint32_t whd_wifi_enable_powersave_with_throughput(whd_interface_t ifp, uint16_t return_to_sleep_delay);
596 
597 /** Get powersave mode on specified interface
598  *
599  * @param ifp Pointer to handle instance of whd interface
600  * @param value Value of the current powersave state
601  * PM1_POWERSAVE_MODE, PM2_POWERSAVE_MODE, NO_POWERSAVE_MODE
602  *
603  * @return WHD_SUCCESS or Error code
604  */
605 extern uint32_t whd_wifi_get_powersave_mode(whd_interface_t ifp, uint32_t *value);
606 
607 /** Disables 802.11 power save mode on specified interface
608  *
609  * @param ifp Pointer to handle instance of whd interface
610  *
611  * @return WHD_SUCCESS if power save mode was successfully disabled
612  * Error code if power save mode was not successfully disabled
613  *
614  */
615 extern uint32_t whd_wifi_disable_powersave(whd_interface_t ifp);
616 /* @} */
617 
618 /** @addtogroup wifiutilities WHD Wi-Fi Utility API
619  * @ingroup wifi
620  * Allows WHD to perform utility operations
621  * @{
622  */
623 /** Registers interest in a multicast address
624  *
625  * Once a multicast address has been registered, all packets detected on the
626  * medium destined for that address are forwarded to the host.
627  * Otherwise they are ignored.
628  *
629  * @param ifp Pointer to handle instance of whd interface
630  * @param mac Ethernet MAC address
631  *
632  * @return WHD_SUCCESS if the address was registered successfully
633  * Error code if the address was not registered
634  */
635 extern uint32_t whd_wifi_register_multicast_address(whd_interface_t ifp, const whd_mac_t *mac);
636 
637 /** Unregisters interest in a multicast address
638  *
639  * Once a multicast address has been unregistered, all packets detected on the
640  * medium destined for that address are ignored.
641  *
642  * @param ifp Pointer to handle instance of whd interface
643  * @param mac Ethernet MAC address
644  *
645  * @return WHD_SUCCESS if the address was unregistered successfully
646  * Error code if the address was not unregistered
647  */
648 extern uint32_t whd_wifi_unregister_multicast_address(whd_interface_t ifp, const whd_mac_t *mac);
649 
650 /** Sets the 802.11 powersave listen interval for a Wi-Fi client, and communicates
651  * the listen interval to the Access Point. The listen interval will be set to
652  * (listen_interval x time_unit) seconds.
653  *
654  * The default value for the listen interval is 0. With the default value of 0 set,
655  * the Wi-Fi device wakes to listen for AP beacons every DTIM period.
656  *
657  * If the DTIM listen interval is non-zero, the DTIM listen interval will over ride
658  * the beacon listen interval value.
659  *
660  * @param ifp Pointer to handle instance of whd interface
661  * @param listen_interval The desired beacon listen interval
662  * @param time_unit The listen interval time unit; options are beacon period or DTIM period.
663  *
664  * @return WHD_SUCCESS If the listen interval was successfully set.
665  * Error code If the listen interval was not successfully set.
666  */
667 extern uint32_t whd_wifi_set_listen_interval(whd_interface_t ifp, uint8_t listen_interval,
669 
670 /** Gets the current value of all beacon listen interval variables
671  *
672  * @param ifp Pointer to handle instance of whd interface
673  * @param li Powersave listen interval values
674  * - listen_interval_beacon : The current value of the listen interval set as a multiple of the beacon period
675  * - listen_interval_dtim : The current value of the listen interval set as a multiple of the DTIM period
676  * - listen_interval_assoc : The current value of the listen interval sent to access points in an association request frame
677  *
678  * @return WHD_SUCCESS If all listen interval values are read successfully
679  * Error code If at least one of the listen interval values are NOT read successfully
680  */
682 
683 /** Determines if a particular interface is ready to transceive ethernet packets
684  *
685  * @param ifp Pointer to handle instance of whd interface
686  *
687  * @return WHD_SUCCESS if the interface is ready to transceive ethernet packets
688  * WHD_NOTFOUND no AP with a matching SSID was found
689  * WHD_NOT_AUTHENTICATED Matching AP was found but it won't let you authenticate.
690  * This can occur if this device is in the block list on the AP.
691  * WHD_NOT_KEYED Device has authenticated and associated but has not completed the key exchange.
692  * This can occur if the passphrase is incorrect.
693  * Error code if the interface is not ready to transceive ethernet packets
694  */
696 
697 /* Certification APIs */
698 
699 /** Retrieve the latest STA EDCF AC parameters
700  *
701  * Retrieve the latest Station (STA) interface EDCF (Enhanced Distributed
702  * Coordination Function) Access Category parameters
703  *
704  * @param ifp Pointer to handle instance of whd interface
705  * @param acp The location where the array of AC parameters will be stored
706  *
707  * @return WHD_SUCCESS if the AC Parameters were successfully retrieved
708  * Error code if the AC Parameters were not retrieved
709  */
710 extern uint32_t whd_wifi_get_acparams(whd_interface_t ifp, whd_edcf_ac_param_t *acp);
711 
712 /* Action Frames */
713 
714 /** Manage the addition and removal of custom IEs
715  *
716  * @param ifp Pointer to handle instance of whd interface
717  * @param action the action to take (add or remove IE)
718  * @param oui the oui of the custom IE
719  * @param subtype the IE sub-type
720  * @param data a pointer to the buffer that hold the custom IE
721  * @param length the length of the buffer pointed to by 'data'
722  * @param which_packets A mask to indicate in which all packets this IE should be included. See whd_ie_packet_flag_t.
723  *
724  * @return WHD_SUCCESS if the custom IE action was successful
725  * Error code if the custom IE action failed
726  */
728  const uint8_t *oui, uint8_t subtype, const void *data,
729  uint16_t length, uint16_t which_packets);
730 
731 /** Send a pre-prepared action frame
732  *
733  * @param ifp Pointer to handle instance of whd interface
734  * @param af_params A pointer to a pre-prepared action frame structure
735  *
736  * @return WHD_SUCCESS or Error code
737  */
738 extern uint32_t whd_wifi_send_action_frame(whd_interface_t ifp, whd_af_params_t *af_params);
739 
740 /** Set coex configuration
741  *
742  * @param ifp Pointer to handle instance of whd interface
743  * @param coex_config Pointer to the structure whd_coex_config_t
744  *
745  * @return WHD_SUCCESS or Error code
746  */
747 extern uint32_t whd_wifi_set_coex_config(whd_interface_t ifp, whd_coex_config_t *coex_config);
748 
749 /** Get version of Device (WLAN) Firmware
750  *
751  * @param[in] ifp : pointer to handle instance of whd interface
752  * @param[out] version : pointer to store version #
753  *
754  * @return whd_result_t
755  */
756 whd_result_t whd_arp_version(whd_interface_t ifp, uint32_t *version);
757 
758 /** Get ARP Offload Peer Age from Device (WLAN)
759  * Length of time in seconds before aging out an entry in the WLAN processor ARP table.
760  *
761  * @param[in] ifp : pointer to handle instance of whd interface
762  * @param[out] seconds : pointer to store value
763  *
764  * @return whd_result_t
765  */
766 whd_result_t whd_arp_peerage_get(whd_interface_t ifp, uint32_t *seconds);
767 
768 /** Set ARP Offload Peer Age in Device (WLAN)
769  * Length of time in seconds before aging out an entry in the WLAN processor ARP table.
770  *
771  * @param[in] ifp : pointer to handle instance of whd interface
772  * @param[in] seconds : Seconds to age out IP
773  *
774  * @return whd_result_t
775  */
776 whd_result_t whd_arp_peerage_set(whd_interface_t ifp, uint32_t seconds);
777 
778 /** Get ARP Offload Agent Enable from Device (WLAN)
779  *
780  * @param[in] ifp : pointer to handle instance of whd interface
781  * @param[out] agent_enable : pointer to store value
782  *
783  * @return whd_result_t
784  */
785 whd_result_t whd_arp_arpoe_get(whd_interface_t ifp, uint32_t *agent_enable);
786 
787 /** Set ARP Offload Agent Enable in Device (WLAN)
788  * Set Enable/Disable of ARP Offload Agent
789  *
790  * @param[in] ifp : pointer to handle instance of whd interface
791  * @param[in] agent_enable : Enable=1 / Disable=0
792  *
793  * @return whd_result_t
794  */
795 whd_result_t whd_arp_arpoe_set(whd_interface_t ifp, uint32_t agent_enable);
796 
797 /** Clear ARP Offload cache in Device (WLAN)
798  *
799  * @param[in] ifp : pointer to handle instance of whd interface
800  *
801  * @return whd_result_t
802  */
804 
805 /** Get ARP Offload Feature Flags from Device (WLAN)
806  *
807  * @param[in] ifp : pointer to handle instance of whd interface
808  * @param[out] features : ptr to store currently set features - bit flags CY_ARP_OL_AGENT_ENABLE, etc.
809  * ARL_OL_AGENT | ARL_OL_SNOOP | ARP_OL_HOST_AUTO_REPLY | ARP_OL_PEER_AUTO_REPLY
810  *
811  * @return whd_result_t
812  */
813 whd_result_t whd_arp_features_get(whd_interface_t ifp, uint32_t *features);
814 
815 /** Set ARP Offload Feature Flags in Device (WLAN)
816  *
817  * @param[in] ifp : pointer to handle instance of whd interface
818  * @param[in] features : features to set value (you can OR ('|') multiple flags) CY_ARP_OL_AGENT_ENABLE, etc.
819  * ARL_OL_AGENT | ARL_OL_SNOOP | ARP_OL_HOST_AUTO_REPLY | ARP_OL_PEER_AUTO_REPLY
820  *
821  * @return whd_result_t
822  */
823 whd_result_t whd_arp_features_set(whd_interface_t ifp, uint32_t features);
824 
825 /** Print ARP Offload Feature Flags in Human readable form to console
826  *
827  * @param[in] features : feature flags to set (you can OR '|' multiple flags) CY_ARP_OL_AGENT_ENABLE, etc.
828  * ARL_OL_AGENT | ARL_OL_SNOOP | ARP_OL_HOST_AUTO_REPLY | ARP_OL_PEER_AUTO_REPLY
829  * @param[in] title : Optional: Title for output (NULL == no title)
830  *
831  * @return whd_result_t
832  */
833 whd_result_t whd_arp_features_print(uint32_t features, const char *title);
834 
835 /** Add ARP Offload Host IP Identifier(s) to HostIP List to Device (WLAN)
836  *
837  * @param[in] ifp : pointer to handle instance of whd interface
838  * @param[in] host_ipv4_list : pointer to host_ip data (IPv4, 1 uint32_t per ip addr)
839  * @param[in] count : Number of array elements in host_ip
840  *
841  * @return whd_result_t
842  */
843 whd_result_t whd_arp_hostip_list_add(whd_interface_t ifp, uint32_t *host_ipv4_list, uint32_t count);
844 
845 /** Add One ARP Offload Host IP Identifier to HostIP List (mbed-style IP string) to Device (WLAN)
846  *
847  * @param[in] ifp : pointer to handle instance of whd interface
848  * @param[in] ip_addr : pointer to ip string (as returned from mbedos calls)
849  *
850  * @return whd_result_t
851  */
853 
854 /** Clear One ARP Offload Host IP Identifier from Host IP List in Device (WLAN)
855  *
856  * @param[in] ifp : pointer to handle instance of whd interface
857  * @param[in] ipv4_addr : ip addr expressed as a uint32_t
858  *
859  * @return whd_result_t
860  */
862 
863 /** Clear One ARP Offload Host IP Identifier from Host IP List (mbed-style IP string) in Device (WLAN)
864  *
865  * @param[in] ifp : pointer to handle instance of whd interface
866  * @param[in] ip_addr : pointer to ip string (as returned from mbedos calls)
867  *
868  * @return whd_result_t
869  */
871 
872 /** Clear all ARP Offload Host IP Identifier List
873  *
874  * @param[in] ifp : pointer to handle instance of whd interface
875  *
876  * @return whd_result_t
877  */
879 
880 /** Get ARP Offload Host IP Identifiers from Device (WLAN)
881  *
882  * @param[in] ifp : pointer to handle instance of whd interface
883  * @param[in] count : Number of array elements in host_ip
884  * @param[out] host_ipv4_list : Pointer to structure array to store host_ip data
885  * @param[out] filled : Number of array elements filled by this routine
886  *
887  * @return whd_result_t
888  */
889 whd_result_t whd_arp_hostip_list_get(whd_interface_t ifp, uint32_t count, uint32_t *host_ipv4_list, uint32_t *filled);
890 
891 /** Clear ARP Offload statistics in Device (WLAN)
892  *
893  * @param[in] ifp : pointer to handle instance of whd interface
894  *
895  * @return whd_result_t
896  */
898 
899 /** Get ARP Offload statistics from Device (WLAN)
900  *
901  * @param[in] ifp : pointer to handle instance of whd interface
902  * @param[out] stats : Ptr to store statistics whd_arp_stats_t
903  *
904  * @return whd_result_t
905  */
906 whd_result_t whd_arp_stats_get(whd_interface_t ifp, whd_arp_stats_t *stats);
907 
908 /** Print ARP Offload statistics
909  * NOTE: call whd_arp_stats_get(), then print them using this function.
910  *
911  * @param[in] arp_stats : Ptr to ARP statistics structure
912  * @param[in] title : Optional: Title for output (NULL == no title)
913  *
914  * @return whd_result_t
915  */
916 whd_result_t whd_arp_stats_print(whd_arp_stats_t *arp_stats, const char *title);
917 
918 /** A filter must be added (e.g. created) before it can be enabled.
919  * @param[in] ifp : pointer to handle instance of whd interface
920  * @param[in] settings : Ptr to filter settings @ref whd_packet_filter_t
921  * @return whd_result_t
922  */
924 
925 /** Remove a previously added filter.
926  * @param[in] ifp : pointer to handle instance of whd interface
927  * @param[in] filter_id : filter to remove
928  * @return whd_result_t
929  */
931 
932 /** After a filter has been added it can be enabled or disabled as needed.
933  * @param[in] ifp : pointer to handle instance of whd interface
934  * @param[in] filter_id : filter to enable
935  * @return whd_result_t
936  */
938 
939 /** After a filter has been added it can be enabled or disabled as needed.
940  * @param[in] ifp : pointer to handle instance of whd interface
941  * @param[in] filter_id : filter to disable
942  * @return whd_result_t
943  */
945 
946 /** After a filter has been added it can be enabled or disabled as needed.
947  * @param[in] ifp : pointer to handle instance of whd interface
948  * @param[in] filter_id : filter to disable/enable
949  * @param[in] enable : Enable/Disable Flag
950  * @return whd_result_t
951  */
953 
954 /** Filters are implemented in WLAN subsystem as a bit pattern and matching bit mask that
955  * are applied to incoming packets. This API retrieves the pattern and mask.
956  * @param[in] ifp : pointer to handle instance of whd interface
957  * @param[in] filter_id : which filter to retrieve
958  * @param[in] max_size : size of both mask and pattern buffers
959  * @param[out] mask : mask for this filter
960  * @param[out] pattern : pattern for this filter
961  * @param[out] size_out : length of both mask and pattern
962  * @return whd_result_t
963  */
964 whd_result_t whd_pf_get_packet_filter_mask_and_pattern(whd_interface_t ifp, uint8_t filter_id, uint32_t max_size,
965  uint8_t *mask,
966  uint8_t *pattern, uint32_t *size_out);
967 
968 /** Clear the packet filter stats associated with a filter id
969  * @param[in] ifp : pointer to handle instance of whd interface
970  * @param[in] filter_id : which filter
971  * @return whd_result_t
972  */
974 
975 /** Return the stats associated with a filter
976  * @param[in] ifp : pointer to handle instance of whd interface
977  * @param[in] filter_id : which filter
978  * @param[out] stats : Ptr to store statistics wl_pkt_filter_stats_t
979  * @return whd_result_t
980  */
981 whd_result_t whd_pf_get_packet_filter_stats(whd_interface_t ifp, uint8_t filter_id, whd_pkt_filter_stats_t *stats);
982 
983 /** Set/Get TKO retry & interval parameters
984  * @param[in] ifp : Pointer to handle instance of whd interface
985  * @param[in] whd_tko_retry : whd retry & interval parameters structure
986  * @param[in] set : Set/Get Flag
987  * @return whd_result_t
988  */
989 whd_result_t whd_tko_param(whd_interface_t ifp, whd_tko_retry_t *whd_tko_retry, int set);
990 
991 /** Return the tko status for all indexes
992  * @param[in] ifp : Pointer to handle instance of whd interface
993  * @param[out] tko_status : Ptr to store tko_status
994  * @return whd_result_t
995  */
996 whd_result_t whd_tko_get_status(whd_interface_t ifp, whd_tko_status_t *tko_status);
997 
998 /** Return the stats associated with a filter
999  * @param[in] ifp : Pointer to handle instance of whd interface
1000  * @param[out] max : returns Max TCP connections supported by WLAN Firmware
1001  * @return whd_result_t
1002  */
1004 
1005 /** Return the stats associated with a filter
1006  * @param[in] ifp : Pointer to handle instance of whd interface
1007  * @param[in] index : index for TCP offload connection
1008  * @param[out] whd_connect : tko_connect structure buffer from Firmware
1009  * @param[in] buflen : Buffer given for tko_connect
1010  * @return whd_result_t
1011  */
1012 whd_result_t whd_tko_get_FW_connect(whd_interface_t ifp, uint8_t index, whd_tko_connect_t *whd_connect,
1013  uint16_t buflen);
1014 
1015 /** Return the stats associated with a filter
1016  * @param[in] ifp : Pointer to handle instance of whd interface
1017  * @param[in] enable : Enable/Disable TCP Keepalive offload
1018  * @return whd_result_t
1019  */
1021 
1022 
1023 /* @} */
1024 
1025 /** @addtogroup wifiioctl WHD Wi-Fi IOCTL Set/Get API
1026  * @ingroup wifi
1027  * Set and get IOCTL values
1028  * @{
1029  */
1030 /** Sends an IOCTL command - CDC_SET IOCTL value
1031  *
1032  * @param ifp Pointer to handle instance of whd interface
1033  * @param ioctl CDC_SET - To set the I/O control
1034  * @param value Data value to be sent
1035  *
1036  * @return WHD_SUCCESS or Error code
1037  */
1038 extern uint32_t whd_wifi_set_ioctl_value(whd_interface_t ifp, uint32_t ioctl, uint32_t value);
1039 
1040 /** Sends an IOCTL command - CDC_GET IOCTL value
1041  *
1042  * @param ifp Pointer to handle instance of whd interface
1043  * @param ioctl CDC_GET - To get the I/O control
1044  * @param value Pointer to receive the data value
1045  *
1046  * @return WHD_SUCCESS or Error code
1047  */
1048 extern uint32_t whd_wifi_get_ioctl_value(whd_interface_t ifp, uint32_t ioctl, uint32_t *value);
1049 
1050 /** Sends an IOCTL command - CDC_SET IOCTL buffer
1051  *
1052  * @param ifp Pointer to handle instance of whd interface
1053  * @param ioctl CDC_SET - To set the I/O control
1054  * @param buffer Handle for a packet buffer containing the data value to be sent.
1055  * @param buffer_length Length of buffer
1056  *
1057  * @return WHD_SUCCESS or Error code
1058  */
1059 extern uint32_t whd_wifi_set_ioctl_buffer(whd_interface_t ifp, uint32_t ioctl, void *buffer, uint16_t buffer_length);
1060 
1061 /** Sends an IOCTL command - CDC_GET IOCTL buffer
1062  *
1063  * @param ifp Pointer to handle instance of whd interface
1064  * @param ioctl CDC_GET - To get the I/O control
1065  * @param out_buffer Pointer to receive the handle for the packet buffer containing the response data value received
1066  * @param out_length Length of out_buffer
1067  *
1068  * @return WHD_SUCCESS or Error code
1069  */
1070 extern uint32_t whd_wifi_get_ioctl_buffer(whd_interface_t ifp, uint32_t ioctl, uint8_t *out_buffer,
1071  uint16_t out_length);
1072 
1073 /** Sends an IOVAR command
1074  *
1075  * @param ifp Pointer to handle instance of whd interface
1076  * @param iovar_name SDPCM_GET - To get the I/O Variable
1077  * @param param Paramater to be passed for the IOVAR
1078  * @param paramlen Paramter length
1079  * @param out_buffer Pointer to receive the handle for the packet buffer containing the response data value received
1080  * @param out_length Length of out_buffer
1081  *
1082  * @return WHD_SUCCESS or Error code
1083  */
1084 extern uint32_t whd_wifi_get_iovar_buffer_with_param(whd_interface_t ifp, const char *iovar_name, void *param,
1085  uint32_t paramlen, uint8_t *out_buffer, uint32_t out_length);
1086 
1087 /* @} */
1088 
1089 /** @addtogroup dbg WHD Wi-Fi Debug API
1090  * @ingroup wifi
1091  * WHD APIs which allows debugging like, printing whd log information, getting whd stats, etc.
1092  * @{
1093  */
1094 /** Retrieves the WLAN firmware version
1095  *
1096  * @param ifp Pointer to handle instance of whd interface
1097  * @param version Pointer to a buffer that version information will be written to
1098  * @param length Length of the buffer
1099  *
1100  * @return WHD_SUCCESS or Error code
1101  */
1102 extern uint32_t whd_wifi_get_wifi_version(whd_interface_t ifp, char *version, uint8_t length);
1103 
1104 /** Retrieves the WLAN CLM version
1105  *
1106  * @param ifp Pointer to handle instance of whd interface
1107  * @param version Pointer to a buffer that version information will be written to
1108  * @param length Length of the buffer
1109  *
1110  * @return WHD_SUCCESS or Error code
1111  */
1112 extern uint32_t whd_wifi_get_clm_version(whd_interface_t ifp, char *version, uint8_t length);
1113 
1114 /** To print whd log information
1115  *
1116  * @param whd_drv Pointer to handle instance of the driver
1117  * @param buffer Buffer to store read log results
1118  * @param buffer_size Variable to store size of the buffer
1119  *
1120  * @return WHD_SUCCESS or Error code
1121  */
1122 extern uint32_t whd_wifi_read_wlan_log(whd_driver_t whd_drv, char *buffer, uint32_t buffer_size);
1123 
1124 /** To print whd log information
1125  *
1126  * @param whd_drv Pointer to handle instance of the driver
1127  *
1128  * @return WHD_SUCCESS or Error code
1129  */
1130 extern uint32_t whd_wifi_print_whd_log(whd_driver_t whd_drv);
1131 
1132 /** Retrieves the ifidx from interface pointer.
1133  * ifidx is a unique value and be used to identify a instance of tcp/ip stack
1134  *
1135  * @param ifp Pointer to the whd_interface_t
1136  * @param ifidx Pointer to ifidx
1137  *
1138  * @return WHD_SUCCESS or Error code
1139  */
1140 extern uint32_t whd_network_get_ifidx_from_ifp(whd_interface_t ifp, uint8_t *ifidx);
1141 
1142 /** Retrieves the bsscfgidx from interface pointer.
1143  *
1144  * Can be used to send IOCTL with requires bsscfgidx
1145  *
1146  * @param ifp Pointer to handle instance of whd interface
1147  * @param bsscfgidx Pointer to bsscfgidx
1148  *
1149  * @return WHD_SUCCESS or Error code
1150  */
1151 extern uint32_t whd_network_get_bsscfgidx_from_ifp(whd_interface_t ifp, uint8_t *bsscfgidx);
1152 
1153 
1154 /** Retrives the bss info
1155  *
1156  * @param ifp Pointer to handle instance of whd interface
1157  * @param bi A pointer to the structure wl_bss_info_t
1158  *
1159  * @return WHD_SUCCESS or Error code
1160  */
1161 extern uint32_t whd_wifi_get_bss_info(whd_interface_t ifp, wl_bss_info_t *bi);
1162 
1163 /** Prints WHD stats
1164  *
1165  * @param whd_drv Pointer to handle instance of the driver
1166  * @param reset_after_print Bool variable to decide if whd_stats to be reset
1167  *
1168  * @return WHD_SUCCESS or Error code
1169  */
1170 extern uint32_t whd_print_stats(whd_driver_t whd_drv, whd_bool_t reset_after_print);
1171 
1172 /* @} */
1173 /* @} */
1174 
1175 #ifdef __cplusplus
1176 } /* extern "C" */
1177 #endif
1178 #endif /* ifndef INCLUDED_WHD_WIFI_H */
1179 
whd_result_t whd_arp_arpoe_get(whd_interface_t ifp, uint32_t *agent_enable)
Get ARP Offload Agent Enable from Device (WLAN)
whd_result_t whd_arp_version(whd_interface_t ifp, uint32_t *version)
Get version of Device (WLAN) Firmware.
uint32_t whd_wifi_get_ap_client_rssi(whd_interface_t ifp, int32_t *rssi, const whd_mac_t *client_mac)
Retrieve the associated STA's RSSI value.
uint32_t whd_wifi_set_passphrase(whd_interface_t ifp, const uint8_t *security_key, uint8_t key_length)
Set the passphrase.
uint32_t whd_wifi_leave(whd_interface_t ifp)
Disassociates from a Wi-Fi network.
Contains functions which allows WHD to pass received data to the network stack, to send an ethernet f...
whd_result_t whd_arp_stats_clear(whd_interface_t ifp)
Clear ARP Offload statistics in Device (WLAN)
uint32_t whd_bus_sdio_attach(whd_driver_t whd_driver, whd_sdio_config_t *whd_config, cyhal_sdio_t *sdio_obj)
Attach the WLAN Device to a specific SDIO bus.
Structure to store scan result parameters for each AP.
Definition: whd_types.h:711
whd_result_t whd_tko_get_FW_connect(whd_interface_t ifp, uint8_t index, whd_tko_connect_t *whd_connect, uint16_t buflen)
Return the stats associated with a filter.
Get/Set TKO intervals & retrys.
Definition: whd_wlioctl.h:3705
whd_result_t whd_arp_stats_print(whd_arp_stats_t *arp_stats, const char *title)
Print ARP Offload statistics NOTE: call whd_arp_stats_get(), then print them using this function...
uint32_t whd_wifi_get_powersave_mode(whd_interface_t ifp, uint32_t *value)
Get powersave mode on specified interface.
uint32_t whd_wifi_sae_password(whd_interface_t ifp, const uint8_t *security_key, uint8_t key_length)
Set the SAE password.
Provides abstract pointer type to act as instance for: driver, interface, buffer funcs, network funcs, resource funcs and bus funcs.
void whd_bus_sdio_detach(whd_driver_t whd_driver)
Detach the WLAN Device to a specific SDIO bus.
Structure for SDIO config parameters which can be set by application during whd power up...
Definition: whd_types.h:970
Structure for storing extended scan parameters.
Definition: whd_types.h:678
uint32_t whd_wifi_manage_custom_ie(whd_interface_t ifp, whd_custom_ie_action_t action, const uint8_t *oui, uint8_t subtype, const void *data, uint16_t length, uint16_t which_packets)
Manage the addition and removal of custom IEs.
uint32_t whd_wifi_get_bss_info(whd_interface_t ifp, wl_bss_info_t *bi)
Retrives the bss info.
uint32_t whd_wifi_set_up(whd_interface_t ifp)
Brings up the Wi-Fi core.
whd_result_t whd_arp_hostip_list_clear_id_string(whd_interface_t ifp, const char *ip_addr)
Clear One ARP Offload Host IP Identifier from Host IP List (mbed-style IP string) in Device (WLAN) ...
Structure for storing scan results.
Definition: whd_types.h:690
whd_scan_type_t
Enumeration of methods of scanning.
Definition: whd_types.h:219
uint32_t whd_wifi_enable_powersave(whd_interface_t ifp)
Enables powersave mode on specified interface without regard for throughput reduction.
whd_security_t
Enumeration of Wi-Fi security modes.
Definition: whd_types.h:182
uint32_t whd_wifi_get_wifi_version(whd_interface_t ifp, char *version, uint8_t length)
Retrieves the WLAN firmware version.
Structure for storing a Service Set Identifier (i.e.
Definition: whd_types.h:393
uint32_t whd_wifi_get_channel(whd_interface_t ifp, uint32_t *channel)
Get the current channel on the WLAN radio.
whd_result_t whd_arp_features_set(whd_interface_t ifp, uint32_t features)
Set ARP Offload Feature Flags in Device (WLAN)
uint32_t whd_wifi_get_rssi(whd_interface_t ifp, int32_t *rssi)
Retrieve the latest RSSI value.
uint32_t whd_network_get_ifidx_from_ifp(whd_interface_t ifp, uint8_t *ifidx)
Retrieves the ifidx from interface pointer.
void(* whd_scan_result_callback_t)(whd_scan_result_t **result_ptr, void *user_data, whd_scan_status_t status)
Scan result callback function pointer type.
Definition: whd_wifi_api.h:197
uint32_t whd_wifi_stop_scan(whd_interface_t ifp)
Abort a previously issued scan.
uint32_t whd_add_secondary_interface(whd_driver_t whd_drv, whd_mac_t *mac_addr, whd_interface_t *ifpp)
Creates a secondary interface.
uint32_t whd_wifi_set_ioctl_value(whd_interface_t ifp, uint32_t ioctl, uint32_t value)
Sends an IOCTL command - CDC_SET IOCTL value.
uint32_t whd_init(whd_driver_t *whd_driver_ptr, whd_init_config_t *whd_init_config, whd_resource_source_t *resource_ops, whd_buffer_funcs_t *buffer_ops, whd_netif_funcs_t *network_ops)
Initialize an instance of the WHD driver.
whd_result_t whd_pf_get_packet_filter_mask_and_pattern(whd_interface_t ifp, uint8_t filter_id, uint32_t max_size, uint8_t *mask, uint8_t *pattern, uint32_t *size_out)
Filters are implemented in WLAN subsystem as a bit pattern and matching bit mask that are applied to ...
whd_result_t whd_arp_arpoe_set(whd_interface_t ifp, uint32_t agent_enable)
Set ARP Offload Agent Enable in Device (WLAN) Set Enable/Disable of ARP Offload Agent.
whd_bool_t
Boolean values.
Definition: whd_types.h:162
uint32_t whd_wifi_get_acparams(whd_interface_t ifp, whd_edcf_ac_param_t *acp)
Retrieve the latest STA EDCF AC parameters.
Defines common data types used with WHD.
Callback< R(ArgTs...)> callback(R(*func)(ArgTs...)=nullptr) noexcept
Create a callback class with type inferred from the arguments.
Definition: Callback.h:678
Structure for storing 802.11 powersave listen interval values See whd_wifi_get_listen_interval for m...
Definition: whd_types.h:766
uint32_t whd_wifi_is_ready_to_transceive(whd_interface_t ifp)
Determines if a particular interface is ready to transceive ethernet packets.
uint32_t whd_wifi_deauth_sta(whd_interface_t ifp, whd_mac_t *mac, whd_dot11_reason_code_t reason)
Deauthenticates a STA which may or may not be associated to SoftAP.
whd_result_t whd_tko_get_status(whd_interface_t ifp, whd_tko_status_t *tko_status)
Return the tko status for all indexes.
whd_result_t whd_tko_toggle(whd_interface_t ifp, whd_bool_t enable)
Return the stats associated with a filter.
uint32_t whd_wifi_enable_powersave_with_throughput(whd_interface_t ifp, uint16_t return_to_sleep_delay)
Enables powersave mode on specified interface while attempting to maximise throughput.
uint32_t whd_wifi_unregister_multicast_address(whd_interface_t ifp, const whd_mac_t *mac)
Unregisters interest in a multicast address.
Structure for storing a MAC address (Wi-Fi Media Access Control address).
Definition: whd_types.h:385
whd_result_t whd_arp_cache_clear(whd_interface_t ifp)
Clear ARP Offload cache in Device (WLAN)
uint32_t whd_wifi_get_clm_version(whd_interface_t ifp, char *version, uint8_t length)
Retrieves the WLAN CLM version.
uint32_t whd_wifi_get_mac_address(whd_interface_t ifp, whd_mac_t *mac)
Retrieves the current Media Access Control (MAC) address (or Ethernet hardware address) of the 802...
uint32_t whd_wifi_print_whd_log(whd_driver_t whd_drv)
To print whd log information.
uint32_t whd_result_t
WHD result is specified as uint32_t value.
Definition: whd_types.h:776
uint32_t whd_wifi_get_associated_client_list(whd_interface_t ifp, void *client_list_buffer, uint16_t buffer_length)
Gets the current number of active connections.
whd_result_t whd_tko_param(whd_interface_t ifp, whd_tko_retry_t *whd_tko_retry, int set)
Set/Get TKO retry & interval parameters.
uint32_t whd_wifi_join_specific(whd_interface_t ifp, const whd_scan_result_t *ap, const uint8_t *security_key, uint8_t key_length)
Joins a specific Wi-Fi network.
whd_result_t whd_arp_hostip_list_add_string(whd_interface_t ifp, const char *ip_addr)
Add One ARP Offload Host IP Identifier to HostIP List (mbed-style IP string) to Device (WLAN) ...
Structure for coex config parameters which can be set by application.
Definition: whd_types.h:1018
uint32_t whd_wifi_start_ap(whd_interface_t ifp)
Start the infrastructure WiFi network (SoftAP) using the parameter set by whd_wifi_init_ap() and opti...
uint32_t whd_wifi_enable_supplicant(whd_interface_t ifp, whd_security_t auth_type)
Enable WHD internal supplicant.
uint32_t whd_wifi_init_ap(whd_interface_t ifp, whd_ssid_t *ssid, whd_security_t auth_type, const uint8_t *security_key, uint8_t key_length, uint8_t channel)
Initialises an infrastructure WiFi network (SoftAP)
whd_result_t whd_pf_enable_packet_filter(whd_interface_t ifp, uint8_t filter_id)
After a filter has been added it can be enabled or disabled as needed.
uint32_t whd_wifi_scan_synch(whd_interface_t ifp, whd_sync_scan_result_t *scan_result, uint32_t count)
Initiates a scan to search for 802.11 networks.
uint32_t whd_wifi_read_wlan_log(whd_driver_t whd_drv, char *buffer, uint32_t buffer_size)
To print whd log information.
whd_result_t whd_pf_add_packet_filter(whd_interface_t ifp, const whd_packet_filter_t *settings)
A filter must be added (e.g.
uint32_t whd_wifi_set_listen_interval(whd_interface_t ifp, uint8_t listen_interval, whd_listen_interval_time_unit_t time_unit)
Sets the 802.11 powersave listen interval for a Wi-Fi client, and communicates the listen interval to...
uint32_t whd_wifi_off(whd_interface_t ifp)
Turn off the Wi-Fi device.
uint32_t whd_wifi_set_down(whd_interface_t ifp)
Bring down the Wi-Fi core.
uint32_t whd_wifi_disable_powersave(whd_interface_t ifp)
Disables 802.11 power save mode on specified interface.
uint32_t whd_wifi_register_multicast_address(whd_interface_t ifp, const whd_mac_t *mac)
Registers interest in a multicast address.
whd_result_t whd_arp_hostip_list_add(whd_interface_t ifp, uint32_t *host_ipv4_list, uint32_t count)
Add ARP Offload Host IP Identifier(s) to HostIP List to Device (WLAN)
whd_listen_interval_time_unit_t
Enumeration of listen interval time unit types.
Definition: whd_types.h:263
uint32_t whd_wifi_ap_set_dtim_interval(whd_interface_t ifp, uint16_t interval)
Set the DTIM interval.
uint32_t whd_print_stats(whd_driver_t whd_drv, whd_bool_t reset_after_print)
Prints WHD stats.
Structure describing a packet filter list item.
Definition: whd_types.h:1037
Structure for storing WHD init configurations.
Definition: whd.h:70
uint32_t whd_wifi_ap_get_max_assoc(whd_interface_t ifp, uint32_t *max_assoc)
Get the maximum number of associations supported by AP interfaces.
whd_result_t whd_pf_disable_packet_filter(whd_interface_t ifp, uint8_t filter_id)
After a filter has been added it can be enabled or disabled as needed.
whd_result_t whd_arp_peerage_get(whd_interface_t ifp, uint32_t *seconds)
Get ARP Offload Peer Age from Device (WLAN) Length of time in seconds before aging out an entry in th...
whd_result_t whd_arp_peerage_set(whd_interface_t ifp, uint32_t seconds)
Set ARP Offload Peer Age in Device (WLAN) Length of time in seconds before aging out an entry in the ...
uint32_t whd_deinit(whd_interface_t ifp)
Shutdown this instance of the wifi driver, freeing all used resources.
whd_result_t whd_arp_hostip_list_clear_id(whd_interface_t ifp, uint32_t ipv4_addr)
Clear One ARP Offload Host IP Identifier from Host IP List in Device (WLAN)
uint32_t whd_wifi_scan(whd_interface_t ifp, whd_scan_type_t scan_type, whd_bss_type_t bss_type, const whd_ssid_t *optional_ssid, const whd_mac_t *optional_mac, const uint16_t *optional_channel_list, const whd_scan_extended_params_t *optional_extended_params, whd_scan_result_callback_t callback, whd_scan_result_t *result_ptr, void *user_data)
Initiates a scan to search for 802.11 networks.
whd_result_t whd_arp_features_get(whd_interface_t ifp, uint32_t *features)
Get ARP Offload Feature Flags from Device (WLAN)
whd_result_t whd_pf_remove_packet_filter(whd_interface_t ifp, uint8_t filter_id)
Remove a previously added filter.
uint32_t whd_wifi_get_ioctl_value(whd_interface_t ifp, uint32_t ioctl, uint32_t *value)
Sends an IOCTL command - CDC_GET IOCTL value.
Allows WHD to perform buffer related operations like, allocating, releasing, retrieving the current p...
whd_result_t whd_arp_hostip_list_get(whd_interface_t ifp, uint32_t count, uint32_t *host_ipv4_list, uint32_t *filled)
Get ARP Offload Host IP Identifiers from Device (WLAN)
whd_scan_status_t
Structure for storing scan status.
Definition: whd_types.h:272
uint32_t whd_network_get_bsscfgidx_from_ifp(whd_interface_t ifp, uint8_t *bsscfgidx)
Retrieves the bsscfgidx from interface pointer.
uint32_t whd_wifi_enable_sup_set_passphrase(whd_interface_t ifp, const uint8_t *security_key_psk, uint8_t psk_length, whd_security_t auth_type)
Enable WHD internal supplicant and set WPA2 passphrase in case of WPA3/WPA2 transition mode...
whd_dot11_reason_code_t
Enumeration of Dot11 Reason Codes.
Definition: whd_types.h:153
uint32_t whd_wifi_send_action_frame(whd_interface_t ifp, whd_af_params_t *af_params)
Send a pre-prepared action frame.
BSS(Basic Service Set) information structure.
Definition: whd_types.h:728
whd_result_t whd_arp_stats_get(whd_interface_t ifp, whd_arp_stats_t *stats)
Get ARP Offload statistics from Device (WLAN)
whd_result_t whd_arp_features_print(uint32_t features, const char *title)
Print ARP Offload Feature Flags in Human readable form to console.
uint32_t whd_wifi_get_bssid(whd_interface_t ifp, whd_mac_t *bssid)
Get the BSSID of the interface.
whd_result_t whd_tko_max_assoc(whd_interface_t ifp, uint8_t *max)
Return the stats associated with a filter.
whd_result_t whd_pf_get_packet_filter_stats(whd_interface_t ifp, uint8_t filter_id, whd_pkt_filter_stats_t *stats)
Return the stats associated with a filter.
whd_result_t whd_arp_hostip_list_clear(whd_interface_t ifp)
Clear all ARP Offload Host IP Identifier List.
Structure for SPI config parameters which can be set by application during whd power up...
Definition: whd_types.h:981
whd_result_t whd_wifi_clear_packet_filter_stats(whd_interface_t ifp, uint32_t filter_id)
Clear the packet filter stats associated with a filter id.
uint32_t whd_wifi_join(whd_interface_t ifp, const whd_ssid_t *ssid, whd_security_t auth_type, const uint8_t *security_key, uint8_t key_length)
Joins a Wi-Fi network.
uint32_t whd_bus_spi_attach(whd_driver_t whd_driver, whd_spi_config_t *whd_config, cyhal_spi_t *spi_obj)
Attach the WLAN Device to a specific SPI bus.
uint32_t whd_wifi_get_listen_interval(whd_interface_t ifp, whd_listen_interval_t *li)
Gets the current value of all beacon listen interval variables.
whd_bss_type_t
Enumeration of network types.
Definition: whd_types.h:231
void whd_bus_spi_detach(whd_driver_t whd_driver)
Detach the WLAN Device to a specific SPI bus.
uint32_t whd_wifi_get_iovar_buffer_with_param(whd_interface_t ifp, const char *iovar_name, void *param, uint32_t paramlen, uint8_t *out_buffer, uint32_t out_length)
Sends an IOVAR command.
uint32_t whd_wifi_get_ap_info(whd_interface_t ifp, whd_bss_info_t *ap_info, whd_security_t *security)
Retrieves AP information.
uint32_t whd_wifi_on(whd_driver_t whd_driver, whd_interface_t *ifpp)
Turn on the Wi-Fi device.
uint32_t whd_wifi_set_channel(whd_interface_t ifp, uint32_t channel)
Set the current channel on the WLAN radio.
whd_custom_ie_action_t
Enumeration of custom IE(Information Element) management actions.
Definition: whd_types.h:253
uint32_t whd_wifi_get_ioctl_buffer(whd_interface_t ifp, uint32_t ioctl, uint8_t *out_buffer, uint16_t out_length)
Sends an IOCTL command - CDC_GET IOCTL buffer.
uint32_t whd_wifi_set_coex_config(whd_interface_t ifp, whd_coex_config_t *coex_config)
Set coex configuration.
uint32_t whd_wifi_ap_set_beacon_interval(whd_interface_t ifp, uint16_t interval)
Set the beacon interval.
uint32_t whd_wifi_set_ioctl_buffer(whd_interface_t ifp, uint32_t ioctl, void *buffer, uint16_t buffer_length)
Sends an IOCTL command - CDC_SET IOCTL buffer.
whd_result_t whd_wifi_toggle_packet_filter(whd_interface_t ifp, uint8_t filter_id, whd_bool_t enable)
After a filter has been added it can be enabled or disabled as needed.
Interface to a data source that provides external resources to the radio driver.
uint32_t whd_wifi_stop_ap(whd_interface_t ifp)
Stops an existing infrastructure WiFi network.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.