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.

Committer:
<>
Date:
Wed Apr 12 16:07:08 2017 +0100
Revision:
140:97feb9bacc10
Parent:
128:9bcdf88f62b0
Child:
145:64910690c574
Release 140 of the mbed library

Ports for Upcoming Targets

3841: Add nRf52840 target https://github.com/ARMmbed/mbed-os/pull/3841
3992: Introducing UBLOX_C030 platform. https://github.com/ARMmbed/mbed-os/pull/3992

Fixes and Changes

3951: [NUCLEO_F303ZE] Correct ARDUINO pin https://github.com/ARMmbed/mbed-os/pull/3951
4021: Fixing a macro to detect when RTOS was in use for the NRF52840_DK https://github.com/ARMmbed/mbed-os/pull/4021
3979: KW24D: Add missing SPI defines and Arduino connector definitions https://github.com/ARMmbed/mbed-os/pull/3979
3990: UBLOX_C027: construct a ticker-based wait, rather than calling wait_ms(), in the https://github.com/ARMmbed/mbed-os/pull/3990
4003: Fixed OBOE in async serial tx for NRF52 target, fixes #4002 https://github.com/ARMmbed/mbed-os/pull/4003
4012: STM32: Correct I2C master error handling https://github.com/ARMmbed/mbed-os/pull/4012
4020: NUCLEO_L011K4 remove unsupported tool chain files https://github.com/ARMmbed/mbed-os/pull/4020
4065: K66F: Move bss section to m_data_2 Section https://github.com/ARMmbed/mbed-os/pull/4065
4014: Issue 3763: Reduce heap allocation in the GCC linker file https://github.com/ARMmbed/mbed-os/pull/4014
4030: [STM32L0] reduce IAR heap and stack size for small targets https://github.com/ARMmbed/mbed-os/pull/4030
4109: NUCLEO_L476RG : minor serial pin update https://github.com/ARMmbed/mbed-os/pull/4109
3982: Ticker - kl25z bugfix for handling events in the past https://github.com/ARMmbed/mbed-os/pull/3982

Who changed what in which revision?

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