> -----Original Message----- > From: Bob Paddock [mailto:[email protected]] > Sent: Friday, February 13, 2009 7:14 AM > To: Weddington, Eric > Cc: [email protected] > Subject: Re: [avr-libc-dev] [RFC] Sleeping BOD API > > > I'm concerned that because you're doing this in C, the > compiler won't generate efficient >enough code > > There was a single unnecessary reload from the compiler > generated code. > This assembly language file (bodsleep.S) does work on the Tiny88: > > ;20090213 Disable Brown Out Detect during Sleep. Has critical cycle > timing. IRQs must be off. > > #include <avr/io.h> > > .section .text > > .global bod_sleep > bod_sleep: > IN R24,_SFR_IO_ADDR(MCUCR) ; Load MCUCR to R24 > ORI R24,(_BV(BODS)|_BV(BODSE)) ; Set Brown Out Disable > during Sleep and enable the bit change > OUT _SFR_IO_ADDR(MCUCR),R24 ; Store MCUCR > ANDI R24,~(_BV(BODSE)) ; Clear BODSE > OUT _SFR_IO_ADDR(MCUCR),R24 ; Store MCUCR with > BODSE cleared > SEI ; Enable Interrupts > SLEEP ; Go to sleep > RET >
Yes, and that is exactly what the inline assembly macros generates. That's why it has to be in inline assembly and not C. _______________________________________________ AVR-libc-dev mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/avr-libc-dev
