mbed library sources modified for open wear
Dependents: openwear-lifelogger-example
Fork of mbed-src by
targets/cmsis/TARGET_STM/TARGET_NUCLEO_F411RE/stm32f4xx_hal_crc.c@310:6188e0254baa, 2014-09-16 (annotated)
- Committer:
- janekm
- Date:
- Tue Sep 16 22:42:01 2014 +0000
- Revision:
- 310:6188e0254baa
- Parent:
- 235:685d5f11838f
N/A
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 235:685d5f11838f | 1 | /** |
mbed_official | 235:685d5f11838f | 2 | ****************************************************************************** |
mbed_official | 235:685d5f11838f | 3 | * @file stm32f4xx_hal_crc.c |
mbed_official | 235:685d5f11838f | 4 | * @author MCD Application Team |
mbed_official | 235:685d5f11838f | 5 | * @version V1.1.0 |
mbed_official | 235:685d5f11838f | 6 | * @date 19-June-2014 |
mbed_official | 235:685d5f11838f | 7 | * @brief CRC HAL module driver. |
mbed_official | 235:685d5f11838f | 8 | * This file provides firmware functions to manage the following |
mbed_official | 235:685d5f11838f | 9 | * functionalities of the Cyclic Redundancy Check (CRC) peripheral: |
mbed_official | 235:685d5f11838f | 10 | * + Initialization and de-initialization functions |
mbed_official | 235:685d5f11838f | 11 | * + Peripheral Control functions |
mbed_official | 235:685d5f11838f | 12 | * + Peripheral State functions |
mbed_official | 235:685d5f11838f | 13 | * |
mbed_official | 235:685d5f11838f | 14 | @verbatim |
mbed_official | 235:685d5f11838f | 15 | ============================================================================== |
mbed_official | 235:685d5f11838f | 16 | ##### How to use this driver ##### |
mbed_official | 235:685d5f11838f | 17 | ============================================================================== |
mbed_official | 235:685d5f11838f | 18 | [..] |
mbed_official | 235:685d5f11838f | 19 | The CRC HAL driver can be used as follows: |
mbed_official | 235:685d5f11838f | 20 | |
mbed_official | 235:685d5f11838f | 21 | (#) Enable CRC AHB clock using __CRC_CLK_ENABLE(); |
mbed_official | 235:685d5f11838f | 22 | |
mbed_official | 235:685d5f11838f | 23 | (#) Use HAL_CRC_Accumulate() function to compute the CRC value of |
mbed_official | 235:685d5f11838f | 24 | a 32-bit data buffer using combination of the previous CRC value |
mbed_official | 235:685d5f11838f | 25 | and the new one. |
mbed_official | 235:685d5f11838f | 26 | |
mbed_official | 235:685d5f11838f | 27 | (#) Use HAL_CRC_Calculate() function to compute the CRC Value of |
mbed_official | 235:685d5f11838f | 28 | a new 32-bit data buffer. This function resets the CRC computation |
mbed_official | 235:685d5f11838f | 29 | unit before starting the computation to avoid getting wrong CRC values. |
mbed_official | 235:685d5f11838f | 30 | |
mbed_official | 235:685d5f11838f | 31 | @endverbatim |
mbed_official | 235:685d5f11838f | 32 | ****************************************************************************** |
mbed_official | 235:685d5f11838f | 33 | * @attention |
mbed_official | 235:685d5f11838f | 34 | * |
mbed_official | 235:685d5f11838f | 35 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
mbed_official | 235:685d5f11838f | 36 | * |
mbed_official | 235:685d5f11838f | 37 | * Redistribution and use in source and binary forms, with or without modification, |
mbed_official | 235:685d5f11838f | 38 | * are permitted provided that the following conditions are met: |
mbed_official | 235:685d5f11838f | 39 | * 1. Redistributions of source code must retain the above copyright notice, |
mbed_official | 235:685d5f11838f | 40 | * this list of conditions and the following disclaimer. |
mbed_official | 235:685d5f11838f | 41 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
mbed_official | 235:685d5f11838f | 42 | * this list of conditions and the following disclaimer in the documentation |
mbed_official | 235:685d5f11838f | 43 | * and/or other materials provided with the distribution. |
mbed_official | 235:685d5f11838f | 44 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
mbed_official | 235:685d5f11838f | 45 | * may be used to endorse or promote products derived from this software |
mbed_official | 235:685d5f11838f | 46 | * without specific prior written permission. |
mbed_official | 235:685d5f11838f | 47 | * |
mbed_official | 235:685d5f11838f | 48 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
mbed_official | 235:685d5f11838f | 49 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
mbed_official | 235:685d5f11838f | 50 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
mbed_official | 235:685d5f11838f | 51 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
mbed_official | 235:685d5f11838f | 52 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
mbed_official | 235:685d5f11838f | 53 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
mbed_official | 235:685d5f11838f | 54 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
mbed_official | 235:685d5f11838f | 55 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
mbed_official | 235:685d5f11838f | 56 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
mbed_official | 235:685d5f11838f | 57 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
mbed_official | 235:685d5f11838f | 58 | * |
mbed_official | 235:685d5f11838f | 59 | ****************************************************************************** |
mbed_official | 235:685d5f11838f | 60 | */ |
mbed_official | 235:685d5f11838f | 61 | |
mbed_official | 235:685d5f11838f | 62 | /* Includes ------------------------------------------------------------------*/ |
mbed_official | 235:685d5f11838f | 63 | #include "stm32f4xx_hal.h" |
mbed_official | 235:685d5f11838f | 64 | |
mbed_official | 235:685d5f11838f | 65 | /** @addtogroup STM32F4xx_HAL_Driver |
mbed_official | 235:685d5f11838f | 66 | * @{ |
mbed_official | 235:685d5f11838f | 67 | */ |
mbed_official | 235:685d5f11838f | 68 | |
mbed_official | 235:685d5f11838f | 69 | /** @defgroup CRC |
mbed_official | 235:685d5f11838f | 70 | * @brief CRC HAL module driver. |
mbed_official | 235:685d5f11838f | 71 | * @{ |
mbed_official | 235:685d5f11838f | 72 | */ |
mbed_official | 235:685d5f11838f | 73 | |
mbed_official | 235:685d5f11838f | 74 | #ifdef HAL_CRC_MODULE_ENABLED |
mbed_official | 235:685d5f11838f | 75 | |
mbed_official | 235:685d5f11838f | 76 | /* Private typedef -----------------------------------------------------------*/ |
mbed_official | 235:685d5f11838f | 77 | /* Private define ------------------------------------------------------------*/ |
mbed_official | 235:685d5f11838f | 78 | /* Private macro -------------------------------------------------------------*/ |
mbed_official | 235:685d5f11838f | 79 | /* Private variables ---------------------------------------------------------*/ |
mbed_official | 235:685d5f11838f | 80 | /* Private function prototypes -----------------------------------------------*/ |
mbed_official | 235:685d5f11838f | 81 | /* Private functions ---------------------------------------------------------*/ |
mbed_official | 235:685d5f11838f | 82 | |
mbed_official | 235:685d5f11838f | 83 | /** @defgroup CRC_Private_Functions |
mbed_official | 235:685d5f11838f | 84 | * @{ |
mbed_official | 235:685d5f11838f | 85 | */ |
mbed_official | 235:685d5f11838f | 86 | |
mbed_official | 235:685d5f11838f | 87 | /** @defgroup CRC_Group1 Initialization and de-initialization functions |
mbed_official | 235:685d5f11838f | 88 | * @brief Initialization and Configuration functions. |
mbed_official | 235:685d5f11838f | 89 | * |
mbed_official | 235:685d5f11838f | 90 | @verbatim |
mbed_official | 235:685d5f11838f | 91 | ============================================================================== |
mbed_official | 235:685d5f11838f | 92 | ##### Initialization and de-initialization functions ##### |
mbed_official | 235:685d5f11838f | 93 | ============================================================================== |
mbed_official | 235:685d5f11838f | 94 | [..] This section provides functions allowing to: |
mbed_official | 235:685d5f11838f | 95 | (+) Initialize the CRC according to the specified parameters |
mbed_official | 235:685d5f11838f | 96 | in the CRC_InitTypeDef and create the associated handle |
mbed_official | 235:685d5f11838f | 97 | (+) DeInitialize the CRC peripheral |
mbed_official | 235:685d5f11838f | 98 | (+) Initialize the CRC MSP |
mbed_official | 235:685d5f11838f | 99 | (+) DeInitialize CRC MSP |
mbed_official | 235:685d5f11838f | 100 | |
mbed_official | 235:685d5f11838f | 101 | @endverbatim |
mbed_official | 235:685d5f11838f | 102 | * @{ |
mbed_official | 235:685d5f11838f | 103 | */ |
mbed_official | 235:685d5f11838f | 104 | |
mbed_official | 235:685d5f11838f | 105 | /** |
mbed_official | 235:685d5f11838f | 106 | * @brief Initializes the CRC according to the specified |
mbed_official | 235:685d5f11838f | 107 | * parameters in the CRC_InitTypeDef and creates the associated handle. |
mbed_official | 235:685d5f11838f | 108 | * @param hcrc: pointer to a CRC_HandleTypeDef structure that contains |
mbed_official | 235:685d5f11838f | 109 | * the configuration information for CRC |
mbed_official | 235:685d5f11838f | 110 | * @retval HAL status |
mbed_official | 235:685d5f11838f | 111 | */ |
mbed_official | 235:685d5f11838f | 112 | HAL_StatusTypeDef HAL_CRC_Init(CRC_HandleTypeDef *hcrc) |
mbed_official | 235:685d5f11838f | 113 | { |
mbed_official | 235:685d5f11838f | 114 | /* Check the CRC handle allocation */ |
mbed_official | 235:685d5f11838f | 115 | if(hcrc == NULL) |
mbed_official | 235:685d5f11838f | 116 | { |
mbed_official | 235:685d5f11838f | 117 | return HAL_ERROR; |
mbed_official | 235:685d5f11838f | 118 | } |
mbed_official | 235:685d5f11838f | 119 | |
mbed_official | 235:685d5f11838f | 120 | /* Check the parameters */ |
mbed_official | 235:685d5f11838f | 121 | assert_param(IS_CRC_ALL_INSTANCE(hcrc->Instance)); |
mbed_official | 235:685d5f11838f | 122 | |
mbed_official | 235:685d5f11838f | 123 | if(hcrc->State == HAL_CRC_STATE_RESET) |
mbed_official | 235:685d5f11838f | 124 | { |
mbed_official | 235:685d5f11838f | 125 | /* Init the low level hardware */ |
mbed_official | 235:685d5f11838f | 126 | HAL_CRC_MspInit(hcrc); |
mbed_official | 235:685d5f11838f | 127 | } |
mbed_official | 235:685d5f11838f | 128 | |
mbed_official | 235:685d5f11838f | 129 | /* Change CRC peripheral state */ |
mbed_official | 235:685d5f11838f | 130 | hcrc->State = HAL_CRC_STATE_BUSY; |
mbed_official | 235:685d5f11838f | 131 | |
mbed_official | 235:685d5f11838f | 132 | /* Change CRC peripheral state */ |
mbed_official | 235:685d5f11838f | 133 | hcrc->State = HAL_CRC_STATE_READY; |
mbed_official | 235:685d5f11838f | 134 | |
mbed_official | 235:685d5f11838f | 135 | /* Return function status */ |
mbed_official | 235:685d5f11838f | 136 | return HAL_OK; |
mbed_official | 235:685d5f11838f | 137 | } |
mbed_official | 235:685d5f11838f | 138 | |
mbed_official | 235:685d5f11838f | 139 | /** |
mbed_official | 235:685d5f11838f | 140 | * @brief DeInitializes the CRC peripheral. |
mbed_official | 235:685d5f11838f | 141 | * @param hcrc: pointer to a CRC_HandleTypeDef structure that contains |
mbed_official | 235:685d5f11838f | 142 | * the configuration information for CRC |
mbed_official | 235:685d5f11838f | 143 | * @retval HAL status |
mbed_official | 235:685d5f11838f | 144 | */ |
mbed_official | 235:685d5f11838f | 145 | HAL_StatusTypeDef HAL_CRC_DeInit(CRC_HandleTypeDef *hcrc) |
mbed_official | 235:685d5f11838f | 146 | { |
mbed_official | 235:685d5f11838f | 147 | /* Check the CRC handle allocation */ |
mbed_official | 235:685d5f11838f | 148 | if(hcrc == NULL) |
mbed_official | 235:685d5f11838f | 149 | { |
mbed_official | 235:685d5f11838f | 150 | return HAL_ERROR; |
mbed_official | 235:685d5f11838f | 151 | } |
mbed_official | 235:685d5f11838f | 152 | |
mbed_official | 235:685d5f11838f | 153 | /* Check the parameters */ |
mbed_official | 235:685d5f11838f | 154 | assert_param(IS_CRC_ALL_INSTANCE(hcrc->Instance)); |
mbed_official | 235:685d5f11838f | 155 | |
mbed_official | 235:685d5f11838f | 156 | /* Change CRC peripheral state */ |
mbed_official | 235:685d5f11838f | 157 | hcrc->State = HAL_CRC_STATE_BUSY; |
mbed_official | 235:685d5f11838f | 158 | |
mbed_official | 235:685d5f11838f | 159 | /* DeInit the low level hardware */ |
mbed_official | 235:685d5f11838f | 160 | HAL_CRC_MspDeInit(hcrc); |
mbed_official | 235:685d5f11838f | 161 | |
mbed_official | 235:685d5f11838f | 162 | /* Change CRC peripheral state */ |
mbed_official | 235:685d5f11838f | 163 | hcrc->State = HAL_CRC_STATE_RESET; |
mbed_official | 235:685d5f11838f | 164 | |
mbed_official | 235:685d5f11838f | 165 | /* Release Lock */ |
mbed_official | 235:685d5f11838f | 166 | __HAL_UNLOCK(hcrc); |
mbed_official | 235:685d5f11838f | 167 | |
mbed_official | 235:685d5f11838f | 168 | /* Return function status */ |
mbed_official | 235:685d5f11838f | 169 | return HAL_OK; |
mbed_official | 235:685d5f11838f | 170 | } |
mbed_official | 235:685d5f11838f | 171 | |
mbed_official | 235:685d5f11838f | 172 | /** |
mbed_official | 235:685d5f11838f | 173 | * @brief Initializes the CRC MSP. |
mbed_official | 235:685d5f11838f | 174 | * @param hcrc: pointer to a CRC_HandleTypeDef structure that contains |
mbed_official | 235:685d5f11838f | 175 | * the configuration information for CRC |
mbed_official | 235:685d5f11838f | 176 | * @retval None |
mbed_official | 235:685d5f11838f | 177 | */ |
mbed_official | 235:685d5f11838f | 178 | __weak void HAL_CRC_MspInit(CRC_HandleTypeDef *hcrc) |
mbed_official | 235:685d5f11838f | 179 | { |
mbed_official | 235:685d5f11838f | 180 | /* NOTE : This function Should not be modified, when the callback is needed, |
mbed_official | 235:685d5f11838f | 181 | the HAL_CRC_MspInit could be implemented in the user file |
mbed_official | 235:685d5f11838f | 182 | */ |
mbed_official | 235:685d5f11838f | 183 | } |
mbed_official | 235:685d5f11838f | 184 | |
mbed_official | 235:685d5f11838f | 185 | /** |
mbed_official | 235:685d5f11838f | 186 | * @brief DeInitializes the CRC MSP. |
mbed_official | 235:685d5f11838f | 187 | * @param hcrc: pointer to a CRC_HandleTypeDef structure that contains |
mbed_official | 235:685d5f11838f | 188 | * the configuration information for CRC |
mbed_official | 235:685d5f11838f | 189 | * @retval None |
mbed_official | 235:685d5f11838f | 190 | */ |
mbed_official | 235:685d5f11838f | 191 | __weak void HAL_CRC_MspDeInit(CRC_HandleTypeDef *hcrc) |
mbed_official | 235:685d5f11838f | 192 | { |
mbed_official | 235:685d5f11838f | 193 | /* NOTE : This function Should not be modified, when the callback is needed, |
mbed_official | 235:685d5f11838f | 194 | the HAL_CRC_MspDeInit could be implemented in the user file |
mbed_official | 235:685d5f11838f | 195 | */ |
mbed_official | 235:685d5f11838f | 196 | } |
mbed_official | 235:685d5f11838f | 197 | |
mbed_official | 235:685d5f11838f | 198 | /** |
mbed_official | 235:685d5f11838f | 199 | * @} |
mbed_official | 235:685d5f11838f | 200 | */ |
mbed_official | 235:685d5f11838f | 201 | |
mbed_official | 235:685d5f11838f | 202 | /** @defgroup CRC_Group2 Peripheral Control functions |
mbed_official | 235:685d5f11838f | 203 | * @brief management functions. |
mbed_official | 235:685d5f11838f | 204 | * |
mbed_official | 235:685d5f11838f | 205 | @verbatim |
mbed_official | 235:685d5f11838f | 206 | ============================================================================== |
mbed_official | 235:685d5f11838f | 207 | ##### Peripheral Control functions ##### |
mbed_official | 235:685d5f11838f | 208 | ============================================================================== |
mbed_official | 235:685d5f11838f | 209 | [..] This section provides functions allowing to: |
mbed_official | 235:685d5f11838f | 210 | (+) Compute the 32-bit CRC value of 32-bit data buffer, |
mbed_official | 235:685d5f11838f | 211 | using combination of the previous CRC value and the new one. |
mbed_official | 235:685d5f11838f | 212 | (+) Compute the 32-bit CRC value of 32-bit data buffer, |
mbed_official | 235:685d5f11838f | 213 | independently of the previous CRC value. |
mbed_official | 235:685d5f11838f | 214 | |
mbed_official | 235:685d5f11838f | 215 | @endverbatim |
mbed_official | 235:685d5f11838f | 216 | * @{ |
mbed_official | 235:685d5f11838f | 217 | */ |
mbed_official | 235:685d5f11838f | 218 | |
mbed_official | 235:685d5f11838f | 219 | /** |
mbed_official | 235:685d5f11838f | 220 | * @brief Computes the 32-bit CRC of 32-bit data buffer using combination |
mbed_official | 235:685d5f11838f | 221 | * of the previous CRC value and the new one. |
mbed_official | 235:685d5f11838f | 222 | * @param hcrc: pointer to a CRC_HandleTypeDef structure that contains |
mbed_official | 235:685d5f11838f | 223 | * the configuration information for CRC |
mbed_official | 235:685d5f11838f | 224 | * @param pBuffer: pointer to the buffer containing the data to be computed |
mbed_official | 235:685d5f11838f | 225 | * @param BufferLength: length of the buffer to be computed |
mbed_official | 235:685d5f11838f | 226 | * @retval 32-bit CRC |
mbed_official | 235:685d5f11838f | 227 | */ |
mbed_official | 235:685d5f11838f | 228 | uint32_t HAL_CRC_Accumulate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_t BufferLength) |
mbed_official | 235:685d5f11838f | 229 | { |
mbed_official | 235:685d5f11838f | 230 | uint32_t index = 0; |
mbed_official | 235:685d5f11838f | 231 | |
mbed_official | 235:685d5f11838f | 232 | /* Process Locked */ |
mbed_official | 235:685d5f11838f | 233 | __HAL_LOCK(hcrc); |
mbed_official | 235:685d5f11838f | 234 | |
mbed_official | 235:685d5f11838f | 235 | /* Change CRC peripheral state */ |
mbed_official | 235:685d5f11838f | 236 | hcrc->State = HAL_CRC_STATE_BUSY; |
mbed_official | 235:685d5f11838f | 237 | |
mbed_official | 235:685d5f11838f | 238 | /* Enter Data to the CRC calculator */ |
mbed_official | 235:685d5f11838f | 239 | for(index = 0; index < BufferLength; index++) |
mbed_official | 235:685d5f11838f | 240 | { |
mbed_official | 235:685d5f11838f | 241 | hcrc->Instance->DR = pBuffer[index]; |
mbed_official | 235:685d5f11838f | 242 | } |
mbed_official | 235:685d5f11838f | 243 | |
mbed_official | 235:685d5f11838f | 244 | /* Change CRC peripheral state */ |
mbed_official | 235:685d5f11838f | 245 | hcrc->State = HAL_CRC_STATE_READY; |
mbed_official | 235:685d5f11838f | 246 | |
mbed_official | 235:685d5f11838f | 247 | /* Process Unlocked */ |
mbed_official | 235:685d5f11838f | 248 | __HAL_UNLOCK(hcrc); |
mbed_official | 235:685d5f11838f | 249 | |
mbed_official | 235:685d5f11838f | 250 | /* Return the CRC computed value */ |
mbed_official | 235:685d5f11838f | 251 | return hcrc->Instance->DR; |
mbed_official | 235:685d5f11838f | 252 | } |
mbed_official | 235:685d5f11838f | 253 | |
mbed_official | 235:685d5f11838f | 254 | /** |
mbed_official | 235:685d5f11838f | 255 | * @brief Computes the 32-bit CRC of 32-bit data buffer independently |
mbed_official | 235:685d5f11838f | 256 | * of the previous CRC value. |
mbed_official | 235:685d5f11838f | 257 | * @param hcrc: pointer to a CRC_HandleTypeDef structure that contains |
mbed_official | 235:685d5f11838f | 258 | * the configuration information for CRC |
mbed_official | 235:685d5f11838f | 259 | * @param pBuffer: Pointer to the buffer containing the data to be computed |
mbed_official | 235:685d5f11838f | 260 | * @param BufferLength: Length of the buffer to be computed |
mbed_official | 235:685d5f11838f | 261 | * @retval 32-bit CRC |
mbed_official | 235:685d5f11838f | 262 | */ |
mbed_official | 235:685d5f11838f | 263 | uint32_t HAL_CRC_Calculate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_t BufferLength) |
mbed_official | 235:685d5f11838f | 264 | { |
mbed_official | 235:685d5f11838f | 265 | uint32_t index = 0; |
mbed_official | 235:685d5f11838f | 266 | |
mbed_official | 235:685d5f11838f | 267 | /* Process Locked */ |
mbed_official | 235:685d5f11838f | 268 | __HAL_LOCK(hcrc); |
mbed_official | 235:685d5f11838f | 269 | |
mbed_official | 235:685d5f11838f | 270 | /* Change CRC peripheral state */ |
mbed_official | 235:685d5f11838f | 271 | hcrc->State = HAL_CRC_STATE_BUSY; |
mbed_official | 235:685d5f11838f | 272 | |
mbed_official | 235:685d5f11838f | 273 | /* Reset CRC Calculation Unit */ |
mbed_official | 235:685d5f11838f | 274 | __HAL_CRC_DR_RESET(hcrc); |
mbed_official | 235:685d5f11838f | 275 | |
mbed_official | 235:685d5f11838f | 276 | /* Enter Data to the CRC calculator */ |
mbed_official | 235:685d5f11838f | 277 | for(index = 0; index < BufferLength; index++) |
mbed_official | 235:685d5f11838f | 278 | { |
mbed_official | 235:685d5f11838f | 279 | hcrc->Instance->DR = pBuffer[index]; |
mbed_official | 235:685d5f11838f | 280 | } |
mbed_official | 235:685d5f11838f | 281 | |
mbed_official | 235:685d5f11838f | 282 | /* Change CRC peripheral state */ |
mbed_official | 235:685d5f11838f | 283 | hcrc->State = HAL_CRC_STATE_READY; |
mbed_official | 235:685d5f11838f | 284 | |
mbed_official | 235:685d5f11838f | 285 | /* Process Unlocked */ |
mbed_official | 235:685d5f11838f | 286 | __HAL_UNLOCK(hcrc); |
mbed_official | 235:685d5f11838f | 287 | |
mbed_official | 235:685d5f11838f | 288 | /* Return the CRC computed value */ |
mbed_official | 235:685d5f11838f | 289 | return hcrc->Instance->DR; |
mbed_official | 235:685d5f11838f | 290 | } |
mbed_official | 235:685d5f11838f | 291 | |
mbed_official | 235:685d5f11838f | 292 | /** |
mbed_official | 235:685d5f11838f | 293 | * @} |
mbed_official | 235:685d5f11838f | 294 | */ |
mbed_official | 235:685d5f11838f | 295 | |
mbed_official | 235:685d5f11838f | 296 | /** @defgroup CRC_Group3 Peripheral State functions |
mbed_official | 235:685d5f11838f | 297 | * @brief Peripheral State functions. |
mbed_official | 235:685d5f11838f | 298 | * |
mbed_official | 235:685d5f11838f | 299 | @verbatim |
mbed_official | 235:685d5f11838f | 300 | ============================================================================== |
mbed_official | 235:685d5f11838f | 301 | ##### Peripheral State functions ##### |
mbed_official | 235:685d5f11838f | 302 | ============================================================================== |
mbed_official | 235:685d5f11838f | 303 | [..] |
mbed_official | 235:685d5f11838f | 304 | This subsection permits to get in run-time the status of the peripheral |
mbed_official | 235:685d5f11838f | 305 | and the data flow. |
mbed_official | 235:685d5f11838f | 306 | |
mbed_official | 235:685d5f11838f | 307 | @endverbatim |
mbed_official | 235:685d5f11838f | 308 | * @{ |
mbed_official | 235:685d5f11838f | 309 | */ |
mbed_official | 235:685d5f11838f | 310 | |
mbed_official | 235:685d5f11838f | 311 | /** |
mbed_official | 235:685d5f11838f | 312 | * @brief Returns the CRC state. |
mbed_official | 235:685d5f11838f | 313 | * @param hcrc: pointer to a CRC_HandleTypeDef structure that contains |
mbed_official | 235:685d5f11838f | 314 | * the configuration information for CRC |
mbed_official | 235:685d5f11838f | 315 | * @retval HAL state |
mbed_official | 235:685d5f11838f | 316 | */ |
mbed_official | 235:685d5f11838f | 317 | HAL_CRC_StateTypeDef HAL_CRC_GetState(CRC_HandleTypeDef *hcrc) |
mbed_official | 235:685d5f11838f | 318 | { |
mbed_official | 235:685d5f11838f | 319 | return hcrc->State; |
mbed_official | 235:685d5f11838f | 320 | } |
mbed_official | 235:685d5f11838f | 321 | |
mbed_official | 235:685d5f11838f | 322 | /** |
mbed_official | 235:685d5f11838f | 323 | * @} |
mbed_official | 235:685d5f11838f | 324 | */ |
mbed_official | 235:685d5f11838f | 325 | |
mbed_official | 235:685d5f11838f | 326 | /** |
mbed_official | 235:685d5f11838f | 327 | * @} |
mbed_official | 235:685d5f11838f | 328 | */ |
mbed_official | 235:685d5f11838f | 329 | |
mbed_official | 235:685d5f11838f | 330 | #endif /* HAL_CRC_MODULE_ENABLED */ |
mbed_official | 235:685d5f11838f | 331 | /** |
mbed_official | 235:685d5f11838f | 332 | * @} |
mbed_official | 235:685d5f11838f | 333 | */ |
mbed_official | 235:685d5f11838f | 334 | |
mbed_official | 235:685d5f11838f | 335 | /** |
mbed_official | 235:685d5f11838f | 336 | * @} |
mbed_official | 235:685d5f11838f | 337 | */ |
mbed_official | 235:685d5f11838f | 338 | |
mbed_official | 235:685d5f11838f | 339 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |