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