lpc_spi.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. #ifndef _ARCH_CM3_NXP_MACH_LPC_SPI_H_
  2. #define _ARCH_CM3_NXP_MACH_LPC_SPI_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_spi.h
  36. * \brief LPC SPI definitions
  37. *
  38. * \verbatim
  39. * $Id$
  40. * \endverbatim
  41. */
  42. /*!
  43. * \addtogroup xgNutArchArmv7mLpcSpi
  44. */
  45. /*@{*/
  46. /*! \name SPI Control Register */
  47. /*@{*/
  48. #define SPCR_OFF 0x00000000
  49. #define SPCR (LPC_SPI_BASE + SPCR_OFF)
  50. #define SPCR_EN (1 << 2)
  51. #define SPCR_CPHA (1 << 3)
  52. #define SPCR_CPOL (1 << 4)
  53. #define SPCR_MSTR (1 << 5)
  54. #define SPCR_LSBF (1 << 6)
  55. #define SPCR_SPIE (1 << 7)
  56. #define SPCR_BITS_LSB 8
  57. #define SPCR_BITS 0x00000F00
  58. #define SPCR_8BITS 0x00000800
  59. #define SPCR_9BITS 0x00000900
  60. #define SPCR_10BITS 0x00000A00
  61. #define SPCR_11BITS 0x00000B00
  62. #define SPCR_12BITS 0x00000C00
  63. #define SPCR_13BITS 0x00000D00
  64. #define SPCR_14BITS 0x00000E00
  65. #define SPCR_15BITS 0x00000F00
  66. #define SPCR_16BITS 0x00000000
  67. /*@}*/
  68. /*! \name SPI Status Register */
  69. /*@{*/
  70. #define SPSR_OFF 0x00000004
  71. #define SPSR (LPC_SPI_BASE + SPSR_OFF)
  72. #define SPSR_ABRT (1 << 3)
  73. #define SPSR_MODF (1 << 4)
  74. #define SPSR_ROVR (1 << 5)
  75. #define SPSR_WCOL (1 << 6)
  76. #define SPSR_SPIF (1 << 7)
  77. /*@}*/
  78. /*! \name SPI Data Register */
  79. /*@{*/
  80. #define SPDR_OFF 0x00000008
  81. #define SPDR (LPC_SPI_BASE + SPDR_OFF)
  82. /*@}*/
  83. /*! \name SPI Clock Counter Register */
  84. /*@{*/
  85. #define SPCCR_OFF 0x0000000C
  86. #define SPCCR (LPC_SPI_BASE + SPCCR_OFF)
  87. /*@}*/
  88. /*! \name SPI Interrupt Flag Register */
  89. /*@{*/
  90. #define SPINT_OFF 0x0000001C
  91. #define SPINT (LPC_SPI_BASE + SPINT_OFF)
  92. #define SPINT_SPIF (1 << 0)
  93. /*@}*/
  94. /*@}*/
  95. #endif