AVR Libc Home Page | AVR Libc Development Pages | ||||
Main Page | User Manual | Library Reference | FAQ | Alphabetical Index | Example Projects |
00001 /* Copyright (c) 2010, Joerg Wunsch 00002 All rights reserved. 00003 00004 Redistribution and use in source and binary forms, with or without 00005 modification, are permitted provided that the following conditions are met: 00006 00007 * Redistributions of source code must retain the above copyright 00008 notice, this list of conditions and the following disclaimer. 00009 00010 * Redistributions in binary form must reproduce the above copyright 00011 notice, this list of conditions and the following disclaimer in 00012 the documentation and/or other materials provided with the 00013 distribution. 00014 00015 * Neither the name of the copyright holders nor the names of 00016 contributors may be used to endorse or promote products derived 00017 from this software without specific prior written permission. 00018 00019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00020 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00021 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00022 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00023 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00024 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00025 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00026 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00027 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00028 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00029 POSSIBILITY OF SUCH DAMAGE. */ 00030 00031 /* $Id: cpufunc.h 2158 2010-06-10 15:48:28Z joerg_wunsch $ */ 00032 00033 /* avr/cpufunc.h - Special CPU functions */ 00034 00035 #ifndef _AVR_CPUFUNC_H_ 00036 #define _AVR_CPUFUNC_H_ 1 00037 00038 /** \file */ 00039 /** \defgroup avr_cpufunc <avr/cpufunc.h>: Special AVR CPU functions 00040 \code #include <avr/cpufunc.h> \endcode 00041 00042 This header file contains macros that access special functions of 00043 the AVR CPU which do not fit into any of the other header files. 00044 00045 */ 00046 00047 #if defined(__DOXYGEN__) 00048 /** 00049 \ingroup avr_cpufunc 00050 \def _NOP 00051 00052 Execute a <i>no operation</i> (NOP) CPU instruction. This 00053 should not be used to implement delays, better use the functions 00054 from <util/delay_basic.h> or <util/delay.h> for this. For 00055 debugging purposes, a NOP can be useful to have an instruction that 00056 is guaranteed to be not optimized away by the compiler, so it can 00057 always become a breakpoint in the debugger. 00058 */ 00059 #define _NOP() 00060 #else /* real code */ 00061 #define _NOP() __asm__ __volatile__("nop") 00062 #endif /* __DOXYGEN__ */ 00063 00064 #if defined(__DOXYGEN__) 00065 /** 00066 \ingroup avr_cpufunc 00067 \def _MemoryBarrier 00068 00069 Implement a read/write <i>memory barrier</i>. A memory 00070 barrier instructs the compiler to not cache any memory data in 00071 registers beyond the barrier. This can sometimes be more effective 00072 than blocking certain optimizations by declaring some object with a 00073 \c volatile qualifier. 00074 00075 See \ref optim_code_reorder for things to be taken into account 00076 with respect to compiler optimizations. 00077 */ 00078 #define _MemoryBarrier() 00079 #else /* real code */ 00080 #define _MemoryBarrier() __asm__ __volatile__(:::"memory") 00081 #endif /* __DOXYGEN__ */ 00082 00083 #endif /* _AVR_CPUFUNC_H_ */