elm.h 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. /**
  2. * \file elm.h
  3. *
  4. * \brief Definitions used for ELM
  5. *
  6. * This file contains the driver API prototypes and macro definitions.
  7. */
  8. /*
  9. * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
  10. */
  11. /*
  12. * Redistribution and use in source and binary forms, with or without
  13. * modification, are permitted provided that the following conditions
  14. * are met:
  15. *
  16. * Redistributions of source code must retain the above copyright
  17. * notice, this list of conditions and the following disclaimer.
  18. *
  19. * Redistributions in binary form must reproduce the above copyright
  20. * notice, this list of conditions and the following disclaimer in the
  21. * documentation and/or other materials provided with the
  22. * distribution.
  23. *
  24. * Neither the name of Texas Instruments Incorporated nor the names of
  25. * its contributors may be used to endorse or promote products derived
  26. * from this software without specific prior written permission.
  27. *
  28. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  29. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  30. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  31. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  32. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  33. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  34. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  35. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  36. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  37. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  38. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  39. *
  40. */
  41. #ifndef _ELM_H_
  42. #define _ELM_H__
  43. #include "hw_elm.h"
  44. #ifdef __cplusplus
  45. extern "C" {
  46. #endif
  47. /*******************************************************************************
  48. * MACRO DEFINITIONS
  49. *******************************************************************************/
  50. /*****************************************************************************/
  51. /*
  52. ** Macros which can be used as 'configVal' parameter to ELMCAutoGatingConfig API
  53. **
  54. */
  55. #define ELM_AUTOGATING_OCP_FREE (0)
  56. #define ELM_AUTOGATING_OCP_GATING (1)
  57. /*
  58. ** Macros which can be used as 'configVal' parameter to ELMCIdleModeSelect API.
  59. **
  60. */
  61. #define ELM_IDLEMODE_FORCEIDLE (0)
  62. #define ELM_IDLEMODE_NOIDLE (1)
  63. #define ELM_IDLEMODE_SMARTIDLE (2)
  64. /*
  65. ** Macros which can be used as 'configVal' parameter to ELMOCPClkActivityConfig
  66. ** API.
  67. **
  68. */
  69. #define ELM_CLOCKACTIVITYOCP_OCP_ON (1)
  70. #define ELM_CLOCKACTIVITYOCP_OCP_OFF (0)
  71. /*
  72. ** Macros which can be used as 'flag' parameter to ELMIntStatusGet API.
  73. **
  74. */
  75. #define ELM_LOC_VALID_0_STATUS (0)
  76. #define ELM_LOC_VALID_1_STATUS (1)
  77. #define ELM_LOC_VALID_2_STATUS (2)
  78. #define ELM_LOC_VALID_3_STATUS (3)
  79. #define ELM_LOC_VALID_4_STATUS (4)
  80. #define ELM_LOC_VALID_5_STATUS (5)
  81. #define ELM_LOC_VALID_6_STATUS (6)
  82. #define ELM_LOC_VALID_7_STATUS (7)
  83. #define ELM_PAGE_VALID_STATUS (8)
  84. /*
  85. ** Macros which can be used as 'flag' parameter to ELMIntConfig API.
  86. **
  87. */
  88. #define ELM_INT_ENALBLE (1)
  89. #define ELM_INT_DISALBLE (0)
  90. /*
  91. ** Macros which can be used as 'bchECCLevel' parameter to
  92. ** ELMErrCorrectionLevelSet API.
  93. **
  94. */
  95. #define ELM_ECC_BCH_LEVEL_4BITS (0)
  96. #define ELM_ECC_BCH_LEVEL_8BITS (1)
  97. #define ELM_ECC_BCH_LEVEL_16BITS (2)
  98. /*
  99. ** Macros which can be used as 'mode' parameter to ELMModeSet API.
  100. **
  101. */
  102. #define ELM_MODE_CONTINUOUS (0)
  103. #define ELM_MODE_PAGE (1)
  104. /*
  105. ** Macros which can be used as 'sectorNum' parameter to ELMModeSet API.
  106. **
  107. */
  108. #define ELM_PAGEMODE_SECTOR_0 (0)
  109. #define ELM_PAGEMODE_SECTOR_1 (1)
  110. #define ELM_PAGEMODE_SECTOR_2 (2)
  111. #define ELM_PAGEMODE_SECTOR_3 (3)
  112. #define ELM_PAGEMODE_SECTOR_4 (4)
  113. #define ELM_PAGEMODE_SECTOR_5 (5)
  114. #define ELM_PAGEMODE_SECTOR_6 (6)
  115. #define ELM_PAGEMODE_SECTOR_7 (7)
  116. /*
  117. ** Macros which can be used as 'synFrgmtId' parameter to ELMSyndromeFrgmtSet API
  118. **
  119. */
  120. #define ELM_SYNDROME_FRGMT_0 (0)
  121. #define ELM_SYNDROME_FRGMT_1 (1)
  122. #define ELM_SYNDROME_FRGMT_2 (2)
  123. #define ELM_SYNDROME_FRGMT_3 (3)
  124. #define ELM_SYNDROME_FRGMT_4 (4)
  125. #define ELM_SYNDROME_FRGMT_5 (5)
  126. #define ELM_SYNDROME_FRGMT_6 (6)
  127. /*
  128. ** Macros which can be used as 'errNum' parameter to ELMErrLocBitAddrGet API.
  129. **
  130. */
  131. #define ELM_ERROR_NUM_0 (0)
  132. #define ELM_ERROR_NUM_1 (1)
  133. #define ELM_ERROR_NUM_2 (2)
  134. #define ELM_ERROR_NUM_3 (3)
  135. #define ELM_ERROR_NUM_4 (4)
  136. #define ELM_ERROR_NUM_5 (5)
  137. #define ELM_ERROR_NUM_6 (6)
  138. #define ELM_ERROR_NUM_7 (7)
  139. #define ELM_ERROR_NUM_8 (8)
  140. #define ELM_ERROR_NUM_9 (9)
  141. #define ELM_ERROR_NUM_10 (10)
  142. #define ELM_ERROR_NUM_11 (11)
  143. #define ELM_ERROR_NUM_12 (12)
  144. #define ELM_ERROR_NUM_13 (13)
  145. #define ELM_ERROR_NUM_14 (14)
  146. #define ELM_ERROR_NUM_15 (15)
  147. /*****************************************************************************
  148. ** FUNCTION PROTOTYPES
  149. *****************************************************************************/
  150. extern void ELMModuleReset(unsigned int baseAddr);
  151. extern unsigned int ELMRevisionGet(unsigned int baseAddr);
  152. extern unsigned int ELMNumOfErrsGet(unsigned int baseAddr);
  153. extern void ELMErrLocProcessingStart(unsigned int baseAddr);
  154. extern unsigned int ELMModuleResetStatusGet(unsigned int baseAddr);
  155. extern unsigned int ELMErrLocProcessingStatusGet(unsigned int baseAddr);
  156. extern void ELMECCSizeSet(unsigned int baseAddr, unsigned int eccSize);
  157. extern void ELMIntStatusClear(unsigned int baseAddr, unsigned int flag);
  158. extern void GPMCIntStatusClear(unsigned int baseAddr, unsigned int flag);
  159. extern void ELMCIdleModeSelect(unsigned int baseAddr, unsigned int mode);
  160. extern unsigned int ELMIntStatusGet(unsigned int baseAddr, unsigned int flag);
  161. extern void ELMCAutoGatingConfig(unsigned int baseAddr,
  162. unsigned int configVal);
  163. extern unsigned int ELMErrLocBitAddrGet(unsigned int baseAddr,
  164. unsigned int errNum);
  165. extern void ELMOCPClkActivityConfig(unsigned int baseAddr,
  166. unsigned int configVal);
  167. extern void ELMErrCorrectionLevelSet(unsigned int baseAddr,
  168. unsigned int bchECCLevel);
  169. extern void ELMModeSet(unsigned int baseAddr, unsigned int mode,
  170. unsigned int sectorNum);
  171. extern void ELMIntConfig(unsigned int baseAddr, unsigned int intFlag,
  172. unsigned int configVal);
  173. extern void ELMSyndromeFrgmtSet(unsigned int baseAddr, unsigned int synFrgmtId,
  174. unsigned int synFrgmtVal);
  175. #ifdef __cplusplus
  176. }
  177. #endif
  178. #endif