1 /* SPDX-License-Identifier: GPL-2.0 */
2 /******************************************************************************
3  *
4  * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
5  *
6  ******************************************************************************/
7 #ifndef	__RTW_RF_H_
8 #define __RTW_RF_H_
9 
10 
11 #define OFDM_PHY		1
12 #define MIXED_PHY		2
13 #define CCK_PHY			3
14 
15 #define NumRates		13
16 
17 /*  slot time for 11g */
18 #define SHORT_SLOT_TIME		9
19 #define NON_SHORT_SLOT_TIME	20
20 
21 #define RTL8711_RF_MAX_SENS	 6
22 #define RTL8711_RF_DEF_SENS	 4
23 
24 /*  */
25 /*  We now define the following channels as the max channels in each channel plan. */
26 /*  2G, total 14 chnls */
27 /*  {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14} */
28 /*  5G, total 24 chnls */
29 /*  {36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120,
30  *   124, 128, 132, 136, 140, 149, 153, 157, 161, 165} */
31 #define	MAX_CHANNEL_NUM_2G	14
32 #define	MAX_CHANNEL_NUM_5G	24
33 #define	MAX_CHANNEL_NUM		38/* 14+24 */
34 
35 #define NUM_REGULATORYS	1
36 
37 /* Country codes */
38 #define USA			0x555320
39 #define EUROPE			0x1 /* temp, should be provided later */
40 #define JAPAN			0x2 /* temp, should be provided later */
41 
42 struct	regulatory_class {
43 	u32 starting_freq;			/* MHz, */
44 	u8 channel_set[MAX_CHANNEL_NUM];
45 	u8 channel_cck_power[MAX_CHANNEL_NUM];/* dbm */
46 	u8 channel_ofdm_power[MAX_CHANNEL_NUM];/* dbm */
47 	u8 txpower_limit;			/* dbm */
48 	u8 channel_spacing;			/* MHz */
49 	u8 modem;
50 };
51 
52 enum {
53 	cESS			= 0x0001,
54 	cIBSS			= 0x0002,
55 	cPollable		= 0x0004,
56 	cPollReq		= 0x0008,
57 	cPrivacy		= 0x0010,
58 	cShortPreamble		= 0x0020,
59 	cPBCC			= 0x0040,
60 	cChannelAgility		= 0x0080,
61 	cSpectrumMgnt		= 0x0100,
62 	cQos			= 0x0200,	/*  For HCCA, use with CF-Pollable and CF-PollReq */
63 	cShortSlotTime		= 0x0400,
64 	cAPSD			= 0x0800,
65 	cRM			= 0x1000,	/*  RRM (Radio Request Measurement) */
66 	cDSSS_OFDM		= 0x2000,
67 	cDelayedBA		= 0x4000,
68 	cImmediateBA		= 0x8000,
69 };
70 
71 enum {
72 	PREAMBLE_LONG	= 1,
73 	PREAMBLE_AUTO	= 2,
74 	PREAMBLE_SHORT	= 3,
75 };
76 
77 /*  Bandwidth Offset */
78 #define HAL_PRIME_CHNL_OFFSET_DONT_CARE	0
79 #define HAL_PRIME_CHNL_OFFSET_LOWER	1
80 #define HAL_PRIME_CHNL_OFFSET_UPPER	2
81 
82 /*  Represent Channel Width in HT Capabilities */
83 enum channel_width {
84 	CHANNEL_WIDTH_20 = 0,
85 	CHANNEL_WIDTH_40 = 1,
86 	CHANNEL_WIDTH_80 = 2,
87 	CHANNEL_WIDTH_160 = 3,
88 	CHANNEL_WIDTH_80_80 = 4,
89 	CHANNEL_WIDTH_MAX = 5,
90 };
91 
92 /*  Represent Extension Channel Offset in HT Capabilities */
93 /*  This is available only in 40Mhz mode. */
94 enum extchnl_offset {
95 	EXTCHNL_OFFSET_NO_EXT = 0,
96 	EXTCHNL_OFFSET_UPPER = 1,
97 	EXTCHNL_OFFSET_NO_DEF = 2,
98 	EXTCHNL_OFFSET_LOWER = 3,
99 };
100 
101 enum {
102 	VHT_DATA_SC_DONOT_CARE = 0,
103 	VHT_DATA_SC_20_UPPER_OF_80MHZ = 1,
104 	VHT_DATA_SC_20_LOWER_OF_80MHZ = 2,
105 	VHT_DATA_SC_20_UPPERST_OF_80MHZ = 3,
106 	VHT_DATA_SC_20_LOWEST_OF_80MHZ = 4,
107 	VHT_DATA_SC_20_RECV1 = 5,
108 	VHT_DATA_SC_20_RECV2 = 6,
109 	VHT_DATA_SC_20_RECV3 = 7,
110 	VHT_DATA_SC_20_RECV4 = 8,
111 	VHT_DATA_SC_40_UPPER_OF_80MHZ = 9,
112 	VHT_DATA_SC_40_LOWER_OF_80MHZ = 10,
113 };
114 
115 /* 2007/11/15 MH Define different RF type. */
116 enum {
117 	RF_1T2R = 0,
118 	RF_2T4R = 1,
119 	RF_2T2R = 2,
120 	RF_1T1R = 3,
121 	RF_2T2R_GREEN = 4,
122 	RF_MAX_TYPE = 5,
123 };
124 
125 u32 rtw_ch2freq(u32 ch);
126 
127 #endif /* _RTL8711_RF_H_ */
128