mbed library sources

Fork of mbed-src by mbed official

Committer:
lzbpli
Date:
Thu Jul 07 06:48:59 2016 +0000
Revision:
636:b0d178e9fa10
Parent:
610:813dcc80987e
l053

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 610:813dcc80987e 1 /**
mbed_official 610:813dcc80987e 2 ******************************************************************************
mbed_official 610:813dcc80987e 3 * @file stm32l4xx_hal_crc.h
mbed_official 610:813dcc80987e 4 * @author MCD Application Team
mbed_official 610:813dcc80987e 5 * @version V1.0.0
mbed_official 610:813dcc80987e 6 * @date 26-June-2015
mbed_official 610:813dcc80987e 7 * @brief Header file of CRC HAL module.
mbed_official 610:813dcc80987e 8 ******************************************************************************
mbed_official 610:813dcc80987e 9 * @attention
mbed_official 610:813dcc80987e 10 *
mbed_official 610:813dcc80987e 11 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
mbed_official 610:813dcc80987e 12 *
mbed_official 610:813dcc80987e 13 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 610:813dcc80987e 14 * are permitted provided that the following conditions are met:
mbed_official 610:813dcc80987e 15 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 610:813dcc80987e 16 * this list of conditions and the following disclaimer.
mbed_official 610:813dcc80987e 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 610:813dcc80987e 18 * this list of conditions and the following disclaimer in the documentation
mbed_official 610:813dcc80987e 19 * and/or other materials provided with the distribution.
mbed_official 610:813dcc80987e 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
mbed_official 610:813dcc80987e 21 * may be used to endorse or promote products derived from this software
mbed_official 610:813dcc80987e 22 * without specific prior written permission.
mbed_official 610:813dcc80987e 23 *
mbed_official 610:813dcc80987e 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 610:813dcc80987e 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 610:813dcc80987e 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 610:813dcc80987e 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mbed_official 610:813dcc80987e 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 610:813dcc80987e 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mbed_official 610:813dcc80987e 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 610:813dcc80987e 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mbed_official 610:813dcc80987e 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mbed_official 610:813dcc80987e 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 610:813dcc80987e 34 *
mbed_official 610:813dcc80987e 35 ******************************************************************************
mbed_official 610:813dcc80987e 36 */
mbed_official 610:813dcc80987e 37
mbed_official 610:813dcc80987e 38 /* Define to prevent recursive inclusion -------------------------------------*/
mbed_official 610:813dcc80987e 39 #ifndef __STM32L4xx_HAL_CRC_H
mbed_official 610:813dcc80987e 40 #define __STM32L4xx_HAL_CRC_H
mbed_official 610:813dcc80987e 41
mbed_official 610:813dcc80987e 42 #ifdef __cplusplus
mbed_official 610:813dcc80987e 43 extern "C" {
mbed_official 610:813dcc80987e 44 #endif
mbed_official 610:813dcc80987e 45
mbed_official 610:813dcc80987e 46 /* Includes ------------------------------------------------------------------*/
mbed_official 610:813dcc80987e 47 #include "stm32l4xx_hal_def.h"
mbed_official 610:813dcc80987e 48
mbed_official 610:813dcc80987e 49 /** @addtogroup STM32L4xx_HAL_Driver
mbed_official 610:813dcc80987e 50 * @{
mbed_official 610:813dcc80987e 51 */
mbed_official 610:813dcc80987e 52
mbed_official 610:813dcc80987e 53 /** @addtogroup CRC
mbed_official 610:813dcc80987e 54 * @{
mbed_official 610:813dcc80987e 55 */
mbed_official 610:813dcc80987e 56
mbed_official 610:813dcc80987e 57 /* Exported types ------------------------------------------------------------*/
mbed_official 610:813dcc80987e 58
mbed_official 610:813dcc80987e 59 /** @defgroup CRC_Exported_Types CRC Exported Types
mbed_official 610:813dcc80987e 60 * @{
mbed_official 610:813dcc80987e 61 */
mbed_official 610:813dcc80987e 62
mbed_official 610:813dcc80987e 63 /**
mbed_official 610:813dcc80987e 64 * @brief CRC HAL State Structure definition
mbed_official 610:813dcc80987e 65 */
mbed_official 610:813dcc80987e 66 typedef enum
mbed_official 610:813dcc80987e 67 {
mbed_official 610:813dcc80987e 68 HAL_CRC_STATE_RESET = 0x00, /*!< CRC not yet initialized or disabled */
mbed_official 610:813dcc80987e 69 HAL_CRC_STATE_READY = 0x01, /*!< CRC initialized and ready for use */
mbed_official 610:813dcc80987e 70 HAL_CRC_STATE_BUSY = 0x02, /*!< CRC internal process is ongoing */
mbed_official 610:813dcc80987e 71 HAL_CRC_STATE_TIMEOUT = 0x03, /*!< CRC timeout state */
mbed_official 610:813dcc80987e 72 HAL_CRC_STATE_ERROR = 0x04 /*!< CRC error state */
mbed_official 610:813dcc80987e 73 }HAL_CRC_StateTypeDef;
mbed_official 610:813dcc80987e 74
mbed_official 610:813dcc80987e 75
mbed_official 610:813dcc80987e 76
mbed_official 610:813dcc80987e 77 /**
mbed_official 610:813dcc80987e 78 * @brief CRC Init Structure definition
mbed_official 610:813dcc80987e 79 */
mbed_official 610:813dcc80987e 80 typedef struct
mbed_official 610:813dcc80987e 81 {
mbed_official 610:813dcc80987e 82 uint8_t DefaultPolynomialUse; /*!< This parameter is a value of @ref CRC_Default_Polynomial and indicates if default polynomial is used.
mbed_official 610:813dcc80987e 83 If set to DEFAULT_POLYNOMIAL_ENABLE, resort to default
mbed_official 610:813dcc80987e 84 X^32 + X^26 + X^23 + X^22 + X^16 + X^12 + X^11 + X^10 +X^8 + X^7 + X^5 + X^4 + X^2+ X +1.
mbed_official 610:813dcc80987e 85 In that case, there is no need to set GeneratingPolynomial field.
mbed_official 610:813dcc80987e 86 If otherwise set to DEFAULT_POLYNOMIAL_DISABLE, GeneratingPolynomial and CRCLength fields must be set. */
mbed_official 610:813dcc80987e 87
mbed_official 610:813dcc80987e 88 uint8_t DefaultInitValueUse; /*!< This parameter is a value of @ref CRC_Default_InitValue_Use and indicates if default init value is used.
mbed_official 610:813dcc80987e 89 If set to DEFAULT_INIT_VALUE_ENABLE, resort to default
mbed_official 610:813dcc80987e 90 0xFFFFFFFF value. In that case, there is no need to set InitValue field.
mbed_official 610:813dcc80987e 91 If otherwise set to DEFAULT_INIT_VALUE_DISABLE, InitValue field must be set. */
mbed_official 610:813dcc80987e 92
mbed_official 610:813dcc80987e 93 uint32_t GeneratingPolynomial; /*!< Set CRC generating polynomial as a 7, 8, 16 or 32-bit long value for a polynomial degree
mbed_official 610:813dcc80987e 94 respectively equal to 7, 8, 16 or 32. This field is written in normal representation,
mbed_official 610:813dcc80987e 95 e.g., for a polynomial of degree 7, X^7 + X^6 + X^5 + X^2 + 1 is written 0x65.
mbed_official 610:813dcc80987e 96 No need to specify it if DefaultPolynomialUse is set to DEFAULT_POLYNOMIAL_ENABLE. */
mbed_official 610:813dcc80987e 97
mbed_official 610:813dcc80987e 98 uint32_t CRCLength; /*!< This parameter is a value of @ref CRC_Polynomial_Sizes and indicates CRC length.
mbed_official 610:813dcc80987e 99 Value can be either one of
mbed_official 610:813dcc80987e 100 @arg CRC_POLYLENGTH_32B (32-bit CRC),
mbed_official 610:813dcc80987e 101 @arg CRC_POLYLENGTH_16B (16-bit CRC),
mbed_official 610:813dcc80987e 102 @arg CRC_POLYLENGTH_8B (8-bit CRC),
mbed_official 610:813dcc80987e 103 @arg CRC_POLYLENGTH_7B (7-bit CRC). */
mbed_official 610:813dcc80987e 104
mbed_official 610:813dcc80987e 105 uint32_t InitValue; /*!< Init value to initiate CRC computation. No need to specify it if DefaultInitValueUse
mbed_official 610:813dcc80987e 106 is set to DEFAULT_INIT_VALUE_ENABLE. */
mbed_official 610:813dcc80987e 107
mbed_official 610:813dcc80987e 108 uint32_t InputDataInversionMode; /*!< This parameter is a value of @ref CRCEx_Input_Data_Inversion and specifies input data inversion mode.
mbed_official 610:813dcc80987e 109 Can be either one of the following values
mbed_official 610:813dcc80987e 110 @arg CRC_INPUTDATA_INVERSION_NONE, no input data inversion
mbed_official 610:813dcc80987e 111 @arg CRC_INPUTDATA_INVERSION_BYTE, byte-wise inversion, 0x1A2B3C4D becomes 0x58D43CB2
mbed_official 610:813dcc80987e 112 @arg CRC_INPUTDATA_INVERSION_HALFWORD, halfword-wise inversion, 0x1A2B3C4D becomes 0xD458B23C
mbed_official 610:813dcc80987e 113 @arg CRC_INPUTDATA_INVERSION_WORD, word-wise inversion, 0x1A2B3C4D becomes 0xB23CD458 */
mbed_official 610:813dcc80987e 114
mbed_official 610:813dcc80987e 115 uint32_t OutputDataInversionMode; /*!< This parameter is a value of @ref CRCEx_Output_Data_Inversion and specifies output data (i.e. CRC) inversion mode.
mbed_official 610:813dcc80987e 116 Can be either
mbed_official 610:813dcc80987e 117 @arg CRC_OUTPUTDATA_INVERSION_DISABLE: no CRC inversion,
mbed_official 610:813dcc80987e 118 @arg CRC_OUTPUTDATA_INVERSION_ENABLE: CRC 0x11223344 is converted into 0x22CC4488 */
mbed_official 610:813dcc80987e 119 }CRC_InitTypeDef;
mbed_official 610:813dcc80987e 120
mbed_official 610:813dcc80987e 121
mbed_official 610:813dcc80987e 122
mbed_official 610:813dcc80987e 123 /**
mbed_official 610:813dcc80987e 124 * @brief CRC Handle Structure definition
mbed_official 610:813dcc80987e 125 */
mbed_official 610:813dcc80987e 126 typedef struct
mbed_official 610:813dcc80987e 127 {
mbed_official 610:813dcc80987e 128 CRC_TypeDef *Instance; /*!< Register base address */
mbed_official 610:813dcc80987e 129
mbed_official 610:813dcc80987e 130 CRC_InitTypeDef Init; /*!< CRC configuration parameters */
mbed_official 610:813dcc80987e 131
mbed_official 610:813dcc80987e 132 HAL_LockTypeDef Lock; /*!< CRC Locking object */
mbed_official 610:813dcc80987e 133
mbed_official 610:813dcc80987e 134 __IO HAL_CRC_StateTypeDef State; /*!< CRC communication state */
mbed_official 610:813dcc80987e 135
mbed_official 610:813dcc80987e 136 uint32_t InputDataFormat; /*!< This parameter is a value of @ref CRC_Input_Buffer_Format and specifies input data format.
mbed_official 610:813dcc80987e 137 Can be either
mbed_official 610:813dcc80987e 138 @arg CRC_INPUTDATA_FORMAT_BYTES, input data is a stream of bytes (8-bit data)
mbed_official 610:813dcc80987e 139 @arg CRC_INPUTDATA_FORMAT_HALFWORDS, input data is a stream of half-words (16-bit data)
mbed_official 610:813dcc80987e 140 @arg CRC_INPUTDATA_FORMAT_WORDS, input data is a stream of words (32-bit data)
mbed_official 610:813dcc80987e 141
mbed_official 610:813dcc80987e 142 Note that constant CRC_INPUT_FORMAT_UNDEFINED is defined but an initialization error
mbed_official 610:813dcc80987e 143 must occur if InputBufferFormat is not one of the three values listed above */
mbed_official 610:813dcc80987e 144 }CRC_HandleTypeDef;
mbed_official 610:813dcc80987e 145
mbed_official 610:813dcc80987e 146
mbed_official 610:813dcc80987e 147 /**
mbed_official 610:813dcc80987e 148 * @}
mbed_official 610:813dcc80987e 149 */
mbed_official 610:813dcc80987e 150
mbed_official 610:813dcc80987e 151 /* Exported constants --------------------------------------------------------*/
mbed_official 610:813dcc80987e 152 /** @defgroup CRC_Exported_Constants CRC Exported Constants
mbed_official 610:813dcc80987e 153 * @{
mbed_official 610:813dcc80987e 154 */
mbed_official 610:813dcc80987e 155
mbed_official 610:813dcc80987e 156 /** @defgroup CRC_Default_Polynomial_Value Default CRC generating polynomial
mbed_official 610:813dcc80987e 157 * @{
mbed_official 610:813dcc80987e 158 */
mbed_official 610:813dcc80987e 159 #define DEFAULT_CRC32_POLY 0x04C11DB7 /*!< X^32 + X^26 + X^23 + X^22 + X^16 + X^12 + X^11 + X^10 +X^8 + X^7 + X^5 + X^4 + X^2+ X +1 */
mbed_official 610:813dcc80987e 160 /**
mbed_official 610:813dcc80987e 161 * @}
mbed_official 610:813dcc80987e 162 */
mbed_official 610:813dcc80987e 163
mbed_official 610:813dcc80987e 164 /** @defgroup CRC_Default_InitValue Default CRC computation initialization value
mbed_official 610:813dcc80987e 165 * @{
mbed_official 610:813dcc80987e 166 */
mbed_official 610:813dcc80987e 167 #define DEFAULT_CRC_INITVALUE 0xFFFFFFFF /*!< Initial CRC default value */
mbed_official 610:813dcc80987e 168 /**
mbed_official 610:813dcc80987e 169 * @}
mbed_official 610:813dcc80987e 170 */
mbed_official 610:813dcc80987e 171
mbed_official 610:813dcc80987e 172 /** @defgroup CRC_Default_Polynomial Indicates whether or not default polynomial is used
mbed_official 610:813dcc80987e 173 * @{
mbed_official 610:813dcc80987e 174 */
mbed_official 610:813dcc80987e 175 #define DEFAULT_POLYNOMIAL_ENABLE ((uint8_t)0x00) /*!< Enable default generating polynomial 0x04C11DB7 */
mbed_official 610:813dcc80987e 176 #define DEFAULT_POLYNOMIAL_DISABLE ((uint8_t)0x01) /*!< Disable default generating polynomial 0x04C11DB7 */
mbed_official 610:813dcc80987e 177 /**
mbed_official 610:813dcc80987e 178 * @}
mbed_official 610:813dcc80987e 179 */
mbed_official 610:813dcc80987e 180
mbed_official 610:813dcc80987e 181 /** @defgroup CRC_Default_InitValue_Use Indicates whether or not default init value is used
mbed_official 610:813dcc80987e 182 * @{
mbed_official 610:813dcc80987e 183 */
mbed_official 610:813dcc80987e 184 #define DEFAULT_INIT_VALUE_ENABLE ((uint8_t)0x00) /*!< Enable initial CRC default value */
mbed_official 610:813dcc80987e 185 #define DEFAULT_INIT_VALUE_DISABLE ((uint8_t)0x01) /*!< Disable initial CRC default value */
mbed_official 610:813dcc80987e 186 /**
mbed_official 610:813dcc80987e 187 * @}
mbed_official 610:813dcc80987e 188 */
mbed_official 610:813dcc80987e 189
mbed_official 610:813dcc80987e 190 /** @defgroup CRC_Polynomial_Sizes Polynomial sizes to configure the IP
mbed_official 610:813dcc80987e 191 * @{
mbed_official 610:813dcc80987e 192 */
mbed_official 610:813dcc80987e 193 #define CRC_POLYLENGTH_32B ((uint32_t)0x00000000) /*!< Resort to a 32-bit long generating polynomial */
mbed_official 610:813dcc80987e 194 #define CRC_POLYLENGTH_16B ((uint32_t)CRC_CR_POLYSIZE_0) /*!< Resort to a 16-bit long generating polynomial */
mbed_official 610:813dcc80987e 195 #define CRC_POLYLENGTH_8B ((uint32_t)CRC_CR_POLYSIZE_1) /*!< Resort to a 8-bit long generating polynomial */
mbed_official 610:813dcc80987e 196 #define CRC_POLYLENGTH_7B ((uint32_t)CRC_CR_POLYSIZE) /*!< Resort to a 7-bit long generating polynomial */
mbed_official 610:813dcc80987e 197 /**
mbed_official 610:813dcc80987e 198 * @}
mbed_official 610:813dcc80987e 199 */
mbed_official 610:813dcc80987e 200
mbed_official 610:813dcc80987e 201 /** @defgroup CRC_Polynomial_Size_Definitions CRC polynomial possible sizes actual definitions
mbed_official 610:813dcc80987e 202 * @{
mbed_official 610:813dcc80987e 203 */
mbed_official 610:813dcc80987e 204 #define HAL_CRC_LENGTH_32B 32 /*!< 32-bit long CRC */
mbed_official 610:813dcc80987e 205 #define HAL_CRC_LENGTH_16B 16 /*!< 16-bit long CRC */
mbed_official 610:813dcc80987e 206 #define HAL_CRC_LENGTH_8B 8 /*!< 8-bit long CRC */
mbed_official 610:813dcc80987e 207 #define HAL_CRC_LENGTH_7B 7 /*!< 7-bit long CRC */
mbed_official 610:813dcc80987e 208 /**
mbed_official 610:813dcc80987e 209 * @}
mbed_official 610:813dcc80987e 210 */
mbed_official 610:813dcc80987e 211
mbed_official 610:813dcc80987e 212 /** @defgroup CRC_Input_Buffer_Format Input Buffer Format
mbed_official 610:813dcc80987e 213 * @{
mbed_official 610:813dcc80987e 214 */
mbed_official 610:813dcc80987e 215 /* WARNING: CRC_INPUT_FORMAT_UNDEFINED is created for reference purposes but
mbed_official 610:813dcc80987e 216 * an error is triggered in HAL_CRC_Init() if InputDataFormat field is set
mbed_official 610:813dcc80987e 217 * to CRC_INPUT_FORMAT_UNDEFINED: the format MUST be defined by the user for
mbed_official 610:813dcc80987e 218 * the CRC APIs to provide a correct result */
mbed_official 610:813dcc80987e 219 #define CRC_INPUTDATA_FORMAT_UNDEFINED ((uint32_t)0x00000000) /*!< Undefined input data format */
mbed_official 610:813dcc80987e 220 #define CRC_INPUTDATA_FORMAT_BYTES ((uint32_t)0x00000001) /*!< Input data in byte format */
mbed_official 610:813dcc80987e 221 #define CRC_INPUTDATA_FORMAT_HALFWORDS ((uint32_t)0x00000002) /*!< Input data in half-word format */
mbed_official 610:813dcc80987e 222 #define CRC_INPUTDATA_FORMAT_WORDS ((uint32_t)0x00000003) /*!< Input data in word format */
mbed_official 610:813dcc80987e 223 /**
mbed_official 610:813dcc80987e 224 * @}
mbed_official 610:813dcc80987e 225 */
mbed_official 610:813dcc80987e 226
mbed_official 610:813dcc80987e 227 /** @defgroup CRC_Aliases CRC API aliases
mbed_official 610:813dcc80987e 228 * @{
mbed_official 610:813dcc80987e 229 */
mbed_official 610:813dcc80987e 230 #define HAL_CRC_Input_Data_Reverse HAL_CRCEx_Input_Data_Reverse /*!< Aliased to HAL_CRCEx_Input_Data_Reverse for inter STM32 series compatibility */
mbed_official 610:813dcc80987e 231 #define HAL_CRC_Output_Data_Reverse HAL_CRCEx_Output_Data_Reverse /*!< Aliased to HAL_CRCEx_Output_Data_Reverse for inter STM32 series compatibility */
mbed_official 610:813dcc80987e 232 /**
mbed_official 610:813dcc80987e 233 * @}
mbed_official 610:813dcc80987e 234 */
mbed_official 610:813dcc80987e 235
mbed_official 610:813dcc80987e 236 /**
mbed_official 610:813dcc80987e 237 * @}
mbed_official 610:813dcc80987e 238 */
mbed_official 610:813dcc80987e 239
mbed_official 610:813dcc80987e 240
mbed_official 610:813dcc80987e 241 /* Exported macros -----------------------------------------------------------*/
mbed_official 610:813dcc80987e 242 /** @defgroup CRC_Exported_Macros CRC Exported Macros
mbed_official 610:813dcc80987e 243 * @{
mbed_official 610:813dcc80987e 244 */
mbed_official 610:813dcc80987e 245
mbed_official 610:813dcc80987e 246 /** @brief Reset CRC handle state.
mbed_official 610:813dcc80987e 247 * @param __HANDLE__: CRC handle.
mbed_official 610:813dcc80987e 248 * @retval None
mbed_official 610:813dcc80987e 249 */
mbed_official 610:813dcc80987e 250 #define __HAL_CRC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_CRC_STATE_RESET)
mbed_official 610:813dcc80987e 251
mbed_official 610:813dcc80987e 252 /**
mbed_official 610:813dcc80987e 253 * @brief Reset CRC Data Register.
mbed_official 610:813dcc80987e 254 * @param __HANDLE__: CRC handle
mbed_official 610:813dcc80987e 255 * @retval None
mbed_official 610:813dcc80987e 256 */
mbed_official 610:813dcc80987e 257 #define __HAL_CRC_DR_RESET(__HANDLE__) ((__HANDLE__)->Instance->CR |= CRC_CR_RESET)
mbed_official 610:813dcc80987e 258
mbed_official 610:813dcc80987e 259 /**
mbed_official 610:813dcc80987e 260 * @brief Set CRC INIT non-default value
mbed_official 610:813dcc80987e 261 * @param __HANDLE__: CRC handle
mbed_official 610:813dcc80987e 262 * @param __INIT__: 32-bit initial value
mbed_official 610:813dcc80987e 263 * @retval None
mbed_official 610:813dcc80987e 264 */
mbed_official 610:813dcc80987e 265 #define __HAL_CRC_INITIALCRCVALUE_CONFIG(__HANDLE__, __INIT__) ((__HANDLE__)->Instance->INIT = (__INIT__))
mbed_official 610:813dcc80987e 266
mbed_official 610:813dcc80987e 267 /**
mbed_official 610:813dcc80987e 268 * @brief Store a 8-bit data in the Independent Data(ID) register.
mbed_official 610:813dcc80987e 269 * @param __HANDLE__: CRC handle
mbed_official 610:813dcc80987e 270 * @param __VALUE__: 8-bit value to be stored in the ID register
mbed_official 610:813dcc80987e 271 * @retval None
mbed_official 610:813dcc80987e 272 */
mbed_official 610:813dcc80987e 273 #define __HAL_CRC_SET_IDR(__HANDLE__, __VALUE__) (WRITE_REG((__HANDLE__)->Instance->IDR, (__VALUE__)))
mbed_official 610:813dcc80987e 274
mbed_official 610:813dcc80987e 275 /**
mbed_official 610:813dcc80987e 276 * @brief Return the 8-bit data stored in the Independent Data(ID) register.
mbed_official 610:813dcc80987e 277 * @param __HANDLE__: CRC handle
mbed_official 610:813dcc80987e 278 * @retval 8-bit value of the ID register
mbed_official 610:813dcc80987e 279 */
mbed_official 610:813dcc80987e 280 #define __HAL_CRC_GET_IDR(__HANDLE__) (((__HANDLE__)->Instance->IDR) & CRC_IDR_IDR)
mbed_official 610:813dcc80987e 281 /**
mbed_official 610:813dcc80987e 282 * @}
mbed_official 610:813dcc80987e 283 */
mbed_official 610:813dcc80987e 284
mbed_official 610:813dcc80987e 285
mbed_official 610:813dcc80987e 286 /* Private macros --------------------------------------------------------*/
mbed_official 610:813dcc80987e 287 /** @addtogroup CRC_Private_Macros CRC Private Macros
mbed_official 610:813dcc80987e 288 * @{
mbed_official 610:813dcc80987e 289 */
mbed_official 610:813dcc80987e 290
mbed_official 610:813dcc80987e 291 #define IS_DEFAULT_POLYNOMIAL(DEFAULT) (((DEFAULT) == DEFAULT_POLYNOMIAL_ENABLE) || \
mbed_official 610:813dcc80987e 292 ((DEFAULT) == DEFAULT_POLYNOMIAL_DISABLE))
mbed_official 610:813dcc80987e 293
mbed_official 610:813dcc80987e 294
mbed_official 610:813dcc80987e 295 #define IS_DEFAULT_INIT_VALUE(VALUE) (((VALUE) == DEFAULT_INIT_VALUE_ENABLE) || \
mbed_official 610:813dcc80987e 296 ((VALUE) == DEFAULT_INIT_VALUE_DISABLE))
mbed_official 610:813dcc80987e 297
mbed_official 610:813dcc80987e 298 #define IS_CRC_POL_LENGTH(LENGTH) (((LENGTH) == CRC_POLYLENGTH_32B) || \
mbed_official 610:813dcc80987e 299 ((LENGTH) == CRC_POLYLENGTH_16B) || \
mbed_official 610:813dcc80987e 300 ((LENGTH) == CRC_POLYLENGTH_8B) || \
mbed_official 610:813dcc80987e 301 ((LENGTH) == CRC_POLYLENGTH_7B))
mbed_official 610:813dcc80987e 302
mbed_official 610:813dcc80987e 303 #define IS_CRC_INPUTDATA_FORMAT(FORMAT) (((FORMAT) == CRC_INPUTDATA_FORMAT_BYTES) || \
mbed_official 610:813dcc80987e 304 ((FORMAT) == CRC_INPUTDATA_FORMAT_HALFWORDS) || \
mbed_official 610:813dcc80987e 305 ((FORMAT) == CRC_INPUTDATA_FORMAT_WORDS))
mbed_official 610:813dcc80987e 306
mbed_official 610:813dcc80987e 307 /**
mbed_official 610:813dcc80987e 308 * @}
mbed_official 610:813dcc80987e 309 */
mbed_official 610:813dcc80987e 310
mbed_official 610:813dcc80987e 311 /* Include CRC HAL Extended module */
mbed_official 610:813dcc80987e 312 #include "stm32l4xx_hal_crc_ex.h"
mbed_official 610:813dcc80987e 313
mbed_official 610:813dcc80987e 314 /* Exported functions --------------------------------------------------------*/
mbed_official 610:813dcc80987e 315 /** @defgroup CRC_Exported_Functions CRC Exported Functions
mbed_official 610:813dcc80987e 316 * @{
mbed_official 610:813dcc80987e 317 */
mbed_official 610:813dcc80987e 318
mbed_official 610:813dcc80987e 319 /* Initialization and de-initialization functions ****************************/
mbed_official 610:813dcc80987e 320 /** @defgroup CRC_Exported_Functions_Group1 Initialization and de-initialization functions
mbed_official 610:813dcc80987e 321 * @{
mbed_official 610:813dcc80987e 322 */
mbed_official 610:813dcc80987e 323 HAL_StatusTypeDef HAL_CRC_Init(CRC_HandleTypeDef *hcrc);
mbed_official 610:813dcc80987e 324 HAL_StatusTypeDef HAL_CRC_DeInit (CRC_HandleTypeDef *hcrc);
mbed_official 610:813dcc80987e 325 void HAL_CRC_MspInit(CRC_HandleTypeDef *hcrc);
mbed_official 610:813dcc80987e 326 void HAL_CRC_MspDeInit(CRC_HandleTypeDef *hcrc);
mbed_official 610:813dcc80987e 327 /**
mbed_official 610:813dcc80987e 328 * @}
mbed_official 610:813dcc80987e 329 */
mbed_official 610:813dcc80987e 330
mbed_official 610:813dcc80987e 331 /* Peripheral Control functions ***********************************************/
mbed_official 610:813dcc80987e 332 /** @defgroup CRC_Exported_Functions_Group2 Peripheral Control functions
mbed_official 610:813dcc80987e 333 * @{
mbed_official 610:813dcc80987e 334 */
mbed_official 610:813dcc80987e 335 uint32_t HAL_CRC_Accumulate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_t BufferLength);
mbed_official 610:813dcc80987e 336 uint32_t HAL_CRC_Calculate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_t BufferLength);
mbed_official 610:813dcc80987e 337 /**
mbed_official 610:813dcc80987e 338 * @}
mbed_official 610:813dcc80987e 339 */
mbed_official 610:813dcc80987e 340
mbed_official 610:813dcc80987e 341 /* Peripheral State and Error functions ***************************************/
mbed_official 610:813dcc80987e 342 /** @defgroup CRC_Exported_Functions_Group3 Peripheral State functions
mbed_official 610:813dcc80987e 343 * @{
mbed_official 610:813dcc80987e 344 */
mbed_official 610:813dcc80987e 345 HAL_CRC_StateTypeDef HAL_CRC_GetState(CRC_HandleTypeDef *hcrc);
mbed_official 610:813dcc80987e 346 /**
mbed_official 610:813dcc80987e 347 * @}
mbed_official 610:813dcc80987e 348 */
mbed_official 610:813dcc80987e 349
mbed_official 610:813dcc80987e 350 /**
mbed_official 610:813dcc80987e 351 * @}
mbed_official 610:813dcc80987e 352 */
mbed_official 610:813dcc80987e 353
mbed_official 610:813dcc80987e 354 /**
mbed_official 610:813dcc80987e 355 * @}
mbed_official 610:813dcc80987e 356 */
mbed_official 610:813dcc80987e 357
mbed_official 610:813dcc80987e 358 /**
mbed_official 610:813dcc80987e 359 * @}
mbed_official 610:813dcc80987e 360 */
mbed_official 610:813dcc80987e 361
mbed_official 610:813dcc80987e 362 #ifdef __cplusplus
mbed_official 610:813dcc80987e 363 }
mbed_official 610:813dcc80987e 364 #endif
mbed_official 610:813dcc80987e 365
mbed_official 610:813dcc80987e 366 #endif /* __STM32L4xx_HAL_CRC_H */
mbed_official 610:813dcc80987e 367
mbed_official 610:813dcc80987e 368 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/