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