summaryrefslogtreecommitdiff
path: root/FreeRTOS/Demo/T-HEAD_CB2201_CDK/csi/csi_driver/include/drv_wifi.h
blob: 0ea3d3eabb36de45b711b9c2d4283d1dbef9288d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
/**
 * Copyright (C) 2016 CSI Project. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef __CSI_WIFI_H__
#define __CSI_WIFI_H__

#ifdef __cplusplus
extern "C" {
#endif

#ifndef bool
#define bool        int8_t
#define false       0        ///< XOS definition of 'false'
#define true        1        ///< XOS definition of 'true'
#endif

typedef enum {
    WIFI_EVENT_WIFI_READY = 0,           /**< WiFi ready */
    WIFI_EVENT_SCAN_DONE,                /**< finish scanning AP */
    WIFI_EVENT_STA_START,                /**< station start */
    WIFI_EVENT_STA_STOP,                 /**< station stop */
    WIFI_EVENT_STA_CONNECTED,            /**< station connected to AP */
    WIFI_EVENT_STA_DISCONNECTED,         /**< station disconnected from AP */
    WIFI_EVENT_STA_AUTHMODE_CHANGE,      /**< the auth mode of AP connected by station changed */
    WIFI_EVENT_STA_GOT_IP,               /**< station got IP from connected AP */
    WIFI_EVENT_STA_WPS_ER_SUCCESS,       /**< station wps succeeds in enrollee mode */
    WIFI_EVENT_STA_WPS_ER_FAILED,        /**< station wps fails in enrollee mode */
    WIFI_EVENT_STA_WPS_ER_TIMEOUT,       /**< station wps timeout in enrollee mode */
    WIFI_EVENT_STA_WPS_ER_PIN,           /**< station wps pin code in enrollee mode */
    WIFI_EVENT_AP_START,                 /**< soft-AP start */
    WIFI_EVENT_AP_STOP,                  /**< soft-AP stop */
    WIFI_EVENT_AP_STACONNECTED,          /**< a station connected to soft-AP */
    WIFI_EVENT_AP_STADISCONNECTED,       /**< a station disconnected from soft-AP */
    WIFI_EVENT_AP_PROBEREQRECVED,        /**< Receive probe request packet in soft-AP interface */
    WIFI_EVENT_AP_STA_GOT_IP6,           /**< station or ap interface v6IP addr is preferred */
    WIFI_EVENT_ETH_START,                /**< ethernet start */
    WIFI_EVENT_ETH_STOP,                 /**< ethernet stop */
    WIFI_EVENT_ETH_CONNECTED,            /**< ethernet phy link up */
    WIFI_EVENT_ETH_DISCONNECTED,         /**< ethernet phy link down */
    WIFI_EVENT_ETH_GOT_IP,               /**< ethernet got IP from connected AP */
    WIFI_EVENT_MAX
} wifi_event_id_t;


typedef enum {
    CSI_IF_WIFI_STA = 0,     /**< CSI station interface */
    CSI_IF_WIFI_AP,          /**< CSI soft-AP interface */
    CSI_IF_ETH,              /**< CSI ethernet interface */
    CSI_IF_MAX
} csi_interface_t;

typedef enum {
    WIFI_MODE_NULL = 0,  /**< null mode */
    WIFI_MODE_STA,       /**< WiFi station mode */
    WIFI_MODE_AP,        /**< WiFi soft-AP mode */
    WIFI_MODE_APSTA,     /**< WiFi station + soft-AP mode */
    WIFI_MODE_MAX
} wifi_mode_t;

typedef csi_interface_t wifi_interface_t;

#define WIFI_IF_STA CSI_IF_WIFI_STA
#define WIFI_IF_AP  CSI_IF_WIFI_AP

typedef enum {
    WIFI_COUNTRY_CN = 0, /**< country China, channel range [1, 14] */
    WIFI_COUNTRY_JP,     /**< country Japan, channel range [1, 14] */
    WIFI_COUNTRY_US,     /**< country USA, channel range [1, 11] */
    WIFI_COUNTRY_EU,     /**< country Europe, channel range [1, 13] */
    WIFI_COUNTRY_MAX
} wifi_country_t;

typedef enum {
    WIFI_AUTH_OPEN = 0,         /**< authenticate mode : open */
    WIFI_AUTH_WEP,              /**< authenticate mode : WEP */
    WIFI_AUTH_WPA_PSK,          /**< authenticate mode : WPA_PSK */
    WIFI_AUTH_WPA2_PSK,         /**< authenticate mode : WPA2_PSK */
    WIFI_AUTH_WPA_WPA2_PSK,     /**< authenticate mode : WPA_WPA2_PSK */
    WIFI_AUTH_WPA2_ENTERPRISE,  /**< authenticate mode : WPA2_ENTERPRISE */
    WIFI_AUTH_MAX
} wifi_auth_mode_t;

enum {
    WIFI_REASON_UNSPECIFIED              = 1,
    WIFI_REASON_AUTH_EXPIRE              = 2,
    WIFI_REASON_AUTH_LEAVE               = 3,
    WIFI_REASON_ASSOC_EXPIRE             = 4,
    WIFI_REASON_ASSOC_TOOMANY            = 5,
    WIFI_REASON_NOT_AUTHED               = 6,
    WIFI_REASON_NOT_ASSOCED              = 7,
    WIFI_REASON_ASSOC_LEAVE              = 8,
    WIFI_REASON_ASSOC_NOT_AUTHED         = 9,
    WIFI_REASON_DISASSOC_PWRCAP_BAD      = 10,
    WIFI_REASON_DISASSOC_SUPCHAN_BAD     = 11,
    WIFI_REASON_IE_INVALID               = 13,
    WIFI_REASON_MIC_FAILURE              = 14,
    WIFI_REASON_4WAY_HANDSHAKE_TIMEOUT   = 15,
    WIFI_REASON_GROUP_KEY_UPDATE_TIMEOUT = 16,
    WIFI_REASON_IE_IN_4WAY_DIFFERS       = 17,
    WIFI_REASON_GROUP_CIPHER_INVALID     = 18,
    WIFI_REASON_PAIRWISE_CIPHER_INVALID  = 19,
    WIFI_REASON_AKMP_INVALID             = 20,
    WIFI_REASON_UNSUPP_RSN_IE_VERSION    = 21,
    WIFI_REASON_INVALID_RSN_IE_CAP       = 22,
    WIFI_REASON_802_1X_AUTH_FAILED       = 23,
    WIFI_REASON_CIPHER_SUITE_REJECTED    = 24,

