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