avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-libc-dev] [bug #40569] sleep_bod_disable does not work in attiny13a


From: Matthijs Kooijman
Subject: [avr-libc-dev] [bug #40569] sleep_bod_disable does not work in attiny13a
Date: Wed, 13 Nov 2013 17:14:48 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130729 Firefox/17.0 Iceweasel/17.0.7

URL:
  <http://savannah.nongnu.org/bugs/?40569>

                 Summary: sleep_bod_disable does not work in attiny13a
                 Project: AVR C Runtime Library
            Submitted by: matthijs
            Submitted on: Wed 13 Nov 2013 05:14:47 PM GMT
                Category: Header
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Header files
                  Status: None
        Percent Complete: 0%
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 1.8.0
           Fixed Release: None

    _______________________________________________________

Details:

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?




    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?40569>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]