Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

Committer:
Kojto
Date:
Wed Sep 16 15:32:31 2015 +0100
Revision:
107:4f6c30876dfa
Release 107  of the mbed library

Changes:
- new platforms - DISCO_F746NG, DISCO_L476VG, NUCLEO_L476RG
- KL43Z - bugfix RTC init function
- K20 - SPI mode fix

Who changed what in which revision?

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