whd_wifi_api.h 65 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607
  1. /*
  2. * Copyright 2024, Cypress Semiconductor Corporation (an Infineon company)
  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. /** @file
  18. * Prototypes of functions for controlling the Wi-Fi system
  19. *
  20. * This file provides prototypes for end-user functions which allow
  21. * actions such as scanning for Wi-Fi networks, joining Wi-Fi
  22. * networks, getting the MAC address, etc
  23. *
  24. */
  25. #include "cybsp.h"
  26. #include "whd.h"
  27. #include "whd_types.h"
  28. #ifndef INCLUDED_WHD_WIFI_API_H
  29. #define INCLUDED_WHD_WIFI_API_H
  30. #ifdef __cplusplus
  31. extern "C"
  32. {
  33. #endif
  34. #define REMAINING_LEN(ptr, type, member) \
  35. (sizeof(*(ptr)) - offsetof(type, member) - sizeof((ptr)->member))
  36. /******************************************************
  37. * Function declarations
  38. ******************************************************/
  39. /** @addtogroup wifi WHD Wi-Fi API
  40. * APIs for controlling the Wi-Fi system
  41. * @{
  42. */
  43. /** @addtogroup wifimanagement WHD Wi-Fi Management API
  44. * @ingroup wifi
  45. * Initialisation and other management functions for WHD system
  46. * @{
  47. */
  48. /** Initialize an instance of the WHD driver
  49. *
  50. * @param whd_driver_ptr Pointer to Pointer to handle instance of the driver
  51. * @param whd_init_config Pointer to configuration data that controls how the driver is initialized
  52. * @param resource_ops Pointer to resource interface to provide resources to the driver initialization process
  53. * @param buffer_ops Pointer to a buffer interface to provide buffer related services to the driver instance
  54. * @param network_ops Pointer to a whd_netif_funcs_t to provide network stack services to the driver instance
  55. *
  56. * @return WHD_SUCCESS or Error code
  57. */
  58. extern whd_result_t whd_init(whd_driver_t *whd_driver_ptr, whd_init_config_t *whd_init_config,
  59. whd_resource_source_t *resource_ops, whd_buffer_funcs_t *buffer_ops,
  60. whd_netif_funcs_t *network_ops);
  61. /* @} */
  62. /* @} */
  63. /** @addtogroup busapi WHD Bus API
  64. * Allows WHD to operate with specific SDIO/SPI bus
  65. * @{
  66. */
  67. #if (CYBSP_WIFI_INTERFACE_TYPE == CYBSP_SDIO_INTERFACE) && !defined(COMPONENT_WIFI_INTERFACE_OCI)
  68. /** Attach the WLAN Device to a specific SDIO bus
  69. *
  70. * @param whd_driver Pointer to handle instance of the driver
  71. * @param whd_config Configuration for SDIO bus
  72. * @param sdio_obj The SDHC hardware interface, from the Level 3 CY HW APIs
  73. *
  74. * @return WHD_SUCCESS or Error code
  75. */
  76. extern whd_result_t whd_bus_sdio_attach(whd_driver_t whd_driver, whd_sdio_config_t *whd_config, cyhal_sdio_t *sdio_obj);
  77. /** Detach the WLAN Device to a specific SDIO bus
  78. *
  79. * @param whd_driver Pointer to handle instance of the driver
  80. */
  81. extern void whd_bus_sdio_detach(whd_driver_t whd_driver);
  82. #elif (CYBSP_WIFI_INTERFACE_TYPE == CYBSP_SPI_INTERFACE)
  83. /** Attach the WLAN Device to a specific SPI bus
  84. *
  85. * @param whd_driver Pointer to handle instance of the driver
  86. * @param whd_config Configuration for SPI bus
  87. * @param spi_obj The SPI hardware interface, from the Level 3 CY HW APIs
  88. *
  89. * @return WHD_SUCCESS or Error code
  90. */
  91. extern whd_result_t whd_bus_spi_attach(whd_driver_t whd_driver, whd_spi_config_t *whd_config, cyhal_spi_t *spi_obj);
  92. /** Detach the WLAN Device to a specific SPI bus
  93. *
  94. * @param whd_driver Pointer to handle instance of the driver
  95. */
  96. extern void whd_bus_spi_detach(whd_driver_t whd_driver);
  97. #elif (CYBSP_WIFI_INTERFACE_TYPE == CYBSP_M2M_INTERFACE)
  98. /** Attach the WLAN Device to M2M bus
  99. *
  100. * @param whd_driver Pointer to handle instance of the driver
  101. * @param whd_config Configuration for M2M bus
  102. * @param m2m_obj The M2M hardware interface, from the Level 3 CY HW APIs
  103. *
  104. * @return WHD_SUCCESS or Error code
  105. */
  106. extern whd_result_t whd_bus_m2m_attach(whd_driver_t whd_driver, whd_m2m_config_t *whd_config, cyhal_m2m_t *m2m_obj);
  107. /** Detach the WLAN Device to a specific M2M bus
  108. *
  109. * @param whd_driver Pointer to handle instance of the driver
  110. */
  111. extern void whd_bus_m2m_detach(whd_driver_t whd_driver);
  112. #elif defined(COMPONENT_WIFI_INTERFACE_OCI)
  113. /** Attach the WLAN Device to AXI(OCI) bus
  114. *
  115. * @param whd_driver Pointer to handle instance of the driver
  116. * @param whd_config Configuration for OCI(AXI) bus
  117. * @param oci_obj The OCI interface, from the Level 3 CY HW APIs
  118. *
  119. * @return WHD_SUCCESS or Error code
  120. */
  121. extern whd_result_t whd_bus_oci_attach(whd_driver_t whd_driver, whd_oci_config_t *whd_config);
  122. /** Detach the WLAN Device to a specific AXI(OCI) bus
  123. *
  124. * @param whd_driver Pointer to handle instance of the driver
  125. */
  126. extern void whd_bus_oci_detach(whd_driver_t whd_driver);
  127. #else
  128. error "CYBSP_WIFI_INTERFACE_TYPE or COMPONENT_WIFI_INTERFACE_OCI is not defined"
  129. #endif
  130. /* @} */
  131. /** @addtogroup wifi WHD Wi-Fi API
  132. * APIs for controlling the Wi-Fi system
  133. * @{
  134. */
  135. /** @addtogroup wifimanagement WHD Wi-Fi Management API
  136. * @ingroup wifi
  137. * Initialisation and other management functions for WHD system
  138. * @{
  139. */
  140. /**
  141. * Turn on the Wi-Fi device
  142. *
  143. * Initialise Wi-Fi platform
  144. * Program various WiFi parameters and modes
  145. *
  146. * @param whd_driver Pointer to handle instance of the driver
  147. * @param ifpp Pointer to Pointer to handle instance of whd interface
  148. *
  149. * @return WHD_SUCCESS if initialization is successful, error code otherwise
  150. */
  151. extern whd_result_t whd_wifi_on(whd_driver_t whd_driver, whd_interface_t *ifpp);
  152. /**
  153. * Turn off the Wi-Fi device
  154. *
  155. * - De-Initialises the required parts of the hardware platform
  156. * i.e. pins for SDIO/SPI, interrupt, reset, power etc.
  157. *
  158. * - De-Initialises the whd thread which arbitrates access
  159. * to the SDIO/SPI bus
  160. *
  161. * @param ifp Pointer to handle instance of whd interface
  162. *
  163. * @return WHD_SUCCESS if deinitialization is successful, Error code otherwise
  164. */
  165. extern whd_result_t whd_wifi_off(whd_interface_t ifp);
  166. /** Shutdown this instance of the wifi driver, freeing all used resources
  167. *
  168. * @param ifp Pointer to handle instance of whd interface
  169. *
  170. * @return WHD_SUCCESS or Error code
  171. */
  172. extern whd_result_t whd_deinit(whd_interface_t ifp);
  173. /** Brings up the Wi-Fi core
  174. *
  175. * @param ifp Pointer to handle instance of whd interface
  176. *
  177. * @return WHD_SUCCESS or Error code
  178. */
  179. extern whd_result_t whd_wifi_set_up(whd_interface_t ifp);
  180. /** Bring down the Wi-Fi core
  181. *
  182. * WARNING / NOTE:
  183. * This brings down the Wi-Fi core and existing network connections will be lost.
  184. *
  185. * @param ifp Pointer to handle instance of whd interface
  186. *
  187. * @return WHD_SUCCESS or Error code
  188. */
  189. extern whd_result_t whd_wifi_set_down(whd_interface_t ifp);
  190. /** Creates a secondary interface
  191. *
  192. * @param whd_drv Pointer to handle instance of the driver
  193. * @param mac_addr MAC address for the interface
  194. * @param ifpp Pointer to the whd interface pointer
  195. *
  196. * @return WHD_SUCCESS or Error code
  197. */
  198. extern whd_result_t whd_add_secondary_interface(whd_driver_t whd_drv, whd_mac_t *mac_addr, whd_interface_t *ifpp);
  199. /* @} */
  200. /** @addtogroup wifijoin WHD Wi-Fi Join, Scan and Halt API
  201. * @ingroup wifi
  202. * Wi-Fi APIs for join, scan & leave
  203. * @{
  204. */
  205. /** Scan result callback function pointer type
  206. *
  207. * @param result_ptr A pointer to the pointer that indicates where to put the next scan result
  208. * @param user_data User provided data
  209. * @param status Status of scan process
  210. */
  211. typedef void (*whd_scan_result_callback_t)(whd_scan_result_t **result_ptr, void *user_data, whd_scan_status_t status);
  212. /** Initiates a scan to search for 802.11 networks.
  213. *
  214. * This functions returns the scan results with limited sets of parameter in a buffer provided by the caller.
  215. * It is also a blocking call. It is an simplified version of the whd_wifi_scan().
  216. *
  217. * @param ifp Pointer to handle instance of whd interface
  218. * @param scan_result Pointer to user requested records buffer.
  219. * @param count Pointer to the no of records user is interested in, and also to the no of record received.
  220. *
  221. * @note When scanning specific channels, devices with a strong signal strength on nearby channels may be detected
  222. *
  223. * @return WHD_SUCCESS or Error code
  224. */
  225. extern whd_result_t whd_wifi_scan_synch(whd_interface_t ifp,
  226. whd_sync_scan_result_t *scan_result,
  227. uint32_t *count
  228. );
  229. /** Initiates a scan to search for 802.11 networks.
  230. *
  231. * The scan progressively accumulates results over time, and may take between 1 and 10 seconds to complete.
  232. * The results of the scan will be individually provided to the callback function.
  233. * Note: The callback function will be executed in the context of the WHD thread and so must not perform any
  234. * actions that may cause a bus transaction.
  235. *
  236. * @param ifp Pointer to handle instance of whd interface
  237. * @param scan_type Specifies whether the scan should be Active, Passive or scan Prohibited channels
  238. * @param bss_type Specifies whether the scan should search for Infrastructure networks (those using
  239. * an Access Point), Ad-hoc networks, or both types.
  240. * @param optional_ssid If this is non-Null, then the scan will only search for networks using the specified SSID.
  241. * @param optional_mac If this is non-Null, then the scan will only search for networks where
  242. * the BSSID (MAC address of the Access Point) matches the specified MAC address.
  243. * @param optional_channel_list If this is non-Null, then the scan will only search for networks on the
  244. * specified channels - array of channel numbers to search, terminated with a zero
  245. * @param optional_extended_params If this is non-Null, then the scan will obey the specifications about
  246. * dwell times and number of probes.
  247. * @param callback The callback function which will receive and process the result data.
  248. * @param result_ptr Pointer to a pointer to a result storage structure.
  249. * @param user_data user specific data that will be passed directly to the callback function
  250. *
  251. * @note - When scanning specific channels, devices with a strong signal strength on nearby channels may be detected
  252. * - Callback must not use blocking functions, nor use WHD functions, since it is called from the context of the
  253. * WHD thread.
  254. * - The callback, result_ptr and user_data variables will be referenced after the function returns.
  255. * Those variables must remain valid until the scan is complete.
  256. *
  257. * @return WHD_SUCCESS or Error code
  258. */
  259. extern whd_result_t whd_wifi_scan(whd_interface_t ifp,
  260. whd_scan_type_t scan_type,
  261. whd_bss_type_t bss_type,
  262. const whd_ssid_t *optional_ssid,
  263. const whd_mac_t *optional_mac,
  264. const uint16_t *optional_channel_list,
  265. const whd_scan_extended_params_t *optional_extended_params,
  266. whd_scan_result_callback_t callback,
  267. whd_scan_result_t *result_ptr,
  268. void *user_data);
  269. /** Abort a previously issued scan
  270. *
  271. * @param ifp Pointer to handle instance of whd interface
  272. *
  273. * @return WHD_SUCCESS or Error code
  274. */
  275. extern whd_result_t whd_wifi_stop_scan(whd_interface_t ifp);
  276. /** Auth result callback function pointer type
  277. *
  278. * @param result_ptr A pointer to the pointer that indicates where to put the auth result
  279. * @param len the size of result
  280. * @param status Status of auth process
  281. * @param flag flag of h2e will be indicated in auth request event, otherwise is NULL.
  282. * @param user_data user specific data that will be passed directly to the callback function
  283. *
  284. */
  285. typedef void (*whd_auth_result_callback_t)(void *result_ptr, uint32_t len, whd_auth_status_t status, uint8_t *flag,
  286. void *user_data);
  287. /** Initiates SAE auth
  288. *
  289. * The results of the auth will be individually provided to the callback function.
  290. * Note: The callback function will be executed in the context of the WHD thread and so must not perform any
  291. * actions that may cause a bus transaction.
  292. *
  293. * @param ifp Pointer to handle instance of whd interface
  294. * @param callback The callback function which will receive and process the result data.
  295. * @param result_ptr Pointer to a pointer to a result storage structure.
  296. * @param user_data user specific data that will be passed directly to the callback function
  297. *
  298. * @note - Callback must not use blocking functions, nor use WHD functions, since it is called from the context of the
  299. * WHD thread.
  300. * - The callback, result_ptr and user_data variables will be referenced after the function returns.
  301. * Those variables must remain valid until the scan is complete.
  302. *
  303. * @return WHD_SUCCESS or Error code
  304. */
  305. extern whd_result_t whd_wifi_external_auth_request(whd_interface_t ifp,
  306. whd_auth_result_callback_t callback,
  307. void *result_ptr,
  308. void *user_data);
  309. /** Abort authentication request
  310. *
  311. * @param ifp Pointer to handle instance of whd interface
  312. *
  313. * @return WHD_SUCCESS or Error code
  314. */
  315. extern whd_result_t whd_wifi_stop_external_auth_request(whd_interface_t ifp);
  316. /** Joins a Wi-Fi network
  317. *
  318. * Scans for, associates and authenticates with a Wi-Fi network.
  319. * On successful return, the system is ready to send data packets.
  320. *
  321. * @param ifp Pointer to handle instance of whd interface
  322. * @param ssid A null terminated string containing the SSID name of the network to join
  323. * @param auth_type Authentication type
  324. * @param security_key A byte array containing either the cleartext security key for WPA/WPA2/WPA3 secured networks
  325. * @param key_length The length of the security_key in bytes.
  326. *
  327. * @note In case of WPA3/WPA2 transition mode, the security_key value is WPA3 password.
  328. *
  329. * @return WHD_SUCCESS when the system is joined and ready to send data packets
  330. * Error code if an error occurred
  331. */
  332. extern whd_result_t whd_wifi_join(whd_interface_t ifp, const whd_ssid_t *ssid, whd_security_t auth_type,
  333. const uint8_t *security_key, uint8_t key_length);
  334. /** Joins a specific Wi-Fi network
  335. *
  336. * Associates and authenticates with a specific Wi-Fi access point.
  337. * On successful return, the system is ready to send data packets.
  338. *
  339. * @param ifp Pointer to handle instance of whd interface
  340. * @param ap A pointer to a whd_scan_result_t structure containing AP details and
  341. * set ap.channel to 0 for unspecificed channel
  342. * @param security_key A byte array containing either the cleartext security key for WPA/WPA2
  343. * secured networks
  344. * @param key_length The length of the security_key in bytes.
  345. *
  346. * @return WHD_SUCCESS when the system is joined and ready to send data packets
  347. * Error code if an error occurred
  348. */
  349. extern whd_result_t whd_wifi_join_specific(whd_interface_t ifp, const whd_scan_result_t *ap, const uint8_t *security_key,
  350. uint8_t key_length);
  351. /** Set the current chanspec on the WLAN radio
  352. *
  353. * @note On most WLAN devices this will set the chanspec for both AP *AND* STA
  354. * (since there is only one radio - it cannot be on two chanspec simulaneously)
  355. *
  356. * @param ifp Pointer to handle instance of whd interface
  357. * @param chanspec The desired chanspec
  358. *
  359. * @return WHD_SUCCESS if the chanspec was successfully set
  360. * Error code if the chanspec was not successfully set
  361. */
  362. extern whd_result_t whd_wifi_set_chanspec(whd_interface_t ifp, wl_chanspec_t chanspec);
  363. /* @} */
  364. /** @addtogroup wifiutilities WHD Wi-Fi Utility API
  365. * @ingroup wifi
  366. * Allows WHD to perform utility operations
  367. * @{
  368. */
  369. /** Set the current channel on the WLAN radio
  370. *
  371. * @note On most WLAN devices this will set the channel for both AP *AND* STA
  372. * (since there is only one radio - it cannot be on two channels simulaneously)
  373. *
  374. * @param ifp Pointer to handle instance of whd interface
  375. * @param channel The desired channel
  376. *
  377. * @return WHD_SUCCESS if the channel was successfully set
  378. * Error code if the channel was not successfully set
  379. */
  380. extern whd_result_t whd_wifi_set_channel(whd_interface_t ifp, uint32_t channel);
  381. /** Get the current channel on the WLAN radio
  382. *
  383. * @note On most WLAN devices this will get the channel for both AP *AND* STA
  384. * (since there is only one radio - it cannot be on two channels simulaneously)
  385. *
  386. * @param ifp Pointer to handle instance of whd interface
  387. * @param channel Pointer to receive the current channel
  388. *
  389. * @return WHD_SUCCESS if the channel was successfully retrieved
  390. * Error code if the channel was not successfully retrieved
  391. */
  392. extern whd_result_t whd_wifi_get_channel(whd_interface_t ifp, uint32_t *channel);
  393. /** Gets the supported channels
  394. *
  395. * @param ifp Pointer to handle instance of whd interface
  396. * @param channel_list Buffer to store list of the supported channels
  397. * and max channel is MAXCHANNEL
  398. *
  399. * @return WHD_SUCCESS if the active connections was successfully read
  400. * WHD_ERROR if the active connections was not successfully read
  401. */
  402. extern whd_result_t whd_wifi_get_channels(whd_interface_t ifp, whd_list_t *channel_list);
  403. /** Set the passphrase
  404. *
  405. * @param ifp Pointer to handle instance of whd interface
  406. * @param security_key The security key (passphrase) which is to be set
  407. * @param key_length length of the key
  408. *
  409. * @return WHD_SUCCESS when the key is set
  410. * Error code if an error occurred
  411. */
  412. extern whd_result_t whd_wifi_set_passphrase(whd_interface_t ifp, const uint8_t *security_key, uint8_t key_length);
  413. /** Set the SAE password
  414. *
  415. * @param ifp Pointer to handle instance of whd interface
  416. * @param security_key The security key (password) which is to be set
  417. * @param key_length length of the key
  418. *
  419. * @return WHD_SUCCESS when the key is set
  420. * Error code if an error occurred
  421. */
  422. extern whd_result_t whd_wifi_sae_password(whd_interface_t ifp, const uint8_t *security_key, uint8_t key_length);
  423. /** Set the offload configuration
  424. *
  425. * @param ifp Pointer to handle instance of whd interface
  426. * @param ol_feat Offload Skip bitmap
  427. * @param reset reset or set configuration
  428. *
  429. * @return WHD_SUCCESS when the offload config is set/reset
  430. * Error code if an error occurred
  431. */
  432. extern whd_result_t whd_wifi_offload_config(whd_interface_t ifp, uint32_t ol_feat, uint32_t reset);
  433. /** Update IPV4 address
  434. *
  435. * @param ifp Pointer to handle instance of whd interface
  436. * @param ol_feat Offload Skip bitmap
  437. * @param ipv4_addr set ipv4 address
  438. * @param is_add To add or delete IPV4 address
  439. *
  440. * @return WHD_SUCCESS when the ipv4 address updated or not
  441. * Error code if an error occurred
  442. */
  443. extern whd_result_t whd_wifi_offload_ipv4_update(whd_interface_t ifp, uint32_t ol_feat, uint32_t ipv4_addr, whd_bool_t is_add);
  444. /** Update IPV6 address
  445. *
  446. * @param ifp Pointer to handle instance of whd interface
  447. * @param ol_feat Offload Skip bitmap
  448. * @param ipv6_addr set ipv6 address
  449. * @param type set 0:unicast 1:anycast
  450. * @param is_add To add or delete IPV6 address
  451. *
  452. * @return WHD_SUCCESS when the ipv6 address updated or not
  453. * Error code if an error occurred
  454. */
  455. extern whd_result_t whd_wifi_offload_ipv6_update(whd_interface_t ifp, uint32_t ol_feat, uint32_t *ipv6_addr, uint8_t type, whd_bool_t is_add);
  456. /** Enable the offload module
  457. *
  458. * @param ifp Pointer to handle instance of whd interface
  459. * @param ol_feat Offload Skip bitmap
  460. * @param enable Enable/Disable offload module
  461. *
  462. * @return WHD_SUCCESS when offload module enabled or not
  463. * Error code if an error occurred
  464. */
  465. extern whd_result_t whd_wifi_offload_enable(whd_interface_t ifp, uint32_t ol_feat, uint32_t enable);
  466. /** Configure the offload module
  467. *
  468. * @param ifp Pointer to handle instance of whd interface
  469. * @param set_wowl value indicates, which are all wowl bits to be set
  470. *
  471. * @return WHD_SUCCESS when offload module enabled or not
  472. * Error code if an error occurred
  473. */
  474. extern whd_result_t whd_configure_wowl(whd_interface_t ifp, uint32_t set_wowl);
  475. /** Configure the Keep Alive offload module
  476. *
  477. * @param ifp Pointer to handle instance of whd interface
  478. * @param packet whd period,len_bytes & Data parameter structure
  479. * @param flag Flag to set NULL(0)/NAT(1) keepalive
  480. *
  481. * @return WHD_SUCCESS when offload module enabled or not
  482. * Error code if an error occurred
  483. */
  484. extern whd_result_t whd_wifi_keepalive_config(whd_interface_t ifp, whd_keep_alive_t * packet, uint8_t flag);
  485. /** Configure the TKO offload module
  486. *
  487. * @param ifp Pointer to handle instance of whd interface
  488. * @param enable Enable/Disable TCP Keepalive offload
  489. *
  490. * @return WHD_SUCCESS when offload module enabled or not
  491. * Error code if an error occurred
  492. */
  493. extern whd_result_t whd_configure_tko_offload(whd_interface_t ifp, whd_bool_t enable);
  494. /** Configure the TKO filter module
  495. *
  496. * @param ifp Pointer to handle instance of whd interface
  497. * @param whd_filter wl_filter structure buffer from Firmware
  498. * @param filter_flag To set filter
  499. *
  500. * @return WHD_SUCCESS when offload module enabled or not
  501. * Error code if an error occurred
  502. */
  503. extern whd_result_t whd_configure_tko_filter(whd_interface_t ifp, whd_tko_auto_filter_t * whd_filter, uint8_t filter_flag);
  504. /** Enable WHD internal supplicant and set WPA2 passphrase in case of WPA3/WPA2 transition mode
  505. *
  506. * @param ifp Pointer to handle instance of whd interface
  507. * @param security_key_psk The security key (passphrase) which is to be set
  508. * @param psk_length length of the key
  509. * @param auth_type Authentication type: @ref WHD_SECURITY_WPA3_WPA2_PSK
  510. *
  511. * @return WHD_SUCCESS when the supplicant variable and wpa2 passphrase is set
  512. * Error code if an error occurred
  513. */
  514. extern whd_result_t whd_wifi_enable_sup_set_passphrase(whd_interface_t ifp, const uint8_t *security_key_psk,
  515. uint8_t psk_length, whd_security_t auth_type);
  516. /** Set the PMK Key
  517. *
  518. * @param ifp Pointer to handle instance of whd interface
  519. * @param security_key The security key (PMK) which is to be set
  520. * @param key_length length of the PMK(It must be 32 bytes)
  521. *
  522. * @return WHD_SUCCESS when the key is set
  523. * Error code if an error occurred
  524. */
  525. extern whd_result_t whd_wifi_set_pmk(whd_interface_t ifp, const uint8_t *security_key, uint8_t key_length);
  526. /** Set the Roam time threshold
  527. *
  528. * @param ifp Pointer to handle instance of whd interface
  529. * @param roam_time_threshold The maximum roam time threshold which is to be set
  530. *
  531. * @return WHD_SUCCESS when the roam_time_threshold is set
  532. * Error code if an error occurred
  533. */
  534. extern whd_result_t whd_wifi_set_roam_time_threshold(whd_interface_t ifp, uint32_t roam_time_threshold);
  535. /** Enable WHD internal supplicant
  536. *
  537. * @param ifp Pointer to handle instance of whd interface
  538. * @param auth_type Authentication type
  539. *
  540. * @return WHD_SUCCESS when the supplicant variable is set
  541. * Error code if an error occurred
  542. */
  543. extern whd_result_t whd_wifi_enable_supplicant(whd_interface_t ifp, whd_security_t auth_type);
  544. /** Set PMKID in Device (WLAN)
  545. *
  546. * @param ifp Pointer to handle instance of whd interface
  547. * @param pmkid Pointer to BSSID and PMKID(16 bytes)
  548. *
  549. * @return whd_result_t
  550. */
  551. extern whd_result_t whd_wifi_set_pmksa(whd_interface_t ifp, const pmkid_t *pmkid);
  552. /** Clear all PMKIDs in Device (WLAN), especially the PMKIDs in Supplicant module
  553. *
  554. * @param ifp Pointer to handle instance of whd interface
  555. *
  556. * @return whd_result_t
  557. */
  558. extern whd_result_t whd_wifi_pmkid_clear(whd_interface_t ifp);
  559. /** Retrieve the latest RSSI value
  560. *
  561. * @param ifp Pointer to handle instance of whd interface
  562. * @param rssi The location where the RSSI value will be stored
  563. *
  564. * @return WHD_SUCCESS if the RSSI was successfully retrieved
  565. * Error code if the RSSI was not retrieved
  566. */
  567. extern whd_result_t whd_wifi_get_rssi(whd_interface_t ifp, int32_t *rssi);
  568. /** Retrieve the latest Roam time threshold value
  569. *
  570. * @param ifp Pointer to handle instance of whd interface
  571. * @param roam_time_threshold The location where the roam time threshold value will be stored
  572. *
  573. * @return WHD_SUCCESS if the roam time threshold was successfully retrieved
  574. * Error code if the roam time threshold was not retrieved
  575. */
  576. extern whd_result_t whd_wifi_get_roam_time_threshold(whd_interface_t ifp, uint32_t *roam_time_threshold);
  577. /** Retrieve the associated STA's RSSI value
  578. *
  579. * @param ifp : Pointer to handle instance of whd interface
  580. * @param rssi : The location where the RSSI value will be stored
  581. * @param client_mac : Pointer to associated client's MAC address
  582. *
  583. * @return WHD_SUCCESS : if the RSSI was successfully retrieved
  584. * Error code : if the RSSI was not retrieved
  585. */
  586. extern whd_result_t whd_wifi_get_ap_client_rssi(whd_interface_t ifp, int32_t *rssi, const whd_mac_t *client_mac);
  587. /* @} */
  588. /** @addtogroup wifijoin WHD Wi-Fi Join, Scan and Halt API
  589. * @ingroup wifi
  590. * Wi-Fi APIs for join, scan & leave
  591. * @{
  592. */
  593. /** Disassociates from a Wi-Fi network.
  594. * Applicable only for STA role
  595. *
  596. * @param ifp Pointer to handle instance of whd interface.
  597. *
  598. * @return WHD_SUCCESS On successful disassociation from the AP
  599. * Error code If an error occurred
  600. */
  601. extern whd_result_t whd_wifi_leave(whd_interface_t ifp);
  602. /* @} */
  603. /** @addtogroup wifiutilities WHD Wi-Fi Utility API
  604. * @ingroup wifi
  605. * Allows WHD to perform utility operations
  606. * @{
  607. */
  608. /** Retrieves the current Media Access Control (MAC) address
  609. * (or Ethernet hardware address) of the 802.11 device
  610. *
  611. * @param ifp Pointer to handle instance of whd interface
  612. * @param mac Pointer to a variable that the current MAC address will be written to
  613. *
  614. * @return WHD_SUCCESS or Error code
  615. */
  616. extern whd_result_t whd_wifi_get_mac_address(whd_interface_t ifp, whd_mac_t *mac);
  617. /** Get the BSSID of the interface
  618. *
  619. * @param ifp Pointer to the whd_interface_t
  620. * @param bssid Returns the BSSID address (mac address) if associated
  621. *
  622. * @return WHD_SUCCESS or Error code
  623. */
  624. extern whd_result_t whd_wifi_get_bssid(whd_interface_t ifp, whd_mac_t *bssid);
  625. /* @} */
  626. /** @addtogroup wifisoftap WHD Wi-Fi SoftAP API
  627. * @ingroup wifi
  628. * Wi-Fi APIs to perform SoftAP related functionalities
  629. * @{
  630. */
  631. /** Initialises an infrastructure WiFi network (SoftAP)
  632. *
  633. * @param ifp Pointer to handle instance of whd interface
  634. * @param ssid A null terminated string containing the SSID name of the network to join
  635. * @param auth_type Authentication type
  636. * @param security_key A byte array containing the cleartext security key for the network
  637. * @param key_length The length of the security_key in bytes.
  638. * @param chanspec The desired chanspec
  639. *
  640. * @return WHD_SUCCESS if successfully initialises an AP
  641. * Error code if an error occurred
  642. */
  643. extern whd_result_t whd_wifi_init_ap(whd_interface_t ifp, whd_ssid_t *ssid, whd_security_t auth_type,
  644. const uint8_t *security_key, uint8_t key_length, uint16_t chanspec);
  645. /** Start the infrastructure WiFi network (SoftAP)
  646. * using the parameter set by whd_wifi_init_ap() and optionaly by whd_wifi_manage_custom_ie()
  647. *
  648. * @return WHD_SUCCESS if successfully creates an AP
  649. * Error code if an error occurred
  650. */
  651. extern whd_result_t whd_wifi_start_ap(whd_interface_t ifp);
  652. /** Stops an existing infrastructure WiFi network
  653. *
  654. * @param ifp Pointer to handle instance of whd interface
  655. *
  656. * @return WHD_SUCCESS if the AP is successfully stopped or if the AP has not yet been brought up
  657. * Error code if an error occurred
  658. */
  659. extern whd_result_t whd_wifi_stop_ap(whd_interface_t ifp);
  660. /** Get the maximum number of associations supported by AP interfaces
  661. *
  662. * @param ifp Pointer to handle instance of whd interface
  663. * @param max_assoc The maximum number of associations supported by Soft AP interfaces.
  664. *
  665. * @return WHD_SUCCESS if the maximum number of associated clients was successfully read
  666. * WHD_ERROR if the maximum number of associated clients was not successfully read
  667. */
  668. extern whd_result_t whd_wifi_ap_get_max_assoc(whd_interface_t ifp, uint32_t *max_assoc);
  669. /** Gets the current number of active connections
  670. *
  671. * @param ifp Pointer to handle instance of whd interface
  672. * @param client_list_buffer Buffer to store list of associated clients
  673. * @param buffer_length Length of client list buffer
  674. *
  675. * @return WHD_SUCCESS if the active connections was successfully read
  676. * WHD_ERROR if the active connections was not successfully read
  677. */
  678. extern whd_result_t whd_wifi_get_associated_client_list(whd_interface_t ifp, void *client_list_buffer,
  679. uint16_t buffer_length);
  680. /** Deauthenticates a STA which may or may not be associated to SoftAP
  681. *
  682. * @param ifp Pointer to handle instance of whd interface
  683. * @param mac Pointer to a variable containing the MAC address to which the deauthentication will be sent
  684. * NULL mac address will deauthenticate all the associated STAs
  685. *
  686. * @param reason Deauthentication reason code
  687. *
  688. * @return WHD_SUCCESS On successful deauthentication of the other STA
  689. * WHD_ERROR If an error occurred
  690. */
  691. extern whd_result_t whd_wifi_deauth_sta(whd_interface_t ifp, whd_mac_t *mac, whd_dot11_reason_code_t reason);
  692. /** Retrieves AP information
  693. *
  694. * @param ifp Pointer to handle instance of whd interface
  695. * @param ap_info Returns a whd_bss_info_t structure containing AP details
  696. * @param security Authentication type
  697. *
  698. * @return WHD_SUCCESS if the AP info was successfully retrieved
  699. * Error code if the AP info was not successfully retrieved
  700. */
  701. extern whd_result_t whd_wifi_get_ap_info(whd_interface_t ifp, whd_bss_info_t *ap_info, whd_security_t *security);
  702. /** Set the beacon interval.
  703. *
  704. * Note that the value needs to be set before ap_start in order to beacon interval to take effect.
  705. *
  706. * @param ifp Pointer to handle instance of whd interface
  707. * @param interval Beacon interval in time units (Default: 100 time units = 102.4 ms)
  708. *
  709. * @return WHD_SUCCESS or Error code
  710. */
  711. extern whd_result_t whd_wifi_ap_set_beacon_interval(whd_interface_t ifp, uint16_t interval);
  712. /** Set the DTIM interval.
  713. *
  714. * Note that the value needs to be set before ap_start in order to DTIM interval to take effect.
  715. *
  716. * @param ifp Pointer to handle instance of whd interface
  717. * @param interval DTIM interval, in unit of beacon interval
  718. *
  719. * @return WHD_SUCCESS or Error code
  720. */
  721. extern whd_result_t whd_wifi_ap_set_dtim_interval(whd_interface_t ifp, uint16_t interval);
  722. /* @} */
  723. /** @addtogroup wifipowersave WHD Wi-Fi Power Save API
  724. * @ingroup wifi
  725. * Wi-Fi functions for WLAN low power modes
  726. * @{
  727. */
  728. /** Enables powersave mode on specified interface without regard for throughput reduction
  729. *
  730. * This function enables (legacy) 802.11 PS-Poll mode and should be used
  731. * to achieve the lowest power consumption possible when the Wi-Fi device
  732. * is primarily passively listening to the network
  733. *
  734. * @param ifp Pointer to handle instance of whd interface
  735. *
  736. * @return WHD_SUCCESS or Error code
  737. */
  738. extern whd_result_t whd_wifi_enable_powersave(whd_interface_t ifp);
  739. /** Enables powersave mode on specified interface while attempting to maximise throughput
  740. *
  741. *
  742. * Network traffic is typically bursty. Reception of a packet often means that another
  743. * packet will be received shortly afterwards (and vice versa for transmit).
  744. *
  745. * In high throughput powersave mode, rather then entering powersave mode immediately
  746. * after receiving or sending a packet, the WLAN chip waits for a timeout period before
  747. * returning to sleep.
  748. *
  749. * @param ifp Pointer to handle instance of whd interface
  750. * @param return_to_sleep_delay The variable to set return to sleep delay.
  751. * return to sleep delay must be set to a multiple of 10 and not equal to zero.
  752. *
  753. * @return WHD_SUCCESS if power save mode was successfully enabled
  754. * Error code if power save mode was not successfully enabled
  755. *
  756. */
  757. extern whd_result_t whd_wifi_enable_powersave_with_throughput(whd_interface_t ifp, uint16_t return_to_sleep_delay);
  758. /** Get powersave mode on specified interface
  759. *
  760. * @param ifp Pointer to handle instance of whd interface
  761. * @param value Value of the current powersave state
  762. * PM1_POWERSAVE_MODE, PM2_POWERSAVE_MODE, NO_POWERSAVE_MODE
  763. *
  764. * @return WHD_SUCCESS or Error code
  765. */
  766. extern whd_result_t whd_wifi_get_powersave_mode(whd_interface_t ifp, uint32_t *value);
  767. /** Disables 802.11 power save mode on specified interface
  768. *
  769. * @param ifp Pointer to handle instance of whd interface
  770. *
  771. * @return WHD_SUCCESS if power save mode was successfully disabled
  772. * Error code if power save mode was not successfully disabled
  773. *
  774. */
  775. extern whd_result_t whd_wifi_disable_powersave(whd_interface_t ifp);
  776. /** Configure ULP mode on specified interface
  777. *
  778. * @param ifp Pointer to handle instance of whd interface
  779. * @param mode mode to be set for ULP(DS0/DS1/DS2)
  780. 1 for DS1, 2 for DS2 and 0 indicates to disable(DS0)
  781. * @param wait_time indicates ulp_wait in ms to be set
  782. (if no network activity for this time, device will enter into DS2)
  783. *
  784. * @return WHD_SUCCESS if ulp mode was successfully configured
  785. * Error code if ulp mode was not configured successfully
  786. *
  787. */
  788. extern whd_result_t whd_wifi_config_ulp_mode(whd_interface_t ifp, uint32_t *mode, uint32_t *wait_time);
  789. /* @} */
  790. /** @addtogroup wifiutilities WHD Wi-Fi Utility API
  791. * @ingroup wifi
  792. * Allows WHD to perform utility operations
  793. * @{
  794. */
  795. /** Registers interest in a multicast address
  796. *
  797. * Once a multicast address has been registered, all packets detected on the
  798. * medium destined for that address are forwarded to the host.
  799. * Otherwise they are ignored.
  800. *
  801. * @param ifp Pointer to handle instance of whd interface
  802. * @param mac Ethernet MAC address
  803. *
  804. * @return WHD_SUCCESS if the address was registered successfully
  805. * Error code if the address was not registered
  806. */
  807. extern whd_result_t whd_wifi_register_multicast_address(whd_interface_t ifp, const whd_mac_t *mac);
  808. /** Unregisters interest in a multicast address
  809. *
  810. * Once a multicast address has been unregistered, all packets detected on the
  811. * medium destined for that address are ignored.
  812. *
  813. * @param ifp Pointer to handle instance of whd interface
  814. * @param mac Ethernet MAC address
  815. *
  816. * @return WHD_SUCCESS if the address was unregistered successfully
  817. * Error code if the address was not unregistered
  818. */
  819. extern whd_result_t whd_wifi_unregister_multicast_address(whd_interface_t ifp, const whd_mac_t *mac);
  820. /** Sets the 802.11 powersave listen interval for a Wi-Fi client, and communicates
  821. * the listen interval to the Access Point. The listen interval will be set to
  822. * (listen_interval x time_unit) seconds.
  823. *
  824. * The default value for the listen interval is 0. With the default value of 0 set,
  825. * the Wi-Fi device wakes to listen for AP beacons every DTIM period.
  826. *
  827. * If the DTIM listen interval is non-zero, the DTIM listen interval will over ride
  828. * the beacon listen interval value.
  829. *
  830. * @param ifp Pointer to handle instance of whd interface
  831. * @param listen_interval The desired beacon listen interval
  832. * @param time_unit The listen interval time unit; options are beacon period or DTIM period.
  833. *
  834. * @return WHD_SUCCESS If the listen interval was successfully set.
  835. * Error code If the listen interval was not successfully set.
  836. */
  837. extern whd_result_t whd_wifi_set_listen_interval(whd_interface_t ifp, uint8_t listen_interval,
  838. whd_listen_interval_time_unit_t time_unit);
  839. /** Gets the current value of all beacon listen interval variables
  840. *
  841. * @param ifp Pointer to handle instance of whd interface
  842. * @param li Powersave listen interval values
  843. * - listen_interval_beacon : The current value of the listen interval set as a multiple of the beacon period
  844. * - listen_interval_dtim : The current value of the listen interval set as a multiple of the DTIM period
  845. * - listen_interval_assoc : The current value of the listen interval sent to access points in an association request frame
  846. *
  847. * @return WHD_SUCCESS If all listen interval values are read successfully
  848. * Error code If at least one of the listen interval values are NOT read successfully
  849. */
  850. extern whd_result_t whd_wifi_get_listen_interval(whd_interface_t ifp, whd_listen_interval_t *li);
  851. /** Determines if a particular interface is ready to transceive ethernet packets
  852. *
  853. * @param ifp Pointer to handle instance of whd interface
  854. *
  855. * @return WHD_SUCCESS if the interface is ready to transceive ethernet packets
  856. * WHD_NOTFOUND no AP with a matching SSID was found
  857. * WHD_NOT_AUTHENTICATED Matching AP was found but it won't let you authenticate.
  858. * This can occur if this device is in the block list on the AP.
  859. * WHD_NOT_KEYED Device has authenticated and associated but has not completed the key exchange.
  860. * This can occur if the passphrase is incorrect.
  861. * Error code if the interface is not ready to transceive ethernet packets
  862. */
  863. extern whd_result_t whd_wifi_is_ready_to_transceive(whd_interface_t ifp);
  864. /* Certification APIs */
  865. /** Retrieve the latest STA EDCF AC parameters
  866. *
  867. * Retrieve the latest Station (STA) interface EDCF (Enhanced Distributed
  868. * Coordination Function) Access Category parameters
  869. *
  870. * @param ifp Pointer to handle instance of whd interface
  871. * @param acp The location where the array of AC parameters will be stored
  872. *
  873. * @return WHD_SUCCESS if the AC Parameters were successfully retrieved
  874. * Error code if the AC Parameters were not retrieved
  875. */
  876. extern whd_result_t whd_wifi_get_acparams(whd_interface_t ifp, whd_edcf_ac_param_t *acp);
  877. /* Action Frames */
  878. /** Manage the addition and removal of custom IEs
  879. *
  880. * @param ifp Pointer to handle instance of whd interface
  881. * @param action the action to take (add or remove IE)
  882. * @param oui the oui of the custom IE
  883. * @param subtype the IE sub-type
  884. * @param data a pointer to the buffer that hold the custom IE
  885. * @param length the length of the buffer pointed to by 'data'
  886. * @param which_packets A mask to indicate in which all packets this IE should be included. See whd_ie_packet_flag_t.
  887. *
  888. * @return WHD_SUCCESS if the custom IE action was successful
  889. * Error code if the custom IE action failed
  890. */
  891. extern whd_result_t whd_wifi_manage_custom_ie(whd_interface_t ifp, whd_custom_ie_action_t action,
  892. const uint8_t *oui, uint8_t subtype, const void *data,
  893. uint16_t length, uint16_t which_packets);
  894. /** Send a pre-prepared action frame
  895. *
  896. * @param ifp Pointer to handle instance of whd interface
  897. * @param af_params A pointer to a pre-prepared action frame structure
  898. *
  899. * @return WHD_SUCCESS or Error code
  900. */
  901. extern whd_result_t whd_wifi_send_action_frame(whd_interface_t ifp, whd_af_params_t *af_params);
  902. /** Send a pre-prepared authentication frame
  903. *
  904. * @param ifp Pointer to handle instance of whd interface
  905. * @param auth_params pointer to a pre-prepared authentication frame structure
  906. *
  907. * @return WHD_SUCCESS or Error code
  908. */
  909. extern whd_result_t whd_wifi_send_auth_frame(whd_interface_t ifp, whd_auth_params_t *auth_params);
  910. /** Configure HE OM Control
  911. *
  912. * @param ifp Pointer to handle instance of whd interface
  913. * @param he_omi_params pointer to he_omi parameters
  914. *
  915. * @return WHD_SUCCESS or Error code
  916. */
  917. extern whd_result_t whd_wifi_he_omi(whd_interface_t ifp, whd_he_omi_params_t *he_omi_params);
  918. /** Configure BSS Max Idle Time
  919. *
  920. * @param ifp Pointer to handle instance of whd interface
  921. * @param period The bss max idle period time unit(seconds)
  922. *
  923. * @return WHD_SUCCESS or Error code
  924. */
  925. extern whd_result_t whd_wifi_bss_max_idle(whd_interface_t ifp, uint16_t period);
  926. /** Trigger individual TWT session(used by STA)
  927. *
  928. * @param ifp Pointer to handle instance of whd interface
  929. * @param twt_params pointer to itwt_setup parameters
  930. *
  931. * @return WHD_SUCCESS or Error code
  932. */
  933. extern whd_result_t whd_wifi_itwt_setup(whd_interface_t ifp, whd_itwt_setup_params_t *twt_params);
  934. /** Trigger Join broadcast TWT session(used by STA)
  935. *
  936. * @param ifp Pointer to handle instance of whd interface
  937. * @param twt_params pointer to btwt_join parameters
  938. *
  939. * @return WHD_SUCCESS or Error code
  940. */
  941. extern whd_result_t whd_wifi_btwt_join(whd_interface_t ifp, whd_btwt_join_params_t *twt_params);
  942. /** Trigger teardown all individual or broadcast TWT sessions
  943. *
  944. * @param ifp Pointer to handle instance of whd interface
  945. * @param twt_params pointer to twt_taerdown parameters
  946. *
  947. * @return WHD_SUCCESS or Error code
  948. */
  949. extern whd_result_t whd_wifi_twt_teardown(whd_interface_t ifp, whd_twt_teardown_params_t *twt_params);
  950. /** Trigger TWT information frame(used by STA)
  951. *
  952. * @param ifp Pointer to handle instance of whd interface
  953. * @param twt_params pointer to twt_information parameters
  954. *
  955. *
  956. * @return WHD_SUCCESS or Error code
  957. */
  958. extern whd_result_t whd_wifi_twt_information_frame(whd_interface_t ifp, whd_twt_information_params_t *twt_params);
  959. /** Configure TWT IE in beacon(used by AP)
  960. *
  961. * @param ifp Pointer to handle instance of whd interface
  962. * @param twt_params pointer to btwt_config parameters
  963. *
  964. * @return WHD_SUCCESS or Error code
  965. */
  966. extern whd_result_t whd_wifi_btwt_config(whd_interface_t ifp, whd_btwt_config_params_t *twt_params);
  967. /** Add MBO preffered/non-prefferd channel attributes
  968. *
  969. * @param ifp Pointer to handle instance of whd interface
  970. * @param mbo_params pointer to whd_mbo_add_chan_pref_params_t structure
  971. *
  972. * @return WHD_SUCCESS or Error code
  973. */
  974. extern uint32_t whd_wifi_mbo_add_chan_pref(whd_interface_t ifp, whd_mbo_add_chan_pref_params_t *mbo_params);
  975. /** Delete MBO preffered/non-prefferd channel attributes
  976. *
  977. * @param ifp Pointer to handle instance of whd interface
  978. * @param mbo_params pointer to whd_mbo_del_chan_pref_params_t structure
  979. *
  980. * @return WHD_SUCCESS or Error code
  981. */
  982. extern uint32_t whd_wifi_mbo_del_chan_pref(whd_interface_t ifp, whd_mbo_del_chan_pref_params_t *mbo_params);
  983. /** Send WNM Notification request sub-element type
  984. *
  985. * @param ifp Pointer to handle instance of whd interface
  986. * @param sub_elem_type sub-element type <2/3>
  987. *
  988. * @return WHD_SUCCESS or Error code
  989. */
  990. extern uint32_t whd_wifi_mbo_send_notif(whd_interface_t ifp, uint8_t sub_elem_type);
  991. /** Set coex configuration
  992. *
  993. * @param ifp Pointer to handle instance of whd interface
  994. * @param coex_config Pointer to the structure whd_coex_config_t
  995. *
  996. * @return WHD_SUCCESS or Error code
  997. */
  998. extern whd_result_t whd_wifi_set_coex_config(whd_interface_t ifp, whd_coex_config_t *coex_config);
  999. /** Set auth status used for External AUTH(SAE)
  1000. *
  1001. * @param ifp Pointer to handle instance of whd interface
  1002. * @param status Pointer to Auth_Status structure
  1003. *
  1004. * @return WHD_SUCCESS or Error code
  1005. */
  1006. extern whd_result_t whd_wifi_set_auth_status(whd_interface_t ifp, whd_auth_req_status_t *status);
  1007. /** Get FW(chip) Capability
  1008. *
  1009. * @param ifp Pointer to handle instance of whd interface
  1010. * @param value Enum value of the current FW capability, ex: sae or sae_ext or ...etc,
  1011. * (enum value map to whd_fwcap_id_t)
  1012. * @return WHD_SUCCESS or Error code
  1013. */
  1014. extern whd_result_t whd_wifi_get_fwcap(whd_interface_t ifp, uint32_t *value);
  1015. /** Get version of Device (WLAN) Firmware
  1016. *
  1017. * @param[in] ifp : pointer to handle instance of whd interface
  1018. * @param[out] version : pointer to store version #
  1019. *
  1020. * @return whd_result_t
  1021. */
  1022. whd_result_t whd_arp_version(whd_interface_t ifp, uint32_t *version);
  1023. /** Get ARP Offload Peer Age from Device (WLAN)
  1024. * Length of time in seconds before aging out an entry in the WLAN processor ARP table.
  1025. *
  1026. * @param[in] ifp : pointer to handle instance of whd interface
  1027. * @param[out] seconds : pointer to store value
  1028. *
  1029. * @return whd_result_t
  1030. */
  1031. whd_result_t whd_arp_peerage_get(whd_interface_t ifp, uint32_t *seconds);
  1032. /** Set ARP Offload Peer Age in Device (WLAN)
  1033. * Length of time in seconds before aging out an entry in the WLAN processor ARP table.
  1034. *
  1035. * @param[in] ifp : pointer to handle instance of whd interface
  1036. * @param[in] seconds : Seconds to age out IP
  1037. *
  1038. * @return whd_result_t
  1039. */
  1040. whd_result_t whd_arp_peerage_set(whd_interface_t ifp, uint32_t seconds);
  1041. /** Get ARP Offload Agent Enable from Device (WLAN)
  1042. *
  1043. * @param[in] ifp : pointer to handle instance of whd interface
  1044. * @param[out] agent_enable : pointer to store value
  1045. *
  1046. * @return whd_result_t
  1047. */
  1048. whd_result_t whd_arp_arpoe_get(whd_interface_t ifp, uint32_t *agent_enable);
  1049. /** Set ARP Offload Agent Enable in Device (WLAN)
  1050. * Set Enable/Disable of ARP Offload Agent
  1051. *
  1052. * @param[in] ifp : pointer to handle instance of whd interface
  1053. * @param[in] agent_enable : Enable=1 / Disable=0
  1054. *
  1055. * @return whd_result_t
  1056. */
  1057. whd_result_t whd_arp_arpoe_set(whd_interface_t ifp, uint32_t agent_enable);
  1058. /** Clear ARP Offload cache in Device (WLAN)
  1059. *
  1060. * @param[in] ifp : pointer to handle instance of whd interface
  1061. *
  1062. * @return whd_result_t
  1063. */
  1064. whd_result_t whd_arp_cache_clear(whd_interface_t ifp);
  1065. /** Get ARP Offload Feature Flags from Device (WLAN)
  1066. *
  1067. * @param[in] ifp : pointer to handle instance of whd interface
  1068. * @param[out] features : ptr to store currently set features - bit flags CY_ARP_OL_AGENT_ENABLE, etc.
  1069. * ARL_OL_AGENT | ARL_OL_SNOOP | ARP_OL_HOST_AUTO_REPLY | ARP_OL_PEER_AUTO_REPLY
  1070. *
  1071. * @return whd_result_t
  1072. */
  1073. whd_result_t whd_arp_features_get(whd_interface_t ifp, uint32_t *features);
  1074. /** Set ARP Offload Feature Flags in Device (WLAN)
  1075. *
  1076. * @param[in] ifp : pointer to handle instance of whd interface
  1077. * @param[in] features : features to set value (you can OR ('|') multiple flags) CY_ARP_OL_AGENT_ENABLE, etc.
  1078. * ARL_OL_AGENT | ARL_OL_SNOOP | ARP_OL_HOST_AUTO_REPLY | ARP_OL_PEER_AUTO_REPLY
  1079. *
  1080. * @return whd_result_t
  1081. */
  1082. whd_result_t whd_arp_features_set(whd_interface_t ifp, uint32_t features);
  1083. /** Print ARP Offload Feature Flags in Human readable form to console
  1084. *
  1085. * @param[in] features : feature flags to set (you can OR '|' multiple flags) CY_ARP_OL_AGENT_ENABLE, etc.
  1086. * ARL_OL_AGENT | ARL_OL_SNOOP | ARP_OL_HOST_AUTO_REPLY | ARP_OL_PEER_AUTO_REPLY
  1087. * @param[in] title : Optional: Title for output (NULL == no title)
  1088. *
  1089. * @return whd_result_t
  1090. */
  1091. whd_result_t whd_arp_features_print(uint32_t features, const char *title);
  1092. /** Add ARP Offload Host IP Identifier(s) to HostIP List to Device (WLAN)
  1093. *
  1094. * @param[in] ifp : pointer to handle instance of whd interface
  1095. * @param[in] host_ipv4_list : pointer to host_ip data (IPv4, 1 uint32_t per ip addr)
  1096. * @param[in] count : Number of array elements in host_ip
  1097. *
  1098. * @return whd_result_t
  1099. */
  1100. whd_result_t whd_arp_hostip_list_add(whd_interface_t ifp, uint32_t *host_ipv4_list, uint32_t count);
  1101. /** Add One ARP Offload Host IP Identifier to HostIP List (mbed-style IP string) to Device (WLAN)
  1102. *
  1103. * @param[in] ifp : pointer to handle instance of whd interface
  1104. * @param[in] ip_addr : pointer to ip string (as returned from mbedos calls)
  1105. *
  1106. * @return whd_result_t
  1107. */
  1108. whd_result_t whd_arp_hostip_list_add_string(whd_interface_t ifp, const char *ip_addr);
  1109. /** Clear One ARP Offload Host IP Identifier from Host IP List in Device (WLAN)
  1110. *
  1111. * @param[in] ifp : pointer to handle instance of whd interface
  1112. * @param[in] ipv4_addr : ip addr expressed as a uint32_t
  1113. *
  1114. * @return whd_result_t
  1115. */
  1116. whd_result_t whd_arp_hostip_list_clear_id(whd_interface_t ifp, uint32_t ipv4_addr);
  1117. /** Clear One ARP Offload Host IP Identifier from Host IP List (mbed-style IP string) in Device (WLAN)
  1118. *
  1119. * @param[in] ifp : pointer to handle instance of whd interface
  1120. * @param[in] ip_addr : pointer to ip string (as returned from mbedos calls)
  1121. *
  1122. * @return whd_result_t
  1123. */
  1124. whd_result_t whd_arp_hostip_list_clear_id_string(whd_interface_t ifp, const char *ip_addr);
  1125. /** Clear all ARP Offload Host IP Identifier List
  1126. *
  1127. * @param[in] ifp : pointer to handle instance of whd interface
  1128. *
  1129. * @return whd_result_t
  1130. */
  1131. whd_result_t whd_arp_hostip_list_clear(whd_interface_t ifp);
  1132. /** Get ARP Offload Host IP Identifiers from Device (WLAN)
  1133. *
  1134. * @param[in] ifp : pointer to handle instance of whd interface
  1135. * @param[in] count : Number of array elements in host_ip
  1136. * @param[out] host_ipv4_list : Pointer to structure array to store host_ip data
  1137. * @param[out] filled : Number of array elements filled by this routine
  1138. *
  1139. * @return whd_result_t
  1140. */
  1141. whd_result_t whd_arp_hostip_list_get(whd_interface_t ifp, uint32_t count, uint32_t *host_ipv4_list, uint32_t *filled);
  1142. /** Clear ARP Offload statistics in Device (WLAN)
  1143. *
  1144. * @param[in] ifp : pointer to handle instance of whd interface
  1145. *
  1146. * @return whd_result_t
  1147. */
  1148. whd_result_t whd_arp_stats_clear(whd_interface_t ifp);
  1149. /** Get ARP Offload statistics from Device (WLAN)
  1150. *
  1151. * @param[in] ifp : pointer to handle instance of whd interface
  1152. * @param[out] stats : Ptr to store statistics whd_arp_stats_t
  1153. *
  1154. * @return whd_result_t
  1155. */
  1156. whd_result_t whd_arp_stats_get(whd_interface_t ifp, whd_arp_stats_t *stats);
  1157. /** Print ARP Offload statistics
  1158. * NOTE: call whd_arp_stats_get(), then print them using this function.
  1159. *
  1160. * @param[in] arp_stats : Ptr to ARP statistics structure
  1161. * @param[in] title : Optional: Title for output (NULL == no title)
  1162. *
  1163. * @return whd_result_t
  1164. */
  1165. whd_result_t whd_arp_stats_print(whd_arp_stats_t *arp_stats, const char *title);
  1166. /** A filter must be added (e.g. created) before it can be enabled.
  1167. * @param[in] ifp : pointer to handle instance of whd interface
  1168. * @param[in] settings : Ptr to filter settings @ref whd_packet_filter_t
  1169. * @return whd_result_t
  1170. */
  1171. whd_result_t whd_pf_add_packet_filter(whd_interface_t ifp, const whd_packet_filter_t *settings);
  1172. /** Remove a previously added filter.
  1173. * @param[in] ifp : pointer to handle instance of whd interface
  1174. * @param[in] filter_id : filter to remove
  1175. * @return whd_result_t
  1176. */
  1177. whd_result_t whd_pf_remove_packet_filter(whd_interface_t ifp, uint8_t filter_id);
  1178. /** After a filter has been added it can be enabled or disabled as needed.
  1179. * @param[in] ifp : pointer to handle instance of whd interface
  1180. * @param[in] filter_id : filter to enable
  1181. * @return whd_result_t
  1182. */
  1183. whd_result_t whd_pf_enable_packet_filter(whd_interface_t ifp, uint8_t filter_id);
  1184. /** After a filter has been added it can be enabled or disabled as needed.
  1185. * @param[in] ifp : pointer to handle instance of whd interface
  1186. * @param[in] filter_id : filter to disable
  1187. * @return whd_result_t
  1188. */
  1189. whd_result_t whd_pf_disable_packet_filter(whd_interface_t ifp, uint8_t filter_id);
  1190. /** After a filter has been added it can be enabled or disabled as needed.
  1191. * @param[in] ifp : pointer to handle instance of whd interface
  1192. * @param[in] filter_id : filter to disable/enable
  1193. * @param[in] enable : Enable/Disable Flag
  1194. * @return whd_result_t
  1195. */
  1196. whd_result_t whd_wifi_toggle_packet_filter(whd_interface_t ifp, uint8_t filter_id, whd_bool_t enable);
  1197. /** Filters are implemented in WLAN subsystem as a bit pattern and matching bit mask that
  1198. * are applied to incoming packets. This API retrieves the pattern and mask.
  1199. * @param[in] ifp : pointer to handle instance of whd interface
  1200. * @param[in] filter_id : which filter to retrieve
  1201. * @param[in] max_size : size of both mask and pattern buffers
  1202. * @param[out] mask : mask for this filter
  1203. * @param[out] pattern : pattern for this filter
  1204. * @param[out] size_out : length of both mask and pattern
  1205. * @return whd_result_t
  1206. */
  1207. whd_result_t whd_pf_get_packet_filter_mask_and_pattern(whd_interface_t ifp, uint8_t filter_id, uint32_t max_size,
  1208. uint8_t *mask,
  1209. uint8_t *pattern, uint32_t *size_out);
  1210. /** Clear the packet filter stats associated with a filter id
  1211. * @param[in] ifp : pointer to handle instance of whd interface
  1212. * @param[in] filter_id : which filter
  1213. * @return whd_result_t
  1214. */
  1215. whd_result_t whd_wifi_clear_packet_filter_stats(whd_interface_t ifp, uint32_t filter_id);
  1216. /** Return the stats associated with a filter
  1217. * @param[in] ifp : pointer to handle instance of whd interface
  1218. * @param[in] filter_id : which filter
  1219. * @param[out] stats : Ptr to store statistics wl_pkt_filter_stats_t
  1220. * @return whd_result_t
  1221. */
  1222. whd_result_t whd_pf_get_packet_filter_stats(whd_interface_t ifp, uint8_t filter_id, whd_pkt_filter_stats_t *stats);
  1223. /** Set/Get TKO retry & interval parameters
  1224. * @param[in] ifp : Pointer to handle instance of whd interface
  1225. * @param[in] whd_tko_retry : whd retry & interval parameters structure
  1226. * @param[in] set : Set(1)/Get(0) Flag
  1227. * @return whd_result_t
  1228. */
  1229. whd_result_t whd_tko_param(whd_interface_t ifp, whd_tko_retry_t *whd_tko_retry, uint8_t set);
  1230. /** Return the tko status for all indexes
  1231. * @param[in] ifp : Pointer to handle instance of whd interface
  1232. * @param[out] tko_status : Ptr to store tko_status
  1233. * @return whd_result_t
  1234. */
  1235. whd_result_t whd_tko_get_status(whd_interface_t ifp, whd_tko_status_t *tko_status);
  1236. /** Return the stats associated with a filter
  1237. * @param[in] ifp : Pointer to handle instance of whd interface
  1238. * @param[out] max : returns Max TCP connections supported by WLAN Firmware
  1239. * @return whd_result_t
  1240. */
  1241. whd_result_t whd_tko_max_assoc(whd_interface_t ifp, uint8_t *max);
  1242. /** Return the stats associated with a filter
  1243. * @param[in] ifp : Pointer to handle instance of whd interface
  1244. * @param[in] index : index for TCP offload connection
  1245. * @param[out] whd_connect : tko_connect structure buffer from Firmware
  1246. * @param[in] buflen : Buffer given for tko_connect
  1247. * @return whd_result_t
  1248. */
  1249. whd_result_t whd_tko_get_FW_connect(whd_interface_t ifp, uint8_t index, whd_tko_connect_t *whd_connect,
  1250. uint16_t buflen);
  1251. /** Return the stats associated with a filter
  1252. * @param[in] ifp : Pointer to handle instance of whd interface
  1253. * @param[in] enable : Enable/Disable TCP Keepalive offload
  1254. * @return whd_result_t
  1255. */
  1256. whd_result_t whd_tko_toggle(whd_interface_t ifp, whd_bool_t enable);
  1257. /** Return the stats associated with a filter
  1258. * @param[in] ifp : Pointer to handle instance of whd interface
  1259. * @param[in] whd_filter : wl_filter structure buffer from Firmware
  1260. * @param[in] filter_flag: To set filter
  1261. * @return whd_result_t
  1262. */
  1263. extern whd_result_t whd_tko_filter(whd_interface_t ifp, whd_tko_auto_filter_t * whd_filter, uint8_t filter_flag);
  1264. /* @} */
  1265. /** @addtogroup wifiioctl WHD Wi-Fi IOCTL Set/Get API
  1266. * @ingroup wifi
  1267. * Set and get IOCTL values
  1268. * @{
  1269. */
  1270. /** Sends an IOCTL command - CDC_SET IOCTL value
  1271. *
  1272. * @param ifp Pointer to handle instance of whd interface
  1273. * @param ioctl CDC_SET - To set the I/O control
  1274. * @param value Data value to be sent
  1275. *
  1276. * @return WHD_SUCCESS or Error code
  1277. */
  1278. extern whd_result_t whd_wifi_set_ioctl_value(whd_interface_t ifp, uint32_t ioctl, uint32_t value);
  1279. /** Sends an IOCTL command - CDC_GET IOCTL value
  1280. *
  1281. * @param ifp Pointer to handle instance of whd interface
  1282. * @param ioctl CDC_GET - To get the I/O control
  1283. * @param value Pointer to receive the data value
  1284. *
  1285. * @return WHD_SUCCESS or Error code
  1286. */
  1287. extern whd_result_t whd_wifi_get_ioctl_value(whd_interface_t ifp, uint32_t ioctl, uint32_t *value);
  1288. /** Sends an IOCTL command - CDC_SET IOCTL buffer
  1289. *
  1290. * @param ifp Pointer to handle instance of whd interface
  1291. * @param ioctl CDC_SET - To set the I/O control
  1292. * @param buffer Handle for a packet buffer containing the data value to be sent.
  1293. * @param buffer_length Length of buffer
  1294. *
  1295. * @return WHD_SUCCESS or Error code
  1296. */
  1297. extern whd_result_t whd_wifi_set_ioctl_buffer(whd_interface_t ifp, uint32_t ioctl, void *buffer, uint16_t buffer_length);
  1298. /** Sends an IOCTL command - CDC_GET IOCTL buffer
  1299. *
  1300. * @param ifp Pointer to handle instance of whd interface
  1301. * @param ioctl CDC_GET - To get the I/O control
  1302. * @param out_buffer Pointer to receive the handle for the packet buffer containing the response data value received
  1303. * @param out_length Length of out_buffer
  1304. *
  1305. * @return WHD_SUCCESS or Error code
  1306. */
  1307. extern whd_result_t whd_wifi_get_ioctl_buffer(whd_interface_t ifp, uint32_t ioctl, uint8_t *out_buffer,
  1308. uint16_t out_length);
  1309. /** Sends an IOVAR command
  1310. *
  1311. * @param ifp Pointer to handle instance of whd interface
  1312. * @param iovar_name SDPCM_GET - To get the I/O Variable
  1313. * @param param Paramater to be passed for the IOVAR
  1314. * @param paramlen Paramter length
  1315. * @param out_buffer Pointer to receive the handle for the packet buffer containing the response data value received
  1316. * @param out_length Length of out_buffer
  1317. *
  1318. * @return WHD_SUCCESS or Error code
  1319. */
  1320. extern whd_result_t whd_wifi_get_iovar_buffer_with_param(whd_interface_t ifp, const char *iovar_name, void *param,
  1321. uint32_t paramlen, uint8_t *out_buffer, uint32_t out_length);
  1322. /* @} */
  1323. /** @addtogroup dbg WHD Wi-Fi Debug API
  1324. * @ingroup wifi
  1325. * WHD APIs which allows debugging like, printing whd log information, getting whd stats, etc.
  1326. * @{
  1327. */
  1328. /** Retrieves the WLAN firmware version
  1329. *
  1330. * @param ifp Pointer to handle instance of whd interface
  1331. * @param version Pointer to a buffer that version information will be written to
  1332. * @param length Length of the buffer
  1333. *
  1334. * @return WHD_SUCCESS or Error code
  1335. */
  1336. extern whd_result_t whd_wifi_get_wifi_version(whd_interface_t ifp, char *version, uint8_t length);
  1337. /** Retrieves the WLAN CLM version
  1338. *
  1339. * @param ifp Pointer to handle instance of whd interface
  1340. * @param version Pointer to a buffer that version information will be written to
  1341. * @param length Length of the buffer
  1342. *
  1343. * @return WHD_SUCCESS or Error code
  1344. */
  1345. extern whd_result_t whd_wifi_get_clm_version(whd_interface_t ifp, char *version, uint8_t length);
  1346. /** To print whd log information
  1347. *
  1348. * @param whd_drv Pointer to handle instance of the driver
  1349. * @param buffer Buffer to store read log results
  1350. * @param buffer_size Variable to store size of the buffer
  1351. *
  1352. * @return WHD_SUCCESS or Error code
  1353. */
  1354. extern whd_result_t whd_wifi_read_wlan_log(whd_driver_t whd_drv, char *buffer, uint32_t buffer_size);
  1355. /** To print whd log information
  1356. *
  1357. * @param whd_drv Pointer to handle instance of the driver
  1358. *
  1359. * @return WHD_SUCCESS or Error code
  1360. */
  1361. extern whd_result_t whd_wifi_print_whd_log(whd_driver_t whd_drv);
  1362. /** Retrieves the ifidx from interface pointer.
  1363. * ifidx is a unique value and be used to identify a instance of tcp/ip stack
  1364. *
  1365. * @param ifp Pointer to the whd_interface_t
  1366. * @param ifidx Pointer to ifidx
  1367. *
  1368. * @return WHD_SUCCESS or Error code
  1369. */
  1370. extern whd_result_t whd_network_get_ifidx_from_ifp(whd_interface_t ifp, uint8_t *ifidx);
  1371. /** Retrieves the bsscfgidx from interface pointer.
  1372. *
  1373. * Can be used to send IOCTL with requires bsscfgidx
  1374. *
  1375. * @param ifp Pointer to handle instance of whd interface
  1376. * @param bsscfgidx Pointer to bsscfgidx
  1377. *
  1378. * @return WHD_SUCCESS or Error code
  1379. */
  1380. extern whd_result_t whd_network_get_bsscfgidx_from_ifp(whd_interface_t ifp, uint8_t *bsscfgidx);
  1381. /** Retrives the bss info
  1382. *
  1383. * @param ifp Pointer to handle instance of whd interface
  1384. * @param bi A pointer to the structure wl_bss_info_t
  1385. *
  1386. * @return WHD_SUCCESS or Error code
  1387. */
  1388. extern whd_result_t whd_wifi_get_bss_info(whd_interface_t ifp, wl_bss_info_t *bi);
  1389. /** Prints WHD stats
  1390. *
  1391. * @param whd_drv Pointer to handle instance of the driver
  1392. * @param reset_after_print Bool variable to decide if whd_stats to be reset
  1393. *
  1394. * @return WHD_SUCCESS or Error code
  1395. */
  1396. extern whd_result_t whd_print_stats(whd_driver_t whd_drv, whd_bool_t reset_after_print);
  1397. /** Fetches ulp statistics and fills the buffer with that data and executes deepsleep
  1398. * indication callback if application registers for it
  1399. *
  1400. * @param whd_driver Instance of whd driver
  1401. * @param buf Pointer to buffer to be filled with ulpstats data
  1402. * @param buflen Buffer length of the above buffer
  1403. * should be between 2048 and 4096
  1404. *
  1405. * @return WHD_SUCCESS or Error code
  1406. */
  1407. extern whd_result_t whd_wifi_get_deepsleep_stats(whd_driver_t whd_driver, char *buf, uint32_t buflen);
  1408. /* Function pointer to be used callback registration */
  1409. typedef void* (*whd_ds_callback_t)(void*, char*, uint32_t);
  1410. /* Structure to store callback registration and parameters */
  1411. typedef struct deepsleep_cb_info {
  1412. whd_ds_callback_t callback;
  1413. void* ctx;
  1414. char* buf;
  1415. uint32_t buflen;
  1416. } deepsleep_cb_info_t ;
  1417. /** Function to register callbacks to be executed
  1418. *
  1419. * @param ifp Pointer to handle instance of whd interface
  1420. * @param callback Callback api to be registered
  1421. * @param ctx Pointer to context
  1422. * @param buf Buffer to be filled with data
  1423. * @param buflen Buffer length of the above buffer
  1424. *
  1425. * @return WHD_SUCCESS or WHD_UNKNOWN_INTERFACE
  1426. */
  1427. extern whd_result_t whd_wifi_register_ds_callback(whd_interface_t ifp, whd_ds_callback_t callback, void *ctx, char* buf, uint32_t buflen);
  1428. /** Function to unregister callbacks that are note needed to be executed anymore
  1429. *
  1430. * @param ifp Pointer to handle instance of whd interface
  1431. * @param callback Callback api to be registered
  1432. *
  1433. * @return WHD_SUCCESS or WHD_UNKNOWN_INTERFACE
  1434. */
  1435. extern whd_result_t whd_wifi_deregister_ds_callback(whd_interface_t ifp, whd_ds_callback_t callback);
  1436. /* @} */
  1437. #ifdef __cplusplus
  1438. } /* extern "C" */
  1439. #endif
  1440. #endif /* ifndef INCLUDED_WHD_WIFI_H */