MCPcopy Create free account
hub / github.com/F-Stack/f-stack / mv_watchdog_event

Function mv_watchdog_event

freebsd/arm/mv/timer.c:479–507  ·  view source on GitHub ↗

* Watchdog event handler. */

Source from the content-addressed store, hash-verified

477 * Watchdog event handler.
478 */
479static void
480mv_watchdog_event(void *arg, unsigned int cmd, int *error)
481{
482 uint64_t ns;
483 uint64_t ticks;
484
485 mtx_lock(&timer_softc->timer_mtx);
486 if (cmd == 0) {
487 if (timer_softc->config->watchdog_disable != NULL)
488 timer_softc->config->watchdog_disable();
489 } else {
490 /*
491 * Watchdog timeout is in nanosecs, calculation according to
492 * watchdog(9)
493 */
494 ns = (uint64_t)1 << (cmd & WD_INTERVAL);
495 ticks = (uint64_t)(ns * timer_softc->config->clock_src) / 1000000000;
496 if (ticks > MAX_WATCHDOG_TICKS) {
497 if (timer_softc->config->watchdog_disable != NULL)
498 timer_softc->config->watchdog_disable();
499 } else {
500 mv_set_timer(WATCHDOG_TIMER_ARMV5, ticks);
501 if (timer_softc->config->watchdog_enable != NULL)
502 timer_softc->config->watchdog_enable();
503 *error = 0;
504 }
505 }
506 mtx_unlock(&timer_softc->timer_mtx);
507}
508
509static int
510mv_timer_start(struct eventtimer *et, sbintime_t first, sbintime_t period)

Callers

nothing calls this directly

Calls 3

mv_set_timerFunction · 0.70
mtx_lockFunction · 0.50
mtx_unlockFunction · 0.50

Tested by

no test coverage detected