Merge branch 'master' into radar
authorChristian Lamparter <chunkeey@googlemail.com>
Sat, 26 Jan 2013 20:46:51 +0000 (21:46 +0100)
committerChristian Lamparter <chunkeey@googlemail.com>
Sat, 26 Jan 2013 20:46:51 +0000 (21:46 +0100)
1  2 
autogen.sh
carlfw/Kconfig
carlfw/src/main.c

diff --combined autogen.sh
index bb52416a2566a1c9bb7e7d27da16b24534ccee4d,a360065b8b4a467c9c051f75d1ce98b57a6e1677..0c4776dbc68549a3da4b1e21e211e97824f00bbb
@@@ -9,7 -9,8 +9,8 @@@ case "$1" i
                cmake .
                make
                popd
-               config/conf Kconfig
+               shift 1
+               config/conf Kconfig "$@"
                cmake .
        ;;
  
  
                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 9bce6f13d6b3791b93785568fd4786095855c9d7,656fcdb4ddd67a66db67e8fb0690f24d10e45a92..4cec81cef2e7f424b9c90e768c8bff6aa945ad90
@@@ -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 b9e558d3bbedf7ee55eecddf60bd8884b777a141,b2d16390cff576eea2f4fd2608ba849b650f1849..50415fedbbb760e77ef29ec6fede2b9f1a907cb7
@@@ -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;
                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 */
                handle_timer();
  
                tally_update();
 +
 +              radar_pattern_generator();
        }
  }