avr32.h

Go to the documentation of this file.
00001 #ifndef _ARCH_AVR32_H_
00002 #define _ARCH_AVR32_H_
00003 
00004 /*
00005 * Copyright (C) 2001-2006 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: avr32.h,v $
00038 *
00039 */
00040 
00041 #include <cfg/arch.h>
00042 
00043 /* AVR32 is big endian core */
00044 #if !defined(__BIG_ENDIAN__)
00045 #define __BIG_ENDIAN__
00046 #endif
00047 
00048 #ifdef __GNUC__
00049 # define CONST      const
00050 # define INLINE     inline
00051 #else
00052 # ifndef CONST
00053 #  define CONST      const
00054 # endif
00055 # ifndef INLINE
00056 #  define INLINE
00057 # endif
00058 #endif
00059 
00060 #define PSTR(p)    (p)
00061 #define PRG_RDB(p) (*((const char *)(p)))
00062 
00063 #define prog_char  const char
00064 #define PGM_P      prog_char *
00065 
00066 #define SIGNAL(x)  __attribute__((__interrupt__)) void x(void)
00067 #define RAMFUNC __attribute__ ((long_call, section (".ramfunc")))
00068 
00069 /* -------------------------------------------------------------------------
00070 * redefine main
00071 * ------------------------------------------------------------------------- */
00072 #if !defined(__cplusplus)
00073 # define main       NutAppMain
00074 #endif
00075 
00076 #define strlen_P(x)             strlen((char *)(x))
00077 #define strcpy_P(x,y)           strcpy(x,(char *)(y))
00078 
00079 #define strcmp_P(x, y)          strcmp((char *)(x), (char *)(y))
00080 #define memcpy_P(x, y, z)       memcpy(x, y, z)
00081 
00082 #ifndef __ASSEMBLER__
00083 
00086 extern void *__bss_end;
00087 
00088 #endif
00089 
00090 #ifndef _NOP
00091 # ifdef __GNUC__
00092 #  define _NOP() __asm__ __volatile__ ("nop")
00093 # else
00094 #  define _NOP() asm("nop")
00095 # endif
00096 #endif
00097 
00098 #define outb(_reg, _val)  (*((volatile unsigned char *)(_reg)) = (_val))
00099 #define outw(_reg, _val)  (*((volatile unsigned short *)(_reg)) = (_val))
00100 #define outr(_reg, _val)  (*((volatile unsigned long *)(_reg)) = (_val))
00101 
00102 #define inb(_reg)   (*((volatile unsigned char *)(_reg)))
00103 #define inw(_reg)   (*((volatile unsigned short *)(_reg)))
00104 #define inr(_reg)   (*((volatile unsigned long *)(_reg)))
00105 
00106 #define _BV(bit)    (1 << (bit))
00107 
00108 #ifdef __IMAGECRAFT__
00109 # define __attribute__(x)
00110 #endif
00111 
00112 #define _SFR_MEM8(addr)     (addr)
00113 #define _SFR_MEM16(addr)    (addr)
00114 
00122 #if __GNUC__
00123 # define Get_system_register(sysreg)         __builtin_mfsr(sysreg)
00124 #elif __ICCAVR32__
00125 # define Get_system_register(sysreg)         __get_system_register(sysreg)
00126 #endif
00127 
00134 #if __GNUC__
00135 # define Set_system_register(sysreg, value)  __builtin_mtsr(sysreg, value)
00136 #elif __ICCAVR32__
00137 # define Set_system_register(sysreg, value)  __set_system_register(sysreg, value)
00138 #endif
00139 
00140 
00141 #endif // _ARCH_AVR32_H_

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