Path: blob/main/sys/contrib/dev/athk/dfs_pri_detector.h
48255 views
/*1* Copyright (c) 2012 Neratec Solutions AG2*3* Permission to use, copy, modify, and/or distribute this software for any4* purpose with or without fee is hereby granted, provided that the above5* copyright notice and this permission notice appear in all copies.6*7* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES8* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF9* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR10* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES11* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN12* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF13* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.14*/1516#ifndef DFS_PRI_DETECTOR_H17#define DFS_PRI_DETECTOR_H1819#include <linux/list.h>2021extern struct ath_dfs_pool_stats global_dfs_pool_stats;2223/**24* struct pri_sequence - sequence of pulses matching one PRI25* @head: list_head26* @pri: pulse repetition interval (PRI) in usecs27* @dur: duration of sequence in usecs28* @count: number of pulses in this sequence29* @count_falses: number of not matching pulses in this sequence30* @first_ts: time stamp of first pulse in usecs31* @last_ts: time stamp of last pulse in usecs32* @deadline_ts: deadline when this sequence becomes invalid (first_ts + dur)33*/34struct pri_sequence {35struct list_head head;36u32 pri;37u32 dur;38u32 count;39u32 count_falses;40u64 first_ts;41u64 last_ts;42u64 deadline_ts;43};4445/**46* struct pri_detector - PRI detector element for a dedicated radar type47* @exit(): destructor48* @add_pulse(): add pulse event, returns pri_sequence if pattern was detected49* @reset(): clear states and reset to given time stamp50* @rs: detector specs for this detector element51* @last_ts: last pulse time stamp considered for this element in usecs52* @sequences: list_head holding potential pulse sequences53* @pulses: list connecting pulse_elem objects54* @count: number of pulses in queue55* @max_count: maximum number of pulses to be queued56* @window_size: window size back from newest pulse time stamp in usecs57*/58struct pri_detector {59void (*exit) (struct pri_detector *de);60struct pri_sequence *61(*add_pulse)(struct pri_detector *de, struct pulse_event *e);62void (*reset) (struct pri_detector *de, u64 ts);6364const struct radar_detector_specs *rs;6566/* private: internal use only */67u64 last_ts;68struct list_head sequences;69struct list_head pulses;70u32 count;71u32 max_count;72u32 window_size;73};7475struct pri_detector *pri_detector_init(const struct radar_detector_specs *rs);7677#endif /* DFS_PRI_DETECTOR_H */787980