From: Christian Lamparter Date: Sat, 26 Jan 2013 20:46:51 +0000 (+0100) Subject: Merge branch 'master' into radar X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=50e4b5124765b7afcf68f21f9d2570d606afba96;hp=-c;p=carl9170fw.git Merge branch 'master' into radar --- 50e4b5124765b7afcf68f21f9d2570d606afba96 diff --combined autogen.sh index bb52416,a360065..0c4776d --- a/autogen.sh +++ b/autogen.sh @@@ -9,7 -9,8 +9,8 @@@ case "$1" i cmake . make popd - config/conf Kconfig + shift 1 + config/conf Kconfig "$@" cmake . ;; @@@ -28,22 -29,23 +29,22 @@@ echo -n "Installing firmware..." if [ "$CONFIG_CARL9170FW_BUILD_TOOLS" = "y" ]; then + echo -n "Prepare firmware image..." + tools/src/fwprepare carlfw/carl9170.fw + if [ "$CONFIG_CARL9170FW_BUILD_MINIBOOT" = "y" ]; then echo -n "Apply miniboot..." - # also adds checksum + # also update checksum tools/src/miniboot a carlfw/carl9170.fw minifw/miniboot.fw - else - echo -n "Add checksum..." - tools/src/checksum carlfw/carl9170.fw fi fi - install -m 644 carlfw/carl9170.fw \ ../carl9170-$CONFIG_CARL9170FW_RELEASE_VERSION.fw echo "done." ;; *) - $0 config + $0 config "$@" $0 compile ;; diff --combined carlfw/Kconfig index 9bce6f1,656fcdb..4cec81c --- a/carlfw/Kconfig +++ b/carlfw/Kconfig @@@ -85,16 -85,6 +85,16 @@@ config CARL9170FW_EXPERIMENTA def_bool y prompt "Experimental Features" +config CARL9170FW_RADAR + def_bool n + prompt "Radar pattern generator" + depends on CARL9170FW_EXPERIMENTAL + ---help--- + With this option enabled, the firmware can generate random + transmission pattern that might fool a reciever to believe + that there is an active radar on the channel. + Note: sadly, no SDR here. + config CARL9170FW_WOL_OPTION def_bool n prompt "Wakeup on WLAN" @@@ -200,7 -190,7 +200,7 @@@ config CARL9170FW_UNUSABL config CARL9170FW_USB_MODESWITCH def_bool n prompt "USB 1.1 / 2.0 switching support" - depends on CARL9170FW_BROKEN_FEATURES + depends on CARL9170FW_BROKEN_FEATURES && CARL9170FW_USB_STANDARD_CMDS ---help--- Mostly implemented, but untested and some serious doubts remain. diff --combined carlfw/src/main.c index b9e558d,b2d1639..50415fe --- a/carlfw/src/main.c +++ b/carlfw/src/main.c @@@ -31,7 -31,6 +31,7 @@@ #include "wl.h" #include "rf.h" #include "usb.h" +#include "radar.h" #define AR9170_WATCH_DOG_TIMER 0x100 @@@ -85,10 -84,13 +85,13 @@@ static void handle_fw(void static void tally_update(void) { - unsigned int boff, time, delta; + unsigned int time; time = get_clock_counter(); + #ifdef CONFIG_CARL9170FW_RADIO_FUNCTIONS if (fw.phy.state == CARL9170_PHY_ON) { + unsigned int boff, delta; + delta = (time - fw.tally_clock); fw.tally.active += delta; @@@ -99,43 -101,11 +102,43 @@@ if (boff & AR9170_MAC_BACKOFF_CCA) fw.tally.cca += delta; } - + #endif /* CONFIG_CARL9170FW_RADIO_FUNCTIONS */ fw.tally_clock = time; fw.counter++; } +#ifdef CONFIG_CARL9170FW_RADAR +static void radar_pattern_generator(void) +{ + if (fw.phy.state == CARL9170_PHY_ON) { + if (fw.wlan.soft_radar == NO_RADAR || + fw.wlan.soft_radar >= __CARL9170FW_NUM_RADARS) + return; + + const struct radar_info *radar = &radars[fw.wlan.soft_radar]; + if (radar->pulses >= fw.wlan.pattern_index) { + fw.wlan.pattern_index = 0; + } + + if (radar->pulses > fw.wlan.pattern_index) { + const struct radar_info_pattern *pattern = &radar->pattern[fw.wlan.pattern_index]; + if (is_after_usecs(fw.wlan.radar_last, pattern->pulse_interval)) { + fw.wlan.radar_last = get_clock_counter(); + set(0x1C3BC0, pattern->pulse_pattern); + set(0x1C3BBC, pattern->pulse_mode); + udelay(pattern->pulse_width); + set(0x1C3BBC, ~pattern->pulse_mode); + fw.wlan.pattern_index++; + } + } + } +} +#else +static void radar_pattern_generator(void) +{ +} +#endif /* CONFIG_CARL9170FW_RADAR */ + static void __noreturn main_loop(void) { /* main loop */ @@@ -155,8 -125,6 +158,8 @@@ handle_timer(); tally_update(); + + radar_pattern_generator(); } }