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"
28 #if defined(CONFIG_CARL9170FW_PATTERN_GENERATOR)
30 void pattern_generator(void)
32 if (fw.phy.state == CARL9170_PHY_ON) {
33 if (likely(fw.wlan.soft_pattern == NO_PATTERN ||
34 fw.wlan.soft_pattern >= __CARL9170FW_NUM_PATTERNS))
37 const struct pattern_info *pattern = &patterns[fw.wlan.soft_pattern];
38 if (pattern->pulses >= fw.wlan.pattern_index) {
39 fw.wlan.pattern_index = 0;
42 if (pattern->pulses > fw.wlan.pattern_index) {
43 const struct pattern_pulse_info *ppi = &pattern->pattern[fw.wlan.pattern_index];
44 if (is_after_usecs(fw.wlan.pattern_last, ppi->pulse_interval)) {
45 fw.wlan.pattern_last = get_clock_counter();
46 set(0x1C3BC0, ppi->pulse_pattern);
47 set(0x1C3BBC, ppi->pulse_mode);
48 udelay(ppi->pulse_width);
51 fw.wlan.pattern_index++;
57 #endif /* CONFIG_CONFIG_CARL9170FW_RADAR */