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