    WIFI_REASON_BEACON_TIMEOUT           = 200,
    WIFI_REASON_NO_AP_FOUND              = 201,
    WIFI_REASON_AUTH_FAIL                = 202,
    WIFI_REASON_ASSOC_FAIL               = 203,
    WIFI_REASON_HANDSHAKE_TIMEOUT        = 204,
};

typedef enum {
    WIFI_SECOND_CHAN_NONE = 0,  /**< the channel width is HT20 */
    WIFI_SECOND_CHAN_ABOVE,     /**< the channel width is HT40 and the second channel is above the primary channel */
    WIFI_SECOND_CHAN_BELOW,     /**< the channel width is HT40 and the second channel is below the primary channel */
} wifi_second_chan_t;

typedef enum {
    WIFI_SCAN_TYPE_ACTIVE = 0,  /**< active scan */
    WIFI_SCAN_TYPE_PASSIVE,     /**< passive scan */
} wifi_scan_type_t;

typedef struct {
    uint32_t min;  /**< minimum active scan time per channel, units: millisecond */
    uint32_t max;  /**< maximum active scan time per channel, units: millisecond, values above 1500ms may
                                          cause station to disconnect from AP and are not recommended.  */
} wifi_active_scan_time_t;

typedef union {
    wifi_active_scan_time_t active;  /**< active scan time per channel */
    uint32_t passive;                /**< passive scan time per channel, units: millisecond, values above 1500ms may
                                          cause station to disconnect from AP and are not recommended. */
} wifi_scan_time_t;

typedef struct {
    uint8_t *ssid;               /**< SSID of AP */
    uint8_t *bssid;              /**< MAC address of AP */
    uint8_t channel;             /**< channel, scan the specific channel */
    bool show_hidden;            /**< enable to scan AP whose SSID is hidden */
    wifi_scan_type_t scan_type;  /**< scan type, active or passive */
    wifi_scan_time_t scan_time;  /**< scan time per channel */
} wifi_scan_config_t;

typedef struct {
    uint8_t bssid[6];                     /**< MAC address of AP */
    uint8_t ssid[32];                     /**< SSID of AP */
    uint8_t primary;                      /**< channel of AP */
    wifi_second_chan_t second;            /**< second channel of AP */
    int8_t  rssi;                         /**< signal strength of AP */
    wifi_auth_mode_t authmode;            /**< authmode of AP */
    uint32_t low_rate_enable:1;           /**< bit: 0 flag to identify if low rate is enabled or not */
    uint32_t reserved:31;                 /**< bit: 1..31 reserved */
} wifi_ap_record_t;

typedef enum {
    WIFI_PS_NONE,    /**< No power save */
    WIFI_PS_MODEM,   /**< Modem power save */
} wifi_ps_type_t;

#define WIFI_PROTOCOL_11B         1
#define WIFI_PROTOCOL_11G         2
#define WIFI_PROTOCOL_11N         4
#define WIFI_PROTOCOL_LR          8

typedef enum {
    WIFI_BW_HT20 = 1, /* Bandwidth is HT20 */
    WIFI_BW_HT40,     /* Bandwidth is HT40 */
    WIFI_BW_HT20_HT40,
} wifi_bandwidth_t;

typedef struct {
    uint8_t ssid[32];           /**< SSID of soft-AP */
    uint8_t password[64];       /**< Password of soft-AP */
    uint8_t ssid_len;           /**< Length of SSID. If softap_config.ssid_len==0, check the SSID until there is a termination character; otherwise, set the SSID length according to softap_config.ssid_len. */
    uint8_t channel;            /**< Channel of soft-AP */
    wifi_auth_mode_t authmode;  /**< Auth mode of soft-AP. Do not support AUTH_WEP in soft-AP mode */
    uint8_t ssid_hidden;        /**< Broadcast SSID or not, default 0, broadcast the SSID */
    uint8_t max_connection;     /**< Max number of stations allowed to connect in, default 4, max 4 */
    uint16_t beacon_interval;   /**< Beacon interval, 100 ~ 60000 ms, default 100 ms */
} wifi_ap_config_t;

typedef struct {
    uint8_t ssid[32];      /**< SSID of target AP*/
    uint8_t password[64];  /**< password of target AP*/
    bool bssid_set;        /**< whether set MAC address of target AP or not. Generally, station_config.bssid_set needs to be 0; and it needs to be 1 only when users need to check the MAC address of the AP.*/
    uint8_t bssid[6];     /**< MAC address of target AP*/
} wifi_sta_config_t;

typedef union {
    wifi_ap_config_t  ap;  /**< configuration of AP */
    wifi_sta_config_t sta; /**< configuration of STA */
} wifi_config_t;

typedef struct {
    uint8_t mac[6];  /**< mac address of sta that associated with soft-AP */
} wifi_sta_info_t;

#define CSI_WIFI_MAX_CONN_NUM  (10)       /**< max number of stations which can connect to soft-AP */

typedef struct {
    wifi_sta_info_t sta[CSI_WIFI_MAX_CONN_NUM]; /**< station list */
    int       num; /**< number of station that associated with soft-AP */
} wifi_sta_list_t;

typedef enum {
    WIFI_STORAGE_FLASH,  /**< all configuration will strore in both memory and flash */
    WIFI_STORAGE_RAM,    /**< all configuration will only store in the memory */
} wifi_storage_t;

