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

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

[avr-libc-commit] [2469] bug #44140: wdt_disable: Add WD reset before ch


From: Pitchumani
Subject: [avr-libc-commit] [2469] bug #44140: wdt_disable: Add WD reset before chaning.
Date: Mon, 09 Mar 2015 06:34:03 +0000

Revision: 2469
          http://svn.sv.gnu.org/viewvc/?view=rev&root=avr-libc&revision=2469
Author:   pitchumani
Date:     2015-03-09 06:34:02 +0000 (Mon, 09 Mar 2015)
Log Message:
-----------
bug #44140: wdt_disable: Add WD reset before chaning. Prescaler bits preserved 
when setting WDCE and WDE.

Ticket Links:
------------
    http://savannah.gnu.org/bugs/?44140

Modified Paths:
--------------
    trunk/avr-libc/ChangeLog
    trunk/avr-libc/NEWS
    trunk/avr-libc/include/avr/wdt.h

Modified: trunk/avr-libc/ChangeLog
===================================================================
--- trunk/avr-libc/ChangeLog    2015-02-25 12:53:38 UTC (rev 2468)
+++ trunk/avr-libc/ChangeLog    2015-03-09 06:34:02 UTC (rev 2469)
@@ -1,3 +1,9 @@
+2015-03-09  Pitchumani Sivanupandi <address@hidden>
+
+       bug #44140: wdt_disable() macro clobbers prescaller bits ...
+       * include/avr/wdt.h (wdt_disable): Add WD reset before changing.
+       Prescaler bits are not overwritten while setting WDCE and WDE.
+
 2015-02-25  Joern Rennecke  <address@hidden>
             Senthil Kumar Selvaraj <address@hidden>
 

Modified: trunk/avr-libc/NEWS
===================================================================
--- trunk/avr-libc/NEWS 2015-02-25 12:53:38 UTC (rev 2468)
+++ trunk/avr-libc/NEWS 2015-03-09 06:34:02 UTC (rev 2469)
@@ -2,6 +2,7 @@
 
 * Bugs fixed:
 
+  [#44140] wdt_disable() macro clobbers prescaller bits 
   [no-id] TC_EVACT_FRQ_gc was misspelled as TC_EVACT_FRW_gc in some Xmega
           header files
 

Modified: trunk/avr-libc/include/avr/wdt.h
===================================================================
--- trunk/avr-libc/include/avr/wdt.h    2015-02-25 12:53:38 UTC (rev 2468)
+++ trunk/avr-libc/include/avr/wdt.h    2015-03-09 06:34:02 UTC (rev 2469)
@@ -446,29 +446,37 @@
 {
        if (_SFR_IO_REG_P (_WD_CONTROL_REG))
        {
+        uint8_t register temp_reg;
                __asm__ __volatile__ (
-                               "in __tmp_reg__, __SREG__" "\n\t"
-                               "cli" "\n\t"
-                               "out %0, %1" "\n\t"
-                               "out %0, __zero_reg__" "\n\t"
-                               "out __SREG__,__tmp_reg__" "\n\t"
-                               : /* no outputs */
-                               : "I" (_SFR_IO_ADDR(_WD_CONTROL_REG)),
-                               "r" ((uint8_t)(_BV(_WD_CHANGE_BIT) | _BV(WDE)))
+                               "in __tmp_reg__,__SREG__"    "\n\t"
+                               "cli"                        "\n\t"
+                               "wdr"                        "\n\t"
+                               "in  %[TEMPREG],%[WDTREG]"   "\n\t"
+                               "ori %[TEMPREG],%[WDCE_WDE]" "\n\t"
+                               "out %[WDTREG],%[TEMPREG]"   "\n\t"
+                               "out %[WDTREG],__zero_reg__" "\n\t"
+                               "out __SREG__,__tmp_reg__"   "\n\t"
+                               : [TEMPREG] "=r" (temp_reg)
+                               : [WDTREG]  "I"  
(_SFR_IO_ADDR(_WD_CONTROL_REG)),
+                               [WDCE_WDE]  "I"  ((uint8_t)(_BV(_WD_CHANGE_BIT) 
| _BV(WDE)))
                                : "r0"
                );
        }
        else
        {
+        uint8_t register temp_reg;
                __asm__ __volatile__ (
-                               "in __tmp_reg__, __SREG__" "\n\t"
-                               "cli" "\n\t"
-                               "sts %0, %1" "\n\t"
-                               "sts %0, __zero_reg__" "\n\t"
-                               "out __SREG__,__tmp_reg__" "\n\t"
-                               : /* no outputs */
-                               : "M" (_SFR_MEM_ADDR(_WD_CONTROL_REG)),
-                               "r" ((uint8_t)(_BV(_WD_CHANGE_BIT) | _BV(WDE)))
+                               "in __tmp_reg__,__SREG__"    "\n\t"
+                               "cli"                        "\n\t"
+                               "wdr"                        "\n\t"
+                               "lds %[TEMPREG],%[WDTREG]"   "\n\t"
+                               "ori %[TEMPREG],%[WDCE_WDE]" "\n\t"
+                               "sts %[WDTREG],%[TEMPREG]"   "\n\t"
+                               "sts %[WDTREG],__zero_reg__" "\n\t"
+                               "out __SREG__,__tmp_reg__"   "\n\t"
+                               : [TEMPREG] "=r" (temp_reg)
+                               : [WDTREG]  "M"  
(_SFR_MEM_ADDR(_WD_CONTROL_REG)),
+                               [WDCE_WDE]  "I"  ((uint8_t)(_BV(_WD_CHANGE_BIT) 
| _BV(WDE)))
                                : "r0"
                );
        }




reply via email to

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