• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  *
3  * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
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  * You should have received a copy of the GNU General Public License along with
15  * this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
17  *
18  *
19  ******************************************************************************/
20 #ifndef __HAL_COMMON_H__
21 #define __HAL_COMMON_H__
22 
23 /*  */
24 /*        Rate Definition */
25 /*  */
26 /* CCK */
27 #define	RATR_1M					0x00000001
28 #define	RATR_2M					0x00000002
29 #define	RATR_55M				0x00000004
30 #define	RATR_11M				0x00000008
31 /* OFDM */
32 #define	RATR_6M					0x00000010
33 #define	RATR_9M					0x00000020
34 #define	RATR_12M				0x00000040
35 #define	RATR_18M				0x00000080
36 #define	RATR_24M				0x00000100
37 #define	RATR_36M				0x00000200
38 #define	RATR_48M				0x00000400
39 #define	RATR_54M				0x00000800
40 /* MCS 1 Spatial Stream */
41 #define	RATR_MCS0				0x00001000
42 #define	RATR_MCS1				0x00002000
43 #define	RATR_MCS2				0x00004000
44 #define	RATR_MCS3				0x00008000
45 #define	RATR_MCS4				0x00010000
46 #define	RATR_MCS5				0x00020000
47 #define	RATR_MCS6				0x00040000
48 #define	RATR_MCS7				0x00080000
49 /* MCS 2 Spatial Stream */
50 #define	RATR_MCS8				0x00100000
51 #define	RATR_MCS9				0x00200000
52 #define	RATR_MCS10				0x00400000
53 #define	RATR_MCS11				0x00800000
54 #define	RATR_MCS12				0x01000000
55 #define	RATR_MCS13				0x02000000
56 #define	RATR_MCS14				0x04000000
57 #define	RATR_MCS15				0x08000000
58 
59 /* CCK */
60 #define RATE_1M					BIT(0)
61 #define RATE_2M					BIT(1)
62 #define RATE_5_5M				BIT(2)
63 #define RATE_11M				BIT(3)
64 /* OFDM */
65 #define RATE_6M					BIT(4)
66 #define RATE_9M					BIT(5)
67 #define RATE_12M				BIT(6)
68 #define RATE_18M				BIT(7)
69 #define RATE_24M				BIT(8)
70 #define RATE_36M				BIT(9)
71 #define RATE_48M				BIT(10)
72 #define RATE_54M				BIT(11)
73 /* MCS 1 Spatial Stream */
74 #define RATE_MCS0				BIT(12)
75 #define RATE_MCS1				BIT(13)
76 #define RATE_MCS2				BIT(14)
77 #define RATE_MCS3				BIT(15)
78 #define RATE_MCS4				BIT(16)
79 #define RATE_MCS5				BIT(17)
80 #define RATE_MCS6				BIT(18)
81 #define RATE_MCS7				BIT(19)
82 /* MCS 2 Spatial Stream */
83 #define RATE_MCS8				BIT(20)
84 #define RATE_MCS9				BIT(21)
85 #define RATE_MCS10				BIT(22)
86 #define RATE_MCS11				BIT(23)
87 #define RATE_MCS12				BIT(24)
88 #define RATE_MCS13				BIT(25)
89 #define RATE_MCS14				BIT(26)
90 #define RATE_MCS15				BIT(27)
91 
92 /*  ALL CCK Rate */
93 #define	RATE_ALL_CCK		(RATR_1M | RATR_2M | RATR_55M | RATR_11M)
94 #define	RATE_ALL_OFDM_AG	(RATR_6M | RATR_9M | RATR_12M | RATR_18M | \
95 				 RATR_24M | RATR_36M | RATR_48M | RATR_54M)
96 #define	RATE_ALL_OFDM_1SS	(RATR_MCS0 | RATR_MCS1 | RATR_MCS2 |	\
97 				 RATR_MCS3 | RATR_MCS4 | RATR_MCS5|RATR_MCS6 | \
98 				 RATR_MCS7)
99 #define	RATE_ALL_OFDM_2SS	(RATR_MCS8 | RATR_MCS9 | RATR_MCS10 | \
100 				 RATR_MCS11 | RATR_MCS12 | RATR_MCS13 | \
101 				 RATR_MCS14 | RATR_MCS15)
102 
103 /*------------------------------ Tx Desc definition Macro --------------------*/
104 /* pragma mark -- Tx Desc related definition. -- */
105 /*	Rate */
106 /*  CCK Rates, TxHT = 0 */
107 #define DESC_RATE1M				0x00
108 #define DESC_RATE2M				0x01
109 #define DESC_RATE5_5M				0x02
110 #define DESC_RATE11M				0x03
111 
112 /*  OFDM Rates, TxHT = 0 */
113 #define DESC_RATE6M				0x04
114 #define DESC_RATE9M				0x05
115 #define DESC_RATE12M				0x06
116 #define DESC_RATE18M				0x07
117 #define DESC_RATE24M				0x08
118 #define DESC_RATE36M				0x09
119 #define DESC_RATE48M				0x0a
120 #define DESC_RATE54M				0x0b
121 
122 /*  MCS Rates, TxHT = 1 */
123 #define DESC_RATEMCS0				0x0c
124 #define DESC_RATEMCS1				0x0d
125 #define DESC_RATEMCS2				0x0e
126 #define DESC_RATEMCS3				0x0f
127 #define DESC_RATEMCS4				0x10
128 #define DESC_RATEMCS5				0x11
129 #define DESC_RATEMCS6				0x12
130 #define DESC_RATEMCS7				0x13
131 #define DESC_RATEMCS8				0x14
132 #define DESC_RATEMCS9				0x15
133 #define DESC_RATEMCS10				0x16
134 #define DESC_RATEMCS11				0x17
135 #define DESC_RATEMCS12				0x18
136 #define DESC_RATEMCS13				0x19
137 #define DESC_RATEMCS14				0x1a
138 #define DESC_RATEMCS15				0x1b
139 #define DESC_RATEMCS15_SG			0x1c
140 #define DESC_RATEMCS32				0x20
141 
142 /*  1 Byte long (in unit of TU) */
143 #define REG_P2P_CTWIN				0x0572
144 #define REG_NOA_DESC_SEL			0x05CF
145 #define REG_NOA_DESC_DURATION			0x05E0
146 #define REG_NOA_DESC_INTERVAL			0x05E4
147 #define REG_NOA_DESC_START			0x05E8
148 #define REG_NOA_DESC_COUNT			0x05EC
149 
150 #include "HalVerDef.h"
151 void dump_chip_info(struct HAL_VERSION	ChipVersion);
152 
153 
154 /* return the final channel plan decision */
155 u8 hal_com_get_channel_plan(struct adapter *padapter,
156 			    u8 hw_channel_plan,
157 			    u8 sw_channel_plan,
158 			    u8 def_channel_plan,
159 			    bool AutoLoadFail
160 );
161 
162 u8 MRateToHwRate(u8 rate);
163 
164 void HalSetBrateCfg(struct adapter *Adapter, u8 *mBratesOS, u16 *pBrateCfg);
165 
166 bool Hal_MappingOutPipe(struct adapter *pAdapter, u8 NumOutPipe);
167 
168 void hal_init_macaddr(struct adapter *adapter);
169 #endif /* __HAL_COMMON_H__ */
170