001
targets/TARGET_STM/TARGET_STM32F4/device/stm32f4xx_ll_crc.h@0:13413ea9a877, 2022-06-12 (annotated)
- Committer:
- ganlikun
- Date:
- Sun Jun 12 14:02:44 2022 +0000
- Revision:
- 0:13413ea9a877
00
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ganlikun | 0:13413ea9a877 | 1 | /** |
ganlikun | 0:13413ea9a877 | 2 | ****************************************************************************** |
ganlikun | 0:13413ea9a877 | 3 | * @file stm32f4xx_ll_crc.h |
ganlikun | 0:13413ea9a877 | 4 | * @author MCD Application Team |
ganlikun | 0:13413ea9a877 | 5 | * @version V1.7.1 |
ganlikun | 0:13413ea9a877 | 6 | * @date 14-April-2017 |
ganlikun | 0:13413ea9a877 | 7 | * @brief Header file of CRC LL module. |
ganlikun | 0:13413ea9a877 | 8 | ****************************************************************************** |
ganlikun | 0:13413ea9a877 | 9 | * @attention |
ganlikun | 0:13413ea9a877 | 10 | * |
ganlikun | 0:13413ea9a877 | 11 | * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> |
ganlikun | 0:13413ea9a877 | 12 | * |
ganlikun | 0:13413ea9a877 | 13 | * Redistribution and use in source and binary forms, with or without modification, |
ganlikun | 0:13413ea9a877 | 14 | * are permitted provided that the following conditions are met: |
ganlikun | 0:13413ea9a877 | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
ganlikun | 0:13413ea9a877 | 16 | * this list of conditions and the following disclaimer. |
ganlikun | 0:13413ea9a877 | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
ganlikun | 0:13413ea9a877 | 18 | * this list of conditions and the following disclaimer in the documentation |
ganlikun | 0:13413ea9a877 | 19 | * and/or other materials provided with the distribution. |
ganlikun | 0:13413ea9a877 | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
ganlikun | 0:13413ea9a877 | 21 | * may be used to endorse or promote products derived from this software |
ganlikun | 0:13413ea9a877 | 22 | * without specific prior written permission. |
ganlikun | 0:13413ea9a877 | 23 | * |
ganlikun | 0:13413ea9a877 | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
ganlikun | 0:13413ea9a877 | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
ganlikun | 0:13413ea9a877 | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
ganlikun | 0:13413ea9a877 | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
ganlikun | 0:13413ea9a877 | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
ganlikun | 0:13413ea9a877 | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
ganlikun | 0:13413ea9a877 | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
ganlikun | 0:13413ea9a877 | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
ganlikun | 0:13413ea9a877 | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
ganlikun | 0:13413ea9a877 | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
ganlikun | 0:13413ea9a877 | 34 | * |
ganlikun | 0:13413ea9a877 | 35 | ****************************************************************************** |
ganlikun | 0:13413ea9a877 | 36 | */ |
ganlikun | 0:13413ea9a877 | 37 | |
ganlikun | 0:13413ea9a877 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
ganlikun | 0:13413ea9a877 | 39 | #ifndef __STM32F4xx_LL_CRC_H |
ganlikun | 0:13413ea9a877 | 40 | #define __STM32F4xx_LL_CRC_H |
ganlikun | 0:13413ea9a877 | 41 | |
ganlikun | 0:13413ea9a877 | 42 | #ifdef __cplusplus |
ganlikun | 0:13413ea9a877 | 43 | extern "C" { |
ganlikun | 0:13413ea9a877 | 44 | #endif |
ganlikun | 0:13413ea9a877 | 45 | |
ganlikun | 0:13413ea9a877 | 46 | /* Includes ------------------------------------------------------------------*/ |
ganlikun | 0:13413ea9a877 | 47 | #include "stm32f4xx.h" |
ganlikun | 0:13413ea9a877 | 48 | |
ganlikun | 0:13413ea9a877 | 49 | /** @addtogroup STM32F4xx_LL_Driver |
ganlikun | 0:13413ea9a877 | 50 | * @{ |
ganlikun | 0:13413ea9a877 | 51 | */ |
ganlikun | 0:13413ea9a877 | 52 | |
ganlikun | 0:13413ea9a877 | 53 | #if defined(CRC) |
ganlikun | 0:13413ea9a877 | 54 | |
ganlikun | 0:13413ea9a877 | 55 | /** @defgroup CRC_LL CRC |
ganlikun | 0:13413ea9a877 | 56 | * @{ |
ganlikun | 0:13413ea9a877 | 57 | */ |
ganlikun | 0:13413ea9a877 | 58 | |
ganlikun | 0:13413ea9a877 | 59 | /* Private types -------------------------------------------------------------*/ |
ganlikun | 0:13413ea9a877 | 60 | /* Private variables ---------------------------------------------------------*/ |
ganlikun | 0:13413ea9a877 | 61 | /* Private constants ---------------------------------------------------------*/ |
ganlikun | 0:13413ea9a877 | 62 | /* Private macros ------------------------------------------------------------*/ |
ganlikun | 0:13413ea9a877 | 63 | |
ganlikun | 0:13413ea9a877 | 64 | /* Exported types ------------------------------------------------------------*/ |
ganlikun | 0:13413ea9a877 | 65 | /* Exported constants --------------------------------------------------------*/ |
ganlikun | 0:13413ea9a877 | 66 | |
ganlikun | 0:13413ea9a877 | 67 | /* Exported macro ------------------------------------------------------------*/ |
ganlikun | 0:13413ea9a877 | 68 | /** @defgroup CRC_LL_Exported_Macros CRC Exported Macros |
ganlikun | 0:13413ea9a877 | 69 | * @{ |
ganlikun | 0:13413ea9a877 | 70 | */ |
ganlikun | 0:13413ea9a877 | 71 | |
ganlikun | 0:13413ea9a877 | 72 | /** @defgroup CRC_LL_EM_WRITE_READ Common Write and read registers Macros |
ganlikun | 0:13413ea9a877 | 73 | * @{ |
ganlikun | 0:13413ea9a877 | 74 | */ |
ganlikun | 0:13413ea9a877 | 75 | |
ganlikun | 0:13413ea9a877 | 76 | /** |
ganlikun | 0:13413ea9a877 | 77 | * @brief Write a value in CRC register |
ganlikun | 0:13413ea9a877 | 78 | * @param __INSTANCE__ CRC Instance |
ganlikun | 0:13413ea9a877 | 79 | * @param __REG__ Register to be written |
ganlikun | 0:13413ea9a877 | 80 | * @param __VALUE__ Value to be written in the register |
ganlikun | 0:13413ea9a877 | 81 | * @retval None |
ganlikun | 0:13413ea9a877 | 82 | */ |
ganlikun | 0:13413ea9a877 | 83 | #define LL_CRC_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__)) |
ganlikun | 0:13413ea9a877 | 84 | |
ganlikun | 0:13413ea9a877 | 85 | /** |
ganlikun | 0:13413ea9a877 | 86 | * @brief Read a value in CRC register |
ganlikun | 0:13413ea9a877 | 87 | * @param __INSTANCE__ CRC Instance |
ganlikun | 0:13413ea9a877 | 88 | * @param __REG__ Register to be read |
ganlikun | 0:13413ea9a877 | 89 | * @retval Register value |
ganlikun | 0:13413ea9a877 | 90 | */ |
ganlikun | 0:13413ea9a877 | 91 | #define LL_CRC_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__) |
ganlikun | 0:13413ea9a877 | 92 | /** |
ganlikun | 0:13413ea9a877 | 93 | * @} |
ganlikun | 0:13413ea9a877 | 94 | */ |
ganlikun | 0:13413ea9a877 | 95 | |
ganlikun | 0:13413ea9a877 | 96 | /** |
ganlikun | 0:13413ea9a877 | 97 | * @} |
ganlikun | 0:13413ea9a877 | 98 | */ |
ganlikun | 0:13413ea9a877 | 99 | |
ganlikun | 0:13413ea9a877 | 100 | |
ganlikun | 0:13413ea9a877 | 101 | /* Exported functions --------------------------------------------------------*/ |
ganlikun | 0:13413ea9a877 | 102 | /** @defgroup CRC_LL_Exported_Functions CRC Exported Functions |
ganlikun | 0:13413ea9a877 | 103 | * @{ |
ganlikun | 0:13413ea9a877 | 104 | */ |
ganlikun | 0:13413ea9a877 | 105 | |
ganlikun | 0:13413ea9a877 | 106 | /** @defgroup CRC_LL_EF_Configuration CRC Configuration functions |
ganlikun | 0:13413ea9a877 | 107 | * @{ |
ganlikun | 0:13413ea9a877 | 108 | */ |
ganlikun | 0:13413ea9a877 | 109 | |
ganlikun | 0:13413ea9a877 | 110 | /** |
ganlikun | 0:13413ea9a877 | 111 | * @brief Reset the CRC calculation unit. |
ganlikun | 0:13413ea9a877 | 112 | * @rmtoll CR RESET LL_CRC_ResetCRCCalculationUnit |
ganlikun | 0:13413ea9a877 | 113 | * @param CRCx CRC Instance |
ganlikun | 0:13413ea9a877 | 114 | * @retval None |
ganlikun | 0:13413ea9a877 | 115 | */ |
ganlikun | 0:13413ea9a877 | 116 | __STATIC_INLINE void LL_CRC_ResetCRCCalculationUnit(CRC_TypeDef *CRCx) |
ganlikun | 0:13413ea9a877 | 117 | { |
ganlikun | 0:13413ea9a877 | 118 | WRITE_REG(CRCx->CR, CRC_CR_RESET); |
ganlikun | 0:13413ea9a877 | 119 | } |
ganlikun | 0:13413ea9a877 | 120 | |
ganlikun | 0:13413ea9a877 | 121 | /** |
ganlikun | 0:13413ea9a877 | 122 | * @} |
ganlikun | 0:13413ea9a877 | 123 | */ |
ganlikun | 0:13413ea9a877 | 124 | |
ganlikun | 0:13413ea9a877 | 125 | /** @defgroup CRC_LL_EF_Data_Management Data_Management |
ganlikun | 0:13413ea9a877 | 126 | * @{ |
ganlikun | 0:13413ea9a877 | 127 | */ |
ganlikun | 0:13413ea9a877 | 128 | |
ganlikun | 0:13413ea9a877 | 129 | /** |
ganlikun | 0:13413ea9a877 | 130 | * @brief Write given 32-bit data to the CRC calculator |
ganlikun | 0:13413ea9a877 | 131 | * @rmtoll DR DR LL_CRC_FeedData32 |
ganlikun | 0:13413ea9a877 | 132 | * @param CRCx CRC Instance |
ganlikun | 0:13413ea9a877 | 133 | * @param InData value to be provided to CRC calculator between between Min_Data=0 and Max_Data=0xFFFFFFFF |
ganlikun | 0:13413ea9a877 | 134 | * @retval None |
ganlikun | 0:13413ea9a877 | 135 | */ |
ganlikun | 0:13413ea9a877 | 136 | __STATIC_INLINE void LL_CRC_FeedData32(CRC_TypeDef *CRCx, uint32_t InData) |
ganlikun | 0:13413ea9a877 | 137 | { |
ganlikun | 0:13413ea9a877 | 138 | WRITE_REG(CRCx->DR, InData); |
ganlikun | 0:13413ea9a877 | 139 | } |
ganlikun | 0:13413ea9a877 | 140 | |
ganlikun | 0:13413ea9a877 | 141 | /** |
ganlikun | 0:13413ea9a877 | 142 | * @brief Return current CRC calculation result. 32 bits value is returned. |
ganlikun | 0:13413ea9a877 | 143 | * @rmtoll DR DR LL_CRC_ReadData32 |
ganlikun | 0:13413ea9a877 | 144 | * @param CRCx CRC Instance |
ganlikun | 0:13413ea9a877 | 145 | * @retval Current CRC calculation result as stored in CRC_DR register (32 bits). |
ganlikun | 0:13413ea9a877 | 146 | */ |
ganlikun | 0:13413ea9a877 | 147 | __STATIC_INLINE uint32_t LL_CRC_ReadData32(CRC_TypeDef *CRCx) |
ganlikun | 0:13413ea9a877 | 148 | { |
ganlikun | 0:13413ea9a877 | 149 | return (uint32_t)(READ_REG(CRCx->DR)); |
ganlikun | 0:13413ea9a877 | 150 | } |
ganlikun | 0:13413ea9a877 | 151 | |
ganlikun | 0:13413ea9a877 | 152 | /** |
ganlikun | 0:13413ea9a877 | 153 | * @brief Return data stored in the Independent Data(IDR) register. |
ganlikun | 0:13413ea9a877 | 154 | * @note This register can be used as a temporary storage location for one byte. |
ganlikun | 0:13413ea9a877 | 155 | * @rmtoll IDR IDR LL_CRC_Read_IDR |
ganlikun | 0:13413ea9a877 | 156 | * @param CRCx CRC Instance |
ganlikun | 0:13413ea9a877 | 157 | * @retval Value stored in CRC_IDR register (General-purpose 8-bit data register). |
ganlikun | 0:13413ea9a877 | 158 | */ |
ganlikun | 0:13413ea9a877 | 159 | __STATIC_INLINE uint32_t LL_CRC_Read_IDR(CRC_TypeDef *CRCx) |
ganlikun | 0:13413ea9a877 | 160 | { |
ganlikun | 0:13413ea9a877 | 161 | return (uint32_t)(READ_REG(CRCx->IDR)); |
ganlikun | 0:13413ea9a877 | 162 | } |
ganlikun | 0:13413ea9a877 | 163 | |
ganlikun | 0:13413ea9a877 | 164 | /** |
ganlikun | 0:13413ea9a877 | 165 | * @brief Store data in the Independent Data(IDR) register. |
ganlikun | 0:13413ea9a877 | 166 | * @note This register can be used as a temporary storage location for one byte. |
ganlikun | 0:13413ea9a877 | 167 | * @rmtoll IDR IDR LL_CRC_Write_IDR |
ganlikun | 0:13413ea9a877 | 168 | * @param CRCx CRC Instance |
ganlikun | 0:13413ea9a877 | 169 | * @param InData value to be stored in CRC_IDR register (8-bit) between between Min_Data=0 and Max_Data=0xFF |
ganlikun | 0:13413ea9a877 | 170 | * @retval None |
ganlikun | 0:13413ea9a877 | 171 | */ |
ganlikun | 0:13413ea9a877 | 172 | __STATIC_INLINE void LL_CRC_Write_IDR(CRC_TypeDef *CRCx, uint32_t InData) |
ganlikun | 0:13413ea9a877 | 173 | { |
ganlikun | 0:13413ea9a877 | 174 | *((uint8_t __IO *)(&CRCx->IDR)) = (uint8_t) InData; |
ganlikun | 0:13413ea9a877 | 175 | } |
ganlikun | 0:13413ea9a877 | 176 | /** |
ganlikun | 0:13413ea9a877 | 177 | * @} |
ganlikun | 0:13413ea9a877 | 178 | */ |
ganlikun | 0:13413ea9a877 | 179 | |
ganlikun | 0:13413ea9a877 | 180 | #if defined(USE_FULL_LL_DRIVER) |
ganlikun | 0:13413ea9a877 | 181 | /** @defgroup CRC_LL_EF_Init Initialization and de-initialization functions |
ganlikun | 0:13413ea9a877 | 182 | * @{ |
ganlikun | 0:13413ea9a877 | 183 | */ |
ganlikun | 0:13413ea9a877 | 184 | |
ganlikun | 0:13413ea9a877 | 185 | ErrorStatus LL_CRC_DeInit(CRC_TypeDef *CRCx); |
ganlikun | 0:13413ea9a877 | 186 | |
ganlikun | 0:13413ea9a877 | 187 | /** |
ganlikun | 0:13413ea9a877 | 188 | * @} |
ganlikun | 0:13413ea9a877 | 189 | */ |
ganlikun | 0:13413ea9a877 | 190 | #endif /* USE_FULL_LL_DRIVER */ |
ganlikun | 0:13413ea9a877 | 191 | |
ganlikun | 0:13413ea9a877 | 192 | /** |
ganlikun | 0:13413ea9a877 | 193 | * @} |
ganlikun | 0:13413ea9a877 | 194 | */ |
ganlikun | 0:13413ea9a877 | 195 | |
ganlikun | 0:13413ea9a877 | 196 | /** |
ganlikun | 0:13413ea9a877 | 197 | * @} |
ganlikun | 0:13413ea9a877 | 198 | */ |
ganlikun | 0:13413ea9a877 | 199 | |
ganlikun | 0:13413ea9a877 | 200 | #endif /* defined(CRC) */ |
ganlikun | 0:13413ea9a877 | 201 | |
ganlikun | 0:13413ea9a877 | 202 | /** |
ganlikun | 0:13413ea9a877 | 203 | * @} |
ganlikun | 0:13413ea9a877 | 204 | */ |
ganlikun | 0:13413ea9a877 | 205 | |
ganlikun | 0:13413ea9a877 | 206 | #ifdef __cplusplus |
ganlikun | 0:13413ea9a877 | 207 | } |
ganlikun | 0:13413ea9a877 | 208 | #endif |
ganlikun | 0:13413ea9a877 | 209 | |
ganlikun | 0:13413ea9a877 | 210 | #endif /* __STM32F4xx_LL_CRC_H */ |
ganlikun | 0:13413ea9a877 | 211 | |
ganlikun | 0:13413ea9a877 | 212 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
ganlikun | 0:13413ea9a877 | 213 |