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 ath_dfs_pool_stats - DFS Statistics for global pools
27 struct ath_dfs_pool_stats
{
30 u32 pulse_alloc_error
;
38 * struct pulse_event - describing pulses reported by PHY
39 * @ts: pulse time stamp in us
40 * @freq: channel frequency in MHz
41 * @width: pulse duration in us
42 * @rssi: rssi of radar event
52 * struct radar_detector_specs - detector specs for a radar pattern type
53 * @type_id: pattern type, as defined by regulatory
54 * @width_min: minimum radar pulse width in [us]
55 * @width_max: maximum radar pulse width in [us]
56 * @pri_min: minimum pulse repetition interval in [us] (including tolerance)
57 * @pri_max: minimum pri in [us] (including tolerance)
58 * @num_pri: maximum number of different pri for this type
59 * @ppb: pulses per bursts for this type
60 * @ppb_thresh: number of pulses required to trigger detection
61 * @max_pri_tolerance: pulse time stamp tolerance on both sides [us]
63 struct radar_detector_specs
{
76 * struct dfs_pattern_detector - DFS pattern detector
78 * @set_dfs_domain(): set DFS domain, resets detector lines upon domain changes
79 * @add_pulse(): add radar pulse to detector, returns true on detection
80 * @region: active DFS region, NL80211_DFS_UNSET until set
81 * @num_radar_types: number of different radar types
82 * @last_pulse_ts: time stamp of last valid pulse in usecs
83 * @radar_detector_specs: array of radar detection specs
84 * @channel_detectors: list connecting channel_detector elements
86 struct dfs_pattern_detector
{
87 void (*exit
)(struct dfs_pattern_detector
*dpd
);
88 bool (*set_dfs_domain
)(struct dfs_pattern_detector
*dpd
,
89 enum nl80211_dfs_regions region
);
90 bool (*add_pulse
)(struct dfs_pattern_detector
*dpd
,
91 struct pulse_event
*pe
);
93 struct ath_dfs_pool_stats (*get_stats
)(struct dfs_pattern_detector
*dpd
);
94 enum nl80211_dfs_regions region
;
97 /* needed for ath_dbg() */
98 struct ath_common
*common
;
100 const struct radar_detector_specs
*radar_spec
;
101 struct list_head channel_detectors
;
105 * dfs_pattern_detector_init() - constructor for pattern detector class
106 * @param region: DFS domain to be used, can be NL80211_DFS_UNSET at creation
107 * @return instance pointer on success, NULL otherwise
109 extern struct dfs_pattern_detector
*
110 dfs_pattern_detector_init(struct ath_common
*common
,
111 enum nl80211_dfs_regions region
);
112 #endif /* DFS_PATTERN_DETECTOR_H */