2 * Copyright (c) 2012 Neratec Solutions AG
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.
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.
17 #ifndef DFS_PATTERN_DETECTOR_H
18 #define DFS_PATTERN_DETECTOR_H
20 #include <linux/types.h>
21 #include <linux/list.h>
22 #include <linux/nl80211.h>
25 * struct pulse_event - describing pulses reported by PHY
26 * @ts: pulse time stamp in us
27 * @freq: channel frequency in MHz
28 * @width: pulse duration in us
29 * @rssi: rssi of radar event
39 * struct radar_detector_specs - detector specs for a radar pattern type
40 * @type_id: pattern type, as defined by regulatory
41 * @width_min: minimum radar pulse width in [us]
42 * @width_max: maximum radar pulse width in [us]
43 * @pri_min: minimum pulse repetition interval in [us] (including tolerance)
44 * @pri_max: minimum pri in [us] (including tolerance)
45 * @num_pri: maximum number of different pri for this type
46 * @ppb: pulses per bursts for this type
47 * @ppb_thresh: number of pulses required to trigger detection
48 * @max_pri_tolerance: pulse time stamp tolerance on both sides [us]
50 struct radar_detector_specs
{
63 * struct dfs_pattern_detector - DFS pattern detector
65 * @set_dfs_domain(): set DFS domain, resets detector lines upon domain changes
66 * @add_pulse(): add radar pulse to detector, returns true on detection
67 * @region: active DFS region, NL80211_DFS_UNSET until set
68 * @num_radar_types: number of different radar types
69 * @last_pulse_ts: time stamp of last valid pulse in usecs
70 * @radar_detector_specs: array of radar detection specs
71 * @channel_detectors: list connecting channel_detector elements
73 struct dfs_pattern_detector
{
74 void (*exit
)(struct dfs_pattern_detector
*dpd
);
75 bool (*set_dfs_domain
)(struct dfs_pattern_detector
*dpd
,
76 enum nl80211_dfs_regions region
);
77 bool (*add_pulse
)(struct dfs_pattern_detector
*dpd
,
78 struct pulse_event
*pe
);
80 enum nl80211_dfs_regions region
;
83 /* needed for ath_dbg() */
86 const struct radar_detector_specs
*radar_spec
;
87 struct list_head channel_detectors
;
91 * dfs_pattern_detector_init() - constructor for pattern detector class
92 * @param region: DFS domain to be used, can be NL80211_DFS_UNSET at creation
93 * @return instance pointer on success, NULL otherwise
95 #if defined(CONFIG_ATH9K_DFS_CERTIFIED)
96 extern struct dfs_pattern_detector
*
97 dfs_pattern_detector_init(struct ath_hw
*ah
, enum nl80211_dfs_regions region
);
99 static inline struct dfs_pattern_detector
*
100 dfs_pattern_detector_init(struct ath_hw
*ah
, enum nl80211_dfs_regions region
)
104 #endif /* CONFIG_ATH9K_DFS_CERTIFIED */
106 #endif /* DFS_PATTERN_DETECTOR_H */