Move telemetry displayport init and cms device registering
[betaflight.git] / lib / main / STM32F4 / Drivers / STM32F4xx_StdPeriph_Driver / src / stm32f4xx_crc.c
blobb505d85cd74c0252cd9bfcae5de908be5765cbfb
1 /**
2 ******************************************************************************
3 * @file stm32f4xx_crc.c
4 * @author MCD Application Team
5 * @version V1.7.1
6 * @date 20-May-2016
7 * @brief This file provides all the CRC firmware functions.
8 ******************************************************************************
9 * @attention
11 * <h2><center>&copy; 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
32 * @{
35 /** @defgroup CRC
36 * @brief CRC driver modules
37 * @{
40 /* Private typedef -----------------------------------------------------------*/
41 /* Private define ------------------------------------------------------------*/
42 /* Private macro -------------------------------------------------------------*/
43 /* Private variables ---------------------------------------------------------*/
44 /* Private function prototypes -----------------------------------------------*/
45 /* Private functions ---------------------------------------------------------*/
47 /** @defgroup CRC_Private_Functions
48 * @{
51 /**
52 * @brief Resets the CRC Data register (DR).
53 * @param None
54 * @retval None
56 void CRC_ResetDR(void)
58 /* Reset CRC generator */
59 CRC->CR = CRC_CR_RESET;
62 /**
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
65 * @retval 32-bit CRC
67 uint32_t CRC_CalcCRC(uint32_t Data)
69 CRC->DR = Data;
71 return (CRC->DR);
74 /**
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
78 * @retval 32-bit CRC
80 uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength)
82 uint32_t index = 0;
84 for(index = 0; index < BufferLength; index++)
86 CRC->DR = pBuffer[index];
88 return (CRC->DR);
91 /**
92 * @brief Returns the current CRC value.
93 * @param None
94 * @retval 32-bit CRC
96 uint32_t CRC_GetCRC(void)
98 return (CRC->DR);
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
104 * @retval None
106 void CRC_SetIDRegister(uint8_t IDValue)
108 CRC->IDR = IDValue;
112 * @brief Returns the 8-bit data stored in the Independent Data(ID) register
113 * @param None
114 * @retval 8-bit value of the ID register
116 uint8_t CRC_GetIDRegister(void)
118 return (CRC->IDR);
122 * @}
126 * @}
130 * @}
133 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/