+static void timer0_isr(void)
+{
+ wlan_timer();
+
+#ifdef CONFIG_CARL9170FW_GPIO_INTERRUPT
+ gpio_timer();
+#endif /* CONFIG_CARL9170FW_GPIO_INTERRUPT */
+
+#ifdef CONFIG_CARL9170FW_DEBUG_LED_HEARTBEAT
+ set(AR9170_GPIO_REG_PORT_DATA, get(AR9170_GPIO_REG_PORT_DATA) ^ 1);
+#endif /* CONFIG_CARL9170FW_DEBUG_LED_HEARTBEAT */
+}
+
+static void handle_timer(void)
+{
+ uint32_t intr;
+
+ intr = get(AR9170_TIMER_REG_INTERRUPT);
+
+ /* ACK timer interrupt */
+ set(AR9170_TIMER_REG_INTERRUPT, intr);
+
+#define HANDLER(intr, flag, func) \
+ do { \
+ if ((intr & flag) != 0) { \
+ intr &= ~flag; \
+ func(); \
+ } \
+ } while (0)
+
+ HANDLER(intr, BIT(0), timer0_isr);
+
+ if (intr)
+ DBG("Unhandled Timer Event %x", (unsigned int) intr);
+
+#undef HANDLER
+}
+
+static void __noreturn main_loop(void)