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

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

[avr-libc-commit] [2458] Detect and branch on presence of SLEEP_SMODE<n>


From: Senthil Kumar Selvaraj
Subject: [avr-libc-commit] [2458] Detect and branch on presence of SLEEP_SMODE<n>_bm for xmegas, instead of assuming 3 bits always.
Date: Thu, 20 Nov 2014 07:36:22 +0000

Revision: 2458
          http://svn.sv.gnu.org/viewvc/?view=rev&root=avr-libc&revision=2458
Author:   saaadhu
Date:     2014-11-20 07:36:20 +0000 (Thu, 20 Nov 2014)
Log Message:
-----------
Detect and branch on presence of SLEEP_SMODE<n>_bm for xmegas, instead of 
assuming 3 bits always.

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

Modified: trunk/avr-libc/ChangeLog
===================================================================
--- trunk/avr-libc/ChangeLog    2014-11-19 11:39:41 UTC (rev 2457)
+++ trunk/avr-libc/ChangeLog    2014-11-20 07:36:20 UTC (rev 2458)
@@ -1,3 +1,8 @@
+2014-11-20  Senthil Kumar Selvaraj <address@hidden>
+
+       * include/avr/sleep.h (set_sleep_mode): Branch on presence of 
+       SLEEP_SMODE<n>_bm for xmegas.
+
 2014-11-18  Senthil Kumar Selvaraj <address@hidden>
 
        * include/avr/sleep.h (set_sleep_mode): Remove SLEEP_MODE defines 

Modified: trunk/avr-libc/include/avr/sleep.h
===================================================================
--- trunk/avr-libc/include/avr/sleep.h  2014-11-19 11:39:41 UTC (rev 2457)
+++ trunk/avr-libc/include/avr/sleep.h  2014-11-20 07:36:20 UTC (rev 2458)
@@ -180,14 +180,32 @@
         EMCUCR = ((EMCUCR & ~_BV(SM0)) | ((mode) == SLEEP_MODE_PWR_SAVE || 
(mode) == SLEEP_MODE_EXT_STANDBY ? _BV(SM0) : 0)); \
     } while(0)
 
-/* All xmegas work the same way */
+/* For xmegas, check presence of SLEEP_SMODE<n>_bm and define set_sleep_mode 
accordingly. */
 #elif defined(__AVR_XMEGA__)
+#if defined(SLEEP_SMODE2_bm)
 
     #define set_sleep_mode(mode) \
     do { \
         _SLEEP_CONTROL_REG = ((_SLEEP_CONTROL_REG & ~(SLEEP_SMODE2_bm | 
SLEEP_SMODE1_bm | SLEEP_SMODE0_bm)) | (mode)); \
     } while(0)
 
+#elif defined(SLEEP_SMODE1_bm)
+
+    #define set_sleep_mode(mode) \
+    do { \
+        _SLEEP_CONTROL_REG = ((_SLEEP_CONTROL_REG & ~(SLEEP_SMODE1_bm | 
SLEEP_SMODE0_bm)) | (mode)); \
+    } while(0)
+
+#else
+
+    #define set_sleep_mode(mode) \
+    do { \
+        _SLEEP_CONTROL_REG = ((_SLEEP_CONTROL_REG & ~( SLEEP_SMODE0_bm)) | 
(mode)); \
+    } while(0)
+
+
+#endif /* #if defined(SLEEP_SMODE2_bm) */
+
 /* For everything else, check for presence of SM<n> and define set_sleep_mode 
accordingly. */
 #else
 #if defined(SM2)




reply via email to

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