2 * carl9170 firmware - used by the ar9170 wireless device
6 * Copyright 2013 Christian Lamparter <chunkeey@googlemail.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 #include "pattern_generator.h"
26 #if defined(CARL9170FW_PATTERN_GENERATOR)
28 void radar_pattern_generator(void)
30 if (fw.phy.state == CARL9170_PHY_ON) {
31 if (likely(fw.wlan.soft_radar == NO_RADAR ||
32 fw.wlan.soft_radar >= __CARL9170FW_NUM_RADARS))
35 const struct radar_info *radar = &radars[fw.wlan.soft_radar];
36 if (radar->pulses >= fw.wlan.pattern_index) {
37 fw.wlan.pattern_index = 0;
40 if (radar->pulses > fw.wlan.pattern_index) {
41 const struct radar_info_pattern *pattern = &radar->pattern[fw.wlan.pattern_index];
42 if (is_after_usecs(fw.wlan.radar_last, pattern->pulse_interval)) {
43 fw.wlan.radar_last = get_clock_counter();
44 set(0x1C3BC0, pattern->pulse_pattern);
45 set(0x1C3BBC, pattern->pulse_mode);
46 udelay(pattern->pulse_width);
47 set(0x1C3BBC, ~pattern->pulse_mode);
48 fw.wlan.pattern_index++;
54 #endif /* CONFIG_CARL9170FW_RADAR */