/* * Copyright (c) 2012 Neratec Solutions AG * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
if (delta <= tolerance) /* val and fraction are within tolerance */ return 1;
factor = val / fraction;
remainder = val % fraction; if (remainder > tolerance) { /* no exact match */ if ((fraction - remainder) <= tolerance) /* remainder is within tolerance */
factor++; else
factor = 0;
} return factor;
}
/* * DOC: Singleton Pulse and Sequence Pools * * Instances of pri_sequence and pulse_elem are kept in singleton pools to * reduce the number of dynamic allocations. They are shared between all * instances and grow up to the peak number of simultaneously used objects. * * Memory is freed after all references to the pools are released.
*/ static u32 singleton_pool_references; static LIST_HEAD(pulse_pool); static LIST_HEAD(pseq_pool); static DEFINE_SPINLOCK(pool_lock);
list_for_each_entry(ps, &pde->sequences, head) { /* * we assume to have enough matching confidence if we * 1) have enough pulses * 2) have more matching than false pulses
*/ if ((ps->count >= pde->rs->ppb_thresh) &&
(ps->count * pde->rs->num_pri >= ps->count_falses)) return ps;
} return NULL;
}
/* free pulse queue and sequences list and give objects back to pools */ staticvoid pri_detector_reset(struct pri_detector *pde, u64 ts)
{ struct pri_sequence *ps, *ps0; struct pulse_elem *p, *p0;
list_for_each_entry_safe(ps, ps0, &pde->sequences, head) {
list_del_init(&ps->head);
pool_put_pseq_elem(ps);
}
list_for_each_entry_safe(p, p0, &pde->pulses, head) {
list_del_init(&p->head);
pool_put_pulse_elem(p);
}
pde->count = 0;
pde->last_ts = ts;
}
/* ignore pulses not within width range */ if ((rs->width_min > event->width) || (rs->width_max < event->width)) return NULL;
if ((ts - de->last_ts) < rs->max_pri_tolerance) /* if delta to last pulse is too short, don't use this pulse */ return NULL; /* radar detector spec needs chirp, but not detected */ if (rs->chirp && rs->chirp != event->chirp) return NULL;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.