mbed library sources

Dependents:   frdm_kl05z_gpio_test

Fork of mbed-src by mbed official

Committer:
shaoziyang
Date:
Sat Sep 13 14:25:46 2014 +0000
Revision:
323:9e901b0a5aa1
Parent:
125:23cc3068a9e4
test with CLOCK_SETUP = 0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 125:23cc3068a9e4 1 /**
mbed_official 125:23cc3068a9e4 2 ******************************************************************************
mbed_official 125:23cc3068a9e4 3 * @file stm32f30x_crc.c
mbed_official 125:23cc3068a9e4 4 * @author MCD Application Team
mbed_official 125:23cc3068a9e4 5 * @version V1.1.0
mbed_official 125:23cc3068a9e4 6 * @date 27-February-2014
mbed_official 125:23cc3068a9e4 7 * @brief This file provides firmware functions to manage the following
mbed_official 125:23cc3068a9e4 8 * functionalities of CRC computation unit peripheral:
mbed_official 125:23cc3068a9e4 9 * + Configuration of the CRC computation unit
mbed_official 125:23cc3068a9e4 10 * + CRC computation of one/many 32-bit data
mbed_official 125:23cc3068a9e4 11 * + CRC Independent register (IDR) access
mbed_official 125:23cc3068a9e4 12 *
mbed_official 125:23cc3068a9e4 13 @verbatim
mbed_official 125:23cc3068a9e4 14
mbed_official 125:23cc3068a9e4 15 ===============================================================================
mbed_official 125:23cc3068a9e4 16 ##### How to use this driver #####
mbed_official 125:23cc3068a9e4 17 ===============================================================================
mbed_official 125:23cc3068a9e4 18 [..]
mbed_official 125:23cc3068a9e4 19 (#) Enable CRC AHB clock using RCC_AHBPeriphClockCmd(RCC_AHBPeriph_CRC, ENABLE)
mbed_official 125:23cc3068a9e4 20 function.
mbed_official 125:23cc3068a9e4 21 (#) Select the polynomial size: 7-bit, 8-bit, 16-bit or 32-bit.
mbed_official 125:23cc3068a9e4 22 (#) Set the polynomial coefficients using CRC_SetPolynomial();
mbed_official 125:23cc3068a9e4 23 (#) If required, select the reverse operation on input data
mbed_official 125:23cc3068a9e4 24 using CRC_ReverseInputDataSelect();
mbed_official 125:23cc3068a9e4 25 (#) If required, enable the reverse operation on output data
mbed_official 125:23cc3068a9e4 26 using CRC_ReverseOutputDataCmd(Enable);
mbed_official 125:23cc3068a9e4 27 (#) If required, set the initialization remainder value using
mbed_official 125:23cc3068a9e4 28 CRC_SetInitRegister();
mbed_official 125:23cc3068a9e4 29 (#) use CRC_CalcCRC() function to compute the CRC of a 32-bit data
mbed_official 125:23cc3068a9e4 30 or use CRC_CalcBlockCRC() function to compute the CRC if a 32-bit
mbed_official 125:23cc3068a9e4 31 data buffer.
mbed_official 125:23cc3068a9e4 32
mbed_official 125:23cc3068a9e4 33 @endverbatim
mbed_official 125:23cc3068a9e4 34
mbed_official 125:23cc3068a9e4 35 ******************************************************************************
mbed_official 125:23cc3068a9e4 36 * @attention
mbed_official 125:23cc3068a9e4 37 *
mbed_official 125:23cc3068a9e4 38 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
mbed_official 125:23cc3068a9e4 39 *
mbed_official 125:23cc3068a9e4 40 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 125:23cc3068a9e4 41 * are permitted provided that the following conditions are met:
mbed_official 125:23cc3068a9e4 42 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 125:23cc3068a9e4 43 * this list of conditions and the following disclaimer.
mbed_official 125:23cc3068a9e4 44 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 125:23cc3068a9e4 45 * this list of conditions and the following disclaimer in the documentation
mbed_official 125:23cc3068a9e4 46 * and/or other materials provided with the distribution.
mbed_official 125:23cc3068a9e4 47 * 3. Neither the name of STMicroelectronics nor the names of its contributors
mbed_official 125:23cc3068a9e4 48 * may be used to endorse or promote products derived from this software
mbed_official 125:23cc3068a9e4 49 * without specific prior written permission.
mbed_official 125:23cc3068a9e4 50 *
mbed_official 125:23cc3068a9e4 51 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 125:23cc3068a9e4 52 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 125:23cc3068a9e4 53 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 125:23cc3068a9e4 54 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mbed_official 125:23cc3068a9e4 55 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 125:23cc3068a9e4 56 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mbed_official 125:23cc3068a9e4 57 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 125:23cc3068a9e4 58 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mbed_official 125:23cc3068a9e4 59 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mbed_official 125:23cc3068a9e4 60 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 125:23cc3068a9e4 61 *
mbed_official 125:23cc3068a9e4 62 ******************************************************************************
mbed_official 125:23cc3068a9e4 63 */
mbed_official 125:23cc3068a9e4 64
mbed_official 125:23cc3068a9e4 65 /* Includes ------------------------------------------------------------------*/
mbed_official 125:23cc3068a9e4 66 #include "stm32f30x_crc.h"
mbed_official 125:23cc3068a9e4 67
mbed_official 125:23cc3068a9e4 68 /** @addtogroup STM32F30x_StdPeriph_Driver
mbed_official 125:23cc3068a9e4 69 * @{
mbed_official 125:23cc3068a9e4 70 */
mbed_official 125:23cc3068a9e4 71
mbed_official 125:23cc3068a9e4 72 /** @defgroup CRC
mbed_official 125:23cc3068a9e4 73 * @brief CRC driver modules
mbed_official 125:23cc3068a9e4 74 * @{
mbed_official 125:23cc3068a9e4 75 */
mbed_official 125:23cc3068a9e4 76
mbed_official 125:23cc3068a9e4 77 /* Private typedef -----------------------------------------------------------*/
mbed_official 125:23cc3068a9e4 78 /* Private define ------------------------------------------------------------*/
mbed_official 125:23cc3068a9e4 79 /* Private macro -------------------------------------------------------------*/
mbed_official 125:23cc3068a9e4 80 /* Private variables ---------------------------------------------------------*/
mbed_official 125:23cc3068a9e4 81 /* Private function prototypes -----------------------------------------------*/
mbed_official 125:23cc3068a9e4 82 /* Private functions ---------------------------------------------------------*/
mbed_official 125:23cc3068a9e4 83
mbed_official 125:23cc3068a9e4 84 /** @defgroup CRC_Private_Functions
mbed_official 125:23cc3068a9e4 85 * @{
mbed_official 125:23cc3068a9e4 86 */
mbed_official 125:23cc3068a9e4 87
mbed_official 125:23cc3068a9e4 88 /** @defgroup CRC_Group1 Configuration of the CRC computation unit functions
mbed_official 125:23cc3068a9e4 89 * @brief Configuration of the CRC computation unit functions
mbed_official 125:23cc3068a9e4 90 *
mbed_official 125:23cc3068a9e4 91 @verbatim
mbed_official 125:23cc3068a9e4 92 ===============================================================================
mbed_official 125:23cc3068a9e4 93 ##### CRC configuration functions #####
mbed_official 125:23cc3068a9e4 94 ===============================================================================
mbed_official 125:23cc3068a9e4 95
mbed_official 125:23cc3068a9e4 96 @endverbatim
mbed_official 125:23cc3068a9e4 97 * @{
mbed_official 125:23cc3068a9e4 98 */
mbed_official 125:23cc3068a9e4 99
mbed_official 125:23cc3068a9e4 100 /**
mbed_official 125:23cc3068a9e4 101 * @brief Deinitializes CRC peripheral registers to their default reset values.
mbed_official 125:23cc3068a9e4 102 * @param None
mbed_official 125:23cc3068a9e4 103 * @retval None
mbed_official 125:23cc3068a9e4 104 */
mbed_official 125:23cc3068a9e4 105 void CRC_DeInit(void)
mbed_official 125:23cc3068a9e4 106 {
mbed_official 125:23cc3068a9e4 107 /* Set DR register to reset value */
mbed_official 125:23cc3068a9e4 108 CRC->DR = 0xFFFFFFFF;
mbed_official 125:23cc3068a9e4 109 /* Set the POL register to the reset value: 0x04C11DB7 */
mbed_official 125:23cc3068a9e4 110 CRC->POL = 0x04C11DB7;
mbed_official 125:23cc3068a9e4 111 /* Reset IDR register */
mbed_official 125:23cc3068a9e4 112 CRC->IDR = 0x00;
mbed_official 125:23cc3068a9e4 113 /* Set INIT register to reset value */
mbed_official 125:23cc3068a9e4 114 CRC->INIT = 0xFFFFFFFF;
mbed_official 125:23cc3068a9e4 115 /* Reset the CRC calculation unit */
mbed_official 125:23cc3068a9e4 116 CRC->CR = CRC_CR_RESET;
mbed_official 125:23cc3068a9e4 117 }
mbed_official 125:23cc3068a9e4 118
mbed_official 125:23cc3068a9e4 119 /**
mbed_official 125:23cc3068a9e4 120 * @brief Resets the CRC calculation unit and sets INIT register content in DR register.
mbed_official 125:23cc3068a9e4 121 * @param None
mbed_official 125:23cc3068a9e4 122 * @retval None
mbed_official 125:23cc3068a9e4 123 */
mbed_official 125:23cc3068a9e4 124 void CRC_ResetDR(void)
mbed_official 125:23cc3068a9e4 125 {
mbed_official 125:23cc3068a9e4 126 /* Reset CRC generator */
mbed_official 125:23cc3068a9e4 127 CRC->CR |= CRC_CR_RESET;
mbed_official 125:23cc3068a9e4 128 }
mbed_official 125:23cc3068a9e4 129
mbed_official 125:23cc3068a9e4 130 /**
mbed_official 125:23cc3068a9e4 131 * @brief Selects the polynomial size.
mbed_official 125:23cc3068a9e4 132 * @param CRC_PolSize: Specifies the polynomial size.
mbed_official 125:23cc3068a9e4 133 * This parameter can be:
mbed_official 125:23cc3068a9e4 134 * @arg CRC_PolSize_7: 7-bit polynomial for CRC calculation
mbed_official 125:23cc3068a9e4 135 * @arg CRC_PolSize_8: 8-bit polynomial for CRC calculation
mbed_official 125:23cc3068a9e4 136 * @arg CRC_PolSize_16: 16-bit polynomial for CRC calculation
mbed_official 125:23cc3068a9e4 137 * @arg CRC_PolSize_32: 32-bit polynomial for CRC calculation
mbed_official 125:23cc3068a9e4 138 * @retval None
mbed_official 125:23cc3068a9e4 139 */
mbed_official 125:23cc3068a9e4 140 void CRC_PolynomialSizeSelect(uint32_t CRC_PolSize)
mbed_official 125:23cc3068a9e4 141 {
mbed_official 125:23cc3068a9e4 142 uint32_t tmpcr = 0;
mbed_official 125:23cc3068a9e4 143
mbed_official 125:23cc3068a9e4 144 /* Check the parameter */
mbed_official 125:23cc3068a9e4 145 assert_param(IS_CRC_POL_SIZE(CRC_PolSize));
mbed_official 125:23cc3068a9e4 146
mbed_official 125:23cc3068a9e4 147 /* Get CR register value */
mbed_official 125:23cc3068a9e4 148 tmpcr = CRC->CR;
mbed_official 125:23cc3068a9e4 149
mbed_official 125:23cc3068a9e4 150 /* Reset POL_SIZE bits */
mbed_official 125:23cc3068a9e4 151 tmpcr &= (uint32_t)~((uint32_t)CRC_CR_POLSIZE);
mbed_official 125:23cc3068a9e4 152 /* Set the polynomial size */
mbed_official 125:23cc3068a9e4 153 tmpcr |= (uint32_t)CRC_PolSize;
mbed_official 125:23cc3068a9e4 154
mbed_official 125:23cc3068a9e4 155 /* Write to CR register */
mbed_official 125:23cc3068a9e4 156 CRC->CR = (uint32_t)tmpcr;
mbed_official 125:23cc3068a9e4 157 }
mbed_official 125:23cc3068a9e4 158
mbed_official 125:23cc3068a9e4 159 /**
mbed_official 125:23cc3068a9e4 160 * @brief Selects the reverse operation to be performed on input data.
mbed_official 125:23cc3068a9e4 161 * @param CRC_ReverseInputData: Specifies the reverse operation on input data.
mbed_official 125:23cc3068a9e4 162 * This parameter can be:
mbed_official 125:23cc3068a9e4 163 * @arg CRC_ReverseInputData_No: No reverse operation is performed
mbed_official 125:23cc3068a9e4 164 * @arg CRC_ReverseInputData_8bits: reverse operation performed on 8 bits
mbed_official 125:23cc3068a9e4 165 * @arg CRC_ReverseInputData_16bits: reverse operation performed on 16 bits
mbed_official 125:23cc3068a9e4 166 * @arg CRC_ReverseInputData_32bits: reverse operation performed on 32 bits
mbed_official 125:23cc3068a9e4 167 * @retval None
mbed_official 125:23cc3068a9e4 168 */
mbed_official 125:23cc3068a9e4 169 void CRC_ReverseInputDataSelect(uint32_t CRC_ReverseInputData)
mbed_official 125:23cc3068a9e4 170 {
mbed_official 125:23cc3068a9e4 171 uint32_t tmpcr = 0;
mbed_official 125:23cc3068a9e4 172
mbed_official 125:23cc3068a9e4 173 /* Check the parameter */
mbed_official 125:23cc3068a9e4 174 assert_param(IS_CRC_REVERSE_INPUT_DATA(CRC_ReverseInputData));
mbed_official 125:23cc3068a9e4 175
mbed_official 125:23cc3068a9e4 176 /* Get CR register value */
mbed_official 125:23cc3068a9e4 177 tmpcr = CRC->CR;
mbed_official 125:23cc3068a9e4 178
mbed_official 125:23cc3068a9e4 179 /* Reset REV_IN bits */
mbed_official 125:23cc3068a9e4 180 tmpcr &= (uint32_t)~((uint32_t)CRC_CR_REV_IN);
mbed_official 125:23cc3068a9e4 181 /* Set the reverse operation */
mbed_official 125:23cc3068a9e4 182 tmpcr |= (uint32_t)CRC_ReverseInputData;
mbed_official 125:23cc3068a9e4 183
mbed_official 125:23cc3068a9e4 184 /* Write to CR register */
mbed_official 125:23cc3068a9e4 185 CRC->CR = (uint32_t)tmpcr;
mbed_official 125:23cc3068a9e4 186 }
mbed_official 125:23cc3068a9e4 187
mbed_official 125:23cc3068a9e4 188 /**
mbed_official 125:23cc3068a9e4 189 * @brief Enables or disable the reverse operation on output data.
mbed_official 125:23cc3068a9e4 190 * The reverse operation on output data is performed on 32-bit.
mbed_official 125:23cc3068a9e4 191 * @param NewState: new state of the reverse operation on output data.
mbed_official 125:23cc3068a9e4 192 * This parameter can be: ENABLE or DISABLE.
mbed_official 125:23cc3068a9e4 193 * @retval None
mbed_official 125:23cc3068a9e4 194 */
mbed_official 125:23cc3068a9e4 195 void CRC_ReverseOutputDataCmd(FunctionalState NewState)
mbed_official 125:23cc3068a9e4 196 {
mbed_official 125:23cc3068a9e4 197 /* Check the parameters */
mbed_official 125:23cc3068a9e4 198 assert_param(IS_FUNCTIONAL_STATE(NewState));
mbed_official 125:23cc3068a9e4 199
mbed_official 125:23cc3068a9e4 200 if (NewState != DISABLE)
mbed_official 125:23cc3068a9e4 201 {
mbed_official 125:23cc3068a9e4 202 /* Enable reverse operation on output data */
mbed_official 125:23cc3068a9e4 203 CRC->CR |= CRC_CR_REV_OUT;
mbed_official 125:23cc3068a9e4 204 }
mbed_official 125:23cc3068a9e4 205 else
mbed_official 125:23cc3068a9e4 206 {
mbed_official 125:23cc3068a9e4 207 /* Disable reverse operation on output data */
mbed_official 125:23cc3068a9e4 208 CRC->CR &= (uint32_t)~((uint32_t)CRC_CR_REV_OUT);
mbed_official 125:23cc3068a9e4 209 }
mbed_official 125:23cc3068a9e4 210 }
mbed_official 125:23cc3068a9e4 211
mbed_official 125:23cc3068a9e4 212 /**
mbed_official 125:23cc3068a9e4 213 * @brief Initializes the INIT register.
mbed_official 125:23cc3068a9e4 214 * @note After resetting CRC calculation unit, CRC_InitValue is stored in DR register
mbed_official 125:23cc3068a9e4 215 * @param CRC_InitValue: Programmable initial CRC value
mbed_official 125:23cc3068a9e4 216 * @retval None
mbed_official 125:23cc3068a9e4 217 */
mbed_official 125:23cc3068a9e4 218 void CRC_SetInitRegister(uint32_t CRC_InitValue)
mbed_official 125:23cc3068a9e4 219 {
mbed_official 125:23cc3068a9e4 220 CRC->INIT = CRC_InitValue;
mbed_official 125:23cc3068a9e4 221 }
mbed_official 125:23cc3068a9e4 222
mbed_official 125:23cc3068a9e4 223 /**
mbed_official 125:23cc3068a9e4 224 * @brief Initializes the polynomail coefficients.
mbed_official 125:23cc3068a9e4 225 * @param CRC_Pol: Polynomial to be used for CRC calculation.
mbed_official 125:23cc3068a9e4 226 * @retval None
mbed_official 125:23cc3068a9e4 227 */
mbed_official 125:23cc3068a9e4 228 void CRC_SetPolynomial(uint32_t CRC_Pol)
mbed_official 125:23cc3068a9e4 229 {
mbed_official 125:23cc3068a9e4 230 CRC->POL = CRC_Pol;
mbed_official 125:23cc3068a9e4 231 }
mbed_official 125:23cc3068a9e4 232
mbed_official 125:23cc3068a9e4 233 /**
mbed_official 125:23cc3068a9e4 234 * @}
mbed_official 125:23cc3068a9e4 235 */
mbed_official 125:23cc3068a9e4 236
mbed_official 125:23cc3068a9e4 237 /** @defgroup CRC_Group2 CRC computation of one/many 32-bit data functions
mbed_official 125:23cc3068a9e4 238 * @brief CRC computation of one/many 32-bit data functions
mbed_official 125:23cc3068a9e4 239 *
mbed_official 125:23cc3068a9e4 240 @verbatim
mbed_official 125:23cc3068a9e4 241 ===============================================================================
mbed_official 125:23cc3068a9e4 242 ##### CRC computation functions #####
mbed_official 125:23cc3068a9e4 243 ===============================================================================
mbed_official 125:23cc3068a9e4 244
mbed_official 125:23cc3068a9e4 245 @endverbatim
mbed_official 125:23cc3068a9e4 246 * @{
mbed_official 125:23cc3068a9e4 247 */
mbed_official 125:23cc3068a9e4 248
mbed_official 125:23cc3068a9e4 249 /**
mbed_official 125:23cc3068a9e4 250 * @brief Computes the 32-bit CRC of a given data word(32-bit).
mbed_official 125:23cc3068a9e4 251 * @param CRC_Data: data word(32-bit) to compute its CRC
mbed_official 125:23cc3068a9e4 252 * @retval 32-bit CRC
mbed_official 125:23cc3068a9e4 253 */
mbed_official 125:23cc3068a9e4 254 uint32_t CRC_CalcCRC(uint32_t CRC_Data)
mbed_official 125:23cc3068a9e4 255 {
mbed_official 125:23cc3068a9e4 256 CRC->DR = CRC_Data;
mbed_official 125:23cc3068a9e4 257
mbed_official 125:23cc3068a9e4 258 return (CRC->DR);
mbed_official 125:23cc3068a9e4 259 }
mbed_official 125:23cc3068a9e4 260
mbed_official 125:23cc3068a9e4 261 /**
mbed_official 125:23cc3068a9e4 262 * @brief Computes the 16-bit CRC of a given 16-bit data.
mbed_official 125:23cc3068a9e4 263 * @param CRC_Data: data half-word(16-bit) to compute its CRC
mbed_official 125:23cc3068a9e4 264 * @retval 16-bit CRC
mbed_official 125:23cc3068a9e4 265 */
mbed_official 125:23cc3068a9e4 266 uint32_t CRC_CalcCRC16bits(uint16_t CRC_Data)
mbed_official 125:23cc3068a9e4 267 {
mbed_official 125:23cc3068a9e4 268 *(uint16_t*)(CRC_BASE) = (uint16_t) CRC_Data;
mbed_official 125:23cc3068a9e4 269
mbed_official 125:23cc3068a9e4 270 return (CRC->DR);
mbed_official 125:23cc3068a9e4 271 }
mbed_official 125:23cc3068a9e4 272
mbed_official 125:23cc3068a9e4 273 /**
mbed_official 125:23cc3068a9e4 274 * @brief Computes the 8-bit CRC of a given 8-bit data.
mbed_official 125:23cc3068a9e4 275 * @param CRC_Data: 8-bit data to compute its CRC
mbed_official 125:23cc3068a9e4 276 * @retval 8-bit CRC
mbed_official 125:23cc3068a9e4 277 */
mbed_official 125:23cc3068a9e4 278 uint32_t CRC_CalcCRC8bits(uint8_t CRC_Data)
mbed_official 125:23cc3068a9e4 279 {
mbed_official 125:23cc3068a9e4 280 *(uint8_t*)(CRC_BASE) = (uint8_t) CRC_Data;
mbed_official 125:23cc3068a9e4 281
mbed_official 125:23cc3068a9e4 282 return (CRC->DR);
mbed_official 125:23cc3068a9e4 283 }
mbed_official 125:23cc3068a9e4 284
mbed_official 125:23cc3068a9e4 285 /**
mbed_official 125:23cc3068a9e4 286 * @brief Computes the 32-bit CRC of a given buffer of data word(32-bit).
mbed_official 125:23cc3068a9e4 287 * @param pBuffer: pointer to the buffer containing the data to be computed
mbed_official 125:23cc3068a9e4 288 * @param BufferLength: length of the buffer to be computed
mbed_official 125:23cc3068a9e4 289 * @retval 32-bit CRC
mbed_official 125:23cc3068a9e4 290 */
mbed_official 125:23cc3068a9e4 291 uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength)
mbed_official 125:23cc3068a9e4 292 {
mbed_official 125:23cc3068a9e4 293 uint32_t index = 0;
mbed_official 125:23cc3068a9e4 294
mbed_official 125:23cc3068a9e4 295 for(index = 0; index < BufferLength; index++)
mbed_official 125:23cc3068a9e4 296 {
mbed_official 125:23cc3068a9e4 297 CRC->DR = pBuffer[index];
mbed_official 125:23cc3068a9e4 298 }
mbed_official 125:23cc3068a9e4 299 return (CRC->DR);
mbed_official 125:23cc3068a9e4 300 }
mbed_official 125:23cc3068a9e4 301
mbed_official 125:23cc3068a9e4 302 /**
mbed_official 125:23cc3068a9e4 303 * @brief Returns the current CRC value.
mbed_official 125:23cc3068a9e4 304 * @param None
mbed_official 125:23cc3068a9e4 305 * @retval 32-bit CRC
mbed_official 125:23cc3068a9e4 306 */
mbed_official 125:23cc3068a9e4 307 uint32_t CRC_GetCRC(void)
mbed_official 125:23cc3068a9e4 308 {
mbed_official 125:23cc3068a9e4 309 return (CRC->DR);
mbed_official 125:23cc3068a9e4 310 }
mbed_official 125:23cc3068a9e4 311
mbed_official 125:23cc3068a9e4 312 /**
mbed_official 125:23cc3068a9e4 313 * @}
mbed_official 125:23cc3068a9e4 314 */
mbed_official 125:23cc3068a9e4 315
mbed_official 125:23cc3068a9e4 316 /** @defgroup CRC_Group3 CRC Independent Register (IDR) access functions
mbed_official 125:23cc3068a9e4 317 * @brief CRC Independent Register (IDR) access (write/read) functions
mbed_official 125:23cc3068a9e4 318 *
mbed_official 125:23cc3068a9e4 319 @verbatim
mbed_official 125:23cc3068a9e4 320 ===============================================================================
mbed_official 125:23cc3068a9e4 321 ##### CRC Independent Register (IDR) access functions #####
mbed_official 125:23cc3068a9e4 322 ===============================================================================
mbed_official 125:23cc3068a9e4 323
mbed_official 125:23cc3068a9e4 324 @endverbatim
mbed_official 125:23cc3068a9e4 325 * @{
mbed_official 125:23cc3068a9e4 326 */
mbed_official 125:23cc3068a9e4 327
mbed_official 125:23cc3068a9e4 328 /**
mbed_official 125:23cc3068a9e4 329 * @brief Stores an 8-bit data in the Independent Data(ID) register.
mbed_official 125:23cc3068a9e4 330 * @param CRC_IDValue: 8-bit value to be stored in the ID register
mbed_official 125:23cc3068a9e4 331 * @retval None
mbed_official 125:23cc3068a9e4 332 */
mbed_official 125:23cc3068a9e4 333 void CRC_SetIDRegister(uint8_t CRC_IDValue)
mbed_official 125:23cc3068a9e4 334 {
mbed_official 125:23cc3068a9e4 335 CRC->IDR = CRC_IDValue;
mbed_official 125:23cc3068a9e4 336 }
mbed_official 125:23cc3068a9e4 337
mbed_official 125:23cc3068a9e4 338 /**
mbed_official 125:23cc3068a9e4 339 * @brief Returns the 8-bit data stored in the Independent Data(ID) register
mbed_official 125:23cc3068a9e4 340 * @param None
mbed_official 125:23cc3068a9e4 341 * @retval 8-bit value of the ID register
mbed_official 125:23cc3068a9e4 342 */
mbed_official 125:23cc3068a9e4 343 uint8_t CRC_GetIDRegister(void)
mbed_official 125:23cc3068a9e4 344 {
mbed_official 125:23cc3068a9e4 345 return (CRC->IDR);
mbed_official 125:23cc3068a9e4 346 }
mbed_official 125:23cc3068a9e4 347
mbed_official 125:23cc3068a9e4 348 /**
mbed_official 125:23cc3068a9e4 349 * @}
mbed_official 125:23cc3068a9e4 350 */
mbed_official 125:23cc3068a9e4 351
mbed_official 125:23cc3068a9e4 352 /**
mbed_official 125:23cc3068a9e4 353 * @}
mbed_official 125:23cc3068a9e4 354 */
mbed_official 125:23cc3068a9e4 355
mbed_official 125:23cc3068a9e4 356 /**
mbed_official 125:23cc3068a9e4 357 * @}
mbed_official 125:23cc3068a9e4 358 */
mbed_official 125:23cc3068a9e4 359
mbed_official 125:23cc3068a9e4 360 /**
mbed_official 125:23cc3068a9e4 361 * @}
mbed_official 125:23cc3068a9e4 362 */
mbed_official 125:23cc3068a9e4 363
mbed_official 125:23cc3068a9e4 364 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/