$treeview $search $mathjax $extrastylesheet
avr-libc  2.0.0
$projectbrief
$projectbrief
$searchbox

AVR Libc Home Page

AVRs

AVR Libc Development Pages

Main Page

User Manual

Library Reference

FAQ

Example Projects

cpufunc.h

Go to the documentation of this file.
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$ */
00032 
00033 /* avr/cpufunc.h - Special CPU functions */
00034 
00035 #ifndef _AVR_CPUFUNC_H_
00036 #define _AVR_CPUFUNC_H_ 1
00037 
00038 #include <stdint.h>
00039 
00040 /** \file */
00041 /** \defgroup avr_cpufunc <avr/cpufunc.h>: Special AVR CPU functions
00042     \code #include <avr/cpufunc.h> \endcode
00043 
00044     This header file contains macros that access special functions of
00045     the AVR CPU which do not fit into any of the other header files.
00046 
00047 */
00048 
00049 #if defined(__DOXYGEN__)
00050 /**
00051    \ingroup avr_cpufunc
00052    \def _NOP
00053 
00054    Execute a <i>no operation</i> (NOP) CPU instruction.  This
00055    should not be used to implement delays, better use the functions
00056    from <util/delay_basic.h> or <util/delay.h> for this.  For
00057    debugging purposes, a NOP can be useful to have an instruction that
00058    is guaranteed to be not optimized away by the compiler, so it can
00059    always become a breakpoint in the debugger.
00060 */
00061 #define _NOP()
00062 #else  /* real code */
00063 #define _NOP() __asm__ __volatile__("nop")
00064 #endif  /* __DOXYGEN__ */
00065 
00066 #if defined(__DOXYGEN__)
00067 /**
00068    \ingroup avr_cpufunc
00069    \def _MemoryBarrier
00070 
00071    Implement a read/write <i>memory barrier</i>.  A memory
00072    barrier instructs the compiler to not cache any memory data in
00073    registers beyond the barrier.  This can sometimes be more effective
00074    than blocking certain optimizations by declaring some object with a
00075    \c volatile qualifier.
00076 
00077    See \ref optim_code_reorder for things to be taken into account
00078    with respect to compiler optimizations.
00079 */
00080 #define _MemoryBarrier()
00081 #else  /* real code */
00082 #define _MemoryBarrier() __asm__ __volatile__("":::"memory")
00083 #endif  /* __DOXYGEN__ */
00084 
00085 /**
00086    \ingroup avr_cpufunc
00087 
00088    Write \a __value to Configuration Change Protected (CCP) IO register
00089    at \a __ioaddr.
00090  */
00091 void ccp_write_io (uint8_t *__ioaddr, uint8_t __value);
00092 
00093 #endif /* _AVR_CPUFUNC_H_ */
 All Data Structures Files Functions Variables Typedefs Enumerations Defines