crc.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. /** @file CRC.h
  2. * @brief CRC Driver Header File
  3. * @date 29.May.2013
  4. * @version 03.05.02
  5. *
  6. * This file contains:
  7. * - Definitions
  8. * - Types
  9. * - Interface Prototypes
  10. * .
  11. * which are relevant for the CRC driver.
  12. */
  13. /* (c) Texas Instruments 2009-2013, All rights reserved. */
  14. #ifndef __CRC_H__
  15. #define __CRC_H__
  16. #include "reg_crc.h"
  17. /* USER CODE BEGIN (0) */
  18. /* USER CODE END */
  19. /* CRC General Definitions */
  20. /** @def CRCLEVEL_ACTIVE
  21. * @brief Alias name for CRC error operation level active
  22. */
  23. #define CRCLEVEL_ACTIVE 0x00U
  24. /** @def CRC_AUTO
  25. * @brief Alias name for CRC auto mode
  26. */
  27. #define CRC_AUTO 0x00000001U
  28. /** @def CRC_SEMI_CPU
  29. * @brief Alias name for semi cpu mode setting
  30. */
  31. #define CRC_SEMI_CPU 0x00000002U
  32. /** @def CRC_FULL_CPU
  33. * @brief Alias name for CRC cpu full mode
  34. */
  35. #define CRC_FULL_CPU 0x00000003U
  36. /** @def CRC_CH4_TO
  37. * @brief Alias name for channel1 time out interrupt flag
  38. */
  39. #define CRC_CH4_TO 0x10000000U
  40. /** @def CRC_CH4_UR
  41. * @brief Alias name for channel1 underrun interrupt flag
  42. */
  43. #define CRC_CH4_UR 0x08000000U
  44. /** @def CRC_CH4_OR
  45. * @brief Alias name for channel1 overrun interrupt flag
  46. */
  47. #define CRC_CH4_OR 0x04000000U
  48. /** @def CRC_CH4_FAIL
  49. * @brief Alias name for channel1 crc fail interrupt flag
  50. */
  51. #define CRC_CH4_FAIL 0x02000000U
  52. /** @def CRC_CH4_CC
  53. * @brief Alias name for channel1 compression complete interrupt flag
  54. */
  55. #define CRC_CH4_CC 0x01000000U
  56. /** @def CRC_CH3_TO
  57. * @brief Alias name for channel2 time out interrupt flag
  58. */
  59. #define CRC_CH3_TO 0x00100000U
  60. /** @def CRC_CH3_UR
  61. * @brief Alias name for channel2 underrun interrupt flag
  62. */
  63. #define CRC_CH3_UR 0x00080000U
  64. /** @def CRC_CH3_OR
  65. * @brief Alias name for channel2 overrun interrupt flag
  66. */
  67. #define CRC_CH3_OR 0x00040000U
  68. /** @def CRC_CH3_FAIL
  69. * @brief Alias name for channel2 crc fail interrupt flag
  70. */
  71. #define CRC_CH3_FAIL 0x00020000U
  72. /** @def CRC_CH3_CC
  73. * @brief Alias name for channel2 compression complete interrupt flag
  74. */
  75. #define CRC_CH3_CC 0x00010000U
  76. /** @def CRC_CH2_TO
  77. * @brief Alias name for channel3 time out interrupt flag
  78. */
  79. #define CRC_CH2_TO 0x00001000U
  80. /** @def CRC_CH2_UR
  81. * @brief Alias name for channel3 underrun interrupt flag
  82. */
  83. #define CRC_CH2_UR 0x00000800U
  84. /** @def CRC_CH2_OR
  85. * @brief Alias name for channel3 overrun interrupt flag
  86. */
  87. #define CRC_CH2_OR 0x00000400U
  88. /** @def CRC_CH2_FAIL
  89. * @brief Alias name for channel3 crc fail interrupt flag
  90. */
  91. #define CRC_CH2_FAIL 0x00000200U
  92. /** @def CRC_CH2_CC
  93. * @brief Alias name for channel3 compression complete interrupt flag
  94. */
  95. #define CRC_CH2_CC 0x00000100U
  96. /** @def CRC_CH1_TO
  97. * @brief Alias name for channel4 time out interrupt flag
  98. */
  99. #define CRC_CH1_TO 0x00000010U
  100. /** @def CRC_CH1_UR
  101. * @brief Alias name for channel4 underrun interrupt flag
  102. */
  103. #define CRC_CH1_UR 0x00000008U
  104. /** @def CRC_CH1_OR
  105. * @brief Alias name for channel4 overrun interrupt flag
  106. */
  107. #define CRC_CH1_OR 0x00000004U
  108. /** @def CRC_CH1_FAIL
  109. * @brief Alias name for channel4 crc fail interrupt flag
  110. */
  111. #define CRC_CH1_FAIL 0x00000002U
  112. /** @def CRC_CH1_CC
  113. * @brief Alias name for channel4 compression complete interrupt flag
  114. */
  115. #define CRC_CH1_CC 0x00000001U
  116. /** @struct crcModConfig
  117. * @brief CRC mode specific parameters
  118. *
  119. * This type is used to pass crc mode specific parameters
  120. */
  121. /** @typedef crcModConfig_t
  122. * @brief CRC Data Type Definition
  123. */
  124. typedef struct crcModConfig
  125. {
  126. uint32 mode; /**< Mode of operation */
  127. uint32 crc_channel; /**< CRC channel-0,1 */
  128. uint32 * src_data_pat; /**< Pattern data */
  129. uint32 data_length; /**< Pattern data length.Number of 64 bit size word*/
  130. } crcModConfig_t;
  131. /** @struct crcConfig
  132. * @brief CRC configuration for different modes
  133. *
  134. * This type is used to pass crc configuration
  135. */
  136. /** @typedef crcConfig_t
  137. * @brief CRC Data Type Definition
  138. */
  139. typedef struct crcConfig
  140. {
  141. uint32 crc_channel; /**< CRC channel-0,1 */
  142. uint32 mode; /**< Mode of operation */
  143. uint32 pcount; /**< Pattern count*/
  144. uint32 scount; /**< Sector count */
  145. uint32 wdg_preload; /**< Watchdog period */
  146. uint32 block_preload; /**< Block period*/
  147. } crcConfig_t;
  148. /* USER CODE BEGIN (1) */
  149. /* USER CODE END */
  150. /**
  151. * @defgroup CRC CRC
  152. * @brief Cyclic Redundancy Check Controller Module.
  153. *
  154. * The CRC controller is a module that is used to perform CRC (Cyclic Redundancy Check) to verify the
  155. * integrity of memory system. A signature representing the contents of the memory is obtained when the
  156. * contents of the memory are read into CRC controller. The responsibility of CRC controller is to calculate
  157. * the signature for a set of data and then compare the calculated signature value against a pre-determined
  158. * good signature value. CRC controller supports two channels to perform CRC calculation on multiple
  159. * memories in parallel and can be used on any memory system.
  160. *
  161. * Related Files
  162. * - reg_crc.h
  163. * - crc.h
  164. * - crc.c
  165. * @addtogroup CRC
  166. * @{
  167. */
  168. /* CRC Interface Functions */
  169. void crcInit(void);
  170. void crcSendPowerDown(crcBASE_t *crc);
  171. void crcSignGen(crcBASE_t *crc,crcModConfig_t *param);
  172. void crcSetConfig(crcBASE_t *crc,crcConfig_t *param);
  173. uint64 crcGetSectorSig(crcBASE_t *crc,uint32 channel);
  174. uint32 crcGetFailedSector(crcBASE_t *crc,uint32 channel);
  175. uint32 crcGetIntrPend(crcBASE_t *crc,uint32 channel);
  176. void crcChannelReset(crcBASE_t *crc,uint32 channel);
  177. void crcEnableNotification(crcBASE_t *crc, uint32 flags);
  178. void crcDisableNotification(crcBASE_t *crc, uint32 flags);
  179. /** @fn void crcNotification(crcBASE_t *crc, uint32 flags)
  180. * @brief Interrupt callback
  181. * @param[in] crc - crc module base address
  182. * @param[in] flags - copy of error interrupt flags
  183. *
  184. * This is a callback that is provided by the application and is called upon
  185. * an interrupt. The parameter passed to the callback is a copy of the
  186. * interrupt flag register.
  187. */
  188. void crcNotification(crcBASE_t *crc, uint32 flags);
  189. /**@}*/
  190. /* USER CODE BEGIN (2) */
  191. /* USER CODE END */
  192. #endif