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