/**
  * @brief     Vendor IE type
  *
  */
typedef enum {
    WIFI_VND_IE_TYPE_BEACON,
    WIFI_VND_IE_TYPE_PROBE_REQ,
    WIFI_VND_IE_TYPE_PROBE_RCSI,
    WIFI_VND_IE_TYPE_ASSOC_REQ,
    WIFI_VND_IE_TYPE_ASSOC_RCSI,
} wifi_vendor_ie_type_t;

/**
  * @brief     Vendor IE index
  *
  */
typedef enum {
    WIFI_VND_IE_ID_0,
    WIFI_VND_IE_ID_1,
} wifi_vendor_ie_id_t;

typedef struct {
    signed rssi:8;            /**< signal intensity of packet */
    unsigned rate:5;          /**< data rate */
    unsigned :1;              /**< reserve */
    unsigned sig_mode:2;      /**< 0:is not 11n packet; 1:is 11n packet */
    unsigned :16;             /**< reserve */
    unsigned mcs:7;           /**< if is 11n packet, shows the modulation(range from 0 to 76) */
    unsigned cwb:1;           /**< if is 11n packet, shows if is HT40 packet or not */
    unsigned :16;             /**< reserve */
    unsigned smoothing:1;     /**< reserve */
    unsigned not_sounding:1;  /**< reserve */
    unsigned :1;              /**< reserve */
    unsigned aggregation:1;   /**< Aggregation */
    unsigned stbc:2;          /**< STBC */
    unsigned fec_coding:1;    /**< if is 11n packet, shows if is LDPC packet or not */
    unsigned sgi:1;           /**< SGI */
    unsigned noise_floor:8;   /**< noise floor */
    unsigned ampdu_cnt:8;     /**< ampdu cnt */
    unsigned channel:4;       /**< which channel this packet in */
    unsigned :12;             /**< reserve */
    unsigned timestamp:32;    /**< timestamp */
    unsigned :32;             /**< reserve */
    unsigned :32;             /**< reserve */
    unsigned sig_len:12;      /**< It is really lenth of packet */
    unsigned :12;             /**< reserve */
    unsigned rx_state:8;      /**< rx state */
} wifi_pkt_rx_ctrl_t;

typedef struct {
    wifi_pkt_rx_ctrl_t rx_ctrl;
    uint8_t payload[0];       /**< ieee80211 packet buff, The length of payload is described by sig_len */
} wifi_promiscuous_pkt_t;

/**
  * @brief     Promiscuous frame type
  *
  */
typedef enum {
    WIFI_PKT_CTRL,  /**< control type, receive packet buf is wifi_pkt_rx_ctrl_t */
    WIFI_PKT_MGMT,  /**< management type, receive packet buf is wifi_promiscuous_pkt_t */
    WIFI_PKT_DATA,  /**< data type, receive packet buf is wifi_promiscuous_pkt_t */
    WIFI_PKT_MISC,  /**< other type, receive packet buf is wifi_promiscuous_pkt_t */
} wifi_promiscuous_pkt_type_t;

#define CSI_OK          0
#define CSI_FAIL        -1

#define CSI_ERR_NO_MEM          0x101
#define CSI_ERR_INVALID_ARG     0x102
#define CSI_ERR_INVALID_STATE   0x103
#define CSI_ERR_INVALID_SIZE    0x104
#define CSI_ERR_NOT_FOUND       0x105
#define CSI_ERR_NOT_SUPPORTED   0x106
#define CSI_ERR_TIMEOUT         0x107
#define CSI_ERR_INVALID_RCSIONSE    0x108
#define CSI_ERR_INVALID_CRC     0x109

//#define CSI_ERR_WIFI_BASE       0x3000 /*!< Starting number of WiFi error codes */

#define CSI_ERR_WIFI_OK          CSI_OK                    /*!< No error */
#define CSI_ERR_WIFI_FAIL        CSI_FAIL                  /*!< General fail code */
#define CSI_ERR_WIFI_NO_MEM      CSI_ERR_NO_MEM            /*!< Out of memory */
#define CSI_ERR_WIFI_ARG         CSI_ERR_INVALID_ARG       /*!< Invalid argument */
#define CSI_ERR_WIFI_NOT_SUPPORT CSI_ERR_NOT_SUPPORTED     /*!< Indicates that API is not supported yet */

#define CSI_ERR_WIFI_NOT_INIT    (CSI_DRV_ERRNO_WIFI_BASE + 1)   /*!< WiFi driver was not installed by csi_wifi_init */
#define CSI_ERR_WIFI_NOT_STARTED (CSI_DRV_ERRNO_WIFI_BASE + 2)   /*!< WiFi driver was not started by csi_wifi_start */
#define CSI_ERR_WIFI_IF          (CSI_DRV_ERRNO_WIFI_BASE + 3)   /*!< WiFi interface error */
#define CSI_ERR_WIFI_MODE        (CSI_DRV_ERRNO_WIFI_BASE + 4)   /*!< WiFi mode error */
#define CSI_ERR_WIFI_STATE       (CSI_DRV_ERRNO_WIFI_BASE + 5)   /*!< WiFi internal state error */
#define CSI_ERR_WIFI_CONN        (CSI_DRV_ERRNO_WIFI_BASE + 6)   /*!< WiFi internal control block of station or soft-AP error */
#define CSI_ERR_WIFI_NVS         (CSI_DRV_ERRNO_WIFI_BASE + 7)   /*!< WiFi internal NVS module error */
#define CSI_ERR_WIFI_MAC         (CSI_DRV_ERRNO_WIFI_BASE + 8)   /*!< MAC address is invalid */
#define CSI_ERR_WIFI_SSID        (CSI_DRV_ERRNO_WIFI_BASE + 9)   /*!< SSID is invalid */
#define CSI_ERR_WIFI_PASSWORD    (CSI_DRV_ERRNO_WIFI_BASE + 10)  /*!< Password is invalid */
#define CSI_ERR_WIFI_TIMEOUT     (CSI_DRV_ERRNO_WIFI_BASE + 11)  /*!< Timeout error */
#define CSI_ERR_WIFI_WAKE_FAIL   (CSI_DRV_ERRNO_WIFI_BASE + 12)  /*!< WiFi is in sleep state(RF closed) and wakeup fail */

