Skip to content

Commit

Permalink
Fix WDIE being wrongly cleared in Interrupt Mode
Browse files Browse the repository at this point in the history
WDIE must be automatically cleared only in "Interrupt and System
Reset Mode" (where it's used to transition to "System Reset Mode").

In other modes, watchdog interrupt must not clear WDIE.

Strictly speaking, the modified condition also clears it in
"System Reset Mode" as well, but the system is reset on
interrupt anyway, so it doesn't matter.

See buserror#456
  • Loading branch information
WGH- committed Dec 10, 2021
1 parent ea4c450 commit d6ba83c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion simavr/sim/avr_watchdog.c
Expand Up @@ -182,7 +182,7 @@ static void avr_watchdog_irq_notify(
* again when cleared (after servicing), value = 0
*/

if (!value && avr_regbit_get(avr, p->watchdog.raised)) {
if (!value && avr_regbit_get(avr, p->watchdog.raised) && avr_regbit_get(avr, p->wde)) {
avr_regbit_clear(avr, p->watchdog.enable);
}
}
Expand Down

0 comments on commit d6ba83c

Please sign in to comment.