+static void handle_fw(void)
+{
+ if (fw.watchdog_enable == 1)
+ set(AR9170_TIMER_REG_WATCH_DOG, AR9170_WATCH_DOG_TIMER);
+
+ if (fw.reboot)
+ reboot();
+}
+
+static void tally_update(void)
+{
+ 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;
+
+ boff = get(AR9170_MAC_REG_BACKOFF_STATUS);
+ if (boff & AR9170_MAC_BACKOFF_TX_PE)
+ fw.tally.tx_time += 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)