2 ******************************************************************************
3 * @file stm32f10x_crc.c
4 * @author MCD Application Team
7 * @brief This file provides all the CRC firmware functions.
8 ******************************************************************************
11 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
12 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
13 * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
14 * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
15 * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
16 * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
18 * <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2>
19 ******************************************************************************
22 /* Includes ------------------------------------------------------------------*/
23 #include "stm32f10x_crc.h"
25 /** @addtogroup STM32F10x_StdPeriph_Driver
30 * @brief CRC driver modules
34 /** @defgroup CRC_Private_TypesDefinitions
42 /** @defgroup CRC_Private_Defines
50 /** @defgroup CRC_Private_Macros
58 /** @defgroup CRC_Private_Variables
66 /** @defgroup CRC_Private_FunctionPrototypes
74 /** @defgroup CRC_Private_Functions
79 * @brief Resets the CRC Data register (DR).
83 void CRC_ResetDR(void)
85 /* Reset CRC generator */
86 CRC
->CR
= CRC_CR_RESET
;
90 * @brief Computes the 32-bit CRC of a given data word(32-bit).
91 * @param Data: data word(32-bit) to compute its CRC
94 uint32_t CRC_CalcCRC(uint32_t Data
)
102 * @brief Computes the 32-bit CRC of a given buffer of data word(32-bit).
103 * @param pBuffer: pointer to the buffer containing the data to be computed
104 * @param BufferLength: length of the buffer to be computed
107 uint32_t CRC_CalcBlockCRC(uint32_t pBuffer
[], uint32_t BufferLength
)
111 for(index
= 0; index
< BufferLength
; index
++)
113 CRC
->DR
= pBuffer
[index
];
119 * @brief Returns the current CRC value.
123 uint32_t CRC_GetCRC(void)
129 * @brief Stores a 8-bit data in the Independent Data(ID) register.
130 * @param IDValue: 8-bit value to be stored in the ID register
133 void CRC_SetIDRegister(uint8_t IDValue
)
139 * @brief Returns the 8-bit data stored in the Independent Data(ID) register
141 * @retval 8-bit value of the ID register
143 uint8_t CRC_GetIDRegister(void)
160 /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/