1 /*
2  * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 #ifndef _HT_SIG_INFO_H_
20 #define _HT_SIG_INFO_H_
21 #if !defined(__ASSEMBLER__)
22 #endif
23 
24 
25 // ################ START SUMMARY #################
26 //
27 //	Dword	Fields
28 //	0	mcs[6:0], cbw[7], length[23:8], reserved_0[31:24]
29 //	1	smoothing[0], not_sounding[1], ht_reserved[2], aggregation[3], stbc[5:4], fec_coding[6], short_gi[7], num_ext_sp_str[9:8], crc[17:10], signal_tail[23:18], reserved_1[31:24]
30 //
31 // ################ END SUMMARY #################
32 
33 #define NUM_OF_DWORDS_HT_SIG_INFO 2
34 
35 struct ht_sig_info {
36              uint32_t mcs                             :  7, //[6:0]
37                       cbw                             :  1, //[7]
38                       length                          : 16, //[23:8]
39                       reserved_0                      :  8; //[31:24]
40              uint32_t smoothing                       :  1, //[0]
41                       not_sounding                    :  1, //[1]
42                       ht_reserved                     :  1, //[2]
43                       aggregation                     :  1, //[3]
44                       stbc                            :  2, //[5:4]
45                       fec_coding                      :  1, //[6]
46                       short_gi                        :  1, //[7]
47                       num_ext_sp_str                  :  2, //[9:8]
48                       crc                             :  8, //[17:10]
49                       signal_tail                     :  6, //[23:18]
50                       reserved_1                      :  8; //[31:24]
51 };
52 
53 /*
54 
55 mcs
56 
57 			Modulation Coding Scheme:
58 
59 			0-7 are used for single stream
60 
61 			8-15 are used for 2 streams
62 
63 			16-23 are used for 3 streams
64 
65 			24-31 are used for 4 streams
66 
67 			32 is used for duplicate HT20 (unsupported)
68 
69 			33-76 is used for unequal modulation (unsupported)
70 
71 			77-127 is reserved.
72 
73 			<legal 0-31>
74 
75 cbw
76 
77 			Packet bandwidth:
78 
79 			<enum 0     ht_20_mhz>
80 
81 			<enum 1     ht_40_mhz>
82 
83 			<legal 0-1>
84 
85 length
86 
87 			This is the MPDU or A-MPDU length in octets of the PPDU
88 
89 			<legal all>
90 
91 reserved_0
92 
93 			This field is not part of HT-SIG
94 
95 			Reserved: Should be set to 0 by the MAC and ignored by
96 			the PHY <legal 0>
97 
98 smoothing
99 
100 			Field indicates if smoothing is needed
101 
102 			E_num 0     do_smoothing Unsupported setting: indicates
103 			smoothing is often used for beamforming
104 
105 
106 			<legal 1>
107 
108 not_sounding
109 
110 			E_num 0     sounding Unsupported setting: indicates
111 			sounding is used
112 
113 			<enum 1     no_sounding>  Indicates no sounding is used
114 
115 			<legal 1>
116 
117 ht_reserved
118 
119 			Reserved: Should be set to 1 by the MAC and ignored by
120 			the PHY
121 
122 			<legal 1>
123 
124 aggregation
125 
126 			<enum 0     mpdu> Indicates MPDU format
127 
128 			<enum 1     a_mpdu> Indicates A-MPDU format
129 
130 			<legal 0-1>
131 
132 stbc
133 
134 			<enum 0     no_stbc> Indicates no STBC
135 
136 			<enum 1     1_str_stbc> Indicates 1 stream STBC
137 
138 			E_num 2     2_str_stbc Indicates 2 stream STBC
139 			(Unsupported)
140 
141 			<legal 0-1>
142 
143 fec_coding
144 
145 			<enum 0     ht_bcc>  Indicates BCC coding
146 
147 			<enum 1     ht_ldpc>  Indicates LDPC coding
148 
149 			<legal 0-1>
150 
151 short_gi
152 
153 			<enum 0     ht_normal_gi>  Indicates normal guard
154 			interval
155 
156 
157 			<legal 0-1>
158 
159 num_ext_sp_str
160 
161 			Number of extension spatial streams: (Used for TxBF)
162 
163 			<enum 0     0_ext_sp_str>  No extension spatial streams
164 
165 			E_num 1     1_ext_sp_str  Not supported: 1 extension
166 			spatial streams
167 
168 			E_num 2     2_ext_sp_str  Not supported:  2 extension
169 			spatial streams
170 
171 			<legal 0>
172 
173 crc
174 
175 			The CRC protects the HT-SIG (HT-SIG[0][23:0] and
176 			HT-SIG[1][9:0]. The generator polynomial is G(D) = D8 + D2 +
177 			D + 1.  <legal all>
178 
179 signal_tail
180 
181 			The 6 bits of tail is always set to 0 is used to flush
182 			the BCC encoder and decoder.  <legal 0>
183 
184 reserved_1
185 
186 			This field is not part of HT-SIG:
187 
188 			Reserved: Should be set to 0 by the MAC and ignored by
189 			the PHY.  <legal 0>
190 */
191 
192 
193 /* Description		HT_SIG_INFO_0_MCS
194 
195 			Modulation Coding Scheme:
196 
197 			0-7 are used for single stream
198 
199 			8-15 are used for 2 streams
200 
201 			16-23 are used for 3 streams
202 
203 			24-31 are used for 4 streams
204 
205 			32 is used for duplicate HT20 (unsupported)
206 
207 			33-76 is used for unequal modulation (unsupported)
208 
209 			77-127 is reserved.
210 
211 			<legal 0-31>
212 */
213 #define HT_SIG_INFO_0_MCS_OFFSET                                     0x00000000
214 #define HT_SIG_INFO_0_MCS_LSB                                        0
215 #define HT_SIG_INFO_0_MCS_MASK                                       0x0000007f
216 
217 /* Description		HT_SIG_INFO_0_CBW
218 
219 			Packet bandwidth:
220 
221 			<enum 0     ht_20_mhz>
222 
223 			<enum 1     ht_40_mhz>
224 
225 			<legal 0-1>
226 */
227 #define HT_SIG_INFO_0_CBW_OFFSET                                     0x00000000
228 #define HT_SIG_INFO_0_CBW_LSB                                        7
229 #define HT_SIG_INFO_0_CBW_MASK                                       0x00000080
230 
231 /* Description		HT_SIG_INFO_0_LENGTH
232 
233 			This is the MPDU or A-MPDU length in octets of the PPDU
234 
235 			<legal all>
236 */
237 #define HT_SIG_INFO_0_LENGTH_OFFSET                                  0x00000000
238 #define HT_SIG_INFO_0_LENGTH_LSB                                     8
239 #define HT_SIG_INFO_0_LENGTH_MASK                                    0x00ffff00
240 
241 /* Description		HT_SIG_INFO_0_RESERVED_0
242 
243 			This field is not part of HT-SIG
244 
245 			Reserved: Should be set to 0 by the MAC and ignored by
246 			the PHY <legal 0>
247 */
248 #define HT_SIG_INFO_0_RESERVED_0_OFFSET                              0x00000000
249 #define HT_SIG_INFO_0_RESERVED_0_LSB                                 24
250 #define HT_SIG_INFO_0_RESERVED_0_MASK                                0xff000000
251 
252 /* Description		HT_SIG_INFO_1_SMOOTHING
253 
254 			Field indicates if smoothing is needed
255 
256 			E_num 0     do_smoothing Unsupported setting: indicates
257 			smoothing is often used for beamforming
258 
259 
260 			<legal 1>
261 */
262 #define HT_SIG_INFO_1_SMOOTHING_OFFSET                               0x00000004
263 #define HT_SIG_INFO_1_SMOOTHING_LSB                                  0
264 #define HT_SIG_INFO_1_SMOOTHING_MASK                                 0x00000001
265 
266 /* Description		HT_SIG_INFO_1_NOT_SOUNDING
267 
268 			E_num 0     sounding Unsupported setting: indicates
269 			sounding is used
270 
271 			<enum 1     no_sounding>  Indicates no sounding is used
272 
273 			<legal 1>
274 */
275 #define HT_SIG_INFO_1_NOT_SOUNDING_OFFSET                            0x00000004
276 #define HT_SIG_INFO_1_NOT_SOUNDING_LSB                               1
277 #define HT_SIG_INFO_1_NOT_SOUNDING_MASK                              0x00000002
278 
279 /* Description		HT_SIG_INFO_1_HT_RESERVED
280 
281 			Reserved: Should be set to 1 by the MAC and ignored by
282 			the PHY
283 
284 			<legal 1>
285 */
286 #define HT_SIG_INFO_1_HT_RESERVED_OFFSET                             0x00000004
287 #define HT_SIG_INFO_1_HT_RESERVED_LSB                                2
288 #define HT_SIG_INFO_1_HT_RESERVED_MASK                               0x00000004
289 
290 /* Description		HT_SIG_INFO_1_AGGREGATION
291 
292 			<enum 0     mpdu> Indicates MPDU format
293 
294 			<enum 1     a_mpdu> Indicates A-MPDU format
295 
296 			<legal 0-1>
297 */
298 #define HT_SIG_INFO_1_AGGREGATION_OFFSET                             0x00000004
299 #define HT_SIG_INFO_1_AGGREGATION_LSB                                3
300 #define HT_SIG_INFO_1_AGGREGATION_MASK                               0x00000008
301 
302 /* Description		HT_SIG_INFO_1_STBC
303 
304 			<enum 0     no_stbc> Indicates no STBC
305 
306 			<enum 1     1_str_stbc> Indicates 1 stream STBC
307 
308 			E_num 2     2_str_stbc Indicates 2 stream STBC
309 			(Unsupported)
310 
311 			<legal 0-1>
312 */
313 #define HT_SIG_INFO_1_STBC_OFFSET                                    0x00000004
314 #define HT_SIG_INFO_1_STBC_LSB                                       4
315 #define HT_SIG_INFO_1_STBC_MASK                                      0x00000030
316 
317 /* Description		HT_SIG_INFO_1_FEC_CODING
318 
319 			<enum 0     ht_bcc>  Indicates BCC coding
320 
321 			<enum 1     ht_ldpc>  Indicates LDPC coding
322 
323 			<legal 0-1>
324 */
325 #define HT_SIG_INFO_1_FEC_CODING_OFFSET                              0x00000004
326 #define HT_SIG_INFO_1_FEC_CODING_LSB                                 6
327 #define HT_SIG_INFO_1_FEC_CODING_MASK                                0x00000040
328 
329 /* Description		HT_SIG_INFO_1_SHORT_GI
330 
331 			<enum 0     ht_normal_gi>  Indicates normal guard
332 			interval
333 
334 
335 			<legal 0-1>
336 */
337 #define HT_SIG_INFO_1_SHORT_GI_OFFSET                                0x00000004
338 #define HT_SIG_INFO_1_SHORT_GI_LSB                                   7
339 #define HT_SIG_INFO_1_SHORT_GI_MASK                                  0x00000080
340 
341 /* Description		HT_SIG_INFO_1_NUM_EXT_SP_STR
342 
343 			Number of extension spatial streams: (Used for TxBF)
344 
345 			<enum 0     0_ext_sp_str>  No extension spatial streams
346 
347 			E_num 1     1_ext_sp_str  Not supported: 1 extension
348 			spatial streams
349 
350 			E_num 2     2_ext_sp_str  Not supported:  2 extension
351 			spatial streams
352 
353 			<legal 0>
354 */
355 #define HT_SIG_INFO_1_NUM_EXT_SP_STR_OFFSET                          0x00000004
356 #define HT_SIG_INFO_1_NUM_EXT_SP_STR_LSB                             8
357 #define HT_SIG_INFO_1_NUM_EXT_SP_STR_MASK                            0x00000300
358 
359 /* Description		HT_SIG_INFO_1_CRC
360 
361 			The CRC protects the HT-SIG (HT-SIG[0][23:0] and
362 			HT-SIG[1][9:0]. The generator polynomial is G(D) = D8 + D2 +
363 			D + 1.  <legal all>
364 */
365 #define HT_SIG_INFO_1_CRC_OFFSET                                     0x00000004
366 #define HT_SIG_INFO_1_CRC_LSB                                        10
367 #define HT_SIG_INFO_1_CRC_MASK                                       0x0003fc00
368 
369 /* Description		HT_SIG_INFO_1_SIGNAL_TAIL
370 
371 			The 6 bits of tail is always set to 0 is used to flush
372 			the BCC encoder and decoder.  <legal 0>
373 */
374 #define HT_SIG_INFO_1_SIGNAL_TAIL_OFFSET                             0x00000004
375 #define HT_SIG_INFO_1_SIGNAL_TAIL_LSB                                18
376 #define HT_SIG_INFO_1_SIGNAL_TAIL_MASK                               0x00fc0000
377 
378 /* Description		HT_SIG_INFO_1_RESERVED_1
379 
380 			This field is not part of HT-SIG:
381 
382 			Reserved: Should be set to 0 by the MAC and ignored by
383 			the PHY.  <legal 0>
384 */
385 #define HT_SIG_INFO_1_RESERVED_1_OFFSET                              0x00000004
386 #define HT_SIG_INFO_1_RESERVED_1_LSB                                 24
387 #define HT_SIG_INFO_1_RESERVED_1_MASK                                0xff000000
388 
389 
390 #endif // _HT_SIG_INFO_H_
391