typedef enum
{
    FRAME_FILTER_MODE_FORWARD = 1,                  /*!< Packet filter engine forwards matching packets, discards non-matching packets */
    FRAME_FILTER_MODE_DISCARD = 0,                  /*!< Packet filter engine discards matching packets, forwards non-matching packets */
} frame_filter_mode_t;

typedef enum
{
    FRAME_FILTER_RULE_POSITIVE_MATCHING  = 0,       /*!< Specifies that a filter should match a given pattern     */
    FRAME_FILTER_RULE_NEGATIVE_MATCHING  = 1,       /*!< Specifies that a filter should NOT match a given pattern */
} frame_filter_rule_t;

/**
 * Structure describing a frame filter list item
 */
typedef struct
{
    uint32_t                       id;             /*!< Unique identifier for a packet filter item */
    frame_filter_rule_t            rule;           /*!< Filter matches are either POSITIVE or NEGATIVE matching */
    uint16_t                       offset;         /*!< Offset in bytes to start filtering (referenced to the start of the ethernet packet) */
    uint16_t                       mask_size;      /*!< Size of the mask in bytes */
    uint8_t*                       mask;           /*!< Pattern mask bytes to be ANDed with the pattern eg. "\xff00" (must be in network byte order) */
    uint8_t*                       pattern;        /*!< Pattern bytes used to filter eg. "\x0800"  (must be in network byte order) */
    bool                           enabled_status; /*!< When returned from mhd_get_packet_filters, indicates if the filter is enabled */
} wifi_frame_filter_t;

struct wifi_frame_filter_list
{
    struct wifi_frame_filter_list*  next;
};
typedef struct wifi_frame_filter_list wifi_frame_filter_list_t;

typedef void (*wifi_event_cb_t)(uint32_t event);  ///< Signal WiFi Event. Events refer to wifi_event_id_t

/**
  * @brief  Init WiFi
  *         Alloc resource for WiFi driver, such as WiFi control structure, RX/TX buffer,
  *         WiFi NVS structure etc, this WiFi also start WiFi task
  *
  * @attention 1. This API must be called before all other WiFi API can be called
  *
  * @param  cb callback to handle WiFi event
  *
  * @return
  *    - CSI_OK: succeed
  *    - CSI_ERR_WIFI_NO_MEM: out of memory
  *    - others: refer to error code csi_err.h
  */
int32_t csi_wifi_init(wifi_event_cb_t *cb);

/**
  * @brief  Deinit WiFi
  *         Free all resource allocated in csi_wifi_init and stop WiFi task
  *
  * @attention 1. This API should be called if you want to remove WiFi driver from the system
  *
  * @return CSI_OK: succeed
  */
int32_t csi_wifi_deinit(void);

/**
  * @brief     Set the WiFi operating mode
  *
  *            Set the WiFi operating mode as station, soft-AP or station+soft-AP,
  *            The default mode is soft-AP mode.
  *
  * @param     mode  WiFi operating mode
  *
  * @return
  *    - CSI_OK: succeed
  *    - CSI_ERR_WIFI_NOT_INIT: WiFi is not initialized by csi_wifi_init
  *    - CSI_ERR_WIFI_ARG: invalid argument
  *    - others: refer to error code in csi_err.h
  */
int32_t csi_wifi_set_mode(wifi_mode_t mode);

/**
  * @brief  Get current operating mode of WiFi
  *
  * @param[out]  mode  store current WiFi mode
  *
  * @return
  *    - CSI_OK: succeed
  *    - CSI_ERR_WIFI_NOT_INIT: WiFi is not initialized by csi_wifi_init
  *    - CSI_ERR_WIFI_ARG: invalid argument
  */
int32_t csi_wifi_get_mode(wifi_mode_t *mode);

/**
  * @brief  Start WiFi according to current configuration
  *         If mode is WIFI_MODE_STA, it create station control block and start station
  *         If mode is WIFI_MODE_AP, it create soft-AP control block and start soft-AP
  *         If mode is WIFI_MODE_APSTA, it create soft-AP and station control block and start soft-AP and station
  *
  * @return
  *    - CSI_OK: succeed
  *    - CSI_ERR_WIFI_NOT_INIT: WiFi is not initialized by csi_wifi_init
  *    - CSI_ERR_WIFI_ARG: invalid argument
  *    - CSI_ERR_WIFI_NO_MEM: out of memory
  *    - CSI_ERR_WIFI_CONN: WiFi internal error, station or soft-AP control block wrong
  *    - CSI_ERR_WIFI_FAIL: other WiFi internal errors
  */
int32_t csi_wifi_start(void);

/**
  * @brief  Stop WiFi
  *         If mode is WIFI_MODE_STA, it stop station and free station control block
  *         If mode is WIFI_MODE_AP, it stop soft-AP and free soft-AP control block
  *         If mode is WIFI_MODE_APSTA, it stop station/soft-AP and free station/soft-AP control block
  *
  * @return
  *    - CSI_OK: succeed
  *    - CSI_ERR_WIFI_NOT_INIT: WiFi is not initialized by csi_wifi_init
  */
int32_t csi_wifi_stop(void);

/**
 * @brief  Restore WiFi stack persistent settings to default values
 *
 * This function will reset settings made using the following APIs:
 * - csi_wifi_get_auto_connect,
 * - csi_wifi_set_protocol,
 * - csi_wifi_set_config related
 * - csi_wifi_set_mode
 *
 * @return
 *    - CSI_OK: succeed
 *    - CSI_ERR_WIFI_NOT_INIT: WiFi is not initialized by csi_wifi_init
 */
