STM32L443xx HAL User Manual
stm32l4xx_hal_crc_ex.h
Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32l4xx_hal_crc_ex.h
00004   * @author  MCD Application Team
00005   * @brief   Header file of CRC HAL extended module.
00006   ******************************************************************************
00007   * @attention
00008   *
00009   * Copyright (c) 2017 STMicroelectronics.
00010   * All rights reserved.
00011   *
00012   * This software is licensed under terms that can be found in the LICENSE file
00013   * in the root directory of this software component.
00014   * If no LICENSE file comes with this software, it is provided AS-IS.
00015   *
00016   ******************************************************************************
00017   */
00018 
00019 /* Define to prevent recursive inclusion -------------------------------------*/
00020 #ifndef STM32L4xx_HAL_CRC_EX_H
00021 #define STM32L4xx_HAL_CRC_EX_H
00022 
00023 #ifdef __cplusplus
00024 extern "C" {
00025 #endif
00026 
00027 /* Includes ------------------------------------------------------------------*/
00028 #include "stm32l4xx_hal_def.h"
00029 
00030 /** @addtogroup STM32L4xx_HAL_Driver
00031   * @{
00032   */
00033 
00034 /** @addtogroup CRCEx
00035   * @{
00036   */
00037 
00038 /* Exported types ------------------------------------------------------------*/
00039 /* Exported constants --------------------------------------------------------*/
00040 /** @defgroup CRCEx_Exported_Constants CRC Extended Exported Constants
00041   * @{
00042   */
00043 
00044 /** @defgroup CRCEx_Input_Data_Inversion Input Data Inversion Modes
00045   * @{
00046   */
00047 #define CRC_INPUTDATA_INVERSION_NONE               0x00000000U     /*!< No input data inversion            */
00048 #define CRC_INPUTDATA_INVERSION_BYTE               CRC_CR_REV_IN_0 /*!< Byte-wise input data inversion     */
00049 #define CRC_INPUTDATA_INVERSION_HALFWORD           CRC_CR_REV_IN_1 /*!< HalfWord-wise input data inversion */
00050 #define CRC_INPUTDATA_INVERSION_WORD               CRC_CR_REV_IN   /*!< Word-wise input data inversion     */
00051 /**
00052   * @}
00053   */
00054 
00055 /** @defgroup CRCEx_Output_Data_Inversion Output Data Inversion Modes
00056   * @{
00057   */
00058 #define CRC_OUTPUTDATA_INVERSION_DISABLE         0x00000000U       /*!< No output data inversion       */
00059 #define CRC_OUTPUTDATA_INVERSION_ENABLE          CRC_CR_REV_OUT    /*!< Bit-wise output data inversion */
00060 /**
00061   * @}
00062   */
00063 
00064 /**
00065   * @}
00066   */
00067 
00068 /* Exported macro ------------------------------------------------------------*/
00069 /** @defgroup CRCEx_Exported_Macros CRC Extended Exported Macros
00070   * @{
00071   */
00072 
00073 /**
00074   * @brief  Set CRC output reversal
00075   * @param  __HANDLE__ CRC handle
00076   * @retval None
00077   */
00078 #define  __HAL_CRC_OUTPUTREVERSAL_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= CRC_CR_REV_OUT)
00079 
00080 /**
00081   * @brief  Unset CRC output reversal
00082   * @param  __HANDLE__ CRC handle
00083   * @retval None
00084   */
00085 #define __HAL_CRC_OUTPUTREVERSAL_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(CRC_CR_REV_OUT))
00086 
00087 /**
00088   * @brief  Set CRC non-default polynomial
00089   * @param  __HANDLE__ CRC handle
00090   * @param  __POLYNOMIAL__ 7, 8, 16 or 32-bit polynomial
00091   * @retval None
00092   */
00093 #define __HAL_CRC_POLYNOMIAL_CONFIG(__HANDLE__, __POLYNOMIAL__) ((__HANDLE__)->Instance->POL = (__POLYNOMIAL__))
00094 
00095 /**
00096   * @}
00097   */
00098 
00099 /* Private macros --------------------------------------------------------*/
00100 /** @defgroup CRCEx_Private_Macros CRC Extended Private Macros
00101   * @{
00102   */
00103 
00104 #define IS_CRC_INPUTDATA_INVERSION_MODE(MODE)     (((MODE) == CRC_INPUTDATA_INVERSION_NONE)     || \
00105                                                    ((MODE) == CRC_INPUTDATA_INVERSION_BYTE)     || \
00106                                                    ((MODE) == CRC_INPUTDATA_INVERSION_HALFWORD) || \
00107                                                    ((MODE) == CRC_INPUTDATA_INVERSION_WORD))
00108 
00109 #define IS_CRC_OUTPUTDATA_INVERSION_MODE(MODE)    (((MODE) == CRC_OUTPUTDATA_INVERSION_DISABLE) || \
00110                                                    ((MODE) == CRC_OUTPUTDATA_INVERSION_ENABLE))
00111 
00112 /**
00113   * @}
00114   */
00115 
00116 /* Exported functions --------------------------------------------------------*/
00117 
00118 /** @addtogroup CRCEx_Exported_Functions
00119   * @{
00120   */
00121 
00122 /** @addtogroup CRCEx_Exported_Functions_Group1
00123   * @{
00124   */
00125 /* Initialization and de-initialization functions  ****************************/
00126 HAL_StatusTypeDef HAL_CRCEx_Polynomial_Set(CRC_HandleTypeDef *hcrc, uint32_t Pol, uint32_t PolyLength);
00127 HAL_StatusTypeDef HAL_CRCEx_Input_Data_Reverse(CRC_HandleTypeDef *hcrc, uint32_t InputReverseMode);
00128 HAL_StatusTypeDef HAL_CRCEx_Output_Data_Reverse(CRC_HandleTypeDef *hcrc, uint32_t OutputReverseMode);
00129 
00130 /**
00131   * @}
00132   */
00133 
00134 /**
00135   * @}
00136   */
00137 
00138 /**
00139   * @}
00140   */
00141 
00142 /**
00143   * @}
00144   */
00145 
00146 #ifdef __cplusplus
00147 }
00148 #endif
00149 
00150 #endif /* STM32L4xx_HAL_CRC_EX_H */