xref: /OK3568_Linux_fs/external/rkwifibt/drivers/rtl8188fu/core/rtw_chplan.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /******************************************************************************
2  *
3  * Copyright(c) 2007 - 2018 Realtek Corporation.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of version 2 of the GNU General Public License as
7  * published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  *****************************************************************************/
15 #ifndef __RTW_CHPLAN_H__
16 #define __RTW_CHPLAN_H__
17 
18 #define RTW_CHPLAN_UNSPECIFIED 0xFF
19 
20 u8 rtw_chplan_get_default_regd(u8 id);
21 bool rtw_chplan_is_empty(u8 id);
22 bool rtw_is_channel_plan_valid(u8 id);
23 
24 struct _RT_CHANNEL_INFO;
25 u8 init_channel_set(_adapter *padapter, u8 ChannelPlan, struct _RT_CHANNEL_INFO *channel_set);
26 bool rtw_chset_is_dfs_range(struct _RT_CHANNEL_INFO *chset, u32 hi, u32 lo);
27 bool rtw_chset_is_dfs_ch(struct _RT_CHANNEL_INFO *chset, u8 ch);
28 bool rtw_chset_is_dfs_chbw(struct _RT_CHANNEL_INFO *chset, u8 ch, u8 bw, u8 offset);
29 void rtw_process_beacon_hint(_adapter *adapter, WLAN_BSSID_EX *bss);
30 
31 #define IS_ALPHA2_NO_SPECIFIED(_alpha2) ((*((u16 *)(_alpha2))) == 0xFFFF)
32 
33 #define RTW_MODULE_RTL8821AE_HMC_M2		BIT0	/* RTL8821AE(HMC + M.2) */
34 #define RTW_MODULE_RTL8821AU			BIT1	/* RTL8821AU */
35 #define RTW_MODULE_RTL8812AENF_NGFF		BIT2	/* RTL8812AENF(8812AE+8761)_NGFF */
36 #define RTW_MODULE_RTL8812AEBT_HMC		BIT3	/* RTL8812AEBT(8812AE+8761)_HMC */
37 #define RTW_MODULE_RTL8188EE_HMC_M2		BIT4	/* RTL8188EE(HMC + M.2) */
38 #define RTW_MODULE_RTL8723BE_HMC_M2		BIT5	/* RTL8723BE(HMC + M.2) */
39 #define RTW_MODULE_RTL8723BS_NGFF1216	BIT6	/* RTL8723BS(NGFF1216) */
40 #define RTW_MODULE_RTL8192EEBT_HMC_M2	BIT7	/* RTL8192EEBT(8192EE+8761AU)_(HMC + M.2) */
41 #define RTW_MODULE_RTL8723DE_NGFF1630	BIT8	/* RTL8723DE(NGFF1630) */
42 #define RTW_MODULE_RTL8822BE			BIT9	/* RTL8822BE */
43 #define RTW_MODULE_RTL8821CE			BIT10	/* RTL8821CE */
44 #define RTW_MODULE_RTL8822CE			BIT11	/* RTL8822CE */
45 
46 struct country_chplan {
47 	char alpha2[2];
48 	u8 chplan;
49 #ifdef CONFIG_80211AC_VHT
50 	u8 en_11ac;
51 #endif
52 #if RTW_DEF_MODULE_REGULATORY_CERT
53 	u16 def_module_flags; /* RTW_MODULE_RTLXXX */
54 #endif
55 };
56 
57 #ifdef CONFIG_80211AC_VHT
58 #define COUNTRY_CHPLAN_EN_11AC(_ent) ((_ent)->en_11ac)
59 #else
60 #define COUNTRY_CHPLAN_EN_11AC(_ent) 0
61 #endif
62 
63 #if RTW_DEF_MODULE_REGULATORY_CERT
64 #define COUNTRY_CHPLAN_DEF_MODULE_FALGS(_ent) ((_ent)->def_module_flags)
65 #else
66 #define COUNTRY_CHPLAN_DEF_MODULE_FALGS(_ent) 0
67 #endif
68 
69 const struct country_chplan *rtw_get_chplan_from_country(const char *country_code);
70 
71 void dump_country_chplan(void *sel, const struct country_chplan *ent);
72 void dump_country_chplan_map(void *sel);
73 void dump_chplan_id_list(void *sel);
74 void dump_chplan_test(void *sel);
75 void dump_chplan_ver(void *sel);
76 
77 #endif /* __RTW_CHPLAN_H__ */
78