Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
HAL_L476/stm32l4xx_hal_crc.c@1:d0dfbce63a89, 2017-02-24 (annotated)
- Committer:
- elmot
- Date:
- Fri Feb 24 21:13:56 2017 +0000
- Revision:
- 1:d0dfbce63a89
Ready-to-copy
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| elmot | 1:d0dfbce63a89 | 1 | /** |
| elmot | 1:d0dfbce63a89 | 2 | ****************************************************************************** |
| elmot | 1:d0dfbce63a89 | 3 | * @file stm32l4xx_hal_crc.c |
| elmot | 1:d0dfbce63a89 | 4 | * @author MCD Application Team |
| elmot | 1:d0dfbce63a89 | 5 | * @version V1.5.1 |
| elmot | 1:d0dfbce63a89 | 6 | * @date 31-May-2016 |
| elmot | 1:d0dfbce63a89 | 7 | * @brief CRC HAL module driver. |
| elmot | 1:d0dfbce63a89 | 8 | * This file provides firmware functions to manage the following |
| elmot | 1:d0dfbce63a89 | 9 | * functionalities of the CRC peripheral: |
| elmot | 1:d0dfbce63a89 | 10 | * + Initialization and de-initialization functions |
| elmot | 1:d0dfbce63a89 | 11 | * + Peripheral Control functions |
| elmot | 1:d0dfbce63a89 | 12 | * + Peripheral State functions |
| elmot | 1:d0dfbce63a89 | 13 | * |
| elmot | 1:d0dfbce63a89 | 14 | @verbatim |
| elmot | 1:d0dfbce63a89 | 15 | =============================================================================== |
| elmot | 1:d0dfbce63a89 | 16 | ##### How to use this driver ##### |
| elmot | 1:d0dfbce63a89 | 17 | =============================================================================== |
| elmot | 1:d0dfbce63a89 | 18 | [..] |
| elmot | 1:d0dfbce63a89 | 19 | (+) Enable CRC AHB clock using __HAL_RCC_CRC_CLK_ENABLE(); |
| elmot | 1:d0dfbce63a89 | 20 | (+) Initialize CRC calculator |
| elmot | 1:d0dfbce63a89 | 21 | (++) specify generating polynomial (IP default or non-default one) |
| elmot | 1:d0dfbce63a89 | 22 | (++) specify initialization value (IP default or non-default one) |
| elmot | 1:d0dfbce63a89 | 23 | (++) specify input data format |
| elmot | 1:d0dfbce63a89 | 24 | (++) specify input or output data inversion mode if any |
| elmot | 1:d0dfbce63a89 | 25 | (+) Use HAL_CRC_Accumulate() function to compute the CRC value of the |
| elmot | 1:d0dfbce63a89 | 26 | input data buffer starting with the previously computed CRC as |
| elmot | 1:d0dfbce63a89 | 27 | initialization value |
| elmot | 1:d0dfbce63a89 | 28 | (+) Use HAL_CRC_Calculate() function to compute the CRC value of the |
| elmot | 1:d0dfbce63a89 | 29 | input data buffer starting with the defined initialization value |
| elmot | 1:d0dfbce63a89 | 30 | (default or non-default) to initiate CRC calculation |
| elmot | 1:d0dfbce63a89 | 31 | |
| elmot | 1:d0dfbce63a89 | 32 | @endverbatim |
| elmot | 1:d0dfbce63a89 | 33 | ****************************************************************************** |
| elmot | 1:d0dfbce63a89 | 34 | * @attention |
| elmot | 1:d0dfbce63a89 | 35 | * |
| elmot | 1:d0dfbce63a89 | 36 | * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> |
| elmot | 1:d0dfbce63a89 | 37 | * |
| elmot | 1:d0dfbce63a89 | 38 | * Redistribution and use in source and binary forms, with or without modification, |
| elmot | 1:d0dfbce63a89 | 39 | * are permitted provided that the following conditions are met: |
| elmot | 1:d0dfbce63a89 | 40 | * 1. Redistributions of source code must retain the above copyright notice, |
| elmot | 1:d0dfbce63a89 | 41 | * this list of conditions and the following disclaimer. |
| elmot | 1:d0dfbce63a89 | 42 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
| elmot | 1:d0dfbce63a89 | 43 | * this list of conditions and the following disclaimer in the documentation |
| elmot | 1:d0dfbce63a89 | 44 | * and/or other materials provided with the distribution. |
| elmot | 1:d0dfbce63a89 | 45 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
| elmot | 1:d0dfbce63a89 | 46 | * may be used to endorse or promote products derived from this software |
| elmot | 1:d0dfbce63a89 | 47 | * without specific prior written permission. |
| elmot | 1:d0dfbce63a89 | 48 | * |
| elmot | 1:d0dfbce63a89 | 49 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| elmot | 1:d0dfbce63a89 | 50 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| elmot | 1:d0dfbce63a89 | 51 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| elmot | 1:d0dfbce63a89 | 52 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
| elmot | 1:d0dfbce63a89 | 53 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| elmot | 1:d0dfbce63a89 | 54 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| elmot | 1:d0dfbce63a89 | 55 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| elmot | 1:d0dfbce63a89 | 56 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| elmot | 1:d0dfbce63a89 | 57 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| elmot | 1:d0dfbce63a89 | 58 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| elmot | 1:d0dfbce63a89 | 59 | * |
| elmot | 1:d0dfbce63a89 | 60 | ****************************************************************************** |
| elmot | 1:d0dfbce63a89 | 61 | */ |
| elmot | 1:d0dfbce63a89 | 62 | |
| elmot | 1:d0dfbce63a89 | 63 | /* Includes ------------------------------------------------------------------*/ |
| elmot | 1:d0dfbce63a89 | 64 | #include "stm32l4xx_hal.h" |
| elmot | 1:d0dfbce63a89 | 65 | |
| elmot | 1:d0dfbce63a89 | 66 | /** @addtogroup STM32L4xx_HAL_Driver |
| elmot | 1:d0dfbce63a89 | 67 | * @{ |
| elmot | 1:d0dfbce63a89 | 68 | */ |
| elmot | 1:d0dfbce63a89 | 69 | |
| elmot | 1:d0dfbce63a89 | 70 | /** @defgroup CRC CRC |
| elmot | 1:d0dfbce63a89 | 71 | * @brief CRC HAL module driver. |
| elmot | 1:d0dfbce63a89 | 72 | * @{ |
| elmot | 1:d0dfbce63a89 | 73 | */ |
| elmot | 1:d0dfbce63a89 | 74 | |
| elmot | 1:d0dfbce63a89 | 75 | #ifdef HAL_CRC_MODULE_ENABLED |
| elmot | 1:d0dfbce63a89 | 76 | |
| elmot | 1:d0dfbce63a89 | 77 | /* Private typedef -----------------------------------------------------------*/ |
| elmot | 1:d0dfbce63a89 | 78 | /* Private define ------------------------------------------------------------*/ |
| elmot | 1:d0dfbce63a89 | 79 | /* Private macro -------------------------------------------------------------*/ |
| elmot | 1:d0dfbce63a89 | 80 | /* Private variables ---------------------------------------------------------*/ |
| elmot | 1:d0dfbce63a89 | 81 | /* Private function prototypes -----------------------------------------------*/ |
| elmot | 1:d0dfbce63a89 | 82 | /** @defgroup CRC_Private_Functions CRC Private Functions |
| elmot | 1:d0dfbce63a89 | 83 | * @{ |
| elmot | 1:d0dfbce63a89 | 84 | */ |
| elmot | 1:d0dfbce63a89 | 85 | static uint32_t CRC_Handle_8(CRC_HandleTypeDef *hcrc, uint8_t pBuffer[], uint32_t BufferLength); |
| elmot | 1:d0dfbce63a89 | 86 | static uint32_t CRC_Handle_16(CRC_HandleTypeDef *hcrc, uint16_t pBuffer[], uint32_t BufferLength); |
| elmot | 1:d0dfbce63a89 | 87 | /** |
| elmot | 1:d0dfbce63a89 | 88 | * @} |
| elmot | 1:d0dfbce63a89 | 89 | */ |
| elmot | 1:d0dfbce63a89 | 90 | |
| elmot | 1:d0dfbce63a89 | 91 | /* Exported functions --------------------------------------------------------*/ |
| elmot | 1:d0dfbce63a89 | 92 | |
| elmot | 1:d0dfbce63a89 | 93 | /** @defgroup CRC_Exported_Functions CRC Exported Functions |
| elmot | 1:d0dfbce63a89 | 94 | * @{ |
| elmot | 1:d0dfbce63a89 | 95 | */ |
| elmot | 1:d0dfbce63a89 | 96 | |
| elmot | 1:d0dfbce63a89 | 97 | /** @defgroup CRC_Exported_Functions_Group1 Initialization and de-initialization functions |
| elmot | 1:d0dfbce63a89 | 98 | * @brief Initialization and Configuration functions. |
| elmot | 1:d0dfbce63a89 | 99 | * |
| elmot | 1:d0dfbce63a89 | 100 | @verbatim |
| elmot | 1:d0dfbce63a89 | 101 | =============================================================================== |
| elmot | 1:d0dfbce63a89 | 102 | ##### Initialization and de-initialization functions ##### |
| elmot | 1:d0dfbce63a89 | 103 | =============================================================================== |
| elmot | 1:d0dfbce63a89 | 104 | [..] This section provides functions allowing to: |
| elmot | 1:d0dfbce63a89 | 105 | (+) Initialize the CRC according to the specified parameters |
| elmot | 1:d0dfbce63a89 | 106 | in the CRC_InitTypeDef and create the associated handle |
| elmot | 1:d0dfbce63a89 | 107 | (+) DeInitialize the CRC peripheral |
| elmot | 1:d0dfbce63a89 | 108 | (+) Initialize the CRC MSP (MCU Specific Package) |
| elmot | 1:d0dfbce63a89 | 109 | (+) DeInitialize the CRC MSP |
| elmot | 1:d0dfbce63a89 | 110 | |
| elmot | 1:d0dfbce63a89 | 111 | @endverbatim |
| elmot | 1:d0dfbce63a89 | 112 | * @{ |
| elmot | 1:d0dfbce63a89 | 113 | */ |
| elmot | 1:d0dfbce63a89 | 114 | |
| elmot | 1:d0dfbce63a89 | 115 | /** |
| elmot | 1:d0dfbce63a89 | 116 | * @brief Initialize the CRC according to the specified |
| elmot | 1:d0dfbce63a89 | 117 | * parameters in the CRC_InitTypeDef and create the associated handle. |
| elmot | 1:d0dfbce63a89 | 118 | * @param hcrc: CRC handle |
| elmot | 1:d0dfbce63a89 | 119 | * @retval HAL status |
| elmot | 1:d0dfbce63a89 | 120 | */ |
| elmot | 1:d0dfbce63a89 | 121 | HAL_StatusTypeDef HAL_CRC_Init(CRC_HandleTypeDef *hcrc) |
| elmot | 1:d0dfbce63a89 | 122 | { |
| elmot | 1:d0dfbce63a89 | 123 | /* Check the CRC handle allocation */ |
| elmot | 1:d0dfbce63a89 | 124 | if(hcrc == NULL) |
| elmot | 1:d0dfbce63a89 | 125 | { |
| elmot | 1:d0dfbce63a89 | 126 | return HAL_ERROR; |
| elmot | 1:d0dfbce63a89 | 127 | } |
| elmot | 1:d0dfbce63a89 | 128 | |
| elmot | 1:d0dfbce63a89 | 129 | /* Check the parameters */ |
| elmot | 1:d0dfbce63a89 | 130 | assert_param(IS_CRC_ALL_INSTANCE(hcrc->Instance)); |
| elmot | 1:d0dfbce63a89 | 131 | |
| elmot | 1:d0dfbce63a89 | 132 | if(hcrc->State == HAL_CRC_STATE_RESET) |
| elmot | 1:d0dfbce63a89 | 133 | { |
| elmot | 1:d0dfbce63a89 | 134 | /* Allocate lock resource and initialize it */ |
| elmot | 1:d0dfbce63a89 | 135 | hcrc->Lock = HAL_UNLOCKED; |
| elmot | 1:d0dfbce63a89 | 136 | |
| elmot | 1:d0dfbce63a89 | 137 | /* Init the low level hardware */ |
| elmot | 1:d0dfbce63a89 | 138 | HAL_CRC_MspInit(hcrc); |
| elmot | 1:d0dfbce63a89 | 139 | } |
| elmot | 1:d0dfbce63a89 | 140 | |
| elmot | 1:d0dfbce63a89 | 141 | hcrc->State = HAL_CRC_STATE_BUSY; |
| elmot | 1:d0dfbce63a89 | 142 | |
| elmot | 1:d0dfbce63a89 | 143 | /* check whether or not non-default generating polynomial has been |
| elmot | 1:d0dfbce63a89 | 144 | * picked up by user */ |
| elmot | 1:d0dfbce63a89 | 145 | assert_param(IS_DEFAULT_POLYNOMIAL(hcrc->Init.DefaultPolynomialUse)); |
| elmot | 1:d0dfbce63a89 | 146 | if (hcrc->Init.DefaultPolynomialUse == DEFAULT_POLYNOMIAL_ENABLE) |
| elmot | 1:d0dfbce63a89 | 147 | { |
| elmot | 1:d0dfbce63a89 | 148 | /* initialize IP with default generating polynomial */ |
| elmot | 1:d0dfbce63a89 | 149 | WRITE_REG(hcrc->Instance->POL, DEFAULT_CRC32_POLY); |
| elmot | 1:d0dfbce63a89 | 150 | MODIFY_REG(hcrc->Instance->CR, CRC_CR_POLYSIZE, CRC_POLYLENGTH_32B); |
| elmot | 1:d0dfbce63a89 | 151 | } |
| elmot | 1:d0dfbce63a89 | 152 | else |
| elmot | 1:d0dfbce63a89 | 153 | { |
| elmot | 1:d0dfbce63a89 | 154 | /* initialize CRC IP with generating polynomial defined by user */ |
| elmot | 1:d0dfbce63a89 | 155 | if (HAL_CRCEx_Polynomial_Set(hcrc, hcrc->Init.GeneratingPolynomial, hcrc->Init.CRCLength) != HAL_OK) |
| elmot | 1:d0dfbce63a89 | 156 | { |
| elmot | 1:d0dfbce63a89 | 157 | return HAL_ERROR; |
| elmot | 1:d0dfbce63a89 | 158 | } |
| elmot | 1:d0dfbce63a89 | 159 | } |
| elmot | 1:d0dfbce63a89 | 160 | |
| elmot | 1:d0dfbce63a89 | 161 | /* check whether or not non-default CRC initial value has been |
| elmot | 1:d0dfbce63a89 | 162 | * picked up by user */ |
| elmot | 1:d0dfbce63a89 | 163 | assert_param(IS_DEFAULT_INIT_VALUE(hcrc->Init.DefaultInitValueUse)); |
| elmot | 1:d0dfbce63a89 | 164 | if (hcrc->Init.DefaultInitValueUse == DEFAULT_INIT_VALUE_ENABLE) |
| elmot | 1:d0dfbce63a89 | 165 | { |
| elmot | 1:d0dfbce63a89 | 166 | WRITE_REG(hcrc->Instance->INIT, DEFAULT_CRC_INITVALUE); |
| elmot | 1:d0dfbce63a89 | 167 | } |
| elmot | 1:d0dfbce63a89 | 168 | else |
| elmot | 1:d0dfbce63a89 | 169 | { |
| elmot | 1:d0dfbce63a89 | 170 | WRITE_REG(hcrc->Instance->INIT, hcrc->Init.InitValue); |
| elmot | 1:d0dfbce63a89 | 171 | } |
| elmot | 1:d0dfbce63a89 | 172 | |
| elmot | 1:d0dfbce63a89 | 173 | |
| elmot | 1:d0dfbce63a89 | 174 | /* set input data inversion mode */ |
| elmot | 1:d0dfbce63a89 | 175 | assert_param(IS_CRC_INPUTDATA_INVERSION_MODE(hcrc->Init.InputDataInversionMode)); |
| elmot | 1:d0dfbce63a89 | 176 | MODIFY_REG(hcrc->Instance->CR, CRC_CR_REV_IN, hcrc->Init.InputDataInversionMode); |
| elmot | 1:d0dfbce63a89 | 177 | |
| elmot | 1:d0dfbce63a89 | 178 | /* set output data inversion mode */ |
| elmot | 1:d0dfbce63a89 | 179 | assert_param(IS_CRC_OUTPUTDATA_INVERSION_MODE(hcrc->Init.OutputDataInversionMode)); |
| elmot | 1:d0dfbce63a89 | 180 | MODIFY_REG(hcrc->Instance->CR, CRC_CR_REV_OUT, hcrc->Init.OutputDataInversionMode); |
| elmot | 1:d0dfbce63a89 | 181 | |
| elmot | 1:d0dfbce63a89 | 182 | /* makes sure the input data format (bytes, halfwords or words stream) |
| elmot | 1:d0dfbce63a89 | 183 | * is properly specified by user */ |
| elmot | 1:d0dfbce63a89 | 184 | assert_param(IS_CRC_INPUTDATA_FORMAT(hcrc->InputDataFormat)); |
| elmot | 1:d0dfbce63a89 | 185 | |
| elmot | 1:d0dfbce63a89 | 186 | /* Change CRC peripheral state */ |
| elmot | 1:d0dfbce63a89 | 187 | hcrc->State = HAL_CRC_STATE_READY; |
| elmot | 1:d0dfbce63a89 | 188 | |
| elmot | 1:d0dfbce63a89 | 189 | /* Return function status */ |
| elmot | 1:d0dfbce63a89 | 190 | return HAL_OK; |
| elmot | 1:d0dfbce63a89 | 191 | } |
| elmot | 1:d0dfbce63a89 | 192 | |
| elmot | 1:d0dfbce63a89 | 193 | /** |
| elmot | 1:d0dfbce63a89 | 194 | * @brief DeInitialize the CRC peripheral. |
| elmot | 1:d0dfbce63a89 | 195 | * @param hcrc: CRC handle |
| elmot | 1:d0dfbce63a89 | 196 | * @retval HAL status |
| elmot | 1:d0dfbce63a89 | 197 | */ |
| elmot | 1:d0dfbce63a89 | 198 | HAL_StatusTypeDef HAL_CRC_DeInit(CRC_HandleTypeDef *hcrc) |
| elmot | 1:d0dfbce63a89 | 199 | { |
| elmot | 1:d0dfbce63a89 | 200 | /* Check the CRC handle allocation */ |
| elmot | 1:d0dfbce63a89 | 201 | if(hcrc == NULL) |
| elmot | 1:d0dfbce63a89 | 202 | { |
| elmot | 1:d0dfbce63a89 | 203 | return HAL_ERROR; |
| elmot | 1:d0dfbce63a89 | 204 | } |
| elmot | 1:d0dfbce63a89 | 205 | |
| elmot | 1:d0dfbce63a89 | 206 | /* Check the parameters */ |
| elmot | 1:d0dfbce63a89 | 207 | assert_param(IS_CRC_ALL_INSTANCE(hcrc->Instance)); |
| elmot | 1:d0dfbce63a89 | 208 | |
| elmot | 1:d0dfbce63a89 | 209 | /* Check the CRC peripheral state */ |
| elmot | 1:d0dfbce63a89 | 210 | if(hcrc->State == HAL_CRC_STATE_BUSY) |
| elmot | 1:d0dfbce63a89 | 211 | { |
| elmot | 1:d0dfbce63a89 | 212 | return HAL_BUSY; |
| elmot | 1:d0dfbce63a89 | 213 | } |
| elmot | 1:d0dfbce63a89 | 214 | |
| elmot | 1:d0dfbce63a89 | 215 | /* Change CRC peripheral state */ |
| elmot | 1:d0dfbce63a89 | 216 | hcrc->State = HAL_CRC_STATE_BUSY; |
| elmot | 1:d0dfbce63a89 | 217 | |
| elmot | 1:d0dfbce63a89 | 218 | /* Reset CRC calculation unit */ |
| elmot | 1:d0dfbce63a89 | 219 | __HAL_CRC_DR_RESET(hcrc); |
| elmot | 1:d0dfbce63a89 | 220 | |
| elmot | 1:d0dfbce63a89 | 221 | /* Reset IDR register content */ |
| elmot | 1:d0dfbce63a89 | 222 | CLEAR_BIT(hcrc->Instance->IDR, CRC_IDR_IDR) ; |
| elmot | 1:d0dfbce63a89 | 223 | |
| elmot | 1:d0dfbce63a89 | 224 | /* DeInit the low level hardware */ |
| elmot | 1:d0dfbce63a89 | 225 | HAL_CRC_MspDeInit(hcrc); |
| elmot | 1:d0dfbce63a89 | 226 | |
| elmot | 1:d0dfbce63a89 | 227 | /* Change CRC peripheral state */ |
| elmot | 1:d0dfbce63a89 | 228 | hcrc->State = HAL_CRC_STATE_RESET; |
| elmot | 1:d0dfbce63a89 | 229 | |
| elmot | 1:d0dfbce63a89 | 230 | /* Process unlocked */ |
| elmot | 1:d0dfbce63a89 | 231 | __HAL_UNLOCK(hcrc); |
| elmot | 1:d0dfbce63a89 | 232 | |
| elmot | 1:d0dfbce63a89 | 233 | /* Return function status */ |
| elmot | 1:d0dfbce63a89 | 234 | return HAL_OK; |
| elmot | 1:d0dfbce63a89 | 235 | } |
| elmot | 1:d0dfbce63a89 | 236 | |
| elmot | 1:d0dfbce63a89 | 237 | /** |
| elmot | 1:d0dfbce63a89 | 238 | * @brief Initializes the CRC MSP. |
| elmot | 1:d0dfbce63a89 | 239 | * @param hcrc: CRC handle |
| elmot | 1:d0dfbce63a89 | 240 | * @retval None |
| elmot | 1:d0dfbce63a89 | 241 | */ |
| elmot | 1:d0dfbce63a89 | 242 | __weak void HAL_CRC_MspInit(CRC_HandleTypeDef *hcrc) |
| elmot | 1:d0dfbce63a89 | 243 | { |
| elmot | 1:d0dfbce63a89 | 244 | /* Prevent unused argument(s) compilation warning */ |
| elmot | 1:d0dfbce63a89 | 245 | UNUSED(hcrc); |
| elmot | 1:d0dfbce63a89 | 246 | |
| elmot | 1:d0dfbce63a89 | 247 | /* NOTE : This function should not be modified, when the callback is needed, |
| elmot | 1:d0dfbce63a89 | 248 | the HAL_CRC_MspInit can be implemented in the user file |
| elmot | 1:d0dfbce63a89 | 249 | */ |
| elmot | 1:d0dfbce63a89 | 250 | } |
| elmot | 1:d0dfbce63a89 | 251 | |
| elmot | 1:d0dfbce63a89 | 252 | /** |
| elmot | 1:d0dfbce63a89 | 253 | * @brief DeInitialize the CRC MSP. |
| elmot | 1:d0dfbce63a89 | 254 | * @param hcrc: CRC handle |
| elmot | 1:d0dfbce63a89 | 255 | * @retval None |
| elmot | 1:d0dfbce63a89 | 256 | */ |
| elmot | 1:d0dfbce63a89 | 257 | __weak void HAL_CRC_MspDeInit(CRC_HandleTypeDef *hcrc) |
| elmot | 1:d0dfbce63a89 | 258 | { |
| elmot | 1:d0dfbce63a89 | 259 | /* Prevent unused argument(s) compilation warning */ |
| elmot | 1:d0dfbce63a89 | 260 | UNUSED(hcrc); |
| elmot | 1:d0dfbce63a89 | 261 | |
| elmot | 1:d0dfbce63a89 | 262 | /* NOTE : This function should not be modified, when the callback is needed, |
| elmot | 1:d0dfbce63a89 | 263 | the HAL_CRC_MspDeInit can be implemented in the user file |
| elmot | 1:d0dfbce63a89 | 264 | */ |
| elmot | 1:d0dfbce63a89 | 265 | } |
| elmot | 1:d0dfbce63a89 | 266 | |
| elmot | 1:d0dfbce63a89 | 267 | /** |
| elmot | 1:d0dfbce63a89 | 268 | * @} |
| elmot | 1:d0dfbce63a89 | 269 | */ |
| elmot | 1:d0dfbce63a89 | 270 | |
| elmot | 1:d0dfbce63a89 | 271 | /** @defgroup CRC_Exported_Functions_Group2 Peripheral Control functions |
| elmot | 1:d0dfbce63a89 | 272 | * @brief management functions. |
| elmot | 1:d0dfbce63a89 | 273 | * |
| elmot | 1:d0dfbce63a89 | 274 | @verbatim |
| elmot | 1:d0dfbce63a89 | 275 | =============================================================================== |
| elmot | 1:d0dfbce63a89 | 276 | ##### Peripheral Control functions ##### |
| elmot | 1:d0dfbce63a89 | 277 | =============================================================================== |
| elmot | 1:d0dfbce63a89 | 278 | [..] This section provides functions allowing to: |
| elmot | 1:d0dfbce63a89 | 279 | (+) compute the 7, 8, 16 or 32-bit CRC value of an 8, 16 or 32-bit data buffer |
| elmot | 1:d0dfbce63a89 | 280 | using the combination of the previous CRC value and the new one |
| elmot | 1:d0dfbce63a89 | 281 | |
| elmot | 1:d0dfbce63a89 | 282 | [..] or |
| elmot | 1:d0dfbce63a89 | 283 | |
| elmot | 1:d0dfbce63a89 | 284 | (+) compute the 7, 8, 16 or 32-bit CRC value of an 8, 16 or 32-bit data buffer |
| elmot | 1:d0dfbce63a89 | 285 | independently of the previous CRC value. |
| elmot | 1:d0dfbce63a89 | 286 | |
| elmot | 1:d0dfbce63a89 | 287 | @endverbatim |
| elmot | 1:d0dfbce63a89 | 288 | * @{ |
| elmot | 1:d0dfbce63a89 | 289 | */ |
| elmot | 1:d0dfbce63a89 | 290 | |
| elmot | 1:d0dfbce63a89 | 291 | /** |
| elmot | 1:d0dfbce63a89 | 292 | * @brief Compute the 7, 8, 16 or 32-bit CRC value of an 8, 16 or 32-bit data buffer |
| elmot | 1:d0dfbce63a89 | 293 | * starting with the previously computed CRC as initialization value. |
| elmot | 1:d0dfbce63a89 | 294 | * @param hcrc: CRC handle |
| elmot | 1:d0dfbce63a89 | 295 | * @param pBuffer: pointer to the input data buffer, exact input data format is |
| elmot | 1:d0dfbce63a89 | 296 | * provided by hcrc->InputDataFormat. |
| elmot | 1:d0dfbce63a89 | 297 | * @param BufferLength: input data buffer length (number of bytes if pBuffer |
| elmot | 1:d0dfbce63a89 | 298 | * type is * uint8_t, number of half-words if pBuffer type is * uint16_t, |
| elmot | 1:d0dfbce63a89 | 299 | * number of words if pBuffer type is * uint32_t). |
| elmot | 1:d0dfbce63a89 | 300 | * @note By default, the API expects a uint32_t pointer as input buffer parameter. |
| elmot | 1:d0dfbce63a89 | 301 | * Input buffer pointers with other types simply need to be cast in uint32_t |
| elmot | 1:d0dfbce63a89 | 302 | * and the API will internally adjust its input data processing based on the |
| elmot | 1:d0dfbce63a89 | 303 | * handle field hcrc->InputDataFormat. |
| elmot | 1:d0dfbce63a89 | 304 | * @retval uint32_t CRC (returned value LSBs for CRC shorter than 32 bits) |
| elmot | 1:d0dfbce63a89 | 305 | */ |
| elmot | 1:d0dfbce63a89 | 306 | uint32_t HAL_CRC_Accumulate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_t BufferLength) |
| elmot | 1:d0dfbce63a89 | 307 | { |
| elmot | 1:d0dfbce63a89 | 308 | uint32_t index = 0; /* CRC input data buffer index */ |
| elmot | 1:d0dfbce63a89 | 309 | uint32_t temp = 0; /* CRC output (read from hcrc->Instance->DR register) */ |
| elmot | 1:d0dfbce63a89 | 310 | |
| elmot | 1:d0dfbce63a89 | 311 | /* Process locked */ |
| elmot | 1:d0dfbce63a89 | 312 | __HAL_LOCK(hcrc); |
| elmot | 1:d0dfbce63a89 | 313 | |
| elmot | 1:d0dfbce63a89 | 314 | /* Change CRC peripheral state */ |
| elmot | 1:d0dfbce63a89 | 315 | hcrc->State = HAL_CRC_STATE_BUSY; |
| elmot | 1:d0dfbce63a89 | 316 | |
| elmot | 1:d0dfbce63a89 | 317 | switch (hcrc->InputDataFormat) |
| elmot | 1:d0dfbce63a89 | 318 | { |
| elmot | 1:d0dfbce63a89 | 319 | case CRC_INPUTDATA_FORMAT_WORDS: |
| elmot | 1:d0dfbce63a89 | 320 | /* Enter Data to the CRC calculator */ |
| elmot | 1:d0dfbce63a89 | 321 | for(index = 0; index < BufferLength; index++) |
| elmot | 1:d0dfbce63a89 | 322 | { |
| elmot | 1:d0dfbce63a89 | 323 | hcrc->Instance->DR = pBuffer[index]; |
| elmot | 1:d0dfbce63a89 | 324 | } |
| elmot | 1:d0dfbce63a89 | 325 | temp = hcrc->Instance->DR; |
| elmot | 1:d0dfbce63a89 | 326 | break; |
| elmot | 1:d0dfbce63a89 | 327 | |
| elmot | 1:d0dfbce63a89 | 328 | case CRC_INPUTDATA_FORMAT_BYTES: |
| elmot | 1:d0dfbce63a89 | 329 | temp = CRC_Handle_8(hcrc, (uint8_t*)pBuffer, BufferLength); |
| elmot | 1:d0dfbce63a89 | 330 | break; |
| elmot | 1:d0dfbce63a89 | 331 | |
| elmot | 1:d0dfbce63a89 | 332 | case CRC_INPUTDATA_FORMAT_HALFWORDS: |
| elmot | 1:d0dfbce63a89 | 333 | temp = CRC_Handle_16(hcrc, (uint16_t*)pBuffer, BufferLength); |
| elmot | 1:d0dfbce63a89 | 334 | break; |
| elmot | 1:d0dfbce63a89 | 335 | |
| elmot | 1:d0dfbce63a89 | 336 | default: |
| elmot | 1:d0dfbce63a89 | 337 | break; |
| elmot | 1:d0dfbce63a89 | 338 | } |
| elmot | 1:d0dfbce63a89 | 339 | |
| elmot | 1:d0dfbce63a89 | 340 | /* Change CRC peripheral state */ |
| elmot | 1:d0dfbce63a89 | 341 | hcrc->State = HAL_CRC_STATE_READY; |
| elmot | 1:d0dfbce63a89 | 342 | |
| elmot | 1:d0dfbce63a89 | 343 | /* Process unlocked */ |
| elmot | 1:d0dfbce63a89 | 344 | __HAL_UNLOCK(hcrc); |
| elmot | 1:d0dfbce63a89 | 345 | |
| elmot | 1:d0dfbce63a89 | 346 | /* Return the CRC computed value */ |
| elmot | 1:d0dfbce63a89 | 347 | return temp; |
| elmot | 1:d0dfbce63a89 | 348 | } |
| elmot | 1:d0dfbce63a89 | 349 | |
| elmot | 1:d0dfbce63a89 | 350 | |
| elmot | 1:d0dfbce63a89 | 351 | /** |
| elmot | 1:d0dfbce63a89 | 352 | * @brief Compute the 7, 8, 16 or 32-bit CRC value of an 8, 16 or 32-bit data buffer |
| elmot | 1:d0dfbce63a89 | 353 | * starting with hcrc->Instance->INIT as initialization value. |
| elmot | 1:d0dfbce63a89 | 354 | * @param hcrc: CRC handle |
| elmot | 1:d0dfbce63a89 | 355 | * @param pBuffer: pointer to the input data buffer, exact input data format is |
| elmot | 1:d0dfbce63a89 | 356 | * provided by hcrc->InputDataFormat. |
| elmot | 1:d0dfbce63a89 | 357 | * @param BufferLength: input data buffer length (number of bytes if pBuffer |
| elmot | 1:d0dfbce63a89 | 358 | * type is * uint8_t, number of half-words if pBuffer type is * uint16_t, |
| elmot | 1:d0dfbce63a89 | 359 | * number of words if pBuffer type is * uint32_t). |
| elmot | 1:d0dfbce63a89 | 360 | * @note By default, the API expects a uint32_t pointer as input buffer parameter. |
| elmot | 1:d0dfbce63a89 | 361 | * Input buffer pointers with other types simply need to be cast in uint32_t |
| elmot | 1:d0dfbce63a89 | 362 | * and the API will internally adjust its input data processing based on the |
| elmot | 1:d0dfbce63a89 | 363 | * handle field hcrc->InputDataFormat. |
| elmot | 1:d0dfbce63a89 | 364 | * @retval uint32_t CRC (returned value LSBs for CRC shorter than 32 bits) |
| elmot | 1:d0dfbce63a89 | 365 | */ |
| elmot | 1:d0dfbce63a89 | 366 | uint32_t HAL_CRC_Calculate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_t BufferLength) |
| elmot | 1:d0dfbce63a89 | 367 | { |
| elmot | 1:d0dfbce63a89 | 368 | uint32_t index = 0; /* CRC input data buffer index */ |
| elmot | 1:d0dfbce63a89 | 369 | uint32_t temp = 0; /* CRC output (read from hcrc->Instance->DR register) */ |
| elmot | 1:d0dfbce63a89 | 370 | |
| elmot | 1:d0dfbce63a89 | 371 | /* Process locked */ |
| elmot | 1:d0dfbce63a89 | 372 | __HAL_LOCK(hcrc); |
| elmot | 1:d0dfbce63a89 | 373 | |
| elmot | 1:d0dfbce63a89 | 374 | /* Change CRC peripheral state */ |
| elmot | 1:d0dfbce63a89 | 375 | hcrc->State = HAL_CRC_STATE_BUSY; |
| elmot | 1:d0dfbce63a89 | 376 | |
| elmot | 1:d0dfbce63a89 | 377 | /* Reset CRC Calculation Unit (hcrc->Instance->INIT is |
| elmot | 1:d0dfbce63a89 | 378 | * written in hcrc->Instance->DR) */ |
| elmot | 1:d0dfbce63a89 | 379 | __HAL_CRC_DR_RESET(hcrc); |
| elmot | 1:d0dfbce63a89 | 380 | |
| elmot | 1:d0dfbce63a89 | 381 | switch (hcrc->InputDataFormat) |
| elmot | 1:d0dfbce63a89 | 382 | { |
| elmot | 1:d0dfbce63a89 | 383 | case CRC_INPUTDATA_FORMAT_WORDS: |
| elmot | 1:d0dfbce63a89 | 384 | /* Enter 32-bit input data to the CRC calculator */ |
| elmot | 1:d0dfbce63a89 | 385 | for(index = 0; index < BufferLength; index++) |
| elmot | 1:d0dfbce63a89 | 386 | { |
| elmot | 1:d0dfbce63a89 | 387 | hcrc->Instance->DR = pBuffer[index]; |
| elmot | 1:d0dfbce63a89 | 388 | } |
| elmot | 1:d0dfbce63a89 | 389 | temp = hcrc->Instance->DR; |
| elmot | 1:d0dfbce63a89 | 390 | break; |
| elmot | 1:d0dfbce63a89 | 391 | |
| elmot | 1:d0dfbce63a89 | 392 | case CRC_INPUTDATA_FORMAT_BYTES: |
| elmot | 1:d0dfbce63a89 | 393 | /* Specific 8-bit input data handling */ |
| elmot | 1:d0dfbce63a89 | 394 | temp = CRC_Handle_8(hcrc, (uint8_t*)pBuffer, BufferLength); |
| elmot | 1:d0dfbce63a89 | 395 | break; |
| elmot | 1:d0dfbce63a89 | 396 | |
| elmot | 1:d0dfbce63a89 | 397 | case CRC_INPUTDATA_FORMAT_HALFWORDS: |
| elmot | 1:d0dfbce63a89 | 398 | /* Specific 16-bit input data handling */ |
| elmot | 1:d0dfbce63a89 | 399 | temp = CRC_Handle_16(hcrc, (uint16_t*)pBuffer, BufferLength); |
| elmot | 1:d0dfbce63a89 | 400 | break; |
| elmot | 1:d0dfbce63a89 | 401 | |
| elmot | 1:d0dfbce63a89 | 402 | default: |
| elmot | 1:d0dfbce63a89 | 403 | break; |
| elmot | 1:d0dfbce63a89 | 404 | } |
| elmot | 1:d0dfbce63a89 | 405 | |
| elmot | 1:d0dfbce63a89 | 406 | /* Change CRC peripheral state */ |
| elmot | 1:d0dfbce63a89 | 407 | hcrc->State = HAL_CRC_STATE_READY; |
| elmot | 1:d0dfbce63a89 | 408 | |
| elmot | 1:d0dfbce63a89 | 409 | /* Process unlocked */ |
| elmot | 1:d0dfbce63a89 | 410 | __HAL_UNLOCK(hcrc); |
| elmot | 1:d0dfbce63a89 | 411 | |
| elmot | 1:d0dfbce63a89 | 412 | /* Return the CRC computed value */ |
| elmot | 1:d0dfbce63a89 | 413 | return temp; |
| elmot | 1:d0dfbce63a89 | 414 | } |
| elmot | 1:d0dfbce63a89 | 415 | |
| elmot | 1:d0dfbce63a89 | 416 | /** |
| elmot | 1:d0dfbce63a89 | 417 | * @} |
| elmot | 1:d0dfbce63a89 | 418 | */ |
| elmot | 1:d0dfbce63a89 | 419 | |
| elmot | 1:d0dfbce63a89 | 420 | /** @defgroup CRC_Exported_Functions_Group3 Peripheral State functions |
| elmot | 1:d0dfbce63a89 | 421 | * @brief Peripheral State functions. |
| elmot | 1:d0dfbce63a89 | 422 | * |
| elmot | 1:d0dfbce63a89 | 423 | @verbatim |
| elmot | 1:d0dfbce63a89 | 424 | =============================================================================== |
| elmot | 1:d0dfbce63a89 | 425 | ##### Peripheral State functions ##### |
| elmot | 1:d0dfbce63a89 | 426 | =============================================================================== |
| elmot | 1:d0dfbce63a89 | 427 | [..] |
| elmot | 1:d0dfbce63a89 | 428 | This subsection permits to get in run-time the status of the peripheral. |
| elmot | 1:d0dfbce63a89 | 429 | |
| elmot | 1:d0dfbce63a89 | 430 | @endverbatim |
| elmot | 1:d0dfbce63a89 | 431 | * @{ |
| elmot | 1:d0dfbce63a89 | 432 | */ |
| elmot | 1:d0dfbce63a89 | 433 | |
| elmot | 1:d0dfbce63a89 | 434 | /** |
| elmot | 1:d0dfbce63a89 | 435 | * @brief Return the CRC handle state. |
| elmot | 1:d0dfbce63a89 | 436 | * @param hcrc: CRC handle |
| elmot | 1:d0dfbce63a89 | 437 | * @retval HAL state |
| elmot | 1:d0dfbce63a89 | 438 | */ |
| elmot | 1:d0dfbce63a89 | 439 | HAL_CRC_StateTypeDef HAL_CRC_GetState(CRC_HandleTypeDef *hcrc) |
| elmot | 1:d0dfbce63a89 | 440 | { |
| elmot | 1:d0dfbce63a89 | 441 | /* Return CRC handle state */ |
| elmot | 1:d0dfbce63a89 | 442 | return hcrc->State; |
| elmot | 1:d0dfbce63a89 | 443 | } |
| elmot | 1:d0dfbce63a89 | 444 | |
| elmot | 1:d0dfbce63a89 | 445 | /** |
| elmot | 1:d0dfbce63a89 | 446 | * @} |
| elmot | 1:d0dfbce63a89 | 447 | */ |
| elmot | 1:d0dfbce63a89 | 448 | |
| elmot | 1:d0dfbce63a89 | 449 | /** |
| elmot | 1:d0dfbce63a89 | 450 | * @} |
| elmot | 1:d0dfbce63a89 | 451 | */ |
| elmot | 1:d0dfbce63a89 | 452 | |
| elmot | 1:d0dfbce63a89 | 453 | /** @defgroup CRC_Private_Functions CRC Private Functions |
| elmot | 1:d0dfbce63a89 | 454 | * @{ |
| elmot | 1:d0dfbce63a89 | 455 | */ |
| elmot | 1:d0dfbce63a89 | 456 | |
| elmot | 1:d0dfbce63a89 | 457 | /** |
| elmot | 1:d0dfbce63a89 | 458 | * @brief Enter 8-bit input data to the CRC calculator. |
| elmot | 1:d0dfbce63a89 | 459 | * Specific data handling to optimize processing time. |
| elmot | 1:d0dfbce63a89 | 460 | * @param hcrc: CRC handle |
| elmot | 1:d0dfbce63a89 | 461 | * @param pBuffer: pointer to the input data buffer |
| elmot | 1:d0dfbce63a89 | 462 | * @param BufferLength: input data buffer length |
| elmot | 1:d0dfbce63a89 | 463 | * @retval uint32_t CRC (returned value LSBs for CRC shorter than 32 bits) |
| elmot | 1:d0dfbce63a89 | 464 | */ |
| elmot | 1:d0dfbce63a89 | 465 | static uint32_t CRC_Handle_8(CRC_HandleTypeDef *hcrc, uint8_t pBuffer[], uint32_t BufferLength) |
| elmot | 1:d0dfbce63a89 | 466 | { |
| elmot | 1:d0dfbce63a89 | 467 | uint32_t i = 0; /* input data buffer index */ |
| elmot | 1:d0dfbce63a89 | 468 | |
| elmot | 1:d0dfbce63a89 | 469 | /* Processing time optimization: 4 bytes are entered in a row with a single word write, |
| elmot | 1:d0dfbce63a89 | 470 | * last bytes must be carefully fed to the CRC calculator to ensure a correct type |
| elmot | 1:d0dfbce63a89 | 471 | * handling by the IP */ |
| elmot | 1:d0dfbce63a89 | 472 | for(i = 0; i < (BufferLength/4); i++) |
| elmot | 1:d0dfbce63a89 | 473 | { |
| elmot | 1:d0dfbce63a89 | 474 | hcrc->Instance->DR = ((uint32_t)pBuffer[4*i]<<24) | ((uint32_t)pBuffer[4*i+1]<<16) | ((uint32_t)pBuffer[4*i+2]<<8) | (uint32_t)pBuffer[4*i+3]; |
| elmot | 1:d0dfbce63a89 | 475 | } |
| elmot | 1:d0dfbce63a89 | 476 | /* last bytes specific handling */ |
| elmot | 1:d0dfbce63a89 | 477 | if ((BufferLength%4) != 0) |
| elmot | 1:d0dfbce63a89 | 478 | { |
| elmot | 1:d0dfbce63a89 | 479 | if (BufferLength%4 == 1) |
| elmot | 1:d0dfbce63a89 | 480 | { |
| elmot | 1:d0dfbce63a89 | 481 | *(uint8_t volatile*) (&hcrc->Instance->DR) = pBuffer[4*i]; |
| elmot | 1:d0dfbce63a89 | 482 | } |
| elmot | 1:d0dfbce63a89 | 483 | if (BufferLength%4 == 2) |
| elmot | 1:d0dfbce63a89 | 484 | { |
| elmot | 1:d0dfbce63a89 | 485 | *(uint16_t volatile*) (&hcrc->Instance->DR) = ((uint32_t)pBuffer[4*i]<<8) | (uint32_t)pBuffer[4*i+1]; |
| elmot | 1:d0dfbce63a89 | 486 | } |
| elmot | 1:d0dfbce63a89 | 487 | if (BufferLength%4 == 3) |
| elmot | 1:d0dfbce63a89 | 488 | { |
| elmot | 1:d0dfbce63a89 | 489 | *(uint16_t volatile*) (&hcrc->Instance->DR) = ((uint32_t)pBuffer[4*i]<<8) | (uint32_t)pBuffer[4*i+1]; |
| elmot | 1:d0dfbce63a89 | 490 | *(uint8_t volatile*) (&hcrc->Instance->DR) = pBuffer[4*i+2]; |
| elmot | 1:d0dfbce63a89 | 491 | } |
| elmot | 1:d0dfbce63a89 | 492 | } |
| elmot | 1:d0dfbce63a89 | 493 | |
| elmot | 1:d0dfbce63a89 | 494 | /* Return the CRC computed value */ |
| elmot | 1:d0dfbce63a89 | 495 | return hcrc->Instance->DR; |
| elmot | 1:d0dfbce63a89 | 496 | } |
| elmot | 1:d0dfbce63a89 | 497 | |
| elmot | 1:d0dfbce63a89 | 498 | |
| elmot | 1:d0dfbce63a89 | 499 | |
| elmot | 1:d0dfbce63a89 | 500 | /** |
| elmot | 1:d0dfbce63a89 | 501 | * @brief Enter 16-bit input data to the CRC calculator. |
| elmot | 1:d0dfbce63a89 | 502 | * Specific data handling to optimize processing time. |
| elmot | 1:d0dfbce63a89 | 503 | * @param hcrc: CRC handle |
| elmot | 1:d0dfbce63a89 | 504 | * @param pBuffer: pointer to the input data buffer |
| elmot | 1:d0dfbce63a89 | 505 | * @param BufferLength: input data buffer length |
| elmot | 1:d0dfbce63a89 | 506 | * @retval uint32_t CRC (returned value LSBs for CRC shorter than 32 bits) |
| elmot | 1:d0dfbce63a89 | 507 | */ |
| elmot | 1:d0dfbce63a89 | 508 | static uint32_t CRC_Handle_16(CRC_HandleTypeDef *hcrc, uint16_t pBuffer[], uint32_t BufferLength) |
| elmot | 1:d0dfbce63a89 | 509 | { |
| elmot | 1:d0dfbce63a89 | 510 | uint32_t i = 0; /* input data buffer index */ |
| elmot | 1:d0dfbce63a89 | 511 | |
| elmot | 1:d0dfbce63a89 | 512 | /* Processing time optimization: 2 HalfWords are entered in a row with a single word write, |
| elmot | 1:d0dfbce63a89 | 513 | * in case of odd length, last HalfWord must be carefully fed to the CRC calculator to ensure |
| elmot | 1:d0dfbce63a89 | 514 | * a correct type handling by the IP */ |
| elmot | 1:d0dfbce63a89 | 515 | for(i = 0; i < (BufferLength/2); i++) |
| elmot | 1:d0dfbce63a89 | 516 | { |
| elmot | 1:d0dfbce63a89 | 517 | hcrc->Instance->DR = ((uint32_t)pBuffer[2*i]<<16) | (uint32_t)pBuffer[2*i+1]; |
| elmot | 1:d0dfbce63a89 | 518 | } |
| elmot | 1:d0dfbce63a89 | 519 | if ((BufferLength%2) != 0) |
| elmot | 1:d0dfbce63a89 | 520 | { |
| elmot | 1:d0dfbce63a89 | 521 | *(uint16_t volatile*) (&hcrc->Instance->DR) = pBuffer[2*i]; |
| elmot | 1:d0dfbce63a89 | 522 | } |
| elmot | 1:d0dfbce63a89 | 523 | |
| elmot | 1:d0dfbce63a89 | 524 | /* Return the CRC computed value */ |
| elmot | 1:d0dfbce63a89 | 525 | return hcrc->Instance->DR; |
| elmot | 1:d0dfbce63a89 | 526 | } |
| elmot | 1:d0dfbce63a89 | 527 | |
| elmot | 1:d0dfbce63a89 | 528 | /** |
| elmot | 1:d0dfbce63a89 | 529 | * @} |
| elmot | 1:d0dfbce63a89 | 530 | */ |
| elmot | 1:d0dfbce63a89 | 531 | |
| elmot | 1:d0dfbce63a89 | 532 | #endif /* HAL_CRC_MODULE_ENABLED */ |
| elmot | 1:d0dfbce63a89 | 533 | /** |
| elmot | 1:d0dfbce63a89 | 534 | * @} |
| elmot | 1:d0dfbce63a89 | 535 | */ |
| elmot | 1:d0dfbce63a89 | 536 | |
| elmot | 1:d0dfbce63a89 | 537 | /** |
| elmot | 1:d0dfbce63a89 | 538 | * @} |
| elmot | 1:d0dfbce63a89 | 539 | */ |
| elmot | 1:d0dfbce63a89 | 540 | |
| elmot | 1:d0dfbce63a89 | 541 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |