The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
<>
Date:
Wed Apr 12 16:07:08 2017 +0100
Revision:
140:97feb9bacc10
Parent:
128:9bcdf88f62b0
Child:
145:64910690c574
Release 140 of the mbed library

Ports for Upcoming Targets

3841: Add nRf52840 target https://github.com/ARMmbed/mbed-os/pull/3841
3992: Introducing UBLOX_C030 platform. https://github.com/ARMmbed/mbed-os/pull/3992

Fixes and Changes

3951: [NUCLEO_F303ZE] Correct ARDUINO pin https://github.com/ARMmbed/mbed-os/pull/3951
4021: Fixing a macro to detect when RTOS was in use for the NRF52840_DK https://github.com/ARMmbed/mbed-os/pull/4021
3979: KW24D: Add missing SPI defines and Arduino connector definitions https://github.com/ARMmbed/mbed-os/pull/3979
3990: UBLOX_C027: construct a ticker-based wait, rather than calling wait_ms(), in the https://github.com/ARMmbed/mbed-os/pull/3990
4003: Fixed OBOE in async serial tx for NRF52 target, fixes #4002 https://github.com/ARMmbed/mbed-os/pull/4003
4012: STM32: Correct I2C master error handling https://github.com/ARMmbed/mbed-os/pull/4012
4020: NUCLEO_L011K4 remove unsupported tool chain files https://github.com/ARMmbed/mbed-os/pull/4020
4065: K66F: Move bss section to m_data_2 Section https://github.com/ARMmbed/mbed-os/pull/4065
4014: Issue 3763: Reduce heap allocation in the GCC linker file https://github.com/ARMmbed/mbed-os/pull/4014
4030: [STM32L0] reduce IAR heap and stack size for small targets https://github.com/ARMmbed/mbed-os/pull/4030
4109: NUCLEO_L476RG : minor serial pin update https://github.com/ARMmbed/mbed-os/pull/4109
3982: Ticker - kl25z bugfix for handling events in the past https://github.com/ARMmbed/mbed-os/pull/3982

Who changed what in which revision?

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