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