Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright (c) 2012 Neratec Solutions AG
0003  *
0004  * Permission to use, copy, modify, and/or distribute this software for any
0005  * purpose with or without fee is hereby granted, provided that the above
0006  * copyright notice and this permission notice appear in all copies.
0007  *
0008  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
0009  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
0010  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
0011  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
0012  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
0013  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
0014  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
0015  */
0016 
0017 #ifndef DFS_PRI_DETECTOR_H
0018 #define DFS_PRI_DETECTOR_H
0019 
0020 #include <linux/list.h>
0021 
0022 extern struct ath_dfs_pool_stats global_dfs_pool_stats;
0023 
0024 /**
0025  * struct pri_sequence - sequence of pulses matching one PRI
0026  * @head: list_head
0027  * @pri: pulse repetition interval (PRI) in usecs
0028  * @dur: duration of sequence in usecs
0029  * @count: number of pulses in this sequence
0030  * @count_falses: number of not matching pulses in this sequence
0031  * @first_ts: time stamp of first pulse in usecs
0032  * @last_ts: time stamp of last pulse in usecs
0033  * @deadline_ts: deadline when this sequence becomes invalid (first_ts + dur)
0034  */
0035 struct pri_sequence {
0036     struct list_head head;
0037     u32 pri;
0038     u32 dur;
0039     u32 count;
0040     u32 count_falses;
0041     u64 first_ts;
0042     u64 last_ts;
0043     u64 deadline_ts;
0044 };
0045 
0046 /**
0047  * struct pri_detector - PRI detector element for a dedicated radar type
0048  * @exit(): destructor
0049  * @add_pulse(): add pulse event, returns pri_sequence if pattern was detected
0050  * @reset(): clear states and reset to given time stamp
0051  * @rs: detector specs for this detector element
0052  * @last_ts: last pulse time stamp considered for this element in usecs
0053  * @sequences: list_head holding potential pulse sequences
0054  * @pulses: list connecting pulse_elem objects
0055  * @count: number of pulses in queue
0056  * @max_count: maximum number of pulses to be queued
0057  * @window_size: window size back from newest pulse time stamp in usecs
0058  */
0059 struct pri_detector {
0060     void (*exit)     (struct pri_detector *de);
0061     struct pri_sequence *
0062          (*add_pulse)(struct pri_detector *de, struct pulse_event *e);
0063     void (*reset)    (struct pri_detector *de, u64 ts);
0064 
0065     const struct radar_detector_specs *rs;
0066 
0067 /* private: internal use only */
0068     u64 last_ts;
0069     struct list_head sequences;
0070     struct list_head pulses;
0071     u32 count;
0072     u32 max_count;
0073     u32 window_size;
0074 };
0075 
0076 struct pri_detector *pri_detector_init(const struct radar_detector_specs *rs);
0077 
0078 #endif /* DFS_PRI_DETECTOR_H */