at91_smc.h 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. #ifndef _ARCH_ARM_AT91_SMC_H_
  2. #define _ARCH_ARM_AT91_SMC_H_
  3. /*
  4. * Copyright (C) 2006 by egnite Software GmbH. All rights reserved.
  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/arm/at91_smc.h
  36. * \brief AT91 static memory controller.
  37. *
  38. * \verbatim
  39. *
  40. * $Log$
  41. * Revision 1.2 2008/02/15 17:00:08 haraldkipp
  42. * Spport for AT91SAM7SE512 added.
  43. *
  44. * Revision 1.1 2006/08/31 19:10:38 haraldkipp
  45. * New peripheral register definitions for the AT91SAM9260.
  46. *
  47. *
  48. * \endverbatim
  49. */
  50. /*!
  51. * \addtogroup xgNutArchArmAt91Smc
  52. */
  53. /*@{*/
  54. #if defined(SMC_HAS_CSR)
  55. #define SMC_CSR(cs) (SMC_BASE + cs * 0x04) /*!< \brief SMC chip select register address. */
  56. #define SMC_NWS 0x0000007F /*!< brief Number of wait states mask. */
  57. #define SMC_NWS_LSB 0 /*!< brief Number of wait states LSB. */
  58. #define SMC_WSEN 0x00000080 /*!< brief Wait state enable. */
  59. #define SMC_TDF 0x00000F00 /*!< brief Data float time mask. */
  60. #define SMC_TDF_LSB 8 /*!< brief Data float time LSB. */
  61. #define SMC_BAT 0x00001000 /*!< brief Byte access type (16 bit device = 1). */
  62. #define SMC_DBW 0x00006000 /*!< brief Data bus width. */
  63. #define SMC_DBW_16 0x00002000 /*!< brief 16-bit data bus. */
  64. #define SMC_DBW_8 0x00004000 /*!< brief 8-bit data bus. */
  65. #define SMC_DRP 0x00008000 /*!< brief Data read protocol (early read = 1). */
  66. #define SMC_ACSS 0x00030000 /*!< brief Address to chip select setup mask. */
  67. #define SMC_ACSS_LSB 16 /*!< brief Address to chip select setup LSB. */
  68. #define SMC_ACSS_STANDARD 0x00000000 /*!< brief Standard, asserted at the beginning of the access and deasserted at the end. */
  69. #define SMC_ACSS_1_CYCLE 0x00010000 /*!< brief One cycle less at the beginning and the end of the access. */
  70. #define SMC_ACSS_2_CYCLES 0x00020000 /*!< brief Two cycles less at the beginning and the end of the access. */
  71. #define SMC_ACSS_3_CYCLES 0x00030000 /*!< brief Three cycles less at the beginning and the end of the access. */
  72. #define SMC_RWSETUP 0x07000000 /*!< brief Read and write signal setup time mask. */
  73. #define SMC_RWSETUP_LSB 24 /*!< brief Read and write signal setup time LSB. */
  74. #define SMC_RWHOLD 0x70000000 /*!< brief Read and write signal hold time mask. */
  75. #define SMC_RWHOLD_LSB 28 /*!< brief Read and write signal hold time LSB. */
  76. #else /* SMC_HAS_CSR */
  77. /*! \name SMC Setup Register */
  78. /*@{*/
  79. #define SMC_SETUP(cs) (SMC_BASE + 0x10 * cs + 0x00) /*!< \brief SMC setup register address. */
  80. #define SMC_NWE_SETUP 0x0000003F /*!< \brief NWE setup length mask. */
  81. #define SMC_NWE_SETUP_LSB 0 /*!< \brief NWE setup length LSB. */
  82. #define SMC_NCS_WR_SETUP 0x00003F00 /*!< \brief NCS setup length in write access mask. */
  83. #define SMC_NCS_WR_SETUP_LSB 8 /*!< \brief NCS setup length in write access LSB. */
  84. #define SMC_NRD_SETUP 0x003F0000 /*!< \brief NRD setup length mask. */
  85. #define SMC_NRD_SETUP_LSB 16 /*!< \brief NRD setup length LSB. */
  86. #define SMC_NCS_RD_SETUP 0x3F000000 /*!< \brief NCS setup length in read access mask. */
  87. #define SMC_NCS_RD_SETUP_LSB 24 /*!< \brief NCS setup length in read access LSB. */
  88. /*@}*/
  89. /*! \name SMC Pulse Register */
  90. /*@{*/
  91. #define SMC_PULSE(cs) (SMC_BASE + 0x10 * cs + 0x04) /*!< \brief SMC pulse register address. */
  92. #define SMC_NWE_PULSE 0x0000003F /*!< \brief NWE pulse length mask. */
  93. #define SMC_NWE_PULSE_LSB 0 /*!< \brief NWE pulse length LSB. */
  94. #define SMC_NCS_WR_PULSE 0x00003F00 /*!< \brief NCS pulse length in write access mask. */
  95. #define SMC_NCS_WR_PULSE_LSB 8 /*!< \brief NCS pulse length in write access LSB. */
  96. #define SMC_NRD_PULSE 0x003F0000 /*!< \brief NRD pulse length mask. */
  97. #define SMC_NRD_PULSE_LSB 16 /*!< \brief NRD pulse length LSB. */
  98. #define SMC_NCS_RD_PULSE 0x3F000000 /*!< \brief NCS pulse length in read access mask. */
  99. #define SMC_NCS_RD_PULSE_LSB 24 /*!< \brief NCS pulse length in read access LSB. */
  100. /*@}*/
  101. /*! \name SMC Cycle Register */
  102. /*@{*/
  103. #define SMC_CYCLE(cs) (SMC_BASE + 0x10 * cs + 0x08) /*!< \brief SMC cycle register address. */
  104. #define SMC_NWE_CYCLE 0x000001FF /*!< \brief Total write cycle length mask. */
  105. #define SMC_NWE_CYCLE_LSB 0 /*!< \brief Total write cycle length LSB. */
  106. #define SMC_NRD_CYCLE 0x01FF0000 /*!< \brief Total read cycle length mask. */
  107. #define SMC_NRD_CYCLE_LSB 16 /*!< \brief Total read cycle length LSB. */
  108. /*@}*/
  109. /*! \name SMC Mode Register */
  110. /*@{*/
  111. #define SMC_MODE(cs) (SMC_BASE + 0x10 * cs + 0x0C) /*!< \brief SMC mode register address. */
  112. #define SMC_READ_MODE 0x00000001 /*!< \brief Read operation mode. */
  113. #define SMC_WRITE_MODE 0x00000002 /*!< \brief Write operation mode. */
  114. #define SMC_EXNW_MODE 0x00000030 /*!< \brief NWAIT mode mask. */
  115. #define SMC_EXNW_MODE_DISABLED 0x00000000 /*!< \brief NWAIT mode mask. */
  116. #define SMC_EXNW_MODE_FROZEN 0x00000020 /*!< \brief NWAIT mode mask. */
  117. #define SMC_EXNW_MODE_READY 0x00000030 /*!< \brief NWAIT mode mask. */
  118. #define SMC_BAT 0x00000100 /*!< \brief Byte access mode. */
  119. #define SMC_DBW 0x00003000 /*!< \brief Data bus width. */
  120. #define SMC_DBW_8 0x00000000 /*!< \brief 8-bit data bus. */
  121. #define SMC_DBW_16 0x00001000 /*!< \brief 16-bit data bus. */
  122. #define SMC_DBW_32 0x00002000 /*!< \brief 32-bit data bus. */
  123. #define SMC_TDF_CYCLES 0x000F0000 /*!< \brief Data float time mask. */
  124. #define SMC_TDF_CYCLES_LSB 16 /*!< \brief Data float time LSB. */
  125. #define SMC_TDF_MODE 0x00100000 /*!< \brief TDF optimization. */
  126. #define SMC_PMEN 0x01000000 /*!< \brief Page mode enable. */
  127. #define SMC_PS 0x30000000 /*!< \brief Page size mask. */
  128. #define SMC_PS_4 0x00000000 /*!< \brief 4-byte page. */
  129. #define SMC_PS_8 0x10000000 /*!< \brief 8-byte page. */
  130. #define SMC_PS_16 0x20000000 /*!< \brief 16-byte page. */
  131. #define SMC_PS_32 0x30000000 /*!< \brief 32-byte page. */
  132. /*@}*/
  133. #endif /* SMC_HAS_CSR */
  134. /*@} xgNutArchArmAt91Smc */
  135. #endif /* _ARCH_ARM_AT91_SMC_H_ */