gcc.h

Go to the documentation of this file.
00001 #ifndef _ARCH_AVR_GCC_H_
00002 #define _ARCH_AVR_GCC_H_
00003 
00004 /*
00005  * Copyright (C) 2001-2005 by egnite Software GmbH. All rights reserved.
00006  *
00007  * Redistribution and use in source and binary forms, with or without
00008  * modification, are permitted provided that the following conditions
00009  * are met:
00010  *
00011  * 1. Redistributions of source code must retain the above copyright
00012  *    notice, this list of conditions and the following disclaimer.
00013  * 2. Redistributions in binary form must reproduce the above copyright
00014  *    notice, this list of conditions and the following disclaimer in the
00015  *    documentation and/or other materials provided with the distribution.
00016  * 3. Neither the name of the copyright holders nor the names of
00017  *    contributors may be used to endorse or promote products derived
00018  *    from this software without specific prior written permission.
00019  *
00020  * THIS SOFTWARE IS PROVIDED BY EGNITE SOFTWARE GMBH AND CONTRIBUTORS
00021  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00022  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00023  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL EGNITE
00024  * SOFTWARE GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00025  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00026  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
00027  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
00028  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00029  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
00030  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00031  * SUCH DAMAGE.
00032  *
00033  * For additional information see http://www.ethernut.de/
00034  */
00035 
00036 /*
00037  * $Log: gcc.h,v $
00038  * Revision 1.3  2007/04/12 09:20:34  haraldkipp
00039  * Added new register bit names for the ATmega2561.
00040  *
00041  * Revision 1.2  2006/01/11 08:32:21  hwmaier
00042  * Support for avr-libc >= 1.4.x
00043  *
00044  * Revision 1.1  2005/10/24 10:46:05  haraldkipp
00045  * First check in.
00046  * Contents taken from avr.h in the parent directory.
00047  *
00048  */
00049 
00050 
00051 /* ================================================================ */
00052 /* To be sorted out.                                                */
00053 /* ================================================================ */
00054 
00055 
00056 #define CONST   const
00057 #define INLINE  inline
00058 
00059 
00060 #include <avr/io.h>
00061 #include <avr/interrupt.h>
00062 #if __AVR_LIBC_VERSION__ < 10400UL
00063 #include <avr/signal.h>
00064 #endif
00065 #include <avr/eeprom.h>
00066 #include <avr/pgmspace.h>
00067 #include <avr/sleep.h>
00068 #include <stdlib.h>
00069 
00070 
00071 /*
00072  * test for a macro added in avr-libc 1.2.0, if yes use different path for twi.h
00073  * note: has to be after #include <eeprom.h>
00074  */
00075 #ifdef eeprom_rb
00076 #include <avr/twi.h>
00077 #else
00078 #include <compat/twi.h>
00079 #endif
00080 
00081 #if defined(__AVR_ATmega2561__)
00082 #if !defined(TXC)
00083 #define TXC     TXC0
00084 #endif
00085 #if !defined(TXB8)
00086 #define TXB8     TXB80
00087 #endif
00088 #if !defined(UMSEL)
00089 #define UMSEL     UMSEL00
00090 #endif
00091 #if !defined(U2X)
00092 #define U2X     U2X0
00093 #endif
00094 #if !defined(UCSZ0)
00095 #define UCSZ0     UCSZ00
00096 #endif
00097 #if !defined(UCSZ1)
00098 #define UCSZ1     UCSZ01
00099 #endif
00100 #if !defined(UCSZ2)
00101 #define UCSZ2     UCSZ02
00102 #endif
00103 #if !defined(UPM0)
00104 #define UPM0     UPM00
00105 #endif
00106 #if !defined(UPM1)
00107 #define UPM1     UPM01
00108 #endif
00109 
00110 #if !defined(USBS)
00111 #define USBS     USBS0
00112 #endif
00113 #if !defined(UPE)
00114 #define UPE     UPE0
00115 #endif
00116 #if !defined(MPCM)
00117 #define MPCM     MPCM0
00118 #endif
00119 #if !defined(UCPOL)
00120 #define UCPOL     UCPOL0
00121 #endif
00122 #endif
00123 
00124 #ifndef __SFR_OFFSET
00125 #define __SFR_OFFSET    0
00126 #endif
00127 
00128 #define COMPRESS_DISABLE
00129 #define COMPRESS_REENABLE
00130 
00131 #ifndef _NOP
00132 #define _NOP() __asm__ __volatile__ ("nop")
00133 #endif
00134 
00135 #ifndef atof
00136 #define atof(s)     strtod(s, 0)
00137 #endif
00138 
00139 #define EEPROMReadBytes(addr, ptr, size)    eeprom_read_block((char *)(addr), ptr, size)
00140 
00143 #define EEPROM_READ(addr, dst)          eeprom_read_block((char *)(addr), &dst, sizeof(dst))
00144 #define EEPROMread(addr)            eeprom_read_byte((char *)(addr))
00145 
00149 #define EEPROM_WRITE(addr, src)                         \
00150 {                                       \
00151     unsigned short __i;                             \
00152     for(__i = 0; __i < sizeof(src); __i++)                  \
00153     eeprom_write_byte(((char *)(addr)) + __i, *(((char *)(&(src))) + __i)); \
00154 }
00155 
00156 #define EEPROMWriteBytes(addr, ptr, size)                   \
00157 {                                       \
00158     unsigned short __i;                             \
00159     for(__i = 0; __i < size; __i++)                     \
00160     eeprom_write_byte(((char *)(addr)) + __i, *(((char *)(ptr)) + __i));    \
00161 }
00162 
00163 #define main    NutAppMain
00164 
00165 #endif /* _ARCH_AVR_GCC_H_ */
00166 

© 2000-2007 by egnite Software GmbH - visit http://www.ethernut.de/