L4 HAL Drivers

Committer:
EricLew
Date:
Mon Nov 02 19:37:23 2015 +0000
Revision:
0:80ee8f3b695e
Errors are with definitions of LCD and QSPI functions. I believe all .h and .c files are  uploaded, but there may need to be certain functions called.

Who changed what in which revision?

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