1 
2 /*
3  * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 
21 
22 #ifndef _RX_LOCATION_INFO_H_
23 #define _RX_LOCATION_INFO_H_
24 #if !defined(__ASSEMBLER__)
25 #endif
26 
27 #define NUM_OF_DWORDS_RX_LOCATION_INFO 9
28 
29 struct rx_location_info {
30              uint32_t rtt_fac_legacy                  : 16,
31                       rtt_fac_legacy_ext80            : 16;
32              uint32_t rtt_fac_vht                     : 16,
33                       rtt_fac_vht_ext80               : 16;
34              uint32_t rtt_fac_legacy_status           :  1,
35                       rtt_fac_legacy_ext80_status     :  1,
36                       rtt_fac_vht_status              :  1,
37                       rtt_fac_vht_ext80_status        :  1,
38                       rtt_fac_sifs                    : 12,
39                       rtt_fac_sifs_status             :  2,
40                       rtt_cfr_status                  :  1,
41                       rtt_cir_status                  :  1,
42                       rtt_channel_dump_size           : 11,
43                       rtt_hw_ifft_mode                :  1;
44              uint32_t rtt_btcf_status                 :  1,
45                       rtt_preamble_type               :  5,
46                       rtt_pkt_bw_leg                  :  2,
47                       rtt_pkt_bw_vht                  :  2,
48                       rtt_gi_type                     :  2,
49                       rtt_mcs_rate                    :  5,
50                       rtt_strongest_chain             :  3,
51                       rtt_strongest_chain_ext80       :  3,
52                       rtt_rx_chain_mask               :  8,
53                       reserved_3                      :  1;
54              uint32_t rx_start_ts                     : 32;
55              uint32_t rx_end_ts                       : 32;
56              uint32_t sfo_phase_pkt_start             : 12,
57                       sfo_phase_pkt_end               : 12,
58                       rtt_che_buffer_pointer_high8    :  8;
59              uint32_t rtt_che_buffer_pointer_low32    : 32;
60              uint32_t rtt_cfo_measurement             : 14,
61                       rtt_chan_spread                 :  8,
62                       rtt_timing_backoff_sel          :  2,
63                       reserved_8                      :  7,
64                       rx_location_info_valid          :  1;
65 };
66 
67 #define RX_LOCATION_INFO_0_RTT_FAC_LEGACY_OFFSET                     0x00000000
68 #define RX_LOCATION_INFO_0_RTT_FAC_LEGACY_LSB                        0
69 #define RX_LOCATION_INFO_0_RTT_FAC_LEGACY_MASK                       0x0000ffff
70 
71 #define RX_LOCATION_INFO_0_RTT_FAC_LEGACY_EXT80_OFFSET               0x00000000
72 #define RX_LOCATION_INFO_0_RTT_FAC_LEGACY_EXT80_LSB                  16
73 #define RX_LOCATION_INFO_0_RTT_FAC_LEGACY_EXT80_MASK                 0xffff0000
74 
75 #define RX_LOCATION_INFO_1_RTT_FAC_VHT_OFFSET                        0x00000004
76 #define RX_LOCATION_INFO_1_RTT_FAC_VHT_LSB                           0
77 #define RX_LOCATION_INFO_1_RTT_FAC_VHT_MASK                          0x0000ffff
78 
79 #define RX_LOCATION_INFO_1_RTT_FAC_VHT_EXT80_OFFSET                  0x00000004
80 #define RX_LOCATION_INFO_1_RTT_FAC_VHT_EXT80_LSB                     16
81 #define RX_LOCATION_INFO_1_RTT_FAC_VHT_EXT80_MASK                    0xffff0000
82 
83 #define RX_LOCATION_INFO_2_RTT_FAC_LEGACY_STATUS_OFFSET              0x00000008
84 #define RX_LOCATION_INFO_2_RTT_FAC_LEGACY_STATUS_LSB                 0
85 #define RX_LOCATION_INFO_2_RTT_FAC_LEGACY_STATUS_MASK                0x00000001
86 
87 #define RX_LOCATION_INFO_2_RTT_FAC_LEGACY_EXT80_STATUS_OFFSET        0x00000008
88 #define RX_LOCATION_INFO_2_RTT_FAC_LEGACY_EXT80_STATUS_LSB           1
89 #define RX_LOCATION_INFO_2_RTT_FAC_LEGACY_EXT80_STATUS_MASK          0x00000002
90 
91 #define RX_LOCATION_INFO_2_RTT_FAC_VHT_STATUS_OFFSET                 0x00000008
92 #define RX_LOCATION_INFO_2_RTT_FAC_VHT_STATUS_LSB                    2
93 #define RX_LOCATION_INFO_2_RTT_FAC_VHT_STATUS_MASK                   0x00000004
94 
95 #define RX_LOCATION_INFO_2_RTT_FAC_VHT_EXT80_STATUS_OFFSET           0x00000008
96 #define RX_LOCATION_INFO_2_RTT_FAC_VHT_EXT80_STATUS_LSB              3
97 #define RX_LOCATION_INFO_2_RTT_FAC_VHT_EXT80_STATUS_MASK             0x00000008
98 
99 #define RX_LOCATION_INFO_2_RTT_FAC_SIFS_OFFSET                       0x00000008
100 #define RX_LOCATION_INFO_2_RTT_FAC_SIFS_LSB                          4
101 #define RX_LOCATION_INFO_2_RTT_FAC_SIFS_MASK                         0x0000fff0
102 
103 #define RX_LOCATION_INFO_2_RTT_FAC_SIFS_STATUS_OFFSET                0x00000008
104 #define RX_LOCATION_INFO_2_RTT_FAC_SIFS_STATUS_LSB                   16
105 #define RX_LOCATION_INFO_2_RTT_FAC_SIFS_STATUS_MASK                  0x00030000
106 
107 #define RX_LOCATION_INFO_2_RTT_CFR_STATUS_OFFSET                     0x00000008
108 #define RX_LOCATION_INFO_2_RTT_CFR_STATUS_LSB                        18
109 #define RX_LOCATION_INFO_2_RTT_CFR_STATUS_MASK                       0x00040000
110 
111 #define RX_LOCATION_INFO_2_RTT_CIR_STATUS_OFFSET                     0x00000008
112 #define RX_LOCATION_INFO_2_RTT_CIR_STATUS_LSB                        19
113 #define RX_LOCATION_INFO_2_RTT_CIR_STATUS_MASK                       0x00080000
114 
115 #define RX_LOCATION_INFO_2_RTT_CHANNEL_DUMP_SIZE_OFFSET              0x00000008
116 #define RX_LOCATION_INFO_2_RTT_CHANNEL_DUMP_SIZE_LSB                 20
117 #define RX_LOCATION_INFO_2_RTT_CHANNEL_DUMP_SIZE_MASK                0x7ff00000
118 
119 #define RX_LOCATION_INFO_2_RTT_HW_IFFT_MODE_OFFSET                   0x00000008
120 #define RX_LOCATION_INFO_2_RTT_HW_IFFT_MODE_LSB                      31
121 #define RX_LOCATION_INFO_2_RTT_HW_IFFT_MODE_MASK                     0x80000000
122 
123 #define RX_LOCATION_INFO_3_RTT_BTCF_STATUS_OFFSET                    0x0000000c
124 #define RX_LOCATION_INFO_3_RTT_BTCF_STATUS_LSB                       0
125 #define RX_LOCATION_INFO_3_RTT_BTCF_STATUS_MASK                      0x00000001
126 
127 #define RX_LOCATION_INFO_3_RTT_PREAMBLE_TYPE_OFFSET                  0x0000000c
128 #define RX_LOCATION_INFO_3_RTT_PREAMBLE_TYPE_LSB                     1
129 #define RX_LOCATION_INFO_3_RTT_PREAMBLE_TYPE_MASK                    0x0000003e
130 
131 #define RX_LOCATION_INFO_3_RTT_PKT_BW_LEG_OFFSET                     0x0000000c
132 #define RX_LOCATION_INFO_3_RTT_PKT_BW_LEG_LSB                        6
133 #define RX_LOCATION_INFO_3_RTT_PKT_BW_LEG_MASK                       0x000000c0
134 
135 #define RX_LOCATION_INFO_3_RTT_PKT_BW_VHT_OFFSET                     0x0000000c
136 #define RX_LOCATION_INFO_3_RTT_PKT_BW_VHT_LSB                        8
137 #define RX_LOCATION_INFO_3_RTT_PKT_BW_VHT_MASK                       0x00000300
138 
139 #define RX_LOCATION_INFO_3_RTT_GI_TYPE_OFFSET                        0x0000000c
140 #define RX_LOCATION_INFO_3_RTT_GI_TYPE_LSB                           10
141 #define RX_LOCATION_INFO_3_RTT_GI_TYPE_MASK                          0x00000c00
142 
143 #define RX_LOCATION_INFO_3_RTT_MCS_RATE_OFFSET                       0x0000000c
144 #define RX_LOCATION_INFO_3_RTT_MCS_RATE_LSB                          12
145 #define RX_LOCATION_INFO_3_RTT_MCS_RATE_MASK                         0x0001f000
146 
147 #define RX_LOCATION_INFO_3_RTT_STRONGEST_CHAIN_OFFSET                0x0000000c
148 #define RX_LOCATION_INFO_3_RTT_STRONGEST_CHAIN_LSB                   17
149 #define RX_LOCATION_INFO_3_RTT_STRONGEST_CHAIN_MASK                  0x000e0000
150 
151 #define RX_LOCATION_INFO_3_RTT_STRONGEST_CHAIN_EXT80_OFFSET          0x0000000c
152 #define RX_LOCATION_INFO_3_RTT_STRONGEST_CHAIN_EXT80_LSB             20
153 #define RX_LOCATION_INFO_3_RTT_STRONGEST_CHAIN_EXT80_MASK            0x00700000
154 
155 #define RX_LOCATION_INFO_3_RTT_RX_CHAIN_MASK_OFFSET                  0x0000000c
156 #define RX_LOCATION_INFO_3_RTT_RX_CHAIN_MASK_LSB                     23
157 #define RX_LOCATION_INFO_3_RTT_RX_CHAIN_MASK_MASK                    0x7f800000
158 
159 #define RX_LOCATION_INFO_3_RESERVED_3_OFFSET                         0x0000000c
160 #define RX_LOCATION_INFO_3_RESERVED_3_LSB                            31
161 #define RX_LOCATION_INFO_3_RESERVED_3_MASK                           0x80000000
162 
163 #define RX_LOCATION_INFO_4_RX_START_TS_OFFSET                        0x00000010
164 #define RX_LOCATION_INFO_4_RX_START_TS_LSB                           0
165 #define RX_LOCATION_INFO_4_RX_START_TS_MASK                          0xffffffff
166 
167 #define RX_LOCATION_INFO_5_RX_END_TS_OFFSET                          0x00000014
168 #define RX_LOCATION_INFO_5_RX_END_TS_LSB                             0
169 #define RX_LOCATION_INFO_5_RX_END_TS_MASK                            0xffffffff
170 
171 #define RX_LOCATION_INFO_6_SFO_PHASE_PKT_START_OFFSET                0x00000018
172 #define RX_LOCATION_INFO_6_SFO_PHASE_PKT_START_LSB                   0
173 #define RX_LOCATION_INFO_6_SFO_PHASE_PKT_START_MASK                  0x00000fff
174 
175 #define RX_LOCATION_INFO_6_SFO_PHASE_PKT_END_OFFSET                  0x00000018
176 #define RX_LOCATION_INFO_6_SFO_PHASE_PKT_END_LSB                     12
177 #define RX_LOCATION_INFO_6_SFO_PHASE_PKT_END_MASK                    0x00fff000
178 
179 #define RX_LOCATION_INFO_6_RTT_CHE_BUFFER_POINTER_HIGH8_OFFSET       0x00000018
180 #define RX_LOCATION_INFO_6_RTT_CHE_BUFFER_POINTER_HIGH8_LSB          24
181 #define RX_LOCATION_INFO_6_RTT_CHE_BUFFER_POINTER_HIGH8_MASK         0xff000000
182 
183 #define RX_LOCATION_INFO_7_RTT_CHE_BUFFER_POINTER_LOW32_OFFSET       0x0000001c
184 #define RX_LOCATION_INFO_7_RTT_CHE_BUFFER_POINTER_LOW32_LSB          0
185 #define RX_LOCATION_INFO_7_RTT_CHE_BUFFER_POINTER_LOW32_MASK         0xffffffff
186 
187 #define RX_LOCATION_INFO_8_RTT_CFO_MEASUREMENT_OFFSET                0x00000020
188 #define RX_LOCATION_INFO_8_RTT_CFO_MEASUREMENT_LSB                   0
189 #define RX_LOCATION_INFO_8_RTT_CFO_MEASUREMENT_MASK                  0x00003fff
190 
191 #define RX_LOCATION_INFO_8_RTT_CHAN_SPREAD_OFFSET                    0x00000020
192 #define RX_LOCATION_INFO_8_RTT_CHAN_SPREAD_LSB                       14
193 #define RX_LOCATION_INFO_8_RTT_CHAN_SPREAD_MASK                      0x003fc000
194 
195 #define RX_LOCATION_INFO_8_RTT_TIMING_BACKOFF_SEL_OFFSET             0x00000020
196 #define RX_LOCATION_INFO_8_RTT_TIMING_BACKOFF_SEL_LSB                22
197 #define RX_LOCATION_INFO_8_RTT_TIMING_BACKOFF_SEL_MASK               0x00c00000
198 
199 #define RX_LOCATION_INFO_8_RESERVED_8_OFFSET                         0x00000020
200 #define RX_LOCATION_INFO_8_RESERVED_8_LSB                            24
201 #define RX_LOCATION_INFO_8_RESERVED_8_MASK                           0x7f000000
202 
203 #define RX_LOCATION_INFO_8_RX_LOCATION_INFO_VALID_OFFSET             0x00000020
204 #define RX_LOCATION_INFO_8_RX_LOCATION_INFO_VALID_LSB                31
205 #define RX_LOCATION_INFO_8_RX_LOCATION_INFO_VALID_MASK               0x80000000
206 
207 #endif
208