xref: /wlan-driver/fw-api/fw/txmon_tlvs.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2022,2024 Qualcomm Innovation Center, Inc. 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 _TXMON_TLVS_H_
20 #define _TXMON_TLVS_H_
21 
22 #define TXMON_FW2SW_MON_FES_SETUP_BAND_CENTER_FREQ1_M   0x0000ffff
23 #define TXMON_FW2SW_MON_FES_SETUP_BAND_CENTER_FREQ1_S   0
24 
25 #define TXMON_FW2SW_MON_FES_SETUP_BAND_CENTER_FREQ2_M   0xffff0000
26 #define TXMON_FW2SW_MON_FES_SETUP_BAND_CENTER_FREQ2_S   16
27 
28 #define TXMON_FW2SW_MON_FES_SETUP_PHY_MODE_M            0x000000ff
29 #define TXMON_FW2SW_MON_FES_SETUP_PHY_MODE_S            0
30 
31 #define TXMON_FW2SW_MON_FES_SETUP_MHZ_M                 0x00ffff00
32 #define TXMON_FW2SW_MON_FES_SETUP_MHZ_S                 8
33 
34 #define TXMON_FW2SW_MON_FES_SETUP_SCHEDULE_ID_M         0xffffffff
35 #define TXMON_FW2SW_MON_FES_SETUP_SCHEDULE_ID_S         0
36 
37 #define TXMON_FW2SW_MON_FES_SETUP_FW_COOKIE_M           0x000fffff
38 #define TXMON_FW2SW_MON_FES_SETUP_FW_COOKIE_S           0
39 
40 #define TXMON_FW2SW_MON_FES_SETUP_FW_COOKIE_SEQ_NUM_M   0x000007ff
41 #define TXMON_FW2SW_MON_FES_SETUP_FW_COOKIE_SEQ_NUM_S   0
42 
43 #define TXMON_FW2SW_MON_FES_SETUP_FW_COOKIE_HW_LINK_ID_M 0x00003800
44 #define TXMON_FW2SW_MON_FES_SETUP_FW_COOKIE_HW_LINK_ID_S 11
45 
46 #define TXMON_FW2SW_MON_FES_SETUP_FW_COOKIE_PACKET_ID_M 0x0007c000
47 #define TXMON_FW2SW_MON_FES_SETUP_FW_COOKIE_PACKET_ID_S 14
48 
49 #define TXMON_FW2SW_MON_FES_SETUP_FW_COOKIE_VALID_M     0x00080000
50 #define TXMON_FW2SW_MON_FES_SETUP_FW_COOKIE_VALID_S     19
51 
52 
53 #define TXMON_FW2SW_MON_FES_SETUP_BAND_CENTER_FREQ1_GET(_var) \
54     (((_var) & TXMON_FW2SW_MON_FES_SETUP_BAND_CENTER_FREQ1_M) >> \
55      TXMON_FW2SW_MON_FES_SETUP_BAND_CENTER_FREQ1_S)
56 
57 #define TXMON_FW2SW_MON_FES_SETUP_BAND_CENTER_FREQ1_SET(_var, _val) \
58     do { \
59         HTT_CHECK_SET_VAL(TXMON_FW2SW_MON_FES_SETUP_BAND_CENTER_FREQ1, _val); \
60         ((_var) |= ((_val) << TXMON_FW2SW_MON_FES_SETUP_BAND_CENTER_FREQ1_S)); \
61     } while (0)
62 
63 #define TXMON_FW2SW_MON_FES_SETUP_BAND_CENTER_FREQ2_GET(_var) \
64     (((_var) & TXMON_FW2SW_MON_FES_SETUP_BAND_CENTER_FREQ2_M) >> \
65      TXMON_FW2SW_MON_FES_SETUP_BAND_CENTER_FREQ2_S)
66 
67 #define TXMON_FW2SW_MON_FES_SETUP_BAND_CENTER_FREQ2_SET(_var, _val) \
68     do { \
69         HTT_CHECK_SET_VAL(TXMON_FW2SW_MON_FES_SETUP_BAND_CENTER_FREQ2, _val); \
70         ((_var) |= ((_val) << TXMON_FW2SW_MON_FES_SETUP_BAND_CENTER_FREQ2_S)); \
71     } while (0)
72 
73 #define TXMON_FW2SW_MON_FES_SETUP_PHY_MODE_GET(_var) \
74     (((_var) & TXMON_FW2SW_MON_FES_SETUP_PHY_MODE_M) >> \
75      TXMON_FW2SW_MON_FES_SETUP_PHY_MODE_S)
76 
77 #define TXMON_FW2SW_MON_FES_SETUP_PHY_MODE_SET(_var, _val) \
78     do { \
79         HTT_CHECK_SET_VAL(TXMON_FW2SW_MON_FES_SETUP_PHY_MODE, _val); \
80         ((_var) |= ((_val) << TXMON_FW2SW_MON_FES_SETUP_PHY_MODE_S)); \
81     } while (0)
82 
83 #define TXMON_FW2SW_MON_FES_SETUP_MHZ_GET(_var) \
84     (((_var) & TXMON_FW2SW_MON_FES_SETUP_MHZ_M) >> \
85      TXMON_FW2SW_MON_FES_SETUP_MHZ_S)
86 
87 #define TXMON_FW2SW_MON_FES_SETUP_MHZ_SET(_var, _val) \
88     do { \
89         HTT_CHECK_SET_VAL(TXMON_FW2SW_MON_FES_SETUP_MHZ, _val); \
90         ((_var) |= ((_val) << TXMON_FW2SW_MON_FES_SETUP_MHZ_S)); \
91     } while (0)
92 
93 #define TXMON_FW2SW_MON_FES_SETUP_SCHEDULE_ID_GET(_var) \
94     (((_var) & TXMON_FW2SW_MON_FES_SETUP_SCHEDULE_ID_M) >> \
95      TXMON_FW2SW_MON_FES_SETUP_SCHEDULE_ID_S)
96 
97 #define TXMON_FW2SW_MON_FES_SETUP_SCHEDULE_ID_SET(_var, _val) \
98     do { \
99         HTT_CHECK_SET_VAL(TXMON_FW2SW_MON_FES_SETUP_SCHEDULE_ID, _val); \
100         ((_var) |= ((_val) << TXMON_FW2SW_MON_FES_SETUP_SCHEDULE_ID_S)); \
101     } while (0)
102 
103 #define TXMON_FW2SW_MON_FES_SETUP_FW_COOKIE_GET(_var) \
104     (((_var) & TXMON_FW2SW_MON_FES_SETUP_FW_COOKIE_M) >> \
105      TXMON_FW2SW_MON_FES_SETUP_FW_COOKIE_S)
106 
107 #define TXMON_FW2SW_MON_FES_SETUP_FW_COOKIE_SET(_var, _val) \
108     do { \
109         HTT_CHECK_SET_VAL(TXMON_FW2SW_MON_FES_SETUP_FW_COOKIE, _val); \
110         ((_var) |= ((_val) << TXMON_FW2SW_MON_FES_SETUP_FW_COOKIE_S)); \
111     } while (0)
112 
113 
114 #define TXMON_FW2SW_MON_FES_SETUP_FW_COOKIE_SEQ_NUM_GET(_var) \
115     (((_var) & TXMON_FW2SW_MON_FES_SETUP_FW_COOKIE_SEQ_NUM_M) >> \
116      TXMON_FW2SW_MON_FES_SETUP_FW_COOKIE_SEQ_NUM_S)
117 
118 #define TXMON_FW2SW_MON_FES_SETUP_FW_COOKIE_SEQ_NUM_SET(_var, _val) \
119     do { \
120         HTT_CHECK_SET_VAL(TXMON_FW2SW_MON_FES_SETUP_FW_COOKIE_SEQ_NUM, _val); \
121         ((_var) |= ((_val) << TXMON_FW2SW_MON_FES_SETUP_FW_COOKIE_SEQ_NUM_S)); \
122     } while (0)
123 
124 #define TXMON_FW2SW_MON_FES_SETUP_FW_COOKIE_HW_LINK_ID_GET(_var) \
125     (((_var) & TXMON_FW2SW_MON_FES_SETUP_FW_COOKIE_HW_LINK_ID_M) >> \
126      TXMON_FW2SW_MON_FES_SETUP_FW_COOKIE_HW_LINK_ID_S)
127 
128 #define TXMON_FW2SW_MON_FES_SETUP_FW_COOKIE_HW_LINK_ID_SET(_var, _val) \
129     do { \
130         HTT_CHECK_SET_VAL(TXMON_FW2SW_MON_FES_SETUP_FW_COOKIEHW_LINK_ID, _val); \
131         ((_var) |= ((_val) << TXMON_FW2SW_MON_FES_SETUP_FW_COOKIE_HW_LINK_ID_S)); \
132     } while (0)
133 
134 #define TXMON_FW2SW_MON_FES_SETUP_FW_COOKIE_PACKET_ID_GET(_var) \
135     (((_var) & TXMON_FW2SW_MON_FES_SETUP_FW_COOKIE_PACKET_ID_M) >> \
136      TXMON_FW2SW_MON_FES_SETUP_FW_COOKIE_PACKET_ID_S)
137 
138 #define TXMON_FW2SW_MON_FES_SETUP_FW_COOKIE_PACKET_ID_SET(_var, _val) \
139     do { \
140         HTT_CHECK_SET_VAL(TXMON_FW2SW_MON_FES_SETUP_FW_COOKIE_PACKET_ID, _val); \
141         ((_var) |= ((_val) << TXMON_FW2SW_MON_FES_SETUP_FW_COOKIE_PACKET_ID_S)); \
142     } while (0)
143 
144 #define TXMON_FW2SW_MON_FES_SETUP_FW_COOKIE_VALID_GET(_var) \
145     (((_var) & TXMON_FW2SW_MON_FES_SETUP_FW_COOKIE_VALID_M) >> \
146      TXMON_FW2SW_MON_FES_SETUP_FW_COOKIE_VALID_S)
147 
148 #define TXMON_FW2SW_MON_FES_SETUP_FW_COOKIE_VALID_SET(_var, _val) \
149     do { \
150         HTT_CHECK_SET_VAL(TXMON_FW2SW_MON_FES_SETUP_FW_COOKIE_VALID, _val); \
151         ((_var) |= ((_val) << TXMON_FW2SW_MON_FES_SETUP_FW_COOKIE_VALID_S)); \
152     } while (0)
153 
154 
155 enum txmon_fw2sw_user_id {
156     TXMON_FW2SW_TYPE_FES_SETUP      = 0, /* Placed after  FES_SETUP */
157     TXMON_FW2SW_TYPE_FES_SETUP_USER = 1, /* Placed before FES_SETUP_COMPLETE */
158     TXMON_FW2SW_TYPE_FES_SETUP_EXT  = 2, /* Placed after  FES_SETUP_COMPLETE */
159     TXMON_FW2SW_TYPE_MAX            = 4
160 };
161 
162 typedef struct txmon_fw2sw_fes_setup {
163     A_UINT32 band_center_freq1  : 16,
164              band_center_freq2  : 16;
165     A_UINT32 phy_mode : 8,              /* this field is filled with WLAN_PHY_MODE enum value */
166              mhz      : 16,
167              reserved : 8;
168     A_UINT32 schedule_id;
169     A_UINT32 fw_cookie : 20,
170              rsvd      : 12;
171 } txmon_fw2sw_fes_setup_t;
172 
173 typedef struct txmon_fw2sw_fes_setup_ext {
174     A_UINT32 reserved;
175 } txmon_fw2sw_fes_setup_ext_t;
176 
177 #define TXMON_FW2SW_MON_FES_SETUP_USER_USER_ID_M        0x0000003f
178 #define TXMON_FW2SW_MON_FES_SETUP_USER_USER_ID_S        0
179 
180 #define TXMON_FW2SW_MON_FES_SETUP_USER_USER_ID_GET(_var) \
181     (((_var) & TXMON_FW2SW_MON_FES_SETUP_USER_USER_ID_M) >> \
182      TXMON_FW2SW_MON_FES_SETUP_USER_USER_ID_S)
183 
184 #define TXMON_FW2SW_MON_FES_SETUP_USER_USER_ID_SET(_var, _val) \
185     do { \
186         HTT_CHECK_SET_VAL(TXMON_FW2SW_MON_FES_SETUP_USER_USER_ID, _val); \
187         ((_var) |= ((_val) << TXMON_FW2SW_MON_FES_SETUP_USER_USER_ID_S)); \
188     } while (0)
189 
190 
191 typedef struct txmon_fw2sw_fes_setup_user {
192     A_UINT32 user_id  : 6,
193              reserved : 24;
194 } txmon_fw2sw_fes_setup_user_t;
195 
196 struct txmon_fw2sw_mon_fes_setup_tlv {
197     struct tlv_usr_32_hdr tag; /* tlv_usrid => TXMON_FW2SW_TYPE_FES_SETUP */
198     struct txmon_fw2sw_fes_setup setup;
199 };
200 
201 struct txmon_fw2sw_mon_fes_setup_ext_tlv {
202     struct tlv_usr_32_hdr tag; /* tlv_usrid => TXMON_FW2SW_TYPE_FES_SETUP_EXT*/
203     struct txmon_fw2sw_fes_setup_ext setup_ext;
204 };
205 
206 struct txmon_fw2sw_mon_fes_setup_user_tlv {
207     struct tlv_usr_32_hdr tag; /* tlv_usrid => TXMON_FW2SW_TYPE_FES_SETUP_USER */
208     struct txmon_fw2sw_fes_setup_user user_setup;
209 };
210 
211 #endif /* _TXMON_TLVS_H_ */
212