RTEMS 6.1-rc6
Loading...
Searching...
No Matches
stm32h7xx_ll_crc.h
Go to the documentation of this file.
1
19/* Define to prevent recursive inclusion -------------------------------------*/
20#ifndef STM32H7xx_LL_CRC_H
21#define STM32H7xx_LL_CRC_H
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27/* Includes ------------------------------------------------------------------*/
28#include "stm32h7xx.h"
29
34#if defined(CRC)
35
41/* Private types -------------------------------------------------------------*/
42/* Private variables ---------------------------------------------------------*/
43/* Private constants ---------------------------------------------------------*/
44/* Private macros ------------------------------------------------------------*/
45
46/* Exported types ------------------------------------------------------------*/
47/* Exported constants --------------------------------------------------------*/
57#define LL_CRC_POLYLENGTH_32B 0x00000000U
58#define LL_CRC_POLYLENGTH_16B CRC_CR_POLYSIZE_0
59#define LL_CRC_POLYLENGTH_8B CRC_CR_POLYSIZE_1
60#define LL_CRC_POLYLENGTH_7B (CRC_CR_POLYSIZE_1 | CRC_CR_POLYSIZE_0)
69#define LL_CRC_INDATA_REVERSE_NONE 0x00000000U
70#define LL_CRC_INDATA_REVERSE_BYTE CRC_CR_REV_IN_0
71#define LL_CRC_INDATA_REVERSE_HALFWORD CRC_CR_REV_IN_1
72#define LL_CRC_INDATA_REVERSE_WORD (CRC_CR_REV_IN_1 | CRC_CR_REV_IN_0)
81#define LL_CRC_OUTDATA_REVERSE_NONE 0x00000000U
82#define LL_CRC_OUTDATA_REVERSE_BIT CRC_CR_REV_OUT
93#define LL_CRC_DEFAULT_CRC32_POLY 0x04C11DB7U
102#define LL_CRC_DEFAULT_CRC_INITVALUE 0xFFFFFFFFU
111/* Exported macro ------------------------------------------------------------*/
129#define LL_CRC_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, __VALUE__)
130
137#define LL_CRC_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
147/* Exported functions --------------------------------------------------------*/
167__STATIC_INLINE void LL_CRC_ResetCRCCalculationUnit(CRC_TypeDef *CRCx)
168{
169 SET_BIT(CRCx->CR, CRC_CR_RESET);
170}
171
183__STATIC_INLINE void LL_CRC_SetPolynomialSize(CRC_TypeDef *CRCx, uint32_t PolySize)
184{
185 MODIFY_REG(CRCx->CR, CRC_CR_POLYSIZE, PolySize);
186}
187
198__STATIC_INLINE uint32_t LL_CRC_GetPolynomialSize(const CRC_TypeDef *CRCx)
199{
200 return (uint32_t)(READ_BIT(CRCx->CR, CRC_CR_POLYSIZE));
201}
202
214__STATIC_INLINE void LL_CRC_SetInputDataReverseMode(CRC_TypeDef *CRCx, uint32_t ReverseMode)
215{
216 MODIFY_REG(CRCx->CR, CRC_CR_REV_IN, ReverseMode);
217}
218
229__STATIC_INLINE uint32_t LL_CRC_GetInputDataReverseMode(const CRC_TypeDef *CRCx)
230{
231 return (uint32_t)(READ_BIT(CRCx->CR, CRC_CR_REV_IN));
232}
233
243__STATIC_INLINE void LL_CRC_SetOutputDataReverseMode(CRC_TypeDef *CRCx, uint32_t ReverseMode)
244{
245 MODIFY_REG(CRCx->CR, CRC_CR_REV_OUT, ReverseMode);
246}
247
256__STATIC_INLINE uint32_t LL_CRC_GetOutputDataReverseMode(const CRC_TypeDef *CRCx)
257{
258 return (uint32_t)(READ_BIT(CRCx->CR, CRC_CR_REV_OUT));
259}
260
271__STATIC_INLINE void LL_CRC_SetInitialData(CRC_TypeDef *CRCx, uint32_t InitCrc)
272{
273 WRITE_REG(CRCx->INIT, InitCrc);
274}
275
284__STATIC_INLINE uint32_t LL_CRC_GetInitialData(const CRC_TypeDef *CRCx)
285{
286 return (uint32_t)(READ_REG(CRCx->INIT));
287}
288
301__STATIC_INLINE void LL_CRC_SetPolynomialCoef(CRC_TypeDef *CRCx, uint32_t PolynomCoef)
302{
303 WRITE_REG(CRCx->POL, PolynomCoef);
304}
305
315__STATIC_INLINE uint32_t LL_CRC_GetPolynomialCoef(const CRC_TypeDef *CRCx)
316{
317 return (uint32_t)(READ_REG(CRCx->POL));
318}
319
336__STATIC_INLINE void LL_CRC_FeedData32(CRC_TypeDef *CRCx, uint32_t InData)
337{
338 WRITE_REG(CRCx->DR, InData);
339}
340
348__STATIC_INLINE void LL_CRC_FeedData16(CRC_TypeDef *CRCx, uint16_t InData)
349{
350 __IO uint16_t *pReg;
351
352 pReg = (__IO uint16_t *)(__IO void *)(&CRCx->DR); /* Derogation MisraC2012 R.11.5 */
353 *pReg = InData;
354}
355
363__STATIC_INLINE void LL_CRC_FeedData8(CRC_TypeDef *CRCx, uint8_t InData)
364{
365 *(uint8_t __IO *)(&CRCx->DR) = (uint8_t) InData;
366}
367
374__STATIC_INLINE uint32_t LL_CRC_ReadData32(const CRC_TypeDef *CRCx)
375{
376 return (uint32_t)(READ_REG(CRCx->DR));
377}
378
386__STATIC_INLINE uint16_t LL_CRC_ReadData16(const CRC_TypeDef *CRCx)
387{
388 return (uint16_t)READ_REG(CRCx->DR);
389}
390
398__STATIC_INLINE uint8_t LL_CRC_ReadData8(const CRC_TypeDef *CRCx)
399{
400 return (uint8_t)READ_REG(CRCx->DR);
401}
402
410__STATIC_INLINE uint8_t LL_CRC_ReadData7(const CRC_TypeDef *CRCx)
411{
412 return (uint8_t)(READ_REG(CRCx->DR) & 0x7FU);
413}
414
422__STATIC_INLINE uint32_t LL_CRC_Read_IDR(const CRC_TypeDef *CRCx)
423{
424 return (uint32_t)(READ_REG(CRCx->IDR));
425}
426
435__STATIC_INLINE void LL_CRC_Write_IDR(CRC_TypeDef *CRCx, uint32_t InData)
436{
437 *((uint32_t __IO *)(&CRCx->IDR)) = (uint32_t) InData;
438}
443#if defined(USE_FULL_LL_DRIVER) || defined(__rtems__)
449ErrorStatus LL_CRC_DeInit(const CRC_TypeDef *CRCx);
450
454#endif /* USE_FULL_LL_DRIVER */
455
464#endif /* defined(CRC) */
465
470#ifdef __cplusplus
471}
472#endif
473
474#endif /* STM32H7xx_LL_CRC_H */
#define __IO
Definition: core_cm4.h:239
#define CRC_CR_REV_IN
Definition: stm32h723xx.h:5786
#define CRC_CR_REV_OUT
Definition: stm32h723xx.h:5791
#define CRC_CR_RESET
Definition: stm32h723xx.h:5778
#define CRC_CR_POLYSIZE
Definition: stm32h723xx.h:5781
CMSIS STM32H7xx Device Peripheral Access Layer Header File.
CRC calculation unit.
Definition: stm32h723xx.h:442
__IO uint32_t POL
Definition: stm32h723xx.h:448
__IO uint32_t INIT
Definition: stm32h723xx.h:447
__IO uint32_t DR
Definition: stm32h723xx.h:443
__IO uint32_t IDR
Definition: stm32h723xx.h:444
__IO uint32_t CR
Definition: stm32h723xx.h:445