my fork
Fork of mbed by
TARGET_NUCLEO_L053R8/stm32l0xx_hal_crc.h@97:4298809c7c9e, 2015-04-08 (annotated)
- Committer:
- filartrix
- Date:
- Wed Apr 08 14:12:53 2015 +0000
- Revision:
- 97:4298809c7c9e
- Parent:
- 96:487b796308b0
First reale BlueNRG module for nucleo 401 board
Who changed what in which revision?
User | Revision | Line number | New 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 | 96:487b796308b0 | 5 | * @version V1.2.0 |
Kojto | 96:487b796308b0 | 6 | * @date 06-February-2015 |
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 | 96:487b796308b0 | 11 | * <h2><center>© COPYRIGHT(c) 2015 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 | |
bogdanm | 84:0b3ab51c8877 | 57 | /* Exported types ------------------------------------------------------------*/ |
bogdanm | 84:0b3ab51c8877 | 58 | |
bogdanm | 84:0b3ab51c8877 | 59 | /** |
bogdanm | 84:0b3ab51c8877 | 60 | * @brief CRC HAL State Structure definition |
bogdanm | 84:0b3ab51c8877 | 61 | */ |
bogdanm | 84:0b3ab51c8877 | 62 | typedef enum |
Kojto | 96:487b796308b0 | 63 | { |
Kojto | 96:487b796308b0 | 64 | HAL_CRC_STATE_RESET = 0x00, /*!< CRC not yet initialized or disabled */ |
Kojto | 96:487b796308b0 | 65 | HAL_CRC_STATE_READY = 0x01, /*!< CRC initialized and ready for use */ |
Kojto | 96:487b796308b0 | 66 | HAL_CRC_STATE_BUSY = 0x02, /*!< CRC internal process is ongoing */ |
Kojto | 96:487b796308b0 | 67 | HAL_CRC_STATE_TIMEOUT = 0x03, /*!< CRC timeout state */ |
Kojto | 96:487b796308b0 | 68 | HAL_CRC_STATE_ERROR = 0x04 /*!< CRC error state */ |
bogdanm | 84:0b3ab51c8877 | 69 | }HAL_CRC_StateTypeDef; |
bogdanm | 84:0b3ab51c8877 | 70 | |
Kojto | 96:487b796308b0 | 71 | |
bogdanm | 84:0b3ab51c8877 | 72 | /** |
bogdanm | 84:0b3ab51c8877 | 73 | * @brief CRC Init Structure definition |
bogdanm | 84:0b3ab51c8877 | 74 | */ |
bogdanm | 84:0b3ab51c8877 | 75 | typedef struct |
bogdanm | 84:0b3ab51c8877 | 76 | { |
bogdanm | 84:0b3ab51c8877 | 77 | uint8_t DefaultPolynomialUse; /*!< This parameter is a value of @ref CRC_Default_Polynomial and indicates if default polynomial is used. |
bogdanm | 84:0b3ab51c8877 | 78 | If set to DEFAULT_POLYNOMIAL_ENABLE, resort to default |
bogdanm | 84:0b3ab51c8877 | 79 | 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 | 80 | In that case, there is no need to set GeneratingPolynomial field. |
bogdanm | 84:0b3ab51c8877 | 81 | If otherwise set to DEFAULT_POLYNOMIAL_DISABLE, GeneratingPolynomial and CRCLength fields must be set */ |
bogdanm | 84:0b3ab51c8877 | 82 | |
bogdanm | 84:0b3ab51c8877 | 83 | 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 | 84 | If set to DEFAULT_INIT_VALUE_ENABLE, resort to default |
bogdanm | 84:0b3ab51c8877 | 85 | 0xFFFFFFFF value. In that case, there is no need to set InitValue field. |
bogdanm | 84:0b3ab51c8877 | 86 | If otherwise set to DEFAULT_INIT_VALUE_DISABLE, InitValue field must be set */ |
bogdanm | 84:0b3ab51c8877 | 87 | |
bogdanm | 84:0b3ab51c8877 | 88 | uint32_t GeneratingPolynomial; /*!< Set CRC generating polynomial. 7, 8, 16 or 32-bit long value for a polynomial degree |
bogdanm | 84:0b3ab51c8877 | 89 | respectively equal to 7, 8, 16 or 32. This field is written in normal representation, |
bogdanm | 84:0b3ab51c8877 | 90 | e.g., for a polynomial of degree 7, X^7 + X^6 + X^5 + X^2 + 1 is written 0x65. |
bogdanm | 84:0b3ab51c8877 | 91 | No need to specify it if DefaultPolynomialUse is set to DEFAULT_POLYNOMIAL_ENABLE */ |
bogdanm | 84:0b3ab51c8877 | 92 | |
Kojto | 96:487b796308b0 | 93 | uint32_t CRCLength; /*!< This parameter is a value of @ref CRC_Polynomial_Sizes and indicates CRC length. |
bogdanm | 84:0b3ab51c8877 | 94 | Value can be either one of |
bogdanm | 84:0b3ab51c8877 | 95 | CRC_POLYLENGTH_32B (32-bit CRC) |
bogdanm | 84:0b3ab51c8877 | 96 | CRC_POLYLENGTH_16B (16-bit CRC) |
bogdanm | 84:0b3ab51c8877 | 97 | CRC_POLYLENGTH_8B (8-bit CRC) |
bogdanm | 84:0b3ab51c8877 | 98 | CRC_POLYLENGTH_7B (7-bit CRC) */ |
bogdanm | 84:0b3ab51c8877 | 99 | |
bogdanm | 84:0b3ab51c8877 | 100 | uint32_t InitValue; /*!< Init value to initiate CRC computation. No need to specify it if DefaultInitValueUse |
bogdanm | 84:0b3ab51c8877 | 101 | is set to DEFAULT_INIT_VALUE_ENABLE */ |
Kojto | 96:487b796308b0 | 102 | |
Kojto | 96:487b796308b0 | 103 | uint32_t InputDataInversionMode; /*!< This parameter is a value of @ref CRCEx_Input_Data_Inversion and specifies input data inversion mode. |
bogdanm | 84:0b3ab51c8877 | 104 | Can be either one of the following values |
bogdanm | 84:0b3ab51c8877 | 105 | CRC_INPUTDATA_INVERSION_NONE no input data inversion |
bogdanm | 84:0b3ab51c8877 | 106 | CRC_INPUTDATA_INVERSION_BYTE byte-wise inversion, 0x1A2B3C4D becomes 0x58D43CB2 |
bogdanm | 84:0b3ab51c8877 | 107 | CRC_INPUTDATA_INVERSION_HALFWORD halfword-wise inversion, 0x1A2B3C4D becomes 0xD458B23C |
bogdanm | 84:0b3ab51c8877 | 108 | CRC_INPUTDATA_INVERSION_WORD word-wise inversion, 0x1A2B3C4D becomes 0xB23CD458 */ |
bogdanm | 84:0b3ab51c8877 | 109 | |
Kojto | 96:487b796308b0 | 110 | 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 | 111 | Can be either |
Kojto | 96:487b796308b0 | 112 | CRC_OUTPUTDATA_INVERSION_DISABLE no CRC inversion, or |
Kojto | 96:487b796308b0 | 113 | CRC_OUTPUTDATA_INVERSION_ENABLE CRC 0x11223344 is converted into 0x22CC4488 */ |
bogdanm | 84:0b3ab51c8877 | 114 | }CRC_InitTypeDef; |
bogdanm | 84:0b3ab51c8877 | 115 | |
bogdanm | 84:0b3ab51c8877 | 116 | |
bogdanm | 84:0b3ab51c8877 | 117 | /** |
bogdanm | 84:0b3ab51c8877 | 118 | * @brief CRC Handle Structure definition |
bogdanm | 84:0b3ab51c8877 | 119 | */ |
bogdanm | 84:0b3ab51c8877 | 120 | typedef struct |
bogdanm | 84:0b3ab51c8877 | 121 | { |
bogdanm | 84:0b3ab51c8877 | 122 | CRC_TypeDef *Instance; /*!< Register base address */ |
Kojto | 96:487b796308b0 | 123 | |
bogdanm | 84:0b3ab51c8877 | 124 | CRC_InitTypeDef Init; /*!< CRC configuration parameters */ |
Kojto | 96:487b796308b0 | 125 | |
bogdanm | 84:0b3ab51c8877 | 126 | HAL_LockTypeDef Lock; /*!< CRC Locking object */ |
Kojto | 96:487b796308b0 | 127 | |
bogdanm | 84:0b3ab51c8877 | 128 | __IO HAL_CRC_StateTypeDef State; /*!< CRC communication state */ |
Kojto | 96:487b796308b0 | 129 | |
bogdanm | 92:4fc01daae5a5 | 130 | uint32_t InputDataFormat; /*!< This parameter is a value of @ref CRC_Input_Buffer_Format and specifies input data format. |
bogdanm | 84:0b3ab51c8877 | 131 | Can be either |
bogdanm | 84:0b3ab51c8877 | 132 | CRC_INPUTDATA_FORMAT_BYTES input data is a stream of bytes (8-bit data) |
bogdanm | 84:0b3ab51c8877 | 133 | CRC_INPUTDATA_FORMAT_HALFWORDS input data is a stream of half-words (16-bit data) |
bogdanm | 84:0b3ab51c8877 | 134 | CRC_INPUTDATA_FORMAT_WORDS input data is a stream of words (32-bits data) |
bogdanm | 84:0b3ab51c8877 | 135 | Note that constant CRC_INPUT_FORMAT_UNDEFINED is defined but an initialization error |
bogdanm | 84:0b3ab51c8877 | 136 | must occur if InputBufferFormat is not one of the three values listed above */ |
bogdanm | 84:0b3ab51c8877 | 137 | }CRC_HandleTypeDef; |
bogdanm | 84:0b3ab51c8877 | 138 | |
bogdanm | 84:0b3ab51c8877 | 139 | /* Exported constants --------------------------------------------------------*/ |
Kojto | 96:487b796308b0 | 140 | /** @defgroup CRC_Exported_Constants CRC exported constants |
bogdanm | 92:4fc01daae5a5 | 141 | * @{ |
bogdanm | 92:4fc01daae5a5 | 142 | */ |
bogdanm | 92:4fc01daae5a5 | 143 | |
Kojto | 96:487b796308b0 | 144 | /** @defgroup CRC_Default_Polynomial_Value Default CRC generating polynomial |
bogdanm | 84:0b3ab51c8877 | 145 | * @{ |
bogdanm | 84:0b3ab51c8877 | 146 | */ |
bogdanm | 84:0b3ab51c8877 | 147 | #define DEFAULT_CRC32_POLY 0x04C11DB7 |
bogdanm | 84:0b3ab51c8877 | 148 | |
bogdanm | 84:0b3ab51c8877 | 149 | /** |
bogdanm | 84:0b3ab51c8877 | 150 | * @} |
bogdanm | 84:0b3ab51c8877 | 151 | */ |
bogdanm | 84:0b3ab51c8877 | 152 | |
Kojto | 96:487b796308b0 | 153 | /** @defgroup CRC_Default_InitValue Default CRC computation initialization value |
bogdanm | 84:0b3ab51c8877 | 154 | * @{ |
bogdanm | 84:0b3ab51c8877 | 155 | */ |
bogdanm | 84:0b3ab51c8877 | 156 | #define DEFAULT_CRC_INITVALUE 0xFFFFFFFF |
bogdanm | 84:0b3ab51c8877 | 157 | |
bogdanm | 84:0b3ab51c8877 | 158 | /** |
bogdanm | 84:0b3ab51c8877 | 159 | * @} |
bogdanm | 84:0b3ab51c8877 | 160 | */ |
bogdanm | 84:0b3ab51c8877 | 161 | |
Kojto | 96:487b796308b0 | 162 | /** @defgroup CRC_Default_Polynomial Indicates whether or not default polynomial is used |
bogdanm | 84:0b3ab51c8877 | 163 | * @{ |
bogdanm | 84:0b3ab51c8877 | 164 | */ |
bogdanm | 84:0b3ab51c8877 | 165 | #define DEFAULT_POLYNOMIAL_ENABLE ((uint8_t)0x00) |
bogdanm | 84:0b3ab51c8877 | 166 | #define DEFAULT_POLYNOMIAL_DISABLE ((uint8_t)0x01) |
Kojto | 96:487b796308b0 | 167 | |
Kojto | 96:487b796308b0 | 168 | #define IS_DEFAULT_POLYNOMIAL(__DEFAULT__) (((__DEFAULT__) == DEFAULT_POLYNOMIAL_ENABLE) || \ |
Kojto | 96:487b796308b0 | 169 | ((__DEFAULT__) == DEFAULT_POLYNOMIAL_DISABLE)) |
Kojto | 96:487b796308b0 | 170 | |
bogdanm | 84:0b3ab51c8877 | 171 | /** |
bogdanm | 84:0b3ab51c8877 | 172 | * @} |
bogdanm | 84:0b3ab51c8877 | 173 | */ |
bogdanm | 84:0b3ab51c8877 | 174 | |
Kojto | 96:487b796308b0 | 175 | /** @defgroup CRC_Default_InitValue_Use Indicates whether or not default init value is used |
bogdanm | 84:0b3ab51c8877 | 176 | * @{ |
bogdanm | 84:0b3ab51c8877 | 177 | */ |
bogdanm | 84:0b3ab51c8877 | 178 | #define DEFAULT_INIT_VALUE_ENABLE ((uint8_t)0x00) |
bogdanm | 84:0b3ab51c8877 | 179 | #define DEFAULT_INIT_VALUE_DISABLE ((uint8_t)0x01) |
Kojto | 96:487b796308b0 | 180 | |
Kojto | 96:487b796308b0 | 181 | #define IS_DEFAULT_INIT_VALUE(__VALUE__) (((__VALUE__) == DEFAULT_INIT_VALUE_ENABLE) || \ |
Kojto | 96:487b796308b0 | 182 | ((__VALUE__) == DEFAULT_INIT_VALUE_DISABLE)) |
bogdanm | 84:0b3ab51c8877 | 183 | |
bogdanm | 84:0b3ab51c8877 | 184 | /** |
bogdanm | 84:0b3ab51c8877 | 185 | * @} |
bogdanm | 84:0b3ab51c8877 | 186 | */ |
bogdanm | 84:0b3ab51c8877 | 187 | |
Kojto | 96:487b796308b0 | 188 | /** @defgroup CRC_Polynomial_Sizes Polynomial sizes to configure the IP |
bogdanm | 84:0b3ab51c8877 | 189 | * @{ |
bogdanm | 84:0b3ab51c8877 | 190 | */ |
bogdanm | 84:0b3ab51c8877 | 191 | #define CRC_POLYLENGTH_32B ((uint32_t)0x00000000) |
bogdanm | 84:0b3ab51c8877 | 192 | #define CRC_POLYLENGTH_16B ((uint32_t)CRC_CR_POLYSIZE_0) |
bogdanm | 84:0b3ab51c8877 | 193 | #define CRC_POLYLENGTH_8B ((uint32_t)CRC_CR_POLYSIZE_1) |
bogdanm | 84:0b3ab51c8877 | 194 | #define CRC_POLYLENGTH_7B ((uint32_t)CRC_CR_POLYSIZE) |
Kojto | 96:487b796308b0 | 195 | #define IS_CRC_POL_LENGTH(__LENGTH__) (((__LENGTH__) == CRC_POLYLENGTH_32B) || \ |
Kojto | 96:487b796308b0 | 196 | ((__LENGTH__) == CRC_POLYLENGTH_16B) || \ |
Kojto | 96:487b796308b0 | 197 | ((__LENGTH__) == CRC_POLYLENGTH_8B) || \ |
Kojto | 96:487b796308b0 | 198 | ((__LENGTH__) == CRC_POLYLENGTH_7B)) |
bogdanm | 84:0b3ab51c8877 | 199 | /** |
bogdanm | 84:0b3ab51c8877 | 200 | * @} |
bogdanm | 84:0b3ab51c8877 | 201 | */ |
bogdanm | 84:0b3ab51c8877 | 202 | |
Kojto | 96:487b796308b0 | 203 | /** @defgroup CRC_Polynomial_Size_Definitions CRC polynomial possible sizes actual definitions |
bogdanm | 84:0b3ab51c8877 | 204 | * @{ |
bogdanm | 84:0b3ab51c8877 | 205 | */ |
bogdanm | 84:0b3ab51c8877 | 206 | #define HAL_CRC_LENGTH_32B 32 |
bogdanm | 84:0b3ab51c8877 | 207 | #define HAL_CRC_LENGTH_16B 16 |
bogdanm | 84:0b3ab51c8877 | 208 | #define HAL_CRC_LENGTH_8B 8 |
bogdanm | 84:0b3ab51c8877 | 209 | #define HAL_CRC_LENGTH_7B 7 |
bogdanm | 84:0b3ab51c8877 | 210 | |
bogdanm | 84:0b3ab51c8877 | 211 | /** |
bogdanm | 84:0b3ab51c8877 | 212 | * @} |
bogdanm | 84:0b3ab51c8877 | 213 | */ |
bogdanm | 84:0b3ab51c8877 | 214 | |
Kojto | 96:487b796308b0 | 215 | /** @defgroup CRC_Input_Buffer_Format CRC input buffer format |
bogdanm | 84:0b3ab51c8877 | 216 | * @{ |
bogdanm | 84:0b3ab51c8877 | 217 | */ |
bogdanm | 84:0b3ab51c8877 | 218 | /* WARNING: CRC_INPUT_FORMAT_UNDEFINED is created for reference purposes but |
bogdanm | 84:0b3ab51c8877 | 219 | * an error is triggered in HAL_CRC_Init() if InputDataFormat field is set |
bogdanm | 84:0b3ab51c8877 | 220 | * to CRC_INPUT_FORMAT_UNDEFINED: the format MUST be defined by the user for |
bogdanm | 84:0b3ab51c8877 | 221 | * the CRC APIs to provide a correct result */ |
bogdanm | 84:0b3ab51c8877 | 222 | #define CRC_INPUTDATA_FORMAT_UNDEFINED ((uint32_t)0x00000000) |
bogdanm | 84:0b3ab51c8877 | 223 | #define CRC_INPUTDATA_FORMAT_BYTES ((uint32_t)0x00000001) |
bogdanm | 84:0b3ab51c8877 | 224 | #define CRC_INPUTDATA_FORMAT_HALFWORDS ((uint32_t)0x00000002) |
bogdanm | 84:0b3ab51c8877 | 225 | #define CRC_INPUTDATA_FORMAT_WORDS ((uint32_t)0x00000003) |
Kojto | 96:487b796308b0 | 226 | |
Kojto | 96:487b796308b0 | 227 | #define IS_CRC_INPUTDATA_FORMAT(__FORMAT__) (((__FORMAT__) == CRC_INPUTDATA_FORMAT_BYTES) || \ |
Kojto | 96:487b796308b0 | 228 | ((__FORMAT__) == CRC_INPUTDATA_FORMAT_HALFWORDS) || \ |
Kojto | 96:487b796308b0 | 229 | ((__FORMAT__) == CRC_INPUTDATA_FORMAT_WORDS)) |
bogdanm | 84:0b3ab51c8877 | 230 | /** |
bogdanm | 84:0b3ab51c8877 | 231 | * @} |
bogdanm | 84:0b3ab51c8877 | 232 | */ |
bogdanm | 84:0b3ab51c8877 | 233 | |
bogdanm | 92:4fc01daae5a5 | 234 | /** |
bogdanm | 92:4fc01daae5a5 | 235 | * @} |
bogdanm | 92:4fc01daae5a5 | 236 | */ |
Kojto | 96:487b796308b0 | 237 | /* Exported macros -----------------------------------------------------------*/ |
bogdanm | 84:0b3ab51c8877 | 238 | |
Kojto | 96:487b796308b0 | 239 | /** @defgroup CRC_Exported_Macros CRC exported macros |
bogdanm | 84:0b3ab51c8877 | 240 | * @{ |
bogdanm | 84:0b3ab51c8877 | 241 | */ |
bogdanm | 84:0b3ab51c8877 | 242 | |
bogdanm | 84:0b3ab51c8877 | 243 | /** @brief Reset CRC handle state |
Kojto | 96:487b796308b0 | 244 | * @param __HANDLE__: CRC handle. |
bogdanm | 84:0b3ab51c8877 | 245 | * @retval None |
bogdanm | 84:0b3ab51c8877 | 246 | */ |
bogdanm | 84:0b3ab51c8877 | 247 | #define __HAL_CRC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_CRC_STATE_RESET) |
bogdanm | 84:0b3ab51c8877 | 248 | |
bogdanm | 84:0b3ab51c8877 | 249 | /** |
bogdanm | 84:0b3ab51c8877 | 250 | * @brief Reset CRC Data Register. |
bogdanm | 84:0b3ab51c8877 | 251 | * @param __HANDLE__: CRC handle |
bogdanm | 84:0b3ab51c8877 | 252 | * @retval None. |
bogdanm | 84:0b3ab51c8877 | 253 | */ |
bogdanm | 84:0b3ab51c8877 | 254 | #define __HAL_CRC_DR_RESET(__HANDLE__) ((__HANDLE__)->Instance->CR |= CRC_CR_RESET) |
bogdanm | 84:0b3ab51c8877 | 255 | |
bogdanm | 84:0b3ab51c8877 | 256 | /** |
bogdanm | 84:0b3ab51c8877 | 257 | * @brief Set CRC INIT non-default value |
bogdanm | 84:0b3ab51c8877 | 258 | * @param __HANDLE__ : CRC handle |
bogdanm | 84:0b3ab51c8877 | 259 | * @param __INIT__ : 32-bit initial value |
bogdanm | 84:0b3ab51c8877 | 260 | * @retval None. |
bogdanm | 84:0b3ab51c8877 | 261 | */ |
bogdanm | 84:0b3ab51c8877 | 262 | #define __HAL_CRC_INITIALCRCVALUE_CONFIG(__HANDLE__, __INIT__) ((__HANDLE__)->Instance->INIT = (__INIT__)) |
bogdanm | 84:0b3ab51c8877 | 263 | |
Kojto | 96:487b796308b0 | 264 | /** |
Kojto | 96:487b796308b0 | 265 | * @brief Stores a 8-bit data in the Independent Data(ID) register. |
Kojto | 96:487b796308b0 | 266 | * @param __HANDLE__: CRC handle |
Kojto | 96:487b796308b0 | 267 | * @param __VALUE__: 8-bit value to be stored in the ID register |
Kojto | 96:487b796308b0 | 268 | * @retval None |
Kojto | 96:487b796308b0 | 269 | */ |
Kojto | 96:487b796308b0 | 270 | #define __HAL_CRC_SET_IDR(__HANDLE__, __VALUE__) (MODIFY_REG((__HANDLE__)->Instance->IDR, CRC_IDR_IDR, (__VALUE__)) |
bogdanm | 84:0b3ab51c8877 | 271 | |
bogdanm | 84:0b3ab51c8877 | 272 | /** |
Kojto | 96:487b796308b0 | 273 | * @brief Returns the 8-bit data stored in the Independent Data(ID) register. |
Kojto | 96:487b796308b0 | 274 | * @param __HANDLE__: CRC handle |
Kojto | 96:487b796308b0 | 275 | * @retval 8-bit value of the ID register |
bogdanm | 84:0b3ab51c8877 | 276 | */ |
Kojto | 96:487b796308b0 | 277 | #define __HAL_CRC_GET_IDR(__HANDLE__) (((__HANDLE__)->Instance->IDR) & CRC_IDR_IDR) |
bogdanm | 84:0b3ab51c8877 | 278 | /** |
bogdanm | 84:0b3ab51c8877 | 279 | * @} |
bogdanm | 84:0b3ab51c8877 | 280 | */ |
bogdanm | 84:0b3ab51c8877 | 281 | |
bogdanm | 84:0b3ab51c8877 | 282 | |
bogdanm | 84:0b3ab51c8877 | 283 | /* Include CRC HAL Extension module */ |
bogdanm | 84:0b3ab51c8877 | 284 | #include "stm32l0xx_hal_crc_ex.h" |
bogdanm | 84:0b3ab51c8877 | 285 | |
bogdanm | 84:0b3ab51c8877 | 286 | /* Exported functions --------------------------------------------------------*/ |
Kojto | 96:487b796308b0 | 287 | /** @defgroup CRC_Exported_Functions CRC Exported Functions |
Kojto | 96:487b796308b0 | 288 | * @{ |
Kojto | 96:487b796308b0 | 289 | */ |
bogdanm | 84:0b3ab51c8877 | 290 | |
Kojto | 96:487b796308b0 | 291 | /** @defgroup CRC_Exported_Functions_Group1 Initialization/de-initialization functions |
Kojto | 96:487b796308b0 | 292 | * @{ |
Kojto | 96:487b796308b0 | 293 | */ |
bogdanm | 84:0b3ab51c8877 | 294 | /* Initialization and de-initialization functions ****************************/ |
bogdanm | 84:0b3ab51c8877 | 295 | HAL_StatusTypeDef HAL_CRC_Init(CRC_HandleTypeDef *hcrc); |
bogdanm | 84:0b3ab51c8877 | 296 | HAL_StatusTypeDef HAL_CRC_DeInit (CRC_HandleTypeDef *hcrc); |
bogdanm | 84:0b3ab51c8877 | 297 | void HAL_CRC_MspInit(CRC_HandleTypeDef *hcrc); |
bogdanm | 84:0b3ab51c8877 | 298 | void HAL_CRC_MspDeInit(CRC_HandleTypeDef *hcrc); |
Kojto | 96:487b796308b0 | 299 | /** |
Kojto | 96:487b796308b0 | 300 | * @} |
Kojto | 96:487b796308b0 | 301 | */ |
bogdanm | 84:0b3ab51c8877 | 302 | |
Kojto | 96:487b796308b0 | 303 | /* Aliases for inter STM32 series compatibility */ |
Kojto | 96:487b796308b0 | 304 | #define HAL_CRC_Input_Data_Reverse HAL_CRCEx_Input_Data_Reverse |
Kojto | 96:487b796308b0 | 305 | #define HAL_CRC_Output_Data_Reverse HAL_CRCEx_Output_Data_Reverse |
Kojto | 96:487b796308b0 | 306 | |
Kojto | 96:487b796308b0 | 307 | /** @defgroup CRC_Exported_Functions_Group2 Peripheral Control functions |
Kojto | 96:487b796308b0 | 308 | * @{ |
Kojto | 96:487b796308b0 | 309 | */ |
bogdanm | 84:0b3ab51c8877 | 310 | /* Peripheral Control functions ***********************************************/ |
bogdanm | 84:0b3ab51c8877 | 311 | uint32_t HAL_CRC_Accumulate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_t BufferLength); |
bogdanm | 84:0b3ab51c8877 | 312 | uint32_t HAL_CRC_Calculate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_t BufferLength); |
Kojto | 96:487b796308b0 | 313 | /** |
Kojto | 96:487b796308b0 | 314 | * @} |
Kojto | 96:487b796308b0 | 315 | */ |
bogdanm | 84:0b3ab51c8877 | 316 | |
Kojto | 96:487b796308b0 | 317 | /** @defgroup CRC_Exported_Functions_Group3 Peripheral State functions |
Kojto | 96:487b796308b0 | 318 | * @{ |
Kojto | 96:487b796308b0 | 319 | */ |
bogdanm | 84:0b3ab51c8877 | 320 | /* Peripheral State and Error functions ***************************************/ |
bogdanm | 84:0b3ab51c8877 | 321 | HAL_CRC_StateTypeDef HAL_CRC_GetState(CRC_HandleTypeDef *hcrc); |
Kojto | 96:487b796308b0 | 322 | /** |
Kojto | 96:487b796308b0 | 323 | * @} |
Kojto | 96:487b796308b0 | 324 | */ |
Kojto | 96:487b796308b0 | 325 | |
Kojto | 96:487b796308b0 | 326 | /** |
Kojto | 96:487b796308b0 | 327 | * @} |
Kojto | 96:487b796308b0 | 328 | */ |
Kojto | 96:487b796308b0 | 329 | |
bogdanm | 84:0b3ab51c8877 | 330 | |
bogdanm | 84:0b3ab51c8877 | 331 | /** |
bogdanm | 84:0b3ab51c8877 | 332 | * @} |
bogdanm | 84:0b3ab51c8877 | 333 | */ |
bogdanm | 84:0b3ab51c8877 | 334 | |
bogdanm | 84:0b3ab51c8877 | 335 | /** |
bogdanm | 84:0b3ab51c8877 | 336 | * @} |
bogdanm | 84:0b3ab51c8877 | 337 | */ |
bogdanm | 84:0b3ab51c8877 | 338 | |
bogdanm | 84:0b3ab51c8877 | 339 | #ifdef __cplusplus |
bogdanm | 84:0b3ab51c8877 | 340 | } |
bogdanm | 84:0b3ab51c8877 | 341 | #endif |
bogdanm | 84:0b3ab51c8877 | 342 | |
bogdanm | 84:0b3ab51c8877 | 343 | #endif /* __STM32L0xx_HAL_CRC_H */ |
bogdanm | 84:0b3ab51c8877 | 344 | |
bogdanm | 84:0b3ab51c8877 | 345 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
Kojto | 96:487b796308b0 | 346 |