int32_t csi_wifi_restore(void);

/**
  * @brief     Connect the WiFi station to the AP.
  *
  * @attention 1. This API only impact WIFI_MODE_STA or WIFI_MODE_APSTA mode
  * @attention 2. If connecting to an AP, call csi_wifi_disconnect to disconnect.
  *
  * @return 
  *    - CSI_OK: succeed
  *    - CSI_ERR_WIFI_NOT_INIT: WiFi is not initialized by csi_wifi_init
  *    - CSI_ERR_WIFI_NOT_START: WiFi is not started by csi_wifi_start
  *    - CSI_ERR_WIFI_CONN: WiFi internal error, station or soft-AP control block wrong
  *    - CSI_ERR_WIFI_SSID: SSID of AP which station connects is invalid
  */
int32_t csi_wifi_connect(void);

/**
  * @brief     Disconnect the WiFi station from the AP.
  *
  * @return
  *    - CSI_OK: succeed
  *    - CSI_ERR_WIFI_NOT_INIT: WiFi was not initialized by csi_wifi_init
  *    - CSI_ERR_WIFI_NOT_STARTED: WiFi was not started by csi_wifi_start
  *    - CSI_ERR_WIFI_FAIL: other WiFi internal errors
  */
int32_t csi_wifi_disconnect(void);

/**
  * @brief     deauthenticate all stations or associated id equals to aid
  *
  * @param     aid  when aid is 0, deauthenticate all stations, otherwise deauthenticate station whose associated id is aid
  *
  * @return
  *    - CSI_OK: succeed
  *    - CSI_ERR_WIFI_NOT_INIT: WiFi is not initialized by csi_wifi_init
  *    - CSI_ERR_WIFI_NOT_STARTED: WiFi was not started by csi_wifi_start
  *    - CSI_ERR_WIFI_ARG: invalid argument
  *    - CSI_ERR_WIFI_MODE: WiFi mode is wrong
  */
int32_t csi_wifi_deauth_sta(uint16_t aid);

/**
  * @brief     Scan all available APs.
  *
  * @attention If this API is called, the found APs are stored in WiFi driver dynamic allocated memory and that
  *            will be freed in csi_wifi_get_ap_list, so generally, call csi_wifi_get_ap_list to cause
  *            the memory to be freed once the scan is done
  * @attention The values of maximum active scan time and passive scan time per channel are limited to 1500 milliseconds.
  *            Values above 1500ms may cause station to disconnect from AP and are not recommended.
  *
  * @param     config  configuration of scanning
  * @param     block if block is true, this API will block the caller until the scan is done, otherwise
  *                         it will return immediately
  *
  * @return
  *    - CSI_OK: succeed
  *    - CSI_ERR_WIFI_NOT_INIT: WiFi is not initialized by csi_wifi_init
  *    - CSI_ERR_WIFI_NOT_STARTED: WiFi was not started by csi_wifi_start
  *    - CSI_ERR_WIFI_TIMEOUT: blocking scan is timeout
  *    - others: refer to error code in csi_err.h
  */
int32_t csi_wifi_scan_start(wifi_scan_config_t *config, bool block);

/**
  * @brief     Stop the scan in process
  *
  * @return
  *    - CSI_OK: succeed
  *    - CSI_ERR_WIFI_NOT_INIT: WiFi is not initialized by csi_wifi_init
  *    - CSI_ERR_WIFI_NOT_STARTED: WiFi is not started by csi_wifi_start
  */
int32_t csi_wifi_scan_stop(void);

/**
  * @brief     Get AP list found in last scan
  *
  * @param[inout]  number As input param, it stores max AP number ap_records can hold. 
  *                As output param, it receives the actual AP number this API returns.
  * @param         ap_records  wifi_ap_record_t array to hold the found APs
  *
  * @return
  *    - CSI_OK: succeed
  *    - CSI_ERR_WIFI_NOT_INIT: WiFi is not initialized by csi_wifi_init
  *    - CSI_ERR_WIFI_NOT_STARTED: WiFi is not started by csi_wifi_start
  *    - CSI_ERR_WIFI_ARG: invalid argument
  *    - CSI_ERR_WIFI_NO_MEM: out of memory
  */
int32_t csi_wifi_scan_get_ap_records(uint16_t *number, wifi_ap_record_t *ap_records);


/**
  * @brief     Get information of AP which station is associated with
  *
  * @param     ap_info  the wifi_ap_record_t to hold AP information
  *
  * @return
  *    - CSI_OK: succeed
  *    - others: fail
  */
int32_t csi_wifi_sta_get_ap_info(wifi_ap_record_t *ap_info);

/**
  * @brief     Set current power save type
  *
  * @attention Default power save type is WIFI_PS_NONE.
  *
  * @param     type  power save type
  *
  * @return    CSI_ERR_WIFI_NOT_SUPPORT: not supported yet
  */
int32_t csi_wifi_set_ps(wifi_ps_type_t type);

/**
  * @brief     Get current power save type
  *
  * @attention Default power save type is WIFI_PS_NONE.
  *
  * @param[out]  type: store current power save type
  *
  * @return    CSI_ERR_WIFI_NOT_SUPPORT: not supported yet
  */
int32_t csi_wifi_get_ps(wifi_ps_type_t *type);

/**
  * @brief     Set protocol type of specified interface
  *            The default protocol is (WIFI_PROTOCOL_11B|WIFI_PROTOCOL_11G|WIFI_PROTOCOL_11N)
  *
  * @attention Currently we only support 802.11b or 802.11bg or 802.11bgn mode
  *
  * @param     ifx  interfaces
  * @param     protocol_bitmap  WiFi protocol bitmap
  *
  * @return
  *    - CSI_OK: succeed
  *    - CSI_ERR_WIFI_NOT_INIT: WiFi is not initialized by csi_wifi_init
  *    - CSI_ERR_WIFI_IF: invalid interface
  *    - others: refer to error codes in csi_err.h
  */
