mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Committer:
AnnaBridge
Date:
Wed Feb 20 22:31:08 2019 +0000
Revision:
189:f392fc9709a3
Parent:
180:96ed750bd169
mbed library release version 165

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 156:95d6b41a828b 1 /**
<> 156:95d6b41a828b 2 ******************************************************************************
<> 156:95d6b41a828b 3 * @file stm32f0xx_ll_crc.h
<> 156:95d6b41a828b 4 * @author MCD Application Team
<> 156:95d6b41a828b 5 * @brief Header file of CRC LL module.
<> 156:95d6b41a828b 6 ******************************************************************************
<> 156:95d6b41a828b 7 * @attention
<> 156:95d6b41a828b 8 *
<> 156:95d6b41a828b 9 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
<> 156:95d6b41a828b 10 *
<> 156:95d6b41a828b 11 * Redistribution and use in source and binary forms, with or without modification,
<> 156:95d6b41a828b 12 * are permitted provided that the following conditions are met:
<> 156:95d6b41a828b 13 * 1. Redistributions of source code must retain the above copyright notice,
<> 156:95d6b41a828b 14 * this list of conditions and the following disclaimer.
<> 156:95d6b41a828b 15 * 2. Redistributions in binary form must reproduce the above copyright notice,
<> 156:95d6b41a828b 16 * this list of conditions and the following disclaimer in the documentation
<> 156:95d6b41a828b 17 * and/or other materials provided with the distribution.
<> 156:95d6b41a828b 18 * 3. Neither the name of STMicroelectronics nor the names of its contributors
<> 156:95d6b41a828b 19 * may be used to endorse or promote products derived from this software
<> 156:95d6b41a828b 20 * without specific prior written permission.
<> 156:95d6b41a828b 21 *
<> 156:95d6b41a828b 22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
<> 156:95d6b41a828b 23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
<> 156:95d6b41a828b 24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
<> 156:95d6b41a828b 25 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
<> 156:95d6b41a828b 26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
<> 156:95d6b41a828b 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
<> 156:95d6b41a828b 28 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
<> 156:95d6b41a828b 29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
<> 156:95d6b41a828b 30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
<> 156:95d6b41a828b 31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<> 156:95d6b41a828b 32 *
<> 156:95d6b41a828b 33 ******************************************************************************
<> 156:95d6b41a828b 34 */
<> 156:95d6b41a828b 35
<> 156:95d6b41a828b 36 /* Define to prevent recursive inclusion -------------------------------------*/
<> 156:95d6b41a828b 37 #ifndef __STM32F0xx_LL_CRC_H
<> 156:95d6b41a828b 38 #define __STM32F0xx_LL_CRC_H
<> 156:95d6b41a828b 39
<> 156:95d6b41a828b 40 #ifdef __cplusplus
<> 156:95d6b41a828b 41 extern "C" {
<> 156:95d6b41a828b 42 #endif
<> 156:95d6b41a828b 43
<> 156:95d6b41a828b 44 /* Includes ------------------------------------------------------------------*/
<> 156:95d6b41a828b 45 #include "stm32f0xx.h"
<> 156:95d6b41a828b 46
<> 156:95d6b41a828b 47 /** @addtogroup STM32F0xx_LL_Driver
<> 156:95d6b41a828b 48 * @{
<> 156:95d6b41a828b 49 */
<> 156:95d6b41a828b 50
<> 156:95d6b41a828b 51 #if defined(CRC)
<> 156:95d6b41a828b 52
<> 156:95d6b41a828b 53 /** @defgroup CRC_LL CRC
<> 156:95d6b41a828b 54 * @{
<> 156:95d6b41a828b 55 */
<> 156:95d6b41a828b 56
<> 156:95d6b41a828b 57 /* Private types -------------------------------------------------------------*/
<> 156:95d6b41a828b 58 /* Private variables ---------------------------------------------------------*/
<> 156:95d6b41a828b 59 /* Private constants ---------------------------------------------------------*/
<> 156:95d6b41a828b 60 /* Private macros ------------------------------------------------------------*/
<> 156:95d6b41a828b 61
<> 156:95d6b41a828b 62 /* Exported types ------------------------------------------------------------*/
<> 156:95d6b41a828b 63 /* Exported constants --------------------------------------------------------*/
<> 156:95d6b41a828b 64 /** @defgroup CRC_LL_Exported_Constants CRC Exported Constants
<> 156:95d6b41a828b 65 * @{
<> 156:95d6b41a828b 66 */
<> 156:95d6b41a828b 67
<> 156:95d6b41a828b 68 #if defined(CRC_PROG_POLYNOMIAL_SUPPORT)
<> 156:95d6b41a828b 69 /** @defgroup CRC_LL_EC_POLYLENGTH Polynomial length
<> 156:95d6b41a828b 70 * @{
<> 156:95d6b41a828b 71 */
Anna Bridge 180:96ed750bd169 72 #define LL_CRC_POLYLENGTH_32B 0x00000000U /*!< 32 bits Polynomial size */
<> 156:95d6b41a828b 73 #define LL_CRC_POLYLENGTH_16B CRC_CR_POLYSIZE_0 /*!< 16 bits Polynomial size */
<> 156:95d6b41a828b 74 #define LL_CRC_POLYLENGTH_8B CRC_CR_POLYSIZE_1 /*!< 8 bits Polynomial size */
<> 156:95d6b41a828b 75 #define LL_CRC_POLYLENGTH_7B (CRC_CR_POLYSIZE_1 | CRC_CR_POLYSIZE_0) /*!< 7 bits Polynomial size */
<> 156:95d6b41a828b 76 /**
<> 156:95d6b41a828b 77 * @}
<> 156:95d6b41a828b 78 */
<> 156:95d6b41a828b 79 #endif
<> 156:95d6b41a828b 80
<> 156:95d6b41a828b 81 /** @defgroup CRC_LL_EC_INDATA_REVERSE Input Data Reverse
<> 156:95d6b41a828b 82 * @{
<> 156:95d6b41a828b 83 */
Anna Bridge 180:96ed750bd169 84 #define LL_CRC_INDATA_REVERSE_NONE 0x00000000U /*!< Input Data bit order not affected */
<> 156:95d6b41a828b 85 #define LL_CRC_INDATA_REVERSE_BYTE CRC_CR_REV_IN_0 /*!< Input Data bit reversal done by byte */
<> 156:95d6b41a828b 86 #define LL_CRC_INDATA_REVERSE_HALFWORD CRC_CR_REV_IN_1 /*!< Input Data bit reversal done by half-word */
<> 156:95d6b41a828b 87 #define LL_CRC_INDATA_REVERSE_WORD (CRC_CR_REV_IN_1 | CRC_CR_REV_IN_0) /*!< Input Data bit reversal done by word */
<> 156:95d6b41a828b 88 /**
<> 156:95d6b41a828b 89 * @}
<> 156:95d6b41a828b 90 */
<> 156:95d6b41a828b 91
<> 156:95d6b41a828b 92 /** @defgroup CRC_LL_EC_OUTDATA_REVERSE Output Data Reverse
<> 156:95d6b41a828b 93 * @{
<> 156:95d6b41a828b 94 */
Anna Bridge 180:96ed750bd169 95 #define LL_CRC_OUTDATA_REVERSE_NONE 0x00000000U /*!< Output Data bit order not affected */
<> 156:95d6b41a828b 96 #define LL_CRC_OUTDATA_REVERSE_BIT CRC_CR_REV_OUT /*!< Output Data bit reversal done by bit */
<> 156:95d6b41a828b 97 /**
<> 156:95d6b41a828b 98 * @}
<> 156:95d6b41a828b 99 */
<> 156:95d6b41a828b 100
<> 156:95d6b41a828b 101 #if defined(CRC_PROG_POLYNOMIAL_SUPPORT)
<> 156:95d6b41a828b 102 /** @defgroup CRC_LL_EC_Default_Polynomial_Value Default CRC generating polynomial value
<> 156:95d6b41a828b 103 * @brief Normal representation of this polynomial value is
<> 156:95d6b41a828b 104 * X^32 + X^26 + X^23 + X^22 + X^16 + X^12 + X^11 + X^10 +X^8 + X^7 + X^5 + X^4 + X^2 + X + 1 .
<> 156:95d6b41a828b 105 * @{
<> 156:95d6b41a828b 106 */
Anna Bridge 180:96ed750bd169 107 #define LL_CRC_DEFAULT_CRC32_POLY 0x04C11DB7U /*!< Default CRC generating polynomial value */
<> 156:95d6b41a828b 108 /**
<> 156:95d6b41a828b 109 * @}
<> 156:95d6b41a828b 110 */
<> 156:95d6b41a828b 111 #endif
<> 156:95d6b41a828b 112
<> 156:95d6b41a828b 113 /** @defgroup CRC_LL_EC_Default_InitValue Default CRC computation initialization value
<> 156:95d6b41a828b 114 * @{
<> 156:95d6b41a828b 115 */
Anna Bridge 180:96ed750bd169 116 #define LL_CRC_DEFAULT_CRC_INITVALUE 0xFFFFFFFFU /*!< Default CRC computation initialization value */
<> 156:95d6b41a828b 117 /**
<> 156:95d6b41a828b 118 * @}
<> 156:95d6b41a828b 119 */
<> 156:95d6b41a828b 120
<> 156:95d6b41a828b 121 /**
<> 156:95d6b41a828b 122 * @}
<> 156:95d6b41a828b 123 */
<> 156:95d6b41a828b 124
<> 156:95d6b41a828b 125 /* Exported macro ------------------------------------------------------------*/
<> 156:95d6b41a828b 126 /** @defgroup CRC_LL_Exported_Macros CRC Exported Macros
<> 156:95d6b41a828b 127 * @{
<> 156:95d6b41a828b 128 */
<> 156:95d6b41a828b 129
<> 156:95d6b41a828b 130 /** @defgroup CRC_LL_EM_WRITE_READ Common Write and read registers Macros
<> 156:95d6b41a828b 131 * @{
<> 156:95d6b41a828b 132 */
<> 156:95d6b41a828b 133
<> 156:95d6b41a828b 134 /**
<> 156:95d6b41a828b 135 * @brief Write a value in CRC register
<> 156:95d6b41a828b 136 * @param __INSTANCE__ CRC Instance
<> 156:95d6b41a828b 137 * @param __REG__ Register to be written
<> 156:95d6b41a828b 138 * @param __VALUE__ Value to be written in the register
<> 156:95d6b41a828b 139 * @retval None
<> 156:95d6b41a828b 140 */
<> 156:95d6b41a828b 141 #define LL_CRC_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
<> 156:95d6b41a828b 142
<> 156:95d6b41a828b 143 /**
<> 156:95d6b41a828b 144 * @brief Read a value in CRC register
<> 156:95d6b41a828b 145 * @param __INSTANCE__ CRC Instance
<> 156:95d6b41a828b 146 * @param __REG__ Register to be read
<> 156:95d6b41a828b 147 * @retval Register value
<> 156:95d6b41a828b 148 */
<> 156:95d6b41a828b 149 #define LL_CRC_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
<> 156:95d6b41a828b 150 /**
<> 156:95d6b41a828b 151 * @}
<> 156:95d6b41a828b 152 */
<> 156:95d6b41a828b 153
<> 156:95d6b41a828b 154 /**
<> 156:95d6b41a828b 155 * @}
<> 156:95d6b41a828b 156 */
<> 156:95d6b41a828b 157
<> 156:95d6b41a828b 158
<> 156:95d6b41a828b 159 /* Exported functions --------------------------------------------------------*/
<> 156:95d6b41a828b 160 /** @defgroup CRC_LL_Exported_Functions CRC Exported Functions
<> 156:95d6b41a828b 161 * @{
<> 156:95d6b41a828b 162 */
<> 156:95d6b41a828b 163
<> 156:95d6b41a828b 164 /** @defgroup CRC_LL_EF_Configuration CRC Configuration functions
<> 156:95d6b41a828b 165 * @{
<> 156:95d6b41a828b 166 */
<> 156:95d6b41a828b 167
<> 156:95d6b41a828b 168 /**
<> 156:95d6b41a828b 169 * @brief Reset the CRC calculation unit.
<> 156:95d6b41a828b 170 * @note If Programmable Initial CRC value feature
<> 156:95d6b41a828b 171 * is available, also set the Data Register to the value stored in the
<> 156:95d6b41a828b 172 * CRC_INIT register, otherwise, reset Data Register to its default value.
<> 156:95d6b41a828b 173 * @rmtoll CR RESET LL_CRC_ResetCRCCalculationUnit
<> 156:95d6b41a828b 174 * @param CRCx CRC Instance
<> 156:95d6b41a828b 175 * @retval None
<> 156:95d6b41a828b 176 */
<> 156:95d6b41a828b 177 __STATIC_INLINE void LL_CRC_ResetCRCCalculationUnit(CRC_TypeDef *CRCx)
<> 156:95d6b41a828b 178 {
<> 156:95d6b41a828b 179 SET_BIT(CRCx->CR, CRC_CR_RESET);
<> 156:95d6b41a828b 180 }
<> 156:95d6b41a828b 181
<> 156:95d6b41a828b 182 #if defined(CRC_PROG_POLYNOMIAL_SUPPORT)
<> 156:95d6b41a828b 183 /**
<> 156:95d6b41a828b 184 * @brief Configure size of the polynomial.
<> 156:95d6b41a828b 185 * @note This function is available only on devices supporting
<> 156:95d6b41a828b 186 * Programmable Polynomial feature.
<> 156:95d6b41a828b 187 * @rmtoll CR POLYSIZE LL_CRC_SetPolynomialSize
<> 156:95d6b41a828b 188 * @param CRCx CRC Instance
<> 156:95d6b41a828b 189 * @param PolySize This parameter can be one of the following values:
<> 156:95d6b41a828b 190 * @arg @ref LL_CRC_POLYLENGTH_32B
<> 156:95d6b41a828b 191 * @arg @ref LL_CRC_POLYLENGTH_16B
<> 156:95d6b41a828b 192 * @arg @ref LL_CRC_POLYLENGTH_8B
<> 156:95d6b41a828b 193 * @arg @ref LL_CRC_POLYLENGTH_7B
<> 156:95d6b41a828b 194 * @retval None
<> 156:95d6b41a828b 195 */
<> 156:95d6b41a828b 196 __STATIC_INLINE void LL_CRC_SetPolynomialSize(CRC_TypeDef *CRCx, uint32_t PolySize)
<> 156:95d6b41a828b 197 {
<> 156:95d6b41a828b 198 MODIFY_REG(CRCx->CR, CRC_CR_POLYSIZE, PolySize);
<> 156:95d6b41a828b 199 }
<> 156:95d6b41a828b 200
<> 156:95d6b41a828b 201 /**
<> 156:95d6b41a828b 202 * @brief Return size of the polynomial.
<> 156:95d6b41a828b 203 * @note This function is available only on devices supporting
<> 156:95d6b41a828b 204 * Programmable Polynomial feature.
<> 156:95d6b41a828b 205 * @rmtoll CR POLYSIZE LL_CRC_GetPolynomialSize
<> 156:95d6b41a828b 206 * @param CRCx CRC Instance
<> 156:95d6b41a828b 207 * @retval Returned value can be one of the following values:
<> 156:95d6b41a828b 208 * @arg @ref LL_CRC_POLYLENGTH_32B
<> 156:95d6b41a828b 209 * @arg @ref LL_CRC_POLYLENGTH_16B
<> 156:95d6b41a828b 210 * @arg @ref LL_CRC_POLYLENGTH_8B
<> 156:95d6b41a828b 211 * @arg @ref LL_CRC_POLYLENGTH_7B
<> 156:95d6b41a828b 212 */
<> 156:95d6b41a828b 213 __STATIC_INLINE uint32_t LL_CRC_GetPolynomialSize(CRC_TypeDef *CRCx)
<> 156:95d6b41a828b 214 {
<> 156:95d6b41a828b 215 return (uint32_t)(READ_BIT(CRCx->CR, CRC_CR_POLYSIZE));
<> 156:95d6b41a828b 216 }
<> 156:95d6b41a828b 217 #endif
<> 156:95d6b41a828b 218
<> 156:95d6b41a828b 219 /**
<> 156:95d6b41a828b 220 * @brief Configure the reversal of the bit order of the input data
<> 156:95d6b41a828b 221 * @rmtoll CR REV_IN LL_CRC_SetInputDataReverseMode
<> 156:95d6b41a828b 222 * @param CRCx CRC Instance
<> 156:95d6b41a828b 223 * @param ReverseMode This parameter can be one of the following values:
<> 156:95d6b41a828b 224 * @arg @ref LL_CRC_INDATA_REVERSE_NONE
<> 156:95d6b41a828b 225 * @arg @ref LL_CRC_INDATA_REVERSE_BYTE
<> 156:95d6b41a828b 226 * @arg @ref LL_CRC_INDATA_REVERSE_HALFWORD
<> 156:95d6b41a828b 227 * @arg @ref LL_CRC_INDATA_REVERSE_WORD
<> 156:95d6b41a828b 228 * @retval None
<> 156:95d6b41a828b 229 */
<> 156:95d6b41a828b 230 __STATIC_INLINE void LL_CRC_SetInputDataReverseMode(CRC_TypeDef *CRCx, uint32_t ReverseMode)
<> 156:95d6b41a828b 231 {
<> 156:95d6b41a828b 232 MODIFY_REG(CRCx->CR, CRC_CR_REV_IN, ReverseMode);
<> 156:95d6b41a828b 233 }
<> 156:95d6b41a828b 234
<> 156:95d6b41a828b 235 /**
<> 156:95d6b41a828b 236 * @brief Return type of reversal for input data bit order
<> 156:95d6b41a828b 237 * @rmtoll CR REV_IN LL_CRC_GetInputDataReverseMode
<> 156:95d6b41a828b 238 * @param CRCx CRC Instance
<> 156:95d6b41a828b 239 * @retval Returned value can be one of the following values:
<> 156:95d6b41a828b 240 * @arg @ref LL_CRC_INDATA_REVERSE_NONE
<> 156:95d6b41a828b 241 * @arg @ref LL_CRC_INDATA_REVERSE_BYTE
<> 156:95d6b41a828b 242 * @arg @ref LL_CRC_INDATA_REVERSE_HALFWORD
<> 156:95d6b41a828b 243 * @arg @ref LL_CRC_INDATA_REVERSE_WORD
<> 156:95d6b41a828b 244 */
<> 156:95d6b41a828b 245 __STATIC_INLINE uint32_t LL_CRC_GetInputDataReverseMode(CRC_TypeDef *CRCx)
<> 156:95d6b41a828b 246 {
<> 156:95d6b41a828b 247 return (uint32_t)(READ_BIT(CRCx->CR, CRC_CR_REV_IN));
<> 156:95d6b41a828b 248 }
<> 156:95d6b41a828b 249
<> 156:95d6b41a828b 250 /**
<> 156:95d6b41a828b 251 * @brief Configure the reversal of the bit order of the Output data
<> 156:95d6b41a828b 252 * @rmtoll CR REV_OUT LL_CRC_SetOutputDataReverseMode
<> 156:95d6b41a828b 253 * @param CRCx CRC Instance
<> 156:95d6b41a828b 254 * @param ReverseMode This parameter can be one of the following values:
<> 156:95d6b41a828b 255 * @arg @ref LL_CRC_OUTDATA_REVERSE_NONE
<> 156:95d6b41a828b 256 * @arg @ref LL_CRC_OUTDATA_REVERSE_BIT
<> 156:95d6b41a828b 257 * @retval None
<> 156:95d6b41a828b 258 */
<> 156:95d6b41a828b 259 __STATIC_INLINE void LL_CRC_SetOutputDataReverseMode(CRC_TypeDef *CRCx, uint32_t ReverseMode)
<> 156:95d6b41a828b 260 {
<> 156:95d6b41a828b 261 MODIFY_REG(CRCx->CR, CRC_CR_REV_OUT, ReverseMode);
<> 156:95d6b41a828b 262 }
<> 156:95d6b41a828b 263
<> 156:95d6b41a828b 264 /**
<> 156:95d6b41a828b 265 * @brief Configure the reversal of the bit order of the Output data
<> 156:95d6b41a828b 266 * @rmtoll CR REV_OUT LL_CRC_GetOutputDataReverseMode
<> 156:95d6b41a828b 267 * @param CRCx CRC Instance
<> 156:95d6b41a828b 268 * @retval Returned value can be one of the following values:
<> 156:95d6b41a828b 269 * @arg @ref LL_CRC_OUTDATA_REVERSE_NONE
<> 156:95d6b41a828b 270 * @arg @ref LL_CRC_OUTDATA_REVERSE_BIT
<> 156:95d6b41a828b 271 */
<> 156:95d6b41a828b 272 __STATIC_INLINE uint32_t LL_CRC_GetOutputDataReverseMode(CRC_TypeDef *CRCx)
<> 156:95d6b41a828b 273 {
<> 156:95d6b41a828b 274 return (uint32_t)(READ_BIT(CRCx->CR, CRC_CR_REV_OUT));
<> 156:95d6b41a828b 275 }
<> 156:95d6b41a828b 276
<> 156:95d6b41a828b 277 /**
<> 156:95d6b41a828b 278 * @brief Initialize the Programmable initial CRC value.
<> 156:95d6b41a828b 279 * @note If the CRC size is less than 32 bits, the least significant bits
<> 156:95d6b41a828b 280 * are used to write the correct value
<> 156:95d6b41a828b 281 * @note LL_CRC_DEFAULT_CRC_INITVALUE could be used as value for InitCrc parameter.
<> 156:95d6b41a828b 282 * @rmtoll INIT INIT LL_CRC_SetInitialData
<> 156:95d6b41a828b 283 * @param CRCx CRC Instance
<> 156:95d6b41a828b 284 * @param InitCrc Value to be programmed in Programmable initial CRC value register
<> 156:95d6b41a828b 285 * @retval None
<> 156:95d6b41a828b 286 */
<> 156:95d6b41a828b 287 __STATIC_INLINE void LL_CRC_SetInitialData(CRC_TypeDef *CRCx, uint32_t InitCrc)
<> 156:95d6b41a828b 288 {
<> 156:95d6b41a828b 289 WRITE_REG(CRCx->INIT, InitCrc);
<> 156:95d6b41a828b 290 }
<> 156:95d6b41a828b 291
<> 156:95d6b41a828b 292 /**
<> 156:95d6b41a828b 293 * @brief Return current Initial CRC value.
<> 156:95d6b41a828b 294 * @note If the CRC size is less than 32 bits, the least significant bits
<> 156:95d6b41a828b 295 * are used to read the correct value
<> 156:95d6b41a828b 296 * @rmtoll INIT INIT LL_CRC_GetInitialData
<> 156:95d6b41a828b 297 * @param CRCx CRC Instance
<> 156:95d6b41a828b 298 * @retval Value programmed in Programmable initial CRC value register
<> 156:95d6b41a828b 299 */
<> 156:95d6b41a828b 300 __STATIC_INLINE uint32_t LL_CRC_GetInitialData(CRC_TypeDef *CRCx)
<> 156:95d6b41a828b 301 {
<> 156:95d6b41a828b 302 return (uint32_t)(READ_REG(CRCx->INIT));
<> 156:95d6b41a828b 303 }
<> 156:95d6b41a828b 304
<> 156:95d6b41a828b 305 #if defined(CRC_PROG_POLYNOMIAL_SUPPORT)
<> 156:95d6b41a828b 306 /**
<> 156:95d6b41a828b 307 * @brief Initialize the Programmable polynomial value
<> 156:95d6b41a828b 308 * (coefficients of the polynomial to be used for CRC calculation).
<> 156:95d6b41a828b 309 * @note This function is available only on devices supporting
<> 156:95d6b41a828b 310 * Programmable Polynomial feature.
<> 156:95d6b41a828b 311 * @note LL_CRC_DEFAULT_CRC32_POLY could be used as value for PolynomCoef parameter.
<> 156:95d6b41a828b 312 * @note Please check Reference Manual and existing Errata Sheets,
<> 156:95d6b41a828b 313 * regarding possible limitations for Polynomial values usage.
<> 156:95d6b41a828b 314 * For example, for a polynomial of degree 7, X^7 + X^6 + X^5 + X^2 + 1 is written 0x65
<> 156:95d6b41a828b 315 * @rmtoll POL POL LL_CRC_SetPolynomialCoef
<> 156:95d6b41a828b 316 * @param CRCx CRC Instance
<> 156:95d6b41a828b 317 * @param PolynomCoef Value to be programmed in Programmable Polynomial value register
<> 156:95d6b41a828b 318 * @retval None
<> 156:95d6b41a828b 319 */
<> 156:95d6b41a828b 320 __STATIC_INLINE void LL_CRC_SetPolynomialCoef(CRC_TypeDef *CRCx, uint32_t PolynomCoef)
<> 156:95d6b41a828b 321 {
<> 156:95d6b41a828b 322 WRITE_REG(CRCx->POL, PolynomCoef);
<> 156:95d6b41a828b 323 }
<> 156:95d6b41a828b 324
<> 156:95d6b41a828b 325 /**
<> 156:95d6b41a828b 326 * @brief Return current Programmable polynomial value
<> 156:95d6b41a828b 327 * @note This function is available only on devices supporting
<> 156:95d6b41a828b 328 * Programmable Polynomial feature.
<> 156:95d6b41a828b 329 * @note Please check Reference Manual and existing Errata Sheets,
<> 156:95d6b41a828b 330 * regarding possible limitations for Polynomial values usage.
<> 156:95d6b41a828b 331 * For example, for a polynomial of degree 7, X^7 + X^6 + X^5 + X^2 + 1 is written 0x65
<> 156:95d6b41a828b 332 * @rmtoll POL POL LL_CRC_GetPolynomialCoef
<> 156:95d6b41a828b 333 * @param CRCx CRC Instance
<> 156:95d6b41a828b 334 * @retval Value programmed in Programmable Polynomial value register
<> 156:95d6b41a828b 335 */
<> 156:95d6b41a828b 336 __STATIC_INLINE uint32_t LL_CRC_GetPolynomialCoef(CRC_TypeDef *CRCx)
<> 156:95d6b41a828b 337 {
<> 156:95d6b41a828b 338 return (uint32_t)(READ_REG(CRCx->POL));
<> 156:95d6b41a828b 339 }
<> 156:95d6b41a828b 340 #endif
<> 156:95d6b41a828b 341
<> 156:95d6b41a828b 342 /**
<> 156:95d6b41a828b 343 * @}
<> 156:95d6b41a828b 344 */
<> 156:95d6b41a828b 345
<> 156:95d6b41a828b 346 /** @defgroup CRC_LL_EF_Data_Management Data_Management
<> 156:95d6b41a828b 347 * @{
<> 156:95d6b41a828b 348 */
<> 156:95d6b41a828b 349
<> 156:95d6b41a828b 350 /**
<> 156:95d6b41a828b 351 * @brief Write given 32-bit data to the CRC calculator
<> 156:95d6b41a828b 352 * @rmtoll DR DR LL_CRC_FeedData32
<> 156:95d6b41a828b 353 * @param CRCx CRC Instance
<> 156:95d6b41a828b 354 * @param InData value to be provided to CRC calculator between between Min_Data=0 and Max_Data=0xFFFFFFFF
<> 156:95d6b41a828b 355 * @retval None
<> 156:95d6b41a828b 356 */
<> 156:95d6b41a828b 357 __STATIC_INLINE void LL_CRC_FeedData32(CRC_TypeDef *CRCx, uint32_t InData)
<> 156:95d6b41a828b 358 {
<> 156:95d6b41a828b 359 WRITE_REG(CRCx->DR, InData);
<> 156:95d6b41a828b 360 }
<> 156:95d6b41a828b 361
<> 156:95d6b41a828b 362 /**
<> 156:95d6b41a828b 363 * @brief Write given 16-bit data to the CRC calculator
<> 156:95d6b41a828b 364 * @rmtoll DR DR LL_CRC_FeedData16
<> 156:95d6b41a828b 365 * @param CRCx CRC Instance
<> 156:95d6b41a828b 366 * @param InData 16 bit value to be provided to CRC calculator between between Min_Data=0 and Max_Data=0xFFFF
<> 156:95d6b41a828b 367 * @retval None
<> 156:95d6b41a828b 368 */
<> 156:95d6b41a828b 369 __STATIC_INLINE void LL_CRC_FeedData16(CRC_TypeDef *CRCx, uint16_t InData)
<> 156:95d6b41a828b 370 {
<> 156:95d6b41a828b 371 *(uint16_t __IO *)(&CRCx->DR) = (uint16_t) InData;
<> 156:95d6b41a828b 372 }
<> 156:95d6b41a828b 373
<> 156:95d6b41a828b 374 /**
<> 156:95d6b41a828b 375 * @brief Write given 8-bit data to the CRC calculator
<> 156:95d6b41a828b 376 * @rmtoll DR DR LL_CRC_FeedData8
<> 156:95d6b41a828b 377 * @param CRCx CRC Instance
<> 156:95d6b41a828b 378 * @param InData 8 bit value to be provided to CRC calculator between between Min_Data=0 and Max_Data=0xFF
<> 156:95d6b41a828b 379 * @retval None
<> 156:95d6b41a828b 380 */
<> 156:95d6b41a828b 381 __STATIC_INLINE void LL_CRC_FeedData8(CRC_TypeDef *CRCx, uint8_t InData)
<> 156:95d6b41a828b 382 {
<> 156:95d6b41a828b 383 *(uint8_t __IO *)(&CRCx->DR) = (uint8_t) InData;
<> 156:95d6b41a828b 384 }
<> 156:95d6b41a828b 385
<> 156:95d6b41a828b 386 /**
<> 156:95d6b41a828b 387 * @brief Return current CRC calculation result. 32 bits value is returned.
<> 156:95d6b41a828b 388 * @rmtoll DR DR LL_CRC_ReadData32
<> 156:95d6b41a828b 389 * @param CRCx CRC Instance
<> 156:95d6b41a828b 390 * @retval Current CRC calculation result as stored in CRC_DR register (32 bits).
<> 156:95d6b41a828b 391 */
<> 156:95d6b41a828b 392 __STATIC_INLINE uint32_t LL_CRC_ReadData32(CRC_TypeDef *CRCx)
<> 156:95d6b41a828b 393 {
<> 156:95d6b41a828b 394 return (uint32_t)(READ_REG(CRCx->DR));
<> 156:95d6b41a828b 395 }
<> 156:95d6b41a828b 396
<> 156:95d6b41a828b 397 #if defined(CRC_PROG_POLYNOMIAL_SUPPORT)
<> 156:95d6b41a828b 398 /**
<> 156:95d6b41a828b 399 * @brief Return current CRC calculation result. 16 bits value is returned.
<> 156:95d6b41a828b 400 * @note This function is expected to be used in a 16 bits CRC polynomial size context.
<> 156:95d6b41a828b 401 * @note This function is available only on devices supporting
<> 156:95d6b41a828b 402 * Programmable Polynomial feature.
<> 156:95d6b41a828b 403 * @rmtoll DR DR LL_CRC_ReadData16
<> 156:95d6b41a828b 404 * @param CRCx CRC Instance
<> 156:95d6b41a828b 405 * @retval Current CRC calculation result as stored in CRC_DR register (16 bits).
<> 156:95d6b41a828b 406 */
<> 156:95d6b41a828b 407 __STATIC_INLINE uint16_t LL_CRC_ReadData16(CRC_TypeDef *CRCx)
<> 156:95d6b41a828b 408 {
<> 156:95d6b41a828b 409 return (uint16_t)READ_REG(CRCx->DR);
<> 156:95d6b41a828b 410 }
<> 156:95d6b41a828b 411
<> 156:95d6b41a828b 412 /**
<> 156:95d6b41a828b 413 * @brief Return current CRC calculation result. 8 bits value is returned.
<> 156:95d6b41a828b 414 * @note This function is expected to be used in a 8 bits CRC polynomial size context.
<> 156:95d6b41a828b 415 * @note This function is available only on devices supporting
<> 156:95d6b41a828b 416 * Programmable Polynomial feature.
<> 156:95d6b41a828b 417 * @rmtoll DR DR LL_CRC_ReadData8
<> 156:95d6b41a828b 418 * @param CRCx CRC Instance
<> 156:95d6b41a828b 419 * @retval Current CRC calculation result as stored in CRC_DR register (8 bits).
<> 156:95d6b41a828b 420 */
<> 156:95d6b41a828b 421 __STATIC_INLINE uint8_t LL_CRC_ReadData8(CRC_TypeDef *CRCx)
<> 156:95d6b41a828b 422 {
<> 156:95d6b41a828b 423 return (uint8_t)READ_REG(CRCx->DR);
<> 156:95d6b41a828b 424 }
<> 156:95d6b41a828b 425
<> 156:95d6b41a828b 426 /**
<> 156:95d6b41a828b 427 * @brief Return current CRC calculation result. 7 bits value is returned.
<> 156:95d6b41a828b 428 * @note This function is expected to be used in a 7 bits CRC polynomial size context.
<> 156:95d6b41a828b 429 * @note This function is available only on devices supporting
<> 156:95d6b41a828b 430 * Programmable Polynomial feature.
<> 156:95d6b41a828b 431 * @rmtoll DR DR LL_CRC_ReadData7
<> 156:95d6b41a828b 432 * @param CRCx CRC Instance
<> 156:95d6b41a828b 433 * @retval Current CRC calculation result as stored in CRC_DR register (7 bits).
<> 156:95d6b41a828b 434 */
<> 156:95d6b41a828b 435 __STATIC_INLINE uint8_t LL_CRC_ReadData7(CRC_TypeDef *CRCx)
<> 156:95d6b41a828b 436 {
<> 156:95d6b41a828b 437 return (uint8_t)(READ_REG(CRCx->DR) & 0x7FU);
<> 156:95d6b41a828b 438 }
<> 156:95d6b41a828b 439 #endif
<> 156:95d6b41a828b 440
<> 156:95d6b41a828b 441 /**
<> 156:95d6b41a828b 442 * @brief Return data stored in the Independent Data(IDR) register.
<> 156:95d6b41a828b 443 * @note This register can be used as a temporary storage location for one byte.
<> 156:95d6b41a828b 444 * @rmtoll IDR IDR LL_CRC_Read_IDR
<> 156:95d6b41a828b 445 * @param CRCx CRC Instance
<> 156:95d6b41a828b 446 * @retval Value stored in CRC_IDR register (General-purpose 8-bit data register).
<> 156:95d6b41a828b 447 */
<> 156:95d6b41a828b 448 __STATIC_INLINE uint32_t LL_CRC_Read_IDR(CRC_TypeDef *CRCx)
<> 156:95d6b41a828b 449 {
<> 156:95d6b41a828b 450 return (uint32_t)(READ_REG(CRCx->IDR));
<> 156:95d6b41a828b 451 }
<> 156:95d6b41a828b 452
<> 156:95d6b41a828b 453 /**
<> 156:95d6b41a828b 454 * @brief Store data in the Independent Data(IDR) register.
<> 156:95d6b41a828b 455 * @note This register can be used as a temporary storage location for one byte.
<> 156:95d6b41a828b 456 * @rmtoll IDR IDR LL_CRC_Write_IDR
<> 156:95d6b41a828b 457 * @param CRCx CRC Instance
<> 156:95d6b41a828b 458 * @param InData value to be stored in CRC_IDR register (8-bit) between between Min_Data=0 and Max_Data=0xFF
<> 156:95d6b41a828b 459 * @retval None
<> 156:95d6b41a828b 460 */
<> 156:95d6b41a828b 461 __STATIC_INLINE void LL_CRC_Write_IDR(CRC_TypeDef *CRCx, uint32_t InData)
<> 156:95d6b41a828b 462 {
<> 156:95d6b41a828b 463 *((uint8_t __IO *)(&CRCx->IDR)) = (uint8_t) InData;
<> 156:95d6b41a828b 464 }
<> 156:95d6b41a828b 465 /**
<> 156:95d6b41a828b 466 * @}
<> 156:95d6b41a828b 467 */
<> 156:95d6b41a828b 468
<> 156:95d6b41a828b 469 #if defined(USE_FULL_LL_DRIVER)
<> 156:95d6b41a828b 470 /** @defgroup CRC_LL_EF_Init Initialization and de-initialization functions
<> 156:95d6b41a828b 471 * @{
<> 156:95d6b41a828b 472 */
<> 156:95d6b41a828b 473
<> 156:95d6b41a828b 474 ErrorStatus LL_CRC_DeInit(CRC_TypeDef *CRCx);
<> 156:95d6b41a828b 475
<> 156:95d6b41a828b 476 /**
<> 156:95d6b41a828b 477 * @}
<> 156:95d6b41a828b 478 */
<> 156:95d6b41a828b 479 #endif /* USE_FULL_LL_DRIVER */
<> 156:95d6b41a828b 480
<> 156:95d6b41a828b 481 /**
<> 156:95d6b41a828b 482 * @}
<> 156:95d6b41a828b 483 */
<> 156:95d6b41a828b 484
<> 156:95d6b41a828b 485 /**
<> 156:95d6b41a828b 486 * @}
<> 156:95d6b41a828b 487 */
<> 156:95d6b41a828b 488
<> 156:95d6b41a828b 489 #endif /* defined(CRC) */
<> 156:95d6b41a828b 490
<> 156:95d6b41a828b 491 /**
<> 156:95d6b41a828b 492 * @}
<> 156:95d6b41a828b 493 */
<> 156:95d6b41a828b 494
<> 156:95d6b41a828b 495 #ifdef __cplusplus
<> 156:95d6b41a828b 496 }
<> 156:95d6b41a828b 497 #endif
<> 156:95d6b41a828b 498
<> 156:95d6b41a828b 499 #endif /* __STM32F0xx_LL_CRC_H */
<> 156:95d6b41a828b 500
<> 156:95d6b41a828b 501 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/