Closed avrs-admin closed 2 years ago
Wed 13 Nov 2013 06:14:47 PM CET
The implementation of sleep_bod_disable for non-xmega mcu's is as follows (from avr/sleep.h):
do { uint8_t tempreg; asm volatile("in %[tempreg], %[mcucr]" "nt" "ori %[tempreg], %[bods_bodse]" "nt" "out %[mcucr], %[tempreg]" "nt" "andi %[tempreg], %[not_bodse]" "nt" "out %[mcucr], %[tempreg]" : [tempreg] "=&d" (tempreg) : [mcucr] "I" _SFR_IO_ADDR(MCUCR), [bods_bodse] "i" (_BV(BODS) | _BV(BODSE)), [not_bodse] "i" (~_BV(BODSE))); } while (0)
However, this hardcodes MCUCR, while attiny13 uses BODCR for these bits (see page 33 of http://www.atmel.com/Images/doc8126.pdf).
A grep on BODSE and BPDSE (a typo, see #40567) shows that tn2313a and tn4313 also have the same problem.
Perhaps adding something like:
and then use BODSE_TEMP_REG in the ASM snippet would fix this?
This issue was migrated from https://savannah.nongnu.org/bugs/?40569
Pitchumani Wed 30 Jul 2014 01:48:23 PM CEST
http://svn.savannah.nongnu.org/viewvc?view=rev&root=avr-libc&revision=2433
This patch has been applied and committed.
Thank you for the contribution.
Matthijs Kooijman Wed 30 Jul 2014 02:26:18 PM CEST
Looks good, thanks!
Wed 13 Nov 2013 06:14:47 PM CET
The implementation of sleep_bod_disable for non-xmega mcu's is as follows (from avr/sleep.h):
define sleep_bod_disable()
do { uint8_t tempreg; asm volatile("in %[tempreg], %[mcucr]" "nt" "ori %[tempreg], %[bods_bodse]" "nt" "out %[mcucr], %[tempreg]" "nt" "andi %[tempreg], %[not_bodse]" "nt" "out %[mcucr], %[tempreg]" : [tempreg] "=&d" (tempreg) : [mcucr] "I" _SFR_IO_ADDR(MCUCR), [bods_bodse] "i" (_BV(BODS) | _BV(BODSE)), [not_bodse] "i" (~_BV(BODSE))); } while (0)
However, this hardcodes MCUCR, while attiny13 uses BODCR for these bits (see page 33 of http://www.atmel.com/Images/doc8126.pdf).
A grep on BODSE and BPDSE (a typo, see #40567) shows that tn2313a and tn4313 also have the same problem.
Perhaps adding something like:
ifdef BODCR
define BODSE_TEMP_REG BODCR
else
define BODSE_TEMP_REG MCUCR
endif
and then use BODSE_TEMP_REG in the ASM snippet would fix this?
This issue was migrated from https://savannah.nongnu.org/bugs/?40569