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

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

[avr-libc-commit] [2299] * include/avr/xmega.h: New file, implement _PRO


From: Joerg Wunsch
Subject: [avr-libc-commit] [2299] * include/avr/xmega.h: New file, implement _PROTECTED_WRITE.
Date: Tue, 18 Sep 2012 14:55:37 +0000

Revision: 2299
          http://svn.sv.gnu.org/viewvc/?view=rev&root=avr-libc&revision=2299
Author:   joerg_wunsch
Date:     2012-09-18 14:55:36 +0000 (Tue, 18 Sep 2012)
Log Message:
-----------
* include/avr/xmega.h: New file, implement _PROTECTED_WRITE.
* include/avr/io.h: Include <avr/xmega.h>
* doc/api/doxygen.config.in: Add <avr/xmega.h> to documentation build.

Modified Paths:
--------------
    trunk/avr-libc/ChangeLog
    trunk/avr-libc/doc/api/doxygen.config.in
    trunk/avr-libc/include/avr/io.h

Added Paths:
-----------
    trunk/avr-libc/include/avr/xmega.h

Modified: trunk/avr-libc/ChangeLog
===================================================================
--- trunk/avr-libc/ChangeLog    2012-07-29 15:30:34 UTC (rev 2298)
+++ trunk/avr-libc/ChangeLog    2012-09-18 14:55:36 UTC (rev 2299)
@@ -1,3 +1,9 @@
+2012-09-18  Joerg Wunsch <address@hidden>
+
+       * include/avr/xmega.h: New file, implement _PROTECTED_WRITE.
+       * include/avr/io.h: Include <avr/xmega.h>
+       * doc/api/doxygen.config.in: Add <avr/xmega.h> to documentation build.
+
 2012-07-30  Dmitry Xmelkov  <address@hidden>
 
        patch #3729: Printf for integers speed up

Modified: trunk/avr-libc/doc/api/doxygen.config.in
===================================================================
--- trunk/avr-libc/doc/api/doxygen.config.in    2012-07-29 15:30:34 UTC (rev 
2298)
+++ trunk/avr-libc/doc/api/doxygen.config.in    2012-09-18 14:55:36 UTC (rev 
2299)
@@ -579,6 +579,7 @@
                          @top_srcdir@/include/avr/signature.h \
                          @top_srcdir@/include/avr/sleep.h \
                          @top_srcdir@/include/avr/version.h \
+                         @top_srcdir@/include/avr/xmega.h \
                          @top_srcdir@/include/avr/wdt.h \
                          @top_srcdir@/include/util \
                          @top_srcdir@/include/compat \

Modified: trunk/avr-libc/include/avr/io.h
===================================================================
--- trunk/avr-libc/include/avr/io.h     2012-07-29 15:30:34 UTC (rev 2298)
+++ trunk/avr-libc/include/avr/io.h     2012-09-18 14:55:36 UTC (rev 2299)
@@ -435,6 +435,10 @@
 
 #include <avr/version.h>
 
+#if __AVR_ARCH__ >= 100
+#  include <avr/xmega.h>
+#endif
+
 /* Include fuse.h after individual IO header files. */
 #include <avr/fuse.h>
 

Added: trunk/avr-libc/include/avr/xmega.h
===================================================================
--- trunk/avr-libc/include/avr/xmega.h                          (rev 0)
+++ trunk/avr-libc/include/avr/xmega.h  2012-09-18 14:55:36 UTC (rev 2299)
@@ -0,0 +1,71 @@
+/* Copyright (c) 2012 Joerg Wunsch
+   All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are met:
+
+   * Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+
+   * Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in
+     the documentation and/or other materials provided with the
+     distribution.
+
+   * Neither the name of the copyright holders nor the names of
+     contributors may be used to endorse or promote products derived
+     from this software without specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE. */
+
+/* $Id$ */
+
+/*
+ * This file is included by <avr/io.h> whenever compiling for an Xmega
+ * device.  It abstracts certain features common to the Xmega device
+ * families.
+ */
+
+#ifndef _AVR_XMEGA_H
+#define _AVR_XMEGA_H
+
+#ifdef __DOXYGEN__
+/**
+ \def _PROTECTED_WRITE
+ \ingroup avr_io
+
+ Write value \c value to IO register \c reg that is protected through
+ the Xmega configuration change protection (CCP) mechanism.  This
+ implements the timed sequence that is required for CCP.
+
+ Example to modify the CPU clock:
+ \code
+ #include <avr/io.h>
+
+ _PROTECTED_WRITE(CLK_PSCTRL, CLK_PSADIV0_bm);
+ _PROTECTED_WRITE(CLK_CTRL, CLK_SCLKSEL0_bm);
+ \endcode
+ */
+#define _PROTECTED_WRITE(reg, value)
+#else  /* !__DOXYGEN__ */
+#define PROTECTED_WRITE(reg, value)                            \
+  __asm__ __volatile__("out %[ccp], %[ccp_ioreg]" "\n\t"       \
+                      "sts %[ioreg], %[val]"                   \
+                      :                                        \
+                      : [ccp] "I" (_SFR_IO_ADDR(CCP)),         \
+                        [ccp_ioreg] "d" (CCP_IOREG_gc),        \
+                        [ioreg] "M" (_SFR_MEM_ADDR(reg)),      \
+                        [val] "r" (value))
+#endif /* DOXYGEN */
+
+#endif /* _AVR_XMEGA_H */


Property changes on: trunk/avr-libc/include/avr/xmega.h
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Author Id Date
Added: svn:eol-style
   + native




reply via email to

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