2 ******************************************************************************
3 * @file stm32f4xx_crc.c
4 * @author MCD Application Team
7 * @brief This file provides all the CRC firmware functions.
8 ******************************************************************************
11 * <h2><center>© COPYRIGHT 2016 STMicroelectronics</center></h2>
13 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
14 * You may not use this file except in compliance with the License.
15 * You may obtain a copy of the License at:
17 * http://www.st.com/software_license_agreement_liberty_v2
19 * Unless required by applicable law or agreed to in writing, software
20 * distributed under the License is distributed on an "AS IS" BASIS,
21 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 * See the License for the specific language governing permissions and
23 * limitations under the License.
25 ******************************************************************************
28 /* Includes ------------------------------------------------------------------*/
29 #include "stm32f4xx_crc.h"
31 /** @addtogroup STM32F4xx_StdPeriph_Driver
36 * @brief CRC driver modules
40 /* Private typedef -----------------------------------------------------------*/
41 /* Private define ------------------------------------------------------------*/
42 /* Private macro -------------------------------------------------------------*/
43 /* Private variables ---------------------------------------------------------*/
44 /* Private function prototypes -----------------------------------------------*/
45 /* Private functions ---------------------------------------------------------*/
47 /** @defgroup CRC_Private_Functions
52 * @brief Resets the CRC Data register (DR).
56 void CRC_ResetDR(void)
58 /* Reset CRC generator */
59 CRC
->CR
= CRC_CR_RESET
;
63 * @brief Computes the 32-bit CRC of a given data word(32-bit).
64 * @param Data: data word(32-bit) to compute its CRC
67 uint32_t CRC_CalcCRC(uint32_t Data
)
75 * @brief Computes the 32-bit CRC of a given buffer of data word(32-bit).
76 * @param pBuffer: pointer to the buffer containing the data to be computed
77 * @param BufferLength: length of the buffer to be computed
80 uint32_t CRC_CalcBlockCRC(uint32_t pBuffer
[], uint32_t BufferLength
)
84 for(index
= 0; index
< BufferLength
; index
++)
86 CRC
->DR
= pBuffer
[index
];
92 * @brief Returns the current CRC value.
96 uint32_t CRC_GetCRC(void)
102 * @brief Stores a 8-bit data in the Independent Data(ID) register.
103 * @param IDValue: 8-bit value to be stored in the ID register
106 void CRC_SetIDRegister(uint8_t IDValue
)
112 * @brief Returns the 8-bit data stored in the Independent Data(ID) register
114 * @retval 8-bit value of the ID register
116 uint8_t CRC_GetIDRegister(void)
133 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/