• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 ASR Microelectronics (Shanghai) 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  ****************************************************************************************
18  *
19  * @file lega_wifi_api.h
20  *
21  * @brief WiFi API.
22  *
23  ****************************************************************************************
24  */
25 #ifndef _LEGA_WIFI_API_H_
26 #define _LEGA_WIFI_API_H_
27 
28 #include <stdint.h>
29 #include <stdbool.h>
30 
31 /**
32  *  @brief  wlan network interface enumeration definition.
33  */
34 typedef enum {
35     SOFTAP,   /*Act as an access point, and other station can connect, 4 stations Max */
36     STA,      /*Act as a station which can connect to an access point */
37 } lega_wlan_type_e;
38 
39 typedef enum {
40     EVENT_STATION_UP = 1,  /* used in station mode,
41                             indicate station associated in open mode or 4-way-handshake done in WPA/WPA2 */
42     EVENT_STATION_DOWN,    /* used in station mode, indicate station deauthed */
43     EVENT_AP_UP,           /* used in softap mode, indicate softap enabled */
44     EVENT_AP_DOWN,         /* used in softap mode, indicate softap disabled */
45 } lega_wifi_event_e;
46 typedef enum {
47     CONNECT_SUCC,
48     CONNECT_SCAN_FAIL,
49     CONNECT_CONN_FAIL,
50 } lega_start_adv_results_e;
51 
52 /**
53  *  @brief  Scan result using normal scan.
54  */
55 typedef struct {
56     uint8_t is_scan_adv;
57     char ap_num;       /**< The number of access points found in scanning. */
58     struct {
59         char    ssid[32 + 1]; /* ssid max len:32. +1 is for '\0'. when ssidlen is 32  */
60         char    ap_power;   /**< Signal strength, min:0, max:100. */
61         char    bssid[6];     /* The BSSID of an access point. */
62         char    channel;      /* The RF frequency, 1-13 */
63         uint8_t security;     /* Security type, @ref wlan_sec_type_t */
64     } *ap_list;
65 } lega_wlan_scan_result_t;
66 
67 typedef enum {
68     WLAN_SECURITY_OPEN,                   // NONE
69     WLAN_SECURITY_WEP,                    // WEP
70     WLAN_SECURITY_WPA,                    // WPA
71     WLAN_SECURITY_WPA2,                   // WPA2
72     WLAN_SECURITY_AUTO,                   // WPA or WPA2
73     WLAN_SECURITY_MAX,
74 } lega_wlan_security_e;
75 
76 /* used in event callback of station mode, indicate softap informatino which is connected */
77 typedef struct {
78     int     rssi;           /* rssi */
79     char    ssid[32 + 1];   /* ssid max len:32. +1 is for '\0' when ssidlen is 32  */
80     char    pwd[64 + 1];    /* pwd max len:64. +1 is for '\0' when pwdlen is 64 */
81     char    bssid[6];       /* BSSID of the wlan needs to be connected. */
82 #ifdef CFG_NAN_CONFIG
83     char    pmk[32];
84 #endif
85     char    ssid_len;       /* ssid length */
86     char    pwd_len;        /* password length */
87     char    channel;       /* wifi channel 0-13. */
88     char    security;      /* refer to lega_wlan_security_d */
89 } lega_wlan_ap_info_adv_t;
90 
91 /* only used in station modd */
92 typedef struct {
93     char    dhcp;             /* no use currently */
94     char    macaddr[16];      /* mac address on the target wlan interface, ASCII */
95     char    ip[16];           /* Local IP address on the target wlan interface, ASCII */
96     char    gate[16];         /* Router IP address on the target wlan interface, ASCII */
97     char    mask[16];         /* Netmask on the target wlan interface, ASCII */
98     char    dns[16];          /* no use currently , ASCII */
99     char    broadcastip[16];  /* no use currently , ASCII */
100 } lega_wlan_ip_stat_t;
101 
102 /* only used in station modd */
103 typedef struct {
104     int     is_connected;  /* The link to wlan is established or not, 0: disconnected, 1: connected. */
105     int     wifi_strength; /* Signal strength of the current connected AP */
106     char    ssid[32 + 1];    /* ssid max len:32. +1 is for '\0'. when ssidlen is 32  */
107     char    bssid[6];      /* BSSID of the current connected wlan */
108     int     channel;       /* Channel of the current connected wlan */
109 } lega_wlan_link_stat_t;
110 
111 /* used in open cmd for AP mode */
112 typedef struct {
113     char    ssid[32 + 1];   /* ssid max len:32. +1 is for '\0' when ssidlen is 32  */
114     char    pwd[64 + 1];    /* pwd max len:64. +1 is for '\0' when pwdlen is 64 */
115     int     interval;       /* beacon listen interval */
116     int     hide;           /* hidden SSID */
117     int     channel;       /* Channel */
118 } lega_wlan_ap_init_t;
119 
120 /* used in open cmd of hal_wifi_module_t */
121 typedef struct {
122     char    wifi_mode;              /* refer to hal_wifi_type_t */
123     char    security;               /* security mode */
124     char    wifi_ssid[32];          /* in station mode, indicate SSID of the wlan needs to be connected.
125                                        in softap mode, indicate softap SSID */
126     char    wifi_key[64];           /* in station mode, indicate Security key of the wlan needs to be connected,
127                                        in softap mode, indicate softap password.(ignored in an open system.) */
128     char    local_ip_addr[16];      /* used in softap mode to config ip for dut */
129     char    net_mask[16];           /* used in softap mode to config gateway for dut */
130     char    gateway_ip_addr[16];    /* used in softap mode to config netmask for dut */
131     char    dns_server_ip_addr[16]; /* no use currently */
132     char    dhcp_mode;              /* no use currently */
133     char    channel;                /* softap channel in softap mode; connect channel in sta modd */
134     char    mac_addr[6];            /* connect bssid in sta modd */
135     char    reserved[32];           /* no use currently */
136 #ifdef CFG_NAN_CONFIG
137     uint8_t pmk[32];
138 #endif
139     int     wifi_retry_interval;    /* no use currently */
140 } lega_wlan_init_type_t;
141 
142 /*WLAN error status */
143 typedef enum {
144     WLAN_STA_MODE_BEACON_LOSS = 1,           // in sta mode, cannot receive beacon of peer connected AP for a long time
145     WLAN_STA_MODE_AUTH_FAIL,                 // in sta mode, connect fail during auth
146     WLAN_STA_MODE_ASSOC_FAIL,                // in sta mode, connect fail during association
147     WLAN_STA_MODE_PASSWORD_ERR,              // in sta mode, connect fail as password error
148     WLAN_STA_MODE_NO_AP_FOUND,               // in sta mode, connect fail as cannot find the connecting AP during scan
149     WLAN_STA_MODE_DHCP_FAIL,                 // in sta mode, connect fail as dhcp fail
150 } lega_wlan_err_status_e;
151 
152 typedef struct {
153     uint8_t first_channel;
154     uint8_t last_channel;
155     uint8_t max_tx_power;
156     uint8_t dfs_req;
157 } lega_wlan_country_channel_table_t;
158 
159 #define LEGA_WLAN_CC_CHAN_TABLE_NUM_MAX 1
160 typedef struct {
161     uint8_t country_code[4];
162     uint8_t channel_table_num;
163     lega_wlan_country_channel_table_t table[LEGA_WLAN_CC_CHAN_TABLE_NUM_MAX];
164 } lega_wlan_country_code_param_t;
165 
166 /**
167  * @brief sta ip and mac address used in softap mode
168  * sta_ip_addr: e.g. when ip addr==192.168.1.1<-->sta_ip_addr == 0x0101A8C0
169  */
170 typedef struct {
171     uint32_t sta_ip_addr;                           /* station ip addr  */
172     uint8_t  sta_mac_addr[6];                       /* station mac addr */
173 } lega_wlan_client_addr_info_t;
174 
175 /* store linked station info */
176 typedef struct {
177     int client_num;                                 /* linked station number */
178     lega_wlan_client_addr_info_t sta[4];            /* linked station entry, max client number is 4 */
179 } lega_wlan_ap_client_info_t;
180 // start with dataelem struct declaration
181 typedef enum {
182     MS_OK = 0,
183     MS_ERROR
184 } MS_STATUS;
185 
186 typedef struct ms_hal_realtime_info_s {
187     int8_t   rssi;                      /* indicator of radio signal strength of uplink from STA to AP */
188     uint8_t  channel;                   /* the channel number scanned by radio given */
189     uint32_t unicast_send_speed;        /* statistics for unicast Bytes Sent per second */
190     uint32_t unicast_recv_speed;        /* statistics for unicast Bytes Receive per second */
191     uint32_t multicast_send_speed;      /* statistics for multicast Bytes Sent per second */
192     uint32_t multicast_recv_speed;      /* statistics for multicast Bytes Receive per second */
193     uint32_t broadcast_send_speed;      /* statistics for broadcast Bytes Sent per second */
194     uint32_t broadcast_recv_speed;      /* statistics for broadcast Bytes Receive per second */
195     uint32_t last_uplink_rate;          /* datarate of data-frame transmit from associated STA to AP */
196     uint32_t last_downlink_rate;        /* datarate of data-frame transmit from AP to associated STA */
197     uint32_t utilization_transmit;      /* the time of radio spent on channel transmit data (ms) */
198     uint32_t utilization_receive;       /* the time of radio spent on channel receive data (ms) */
199     uint32_t est_uplink_rate;           /* estimate of MAC layer throuhtput in uplink if chn 100% used */
200     uint32_t est_downlink_rate;         /* estimate of MAC layer throuhtput in downlink if chn 100% used */
201     uint32_t byte_send_speed;           /* bytes sent to associate AP per second */
202     uint32_t byte_recv_speed;           /* bytes receive from associate AP per second */
203     uint32_t packet_send_speed;         /* packets sent to associate AP per second */
204     uint32_t packet_recv_speed;         /* packets receive from associate AP per second */
205     uint32_t errors_send_speed;         /* error packet AP transmit to STA per second (retry limit and other) */
206     uint32_t errors_recv_speed;         /* error packet STA transmit to AP per second */
207     uint32_t retrains_count;            /* total retransmission include same packted retransmit in hw */
208     uint8_t  chn_utilization;           /* measure by the radio on the scanned 20MHZ channel */
209     int8_t   noise;                     /* indicator of the average radio noise plus interference power */
210 } ms_hal_realtime_info_t;
211 
212 typedef struct ms_hal_base_info_s {
213     int8_t   rssi;                      /* indicator of radio signal strength of uplink from STA to AP */
214     uint8_t  channel;                   /* the channel number scanned by radio given */
215     uint8_t  snr;                       /* snr of connected ap for station mode */
216     uint8_t  bssid[6];                  /* mac address of associated AP */
217 } ms_hal_base_info_t;
218 
219 typedef struct ms_hal_status_info_s {
220     uint8_t  enc_type;                  /* security mode, refer to lega_wlan_security_e */
221     uint8_t  dns[16];                   /* dns address assigned to the client */
222     uint64_t bts;                       /* beacon timestamp of associated AP */
223     uint8_t  ipv4[16];                  /* ipv4 address assigned to client */
224     uint8_t  ipv6[16];                  /* ipv6 address assigned to client */
225     uint16_t ssid_len;                  /* ssid length of STA */
226     uint8_t  ssid[32];                  /* ssid of associated AP */
227 } ms_hal_status_info_t;
228 
229 typedef struct ms_hal_test_report_s {
230     uint8_t  sta_num_on_router;         /* the number of STAs associated to this BSS */
231     uint8_t  numofNeighbors;            /* the number of neithbor bss in associate channel */
232     uint32_t byte_tx_speed;             /* bytes sent to associate AP per second */
233     uint32_t byte_rx_speed;             /* bytes receive from associate AP per second */
234     uint32_t packet_tx_speed;           /* packets sent to associate AP per second */
235     uint32_t packet_rx_spped;           /* bytes receive from associate AP per second */
236     uint32_t auth_time;                 /* time used between auth req and last auth rsp */
237     uint32_t assoc_time;                /* time used between assoc req and last assoc rsp */
238     uint8_t  power_save_enable;         /* check powersave mode is whether enable */
239     uint8_t  measure_num;               /*  number of measure frame report */
240     uint8_t  *measure;                  /* measure report content */
241 } ms_hal_test_report_t;
242 
243 /** @brief  get realtime wireless info, call it after in sta mode and connected status
244  *  @return    0       : on success.
245  *  @return    other   : error occurred
246  */
247 MS_STATUS ms_hal_realtime_info_get(ms_hal_realtime_info_t *info);
248 
249 /** @brief  get wireless basic info, call it after in sta mode and connected status
250  *  @return    0       : on success.
251  *  @return    other   : error occurred
252  */
253 MS_STATUS ms_hal_base_info_get(ms_hal_base_info_t *info);
254 
255 /** @brief  get wireless basic info, call it after start sta mode
256  *  @return    0       : on success.
257  *  @return    other   : error occurred
258  */
259 MS_STATUS ms_hal_status_info_get(ms_hal_status_info_t *info);
260 
261 /** @brief  start test wireless quality, call it after start sta mode
262  *  @return    0       : on success.
263  *  @return    other   : error occurred
264  */
265 MS_STATUS ms_hal_test_start(void);
266 /** @brief  get wireless quality test info, call it after call ms_hal_test_start
267  *  @return    0       : on success.
268  *  @return    other   : error occurred
269  */
270 MS_STATUS ms_hal_test_report_get(ms_hal_test_report_t *report);
271 // end of dataelem struct declaration
272 
273 /** @brief  wifi init functin, user should call it before use any wifi cmd
274  *  @return    0       : on success.
275  *  @return    other   : error occurred
276  */
277 int lega_wlan_init(void);
278 
279 /** @brief  wifi deinit functin, call it when donot use wifi any more to free resources
280  *  @return    0       : on success.
281  *  @return    other   : error occurred
282  */
283 int lega_wlan_deinit(void);
284 
285 /** @brief  used in station and softap mode, open wifi cmd
286  *
287  * @param init_info    : refer to lega_wlan_init_type_t
288  *
289  * @return    0       : on success.
290  * @return    other   : error occurred
291  */
292 int lega_wlan_open(lega_wlan_init_type_t *init_info);
293 
294 /** @brief  used in softap mode, open wifi cmd
295  *
296  * @param init_info    : refer to lega_wlan_ap_init_t
297  *
298  * @return    0       : on success.
299  * @return    other   : error occurred
300  */
301 int lega_wlan_ap_open(lega_wlan_ap_init_t *init_info);
302 
303 /** @brief  used in station and softap mode, close wifi cmd
304  *
305  * @return    0       : on success.
306  * @return    other   : error occurred
307  */
308 int lega_wlan_close(void);
309 
310 /** @brief  used in station mode, scan cmd
311  *  @return    0       : on success.
312  *  @return    other   : error occurred
313  */
314 int lega_wlan_start_scan(void);
315 
316 /** @brief  used in station mode, scan cmd
317  *  @return    0       : on success.
318  *  @return    other   : error occurred
319  */
320 int lega_wlan_start_scan_adv(void);
321 
322 /** @brief  used in station mode, scan cmd
323  *
324  * @param ssid    : target ssid to scan
325  *
326  *  @return    0       : on success.
327  *  @return    other   : error occurred
328  */
329 int lega_wlan_start_scan_active(const char *ssid);
330 
331 /** @brief  used in station mode, scan cmd
332  *
333  * @param ssid    : target ssid to scan, could be null
334  * @param bssid   : target bssid to scan, could be null
335  * @param channel : target channel to scan, could be null
336  *
337  *  @return    0       : on success.
338  *  @return    other   : error occurred
339  */
340 int lega_wlan_start_scan_detail(char *ssid, int channel, char *bssid);
341 
342 /** @brief  used in station and softap mode, get mac address(in hex mode) of WIFI device
343  *
344  * @param mac_addr    : pointer to get the mac address
345  *
346  *  @return    0       : on success.
347  *  @return    other   : error occurred
348  */
349 int lega_wlan_get_mac_address(uint8_t *mac_addr);
350 
351 /** @brief  used in station and softap mode, set mac address for WIFI device
352  *
353  *  @param mac_addr    : src mac address pointer to set
354  *
355  */
356 void lega_wlan_set_mac_address(uint8_t *mac_addr);
357 
358 /** @brief  used in station mode, get the ip information
359  *
360  * @param void
361  * @return    NULL    : error occurred.
362  * @return    pointer : ip status got.
363  */
364 lega_wlan_ip_stat_t *lega_wlan_get_ip_status(void);
365 
366 /** @brief  used in station mode, get link status information
367  *
368  * @param link_status    : refer to lega_wlan_link_stat_t
369  *
370  * @return    0       : on success.
371  * @return    other   : error occurred
372  */
373 int lega_wlan_get_link_status(lega_wlan_link_stat_t *link_status);
374 
375 /** @brief  used in station mode, get the associated ap information
376  *
377  * @param void
378  * @return    NULL    : error occurred.
379  * @return    pointer : associated ap info got.
380  */
381 lega_wlan_ap_info_adv_t *lega_wlan_get_associated_apinfo(void);
382 
383 /* used in sniffer mode, open sniffer mode
384 *  @return    0       : on success.
385 *  @return    other   : error occurred
386 */
387 int lega_wlan_start_monitor(void);
388 
389 /* used in sniffer mode, close sniffer mode
390 *  @return    0       : on success.
391 *  @return    other   : error occurred
392 */
393 int lega_wlan_stop_monitor(void);
394 
395 /** @brief  used in sniffer mode, set the sniffer channel, should call this cmd after call start_monitor cmd
396  *
397  * @param channel    : WIFI channel(1-13)
398  *  @return    0       : on success.
399  *  @return    other   : error occurred
400  */
401 int lega_wlan_monitor_set_channel(int channel);
402 
403 /** @brief  used in sta mode, set the ps bc mc and listen interval, called before connect to ap.
404  *
405  * @param listen_bc_mc    : true or false
406  * @param listen_interval :1, 3, 10
407  *  @return    0       : on success.
408  *  @return    other   : error occurred
409  */
410 int lega_wlan_set_ps_options(uint8_t listen_bc_mc, uint16_t listen_interval);
411 
412 /** @brief  used in sta mode, set ps mode on/off
413  *
414  * @param ps_on    : true or false
415  *  @return    0       : on success.
416  *  @return    other   : error occurred
417  */
418 int lega_wlan_set_ps_mode(uint8_t ps_on);
419 
420 /* when use monitor mode, user should register this type of callback function to get the received MPDU */
421 typedef void (*monitor_cb_t)(uint8_t *data, int len, int rssi);
422 
423 /* when use monitor-ap mode, user should register this type of callback function to turn off monitor */
424 typedef void (*monitor_ap_cb_t)(void);
425 
426 /** @brief  used in sniffer mode, callback function to get received MPDU, should register before start_monitor
427  *
428  * @param fn    : refer to monitor_data_cb_t
429  *
430  *  @return    0       : on success.
431  *  @return    other   : error occurred
432  */
433 int lega_wlan_register_monitor_cb(monitor_cb_t fn);
434 
435 /** @brief  used in sniffer-ap mode, callback function for application
436  *
437  * @param fn    : refer to monitor_ap_cb_t
438  *
439  *  @return    0       : on success.
440  *  @return    other   : error occurred
441  */
442 int lega_wlan_register_monitor_ap_cb(monitor_ap_cb_t fn);
443 
444 /* start adv callback function, notify the connect results */
445 typedef void (*start_adv_cb_t)(lega_start_adv_results_e status);
446 
447 /** @brief  used in sta mode, callback function to notify the connecting results
448  *
449  * @param fn    : refer to start_adv_cb_t
450  *
451  *  @return    0       : on success.
452  *  @return    other   : error occurred
453  */
454 int lega_wlan_register_start_adv_cb(start_adv_cb_t fn);
455 
456 /** @brief  used in station mode or sniffer mode, call this cmd to send a MPDU constructed by user
457  *
458  * @param buf    :  mac header pointer of the MPDU
459  * @param len    :  length of the MPDU
460  *
461  * @return    0       : on success.
462  * @return    other   : error occurred
463  */
464 int lega_wlan_send_raw_frame(uint8_t *buf, int len);
465 
466 /* @brief api for nanconfig
467  *
468  */
469 #ifdef CFG_NAN_CONFIG
470 typedef void (*ap_cb_t)(uint32_t len, uint8_t *output, uint8_t *mac_src);
471 int lega_wlan_register_protobuf_frame_handle_cb(ap_cb_t fn);
472 int lega_wlan_nan_update_beacon(uint32_t outlen, uint8_t *output, uint8_t *mac_dst, uint8_t iftype);
473 int lega_wlan_stop_recev_protobuf_frame(void);
474 int lega_wlan_nan_set_seq_num(uint8_t *pframe, uint8_t len);
475 int lega_wlan_nan_set_scan_channel(uint8_t channel, uint32_t duration);
476 int lega_wlan_disable_nanconfig(void);
477 #endif
478 
479 /* enable WIFI stack log, will be output by uart
480 *
481 * @return    0       : on success.
482 * @return    other   : error occurred
483 */
484 int lega_wlan_start_debug_mode(void);
485 
486 /* disable WIFI stack log
487 *
488 * @return    0       : on success.
489 * @return    other   : error occurred
490 */
491 int lega_wlan_stop_debug_mode(void);
492 
493 /*
494  * The event callback function called at specific wifi events occurred by wifi stack.
495  * user should register these callback if want to use the informatin.
496  *
497  * @note For HAL implementors, these callbacks must be
498  *       called under normal task context, not from interrupt.
499  */
500 typedef void (*lega_wlan_cb_ip_got)(lega_wlan_ip_stat_t *ip_status);
501 /** @brief  used in station mode, WIFI stack call this cb when get ip
502  *
503  * @param fn    : cb function type, refer to lega_wlan_ip_stat_t
504  *
505  * @return    0       : on success.
506  * @return    other   : error occurred
507  */
508 int lega_wlan_ip_got_cb_register(lega_wlan_cb_ip_got fn);
509 
510 typedef void (*lega_wlan_cb_stat_chg)(lega_wifi_event_e wlan_event);
511 /** @brief  used in station and softap mode,
512  *          WIFI stack call this cb when status change, refer to lega_wifi_event_e
513  *
514  * @param fn    : cb function type
515  *
516  * @return    0       : on success.
517  * @return    other   : error occurred
518  */
519 int lega_wlan_stat_chg_cb_register(lega_wlan_cb_stat_chg fn);
520 
521 typedef void (*lega_wlan_cb_scan_compeleted)(lega_wlan_scan_result_t *result);
522 /** @brief  used in station mode,
523  *          WIFI stack call this cb when scan complete
524  *
525  * @param fn    : cb function type
526  *
527  * @return    0       : on success.
528  * @return    other   : error occurred
529  */
530 int lega_wlan_scan_compeleted_cb_register(lega_wlan_cb_scan_compeleted fn);
531 
532 typedef void (*lega_wlan_cb_associated_ap)(lega_wlan_ap_info_adv_t *ap_info);
533 /** @brief  used in station mode,
534  *          WIFI stack call this cb when associated with an AP, and tell the AP information
535  *
536  * @param fn    : cb function type
537  *
538  * @return    0       : on success.
539  * @return    other   : error occurred
540  */
541 int lega_wlan_associated_ap_cb_register(lega_wlan_cb_associated_ap fn);
542 
543 /** @brief  calibration RCO clock for RTC
544  *
545  */
546 void lega_drv_rco_cal(void);
547 
548 /** @brief  config to close DCDC PFM mode
549  *
550  */
551 void lega_drv_close_dcdc_pfm(void);
552 
553 /** @brief  config to support smartconfig in MIMO scenario
554  *
555  */
556 void lega_wlan_smartconfig_mimo_enable(void);
557 
558 /** @brief  set information about country code
559  *
560  * @param country_code_param  : refer to lega_wlan_country_code_param_t
561  */
562 void lega_wlan_set_country_code(lega_wlan_country_code_param_t *country_code_param);
563 
564 /** @brief  start monitor and ap coexist mode
565  *
566  * @param init_info    : refer to lega_wlan_init_type_t
567  *
568  * @return    0       : on success.
569  * @return    other   : error occurred
570  */
571 int lega_wlan_start_monitor_ap(lega_wlan_init_type_t *init_info);
572 
573 /** @brief  stop monitor and ap coexist mode
574  *
575  * @return    0       : on success.
576  * @return    other   : error occurred
577  */
578 int lega_wlan_stop_monitor_ap(void);
579 
580 typedef void (*lega_wlan_err_stat_handler)(lega_wlan_err_status_e err_info);
581 /** @brief  user use to register err status callback function,
582  *          WIFI stack call this cb when some error occured, refer to lega_wlan_err_status_e
583  *
584  * @param fn    : cb function type
585  *
586  * @return    0       : on success.
587  * @return    other   : error occurred
588  */
589 int lega_wlan_err_stat_cb_register(lega_wlan_err_stat_handler fn);
590 
591 /** @brief  enable temperature compensation
592  *  called before wifi open
593  *
594  * @param timer_in_sec    : input tmmt detect interval,min 10(second)
595  *
596  */
597 void lega_wlan_enable_tmmt_compensation(uint64_t timer_in_sec);
598 
599 /** @brief  get linked station ip and address in ap mode
600  *  @param            : input param to get sta ip and mac addr
601  */
602 void lega_get_client_ip_mac(lega_wlan_ap_client_info_t *sta_addr);
603 
604 /** @brief  api for uart log control
605  *
606  */
607 void lega_log_enable(void);
608 void lega_log_disable(void);
609 bool lega_log_is_enable(void);
610 
611 #endif  // _LEGA_WIFI_API_H_
612