1 /** 2 ****************************************************************************** 3 * @file stm32l4xx_hal_crc_ex.h 4 * @author MCD Application Team 5 * @brief Header file of CRC HAL extended module. 6 ****************************************************************************** 7 * @attention 8 * 9 * <h2><center>© Copyright (c) 2017 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 STM32L4xx_HAL_CRC_EX_H 22 #define STM32L4xx_HAL_CRC_EX_H 23 24 #ifdef __cplusplus 25 extern "C" { 26 #endif 27 28 /* Includes ------------------------------------------------------------------*/ 29 #include "stm32l4xx_hal_def.h" 30 31 /** @addtogroup STM32L4xx_HAL_Driver 32 * @{ 33 */ 34 35 /** @addtogroup CRCEx 36 * @{ 37 */ 38 39 /* Exported types ------------------------------------------------------------*/ 40 /* Exported constants --------------------------------------------------------*/ 41 /** @defgroup CRCEx_Exported_Constants CRC Extended Exported Constants 42 * @{ 43 */ 44 45 /** @defgroup CRCEx_Input_Data_Inversion Input Data Inversion Modes 46 * @{ 47 */ 48 #define CRC_INPUTDATA_INVERSION_NONE 0x00000000U /*!< No input data inversion */ 49 #define CRC_INPUTDATA_INVERSION_BYTE CRC_CR_REV_IN_0 /*!< Byte-wise input data inversion */ 50 #define CRC_INPUTDATA_INVERSION_HALFWORD CRC_CR_REV_IN_1 /*!< HalfWord-wise input data inversion */ 51 #define CRC_INPUTDATA_INVERSION_WORD CRC_CR_REV_IN /*!< Word-wise input data inversion */ 52 /** 53 * @} 54 */ 55 56 /** @defgroup CRCEx_Output_Data_Inversion Output Data Inversion Modes 57 * @{ 58 */ 59 #define CRC_OUTPUTDATA_INVERSION_DISABLE 0x00000000U /*!< No output data inversion */ 60 #define CRC_OUTPUTDATA_INVERSION_ENABLE CRC_CR_REV_OUT /*!< Bit-wise output data inversion */ 61 /** 62 * @} 63 */ 64 65 /** 66 * @} 67 */ 68 69 /* Exported macro ------------------------------------------------------------*/ 70 /** @defgroup CRCEx_Exported_Macros CRC Extended Exported Macros 71 * @{ 72 */ 73 74 /** 75 * @brief Set CRC output reversal 76 * @param __HANDLE__ CRC handle 77 * @retval None 78 */ 79 #define __HAL_CRC_OUTPUTREVERSAL_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= CRC_CR_REV_OUT) 80 81 /** 82 * @brief Unset CRC output reversal 83 * @param __HANDLE__ CRC handle 84 * @retval None 85 */ 86 #define __HAL_CRC_OUTPUTREVERSAL_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(CRC_CR_REV_OUT)) 87 88 /** 89 * @brief Set CRC non-default polynomial 90 * @param __HANDLE__ CRC handle 91 * @param __POLYNOMIAL__ 7, 8, 16 or 32-bit polynomial 92 * @retval None 93 */ 94 #define __HAL_CRC_POLYNOMIAL_CONFIG(__HANDLE__, __POLYNOMIAL__) ((__HANDLE__)->Instance->POL = (__POLYNOMIAL__)) 95 96 /** 97 * @} 98 */ 99 100 /* Private macros --------------------------------------------------------*/ 101 /** @defgroup CRCEx_Private_Macros CRC Extended Private Macros 102 * @{ 103 */ 104 105 #define IS_CRC_INPUTDATA_INVERSION_MODE(MODE) (((MODE) == CRC_INPUTDATA_INVERSION_NONE) || \ 106 ((MODE) == CRC_INPUTDATA_INVERSION_BYTE) || \ 107 ((MODE) == CRC_INPUTDATA_INVERSION_HALFWORD) || \ 108 ((MODE) == CRC_INPUTDATA_INVERSION_WORD)) 109 110 #define IS_CRC_OUTPUTDATA_INVERSION_MODE(MODE) (((MODE) == CRC_OUTPUTDATA_INVERSION_DISABLE) || \ 111 ((MODE) == CRC_OUTPUTDATA_INVERSION_ENABLE)) 112 113 /** 114 * @} 115 */ 116 117 /* Exported functions --------------------------------------------------------*/ 118 119 /** @addtogroup CRCEx_Exported_Functions 120 * @{ 121 */ 122 123 /** @addtogroup CRCEx_Exported_Functions_Group1 124 * @{ 125 */ 126 /* Initialization and de-initialization functions ****************************/ 127 HAL_StatusTypeDef HAL_CRCEx_Polynomial_Set(CRC_HandleTypeDef *hcrc, uint32_t Pol, uint32_t PolyLength); 128 HAL_StatusTypeDef HAL_CRCEx_Input_Data_Reverse(CRC_HandleTypeDef *hcrc, uint32_t InputReverseMode); 129 HAL_StatusTypeDef HAL_CRCEx_Output_Data_Reverse(CRC_HandleTypeDef *hcrc, uint32_t OutputReverseMode); 130 131 /** 132 * @} 133 */ 134 135 /** 136 * @} 137 */ 138 139 /** 140 * @} 141 */ 142 143 /** 144 * @} 145 */ 146 147 #ifdef __cplusplus 148 } 149 #endif 150 151 #endif /* STM32L4xx_HAL_CRC_EX_H */ 152 153 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 154