int32_t csi_wifi_set_protocol(wifi_interface_t ifx, uint8_t protocol_bitmap);

/**
  * @brief     Get the current protocol bitmap of the specified interface
  *
  * @param     ifx  interface
  * @param[out] protocol_bitmap  store current WiFi protocol bitmap of interface ifx
  *
  * @return
  *    - CSI_OK: succeed
  *    - CSI_ERR_WIFI_NOT_INIT: WiFi is not initialized by csi_wifi_init
  *    - CSI_ERR_WIFI_IF: invalid interface
  *    - CSI_ERR_WIFI_ARG: invalid argument
  *    - others: refer to error codes in csi_err.h
  */
int32_t csi_wifi_get_protocol(wifi_interface_t ifx, uint8_t *protocol_bitmap);

/**
  * @brief     Set the bandwidth of specified interface
  *
  * @attention 1. API return false if try to configure an interface that is not enabled
  * @attention 2. WIFI_BW_HT40 is supported only when the interface support 11N
  *
  * @param     ifx  interface to be configured
  * @param     bw  bandwidth
  *
  * @return
  *    - CSI_OK: succeed
  *    - CSI_ERR_WIFI_NOT_INIT: WiFi is not initialized by csi_wifi_init
  *    - CSI_ERR_WIFI_IF: invalid interface
  *    - CSI_ERR_WIFI_ARG: invalid argument
  *    - others: refer to error codes in csi_err.h
  */
int32_t csi_wifi_set_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t bw);

/**
  * @brief     Get the bandwidth of specified interface
  *
  * @attention 1. API return false if try to get a interface that is not enable
  *
  * @param     ifx interface to be configured
  * @param[out] bw  store bandwidth of interface ifx
  *
  * @return
  *    - CSI_OK: succeed
  *    - CSI_ERR_WIFI_NOT_INIT: WiFi is not initialized by csi_wifi_init
  *    - CSI_ERR_WIFI_IF: invalid interface
  *    - CSI_ERR_WIFI_ARG: invalid argument
  */
int32_t csi_wifi_get_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t *bw);

/**
  * @brief     Set primary/secondary channel
  *
  * @attention 1. This is a special API for sniffer
  * @attention 2. This API should be called after csi_wifi_start() or csi_wifi_set_promiscuous()
  *
  * @param     primary  for HT20, primary is the channel number, for HT40, primary is the primary channel
  * @param     second   for HT20, second is ignored, for HT40, second is the second channel
  *
  * @return
  *    - CSI_OK: succeed
  *    - CSI_ERR_WIFI_NOT_INIT: WiFi is not initialized by csi_wifi_init
  *    - CSI_ERR_WIFI_IF: invalid interface
  *    - CSI_ERR_WIFI_ARG: invalid argument
  */
int32_t csi_wifi_set_channel(uint8_t primary, wifi_second_chan_t second);

/**
  * @brief     Get the primary/secondary channel
  *
  * @attention 1. API return false if try to get a interface that is not enable
  *
  * @param[out]  primary   store current primary channel
  * @param[out]  second  store current second channel
  *
  * @return
  *    - CSI_OK: succeed
  *    - CSI_ERR_WIFI_NOT_INIT: WiFi is not initialized by csi_wifi_init
  *    - CSI_ERR_WIFI_ARG: invalid argument
  */
int32_t csi_wifi_get_channel(uint8_t *primary, wifi_second_chan_t *second);

/**
  * @brief     Set country code
  *            The default value is WIFI_COUNTRY_CN
  *
  * @param     country  country type
  *
  * @return
  *    - CSI_OK: succeed
  *    - CSI_ERR_WIFI_NOT_INIT: WiFi is not initialized by csi_wifi_init
  *    - CSI_ERR_WIFI_ARG: invalid argument
  *    - others: refer to error code in csi_err.h
  */
int32_t csi_wifi_set_country(wifi_country_t country);

/**
  * @brief     Get country code
  *
  * @param     country  store current country
  *
  * @return
  *    - CSI_OK: succeed
  *    - CSI_ERR_WIFI_NOT_INIT: WiFi is not initialized by csi_wifi_init
  *    - CSI_ERR_WIFI_ARG: invalid argument
  */
int32_t csi_wifi_get_country(wifi_country_t *country);

/**
  * @brief     Set MAC address of the WiFi station or the soft-AP interface.
  *
  * @attention 1. This API can only be called when the interface is disabled
  * @attention 2. soft-AP and station have different MAC addresses, do not set them to be the same.
  * @attention 3. The bit 0 of the first byte of MAC address can not be 1. For example, the MAC address
  *      can set to be "1a:XX:XX:XX:XX:XX", but can not be "15:XX:XX:XX:XX:XX".
  *
  * @param     ifx  interface
  * @param     mac  the MAC address
  *
  * @return
  *    - CSI_OK: succeed
  *    - CSI_ERR_WIFI_NOT_INIT: WiFi is not initialized by csi_wifi_init
  *    - CSI_ERR_WIFI_ARG: invalid argument
  *    - CSI_ERR_WIFI_IF: invalid interface
  *    - CSI_ERR_WIFI_MAC: invalid mac address
  *    - CSI_ERR_WIFI_MODE: WiFi mode is wrong
  *    - others: refer to error codes in csi_err.h
  */
int32_t csi_wifi_set_mac(wifi_interface_t ifx, uint8_t mac[6]);

/**
  * @brief     Get mac of specified interface
  *
  * @param      ifx  interface
  * @param[out] mac  store mac of the interface ifx
  *
  * @return
  *    - CSI_OK: succeed
  *    - CSI_ERR_WIFI_NOT_INIT: WiFi is not initialized by csi_wifi_init
  *    - CSI_ERR_WIFI_ARG: invalid argument
  *    - CSI_ERR_WIFI_IF: invalid interface
  */
