• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 Winner Microelectronics Co., Ltd. All rights reserved.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 /**
17  * @file    wm_wifi.h
18  *
19  * @brief   Wi-Fi API
20  *
21  * @author  WinnerMicro
22  *
23  * Copyright (c) 2015 Winner Microelectronics Co., Ltd.
24  */
25 #ifndef TLS_WIFI_FUNC_H
26 #define TLS_WIFI_FUNC_H
27 #include "list.h"
28 
29 /** MACRO for callback EVENT to join AP or create soft-AP successfully  */
30 #define    NETIF_WIFI_JOIN_SUCCESS         0x1
31 /** MACRO for callback EVENT to fail to join AP */
32 #define  NETIF_WIFI_JOIN_FAILED          0x2
33 /** MACRO for callback EVENT to disconnect from AP or destroy soft-AP */
34 #define    NETIF_WIFI_DISCONNECTED         0x3
35 
36 /** MACRO for callback EVNET to create AP successfully */
37 #define    NETIF_WIFI_SOFTAP_SUCCESS    0x5
38 /** MACRO for callback EVNET to create soft-AP failed */
39 #define    NETIF_WIFI_SOFTAP_FAILED     0x6
40 /** MACRO for callback EVNET to close soft-AP */
41 #define    NETIF_WIFI_SOFTAP_CLOSED          0x7
42 
43 /* Return Error definition */
44 /** invalid SSID */
45 #define    WM_WIFI_ERR_SSID         (-1)
46 /** invalid key */
47 #define    WM_WIFI_ERR_KEY          (-2)
48 /** wps is busing */
49 #define WM_WIFI_WPS_BUSY           (-3)
50 /** scan is busing */
51 #define WM_WIFI_SCANNING_BUSY       (-4)
52 /** station is connecting */
53 #define WM_WIFI_STA_BUSY           (-5)
54 
55 /* error number definition */
56 /** no error */
57 #define     WM_WIFI_ENOERR          0
58 /** ap not exist */
59 #define     WM_WIFI_ENOAP           1
60 /** pre-shared key may be incorrect */
61 #define     WM_WIFI_EKEY            2
62 /** Low signal intensity */
63 #define     WM_WIFI_ELSI            3
64 
65 #define ETH_ALEN 6
66 // #endif
67 
68 /* bss type definition */
69 #ifndef IEEE80211_MODE_INFRA
70 /** station mode */
71 #define IEEE80211_MODE_INFRA    1
72 /** ibss mode */
73 #define IEEE80211_MODE_IBSS        2
74 /** softap mode */
75 #define IEEE80211_MODE_AP        4
76 #endif
77 
78 /** authenticate mode : open */
79 #define IEEE80211_ENCRYT_NONE            0
80 /** authenticate mode : WEP40 */
81 #define IEEE80211_ENCRYT_WEP40            1
82 /** authenticate mode : WEP104 */
83 #define    IEEE80211_ENCRYT_WEP104            2
84 /** authenticate mode : WPA_PSK_TKIP */
85 #define    IEEE80211_ENCRYT_TKIP_WPA        3
86 /** authenticate mode : WPA_PSK_CCMP */
87 #define    IEEE80211_ENCRYT_CCMP_WPA        4
88 /** authenticate mode : WPA2_PSK_TKIP */
89 #define    IEEE80211_ENCRYT_TKIP_WPA2        5
90 /** authenticate mode : WPA2_PSK_CCMP */
91 #define    IEEE80211_ENCRYT_CCMP_WPA2        6
92 /** authenticate mode : WPA_PSK_TKIP&AES */
93 #define    IEEE80211_ENCRYT_AUTO_WPA        7
94 /** authenticate mode : WPA2_PSK_TKIP&AES */
95 #define    IEEE80211_ENCRYT_AUTO_WPA2        8
96 
97 #ifdef TLS_CONFIG_WPS
98 /** length of WPS pin code */
99 #define WPS_PIN_LEN                     8
100 #endif
101 
102 /** set auto connecting flag */
103 #define WIFI_AUTO_CNT_FLAG_SET            1
104 /** get auto connecting flag */
105 #define WIFI_AUTO_CNT_FLAG_GET            0
106 
107 /** disable Wi-Fi auto connecting */
108 #define WIFI_AUTO_CNT_OFF                0x0
109 /** enable Wi-Fi auto connecting */
110 #define WIFI_AUTO_CNT_ON                0x1
111 /** disable Wi-Fi auto connecting temporary */
112 #define WIFI_AUTO_CNT_TMP_OFF            0x3
113 
114 /** Wi-Fi join net successfully */
115 #define WIFI_JOIN_SUCCESS               0x1
116 /** Wi-Fi join net failed */
117 #define WIFI_JOIN_FAILED                0x2
118 /** Wi-Fi disconnected */
119 #define WIFI_DISCONNECTED               0x3
120 /** Wi-Fi create ap successfully */
121 #define WIFI_SOFTAP_SUCCESS     0x4
122 /** Wi-Fi create softap failure */
123 #define WIFI_SOFTAP_FAILED      0x5
124 /** Wi-Fi close softap */
125 #define     WIFI_SOFTAP_CLOSED              0x6
126 
127 enum tls_wifi_auth_mode {
128     WM_WIFI_AUTH_MODE_OPEN              = 0, /**< authenticate mode : open */
129     WM_WIFI_AUTH_MODE_WEP_AUTO          = 3, /**< authenticate mode : wep (open or/and shared...) */
130     WM_WIFI_AUTH_MODE_WPA_PSK_TKIP      = 4, /**< authenticate mode : wpa psk rc4 */
131     WM_WIFI_AUTH_MODE_WPA_PSK_CCMP      = 8, /**< authenticate mode : wpa psk aes */
132     /**< authenticate mode : wpa psk, tkip and aes */
133     WM_WIFI_AUTH_MODE_WPA_PSK_AUTO      = (WM_WIFI_AUTH_MODE_WPA_PSK_TKIP | WM_WIFI_AUTH_MODE_WPA_PSK_CCMP),
134     WM_WIFI_AUTH_MODE_WPA2_PSK_TKIP     = 16, /**< authenticate mode : wpa2 psk rc4 */
135     WM_WIFI_AUTH_MODE_WPA2_PSK_CCMP     = 32, /**< authenticate mode : wpa2 psk aes */
136     /**< authenticate mode : wpa2 psk, tkip and aes */
137     WM_WIFI_AUTH_MODE_WPA2_PSK_AUTO     = (WM_WIFI_AUTH_MODE_WPA2_PSK_TKIP | WM_WIFI_AUTH_MODE_WPA2_PSK_CCMP),
138     WM_WIFI_AUTH_MODE_WPA_WPA2_PSK_TKIP = (WM_WIFI_AUTH_MODE_WPA_PSK_TKIP | WM_WIFI_AUTH_MODE_WPA2_PSK_TKIP),
139     WM_WIFI_AUTH_MODE_WPA_WPA2_PSK_CCMP = (WM_WIFI_AUTH_MODE_WPA_PSK_CCMP | WM_WIFI_AUTH_MODE_WPA2_PSK_CCMP),
140     /**< authenticate mode : wpa and wpa2, tkip and aes */
141     WM_WIFI_AUTH_MODE_WPA_WPA2_PSK_AUTO = (WM_WIFI_AUTH_MODE_WPA_PSK_AUTO | WM_WIFI_AUTH_MODE_WPA2_PSK_AUTO),
142     WM_WIFI_AUTH_MODE_UNKNOWN           = 128
143 };
144 
145 /** Wi-Fi states */
146 enum tls_wifi_states {
147     WM_WIFI_DISCONNECTED,      /**< Disconnected state */
148     WM_WIFI_SCANNING,          /**< Scanning for a network */
149     WM_WIFI_JOINING,           /**< Trying to join with a BSS/SSID */
150     WM_WIFI_JOINED             /**< All authentication completed */
151 };
152 
153 /** frame type of the manager */
154 enum tls_wifi_mgmt_type {
155     WM_WIFI_MGMT_TYPE_ASSOC_REQ       = 0x0000,    /**< association request frame */
156     WM_WIFI_MGMT_TYPE_ASSOC_RESP   = 0x0010,    /**< association response frame */
157     WM_WIFI_MGMT_TYPE_REASSOC_REQ  = 0x0020,    /**< reassociation request frame */
158     WM_WIFI_MGMT_TYPE_REASSOC_RESP = 0x0030,    /**< reassociation response frame */
159     WM_WIFI_MGMT_TYPE_PROBE_REQ    = 0x0040,    /**< probe request frame */
160     WM_WIFI_MGMT_TYPE_PROBE_RESP   = 0x0050,    /**< probe response frame */
161     WM_WIFI_MGMT_TYPE_BEACON       = 0x0080,    /**< beacon frame */
162     WM_WIFI_MGMT_TYPE_ATIM         = 0x0090,    /**< ATIM frame */
163     WM_WIFI_MGMT_TYPE_DISASSOC     = 0x00A0,    /**< disassociation frame */
164     WM_WIFI_MGMT_TYPE_AUTH         = 0x00B0,    /**< authentication frame */
165     WM_WIFI_MGMT_TYPE_DEAUTH       = 0x00C0,    /**< deauthentication frame */
166     WM_WIFI_MGMT_TYPE_ACTION       = 0x00D0     /**< action frame */
167 };
168 
169 /** Wi-Fi ransport rate */
170 enum tls_wifi_tx_rate {
171     WM_WIFI_TX_RATEIDX_1M = 0,    /**< 11b, 1M */
172     WM_WIFI_TX_RATEIDX_2M,        /**< 11b, 2M */
173     WM_WIFI_TX_RATEIDX_5_5M,      /**< 11b, 5.5M */
174     WM_WIFI_TX_RATEIDX_11M,       /**< 11b, 11M */
175     WM_WIFI_TX_RATEIDX_6M,        /**< 11g, 6M */
176     WM_WIFI_TX_RATEIDX_9M,        /**< 11g, 9M */
177     WM_WIFI_TX_RATEIDX_12M,       /**< 11g, 12M */
178     WM_WIFI_TX_RATEIDX_18M,       /**< 11g, 18M */
179     WM_WIFI_TX_RATEIDX_24M,       /**< 11g, 24M */
180     WM_WIFI_TX_RATEIDX_36M,       /**< 11g, 36M */
181     WM_WIFI_TX_RATEIDX_48M,       /**< 11g, 48M */
182     WM_WIFI_TX_RATEIDX_54M,       /**< 11g, 54M */
183     WM_WIFI_TX_RATEIDX_MCS0,      /**< 11n-20MHz, mcs0 */
184     WM_WIFI_TX_RATEIDX_MCS1,      /**< 11n-20MHz, mcs1 */
185     WM_WIFI_TX_RATEIDX_MCS2,      /**< 11n-20MHz, mcs2 */
186     WM_WIFI_TX_RATEIDX_MCS3,      /**< 11n-20MHz, mcs3 */
187     WM_WIFI_TX_RATEIDX_MCS4,      /**< 11n-20MHz, mcs4 */
188     WM_WIFI_TX_RATEIDX_MCS5,      /**< 11n-20MHz, mcs5 */
189     WM_WIFI_TX_RATEIDX_MCS6,      /**< 11n-20MHz, mcs6 */
190     WM_WIFI_TX_RATEIDX_MCS7,      /**< 11n-20MHz, mcs7 */
191     WM_WIFI_TX_RATEIDX_MCS8,      /**< 11n-40MHz, mcs8 */
192     WM_WIFI_TX_RATEIDX_MCS9,      /**< 11n-40MHz, mcs9 */
193     WM_WIFI_TX_RATEIDX_MCS10,     /**< 11n-40MHz, mcs10 */
194     WM_WIFI_TX_RATEIDX_MCS11,     /**< 11n-40MHz, mcs11 */
195     WM_WIFI_TX_RATEIDX_MCS12,     /**< 11n-40MHz, mcs12 */
196     WM_WIFI_TX_RATEIDX_MCS13,     /**< 11n-40MHz, mcs13 */
197     WM_WIFI_TX_RATEIDX_MCS14,     /**< 11n-40MHz, mcs14 */
198     WM_WIFI_TX_RATEIDX_MCS15,     /**< 11n-40MHz, mcs15 */
199     WM_WIFI_TX_RATEIDX_MCS32      /**< invalid rate */
200 };
201 
202 enum tls_wifi_oneshot_result_type {
203     WM_WIFI_ONESHOT_TYPE_SSIDPWD,
204     WM_WIFI_ONESHOT_TYPE_CUSTOMDATA
205 };
206 
207 enum tls_wifi_client_event_type {
208     WM_WIFI_CLIENT_EVENT_ONLINE,
209     WM_WIFI_CLIENT_EVENT_OFFLINE
210 };
211 
212 enum tls_wifi_op_mode {
213     STATION_MODE = 1,
214     SOFTAP_MODE,
215     STATIONAP_MODE
216 };
217 
218 /** current bss information */
219 struct tls_curr_bss_t {
220     u8 bssid[ETH_ALEN];    /**< BSSID of connected AP */
221     u8 ssid[32];           /**< SSID of connected AP */
222     u8 ssid_len;           /**< SSID length of connected AP */
223     u8 channel;            /**< channel of connected AP */
224     u8 type;               /**< BSS's type of connected AP, value is:
225                                 IEEE80211_MODE_INFRA, IEEE80211_MODE_IBSS,
226                                 IEEE80211_MODE_AP,    IEEE80211_MODE_APSTA */
227     u8 encryptype;         /**< BSS's encryption type of connected AP, value is: IEEE80211_ENCRYT_NONE,
228                                 IEEE80211_ENCRYT_WEP40,     IEEE80211_ENCRYT_WEP104,
229                                 IEEE80211_ENCRYT_TKIP_WPA,  IEEE80211_ENCRYT_CCMP_WPA,
230                                 IEEE80211_ENCRYT_TKIP_WPA2, IEEE80211_ENCRYT_CCMP_WPA2,
231                                 IEEE80211_ENCRYT_AUTO_WPA,  IEEE80211_ENCRYT_AUTO_WPA2 */
232     u8 rssi;               /**< single strength of AP */
233 };
234 
235 /** secret key information */
236 struct tls_key_info_t {
237     u8 format;     /**< key format, value is: 0-hex, 1-ascii */
238     u8 index;      /**< key index, value is: 1-4 (only wep) */
239     u8 key_len;    /**< key length */
240     u8 key[64];    /**< key content */
241 };
242 
243 /** Wi-Fi configuration of softap */
244 struct tls_softap_info_t {
245     u8 ssid[33];    /**< SSID of softap */
246     u8 encrypt;     /**< encryption mode of softap, value is: IEEE80211_ENCRYT_NONE,
247                          IEEE80211_ENCRYT_WEP40,     IEEE80211_ENCRYT_WEP104,
248                          IEEE80211_ENCRYT_TKIP_WPA,  IEEE80211_ENCRYT_CCMP_WPA,
249                          IEEE80211_ENCRYT_TKIP_WPA2, IEEE80211_ENCRYT_CCMP_WPA2 */
250     u8 channel;     /**< channel of softap */
251     struct tls_key_info_t keyinfo;  /**< Password (key) of softap */
252 };
253 
254 /** ip address information */
255 struct tls_ip_info_t {
256     u8 ip_addr[4];     /**< IP address */
257     u8 netmask[4];     /**< netmask */
258     u8 dnsname[32];    /**< DNS server name */
259 };
260 
261 /** Wi-Fi configuration of ibss */
262 struct tls_ibss_info_t {
263     u8 ssid[33];    /**< SSID of ibss */
264     u8 encrypt;     /**< encryption mode of ibss, value is: IEEE80211_ENCRYT_NONE,
265                          IEEE80211_ENCRYT_WEP40,     IEEE80211_ENCRYT_WEP104,
266                          IEEE80211_ENCRYT_TKIP_WPA,  IEEE80211_ENCRYT_CCMP_WPA,
267                          IEEE80211_ENCRYT_TKIP_WPA2, IEEE80211_ENCRYT_CCMP_WPA2,
268                          IEEE80211_ENCRYT_AUTO_WPA,  IEEE80211_ENCRYT_AUTO_WPA2 */
269     u8 channel;     /**< channel of ibss */
270     struct tls_key_info_t keyinfo;    /**< Password (key) of ibss */
271 };
272 
273 /** ip address information of ibss */
274 struct tls_ibssip_info_t {
275     u8 ip[4];         /**< IP address */
276     u8 netmask[4];    /**< netmask */
277     u8 gateway[4];    /**< gateway */
278     u8 dns1[4];       /**< DNS1 IP address */
279     u8 dns2[4];       /**< DNS2 IP address */
280 };
281 
282 /** bss information */
283 struct tls_bss_info_t {
284     u8 bssid[ETH_ALEN];    /**< MAC address of AP */
285     u8 mode;               /**< AP type, value is: 1-ibss, 2-ess */
286     u8 channel;            /**< channel of AP */
287     u8 privacy;            /**< encryption type, @ref enum tls_wifi_auth_mode */
288     u8 ssid_len;           /**< SSID length */
289     u8 rssi;               /**< signal strength of AP, real rssi = (signed char)rssi */
290     u8 ssid[32];           /**< SSID of AP */
291     u32 max_data_rate;     /**< maximum rate of AP, the unit is Mbps */
292     bool wps_support;      /**< is support WPS function */
293 };
294 
295 /** scan result */
296 struct tls_scan_bss_t {
297     u32     count;                   /**< total count */
298     u32     length;                  /**< bss info total length */
299     struct tls_bss_info_t bss[1];    /**< list of bss found*/
300 };
301 
302 /** station information */
303 struct tls_sta_info_t {
304     u8  mac_addr[ETH_ALEN];    /**< MAC address of station */
305 };
306 
307 /** 802.11 packet information from the physical layer */
308 struct tls_wifi_ext_t {
309     u8 rssi;    /**< signal strength */
310     u8 rx_rate; /**< Rx_rate */
311 };
312 
313 /** 802.11 mac address */
314 struct tls_wifi_hdr_mac_t {
315     u8  da_addr[ETH_ALEN];    /**< MAC address of destination */
316     u8  sa_addr[ETH_ALEN];    /**< MAC address of source */
317     u8  bssid[ETH_ALEN];      /**< MAC address of AP */
318 };
319 
320 /** transport rate and gain */
321 struct tls_wifi_tx_rate_t {
322     enum tls_wifi_tx_rate tx_rate;    /**< Wi-Fi ransport rate */
323     u8 tx_gain;                       /**< Wi-Fi ransport gain,
324                                            The caller can get the maximum gain
325                                            by using the tls_wifi_get_tx_gain_max function. */
326     u8 retry_times;                   /**< Wi-Fi number of retransmissions, ranging from 1 to 15. */
327 };
328 
329 /** scan param */
330 struct tls_wifi_scan_param_t {
331     u32 scan_times;        /**< Scan times, >=0, if zero, only 1 times */
332     /**< Scan channel list ,[0,3FFF],per bit is one channel,if zero or above 0x3FFF, scan all channel*/
333     u16 scan_chanlist;
334     u16 scan_chinterval;   /**< Scan channel switch time,>=0, if zero, use default value, unit:ms */
335 };
336 
337 /** callback function of receive Wi-Fi data */
338 typedef void (*tls_wifi_data_recv_callback)(u8* data, u32 data_len);
339 
340 /** callback function of Wi-Fi PSMode Preprocess when enter chipsleep function */
341 typedef void (*tls_wifi_psm_prechipsleep_callback)(void);
342 
343 /** callback function of Wi-Fi PSMode Using chipsleep function */
344 typedef void (*tls_wifi_psm_chipsleep_callback)(u32 sleeptime);
345 
346 /** callback function of Wi-Fi PSMode Postprocess after chip wakeup */
347 typedef void (*tls_wifi_psm_postchipsleep_callback)(void);
348 
349 /** callback function of receive ETHERNET data */
350 typedef int (*net_rx_data_cb)(const u8 *bssid, u8 *buf, u32 buf_len);
351 
352 typedef void (*tls_wifi_data_ext_recv_callback)(u8* data, u32 data_len, struct tls_wifi_ext_t *ext);
353 
354 /** wifi event status structure for user layer*/
355 typedef void (*tls_wifi_netif_status_event_fn)(u8 status);
356 struct tls_wifi_netif_status_event {
357     struct dl_list list;
358     tls_wifi_netif_status_event_fn status_callback;
359 };
360 
361 /**
362  * @defgroup Wi-Fi_APIs Wi-Fi APIs
363  * @brief Wi-Fi related APIs
364  */
365 
366 /**
367  * @addtogroup Wi-Fi_APIs
368  * @{
369  */
370 
371 /**
372  * @brief          This function is used to enable/disable listen mode
373  *
374  * @param[in]      enable:non-zero, disable: 0
375  *
376  * @return         None
377  *
378  * @note           This function used when oneshot start.
379  */
380 void tls_wifi_set_listen_mode(u8 enable);
381 
382 /**
383  * @brief          This function is used to get listen mode
384  *
385  * @param          None
386  *
387  * @retval         0        normal mode
388  * @retval         non-zero listen mode
389  *
390  * @note           None
391  */
392 u8 tls_wifi_get_listen_mode(void);
393 
394 /**
395 * @brief          This function is used to filter multicast frames
396 * @param mac:     The multicast frame that we want receive or filter.
397 *
398 * @param receive: 1, receive this multicast frame
399 *                 0, filter this multicast frame
400 *
401 * @note usage:    For example: u8 mac[6]={01, 00, 5e, 7f, ff, fa},if receive
402 *                 is set to 0,the 802.11 multicast frames whose hdr->addr1 is
403 *                 [01 00 5e 7f ff fa] will be filtered.
404 */
405 u8 tls_filter_mcast_mac(u8 *mac, u8 receive);
406 
407 /**
408  * @brief         This function is used to set mac filter.
409  * @param[in] mac:     mac: to be filtered or received
410  *
411  * @param[in] receive: 1:not filter,zero:filter
412  *
413  * @param[in] clear:   1:clear all, 0:do not clear, only add new filter
414  *
415  * @return         None
416  *
417  * @note usage:    normally, it is used to oneshot config
418  */
419 void tls_wifi_set_bcast_mac_filter(u8 *mac, u8 receive, u8 clear);
420 
421 /**
422  * @brief           This function is used to restore mac filter to normal mode.
423  *
424  * @param[in]       None
425  *
426  * @return           None
427  *
428  * @note           Normally, it is used to restore mac filter after oneshot config
429  */
430 void tls_wifi_restore_bcast_mac_filter(void);
431 
432 /**
433  * @brief          This function is used to register recv wifi data callback function
434  *
435 
436  * @return         None
437  *
438  * @note           None
439  */
440 void tls_wifi_data_recv_cb_register(tls_wifi_data_recv_callback callback);
441 
442 /**
443  * @brief          This function is used to register recv wifi extended
444  *                 data callback function
445  *
446  * @param[in]      callback   point to receive Wi-Fi extended data function
447  *
448  * @return         None
449  *
450  * @note           None
451  */
452 void tls_wifi_data_ext_recv_cb_register(tls_wifi_data_ext_recv_callback callback);
453 
454 /**
455  * @brief      This function is used to register recv wifi management frame
456  *                   callback function
457  *
458 
459  * @return      None
460  *
461  * @note           None
462  */
463 void tls_wifi_mgmt_ext_recv_cb_register(tls_wifi_data_ext_recv_callback callback);
464 
465 /**
466  * @brief       This function is used to register chipsleep callback function
467  *                   when using chip sleep for powersaving
468  *
469  * @param[in]       sleepcallback: pointer to function when enter to chipsleep
470  * @param[in]       precallback: pointer to function before enter to chipsleep
471  * @param[in]       postcallback: pointer to function after leave chipsleep
472  *
473  * @return       None
474  *
475  * @note           None
476  */
477 void tls_wifi_psm_chipsleep_cb_register(tls_wifi_psm_chipsleep_callback sleepcallback,
478     tls_wifi_psm_prechipsleep_callback precallback,
479     tls_wifi_psm_postchipsleep_callback postcallback);
480 
481 /**
482  * @brief       This function is used to set chipsleep valid flag
483  *
484  * @param[in]       flag: use chipsleep when psm using.0:using normal wifi sleep, non-zero:using chipsleep
485  *
486  * @return       None
487  *
488  * @note           None
489  */
490 void tls_wifi_set_psm_chipsleep_flag(u32 flag);
491 
492 /**
493  * @brief       This function is used to get chipsleep valid flag
494  *
495  * @param[in]       None
496  *
497  * @return       None
498  *
499  * @note           None
500  */
501 u32 tls_wifi_get_psm_chipsleep_flag(void);
502 
503 /**
504  * @brief          This function is used to set oneshot config flag
505  *
506  * @param[in]      flag 0: closed oneshot
507  *                      1: one shot open
508 
509  *                      4: bt
510  *
511  * @return         0��success
512  *                 -1��failed
513  *
514  * @note           None
515  */
516 int   tls_wifi_set_oneshot_flag(u8 flag);
517 
518 /**
519  * @brief          This function is used to get one shot flag
520  *
521  * @param          None
522  *
523  * @retval         0: oneshot closed
524  *                 1: one shot open
525  *                 2: AP+socket
526  *                 3: AP+WEBSERVER
527  *                 4: bt
528  *
529  * @note           None
530  */
531 int     tls_wifi_get_oneshot_flag(void);
532 
533 /** callback function of oneshot result */
534 typedef void (*tls_wifi_oneshot_result_callback)(enum tls_wifi_oneshot_result_type type);
535 
536 /**
537  * @brief          before calling tls_wifi_get_oneshot_ssidpwd or tls_wifi_get_oneshot_customdata,
538  *                 application should call this function to register the call back function
539  *
540  * @param[in]      callback         callback function pointer
541  *
542  * @return         None
543  *
544  * @note           None
545  */
546 void tls_wifi_oneshot_result_cb_register(tls_wifi_oneshot_result_callback callback);
547 
548 /**
549  * @brief          This function is used to get one shot ssid and password information.
550  *
551  * @param[in]      ssid     wifi name
552  * @param[in]      pwd      pwssword
553  *
554  * @return         None
555  *
556  * @note           None
557  */
558 void tls_wifi_get_oneshot_ssidpwd(u8 *ssid, u8 *pwd);
559 
560 /**
561  * @brief          This function is used to get one shot custom data
562  *
563  * @param[in]      data     custom data
564  *
565  * @return         None
566  *
567  * @note           None
568  */
569 void tls_wifi_get_oneshot_customdata(u8 *data);
570 
571 /**
572  * @brief          This function is used to change channel actively
573  *
574  * @param[in]      chanid
575  *
576  * @return         None
577  *
578  * @note           Normally, it is just used in listen mode;
579  */
580 void tls_wifi_change_chanel(u32 chanid);
581 
582 /**
583  * @brief          This function is used to trigger scan AP
584  *
585  * @param          None
586  *
587  * @retval         WM_SUCCESS                     start scan
588  * @retval         WM_WIFI_SCANNING_BUSY         scanning
589  * @retval         WM_FAILED                    failed
590  *
591  * @note           If not SUCCESS, user needs to call this function again
592  *                 to trigger scan
593  */
594 int tls_wifi_scan(void);
595 
596 /**
597  * @brief          This function is used to trigger scan AP
598  *
599  * @param          None
600  *
601  * @retval         WM_SUCCESS                     start scan
602  * @retval         WM_WIFI_SCANNING_BUSY         scanning
603  * @retval         WM_FAILED                    failed
604  *
605  * @note           If not SUCCESS, user needs to call this function again
606  *                 to trigger scan
607  */
608 int tls_wifi_passive_scan(void);
609 
610 /**
611 * @brief         scan AP ,user can set channellist,scan times and switch interval per channel
612 *
613 * @param[in]     scan_param
614 *                scan_param member
615 *
616 * @retval        WM_SUCCESS                will start scan
617 * @retval        WM_WIFI_SCANNING_BUSY     wifi module is scanning now
618 * @retval        WM_FAILED                other Error
619 *
620 * @note           in case not SUCCESS, user need to call this function again to trigger the scan
621 */
622 int tls_wifi_scan_by_param(struct tls_wifi_scan_param_t *scan_param);
623 
624 /**
625  * @brief          Before calling tls_wifi_scan() , application should call
626  *                 this function to register the call back function;
627  *
628  * @param[in]      callback  point to callback function
629  *
630  * @return         None
631 
632  *                 and return immediately.
633  *                 After callback called, scan result can be get by
634  *                 calling function tls_wifi_get_scan_rslt
635  */
636 void tls_wifi_scan_result_cb_register(void (*callback)(void));
637 
638 /**
639  * @brief          This function is used to get scan result
640  *
641  * @param[out]     buf          buf to be used to store returned BSS info
642  * @param[in]      buffer_size  buf size
643  *
644  * @retval         WM_SUCCESS     success
645  * @retval         WM_FAILED      failed
646  *
647  * @note           User need to alloc buffer in advance.
648  *                 One item of scan result is @ref struct tls_bss_info_t.
649  *                 Size for one item of scan result is 48Bytes;
650  *                   The buffer size depends how many items user wants.
651  *                 Compared with the previous scanning results,
652  *                 max_data_rate and wps_support fields were added,
653  *                 and the meaning of the privacy field was extended.
654  */
655 int tls_wifi_get_scan_rslt(u8* buf, u32 buffer_size);
656 
657 /**
658  * @brief          This function is used to create soft ap
659  *
660  * @param[in]      apinfo   softap Wi-Fi configuration
661  * @param[in]      ipinfo   softap ip address
662  *
663  * @retval         WM_WIFI_ERR_SSID     SSID is NULL
664  * @retval         WM_WIFI_ERR_KEY      key info not
665 
666  *
667  * @note           None
668  */
669 int tls_wifi_softap_create(struct tls_softap_info_t* apinfo, struct tls_ip_info_t* ipinfo);
670 
671 /**
672  * @brief          This function is used to destroy soft ap
673  *
674  * @param          None
675  *
676  * @return         None
677  *
678  * @note           None
679  */
680 
681 /**
682  * @brief          This function is used to get soft ap's state
683  *
684  * @param          None
685  *
686  * @return         softap's state, @ref tls_wifi_states
687  *
688  * @note           None
689  */
690 enum tls_wifi_states tls_wifi_softap_get_state(void);
691 
692 /** callback function of wifi client event */
693 typedef void (*tls_wifi_client_event_callback)(u8 *mac, enum tls_wifi_client_event_type event);
694 
695 /**
696  * @brief          This function is used to register client event
697  *
698  * @param[in]    client event callback
699  *
700  * @return         None
701  *
702  * @note           None
703  */
704 void tls_wifi_softap_client_event_register(tls_wifi_client_event_callback callback);
705 
706 /**
707  * @brief           This function is used to get the authed sta list
708  *
709  * @param[out]     sta_num the authed's station number
710  *
711  * @param[out]     buf address to store returned station list info(struct tls_sta_info_t[])
712  *
713  * @param[in]     buf_size
714  *
715  * @return           None
716  *
717  * @note           None
718  */
719 void tls_wifi_get_authed_sta_info(u32 *sta_num, u8 *buf, u32 buf_size);
720 
721 /**
722  * @brief          This function is used to create or join ibss
723  *
724  * @param[in]      *ibssinfo    ibss Wi-Fi configuration
725  * @param[in]      *ipinfo      ibss ip address
726  *
727  * @retval         WM_SUCCESS         IBSS join or create ok
728  * @retval         WM_WIFI_ERR_SSID SSID is NULL
729  * @retval         WM_WIFI_ERR_KEY  key info not correct
730  *
731  * @note           Join IBSS if existed
732  *                 Create IBSS by SSID when not existed.
733  */
734 int tls_wifi_ibss_create(struct tls_ibss_info_t *ibssinfo, struct tls_ibssip_info_t *ipinfo);
735 
736 /**
737  * @brief          This function is used to destroy or leave Wi-Fi network
738  *
739  * @param          None
740  *
741  * @return         None
742  *
743  * @note           For AP,   destroy soft AP
744  *                 For STA,  leave the network by AP
745  *                 For IBSS, destroy or leave the IBSS network.
746  */
747 void tls_wifi_disconnect(void);
748 
749 /* void *connectinfo (about 1024 bytes buf) */
750 int tls_wifi_faslink_connect(void *connectinfo);
751 
752 /* void *connectinfo (about 1024 bytes buf) */
753 int tls_wifi_get_fastlink_info(void *connectinfo);
754 
755 /**
756  * @brief          This function is used to connect AP
757  *
758  * @param[in]      *ssid       Network  Name to connect
759  * @param[in]      ssid_len    length of SSID
760  * @param[in]      *pwd        password to connect AP
761  * @param[in]      pwd_len     length of password
762  *
763  * @retval         WM_SUCCESS    config ok, wifi will start to connect AP;
764  * @retval         WM_FAILED     parameter wrong
765  *
766  * @note           User should register Wi-Fi status callback function
767  *                 to get result;
768  *                   wifi_status_change_cb just return WIFI MAC layer status;
769  *                   User should register netif status callback
770  *                 to get TCP/IP layer status;
771  */
772 int tls_wifi_connect(u8 *ssid, u8 ssid_len, u8 *pwd, u8 pwd_len);
773 
774 /**
775  * @brief          This function is used to connect AP by BSSID
776  *
777  * @param[in]      *bssid    BSSID to connect
778  * @param[in]      *pwd      password to connect AP
779  * @param[in]      pwd_len   length of password
780  *
781  * @retval         WM_SUCCESS     success
782  * @retval         WM_FAILED      failed
783  *
784  * @note           When SSID hided,this function can not be used.
785  *                    User should register Wi-Fi status callback function
786  *                 to get result;
787  *                   wifi_status_change_cb just return WIFI MAC layer status;
788  *                   User should register netif status callback
789  *                 to get TCP/IP layer status;
790  */
791 int tls_wifi_connect_by_bssid(u8 *bssid, u8 *pwd, u8 pwd_len);
792 
793 /**
794  * @brief          This function is used to connect AP by SSID an BSSID
795  *
796  * @param[in]      *ssid      Network  Name to connect
797  * @param[in]      ssid_len   length of SSID
798  * @param[in]      *bssid     BSSID to connect with SSID
799  * @param[in]      *pwd       password to connect AP
800  * @param[in]      pwd_len    length of password
801  *
802  * @retval         WM_SUCCESS     success
803  * @retval         WM_FAILED      failed
804  *
805  * @note           When SSID&BSSID is knonw, user can use this function
806  *                 to connect Wi-Fi AP.
807  *                    User should register Wi-Fi status callback function
808  *                 to get result;
809  *                   wifi_status_change_cb just return WIFI MAC layer status;
810  *                   User should register netif status callback
811  *                 to get TCP/IP layer status;
812  */
813 int tls_wifi_connect_by_ssid_bssid(u8 *ssid, u8 ssid_len, u8 *bssid, u8 *pwd, u8 pwd_len);
814 
815 /**
816  * @brief          Set auto connect mode: Enable/Disable.
817  *                 Get auto connect mode parameter
818  *
819  * @param[in]      opt     WIFI_AUTO_CNT_FLAG_SET or WIFI_AUTO_CNT_FLAG_GET
820  * @param[in]      mode    WIFI_AUTO_CNT_OFF WIFI_AUTO_CNT_ON
821  *                         or WIFI_AUTO_CNT_TMP_OFF
822  *
823  * @retval         WM_SUCCESS success
824  * @retval         WM_FAILED  failed
825 
826  *                    WIFI_AUTO_CNT_ON          Enable/d;
827  *                 WIFI_AUTO_CNT_TMP_OFF     For user initiated "DISCONNECT",
828  *                 such as AT CMD; In such case, user might expect
829  *                 "disconnect witout reconnection, even in WIFI_AUTO_CNT_ON
830  *                 status; WIFI_AUTO_CNT_TMP_OFF flag just be effective
831  *                 for one time of "DISCONNECT";
832  *                 After that or reboot, the FLAG will be set to the previous value;
833  */
834 int tls_wifi_auto_connect_flag(u8 opt, u8* mode);
835 
836 /**
837  * @brief          This function is used to register wifi status changed callback function
838  *
839  * @param[in]      callback   point to wifi status function
840  *
841  * @return         None
842  *
843  * @note
844  *             WIFI_JOIN_SUCCESS connect with wifi AP correctly in Wifi layer;
845  *              No IP address
846  *             WIFI_JOIN_FAILED  did not connect with wifi AP;
847  *                             normally,  timeout in 20s after start connection
848  *             WIFI_DISCONNECTED STA is disconnected with AP for any case,
849  *                             such as wifi AP shut dow, Wi-Fi AP
850  *                             changed password, and so on;
851  */
852 void tls_wifi_status_change_cb_register(void (*callback)(u8 status));
853 
854 /**
855  * @brief          This function is used to get AP's info
856  *
857  * @param[out]     bss    address where the network parameters will be write;
858  *
859  * @return         None
860  *
861  * @note           None
862  */
863 void tls_wifi_get_current_bss(struct tls_curr_bss_t* bss);
864 
865 /*********************************************************************************************************
866                     Wifi WPS API
867 *********************************************************************************************************/
868 #ifdef TLS_CONFIG_WPS
869 
870 /**
871  * @brief          This function generate random PIN code
872  *
873  * @param[out]     pin  buf to store pin code, WPS_PIN_LEN Bytes
874  *
875  * @retval         WM_SUCCESS   success
876  * @retval         other         failed
877  *
878  * @note           None
879  */
880 int tls_wps_get_pin(u8* pin);
881 
882 /**
883  * @brief          set PIN code into system
884  *
885  * @param[in]      pin     8bytes string
886  * @param[in]      pin_len length of pin, should be 8 by current WPS spec
887  *
888  * @retval         WM_SUCCESS   success
889  * @retval         WM_FAILED    failed
890  *
891  * @note           normally, the @pin code will be hard coded during manufacturing. should not use this function;
892  */
893 int tls_wps_set_pin(u8* pin, u8 pin_len);
894 
895 /**
896  * @brief          Start WPS process via PIN mode
897  *
898  * @param          None
899  *
900  * @retval         WM_SUCCESS        success
901  * @retval         WM_FAILED         failed
902  * @retval         WM_WIFI_WPS_BUSY     last WPS process is not finished;
903  *
904  * @note           Normally, 120s for WPS protocol, but for us, 180s totally;
905  *                 Adapter will use the PIN code in system for WPS process
906  *                 and before that, the PIN code should be input
907  *                 into AP/Registrar mannually
908  */
909 int tls_wps_start_pin(void);
910 
911 /**
912  * @brief          Start WPS process via PBC/PushButton mode
913  *
914  * @param          None
915  *
916  * @retval         WM_SUCCESS       success
917  * @retval         WM_FAILED         failed
918  * @retval         WM_WIFI_WPS_BUSY last WPS process is not finished;
919  *
920  * @note           Normally, 120s for WPS protocol, but for us, 180s totally;
921  *                 if OK, adaptor will start the WPS connection;
922  *                 APP should register Wi-Fi/netif status callback to get result
923  */
924 int tls_wps_start_pbc(void);
925 #endif
926 
927 /**
928  * @brief          This function is used to register ETHERNET data rx callback function
929  *
930  * @param[in]      callback    point to receive ETHERNET data function
931  *
932  * @return         None
933  *
934  * @note           register ip rx callback when user porting lwip.
935  */
936 void tls_ethernet_data_rx_callback(net_rx_data_cb callback);
937 #if TLS_CONFIG_AP_OPT_FWD
938 /**
939  * @brief          This function is used to forward IP data packets
940  *                 by routing, only for APSTA mode.
941  *
942  * @param[in]      callback   point to receive ETHERNET data function
943  *
944  * @return         None
945  *
946  * @note           Only in APSTA mode, this function to deal with IP data
947  */
948 void tls_ethernet_ip_rx_callback(net_rx_data_cb callback);
949 #endif
950 
951 /**
952  * @brief          This function is used to set powersave flag
953  *
954  * @param[in]      enable     non-zero: enable  0: disable
955  * @param[in]      alwaysflag 0: only once, lost when restart;  !0: always
956  *
957  * @return         None
958  *
959  * @note           None
960  */
961 void tls_wifi_set_psflag(bool enable, bool alwaysflag);
962 
963 /**
964  * @brief          This function is used to get current powersave flag
965  *
966  * @param          None
967  *
968  * @retval         0        power-saving disable
969  * @retval         non-zero power-saving enable
970  *
971  * @note           None
972  */
973 u32 tls_wifi_get_psflag(void);
974 
975 /**
976  * @brief          This function is used to send oneshot data to other sta
977  *
978  * @param[in]      *dst      NULL , send broadcast info
979  *                           !NULL, send unicast   info
980  * @param[in]      *ssid     SSID to be sent
981  * @param[in]      ssid_len  SSID length to be sent
982  *
983  * @return         None
984  *
985  * @note           None
986  */
987 void tls_wifi_send_oneshotdata(u8 *dst, const u8 *ssid, u8 ssid_len);
988 
989 /**
990  * @brief          This function is used to get max gain by rate index
991  *
992  * @param[in]      tx_rate    rate index (enum)
993  *
994  * @retval         Max Gain
995  *
996  * @note           None
997  */
998 u8 tls_wifi_get_tx_gain_max(enum tls_wifi_tx_rate tx_rate);
999 
1000 /**
1001  * @brief          This function is used to send 802.11 management packet
1002  *
1003  * @param[in]      type      management packet type
1004  * @param[in]      *mac      mac address
1005  * @param[in]      *ie       information elements, if have no ie can fill NULL
1006  * @param[in]      ie_len    information elements length, it's zero if ie is NULL.
1007  * @param[in]      *tx       rate and gain to transfer
1008  *
1009  * @retval         0     success
1010  * @retval         other failed
1011  *
1012  * @note           None
1013  */
1014 int tls_wifi_send_mgmt(enum tls_wifi_mgmt_type type, struct tls_wifi_hdr_mac_t *mac,
1015                        u8 *ie, u16 ie_len, struct tls_wifi_tx_rate_t *tx);
1016 
1017 /**
1018  * @brief          This function is used to send an 802.11 frame
1019  *
1020  * @param[in]      *mac         mac address, it can be NULL
1021  * @param[in]      *data        data packet buffer
1022  * @param[in]       data_len    data packet length
1023  * @param[in]      *tx          rate and gain, it can be NULL
1024  *
1025  * @retval         0            success
1026  * @retval         other        failed
1027  *
1028  * @note     If the @*mac is NULL, @*data should be an entire 802.11 frame.
1029  *           If the @*mac is not NULL, this function will build an 802.11 frame
1030  *           with @*mac as destination mac address and @*data as the data body.
1031  *           If the @*tx is NULL, the packet will be sent at 11B 1Mbps.
1032  */
1033 int tls_wifi_send_data(struct tls_wifi_hdr_mac_t *mac, u8 *data, u16 data_len, struct tls_wifi_tx_rate_t *tx);
1034 
1035 #if TLS_CONFIG_AP
1036 /**
1037  * @brief          This function is used to get authed sta list
1038  *
1039  * @param[out]     *sta_num    authed's station number
1040  * @param[out]     *buf        address to store returned station list info, tls_sta_info_t
1041  * @param[in]      buf_size    buffer size
1042  *
1043  * @return         None
1044  *
1045  * @note           None
1046  */
1047 void tls_wifi_get_authed_sta_info(u32 *sta_num, u8 *buf, u32 buf_size);
1048 #endif
1049 /**
1050  * @brief          This function is used to get current Wi-Fi State
1051  *
1052  * @param          None
1053  *
1054  * @retval         Wi-Fi State, @ref tls_wifi_states
1055  *
1056  * @note           None
1057  */
1058 enum tls_wifi_states tls_wifi_get_state(void);
1059 
1060 /**
1061  * @brief          This function is used to get current error number during joining AP
1062  *
1063  * @param          None
1064  *
1065  * @retval         Error Number(WM_WIFI_ENOERR,WM_WIFI_ENOAP,
1066  *                                WM_WIFI_EKEY,WM_WIFI_ELSI)
1067  *
1068  * @note           None
1069  */
1070 int tls_wifi_get_errno(void);
1071 
1072 /**
1073  * @brief          This function is used to print current error during joining AP
1074  *
1075  * @param[in]      *info   prefix information
1076  *
1077  * @return         None
1078  *
1079  * @note           None
1080  */
1081 void tls_wifi_perror(const char *info);
1082 
1083 /**
1084  * @brief          This function is used to get wifi error
1085  *
1086  * @param[in]      eno  error number(WM_WIFI_ENOERR,WM_WIFI_ENOAP,
1087  *                                   WM_WIFI_EKEY,WM_WIFI_ELSI)
1088  *
1089  * @retval         error description
1090  *
1091  * @note           None
1092  */
1093 const char *tls_wifi_get_errinfo(int eno);
1094 
1095 /**
1096  * @brief          This function is used to customize wifi tx&rx memory
1097  *
1098  * @param[in]      startmem: memory addr, only used from 0x20028000 to 0x20048000
1099  *
1100  * @param[in]      txcnt: wifi tx buf cnt, non -zero value
1101  *
1102  * @param[in]      rxcnt: wifi rx buf cnt, greater than 2 && lower than 30
1103  *
1104  * @retval         0  :successfullly
1105  *                    <0:failure
1106  *
1107  * @note           None
1108  */
1109 int tls_wifi_mem_cfg(u32 startmem, u8 txcnt, u8 rxcnt);
1110 
1111 /**
1112  * @brief          This function is used to set max sta num
1113  *
1114  * @param[in]      ap_sta_num: can be accepted num for sta
1115  *
1116  * @retval         0  :successfullly
1117  *                    <0:failure if ap_sta_num is 0
1118  *
1119  * @note          max sta num is 8, this function must be called before ap created.
1120  */
1121 int tls_wifi_softap_set_sta_num(unsigned char ap_sta_num);
1122 
1123 /**
1124  * @brief          This function is used to deauth sta connected to softap
1125  *
1126  * @param[in]      hwaddr: sta's mac to deauth
1127  *
1128  * @retval         0  :successfullly
1129  *                    <0:failure if hwaddr is null
1130  *
1131  * @note           None
1132  */
1133 int tls_wifi_softap_del_station(unsigned char* hwaddr);
1134 
1135 /**
1136  * @brief          This function is used to set some information display in the process of wifi networking
1137  *
1138  * @param[in]      enable     true: enable  false: disable
1139  *
1140  * @return         None
1141  *
1142  * @note           None
1143  */
1144 void tls_wifi_enable_log(bool enable);
1145 
1146 /**
1147  * @brief          This function is used to set temperature compensation flag
1148  *
1149  * @param[in]      flag:0- close temperature compensation,non-zero-open temperature compensation
1150  *
1151  * @return         None
1152  *
1153  * @note           None
1154  */
1155 void tls_wifi_set_tempcomp_flag(int flag);
1156 
1157 /**
1158  * @brief          This function is used to get temperature compensation flag
1159  *
1160  * @param[in]      None
1161  *
1162  * @return         flag: 0- no temperature compensation. non zero-temperature compensation valid
1163  *
1164  * @note           None
1165  */
1166 u8 tls_wifi_get_tempcomp_flag(void);
1167 
1168 /**
1169  * @}
1170  */
1171 
1172 /**
1173  * @}
1174  */
1175 
1176 int tls_wl_get_isr_count(void);
1177 
1178 /**
1179 
1180  * @param[in]      None
1181  *
1182  * @return         0-success
1183  *
1184  * @note           None
1185  */
1186 int tls_wifi_netif_add_status_event(tls_wifi_netif_status_event_fn event_fn);
1187 
1188 /**
1189  * @brief          This function is used to remove wifi event function
1190  *
1191  * @param[in]      None
1192  *
1193  * @return         0-success
1194  *
1195  * @note           None
1196  */
1197 int tls_wifi_netif_remove_status_event(tls_wifi_netif_status_event_fn event_fn);
1198 
1199 /**
1200  * @brief          This function is used to initialize wifi
1201  *
1202  * @param[in]      None
1203  *
1204  * @return         0-success
1205  *
1206  * @note           None
1207  */
1208 int tls_wifi_init(void);
1209 
1210 /**
1211  * @brief           This function is used to initialize wifi netif event list
1212  *
1213  * @param[in]       None
1214  *
1215  * @return           0-success
1216  *
1217  * @note           None
1218  */
1219 void tls_wifi_netif_event_init(void);
1220 
1221 /**
1222  * @brief          This function is used to get wifi tx buffer when use tcp/ip tx
1223  *
1224  * @param[in]       total_len:tx data len from tcp/ip output
1225  *
1226  * @return           None-zero:available buffer, NULL:no buffer
1227  *
1228  * @note           tls_wifi_buffer_acquire/tls_wifi_buffer_release must be used at pair
1229  */
1230 u8* tls_wifi_buffer_acquire(int total_len);
1231 /**
1232  * @brief          This function is used to tx buffer when use tcp/ip tx
1233  *
1234  * @param[in]      is_apsta: always false if ap and sta use the same network interface
1235  * @param[in]      buffer:   tx data's buffer from tcp/ip
1236  * @return          None
1237  *
1238  * @note          tls_wifi_buffer_acquire/tls_wifi_buffer_release must be used at pair
1239  */
1240 void tls_wifi_buffer_release(bool is_apsta, u8* buffer);
1241 
1242 #endif /* TLS_WIFI_FUNC_H */