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. |
||
| 10 | * All rights reserved.</center></h2> |
||
| 11 | * |
||
| 12 | * This software component is licensed by ST under BSD 3-Clause license, |
||
| 13 | * the "License"; You may not use this file except in compliance with the |
||
| 14 | * License. You may obtain a copy of the License at: |
||
| 15 | * opensource.org/licenses/BSD-3-Clause |
||
| 16 | * |
||
| 17 | ****************************************************************************** |
||
| 18 | */ |
||
| 19 | |||
| 20 | /* Define to prevent recursive inclusion -------------------------------------*/ |
||
| 21 | #ifndef STM32F1xx_LL_CRC_H |
||
| 22 | #define STM32F1xx_LL_CRC_H |
||
| 23 | |||
| 24 | #ifdef __cplusplus |
||
| 25 | extern "C" { |
||
| 26 | #endif |
||
| 27 | |||
| 28 | /* Includes ------------------------------------------------------------------*/ |
||
| 29 | #include "stm32f1xx.h" |
||
| 30 | |||
| 31 | /** @addtogroup STM32F1xx_LL_Driver |
||
| 32 | * @{ |
||
| 33 | */ |
||
| 34 | |||
| 35 | #if defined(CRC) |
||
| 36 | |||
| 37 | /** @defgroup CRC_LL CRC |
||
| 38 | * @{ |
||
| 39 | */ |
||
| 40 | |||
| 41 | /* Private types -------------------------------------------------------------*/ |
||
| 42 | /* Private variables ---------------------------------------------------------*/ |
||
| 43 | /* Private constants ---------------------------------------------------------*/ |
||
| 44 | /* Private macros ------------------------------------------------------------*/ |
||
| 45 | |||
| 46 | /* Exported types ------------------------------------------------------------*/ |
||
| 47 | /* Exported constants --------------------------------------------------------*/ |
||
| 48 | /** @defgroup CRC_LL_Exported_Constants CRC Exported Constants |
||
| 49 | * @{ |
||
| 50 | */ |
||
| 51 | |||
| 52 | /** |
||
| 53 | * @} |
||
| 54 | */ |
||
| 55 | |||
| 56 | /* Exported macro ------------------------------------------------------------*/ |
||
| 57 | /** @defgroup CRC_LL_Exported_Macros CRC Exported Macros |
||
| 58 | * @{ |
||
| 59 | */ |
||
| 60 | |||
| 61 | /** @defgroup CRC_LL_EM_WRITE_READ Common Write and read registers Macros |
||
| 62 | * @{ |
||
| 63 | */ |
||
| 64 | |||
| 65 | /** |
||
| 66 | * @brief Write a value in CRC register |
||
| 67 | * @param __INSTANCE__ CRC Instance |
||
| 68 | * @param __REG__ Register to be written |
||
| 69 | * @param __VALUE__ Value to be written in the register |
||
| 70 | * @retval None |
||
| 71 | */ |
||
| 72 | #define LL_CRC_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, __VALUE__) |
||
| 73 | |||
| 74 | /** |
||
| 75 | * @brief Read a value in CRC register |
||
| 76 | * @param __INSTANCE__ CRC Instance |
||
| 77 | * @param __REG__ Register to be read |
||
| 78 | * @retval Register value |
||
| 79 | */ |
||
| 80 | #define LL_CRC_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__) |
||
| 81 | /** |
||
| 82 | * @} |
||
| 83 | */ |
||
| 84 | |||
| 85 | /** |
||
| 86 | * @} |
||
| 87 | */ |
||
| 88 | |||
| 89 | |||
| 90 | /* Exported functions --------------------------------------------------------*/ |
||
| 91 | /** @defgroup CRC_LL_Exported_Functions CRC Exported Functions |
||
| 92 | * @{ |
||
| 93 | */ |
||
| 94 | |||
| 95 | /** @defgroup CRC_LL_EF_Configuration CRC Configuration functions |
||
| 96 | * @{ |
||
| 97 | */ |
||
| 98 | |||
| 99 | /** |
||
| 100 | * @brief Reset the CRC calculation unit. |
||
| 101 | * @note If Programmable Initial CRC value feature |
||
| 102 | * is available, also set the Data Register to the value stored in the |
||
| 103 | * CRC_INIT register, otherwise, reset Data Register to its default value. |
||
| 104 | * @rmtoll CR RESET LL_CRC_ResetCRCCalculationUnit |
||
| 105 | * @param CRCx CRC Instance |
||
| 106 | * @retval None |
||
| 107 | */ |
||
| 108 | __STATIC_INLINE void LL_CRC_ResetCRCCalculationUnit(CRC_TypeDef *CRCx) |
||
| 109 | { |
||
| 110 | SET_BIT(CRCx->CR, CRC_CR_RESET); |
||
| 111 | } |
||
| 112 | |||
| 113 | /** |
||
| 114 | * @} |
||
| 115 | */ |
||
| 116 | |||
| 117 | /** @defgroup CRC_LL_EF_Data_Management Data_Management |
||
| 118 | * @{ |
||
| 119 | */ |
||
| 120 | |||
| 121 | /** |
||
| 122 | * @brief Write given 32-bit data to the CRC calculator |
||
| 123 | * @rmtoll DR DR LL_CRC_FeedData32 |
||
| 124 | * @param CRCx CRC Instance |
||
| 125 | * @param InData value to be provided to CRC calculator between between Min_Data=0 and Max_Data=0xFFFFFFFF |
||
| 126 | * @retval None |
||
| 127 | */ |
||
| 128 | __STATIC_INLINE void LL_CRC_FeedData32(CRC_TypeDef *CRCx, uint32_t InData) |
||
| 129 | { |
||
| 130 | WRITE_REG(CRCx->DR, InData); |
||
| 131 | } |
||
| 132 | |||
| 133 | /** |
||
| 134 | * @brief Return current CRC calculation result. 32 bits value is returned. |
||
| 135 | * @rmtoll DR DR LL_CRC_ReadData32 |
||
| 136 | * @param CRCx CRC Instance |
||
| 137 | * @retval Current CRC calculation result as stored in CRC_DR register (32 bits). |
||
| 138 | */ |
||
| 139 | __STATIC_INLINE uint32_t LL_CRC_ReadData32(CRC_TypeDef *CRCx) |
||
| 140 | { |
||
| 141 | return (uint32_t)(READ_REG(CRCx->DR)); |
||
| 142 | } |
||
| 143 | |||
| 144 | /** |
||
| 145 | * @brief Return data stored in the Independent Data(IDR) register. |
||
| 146 | * @note This register can be used as a temporary storage location for one byte. |
||
| 147 | * @rmtoll IDR IDR LL_CRC_Read_IDR |
||
| 148 | * @param CRCx CRC Instance |
||
| 149 | * @retval Value stored in CRC_IDR register (General-purpose 8-bit data register). |
||
| 150 | */ |
||
| 151 | __STATIC_INLINE uint32_t LL_CRC_Read_IDR(CRC_TypeDef *CRCx) |
||
| 152 | { |
||
| 153 | return (uint32_t)(READ_REG(CRCx->IDR)); |
||
| 154 | } |
||
| 155 | |||
| 156 | /** |
||
| 157 | * @brief Store data in the Independent Data(IDR) register. |
||
| 158 | * @note This register can be used as a temporary storage location for one byte. |
||
| 159 | * @rmtoll IDR IDR LL_CRC_Write_IDR |
||
| 160 | * @param CRCx CRC Instance |
||
| 161 | * @param InData value to be stored in CRC_IDR register (8-bit) between Min_Data=0 and Max_Data=0xFF |
||
| 162 | * @retval None |
||
| 163 | */ |
||
| 164 | __STATIC_INLINE void LL_CRC_Write_IDR(CRC_TypeDef *CRCx, uint32_t InData) |
||
| 165 | { |
||
| 166 | *((uint8_t __IO *)(&CRCx->IDR)) = (uint8_t) InData; |
||
| 167 | } |
||
| 168 | /** |
||
| 169 | * @} |
||
| 170 | */ |
||
| 171 | |||
| 172 | #if defined(USE_FULL_LL_DRIVER) |
||
| 173 | /** @defgroup CRC_LL_EF_Init Initialization and de-initialization functions |
||
| 174 | * @{ |
||
| 175 | */ |
||
| 176 | |||
| 177 | ErrorStatus LL_CRC_DeInit(CRC_TypeDef *CRCx); |
||
| 178 | |||
| 179 | /** |
||
| 180 | * @} |
||
| 181 | */ |
||
| 182 | #endif /* USE_FULL_LL_DRIVER */ |
||
| 183 | |||
| 184 | /** |
||
| 185 | * @} |
||
| 186 | */ |
||
| 187 | |||
| 188 | /** |
||
| 189 | * @} |
||
| 190 | */ |
||
| 191 | |||
| 192 | #endif /* defined(CRC) */ |
||
| 193 | |||
| 194 | /** |
||
| 195 | * @} |
||
| 196 | */ |
||
| 197 | |||
| 198 | #ifdef __cplusplus |
||
| 199 | } |
||
| 200 | #endif |
||
| 201 | |||
| 202 | #endif /* STM32F1xx_LL_CRC_H */ |
||
| 203 | |||
| 204 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |