armv4t.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #ifndef _ARCH_ARM_ARMV4T_H_
  2. #define _ARCH_ARM_ARMV4T_H_
  3. /*
  4. * Copyright 2011 by egnite GmbH
  5. *
  6. * All rights reserved.
  7. *
  8. * Redistribution and use in source and binary forms, with or without
  9. * modification, are permitted provided that the following conditions
  10. * are met:
  11. *
  12. * 1. Redistributions of source code must retain the above copyright
  13. * notice, this list of conditions and the following disclaimer.
  14. * 2. Redistributions in binary form must reproduce the above copyright
  15. * notice, this list of conditions and the following disclaimer in the
  16. * documentation and/or other materials provided with the distribution.
  17. * 3. Neither the name of the copyright holders nor the names of
  18. * contributors may be used to endorse or promote products derived
  19. * from this software without specific prior written permission.
  20. *
  21. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  24. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  25. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  26. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  27. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  28. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  29. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  30. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  31. * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  32. * SUCH DAMAGE.
  33. *
  34. * For additional information see http://www.ethernut.de/
  35. */
  36. /*!
  37. * \file arch/arm/armv4t.h
  38. * \brief ARMv4T architecture definitions
  39. *
  40. * \verbatim
  41. * $Id$
  42. * \endverbatim
  43. */
  44. /*!
  45. * \addtogroup xgNutArchArmV4t
  46. */
  47. /*@{*/
  48. #if defined (MCU_AT91)
  49. #include <arch/arm/at91.h>
  50. #elif defined (MCU_GBA)
  51. #include <arch/arm/gba.h>
  52. #elif defined (MCU_LPC2XXX)
  53. #include <arch/arm/lpc2xxx.h>
  54. #endif
  55. #ifndef __ASSEMBLER__
  56. #include <stdint.h>
  57. #include <dev/mweeprom.h>
  58. #endif
  59. #define ARM_MODE_USER 0x10
  60. #define ARM_MODE_FIQ 0x11
  61. #define ARM_MODE_IRQ 0x12
  62. #define ARM_MODE_SVC 0x13
  63. #define ARM_MODE_ABORT 0x17
  64. #define ARM_MODE_UNDEF 0x1B
  65. #define ARM_MODE_SYS 0x1F
  66. #define ARM_MODE_MASK 0x1F
  67. #define I_BIT 0x80
  68. #define ARM_CPSR_I_BIT 0x80
  69. #define F_BIT 0x40
  70. #define ARM_CPSR_F_BIT 0x40
  71. #define T_BIT 0x20
  72. #define ARM_CPSR_T_BIT 0x20
  73. #ifndef __ASSEMBLER__
  74. #ifdef __GNUC__
  75. #define ARM_SET_CP15_CR(val) __asm__ __volatile__("mcr p15, 0, %0, c1, c0, 0" :: "r"(val) : "cc")
  76. #define ARM_GET_CP15_CR() ( \
  77. { \
  78. unsigned int val; \
  79. __asm__ __volatile__("mrc p15, 0, %0, c1, c0, 0" : "=r"(val) :: "cc"); \
  80. val; \
  81. } \
  82. )
  83. #endif /* __GNUC__ */
  84. #endif /* __ASSEMBLER__ */
  85. #endif