Lines Matching +full:delta +full:- +full:x +full:- +full:threshold
2 * Copyright (c) 2008-2011 Atheros Communications Inc.
19 #include "hw-ops.h"
36 * - 20MHz chirp width over a pulse width of 50us
37 * - 5MHz chirp width over a pulse width of 100us
46 /* Threshold for difference of delta peaks */
83 is_ctl = fft_bitmap_weight(fft->lower_bins) != 0; in ath9k_get_max_index_ht40()
84 is_ext = fft_bitmap_weight(fft->upper_bins) != 0; in ath9k_get_max_index_ht40()
88 int mag_lower = fft_max_magnitude(fft->lower_bins); in ath9k_get_max_index_ht40()
89 int mag_upper = fft_max_magnitude(fft->upper_bins); in ath9k_get_max_index_ht40()
97 return fft_max_index(fft->lower_bins); in ath9k_get_max_index_ht40()
98 return fft_max_index(fft->upper_bins) + DFS_UPPER_BIN_OFFSET; in ath9k_get_max_index_ht40()
105 struct ath_hw *ah = sc->sc_ah; in ath9k_check_chirping()
109 if (IS_CHAN_HT40(ah->curchan)) { in ath9k_check_chirping()
126 if (IS_CHAN_HT40MINUS(ah->curchan)) in ath9k_check_chirping()
143 /* in ht20, this is a 6-bit signed number => shift it to 0 */ in ath9k_check_chirping()
151 * a) delta of adjacent max_bins is within range in ath9k_check_chirping()
152 * b) delta of adjacent deltas are within tolerance in ath9k_check_chirping()
156 int ddelta = -1; in ath9k_check_chirping()
157 int delta = max_bin[i + 1] - max_bin[i]; in ath9k_check_chirping() local
160 if (abs(delta) < BIN_DELTA_MIN || abs(delta) > BIN_DELTA_MAX) { in ath9k_check_chirping()
161 ath_dbg(common, DFS, "CHIRP: invalid delta %d " in ath9k_check_chirping()
162 "in sample %d\n", delta, i); in ath9k_check_chirping()
167 ddelta = delta - prev_delta; in ath9k_check_chirping()
174 ath_dbg(common, DFS, "CHIRP - %d: delta=%d, ddelta=%d\n", in ath9k_check_chirping()
175 i, delta, ddelta); in ath9k_check_chirping()
176 prev_delta = delta; in ath9k_check_chirping()
189 if (IS_CHAN_A_FAST_CLOCK(ah, ah->curchan)) in dur_to_usecs()
211 ard->pulse_bw_info &= 0x03; in ath9k_postprocess_radar_event()
213 switch (ard->pulse_bw_info) { in ath9k_postprocess_radar_event()
216 dur = ard->pulse_length_pri; in ath9k_postprocess_radar_event()
222 rssi = (ard->ext_rssi >= (ard->rssi + 3)) ? 0 : ard->rssi; in ath9k_postprocess_radar_event()
226 dur = ard->pulse_length_ext; in ath9k_postprocess_radar_event()
232 rssi = (ard->rssi >= (ard->ext_rssi + 12)) ? 0 : ard->ext_rssi; in ath9k_postprocess_radar_event()
242 if (ard->pulse_length_ext >= ard->pulse_length_pri) in ath9k_postprocess_radar_event()
243 dur = ard->pulse_length_ext; in ath9k_postprocess_radar_event()
245 dur = ard->pulse_length_pri; in ath9k_postprocess_radar_event()
249 rssi = max(ard->rssi, ard->ext_rssi); in ath9k_postprocess_radar_event()
266 pe->width = dur_to_usecs(sc->sc_ah, dur); in ath9k_postprocess_radar_event()
267 pe->rssi = rssi; in ath9k_postprocess_radar_event()
276 struct dfs_pattern_detector *pd = sc->dfs_detector; in ath9k_dfs_process_radar_pulse()
280 if (!pd->add_pulse(pd, pe, NULL)) in ath9k_dfs_process_radar_pulse()
283 ieee80211_radar_detected(sc->hw, NULL); in ath9k_dfs_process_radar_pulse()
287 * DFS: check PHY-error for radar pulse and feed the detector
296 struct ath_hw *ah = sc->sc_ah; in ath9k_dfs_process_phyerr()
300 if ((rs->rs_phyerr != ATH9K_PHYERR_RADAR) && in ath9k_dfs_process_phyerr()
301 (rs->rs_phyerr != ATH9K_PHYERR_FALSE_RADAR_EXT)) { in ath9k_dfs_process_phyerr()
303 "Error: rs_phyer=0x%x not a radar error\n", in ath9k_dfs_process_phyerr()
304 rs->rs_phyerr); in ath9k_dfs_process_phyerr()
309 datalen = rs->rs_datalen; in ath9k_dfs_process_phyerr()
315 ard.rssi = rs->rs_rssi_ctl[0]; in ath9k_dfs_process_phyerr()
316 ard.ext_rssi = rs->rs_rssi_ext[0]; in ath9k_dfs_process_phyerr()
328 ard.pulse_bw_info = vdata_end[-1]; in ath9k_dfs_process_phyerr()
329 ard.pulse_length_ext = vdata_end[-2]; in ath9k_dfs_process_phyerr()
330 ard.pulse_length_pri = vdata_end[-3]; in ath9k_dfs_process_phyerr()
331 pe.freq = ah->curchan->channel; in ath9k_dfs_process_phyerr()
340 int clen = datalen - 3; in ath9k_dfs_process_phyerr()
350 pe.ts - sc->dfs_prev_pulse_ts); in ath9k_dfs_process_phyerr()
351 sc->dfs_prev_pulse_ts = pe.ts; in ath9k_dfs_process_phyerr()
354 if (IS_CHAN_HT40(ah->curchan) && in ath9k_dfs_process_phyerr()
356 pe.freq += IS_CHAN_HT40PLUS(ah->curchan) ? 20 : -20; in ath9k_dfs_process_phyerr()