提交 | 用户 | age
|
483170
|
1 |
/** |
Q |
2 |
****************************************************************************** |
|
3 |
* @file stm32f0xx_ll_crc.h |
|
4 |
* @author MCD Application Team |
|
5 |
* @brief Header file of CRC LL module. |
|
6 |
****************************************************************************** |
|
7 |
* @attention |
|
8 |
* |
|
9 |
* <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> |
|
10 |
* |
|
11 |
* Redistribution and use in source and binary forms, with or without modification, |
|
12 |
* are permitted provided that the following conditions are met: |
|
13 |
* 1. Redistributions of source code must retain the above copyright notice, |
|
14 |
* this list of conditions and the following disclaimer. |
|
15 |
* 2. Redistributions in binary form must reproduce the above copyright notice, |
|
16 |
* this list of conditions and the following disclaimer in the documentation |
|
17 |
* and/or other materials provided with the distribution. |
|
18 |
* 3. Neither the name of STMicroelectronics nor the names of its contributors |
|
19 |
* may be used to endorse or promote products derived from this software |
|
20 |
* without specific prior written permission. |
|
21 |
* |
|
22 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
|
23 |
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
|
24 |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
|
25 |
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
|
26 |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
|
27 |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
|
28 |
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
|
29 |
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
|
30 |
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|
31 |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
32 |
* |
|
33 |
****************************************************************************** |
|
34 |
*/ |
|
35 |
|
|
36 |
/* Define to prevent recursive inclusion -------------------------------------*/ |
|
37 |
#ifndef __STM32F0xx_LL_CRC_H |
|
38 |
#define __STM32F0xx_LL_CRC_H |
|
39 |
|
|
40 |
#ifdef __cplusplus |
|
41 |
extern "C" { |
|
42 |
#endif |
|
43 |
|
|
44 |
/* Includes ------------------------------------------------------------------*/ |
|
45 |
#include "stm32f0xx.h" |
|
46 |
|
|
47 |
/** @addtogroup STM32F0xx_LL_Driver |
|
48 |
* @{ |
|
49 |
*/ |
|
50 |
|
|
51 |
#if defined(CRC) |
|
52 |
|
|
53 |
/** @defgroup CRC_LL CRC |
|
54 |
* @{ |
|
55 |
*/ |
|
56 |
|
|
57 |
/* Private types -------------------------------------------------------------*/ |
|
58 |
/* Private variables ---------------------------------------------------------*/ |
|
59 |
/* Private constants ---------------------------------------------------------*/ |
|
60 |
/* Private macros ------------------------------------------------------------*/ |
|
61 |
|
|
62 |
/* Exported types ------------------------------------------------------------*/ |
|
63 |
/* Exported constants --------------------------------------------------------*/ |
|
64 |
/** @defgroup CRC_LL_Exported_Constants CRC Exported Constants |
|
65 |
* @{ |
|
66 |
*/ |
|
67 |
|
|
68 |
#if defined(CRC_PROG_POLYNOMIAL_SUPPORT) |
|
69 |
/** @defgroup CRC_LL_EC_POLYLENGTH Polynomial length |
|
70 |
* @{ |
|
71 |
*/ |
|
72 |
#define LL_CRC_POLYLENGTH_32B 0x00000000U /*!< 32 bits Polynomial size */ |
|
73 |
#define LL_CRC_POLYLENGTH_16B CRC_CR_POLYSIZE_0 /*!< 16 bits Polynomial size */ |
|
74 |
#define LL_CRC_POLYLENGTH_8B CRC_CR_POLYSIZE_1 /*!< 8 bits Polynomial size */ |
|
75 |
#define LL_CRC_POLYLENGTH_7B (CRC_CR_POLYSIZE_1 | CRC_CR_POLYSIZE_0) /*!< 7 bits Polynomial size */ |
|
76 |
/** |
|
77 |
* @} |
|
78 |
*/ |
|
79 |
#endif |
|
80 |
|
|
81 |
/** @defgroup CRC_LL_EC_INDATA_REVERSE Input Data Reverse |
|
82 |
* @{ |
|
83 |
*/ |
|
84 |
#define LL_CRC_INDATA_REVERSE_NONE 0x00000000U /*!< Input Data bit order not affected */ |
|
85 |
#define LL_CRC_INDATA_REVERSE_BYTE CRC_CR_REV_IN_0 /*!< Input Data bit reversal done by byte */ |
|
86 |
#define LL_CRC_INDATA_REVERSE_HALFWORD CRC_CR_REV_IN_1 /*!< Input Data bit reversal done by half-word */ |
|
87 |
#define LL_CRC_INDATA_REVERSE_WORD (CRC_CR_REV_IN_1 | CRC_CR_REV_IN_0) /*!< Input Data bit reversal done by word */ |
|
88 |
/** |
|
89 |
* @} |
|
90 |
*/ |
|
91 |
|
|
92 |
/** @defgroup CRC_LL_EC_OUTDATA_REVERSE Output Data Reverse |
|
93 |
* @{ |
|
94 |
*/ |
|
95 |
#define LL_CRC_OUTDATA_REVERSE_NONE 0x00000000U /*!< Output Data bit order not affected */ |
|
96 |
#define LL_CRC_OUTDATA_REVERSE_BIT CRC_CR_REV_OUT /*!< Output Data bit reversal done by bit */ |
|
97 |
/** |
|
98 |
* @} |
|
99 |
*/ |
|
100 |
|
|
101 |
#if defined(CRC_PROG_POLYNOMIAL_SUPPORT) |
|
102 |
/** @defgroup CRC_LL_EC_Default_Polynomial_Value Default CRC generating polynomial value |
|
103 |
* @brief Normal representation of this polynomial value is |
|
104 |
* X^32 + X^26 + X^23 + X^22 + X^16 + X^12 + X^11 + X^10 +X^8 + X^7 + X^5 + X^4 + X^2 + X + 1 . |
|
105 |
* @{ |
|
106 |
*/ |
|
107 |
#define LL_CRC_DEFAULT_CRC32_POLY 0x04C11DB7U /*!< Default CRC generating polynomial value */ |
|
108 |
/** |
|
109 |
* @} |
|
110 |
*/ |
|
111 |
#endif |
|
112 |
|
|
113 |
/** @defgroup CRC_LL_EC_Default_InitValue Default CRC computation initialization value |
|
114 |
* @{ |
|
115 |
*/ |
|
116 |
#define LL_CRC_DEFAULT_CRC_INITVALUE 0xFFFFFFFFU /*!< Default CRC computation initialization value */ |
|
117 |
/** |
|
118 |
* @} |
|
119 |
*/ |
|
120 |
|
|
121 |
/** |
|
122 |
* @} |
|
123 |
*/ |
|
124 |
|
|
125 |
/* Exported macro ------------------------------------------------------------*/ |
|
126 |
/** @defgroup CRC_LL_Exported_Macros CRC Exported Macros |
|
127 |
* @{ |
|
128 |
*/ |
|
129 |
|
|
130 |
/** @defgroup CRC_LL_EM_WRITE_READ Common Write and read registers Macros |
|
131 |
* @{ |
|
132 |
*/ |
|
133 |
|
|
134 |
/** |
|
135 |
* @brief Write a value in CRC register |
|
136 |
* @param __INSTANCE__ CRC Instance |
|
137 |
* @param __REG__ Register to be written |
|
138 |
* @param __VALUE__ Value to be written in the register |
|
139 |
* @retval None |
|
140 |
*/ |
|
141 |
#define LL_CRC_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__)) |
|
142 |
|
|
143 |
/** |
|
144 |
* @brief Read a value in CRC register |
|
145 |
* @param __INSTANCE__ CRC Instance |
|
146 |
* @param __REG__ Register to be read |
|
147 |
* @retval Register value |
|
148 |
*/ |
|
149 |
#define LL_CRC_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__) |
|
150 |
/** |
|
151 |
* @} |
|
152 |
*/ |
|
153 |
|
|
154 |
/** |
|
155 |
* @} |
|
156 |
*/ |
|
157 |
|
|
158 |
|
|
159 |
/* Exported functions --------------------------------------------------------*/ |
|
160 |
/** @defgroup CRC_LL_Exported_Functions CRC Exported Functions |
|
161 |
* @{ |
|
162 |
*/ |
|
163 |
|
|
164 |
/** @defgroup CRC_LL_EF_Configuration CRC Configuration functions |
|
165 |
* @{ |
|
166 |
*/ |
|
167 |
|
|
168 |
/** |
|
169 |
* @brief Reset the CRC calculation unit. |
|
170 |
* @note If Programmable Initial CRC value feature |
|
171 |
* is available, also set the Data Register to the value stored in the |
|
172 |
* CRC_INIT register, otherwise, reset Data Register to its default value. |
|
173 |
* @rmtoll CR RESET LL_CRC_ResetCRCCalculationUnit |
|
174 |
* @param CRCx CRC Instance |
|
175 |
* @retval None |
|
176 |
*/ |
|
177 |
__STATIC_INLINE void LL_CRC_ResetCRCCalculationUnit(CRC_TypeDef *CRCx) |
|
178 |
{ |
|
179 |
SET_BIT(CRCx->CR, CRC_CR_RESET); |
|
180 |
} |
|
181 |
|
|
182 |
#if defined(CRC_PROG_POLYNOMIAL_SUPPORT) |
|
183 |
/** |
|
184 |
* @brief Configure size of the polynomial. |
|
185 |
* @note This function is available only on devices supporting |
|
186 |
* Programmable Polynomial feature. |
|
187 |
* @rmtoll CR POLYSIZE LL_CRC_SetPolynomialSize |
|
188 |
* @param CRCx CRC Instance |
|
189 |
* @param PolySize This parameter can be one of the following values: |
|
190 |
* @arg @ref LL_CRC_POLYLENGTH_32B |
|
191 |
* @arg @ref LL_CRC_POLYLENGTH_16B |
|
192 |
* @arg @ref LL_CRC_POLYLENGTH_8B |
|
193 |
* @arg @ref LL_CRC_POLYLENGTH_7B |
|
194 |
* @retval None |
|
195 |
*/ |
|
196 |
__STATIC_INLINE void LL_CRC_SetPolynomialSize(CRC_TypeDef *CRCx, uint32_t PolySize) |
|
197 |
{ |
|
198 |
MODIFY_REG(CRCx->CR, CRC_CR_POLYSIZE, PolySize); |
|
199 |
} |
|
200 |
|
|
201 |
/** |
|
202 |
* @brief Return size of the polynomial. |
|
203 |
* @note This function is available only on devices supporting |
|
204 |
* Programmable Polynomial feature. |
|
205 |
* @rmtoll CR POLYSIZE LL_CRC_GetPolynomialSize |
|
206 |
* @param CRCx CRC Instance |
|
207 |
* @retval Returned value can be one of the following values: |
|
208 |
* @arg @ref LL_CRC_POLYLENGTH_32B |
|
209 |
* @arg @ref LL_CRC_POLYLENGTH_16B |
|
210 |
* @arg @ref LL_CRC_POLYLENGTH_8B |
|
211 |
* @arg @ref LL_CRC_POLYLENGTH_7B |
|
212 |
*/ |
|
213 |
__STATIC_INLINE uint32_t LL_CRC_GetPolynomialSize(CRC_TypeDef *CRCx) |
|
214 |
{ |
|
215 |
return (uint32_t)(READ_BIT(CRCx->CR, CRC_CR_POLYSIZE)); |
|
216 |
} |
|
217 |
#endif |
|
218 |
|
|
219 |
/** |
|
220 |
* @brief Configure the reversal of the bit order of the input data |
|
221 |
* @rmtoll CR REV_IN LL_CRC_SetInputDataReverseMode |
|
222 |
* @param CRCx CRC Instance |
|
223 |
* @param ReverseMode This parameter can be one of the following values: |
|
224 |
* @arg @ref LL_CRC_INDATA_REVERSE_NONE |
|
225 |
* @arg @ref LL_CRC_INDATA_REVERSE_BYTE |
|
226 |
* @arg @ref LL_CRC_INDATA_REVERSE_HALFWORD |
|
227 |
* @arg @ref LL_CRC_INDATA_REVERSE_WORD |
|
228 |
* @retval None |
|
229 |
*/ |
|
230 |
__STATIC_INLINE void LL_CRC_SetInputDataReverseMode(CRC_TypeDef *CRCx, uint32_t ReverseMode) |
|
231 |
{ |
|
232 |
MODIFY_REG(CRCx->CR, CRC_CR_REV_IN, ReverseMode); |
|
233 |
} |
|
234 |
|
|
235 |
/** |
|
236 |
* @brief Return type of reversal for input data bit order |
|
237 |
* @rmtoll CR REV_IN LL_CRC_GetInputDataReverseMode |
|
238 |
* @param CRCx CRC Instance |
|
239 |
* @retval Returned value can be one of the following values: |
|
240 |
* @arg @ref LL_CRC_INDATA_REVERSE_NONE |
|
241 |
* @arg @ref LL_CRC_INDATA_REVERSE_BYTE |
|
242 |
* @arg @ref LL_CRC_INDATA_REVERSE_HALFWORD |
|
243 |
* @arg @ref LL_CRC_INDATA_REVERSE_WORD |
|
244 |
*/ |
|
245 |
__STATIC_INLINE uint32_t LL_CRC_GetInputDataReverseMode(CRC_TypeDef *CRCx) |
|
246 |
{ |
|
247 |
return (uint32_t)(READ_BIT(CRCx->CR, CRC_CR_REV_IN)); |
|
248 |
} |
|
249 |
|
|
250 |
/** |
|
251 |
* @brief Configure the reversal of the bit order of the Output data |
|
252 |
* @rmtoll CR REV_OUT LL_CRC_SetOutputDataReverseMode |
|
253 |
* @param CRCx CRC Instance |
|
254 |
* @param ReverseMode This parameter can be one of the following values: |
|
255 |
* @arg @ref LL_CRC_OUTDATA_REVERSE_NONE |
|
256 |
* @arg @ref LL_CRC_OUTDATA_REVERSE_BIT |
|
257 |
* @retval None |
|
258 |
*/ |
|
259 |
__STATIC_INLINE void LL_CRC_SetOutputDataReverseMode(CRC_TypeDef *CRCx, uint32_t ReverseMode) |
|
260 |
{ |
|
261 |
MODIFY_REG(CRCx->CR, CRC_CR_REV_OUT, ReverseMode); |
|
262 |
} |
|
263 |
|
|
264 |
/** |
|
265 |
* @brief Configure the reversal of the bit order of the Output data |
|
266 |
* @rmtoll CR REV_OUT LL_CRC_GetOutputDataReverseMode |
|
267 |
* @param CRCx CRC Instance |
|
268 |
* @retval Returned value can be one of the following values: |
|
269 |
* @arg @ref LL_CRC_OUTDATA_REVERSE_NONE |
|
270 |
* @arg @ref LL_CRC_OUTDATA_REVERSE_BIT |
|
271 |
*/ |
|
272 |
__STATIC_INLINE uint32_t LL_CRC_GetOutputDataReverseMode(CRC_TypeDef *CRCx) |
|
273 |
{ |
|
274 |
return (uint32_t)(READ_BIT(CRCx->CR, CRC_CR_REV_OUT)); |
|
275 |
} |
|
276 |
|
|
277 |
/** |
|
278 |
* @brief Initialize the Programmable initial CRC value. |
|
279 |
* @note If the CRC size is less than 32 bits, the least significant bits |
|
280 |
* are used to write the correct value |
|
281 |
* @note LL_CRC_DEFAULT_CRC_INITVALUE could be used as value for InitCrc parameter. |
|
282 |
* @rmtoll INIT INIT LL_CRC_SetInitialData |
|
283 |
* @param CRCx CRC Instance |
|
284 |
* @param InitCrc Value to be programmed in Programmable initial CRC value register |
|
285 |
* @retval None |
|
286 |
*/ |
|
287 |
__STATIC_INLINE void LL_CRC_SetInitialData(CRC_TypeDef *CRCx, uint32_t InitCrc) |
|
288 |
{ |
|
289 |
WRITE_REG(CRCx->INIT, InitCrc); |
|
290 |
} |
|
291 |
|
|
292 |
/** |
|
293 |
* @brief Return current Initial CRC value. |
|
294 |
* @note If the CRC size is less than 32 bits, the least significant bits |
|
295 |
* are used to read the correct value |
|
296 |
* @rmtoll INIT INIT LL_CRC_GetInitialData |
|
297 |
* @param CRCx CRC Instance |
|
298 |
* @retval Value programmed in Programmable initial CRC value register |
|
299 |
*/ |
|
300 |
__STATIC_INLINE uint32_t LL_CRC_GetInitialData(CRC_TypeDef *CRCx) |
|
301 |
{ |
|
302 |
return (uint32_t)(READ_REG(CRCx->INIT)); |
|
303 |
} |
|
304 |
|
|
305 |
#if defined(CRC_PROG_POLYNOMIAL_SUPPORT) |
|
306 |
/** |
|
307 |
* @brief Initialize the Programmable polynomial value |
|
308 |
* (coefficients of the polynomial to be used for CRC calculation). |
|
309 |
* @note This function is available only on devices supporting |
|
310 |
* Programmable Polynomial feature. |
|
311 |
* @note LL_CRC_DEFAULT_CRC32_POLY could be used as value for PolynomCoef parameter. |
|
312 |
* @note Please check Reference Manual and existing Errata Sheets, |
|
313 |
* regarding possible limitations for Polynomial values usage. |
|
314 |
* For example, for a polynomial of degree 7, X^7 + X^6 + X^5 + X^2 + 1 is written 0x65 |
|
315 |
* @rmtoll POL POL LL_CRC_SetPolynomialCoef |
|
316 |
* @param CRCx CRC Instance |
|
317 |
* @param PolynomCoef Value to be programmed in Programmable Polynomial value register |
|
318 |
* @retval None |
|
319 |
*/ |
|
320 |
__STATIC_INLINE void LL_CRC_SetPolynomialCoef(CRC_TypeDef *CRCx, uint32_t PolynomCoef) |
|
321 |
{ |
|
322 |
WRITE_REG(CRCx->POL, PolynomCoef); |
|
323 |
} |
|
324 |
|
|
325 |
/** |
|
326 |
* @brief Return current Programmable polynomial value |
|
327 |
* @note This function is available only on devices supporting |
|
328 |
* Programmable Polynomial feature. |
|
329 |
* @note Please check Reference Manual and existing Errata Sheets, |
|
330 |
* regarding possible limitations for Polynomial values usage. |
|
331 |
* For example, for a polynomial of degree 7, X^7 + X^6 + X^5 + X^2 + 1 is written 0x65 |
|
332 |
* @rmtoll POL POL LL_CRC_GetPolynomialCoef |
|
333 |
* @param CRCx CRC Instance |
|
334 |
* @retval Value programmed in Programmable Polynomial value register |
|
335 |
*/ |
|
336 |
__STATIC_INLINE uint32_t LL_CRC_GetPolynomialCoef(CRC_TypeDef *CRCx) |
|
337 |
{ |
|
338 |
return (uint32_t)(READ_REG(CRCx->POL)); |
|
339 |
} |
|
340 |
#endif |
|
341 |
|
|
342 |
/** |
|
343 |
* @} |
|
344 |
*/ |
|
345 |
|
|
346 |
/** @defgroup CRC_LL_EF_Data_Management Data_Management |
|
347 |
* @{ |
|
348 |
*/ |
|
349 |
|
|
350 |
/** |
|
351 |
* @brief Write given 32-bit data to the CRC calculator |
|
352 |
* @rmtoll DR DR LL_CRC_FeedData32 |
|
353 |
* @param CRCx CRC Instance |
|
354 |
* @param InData value to be provided to CRC calculator between between Min_Data=0 and Max_Data=0xFFFFFFFF |
|
355 |
* @retval None |
|
356 |
*/ |
|
357 |
__STATIC_INLINE void LL_CRC_FeedData32(CRC_TypeDef *CRCx, uint32_t InData) |
|
358 |
{ |
|
359 |
WRITE_REG(CRCx->DR, InData); |
|
360 |
} |
|
361 |
|
|
362 |
/** |
|
363 |
* @brief Write given 16-bit data to the CRC calculator |
|
364 |
* @rmtoll DR DR LL_CRC_FeedData16 |
|
365 |
* @param CRCx CRC Instance |
|
366 |
* @param InData 16 bit value to be provided to CRC calculator between between Min_Data=0 and Max_Data=0xFFFF |
|
367 |
* @retval None |
|
368 |
*/ |
|
369 |
__STATIC_INLINE void LL_CRC_FeedData16(CRC_TypeDef *CRCx, uint16_t InData) |
|
370 |
{ |
|
371 |
*(uint16_t __IO *)(&CRCx->DR) = (uint16_t) InData; |
|
372 |
} |
|
373 |
|
|
374 |
/** |
|
375 |
* @brief Write given 8-bit data to the CRC calculator |
|
376 |
* @rmtoll DR DR LL_CRC_FeedData8 |
|
377 |
* @param CRCx CRC Instance |
|
378 |
* @param InData 8 bit value to be provided to CRC calculator between between Min_Data=0 and Max_Data=0xFF |
|
379 |
* @retval None |
|
380 |
*/ |
|
381 |
__STATIC_INLINE void LL_CRC_FeedData8(CRC_TypeDef *CRCx, uint8_t InData) |
|
382 |
{ |
|
383 |
*(uint8_t __IO *)(&CRCx->DR) = (uint8_t) InData; |
|
384 |
} |
|
385 |
|
|
386 |
/** |
|
387 |
* @brief Return current CRC calculation result. 32 bits value is returned. |
|
388 |
* @rmtoll DR DR LL_CRC_ReadData32 |
|
389 |
* @param CRCx CRC Instance |
|
390 |
* @retval Current CRC calculation result as stored in CRC_DR register (32 bits). |
|
391 |
*/ |
|
392 |
__STATIC_INLINE uint32_t LL_CRC_ReadData32(CRC_TypeDef *CRCx) |
|
393 |
{ |
|
394 |
return (uint32_t)(READ_REG(CRCx->DR)); |
|
395 |
} |
|
396 |
|
|
397 |
#if defined(CRC_PROG_POLYNOMIAL_SUPPORT) |
|
398 |
/** |
|
399 |
* @brief Return current CRC calculation result. 16 bits value is returned. |
|
400 |
* @note This function is expected to be used in a 16 bits CRC polynomial size context. |
|
401 |
* @note This function is available only on devices supporting |
|
402 |
* Programmable Polynomial feature. |
|
403 |
* @rmtoll DR DR LL_CRC_ReadData16 |
|
404 |
* @param CRCx CRC Instance |
|
405 |
* @retval Current CRC calculation result as stored in CRC_DR register (16 bits). |
|
406 |
*/ |
|
407 |
__STATIC_INLINE uint16_t LL_CRC_ReadData16(CRC_TypeDef *CRCx) |
|
408 |
{ |
|
409 |
return (uint16_t)READ_REG(CRCx->DR); |
|
410 |
} |
|
411 |
|
|
412 |
/** |
|
413 |
* @brief Return current CRC calculation result. 8 bits value is returned. |
|
414 |
* @note This function is expected to be used in a 8 bits CRC polynomial size context. |
|
415 |
* @note This function is available only on devices supporting |
|
416 |
* Programmable Polynomial feature. |
|
417 |
* @rmtoll DR DR LL_CRC_ReadData8 |
|
418 |
* @param CRCx CRC Instance |
|
419 |
* @retval Current CRC calculation result as stored in CRC_DR register (8 bits). |
|
420 |
*/ |
|
421 |
__STATIC_INLINE uint8_t LL_CRC_ReadData8(CRC_TypeDef *CRCx) |
|
422 |
{ |
|
423 |
return (uint8_t)READ_REG(CRCx->DR); |
|
424 |
} |
|
425 |
|
|
426 |
/** |
|
427 |
* @brief Return current CRC calculation result. 7 bits value is returned. |
|
428 |
* @note This function is expected to be used in a 7 bits CRC polynomial size context. |
|
429 |
* @note This function is available only on devices supporting |
|
430 |
* Programmable Polynomial feature. |
|
431 |
* @rmtoll DR DR LL_CRC_ReadData7 |
|
432 |
* @param CRCx CRC Instance |
|
433 |
* @retval Current CRC calculation result as stored in CRC_DR register (7 bits). |
|
434 |
*/ |
|
435 |
__STATIC_INLINE uint8_t LL_CRC_ReadData7(CRC_TypeDef *CRCx) |
|
436 |
{ |
|
437 |
return (uint8_t)(READ_REG(CRCx->DR) & 0x7FU); |
|
438 |
} |
|
439 |
#endif |
|
440 |
|
|
441 |
/** |
|
442 |
* @brief Return data stored in the Independent Data(IDR) register. |
|
443 |
* @note This register can be used as a temporary storage location for one byte. |
|
444 |
* @rmtoll IDR IDR LL_CRC_Read_IDR |
|
445 |
* @param CRCx CRC Instance |
|
446 |
* @retval Value stored in CRC_IDR register (General-purpose 8-bit data register). |
|
447 |
*/ |
|
448 |
__STATIC_INLINE uint32_t LL_CRC_Read_IDR(CRC_TypeDef *CRCx) |
|
449 |
{ |
|
450 |
return (uint32_t)(READ_REG(CRCx->IDR)); |
|
451 |
} |
|
452 |
|
|
453 |
/** |
|
454 |
* @brief Store data in the Independent Data(IDR) register. |
|
455 |
* @note This register can be used as a temporary storage location for one byte. |
|
456 |
* @rmtoll IDR IDR LL_CRC_Write_IDR |
|
457 |
* @param CRCx CRC Instance |
|
458 |
* @param InData value to be stored in CRC_IDR register (8-bit) between between Min_Data=0 and Max_Data=0xFF |
|
459 |
* @retval None |
|
460 |
*/ |
|
461 |
__STATIC_INLINE void LL_CRC_Write_IDR(CRC_TypeDef *CRCx, uint32_t InData) |
|
462 |
{ |
|
463 |
*((uint8_t __IO *)(&CRCx->IDR)) = (uint8_t) InData; |
|
464 |
} |
|
465 |
/** |
|
466 |
* @} |
|
467 |
*/ |
|
468 |
|
|
469 |
#if defined(USE_FULL_LL_DRIVER) |
|
470 |
/** @defgroup CRC_LL_EF_Init Initialization and de-initialization functions |
|
471 |
* @{ |
|
472 |
*/ |
|
473 |
|
|
474 |
ErrorStatus LL_CRC_DeInit(CRC_TypeDef *CRCx); |
|
475 |
|
|
476 |
/** |
|
477 |
* @} |
|
478 |
*/ |
|
479 |
#endif /* USE_FULL_LL_DRIVER */ |
|
480 |
|
|
481 |
/** |
|
482 |
* @} |
|
483 |
*/ |
|
484 |
|
|
485 |
/** |
|
486 |
* @} |
|
487 |
*/ |
|
488 |
|
|
489 |
#endif /* defined(CRC) */ |
|
490 |
|
|
491 |
/** |
|
492 |
* @} |
|
493 |
*/ |
|
494 |
|
|
495 |
#ifdef __cplusplus |
|
496 |
} |
|
497 |
#endif |
|
498 |
|
|
499 |
#endif /* __STM32F0xx_LL_CRC_H */ |
|
500 |
|
|
501 |
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |