xref: /nrf52832-nimble/rt-thread/components/drivers/wlan/wlan_cfg.h (revision 104654410c56c573564690304ae786df310c91fc)
1 /*
2  * Copyright (c) 2006-2018, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author       Notes
8  * 2018-08-06     tyx          the first version
9  */
10 
11 #ifndef __WLAN_CFG_H__
12 #define __WLAN_CFG_H__
13 
14 #include <wlan_dev.h>
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 
20 #ifndef RT_WLAN_CFG_INFO_MAX
21 #define RT_WLAN_CFG_INFO_MAX    (3) /* min is 1 */
22 #endif
23 
24 #define RT_WLAN_CFG_MAGIC       (0x426f6d62)
25 
26 struct rt_wlan_cfg_info
27 {
28     struct rt_wlan_info info;
29     struct rt_wlan_key key;
30 };
31 
32 typedef int (*rt_wlan_wr)(void *buff, int len);
33 
34 struct rt_wlan_cfg_ops
35 {
36     int (*read_cfg)(void *buff, int len);
37     int (*get_len)(void);
38     int (*write_cfg)(void *buff, int len);
39 };
40 
41 void rt_wlan_cfg_init(void);
42 
43 void rt_wlan_cfg_set_ops(const struct rt_wlan_cfg_ops *ops);
44 
45 int rt_wlan_cfg_get_num(void);
46 
47 int rt_wlan_cfg_read(struct rt_wlan_cfg_info *cfg_info, int num);
48 
49 int rt_wlan_cfg_read_index(struct rt_wlan_cfg_info *cfg_info, int index);
50 
51 rt_err_t rt_wlan_cfg_save(struct rt_wlan_cfg_info *cfg_info);
52 
53 rt_err_t rt_wlan_cfg_cache_refresh(void);
54 
55 rt_err_t rt_wlan_cfg_cache_save(void);
56 
57 int rt_wlan_cfg_delete_index(int index);
58 
59 void rt_wlan_cfg_delete_all(void);
60 
61 void rt_wlan_cfg_dump(void);
62 
63 #ifdef __cplusplus
64 }
65 #endif
66 
67 #endif
68