1 
2 /* Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 
18 
19 
20 
21 
22 
23 
24 
25 
26 #ifndef _HT_SIG_INFO_H_
27 #define _HT_SIG_INFO_H_
28 #if !defined(__ASSEMBLER__)
29 #endif
30 
31 #define NUM_OF_DWORDS_HT_SIG_INFO 2
32 
33 
34 struct ht_sig_info {
35 #ifndef WIFI_BIT_ORDER_BIG_ENDIAN
36              uint32_t mcs                                                     :  7, // [6:0]
37                       cbw                                                     :  1, // [7:7]
38                       length                                                  : 16, // [23:8]
39                       reserved_0                                              :  8; // [31:24]
40              uint32_t smoothing                                               :  1, // [0:0]
41                       not_sounding                                            :  1, // [1:1]
42                       ht_reserved                                             :  1, // [2:2]
43                       aggregation                                             :  1, // [3:3]
44                       stbc                                                    :  2, // [5:4]
45                       fec_coding                                              :  1, // [6:6]
46                       short_gi                                                :  1, // [7:7]
47                       num_ext_sp_str                                          :  2, // [9:8]
48                       crc                                                     :  8, // [17:10]
49                       signal_tail                                             :  6, // [23:18]
50                       reserved_1                                              :  7, // [30:24]
51                       rx_integrity_check_passed                               :  1; // [31:31]
52 #else
53              uint32_t reserved_0                                              :  8, // [31:24]
54                       length                                                  : 16, // [23:8]
55                       cbw                                                     :  1, // [7:7]
56                       mcs                                                     :  7; // [6:0]
57              uint32_t rx_integrity_check_passed                               :  1, // [31:31]
58                       reserved_1                                              :  7, // [30:24]
59                       signal_tail                                             :  6, // [23:18]
60                       crc                                                     :  8, // [17:10]
61                       num_ext_sp_str                                          :  2, // [9:8]
62                       short_gi                                                :  1, // [7:7]
63                       fec_coding                                              :  1, // [6:6]
64                       stbc                                                    :  2, // [5:4]
65                       aggregation                                             :  1, // [3:3]
66                       ht_reserved                                             :  1, // [2:2]
67                       not_sounding                                            :  1, // [1:1]
68                       smoothing                                               :  1; // [0:0]
69 #endif
70 };
71 
72 
73 /* Description		MCS
74 
75 			Modulation Coding Scheme:
76 			0-7 are used for single stream
77 			8-15 are used for 2 streams
78 			16-23 are used for 3 streams
79 			24-31 are used for 4 streams
80 			32 is used for duplicate HT20 (unsupported)
81 			33-76 is used for unequal modulation (unsupported)
82 			77-127 is reserved.
83 			<legal 0-31>
84 */
85 
86 #define HT_SIG_INFO_MCS_OFFSET                                                      0x00000000
87 #define HT_SIG_INFO_MCS_LSB                                                         0
88 #define HT_SIG_INFO_MCS_MSB                                                         6
89 #define HT_SIG_INFO_MCS_MASK                                                        0x0000007f
90 
91 
92 /* Description		CBW
93 
94 			Packet bandwidth:
95 			<enum 0     ht_20_mhz>
96 			<enum 1     ht_40_mhz>
97 			<legal 0-1>
98 */
99 
100 #define HT_SIG_INFO_CBW_OFFSET                                                      0x00000000
101 #define HT_SIG_INFO_CBW_LSB                                                         7
102 #define HT_SIG_INFO_CBW_MSB                                                         7
103 #define HT_SIG_INFO_CBW_MASK                                                        0x00000080
104 
105 
106 /* Description		LENGTH
107 
108 			This is the MPDU or A-MPDU length in octets of the PPDU
109 			<legal all>
110 */
111 
112 #define HT_SIG_INFO_LENGTH_OFFSET                                                   0x00000000
113 #define HT_SIG_INFO_LENGTH_LSB                                                      8
114 #define HT_SIG_INFO_LENGTH_MSB                                                      23
115 #define HT_SIG_INFO_LENGTH_MASK                                                     0x00ffff00
116 
117 
118 /* Description		RESERVED_0
119 
120 			This field is not part of HT-SIG
121 			Reserved: Should be set to 0 by the MAC and ignored by the
122 			 PHY <legal 0>
123 */
124 
125 #define HT_SIG_INFO_RESERVED_0_OFFSET                                               0x00000000
126 #define HT_SIG_INFO_RESERVED_0_LSB                                                  24
127 #define HT_SIG_INFO_RESERVED_0_MSB                                                  31
128 #define HT_SIG_INFO_RESERVED_0_MASK                                                 0xff000000
129 
130 
131 /* Description		SMOOTHING
132 
133 			Field indicates if smoothing is needed
134 			E_num 0     do_smoothing Unsupported setting: indicates
135 			smoothing is often used for beamforming
136 			<enum 1     no_smoothing> Indicates no smoothing is used
137 
138 			<legal 1>
139 */
140 
141 #define HT_SIG_INFO_SMOOTHING_OFFSET                                                0x00000004
142 #define HT_SIG_INFO_SMOOTHING_LSB                                                   0
143 #define HT_SIG_INFO_SMOOTHING_MSB                                                   0
144 #define HT_SIG_INFO_SMOOTHING_MASK                                                  0x00000001
145 
146 
147 /* Description		NOT_SOUNDING
148 
149 			E_num 0     sounding Unsupported setting: indicates sounding
150 			 is used
151 			<enum 1     no_sounding>  Indicates no sounding is used
152 			<legal 1>
153 */
154 
155 #define HT_SIG_INFO_NOT_SOUNDING_OFFSET                                             0x00000004
156 #define HT_SIG_INFO_NOT_SOUNDING_LSB                                                1
157 #define HT_SIG_INFO_NOT_SOUNDING_MSB                                                1
158 #define HT_SIG_INFO_NOT_SOUNDING_MASK                                               0x00000002
159 
160 
161 /* Description		HT_RESERVED
162 
163 			Reserved: Should be set to 1 by the MAC and ignored by the
164 			 PHY
165 			<legal 1>
166 */
167 
168 #define HT_SIG_INFO_HT_RESERVED_OFFSET                                              0x00000004
169 #define HT_SIG_INFO_HT_RESERVED_LSB                                                 2
170 #define HT_SIG_INFO_HT_RESERVED_MSB                                                 2
171 #define HT_SIG_INFO_HT_RESERVED_MASK                                                0x00000004
172 
173 
174 /* Description		AGGREGATION
175 
176 			<enum 0     mpdu> Indicates MPDU format
177 			<enum 1     a_mpdu> Indicates A-MPDU format
178 			<legal 0-1>
179 */
180 
181 #define HT_SIG_INFO_AGGREGATION_OFFSET                                              0x00000004
182 #define HT_SIG_INFO_AGGREGATION_LSB                                                 3
183 #define HT_SIG_INFO_AGGREGATION_MSB                                                 3
184 #define HT_SIG_INFO_AGGREGATION_MASK                                                0x00000008
185 
186 
187 /* Description		STBC
188 
189 			<enum 0     no_stbc> Indicates no STBC
190 			<enum 1     1_str_stbc> Indicates 1 stream STBC
191 			E_num 2     2_str_stbc Indicates 2 stream STBC (Unsupported)
192 
193 			<legal 0-1>
194 */
195 
196 #define HT_SIG_INFO_STBC_OFFSET                                                     0x00000004
197 #define HT_SIG_INFO_STBC_LSB                                                        4
198 #define HT_SIG_INFO_STBC_MSB                                                        5
199 #define HT_SIG_INFO_STBC_MASK                                                       0x00000030
200 
201 
202 /* Description		FEC_CODING
203 
204 			<enum 0     ht_bcc>  Indicates BCC coding
205 			<enum 1     ht_ldpc>  Indicates LDPC coding
206 			<legal 0-1>
207 */
208 
209 #define HT_SIG_INFO_FEC_CODING_OFFSET                                               0x00000004
210 #define HT_SIG_INFO_FEC_CODING_LSB                                                  6
211 #define HT_SIG_INFO_FEC_CODING_MSB                                                  6
212 #define HT_SIG_INFO_FEC_CODING_MASK                                                 0x00000040
213 
214 
215 /* Description		SHORT_GI
216 
217 			<enum 0     ht_normal_gi>  Indicates normal guard interval
218 
219 			<enum 1     ht_short_gi>  Indicates short guard interval
220 
221 			<legal 0-1>
222 */
223 
224 #define HT_SIG_INFO_SHORT_GI_OFFSET                                                 0x00000004
225 #define HT_SIG_INFO_SHORT_GI_LSB                                                    7
226 #define HT_SIG_INFO_SHORT_GI_MSB                                                    7
227 #define HT_SIG_INFO_SHORT_GI_MASK                                                   0x00000080
228 
229 
230 /* Description		NUM_EXT_SP_STR
231 
232 			Number of extension spatial streams: (Used for TxBF)
233 			<enum 0     0_ext_sp_str>  No extension spatial streams
234 			E_num 1     1_ext_sp_str  Not supported: 1 extension spatial
235 			 streams
236 			E_num 2     2_ext_sp_str  Not supported:  2 extension spatial
237 			 streams
238 			<legal 0>
239 */
240 
241 #define HT_SIG_INFO_NUM_EXT_SP_STR_OFFSET                                           0x00000004
242 #define HT_SIG_INFO_NUM_EXT_SP_STR_LSB                                              8
243 #define HT_SIG_INFO_NUM_EXT_SP_STR_MSB                                              9
244 #define HT_SIG_INFO_NUM_EXT_SP_STR_MASK                                             0x00000300
245 
246 
247 /* Description		CRC
248 
249 			The CRC protects the HT-SIG (HT-SIG[0][23:0] and HT-SIG[1][9:0].
250 			The generator polynomial is G(D) = D8 + D2 + D + 1.  <legal
251 			 all>
252 */
253 
254 #define HT_SIG_INFO_CRC_OFFSET                                                      0x00000004
255 #define HT_SIG_INFO_CRC_LSB                                                         10
256 #define HT_SIG_INFO_CRC_MSB                                                         17
257 #define HT_SIG_INFO_CRC_MASK                                                        0x0003fc00
258 
259 
260 /* Description		SIGNAL_TAIL
261 
262 			The 6 bits of tail is always set to 0 is used to flush the
263 			 BCC encoder and decoder.  <legal 0>
264 */
265 
266 #define HT_SIG_INFO_SIGNAL_TAIL_OFFSET                                              0x00000004
267 #define HT_SIG_INFO_SIGNAL_TAIL_LSB                                                 18
268 #define HT_SIG_INFO_SIGNAL_TAIL_MSB                                                 23
269 #define HT_SIG_INFO_SIGNAL_TAIL_MASK                                                0x00fc0000
270 
271 
272 /* Description		RESERVED_1
273 
274 			This field is not part of HT-SIG:
275 			Reserved: Should be set to 0 by the MAC and ignored by the
276 			 PHY.  <legal 0>
277 */
278 
279 #define HT_SIG_INFO_RESERVED_1_OFFSET                                               0x00000004
280 #define HT_SIG_INFO_RESERVED_1_LSB                                                  24
281 #define HT_SIG_INFO_RESERVED_1_MSB                                                  30
282 #define HT_SIG_INFO_RESERVED_1_MASK                                                 0x7f000000
283 
284 
285 /* Description		RX_INTEGRITY_CHECK_PASSED
286 
287 			TX side: Set to 0
288 			RX side: Set to 1 if PHY determines the HT-SIG CRC check
289 			 has passed, else set to 0
290 
291 			<legal all>
292 */
293 
294 #define HT_SIG_INFO_RX_INTEGRITY_CHECK_PASSED_OFFSET                                0x00000004
295 #define HT_SIG_INFO_RX_INTEGRITY_CHECK_PASSED_LSB                                   31
296 #define HT_SIG_INFO_RX_INTEGRITY_CHECK_PASSED_MSB                                   31
297 #define HT_SIG_INFO_RX_INTEGRITY_CHECK_PASSED_MASK                                  0x80000000
298 
299 
300 
301 #endif   // HT_SIG_INFO
302