at91_ecc.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. #ifndef _ARCH_ARM_AT91_ECC_H_
  2. #define _ARCH_ARM_AT91_ECC_H_
  3. /*
  4. * Copyright (C) 2010 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/at91_ecc.h
  38. * \brief AT91 peripherals.
  39. *
  40. * \verbatim
  41. * $Id$
  42. * \endverbatim
  43. */
  44. /*!
  45. * \addtogroup xgNutArchArmAt91Ecc
  46. */
  47. /*@{*/
  48. /*! \name ECC Control Register */
  49. /*@{*/
  50. #define ECC_CR_OFF 0x00000000 /*!< \brief Control register offset. */
  51. #define ECC_CR (ECC_BASE + ECC_CR_OFF) /*!< \brief Control register address. */
  52. #define ECC_RST 0x00000001 /*!< \brief Reset ECC parity registers. */
  53. #define ECC_SRST 0x00000002 /*!< \brief Software reset. */
  54. /*@}*/
  55. /*! \name ECC Mode Register */
  56. /*@{*/
  57. #define ECC_MR_OFF 0x00000004 /*!< \brief Mode register offset. */
  58. #define ECC_MR (ECC_BASE + ECC_MR_OFF) /*!< \brief Mode register address. */
  59. #define ECC_PAGESIZE 0x00000003 /*!< \brief NAND flash page size mask. */
  60. #define ECC_PAGESIZE_528 0x00000000 /*!< \brief NAND flash page size is 528 words. */
  61. #define ECC_PAGESIZE_1056 0x00000001 /*!< \brief NAND flash page size is 1056 words. */
  62. #define ECC_PAGESIZE_2112 0x00000002 /*!< \brief NAND flash page size is 2112 words. */
  63. #define ECC_PAGESIZE_4224 0x00000003 /*!< \brief NAND flash page size is 4224 words. */
  64. #define ECC_TYPECORREC 0x00000030 /*!< \brief Type of correction mask. */
  65. #define ECC_TYPECORREC_0 0x00000000 /*!< \brief 1 bit correction. */
  66. #define ECC_TYPECORREC_1 0x00000010 /*!< \brief 1 bit correction for 256 data bytes. */
  67. #define ECC_TYPECORREC_2 0x00000020 /*!< \brief 1 bit correction for 512 data bytes. */
  68. /*@}*/
  69. /*! \name ECC Status Registers */
  70. /*@{*/
  71. #define ECC_SR1_OFF 0x00000008 /*!< \brief Status register 1 offset. */
  72. #define ECC_SR1 (ECC_BASE + ECC_SR1_OFF) /*!< \brief Status register 1 address. */
  73. #define ECC_SR2_OFF 0x00000014 /*!< \brief Status register 2 offset. */
  74. #define ECC_SR2 (ECC_BASE + ECC_SR2_OFF) /*!< \brief Status register 2 address. */
  75. #define ECC_RECERR(i) (1 << (i * 4)) /*!< \brief Recoverable error. */
  76. #define ECC_ECCERR(i) (2 << (i * 4)) /*!< \brief Single bit error. */
  77. #define ECC_MULERR(i) (4 << (i * 4)) /*!< \brief Multiple errors. */
  78. /*@}*/
  79. /*! \name ECC Parity Registers */
  80. /*@{*/
  81. #define ECC_PR0_OFF 0x0000000C /*!< \brief Parity register 0 offset. */
  82. #define ECC_PR0 (ECC_BASE + ECC_PR0_OFF) /*!< \brief Parity register 0 address. */
  83. #define ECC_PR1_OFF 0x00000010 /*!< \brief Parity register 1 offset. */
  84. #define ECC_PR1 (ECC_BASE + ECC_PR1_OFF) /*!< \brief Parity register 1 address. */
  85. #define ECC_PR(i) (ECC_BASE + 0x18 + (((i) - 2) * 4)) /*!< \brief Parity registers 2 to 15 address. */
  86. #define ECC_BITADDR0 0x0000000F /*!< \brief Corrupted bit offset mask. */
  87. #define ECC_BITADDR0_LSB 0 /*!< \brief Corrupted bit offset LSB. */
  88. #define ECC_BITADDR 0x00000007 /*!< \brief Corrupted bit offset mask, 8-bit word. */
  89. #define ECC_BITADDR_LSB 0 /*!< \brief Corrupted bit offset LSB, 8-bit word. */
  90. #define ECC_WORDADDR0 0x0000FFF0 /*!< \brief Corrupted bit word offset mask, type 1. */
  91. #define ECC_WORDADDR0_LSB 4 /*!< \brief Corrupted bit word offset LSB, type 1. */
  92. #define ECC_WORDADDR 0x0000FFF8 /*!< \brief Corrupted bit word offset mask. */
  93. #define ECC_WORDADDR_LSB 3 /*!< \brief Corrupted bit word offset LSB. */
  94. #define ECC_NPARITY1 0x0000FFFF /*!< \brief Parity 1 mask. */
  95. #define ECC_NPARITY1_LSB 0 /*!< \brief Parity 1 LSB. */
  96. #define ECC_NPARITY 0x00FFF000 /*!< \brief Parity mask. */
  97. #define ECC_NPARITY_LSB 12 /*!< \brief Parity LSB. */
  98. /*@}*/
  99. /*@}*/
  100. /*! \name ECC Version Register */
  101. /*@{*/
  102. #define ECC_VR_OFF 0x000000FC // (ECC_VR) ECC Version register
  103. #define ECC_VR (ECC_BASE + ECC_VR_OFF) // (ECC) ECC version register
  104. /*@} xgNutArchArmAt91Ecc */
  105. #endif