CARME-M4 BSP  V1.5
stm32f4xx_crc.c
Go to the documentation of this file.
1 
28 /* Includes ------------------------------------------------------------------*/
29 #include "stm32f4xx_crc.h"
30 
40 /* Private typedef -----------------------------------------------------------*/
41 /* Private define ------------------------------------------------------------*/
42 /* Private macro -------------------------------------------------------------*/
43 /* Private variables ---------------------------------------------------------*/
44 /* Private function prototypes -----------------------------------------------*/
45 /* Private functions ---------------------------------------------------------*/
46 
56 void CRC_ResetDR(void)
57 {
58  /* Reset CRC generator */
59  CRC->CR = CRC_CR_RESET;
60 }
61 
67 uint32_t CRC_CalcCRC(uint32_t Data)
68 {
69  CRC->DR = Data;
70 
71  return (CRC->DR);
72 }
73 
80 uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength)
81 {
82  uint32_t index = 0;
83 
84  for(index = 0; index < BufferLength; index++)
85  {
86  CRC->DR = pBuffer[index];
87  }
88  return (CRC->DR);
89 }
90 
96 uint32_t CRC_GetCRC(void)
97 {
98  return (CRC->DR);
99 }
100 
106 void CRC_SetIDRegister(uint8_t IDValue)
107 {
108  CRC->IDR = IDValue;
109 }
110 
116 uint8_t CRC_GetIDRegister(void)
117 {
118  return (CRC->IDR);
119 }
120 
133 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
This file contains all the functions prototypes for the CRC firmware library.
void CRC_ResetDR(void)
Resets the CRC Data register (DR).
Definition: stm32f4xx_crc.c:56
uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength)
Computes the 32-bit CRC of a given buffer of data word(32-bit).
Definition: stm32f4xx_crc.c:80
uint32_t CRC_CalcCRC(uint32_t Data)
Computes the 32-bit CRC of a given data word(32-bit).
Definition: stm32f4xx_crc.c:67
void CRC_SetIDRegister(uint8_t IDValue)
Stores a 8-bit data in the Independent Data(ID) register.
uint32_t CRC_GetCRC(void)
Returns the current CRC value.
Definition: stm32f4xx_crc.c:96
uint8_t CRC_GetIDRegister(void)
Returns the 8-bit data stored in the Independent Data(ID) register.