STM32F103xB HAL User Manual
|
00001 /** 00002 ****************************************************************************** 00003 * @file stm32f1xx_hal_crc.h 00004 * @author MCD Application Team 00005 * @brief Header file of CRC HAL 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 STM32F1xx_HAL_CRC_H 00022 #define STM32F1xx_HAL_CRC_H 00023 00024 #ifdef __cplusplus 00025 extern "C" { 00026 #endif 00027 00028 /* Includes ------------------------------------------------------------------*/ 00029 #include "stm32f1xx_hal_def.h" 00030 00031 /** @addtogroup STM32F1xx_HAL_Driver 00032 * @{ 00033 */ 00034 00035 /** @addtogroup CRC 00036 * @{ 00037 */ 00038 00039 /* Exported types ------------------------------------------------------------*/ 00040 /** @defgroup CRC_Exported_Types CRC Exported Types 00041 * @{ 00042 */ 00043 00044 /** 00045 * @brief CRC HAL State Structure definition 00046 */ 00047 typedef enum 00048 { 00049 HAL_CRC_STATE_RESET = 0x00U, /*!< CRC not yet initialized or disabled */ 00050 HAL_CRC_STATE_READY = 0x01U, /*!< CRC initialized and ready for use */ 00051 HAL_CRC_STATE_BUSY = 0x02U, /*!< CRC internal process is ongoing */ 00052 HAL_CRC_STATE_TIMEOUT = 0x03U, /*!< CRC timeout state */ 00053 HAL_CRC_STATE_ERROR = 0x04U /*!< CRC error state */ 00054 } HAL_CRC_StateTypeDef; 00055 00056 00057 /** 00058 * @brief CRC Handle Structure definition 00059 */ 00060 typedef struct 00061 { 00062 CRC_TypeDef *Instance; /*!< Register base address */ 00063 00064 HAL_LockTypeDef Lock; /*!< CRC Locking object */ 00065 00066 __IO HAL_CRC_StateTypeDef State; /*!< CRC communication state */ 00067 00068 } CRC_HandleTypeDef; 00069 /** 00070 * @} 00071 */ 00072 00073 /* Exported constants --------------------------------------------------------*/ 00074 /** @defgroup CRC_Exported_Constants CRC Exported Constants 00075 * @{ 00076 */ 00077 00078 /** 00079 * @} 00080 */ 00081 00082 /* Exported macros -----------------------------------------------------------*/ 00083 /** @defgroup CRC_Exported_Macros CRC Exported Macros 00084 * @{ 00085 */ 00086 00087 /** @brief Reset CRC handle state. 00088 * @param __HANDLE__ CRC handle. 00089 * @retval None 00090 */ 00091 #define __HAL_CRC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_CRC_STATE_RESET) 00092 00093 /** 00094 * @brief Reset CRC Data Register. 00095 * @param __HANDLE__ CRC handle 00096 * @retval None 00097 */ 00098 #define __HAL_CRC_DR_RESET(__HANDLE__) ((__HANDLE__)->Instance->CR |= CRC_CR_RESET) 00099 00100 /** 00101 * @brief Store data in the Independent Data (ID) register. 00102 * @param __HANDLE__ CRC handle 00103 * @param __VALUE__ Value to be stored in the ID register 00104 * @note Refer to the Reference Manual to get the authorized __VALUE__ length in bits 00105 * @retval None 00106 */ 00107 #define __HAL_CRC_SET_IDR(__HANDLE__, __VALUE__) (WRITE_REG((__HANDLE__)->Instance->IDR, (__VALUE__))) 00108 00109 /** 00110 * @brief Return the data stored in the Independent Data (ID) register. 00111 * @param __HANDLE__ CRC handle 00112 * @note Refer to the Reference Manual to get the authorized __VALUE__ length in bits 00113 * @retval Value of the ID register 00114 */ 00115 #define __HAL_CRC_GET_IDR(__HANDLE__) (((__HANDLE__)->Instance->IDR) & CRC_IDR_IDR) 00116 /** 00117 * @} 00118 */ 00119 00120 00121 /* Private macros --------------------------------------------------------*/ 00122 /** @defgroup CRC_Private_Macros CRC Private Macros 00123 * @{ 00124 */ 00125 00126 /** 00127 * @} 00128 */ 00129 00130 /* Exported functions --------------------------------------------------------*/ 00131 /** @defgroup CRC_Exported_Functions CRC Exported Functions 00132 * @{ 00133 */ 00134 00135 /* Initialization and de-initialization functions ****************************/ 00136 /** @defgroup CRC_Exported_Functions_Group1 Initialization and de-initialization functions 00137 * @{ 00138 */ 00139 HAL_StatusTypeDef HAL_CRC_Init(CRC_HandleTypeDef *hcrc); 00140 HAL_StatusTypeDef HAL_CRC_DeInit(CRC_HandleTypeDef *hcrc); 00141 void HAL_CRC_MspInit(CRC_HandleTypeDef *hcrc); 00142 void HAL_CRC_MspDeInit(CRC_HandleTypeDef *hcrc); 00143 /** 00144 * @} 00145 */ 00146 00147 /* Peripheral Control functions ***********************************************/ 00148 /** @defgroup CRC_Exported_Functions_Group2 Peripheral Control functions 00149 * @{ 00150 */ 00151 uint32_t HAL_CRC_Accumulate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_t BufferLength); 00152 uint32_t HAL_CRC_Calculate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_t BufferLength); 00153 /** 00154 * @} 00155 */ 00156 00157 /* Peripheral State and Error functions ***************************************/ 00158 /** @defgroup CRC_Exported_Functions_Group3 Peripheral State functions 00159 * @{ 00160 */ 00161 HAL_CRC_StateTypeDef HAL_CRC_GetState(CRC_HandleTypeDef *hcrc); 00162 /** 00163 * @} 00164 */ 00165 00166 /** 00167 * @} 00168 */ 00169 00170 /** 00171 * @} 00172 */ 00173 00174 /** 00175 * @} 00176 */ 00177 00178 #ifdef __cplusplus 00179 } 00180 #endif 00181 00182 #endif /* STM32F1xx_HAL_CRC_H */ 00183 00184 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/