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

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

[avr-libc-dev] [bug #38192] eeprom_update_byte does not use bitwise AND


From: anonymous
Subject: [avr-libc-dev] [bug #38192] eeprom_update_byte does not use bitwise AND
Date: Tue, 29 Jan 2013 11:23:57 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.16) Gecko/20100427 Galeon/2.0.7 (Debian 2.0.7-2.1+b1)

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

                 Summary: eeprom_update_byte does not use bitwise AND
                 Project: AVR C Runtime Library
            Submitted by: None
            Submitted on: Tue 29 Jan 2013 11:23:56 AM UTC
                Category: Library
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: libc code
                  Status: None
        Percent Complete: 0%
             Assigned to: None
        Originator Email: address@hidden
             Open/Closed: Open
         Discussion Lock: Any
                 Release: Any
           Fixed Release: None

    _______________________________________________________

Details:

As described in AVR103, there is no need of erase cycle if new value match
bitwise AND between the old value and the new value. 

Patch below uses this functionality, eeprom endurance is higher and update
time is reduced too. 


% diff -u eeupd_byte.S.orig eeupd_byte.S
--- eeupd_byte.S.orig   2013-01-29 10:54:43.000000000 +0100
+++ eeupd_byte.S        2013-01-29 12:02:25.000000000 +0100
@@ -88,8 +88,14 @@
        breq    2f
 
 # if    defined (EEPM0) && defined (EEPM1)
-       ; Set programming mode: erase and write.
+       ; Set programming mode: write only
        out     _SFR_IO_ADDR (EECR), __zero_reg__
+       sbi     _SFR_IO_ADDR (EECR),EEPM1
+       ;test bitwise AND
+       and     __tmp_reg__, r18
+       cpse    __tmp_reg__, r18
+       ; final value different, set programing mode: erase and write
+       cbi     _SFR_IO_ADDR (EECR),EEPM1
 # elif  defined (EEPM0) || defined (EEPM1)
 #  error       /* Unknown EECR register.       */
 # endif





    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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