mbed official / mbed

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

Committer:
Kojto
Date:
Wed Apr 27 12:10:56 2016 -0500
Revision:
119:aae6fcc7d9bb
Parent:
96:487b796308b0
Release 119 of the mbed library

Changes:
- new targets - EFM32PG_STK3401, NUCLEO_L031K6
- ST - hwflwctl support for NUCLEO_L476RG
- Update STM32CUBE_L0 from v1.2 to v1.5
- STM32F7 - bugfix - The weak function HAL_Delay is overwritten to use us ticker API.
- Maxim - Fixing the send break for the MAXWSNENV and MAX32600MBED

Who changed what in which revision?

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