int32_t csi_wifi_get_mac(wifi_interface_t ifx, uint8_t mac[6]);

/**
  * @brief The RX callback function in the promiscuous mode. 
  *        Each time a packet is received, the callback function will be called.
  *
  * @param buf  Data received. Type of data in buffer (wifi_promiscuous_pkt_t or wifi_pkt_rx_ctrl_t) indicated by 'type' parameter.
  * @param type  promiscuous packet type.
  *
  */
typedef void (* wifi_promiscuous_cb_t)(void *buf, wifi_promiscuous_pkt_type_t type);

/**
  * @brief Register the RX callback function in the promiscuous mode.
  *
  * Each time a packet is received, the registered callback function will be called.
  *
  * @param cb  callback
  *
  * @return
  *    - CSI_OK: succeed
  *    - CSI_ERR_WIFI_NOT_INIT: WiFi is not initialized by csi_wifi_init
  */
int32_t csi_wifi_set_promiscuous_rx_cb(wifi_promiscuous_cb_t cb);

/**
  * @brief     Enable the promiscuous mode.
  *
  * @param     en  false - disable, true - enable
  *
  * @return
  *    - CSI_OK: succeed
  *    - CSI_ERR_WIFI_NOT_INIT: WiFi is not initialized by csi_wifi_init
  */
int32_t csi_wifi_set_promiscuous(bool en);

/**
  * @brief     Get the promiscuous mode.
  *
  * @param[out] en  store the current status of promiscuous mode
  *
  * @return
  *    - CSI_OK: succeed
  *    - CSI_ERR_WIFI_NOT_INIT: WiFi is not initialized by csi_wifi_init
  *    - CSI_ERR_WIFI_ARG: invalid argument
  */
int32_t csi_wifi_get_promiscuous(bool *en);

/**
  * @brief     Set the configuration of STA or AP
  *
  * @attention 1. This API can be called only when specified interface is enabled, otherwise, API fail
  * @attention 2. For station configuration, bssid_set needs to be 0; and it needs to be 1 only when users need to check the MAC address of the AP.
  * @attention 3. Limited to only one channel, so when in the soft-AP+station mode, the soft-AP will adjust its channel automatically to be the same as
  *               the channel of the station.
  *
  * @param     ifx  interface
  * @param     conf  station or soft-AP configuration
  *
  * @return
  *    - CSI_OK: succeed
  *    - CSI_ERR_WIFI_NOT_INIT: WiFi is not initialized by csi_wifi_init
  *    - CSI_ERR_WIFI_ARG: invalid argument
  *    - CSI_ERR_WIFI_IF: invalid interface
  *    - CSI_ERR_WIFI_MODE: invalid mode
  *    - CSI_ERR_WIFI_PASSWORD: invalid password
  *    - CSI_ERR_WIFI_NVS: WiFi internal NVS error
  *    - others: refer to the erro code in csi_err.h
  */
int32_t csi_wifi_set_config(wifi_interface_t ifx, wifi_config_t *conf);

/**
  * @brief     Get configuration of specified interface
  *
  * @param     ifx  interface
  * @param[out]  conf  station or soft-AP configuration
  *
  * @return
  *    - CSI_OK: succeed
  *    - CSI_ERR_WIFI_NOT_INIT: WiFi is not initialized by csi_wifi_init
  *    - CSI_ERR_WIFI_ARG: invalid argument
  *    - CSI_ERR_WIFI_IF: invalid interface
  */
int32_t csi_wifi_get_config(wifi_interface_t ifx, wifi_config_t *conf);

/**
  * @brief     Get STAs associated with soft-AP
  *
  * @attention SSC only API
  *
  * @param[out] sta  station list
  *
  * @return
  *    - CSI_OK: succeed
  *    - CSI_ERR_WIFI_NOT_INIT: WiFi is not initialized by csi_wifi_init
  *    - CSI_ERR_WIFI_ARG: invalid argument
  *    - CSI_ERR_WIFI_MODE: WiFi mode is wrong
  *    - CSI_ERR_WIFI_CONN: WiFi internal error, the station/soft-AP control block is invalid
  */
int32_t csi_wifi_ap_get_sta_list(wifi_sta_list_t *sta);


/**
  * @brief     Set the WiFi API configuration storage type
  *
  * @attention 1. The default value is WIFI_STORAGE_FLASH
  *
  * @param     storage : storage type
  *
  * @return
  *   - CSI_OK: succeed
  *   - CSI_ERR_WIFI_NOT_INIT: WiFi is not initialized by csi_wifi_init
  *   - CSI_ERR_WIFI_ARG: invalid argument
  */
int32_t csi_wifi_set_storage(wifi_storage_t storage);

/**
  * @brief     Set auto connect
  *            The default value is true
  *
  * @param     en : true - enable auto connect / false - disable auto connect
  *
  * @return
  *    - CSI_OK: succeed
  *    - CSI_ERR_WIFI_NOT_INIT: WiFi is not initialized by csi_wifi_init
  *    - CSI_ERR_WIFI_MODE: WiFi internal error, the station/soft-AP control block is invalid
  *    - others: refer to error code in csi_err.h
  */
int32_t csi_wifi_set_auto_connect(bool en);

/**
  * @brief     Get the auto connect flag
  *
  * @param[out] en  store current auto connect configuration
  *
  * @return
  *    - CSI_OK: succeed
  *    - CSI_ERR_WIFI_NOT_INIT: WiFi is not initialized by csi_wifi_init
  *    - CSI_ERR_WIFI_ARG: invalid argument
  */
int32_t csi_wifi_get_auto_connect(bool *en);

/**
  * @brief     Set vendor specific element
  *
  * @param     enable  enable or not
  * @param     type  information element type
  * @param     idx  information element index
  * @param     vnd_ie  pointer to a vendor specific element
  *
  * @return
  *    - CSI_OK: succeed
  *    - CSI_ERR_WIFI_NOT_INIT: WiFi is not initialized by csi_wifi_init
  *    - CSI_ERR_WIFI_ARG: invalid argument
  *    - CSI_ERR_WIFI_NO_MEM: out of memory
  */
