Nut/OS  5.0.5
API Reference
armv4t.h
Go to the documentation of this file.
00001 #ifndef _ARCH_ARM_ARMV4T_H_
00002 #define _ARCH_ARM_ARMV4T_H_
00003 
00004 /*
00005  * Copyright 2011 by egnite GmbH
00006  *
00007  * All rights reserved.
00008  *
00009  * Redistribution and use in source and binary forms, with or without
00010  * modification, are permitted provided that the following conditions
00011  * are met:
00012  *
00013  * 1. Redistributions of source code must retain the above copyright
00014  *    notice, this list of conditions and the following disclaimer.
00015  * 2. Redistributions in binary form must reproduce the above copyright
00016  *    notice, this list of conditions and the following disclaimer in the
00017  *    documentation and/or other materials provided with the distribution.
00018  * 3. Neither the name of the copyright holders nor the names of
00019  *    contributors may be used to endorse or promote products derived
00020  *    from this software without specific prior written permission.
00021  *
00022  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00023  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00024  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00025  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00026  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00027  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00028  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
00029  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
00030  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00031  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
00032  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00033  * SUCH DAMAGE.
00034  *
00035  * For additional information see http://www.ethernut.de/
00036  */
00037 
00051 
00052 #if defined (MCU_AT91)
00053 #include <arch/arm/at91.h>
00054 #elif defined (MCU_GBA)
00055 #include <arch/arm/gba.h>
00056 #elif defined (MCU_LPC2XXX)
00057 #include <arch/arm/lpc2xxx.h>
00058 #endif
00059 
00060 #ifndef __ASSEMBLER__
00061 #include <stdint.h>
00062 #include <dev/mweeprom.h>
00063 #endif
00064 
00065 #define ARM_MODE_USER       0x10
00066 #define ARM_MODE_FIQ        0x11
00067 #define ARM_MODE_IRQ        0x12
00068 #define ARM_MODE_SVC        0x13
00069 #define ARM_MODE_ABORT      0x17
00070 #define ARM_MODE_UNDEF      0x1B
00071 #define ARM_MODE_SYS        0x1F
00072 #define ARM_MODE_MASK       0x1F
00073 
00074 #define I_BIT               0x80
00075 #define ARM_CPSR_I_BIT      0x80
00076 #define F_BIT               0x40
00077 #define ARM_CPSR_F_BIT      0x40
00078 #define T_BIT               0x20
00079 #define ARM_CPSR_T_BIT      0x20
00080 
00081 #ifndef __ASSEMBLER__
00082 #ifdef __GNUC__
00083 #define ARM_SET_CP15_CR(val) __asm__ __volatile__("mcr p15, 0, %0, c1, c0, 0" :: "r"(val) : "cc")
00084 #define ARM_GET_CP15_CR() ( \
00085     { \
00086         unsigned int val; \
00087         __asm__ __volatile__("mrc p15, 0, %0, c1, c0, 0" : "=r"(val) :: "cc"); \
00088         val; \
00089     } \
00090 )
00091 #endif /* __GNUC__ */
00092 #endif /* __ASSEMBLER__ */
00093 
00094 
00095 #endif