STM32F439xx HAL User Manual
stm32f4xx_hal_crc.h
Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32f4xx_hal_crc.h
00004   * @author  MCD Application Team
00005   * @brief   Header file of CRC HAL module.
00006   ******************************************************************************
00007   * @attention
00008   *
00009   * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
00010   *
00011   * Redistribution and use in source and binary forms, with or without modification,
00012   * are permitted provided that the following conditions are met:
00013   *   1. Redistributions of source code must retain the above copyright notice,
00014   *      this list of conditions and the following disclaimer.
00015   *   2. Redistributions in binary form must reproduce the above copyright notice,
00016   *      this list of conditions and the following disclaimer in the documentation
00017   *      and/or other materials provided with the distribution.
00018   *   3. Neither the name of STMicroelectronics nor the names of its contributors
00019   *      may be used to endorse or promote products derived from this software
00020   *      without specific prior written permission.
00021   *
00022   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00023   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00024   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00025   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00026   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00027   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00028   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00029   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00030   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00031   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00032   *
00033   ******************************************************************************
00034   */ 
00035 
00036 /* Define to prevent recursive inclusion -------------------------------------*/
00037 #ifndef __STM32F4xx_HAL_CRC_H
00038 #define __STM32F4xx_HAL_CRC_H
00039 
00040 #ifdef __cplusplus
00041  extern "C" {
00042 #endif
00043 
00044 /* Includes ------------------------------------------------------------------*/
00045 #include "stm32f4xx_hal_def.h"
00046 
00047 /** @addtogroup STM32F4xx_HAL_Driver
00048   * @{
00049   */
00050 
00051 /** @defgroup CRC CRC
00052   * @brief CRC HAL module driver
00053   * @{
00054   */
00055 
00056 /* Exported types ------------------------------------------------------------*/
00057 /** @defgroup CRC_Exported_Types CRC Exported Types
00058   * @{
00059   */
00060 
00061 /** @defgroup CRC_Exported_Types_Group1 CRC State Structure definition 
00062   * @{
00063   */
00064 typedef enum
00065 {
00066   HAL_CRC_STATE_RESET     = 0x00U,  /*!< CRC not yet initialized or disabled */
00067   HAL_CRC_STATE_READY     = 0x01U,  /*!< CRC initialized and ready for use   */
00068   HAL_CRC_STATE_BUSY      = 0x02U,  /*!< CRC internal process is ongoing     */
00069   HAL_CRC_STATE_TIMEOUT   = 0x03U,  /*!< CRC timeout state                   */
00070   HAL_CRC_STATE_ERROR     = 0x04U   /*!< CRC error state                     */
00071 
00072 }HAL_CRC_StateTypeDef;
00073 /** 
00074   * @}
00075   */
00076 
00077 /** @defgroup CRC_Exported_Types_Group2 CRC Handle Structure definition   
00078   * @{
00079   */ 
00080 typedef struct
00081 {
00082   CRC_TypeDef                 *Instance;  /*!< Register base address   */
00083 
00084   HAL_LockTypeDef             Lock;       /*!< CRC locking object      */
00085 
00086   __IO HAL_CRC_StateTypeDef   State;      /*!< CRC communication state */
00087 
00088 }CRC_HandleTypeDef;
00089 /** 
00090   * @}
00091   */
00092 
00093 /**
00094   * @}
00095   */ 
00096 
00097 /* Exported constants --------------------------------------------------------*/
00098 /* Exported macro ------------------------------------------------------------*/
00099 /** @defgroup CRC_Exported_Macros CRC Exported Macros
00100   * @{
00101   */
00102 
00103 /** @brief Resets CRC handle state
00104   * @param  __HANDLE__ CRC handle
00105   * @retval None
00106   */
00107 #define __HAL_CRC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_CRC_STATE_RESET)
00108 
00109 /**
00110   * @brief  Resets CRC Data Register.
00111   * @param  __HANDLE__ CRC handle
00112   * @retval None
00113   */
00114 #define __HAL_CRC_DR_RESET(__HANDLE__) ((__HANDLE__)->Instance->CR |= CRC_CR_RESET)
00115 
00116 /**
00117   * @brief Stores a 8-bit data in the Independent Data(ID) register.
00118   * @param __HANDLE__ CRC handle
00119   * @param __VALUE__ 8-bit value to be stored in the ID register
00120   * @retval None
00121   */
00122 #define __HAL_CRC_SET_IDR(__HANDLE__, __VALUE__) (WRITE_REG((__HANDLE__)->Instance->IDR, (__VALUE__)))
00123 
00124 /**
00125   * @brief Returns the 8-bit data stored in the Independent Data(ID) register.
00126   * @param __HANDLE__ CRC handle
00127   * @retval 8-bit value of the ID register 
00128   */
00129 #define __HAL_CRC_GET_IDR(__HANDLE__) (((__HANDLE__)->Instance->IDR) & CRC_IDR_IDR)
00130 /**
00131   * @}
00132   */ 
00133 
00134 /* Exported functions --------------------------------------------------------*/
00135 /** @defgroup CRC_Exported_Functions CRC Exported Functions
00136   * @{
00137   */
00138 
00139 /** @defgroup CRC_Exported_Functions_Group1 Initialization and de-initialization functions
00140   * @{
00141   */
00142 HAL_StatusTypeDef HAL_CRC_Init(CRC_HandleTypeDef *hcrc);
00143 HAL_StatusTypeDef HAL_CRC_DeInit (CRC_HandleTypeDef *hcrc);
00144 void HAL_CRC_MspInit(CRC_HandleTypeDef *hcrc);
00145 void HAL_CRC_MspDeInit(CRC_HandleTypeDef *hcrc);
00146 /**
00147   * @}
00148   */ 
00149 
00150 /** @defgroup CRC_Exported_Functions_Group2 Peripheral Control functions
00151   * @{
00152   */
00153 uint32_t HAL_CRC_Accumulate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_t BufferLength);
00154 uint32_t HAL_CRC_Calculate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_t BufferLength);
00155 /**
00156   * @}
00157   */ 
00158 
00159 /** @defgroup CRC_Exported_Functions_Group3 Peripheral State functions
00160   * @{
00161   */
00162 HAL_CRC_StateTypeDef HAL_CRC_GetState(CRC_HandleTypeDef *hcrc);
00163 /**
00164   * @}
00165   */ 
00166 
00167 /**
00168   * @}
00169   */
00170 /* Private types -------------------------------------------------------------*/
00171 /** @defgroup CRC_Private_Types CRC Private Types
00172   * @{
00173   */
00174 
00175 /**
00176   * @}
00177   */ 
00178 
00179 /* Private defines -----------------------------------------------------------*/
00180 /** @defgroup CRC_Private_Defines CRC Private Defines
00181   * @{
00182   */
00183 
00184 /**
00185   * @}
00186   */ 
00187           
00188 /* Private variables ---------------------------------------------------------*/
00189 /** @defgroup CRC_Private_Variables CRC Private Variables
00190   * @{
00191   */
00192 
00193 /**
00194   * @}
00195   */ 
00196 
00197 /* Private constants ---------------------------------------------------------*/
00198 /** @defgroup CRC_Private_Constants CRC Private Constants
00199   * @{
00200   */
00201 
00202 /**
00203   * @}
00204   */ 
00205 
00206 /* Private macros ------------------------------------------------------------*/
00207 /** @defgroup CRC_Private_Macros CRC Private Macros
00208   * @{
00209   */
00210 
00211 /**
00212   * @}
00213   */
00214 
00215 /* Private functions prototypes ----------------------------------------------*/
00216 /** @defgroup CRC_Private_Functions_Prototypes CRC Private Functions Prototypes
00217   * @{
00218   */
00219 
00220 /**
00221   * @}
00222   */
00223 
00224 /* Private functions ---------------------------------------------------------*/
00225 /** @defgroup CRC_Private_Functions CRC Private Functions
00226   * @{
00227   */
00228 
00229 /**
00230   * @}
00231   */
00232 
00233 /**
00234   * @}
00235   */ 
00236 
00237 /**
00238   * @}
00239   */ 
00240 
00241 #ifdef __cplusplus
00242 }
00243 #endif
00244 
00245 #endif /* __STM32F4xx_HAL_CRC_H */
00246 
00247 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/