[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-libc-dev] wdt.h watchdog code - will an interrupt mess up the t
From: |
Joerg Wunsch |
Subject: |
Re: [avr-libc-dev] wdt.h watchdog code - will an interrupt mess up the timing ? |
Date: |
Thu, 25 Aug 2005 06:33:37 +0200 |
User-agent: |
Mutt/1.4.2.1i |
As Jeff Kowing wrote:
> My concern is that since global interrupts are potentially
> re-enabled on line 5, what prevents an interrupt routine from
> triggering before line 6 gets executed ? I believe that the
> instruction following a "sei" instruction is guaranteed to execute
> before any pending interrupts are handled, but is the same true when
> using an "in" instruction to set the I bit ?
Yes, it is, alas it's undocumented. Any function prologue/epilogue
generated by GCC also relies on that.
> My other question concerns wdt_disable():
> 1. in __tmp_reg__, __SREG__
> 2. out _WD_CONTROL_REG, _BV(_WD_CHANGE_BIT) | _BV(WDE)
> 3. out _WD_CONTROL_REG, __zero_reg__
> 4. out __SREG__, __tmp_reg__
> This one really confuses me because there is no "cli" ...
And I think you've found a real bug here. Originally, wdt_disable()
has been implemented in terms of _wdt_write(), but Eric Weddington
rewrote that in rev 1.11, to fix bug #11522. Obviously, the cli got
lost in this.
Please file a bug report for that.
--
cheers, J"org .-.-. --... ...-- -.. . DL8DTL
http://www.sax.de/~joerg/ NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)