lpc_ssp.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. #ifndef _ARCH_CM3_NXP_MACH_LPC_SSP_H_
  2. #define _ARCH_CM3_NXP_MACH_LPC_SSP_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_ssp.h
  36. * \brief LPC SSP definitions
  37. *
  38. * \verbatim
  39. * $Id$
  40. * \endverbatim
  41. */
  42. /*!
  43. * \addtogroup xgNutArchArmv7mLpcSsp
  44. */
  45. /*@{*/
  46. /*! \name SSP Control Register 0 */
  47. /*@{*/
  48. #define SSP_CR0_OFF 0x00000000
  49. #define SSP_CR0_DSS_MSK 0x0000000F
  50. #define SSP_CR0_DSS_LSB 0
  51. #define SSP_CR0_DSS(n) (((n) - 1) << SSP_CR0_DSS_LSB)
  52. #define SSP_CR0_FRF_MSK 0x00000030
  53. #define SSP_CR0_FRF_SPI 0x00000000
  54. #define SSP_CR0_FRF_TI 0x00000010
  55. #define SSP_CR0_FRF_MW 0x00000020
  56. #define SSP_CR0_CPOL 0x00000040
  57. #define SSP_CR0_CPHA 0x00000080
  58. #define SSP_CR0_SPI_MODE0 0
  59. #define SSP_CR0_SPI_MODE1 SSP_CR0_CPHA
  60. #define SSP_CR0_SPI_MODE2 SSP_CR0_CPOL
  61. #define SSP_CR0_SPI_MODE3 (SSP_CR0_CPOL | SSP_CR0_CPHA)
  62. #define SSP_CR0_SCR_MSK 0x0000FF00
  63. #define SSP_CR0_SCR_LSB 8
  64. /*@}*/
  65. /*! \name SSP Control Register 1 */
  66. /*@{*/
  67. #define SSP_CR1_OFF 0x00000004
  68. #define SSP_CR1_LBM 0x00000001
  69. #define SSP_CR1_SSE 0x00000002
  70. #define SSP_CR1_MS 0x00000004
  71. #define SSP_CR1_SOD 0x00000008
  72. /*@}*/
  73. /*! \name SSP Data Register */
  74. /*@{*/
  75. #define SSP_DR_OFF 0x00000008
  76. /*@}*/
  77. /*! \name SSP Status Register */
  78. /*@{*/
  79. #define SSP_SR_OFF 0x0000000C
  80. #define SSP_SR_TFE 0x00000001
  81. #define SSP_SR_TNF 0x00000002
  82. #define SSP_SR_RNE 0x00000004
  83. #define SSP_SR_RFF 0x00000008
  84. #define SSP_SR_BSY 0x00000010
  85. /*@}*/
  86. /*! \name SSP Clock Prescale Register */
  87. /*@{*/
  88. #define SSP_CPSR_OFF 0x00000010
  89. /*@}*/
  90. /*! \name SSP Interrupt Registers */
  91. /*@{*/
  92. #define SSP_IMSC_OFF 0x00000014
  93. #define SSP_RIS_OFF 0x00000018
  94. #define SSP_MIS_OFF 0x0000001C
  95. #define SSP_ICR_OFF 0x00000020
  96. #define SSP_RORI 0x00000001
  97. #define SSP_RTI 0x00000002
  98. #define SSP_RXI 0x00000004
  99. #define SSP_TXI 0x00000008
  100. /*@}*/
  101. /*! \name SSP DMA Control Register */
  102. /*@{*/
  103. #define SSP_DMACR_OFF 0x00000024
  104. #define SSP_RXDMAE 0x00000001
  105. #define SSP_TXDMAE 0x00000002
  106. /*@}*/
  107. /*! \name SSP0 Register Addresses */
  108. /*@{*/
  109. #ifdef LPC_SSP0_BASE
  110. #define SSP0CR0 (LPC_SSP0_BASE + SSP_CR0_OFF)
  111. #define SSP0CR1 (LPC_SSP0_BASE + SSP_CR1_OFF)
  112. #define SSP0DR (LPC_SSP0_BASE + SSP_DR_OFF)
  113. #define SSP0SR (LPC_SSP0_BASE + SSP_SR_OFF)
  114. #define SSP0CPSR (LPC_SSP0_BASE + SSP_CPSR_OFF)
  115. #define SSP0IMSC (LPC_SSP0_BASE + SSP_IMSC_OFF)
  116. #define SSP0RIS (LPC_SSP0_BASE + SSP_RIS_OFF)
  117. #define SSP0MIS (LPC_SSP0_BASE + SSP_MIS_OFF)
  118. #define SSP0ICR (LPC_SSP0_BASE + SSP_ICR_OFF)
  119. #define SSP0DMACR (LPC_SSP0_BASE + SSP_DMACR_OFF)
  120. #endif
  121. /*! \name SSP0 Register Addresses */
  122. /*@{*/
  123. #ifdef LPC_SSP1_BASE
  124. #define SSP1CR0 (LPC_SSP1_BASE + SSP_CR0_OFF)
  125. #define SSP1CR1 (LPC_SSP1_BASE + SSP_CR1_OFF)
  126. #define SSP1DR (LPC_SSP1_BASE + SSP_DR_OFF)
  127. #define SSP1SR (LPC_SSP1_BASE + SSP_SR_OFF)
  128. #define SSP1CPSR (LPC_SSP1_BASE + SSP_CPSR_OFF)
  129. #define SSP1IMSC (LPC_SSP1_BASE + SSP_IMSC_OFF)
  130. #define SSP1RIS (LPC_SSP1_BASE + SSP_RIS_OFF)
  131. #define SSP1MIS (LPC_SSP1_BASE + SSP_MIS_OFF)
  132. #define SSP1ICR (LPC_SSP1_BASE + SSP_ICR_OFF)
  133. #define SSP1DMACR (LPC_SSP1_BASE + SSP_DMACR_OFF)
  134. #endif
  135. /*@}*/
  136. #endif