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

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

[avr-libc-commit] [2141] * include/avr/interrupt.h (cli, sei): Add a mem


From: Joerg Wunsch
Subject: [avr-libc-commit] [2141] * include/avr/interrupt.h (cli, sei): Add a memory barrier,
Date: Tue, 08 Jun 2010 19:46:16 +0000

Revision: 2141
          http://svn.sv.gnu.org/viewvc/?view=rev&root=avr-libc&revision=2141
Author:   joerg_wunsch
Date:     2010-06-08 19:46:15 +0000 (Tue, 08 Jun 2010)
Log Message:
-----------
* include/avr/interrupt.h (cli, sei): Add a memory barrier,
and cross-reference <util/atomic.h>.

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

Modified: trunk/avr-libc/ChangeLog
===================================================================
--- trunk/avr-libc/ChangeLog    2010-06-08 14:08:18 UTC (rev 2140)
+++ trunk/avr-libc/ChangeLog    2010-06-08 19:46:15 UTC (rev 2141)
@@ -1,5 +1,10 @@
 2010-06-08  Joerg Wunsch <address@hidden>
 
+       * include/avr/interrupt.h (cli, sei): Add a memory barrier,
+       and cross-reference <util/atomic.h>.
+
+2010-06-08  Joerg Wunsch <address@hidden>
+
        Implement new header file: <avr/cpufunc.h>
        * include/avr/cpufunc.h: New file.
        * include/avr/Makefile.am (avr_HEADERS): Add cpufunc.h.

Modified: trunk/avr-libc/NEWS
===================================================================
--- trunk/avr-libc/NEWS 2010-06-08 14:08:18 UTC (rev 2140)
+++ trunk/avr-libc/NEWS 2010-06-08 19:46:15 UTC (rev 2141)
@@ -181,10 +181,15 @@
 
   - Added new headerfile: <avr/cpufunc.h>; currently contains _NOP() and
     _MemoryBarrier().
-  
 
+  - The twidemo can now optionally address 24C32 and larger EEPROMs
+    that require 16-bit word addressing.
+
+  - Add a "memory barrier" to the cli() and sei() macros.
+
+
 * New devices supported:
-  
+
   + ATxmega64D3
   + ATxmega128D3
   + ATxmega256D3

Modified: trunk/avr-libc/include/avr/interrupt.h
===================================================================
--- trunk/avr-libc/include/avr/interrupt.h      2010-06-08 14:08:18 UTC (rev 
2140)
+++ trunk/avr-libc/include/avr/interrupt.h      2010-06-08 19:46:15 UTC (rev 
2141)
@@ -62,10 +62,16 @@
 
     Enables interrupts by setting the global interrupt mask. This function
     actually compiles into a single line of assembly, so there is no function
-    call overhead. */
+    call overhead.  However, the macro also implies a <i>memory barrier</i>
+    which can cause additional loss of optimization.
+
+    In order to implement atomic access to multi-byte objects,
+    consider using the macros from <util/atomic.h>, rather than
+    implementing them manually with cli() and sei().
+*/
 #define sei()
 #else  /* !DOXYGEN */
-# define sei()  __asm__ __volatile__ ("sei" ::)
+# define sei()  __asm__ __volatile__ ("sei" ::: "memory")
 #endif /* DOXYGEN */
 
 #if defined(__DOXYGEN__)
@@ -76,10 +82,16 @@
 
     Disables all interrupts by clearing the global interrupt mask. This 
function
     actually compiles into a single line of assembly, so there is no function
-    call overhead. */
+    call overhead.  However, the macro also implies a <i>memory barrier</i>
+    which can cause additional loss of optimization.
+
+    In order to implement atomic access to multi-byte objects,
+    consider using the macros from <util/atomic.h>, rather than
+    implementing them manually with cli() and sei().
+*/
 #define cli()
 #else  /* !DOXYGEN */
-# define cli()  __asm__ __volatile__ ("cli" ::)
+# define cli()  __asm__ __volatile__ ("cli" ::: "memory")
 #endif /* DOXYGEN */
 
 




reply via email to

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