Пример #1
0
static void avr_watchdog_reset(avr_io_t * port)
{
	avr_watchdog_t * p = (avr_watchdog_t *)port;
	avr_t * avr = p->io.avr;

	if (p->reset_context.wdrf) {
		p->reset_context.wdrf = 0;
		/*
		 * if watchdog reset kicked, then watchdog gets restarted at
		 * fastest interval
		 */
		avr->run = p->reset_context.avr_run;

		avr_regbit_set(avr, p->wde);
		avr_regbit_set(avr, p->wdrf);
		avr_regbit_set_array_from_value(avr, p->wdp, 4, 0);
		
		avr_watchdog_set_cycle_count_and_timer(avr, p, 0, 0);
	}
	/* TODO could now use the two pending/running IRQs to do the same
	 * as before */
	avr_irq_register_notify(p->watchdog.irq, avr_watchdog_irq_notify, p);
}
Пример #2
0
static void
avr_watchdog_reset (avr_io_t * port)
{
  avr_watchdog_t *p = (avr_watchdog_t *) port;
  avr_t *avr = p->io.avr;

  if (p->reset_context.wdrf)
    {
      /*
       * if watchdog reset kicked, then watchdog gets restated at fastest interval
       */

      avr->run = p->reset_context.avr_run;

      avr_regbit_set (avr, p->wde);
      avr_regbit_set (avr, p->wdrf);
      avr_regbit_set_array_from_value (avr, p->wdp, 4, 0);

      avr_watchdog_set_cycle_count_and_timer (avr, p, 0, 0);
    }

  avr_irq_register_notify (&p->watchdog.irq, avr_watchdog_irq_notify, p);
}