int32_t csi_wifi_set_vendor_ie(bool enable, wifi_vendor_ie_type_t type, wifi_vendor_ie_id_t idx, uint8_t *vnd_ie);

/**
  * @brief     Define function pointer for vendor specific element callback
  * @param     ctx  reserved
  * @param     type  information element type 
  * @param     sa  source address
  * @param     vnd_ie  pointer to a vendor specific element
  * @param     rssi  received signal strength indication
  */
typedef void (*csi_vendor_ie_cb_t) (void *ctx, wifi_vendor_ie_type_t type, const uint8_t sa[6], const uint8_t *vnd_ie, int rssi);

/**
  * @brief     Set vendor specific element callback
  *
  * @param     cb   callback function
  * @param     ctx  reserved
  *
  * @return
  *    - CSI_OK: succeed
  *    - CSI_ERR_WIFI_NOT_INIT: WiFi is not initialized by csi_wifi_init
  */
int32_t csi_wifi_set_vendor_ie_cb(csi_vendor_ie_cb_t cb, void *ctx);

/**
  * @brief  get whether the wifi driver is allowed to transmit data or not
  *
  * @return
  *     - true  : upper layer should stop to transmit data to wifi driver
  *     - false : upper layer can transmit data to wifi driver
  */
bool csi_wifi_tx_is_stop(void);

/**
  * @brief  free the rx buffer which allocated by wifi driver
  *
  * @param  buffer: rx buffer pointer
  */
void csi_wifi_free_rx_buffer(void *buffer);

/**
  * @brief  transmit the buffer via wifi driver
  *
  * @param  wifi_if : wifi interface id
  * @param  buffer : the buffer to be tansmit
  * @param  len : the length of buffer
  *
  * @return
  *    - ERR_OK  : Successfully transmit the buffer to wifi driver
  *    - ERR_MEM : Out of memory
  *    - ERR_IF : WiFi driver error
  *    - ERR_ARG : Invalid argument
  */
int csi_wifi_tx(wifi_interface_t wifi_if, void *buffer, uint16_t len);

/**
  * @brief     The WiFi RX callback function
  *
  *            Each time the WiFi need to forward the packets to high layer, the callback function will be called.
  *            ebuf is rx buffer allocated by wifi driver
  */
typedef int32_t (*wifi_rxcb_t)(void *buffer, uint16_t len, void *ebuf);

/**
  * @brief     Set the WiFi RX callback
  *
  * @attention 1. Currently we support only one RX callback for each interface
  *
  * @param     ifx : interface
  * @param     fn : WiFi RX callback
  *
  * @return
  *     - CSI_OK : succeed
  *     - others : fail
  */
int32_t csi_wifi_reg_rxcb(wifi_interface_t ifx, wifi_rxcb_t fn);

/**
  \brief       Add Frame Filter Setting with Filter ID.
  \param[in]   filter  Pointer to filter setting
  \return      
*/
int32_t csi_wifi_add_framefilter(const wifi_frame_filter_t *filter);

/**
  \brief       Remove Frame Filter Setting.
  \param[in]   filter_id  Frame Filter ID
  \return      
*/
int32_t csi_wifi_remove_framefilter(uint32_t filter_id);

/**
  \brief       Enable/Disable Specified Frame Filter ID.
  \param[in]   filter_id  Frame Filter ID
  \param[in]   en  Enable or disable
  \return      
*/
int32_t csi_wifi_en_framefilter(uint32_t filter_id, bool en);

/**
  \brief       Get frame filter table list.
  \param[in]   list  frame filter table list
  \param[in]   count_out  the count of filter setting added
  \param[in]   max_count  max filter setting can be supported
  \return      
*/
int32_t csi_wifi_get_framefilter(wifi_frame_filter_list_t* list, uint32_t* count_out, uint32_t max_count);

/**
* @brief This function gets the radio status of the Wi-Fi driver.
*
* @param[out]  on_off indicates the Wi-Fi radio is on or off.
*
* Value                         |Definition                                                              |
* ------------------------------|------------------------------------------------------------------------|
* \b 0                          | OFF, the Wi-Fi radio is turned off, and Wi-Fi TX/RX is disabled.|
* \b 1                          | ON, the Wi-Fi radio is turned on, and Wi-Fi TX/RX is enabled.|
*
*
* @return  >=0 the operation completed successfully, <0 the operation failed.
*
* @note In repeater mode, both Wi-Fi interface and Wi-Fi radio are turned on/off at the same time.
*/
int32_t wifi_config_get_radio(uint8_t *on_off);

/**
* @brief This function sets the radio status of the Wi-Fi driver. This operation takes effect immediately.
*
* @param[in] on_off indicates the Wi-Fi radio is on or off.
*
* Value                         |Definition                                                              |
* ------------------------------|------------------------------------------------------------------------|
* \b 0                          | OFF, the Wi-Fi radio is turned off, and Wi-Fi TX/RX is disabled|
* \b 1                          | ON, the Wi-Fi radio is turned on, and Wi-Fi TX/RX is enabled|
*
* @return  >=0 the operation completed successfully, <0 the operation failed.
*
* @note In repeater mode, both Wi-Fi interface and Wi-Fi radio are turned on/off at the same time.
*/
int32_t wifi_config_set_radio(uint8_t on_off);

/**
* @brief This function gets the RSSI of the connected AP. It's only used for the STA mode and while the station is connected to the AP.
*
* @param[out]  rssi returns the RSSI of the connected AP.
*
* @return  >=0 the operation completed successfully, <0 the operation failed.
*
*
*/
int32_t csi_wifi_connection_get_rssi(int8_t *rssi);


#ifdef __cplusplus
}
#endif

#endif /* __CSI_WIFI_H__ */