xref: /wlan-driver/qca-wifi-host-cmn/umac/dfs/core/src/dfs_structs.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2011-2012, 2016-2018 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  */
17 
18 /**
19  * DOC: This file has dfs capability, dfs pulse structures.
20  */
21 
22 #ifndef _DFS_STRUCTS_H_
23 #define _DFS_STRUCTS_H_
24 
25 /*
26  * This represents the general case of the radar PHY configuration,
27  * across all chips.
28  *
29  * It's then up to each chip layer to translate to/from this
30  * (eg to HAL_PHYERR_PARAM for the HAL case.)
31  */
32 
33 #define WLAN_DFS_PHYERR_PARAM_NOVAL   0xFFFF
34 #define WLAN_DFS_PHYERR_PARAM_ENABLE  0x8000
35 
36 /*
37  * For the dfs_nol_clist_update() method - this is the
38  * update command.
39  */
40 enum {
41 	DFS_NOL_CLIST_CMD_NONE      = 0x0,
42 	DFS_NOL_CLIST_CMD_UPDATE    = 0x1,
43 };
44 
45 /**
46  * struct dfs_pulse - DFS pulses.
47  * @rp_numpulses:         Num of pulses in radar burst.
48  * @rp_pulsedur:          Duration of each pulse in usecs.
49  * @rp_pulsefreq:         Frequency of pulses in burst.
50  * @rp_max_pulsefreq:     Frequency of pulses in burst.
51  * @rp_patterntype:       fixed or variable pattern type.
52  * @rp_pulsevar:          Time variation of pulse duration for matched
53  *                        filter (single-sided) in usecs.
54  * @rp_threshold:         Threshold for MF output to indicate radar match.
55  * @rp_mindur:            Min pulse duration to be considered for this pulse
56  *                        type.
57  * @rp_maxdur:            Min pulse duration to be considered for this pulse
58  *                        type.
59  * @rp_rssithresh:        Minimum rssi to be considered a radar pulse.
60  * @rp_meanoffset:        Offset for timing adjustment.
61  * @rp_rssimargin:        rssi threshold margin. In Turbo Mode HW reports
62  *                        rssi 3dBm. lower than in non TURBO mode. This
63  *                        will be used to offset that diff.
64  * @rp_ignore_pri_window: Ignore PRI window.
65  * @rp_sidx_spread:       To reduce false detection use sidx spread. For HT160,
66  *                        for consistency, push all pulses at center of the
67  *                        channel to 80MHz ext when both segments are DFS.
68  *                        Maximum SIDX value spread in a matched sequence
69  *                        excluding FCC Bin 5.
70  * @rp_check_delta_peak:  This is mainly used for ETSI Type 4 5MHz chirp pulses
71  *                        which HW cnanot identify.
72  *                        Reliably as chirping but can correctly characterize
73  *                        these with delta_peak non-zero.
74  *                        Is delta_peak check required for this filter.
75  * @rp_pulseid:           Unique ID for identifying filter.
76  */
77 struct dfs_pulse {
78 	uint32_t  rp_numpulses;
79 	uint32_t  rp_pulsedur;
80 	uint32_t  rp_pulsefreq;
81 	uint32_t  rp_max_pulsefreq;
82 	uint32_t  rp_patterntype;
83 	uint32_t  rp_pulsevar;
84 	uint32_t  rp_threshold;
85 	uint32_t  rp_mindur;
86 	uint32_t  rp_maxdur;
87 	uint32_t  rp_rssithresh;
88 	uint32_t  rp_meanoffset;
89 	int32_t   rp_rssimargin;
90 	uint32_t  rp_ignore_pri_window;
91 	uint16_t  rp_sidx_spread;
92 	int8_t    rp_check_delta_peak;
93 	uint16_t  rp_pulseid;
94 };
95 
96 /**
97  * struct dfs_bin5pulse - DFS bin5 pulse.
98  * @b5_threshold:    Number of bin5 pulses to indicate detection.
99  * @b5_mindur:       Min duration for a bin5 pulse.
100  * @b5_maxdur:       Max duration for a bin5 pulse.
101  * @b5_timewindow:   Window over which to count bin5 pulses.
102  * @b5_rssithresh:   Min rssi to be considered a pulse.
103  * @b5_rssimargin:   rssi threshold margin. In Turbo Mode HW reports rssi 3dB
104  */
105 struct dfs_bin5pulse {
106 	uint32_t  b5_threshold;
107 	uint32_t  b5_mindur;
108 	uint32_t  b5_maxdur;
109 	uint32_t  b5_timewindow;
110 	uint32_t  b5_rssithresh;
111 	uint32_t  b5_rssimargin;
112 };
113 
114 /**
115  * wlan_dfs_phyerr_init_noval() - Fill wlan_dfs_phyerr_param with 0xFF.
116  * @pe: Pointer to wlan_dfs_phyerr_param structure.
117  */
wlan_dfs_phyerr_init_noval(struct wlan_dfs_phyerr_param * pe)118 static inline void wlan_dfs_phyerr_init_noval(struct wlan_dfs_phyerr_param *pe)
119 {
120 	pe->pe_firpwr = WLAN_DFS_PHYERR_PARAM_NOVAL;
121 	pe->pe_rrssi = WLAN_DFS_PHYERR_PARAM_NOVAL;
122 	pe->pe_height = WLAN_DFS_PHYERR_PARAM_NOVAL;
123 	pe->pe_prssi = WLAN_DFS_PHYERR_PARAM_NOVAL;
124 	pe->pe_inband = WLAN_DFS_PHYERR_PARAM_NOVAL;
125 	pe->pe_relpwr = WLAN_DFS_PHYERR_PARAM_NOVAL;
126 	pe->pe_relstep = WLAN_DFS_PHYERR_PARAM_NOVAL;
127 	pe->pe_maxlen = WLAN_DFS_PHYERR_PARAM_NOVAL;
128 }
129 
130 /**
131  * struct wlan_dfs_radar_tab_info - Radar table information.
132  * @dfsdomain:         DFS domain.
133  * @numradars:         Number of radars.
134  * @dfs_radars:        Pointer to dfs_pulse structure.
135  * @numb5radars:       NUM5 radars.
136  * @b5pulses:          BIN5 radars.
137  * @dfs_defaultparams: phyerr params.
138  */
139 struct wlan_dfs_radar_tab_info {
140 	uint32_t          dfsdomain;
141 	int               numradars;
142 	struct dfs_pulse *dfs_radars;
143 	int               numb5radars;
144 	struct dfs_bin5pulse *b5pulses;
145 	struct wlan_dfs_phyerr_param dfs_defaultparams;
146 };
147 
148 #endif  /* _DFS_STRUCTS_H_ */
149