STM32F479xx HAL User Manual
|
00001 /** 00002 ****************************************************************************** 00003 * @file stm32f4xx_ll_crc.h 00004 * @author MCD Application Team 00005 * @brief Header file of CRC LL module. 00006 ****************************************************************************** 00007 * @attention 00008 * 00009 * <h2><center>© Copyright (c) 2016 STMicroelectronics. 00010 * All rights reserved.</center></h2> 00011 * 00012 * This software component is licensed by ST under BSD 3-Clause license, 00013 * the "License"; You may not use this file except in compliance with the 00014 * License. You may obtain a copy of the License at: 00015 * opensource.org/licenses/BSD-3-Clause 00016 * 00017 ****************************************************************************** 00018 */ 00019 00020 /* Define to prevent recursive inclusion -------------------------------------*/ 00021 #ifndef STM32F4xx_LL_CRC_H 00022 #define STM32F4xx_LL_CRC_H 00023 00024 #ifdef __cplusplus 00025 extern "C" { 00026 #endif 00027 00028 /* Includes ------------------------------------------------------------------*/ 00029 #include "stm32f4xx.h" 00030 00031 /** @addtogroup STM32F4xx_LL_Driver 00032 * @{ 00033 */ 00034 00035 #if defined(CRC) 00036 00037 /** @defgroup CRC_LL CRC 00038 * @{ 00039 */ 00040 00041 /* Private types -------------------------------------------------------------*/ 00042 /* Private variables ---------------------------------------------------------*/ 00043 /* Private constants ---------------------------------------------------------*/ 00044 /* Private macros ------------------------------------------------------------*/ 00045 00046 /* Exported types ------------------------------------------------------------*/ 00047 /* Exported constants --------------------------------------------------------*/ 00048 /** @defgroup CRC_LL_Exported_Constants CRC Exported Constants 00049 * @{ 00050 */ 00051 00052 /** 00053 * @} 00054 */ 00055 00056 /* Exported macro ------------------------------------------------------------*/ 00057 /** @defgroup CRC_LL_Exported_Macros CRC Exported Macros 00058 * @{ 00059 */ 00060 00061 /** @defgroup CRC_LL_EM_WRITE_READ Common Write and read registers Macros 00062 * @{ 00063 */ 00064 00065 /** 00066 * @brief Write a value in CRC register 00067 * @param __INSTANCE__ CRC Instance 00068 * @param __REG__ Register to be written 00069 * @param __VALUE__ Value to be written in the register 00070 * @retval None 00071 */ 00072 #define LL_CRC_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, __VALUE__) 00073 00074 /** 00075 * @brief Read a value in CRC register 00076 * @param __INSTANCE__ CRC Instance 00077 * @param __REG__ Register to be read 00078 * @retval Register value 00079 */ 00080 #define LL_CRC_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__) 00081 /** 00082 * @} 00083 */ 00084 00085 /** 00086 * @} 00087 */ 00088 00089 00090 /* Exported functions --------------------------------------------------------*/ 00091 /** @defgroup CRC_LL_Exported_Functions CRC Exported Functions 00092 * @{ 00093 */ 00094 00095 /** @defgroup CRC_LL_EF_Configuration CRC Configuration functions 00096 * @{ 00097 */ 00098 00099 /** 00100 * @brief Reset the CRC calculation unit. 00101 * @note If Programmable Initial CRC value feature 00102 * is available, also set the Data Register to the value stored in the 00103 * CRC_INIT register, otherwise, reset Data Register to its default value. 00104 * @rmtoll CR RESET LL_CRC_ResetCRCCalculationUnit 00105 * @param CRCx CRC Instance 00106 * @retval None 00107 */ 00108 __STATIC_INLINE void LL_CRC_ResetCRCCalculationUnit(CRC_TypeDef *CRCx) 00109 { 00110 SET_BIT(CRCx->CR, CRC_CR_RESET); 00111 } 00112 00113 /** 00114 * @} 00115 */ 00116 00117 /** @defgroup CRC_LL_EF_Data_Management Data_Management 00118 * @{ 00119 */ 00120 00121 /** 00122 * @brief Write given 32-bit data to the CRC calculator 00123 * @rmtoll DR DR LL_CRC_FeedData32 00124 * @param CRCx CRC Instance 00125 * @param InData value to be provided to CRC calculator between between Min_Data=0 and Max_Data=0xFFFFFFFF 00126 * @retval None 00127 */ 00128 __STATIC_INLINE void LL_CRC_FeedData32(CRC_TypeDef *CRCx, uint32_t InData) 00129 { 00130 WRITE_REG(CRCx->DR, InData); 00131 } 00132 00133 /** 00134 * @brief Return current CRC calculation result. 32 bits value is returned. 00135 * @rmtoll DR DR LL_CRC_ReadData32 00136 * @param CRCx CRC Instance 00137 * @retval Current CRC calculation result as stored in CRC_DR register (32 bits). 00138 */ 00139 __STATIC_INLINE uint32_t LL_CRC_ReadData32(CRC_TypeDef *CRCx) 00140 { 00141 return (uint32_t)(READ_REG(CRCx->DR)); 00142 } 00143 00144 /** 00145 * @brief Return data stored in the Independent Data(IDR) register. 00146 * @note This register can be used as a temporary storage location for one byte. 00147 * @rmtoll IDR IDR LL_CRC_Read_IDR 00148 * @param CRCx CRC Instance 00149 * @retval Value stored in CRC_IDR register (General-purpose 8-bit data register). 00150 */ 00151 __STATIC_INLINE uint32_t LL_CRC_Read_IDR(CRC_TypeDef *CRCx) 00152 { 00153 return (uint32_t)(READ_REG(CRCx->IDR)); 00154 } 00155 00156 /** 00157 * @brief Store data in the Independent Data(IDR) register. 00158 * @note This register can be used as a temporary storage location for one byte. 00159 * @rmtoll IDR IDR LL_CRC_Write_IDR 00160 * @param CRCx CRC Instance 00161 * @param InData value to be stored in CRC_IDR register (8-bit) between Min_Data=0 and Max_Data=0xFF 00162 * @retval None 00163 */ 00164 __STATIC_INLINE void LL_CRC_Write_IDR(CRC_TypeDef *CRCx, uint32_t InData) 00165 { 00166 *((uint8_t __IO *)(&CRCx->IDR)) = (uint8_t) InData; 00167 } 00168 /** 00169 * @} 00170 */ 00171 00172 #if defined(USE_FULL_LL_DRIVER) 00173 /** @defgroup CRC_LL_EF_Init Initialization and de-initialization functions 00174 * @{ 00175 */ 00176 00177 ErrorStatus LL_CRC_DeInit(CRC_TypeDef *CRCx); 00178 00179 /** 00180 * @} 00181 */ 00182 #endif /* USE_FULL_LL_DRIVER */ 00183 00184 /** 00185 * @} 00186 */ 00187 00188 /** 00189 * @} 00190 */ 00191 00192 #endif /* defined(CRC) */ 00193 00194 /** 00195 * @} 00196 */ 00197 00198 #ifdef __cplusplus 00199 } 00200 #endif 00201 00202 #endif /* STM32F4xx_LL_CRC_H */ 00203 00204 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/