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
43 * @chirp: chirp detected in pulse
54 * struct radar_detector_specs - detector specs for a radar pattern type
55 * @type_id: pattern type, as defined by regulatory
56 * @width_min: minimum radar pulse width in [us]
57 * @width_max: maximum radar pulse width in [us]
58 * @pri_min: minimum pulse repetition interval in [us] (including tolerance)
59 * @pri_max: minimum pri in [us] (including tolerance)
60 * @num_pri: maximum number of different pri for this type
61 * @ppb: pulses per bursts for this type
62 * @ppb_thresh: number of pulses required to trigger detection
63 * @max_pri_tolerance: pulse time stamp tolerance on both sides [us]
64 * @chirp: chirp required for the radar pattern
66 struct radar_detector_specs {
80 * struct dfs_pattern_detector - DFS pattern detector
82 * @set_dfs_domain(): set DFS domain, resets detector lines upon domain changes
83 * @add_pulse(): add radar pulse to detector, returns true on detection
84 * @region: active DFS region, NL80211_DFS_UNSET until set
85 * @num_radar_types: number of different radar types
86 * @last_pulse_ts: time stamp of last valid pulse in usecs
87 * @radar_detector_specs: array of radar detection specs
88 * @channel_detectors: list connecting channel_detector elements
90 struct dfs_pattern_detector {
91 void (*exit)(struct dfs_pattern_detector *dpd);
92 bool (*set_dfs_domain)(struct dfs_pattern_detector *dpd,
93 enum nl80211_dfs_regions region);
94 bool (*add_pulse)(struct dfs_pattern_detector *dpd,
95 struct pulse_event *pe);
97 struct ath_dfs_pool_stats (*get_stats)(struct dfs_pattern_detector *dpd);
98 enum nl80211_dfs_regions region;
101 /* needed for ath_dbg() */
102 struct ath_common *common;
104 const struct radar_detector_specs *radar_spec;
105 struct list_head channel_detectors;
109 * dfs_pattern_detector_init() - constructor for pattern detector class
110 * @param region: DFS domain to be used, can be NL80211_DFS_UNSET at creation
111 * @return instance pointer on success, NULL otherwise
113 extern struct dfs_pattern_detector *
114 dfs_pattern_detector_init(struct ath_common *common,
115 enum nl80211_dfs_regions region);
116 #endif /* DFS_PATTERN_DETECTOR_H */