lpc_gpio.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. #ifndef _ARCH_CM3_NXP_MACH_LPC_GPIO_H_
  2. #define _ARCH_CM3_NXP_MACH_LPC_GPIO_H_
  3. /*
  4. * Copyright 2011 by egnite GmbH
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions
  8. * are met:
  9. *
  10. * 1. Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. * 2. Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in the
  14. * documentation and/or other materials provided with the distribution.
  15. * 3. Neither the name of the copyright holders nor the names of
  16. * contributors may be used to endorse or promote products derived
  17. * from this software without specific prior written permission.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  20. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  21. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  22. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  23. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  24. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  25. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  26. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  27. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  28. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  29. * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  30. * SUCH DAMAGE.
  31. *
  32. * For additional information see http://www.ethernut.de/
  33. */
  34. /*!
  35. * \file arch/cm3/nxp/mach/lpc_gpio.h
  36. * \brief LPC GPIO definitions
  37. *
  38. * \verbatim
  39. * $Id$
  40. * \endverbatim
  41. */
  42. /*!
  43. * \addtogroup xgNutArchArmv7mLpcGpio
  44. */
  45. /*@{*/
  46. /*! \name Fast GPIO Port Register Offsets */
  47. /*@{*/
  48. #define FIO_DIR_OFF 0x00000000 /*!< Direction control register offset. */
  49. #define FIO_MASK_OFF 0x00000010 /*!< Mask register offset. */
  50. #define FIO_PIN_OFF 0x00000014 /*!< Pin value register offset. */
  51. #define FIO_SET_OFF 0x00000018 /*!< Set register offset. */
  52. #define FIO_CLR_OFF 0x0000001C /*!< Clear register offset. */
  53. /*@{*/
  54. /*! \name GPIO0 Register Addresses */
  55. /*@{*/
  56. #ifdef LPC_GPIO0_BASE
  57. #define FIO0DIR (LPC_GPIO0_BASE + FIO_DIR_OFF)
  58. #define FIO0MASK (LPC_GPIO0_BASE + FIO_MASK_OFF)
  59. #define FIO0PIN (LPC_GPIO0_BASE + FIO_PIN_OFF)
  60. #define FIO0SET (LPC_GPIO0_BASE + FIO_SET_OFF)
  61. #define FIO0CLR (LPC_GPIO0_BASE + FIO_CLR_OFF)
  62. #endif
  63. /*@}*/
  64. /*! \name GPIO1 Register Addresses */
  65. /*@{*/
  66. #ifdef LPC_GPIO1_BASE
  67. #define FIO1DIR (LPC_GPIO1_BASE + FIO_DIR_OFF)
  68. #define FIO1MASK (LPC_GPIO1_BASE + FIO_MASK_OFF)
  69. #define FIO1PIN (LPC_GPIO1_BASE + FIO_PIN_OFF)
  70. #define FIO1SET (LPC_GPIO1_BASE + FIO_SET_OFF)
  71. #define FIO1CLR (LPC_GPIO1_BASE + FIO_CLR_OFF)
  72. #endif
  73. /*@}*/
  74. /*! \name GPIO2 Register Addresses */
  75. /*@{*/
  76. #ifdef LPC_GPIO2_BASE
  77. #define FIO2DIR (LPC_GPIO2_BASE + FIO_DIR_OFF)
  78. #define FIO2MASK (LPC_GPIO2_BASE + FIO_MASK_OFF)
  79. #define FIO2PIN (LPC_GPIO2_BASE + FIO_PIN_OFF)
  80. #define FIO2SET (LPC_GPIO2_BASE + FIO_SET_OFF)
  81. #define FIO2CLR (LPC_GPIO2_BASE + FIO_CLR_OFF)
  82. #endif
  83. /*@}*/
  84. /*! \name GPIO3 Register Addresses */
  85. /*@{*/
  86. #ifdef LPC_GPIO3_BASE
  87. #define FIO3DIR (LPC_GPIO3_BASE + FIO_DIR_OFF)
  88. #define FIO3MASK (LPC_GPIO3_BASE + FIO_MASK_OFF)
  89. #define FIO3PIN (LPC_GPIO3_BASE + FIO_PIN_OFF)
  90. #define FIO3SET (LPC_GPIO3_BASE + FIO_SET_OFF)
  91. #define FIO3CLR (LPC_GPIO3_BASE + FIO_CLR_OFF)
  92. #endif
  93. /*@}*/
  94. /*! \name GPIO4 Register Addresses */
  95. /*@{*/
  96. #ifdef LPC_GPIO4_BASE
  97. #define FIO4DIR (LPC_GPIO4_BASE + FIO_DIR_OFF)
  98. #define FIO4MASK (LPC_GPIO4_BASE + FIO_MASK_OFF)
  99. #define FIO4PIN (LPC_GPIO4_BASE + FIO_PIN_OFF)
  100. #define FIO4SET (LPC_GPIO4_BASE + FIO_SET_OFF)
  101. #define FIO4CLR (LPC_GPIO4_BASE + FIO_CLR_OFF)
  102. #endif
  103. /*@}*/
  104. #ifdef LPC_GPIOINT_BASE
  105. #define GPIO_IER_OFF 0x00000010
  106. #define GPIO_IFR_OFF 0x00000014
  107. #define GPIO_ISR_OFF 0x00000004
  108. #define GPIO_ISF_OFF 0x00000008
  109. #define GPIO_IC_OFF 0x0000000C
  110. #define GPIO_IS_OFF 0x00000000
  111. #endif
  112. /*@}*/
  113. #endif