1 /*
2  * Copyright (c) 2023 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 #ifndef _RESPONSE_START_STATUS_H_
18 #define _RESPONSE_START_STATUS_H_
19 #if !defined(__ASSEMBLER__)
20 #endif
21 
22 #define NUM_OF_DWORDS_RESPONSE_START_STATUS 2
23 
24 #define NUM_OF_QWORDS_RESPONSE_START_STATUS 1
25 
26 
27 struct response_start_status {
28 #ifndef WIFI_BIT_ORDER_BIG_ENDIAN
29              uint32_t generated_response                                      :  3, // [2:0]
30                       ftm_tm                                                  :  2, // [4:3]
31                       trig_response_related                                   :  1, // [5:5]
32                       response_sta_count                                      :  7, // [12:6]
33                       reserved                                                : 19; // [31:13]
34              uint32_t phy_ppdu_id                                             : 16, // [15:0]
35                       sw_peer_id                                              : 16; // [31:16]
36 #else
37              uint32_t reserved                                                : 19, // [31:13]
38                       response_sta_count                                      :  7, // [12:6]
39                       trig_response_related                                   :  1, // [5:5]
40                       ftm_tm                                                  :  2, // [4:3]
41                       generated_response                                      :  3; // [2:0]
42              uint32_t sw_peer_id                                              : 16, // [31:16]
43                       phy_ppdu_id                                             : 16; // [15:0]
44 #endif
45 };
46 
47 
48 /* Description		GENERATED_RESPONSE
49 
50 			The generated response frame
51 
52 			<enum 0 selfgen_ACK> TXPCU generated an ACK response. Note
53 			 that this can be part of a trigger response. In that case
54 			 bit trig_response_related will be set as well.
55 
56 			<enum 1 selfgen_CTS> TXPCU generated an CTS response. Note
57 			 that this can be part of a trigger response. In that case
58 			 bit trig_response_related will be set as well.
59 
60 			<enum 2 selfgen_BA> TXPCU generated a BA response. Note
61 			that this can be part of a trigger response. In that case
62 			 bit trig_response_related will be set as well.
63 
64 			<enum 3 selfgen_MBA> TXPCU generated an M BA response. Note
65 			 that this can be part of a trigger response. In that case
66 			 bit trig_response_related will be set as well.
67 
68 			<enum 4 selfgen_CBF> TXPCU generated a CBF response. Note
69 			 that this can be part of a trigger response. In that case
70 			 bit trig_response_related will be set as well.
71 
72 			<enum 5 selfgen_other_trig_response>
73 			TXPCU generated a trigger related response of a type not
74 			 specified above. Note that in this case bit trig_response_related
75 			 will be set as well.
76 
77 			This e-num will also be used when TXPCU has been programmed
78 			 to overwrite it's own self gen response generation, and
79 			 wait for the response to come from SCH..
80 			Also applicable for basic trigger response.
81 
82 			<enum 6 selfgen_NDP_LMR> TXPCU generated a self-gen NDP
83 			followed by a self-gen LMR for the ranging NDPA followed
84 			 by NDP received by RXPCU.
85 
86 			<legal 0-6>
87 */
88 
89 #define RESPONSE_START_STATUS_GENERATED_RESPONSE_OFFSET                             0x0000000000000000
90 #define RESPONSE_START_STATUS_GENERATED_RESPONSE_LSB                                0
91 #define RESPONSE_START_STATUS_GENERATED_RESPONSE_MSB                                2
92 #define RESPONSE_START_STATUS_GENERATED_RESPONSE_MASK                               0x0000000000000007
93 
94 
95 /* Description		FTM_TM
96 
97 			This field Indicates if the response is related to receiving
98 			 a TM or FTM frame
99 
100 			0: no TM and no FTM frame => there is NO measurement done
101 
102 			1: FTM frame
103 			2: TM frame
104 			3: reserved
105 */
106 
107 #define RESPONSE_START_STATUS_FTM_TM_OFFSET                                         0x0000000000000000
108 #define RESPONSE_START_STATUS_FTM_TM_LSB                                            3
109 #define RESPONSE_START_STATUS_FTM_TM_MSB                                            4
110 #define RESPONSE_START_STATUS_FTM_TM_MASK                                           0x0000000000000018
111 
112 
113 /* Description		TRIG_RESPONSE_RELATED
114 
115 			When set, this TLV is generated by TXPCU in the context
116 			of a response transmission to a received trigger frame.
117 
118 			<legal all>
119 */
120 
121 #define RESPONSE_START_STATUS_TRIG_RESPONSE_RELATED_OFFSET                          0x0000000000000000
122 #define RESPONSE_START_STATUS_TRIG_RESPONSE_RELATED_LSB                             5
123 #define RESPONSE_START_STATUS_TRIG_RESPONSE_RELATED_MSB                             5
124 #define RESPONSE_START_STATUS_TRIG_RESPONSE_RELATED_MASK                            0x0000000000000020
125 
126 
127 /* Description		RESPONSE_STA_COUNT
128 
129 			The number of STAs to which the responses need to be sent.
130 
131 
132 			In case of multiple ACKs/BAs to be send, TXPCU uses this
133 			 field to determine what address formatting to use for the
134 			 response frame: This could be broadcast or unicast.
135 
136 			<legal all>
137 */
138 
139 #define RESPONSE_START_STATUS_RESPONSE_STA_COUNT_OFFSET                             0x0000000000000000
140 #define RESPONSE_START_STATUS_RESPONSE_STA_COUNT_LSB                                6
141 #define RESPONSE_START_STATUS_RESPONSE_STA_COUNT_MSB                                12
142 #define RESPONSE_START_STATUS_RESPONSE_STA_COUNT_MASK                               0x0000000000001fc0
143 
144 
145 /* Description		RESERVED
146 
147 			<legal 0>
148 */
149 
150 #define RESPONSE_START_STATUS_RESERVED_OFFSET                                       0x0000000000000000
151 #define RESPONSE_START_STATUS_RESERVED_LSB                                          13
152 #define RESPONSE_START_STATUS_RESERVED_MSB                                          31
153 #define RESPONSE_START_STATUS_RESERVED_MASK                                         0x00000000ffffe000
154 
155 
156 /* Description		PHY_PPDU_ID
157 
158 			The PHY_PPDU_ID of the received PPDU for which this response
159 			 is generated.
160 */
161 
162 #define RESPONSE_START_STATUS_PHY_PPDU_ID_OFFSET                                    0x0000000000000000
163 #define RESPONSE_START_STATUS_PHY_PPDU_ID_LSB                                       32
164 #define RESPONSE_START_STATUS_PHY_PPDU_ID_MSB                                       47
165 #define RESPONSE_START_STATUS_PHY_PPDU_ID_MASK                                      0x0000ffff00000000
166 
167 
168 /* Description		SW_PEER_ID
169 
170 			This field is only valid when Response_STA_count  is set
171 			 to 1
172 
173 			An identifier indicating for which device this response
174 			is needed.
175 			<legal all>
176 */
177 
178 #define RESPONSE_START_STATUS_SW_PEER_ID_OFFSET                                     0x0000000000000000
179 #define RESPONSE_START_STATUS_SW_PEER_ID_LSB                                        48
180 #define RESPONSE_START_STATUS_SW_PEER_ID_MSB                                        63
181 #define RESPONSE_START_STATUS_SW_PEER_ID_MASK                                       0xffff000000000000
182 
183 
184 
185 #endif   // RESPONSE_START_STATUS
186