Iftikhar Aziz / mbed-dev

Dependents:   LSS_Rev_1

Fork of mbed-dev by Umar Naeem

Committer:
<>
Date:
Thu Mar 30 13:45:57 2017 +0100
Revision:
161:2cc1468da177
This updates the lib to the mbed lib v139

Who changed what in which revision?

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