static void handle_nap_exti(void) { u32 irq = nap_irq_rd_blocking(); if (irq & NAP_IRQ_ACQ_DONE) acq_service_irq(); if (irq & NAP_IRQ_ACQ_LOAD_DONE) acq_service_load_done(); if (irq & NAP_IRQ_TIMING_STROBE) { chBSemReset(&timing_strobe_sem, TRUE); } if (irq & NAP_IRQ_EXT_EVENT) ext_event_service(); /* Mask off everything but tracking irqs. */ irq &= NAP_IRQ_TRACK_MASK; tracking_channels_update(irq); u32 err = nap_error_rd_blocking(); if (err) { log_error("SwiftNAP Error: 0x%08X", (unsigned int)err); tracking_channels_missed_update_error(err); } watchdog_notify(WD_NOTIFY_NAP_ISR); nap_exti_count++; }
static void manage_acq_thread(void *arg) { /* TODO: This should be trigged by a semaphore from the acq ISR code, not * just ran periodically. */ (void)arg; chRegSetThreadName("manage acq"); while (TRUE) { manage_acq(); manage_tracking_startup(); watchdog_notify(WD_NOTIFY_ACQ_MGMT); } }
static void manage_track_thread(void *arg) { (void)arg; chRegSetThreadName("manage track"); while (TRUE) { chThdSleepMilliseconds(500); DO_EVERY(2, check_clear_unhealthy(); manage_track(); watchdog_notify(WD_NOTIFY_TRACKING_MGMT); ); tracking_send_state(); }
static void handle_nap_exti(void) { u32 irq = NAP->TRK_IRQ; while (irq) { tracking_channels_update(irq); NAP->TRK_IRQ = irq; asm("dsb"); irq = NAP->TRK_IRQ; } u32 err = NAP->TRK_IRQ_ERROR; if (err) { NAP->TRK_IRQ_ERROR = err; log_error("SwiftNAP Error: 0x%08X", (unsigned int)err); tracking_channels_missed_update_error(err); } watchdog_notify(WD_NOTIFY_NAP_ISR); }