Martin Johnson / STM32F3-Discovery

Dependents:   Space_Invaders_Demo neopixels gpio_test_stm32f3_discovery gpio_test_systimer ... more

Committer:
MartinJohnson
Date:
Mon May 09 04:00:25 2016 +0000
Revision:
0:404f5a4f1385
Initial library for STM32F3 discovery board

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MartinJohnson 0:404f5a4f1385 1 /**
MartinJohnson 0:404f5a4f1385 2 ******************************************************************************
MartinJohnson 0:404f5a4f1385 3 * @file stm32f30x_crc.c
MartinJohnson 0:404f5a4f1385 4 * @author MCD Application Team
MartinJohnson 0:404f5a4f1385 5 * @version V1.2.3
MartinJohnson 0:404f5a4f1385 6 * @date 10-July-2015
MartinJohnson 0:404f5a4f1385 7 * @brief This file provides firmware functions to manage the following
MartinJohnson 0:404f5a4f1385 8 * functionalities of CRC computation unit peripheral:
MartinJohnson 0:404f5a4f1385 9 * + Configuration of the CRC computation unit
MartinJohnson 0:404f5a4f1385 10 * + CRC computation of one/many 32-bit data
MartinJohnson 0:404f5a4f1385 11 * + CRC Independent register (IDR) access
MartinJohnson 0:404f5a4f1385 12 *
MartinJohnson 0:404f5a4f1385 13 @verbatim
MartinJohnson 0:404f5a4f1385 14
MartinJohnson 0:404f5a4f1385 15 ===============================================================================
MartinJohnson 0:404f5a4f1385 16 ##### How to use this driver #####
MartinJohnson 0:404f5a4f1385 17 ===============================================================================
MartinJohnson 0:404f5a4f1385 18 [..]
MartinJohnson 0:404f5a4f1385 19 (#) Enable CRC AHB clock using RCC_AHBPeriphClockCmd(RCC_AHBPeriph_CRC, ENABLE)
MartinJohnson 0:404f5a4f1385 20 function.
MartinJohnson 0:404f5a4f1385 21 (#) Select the polynomial size: 7-bit, 8-bit, 16-bit or 32-bit.
MartinJohnson 0:404f5a4f1385 22 (#) Set the polynomial coefficients using CRC_SetPolynomial();
MartinJohnson 0:404f5a4f1385 23 (#) If required, select the reverse operation on input data
MartinJohnson 0:404f5a4f1385 24 using CRC_ReverseInputDataSelect();
MartinJohnson 0:404f5a4f1385 25 (#) If required, enable the reverse operation on output data
MartinJohnson 0:404f5a4f1385 26 using CRC_ReverseOutputDataCmd(Enable);
MartinJohnson 0:404f5a4f1385 27 (#) If required, set the initialization remainder value using
MartinJohnson 0:404f5a4f1385 28 CRC_SetInitRegister();
MartinJohnson 0:404f5a4f1385 29 (#) use CRC_CalcCRC() function to compute the CRC of a 32-bit data
MartinJohnson 0:404f5a4f1385 30 or use CRC_CalcBlockCRC() function to compute the CRC if a 32-bit
MartinJohnson 0:404f5a4f1385 31 data buffer.
MartinJohnson 0:404f5a4f1385 32
MartinJohnson 0:404f5a4f1385 33 @endverbatim
MartinJohnson 0:404f5a4f1385 34
MartinJohnson 0:404f5a4f1385 35 ******************************************************************************
MartinJohnson 0:404f5a4f1385 36 * @attention
MartinJohnson 0:404f5a4f1385 37 *
MartinJohnson 0:404f5a4f1385 38 * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
MartinJohnson 0:404f5a4f1385 39 *
MartinJohnson 0:404f5a4f1385 40 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
MartinJohnson 0:404f5a4f1385 41 * You may not use this file except in compliance with the License.
MartinJohnson 0:404f5a4f1385 42 * You may obtain a copy of the License at:
MartinJohnson 0:404f5a4f1385 43 *
MartinJohnson 0:404f5a4f1385 44 * http://www.st.com/software_license_agreement_liberty_v2
MartinJohnson 0:404f5a4f1385 45 *
MartinJohnson 0:404f5a4f1385 46 * Unless required by applicable law or agreed to in writing, software
MartinJohnson 0:404f5a4f1385 47 * distributed under the License is distributed on an "AS IS" BASIS,
MartinJohnson 0:404f5a4f1385 48 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
MartinJohnson 0:404f5a4f1385 49 * See the License for the specific language governing permissions and
MartinJohnson 0:404f5a4f1385 50 * limitations under the License.
MartinJohnson 0:404f5a4f1385 51 *
MartinJohnson 0:404f5a4f1385 52 ******************************************************************************
MartinJohnson 0:404f5a4f1385 53 */
MartinJohnson 0:404f5a4f1385 54
MartinJohnson 0:404f5a4f1385 55 /* Includes ------------------------------------------------------------------*/
MartinJohnson 0:404f5a4f1385 56 #include "stm32f30x_crc.h"
MartinJohnson 0:404f5a4f1385 57
MartinJohnson 0:404f5a4f1385 58 /** @addtogroup STM32F30x_StdPeriph_Driver
MartinJohnson 0:404f5a4f1385 59 * @{
MartinJohnson 0:404f5a4f1385 60 */
MartinJohnson 0:404f5a4f1385 61
MartinJohnson 0:404f5a4f1385 62 /** @defgroup CRC
MartinJohnson 0:404f5a4f1385 63 * @brief CRC driver modules
MartinJohnson 0:404f5a4f1385 64 * @{
MartinJohnson 0:404f5a4f1385 65 */
MartinJohnson 0:404f5a4f1385 66
MartinJohnson 0:404f5a4f1385 67 /* Private typedef -----------------------------------------------------------*/
MartinJohnson 0:404f5a4f1385 68 /* Private define ------------------------------------------------------------*/
MartinJohnson 0:404f5a4f1385 69 /* Private macro -------------------------------------------------------------*/
MartinJohnson 0:404f5a4f1385 70 /* Private variables ---------------------------------------------------------*/
MartinJohnson 0:404f5a4f1385 71 /* Private function prototypes -----------------------------------------------*/
MartinJohnson 0:404f5a4f1385 72 /* Private functions ---------------------------------------------------------*/
MartinJohnson 0:404f5a4f1385 73
MartinJohnson 0:404f5a4f1385 74 /** @defgroup CRC_Private_Functions
MartinJohnson 0:404f5a4f1385 75 * @{
MartinJohnson 0:404f5a4f1385 76 */
MartinJohnson 0:404f5a4f1385 77
MartinJohnson 0:404f5a4f1385 78 /** @defgroup CRC_Group1 Configuration of the CRC computation unit functions
MartinJohnson 0:404f5a4f1385 79 * @brief Configuration of the CRC computation unit functions
MartinJohnson 0:404f5a4f1385 80 *
MartinJohnson 0:404f5a4f1385 81 @verbatim
MartinJohnson 0:404f5a4f1385 82 ===============================================================================
MartinJohnson 0:404f5a4f1385 83 ##### CRC configuration functions #####
MartinJohnson 0:404f5a4f1385 84 ===============================================================================
MartinJohnson 0:404f5a4f1385 85
MartinJohnson 0:404f5a4f1385 86 @endverbatim
MartinJohnson 0:404f5a4f1385 87 * @{
MartinJohnson 0:404f5a4f1385 88 */
MartinJohnson 0:404f5a4f1385 89
MartinJohnson 0:404f5a4f1385 90 /**
MartinJohnson 0:404f5a4f1385 91 * @brief Deinitializes CRC peripheral registers to their default reset values.
MartinJohnson 0:404f5a4f1385 92 * @param None
MartinJohnson 0:404f5a4f1385 93 * @retval None
MartinJohnson 0:404f5a4f1385 94 */
MartinJohnson 0:404f5a4f1385 95 void CRC_DeInit(void)
MartinJohnson 0:404f5a4f1385 96 {
MartinJohnson 0:404f5a4f1385 97 /* Set DR register to reset value */
MartinJohnson 0:404f5a4f1385 98 CRC->DR = 0xFFFFFFFF;
MartinJohnson 0:404f5a4f1385 99 /* Set the POL register to the reset value: 0x04C11DB7 */
MartinJohnson 0:404f5a4f1385 100 CRC->POL = 0x04C11DB7;
MartinJohnson 0:404f5a4f1385 101 /* Reset IDR register */
MartinJohnson 0:404f5a4f1385 102 CRC->IDR = 0x00;
MartinJohnson 0:404f5a4f1385 103 /* Set INIT register to reset value */
MartinJohnson 0:404f5a4f1385 104 CRC->INIT = 0xFFFFFFFF;
MartinJohnson 0:404f5a4f1385 105 /* Reset the CRC calculation unit */
MartinJohnson 0:404f5a4f1385 106 CRC->CR = CRC_CR_RESET;
MartinJohnson 0:404f5a4f1385 107 }
MartinJohnson 0:404f5a4f1385 108
MartinJohnson 0:404f5a4f1385 109 /**
MartinJohnson 0:404f5a4f1385 110 * @brief Resets the CRC calculation unit and sets INIT register content in DR register.
MartinJohnson 0:404f5a4f1385 111 * @param None
MartinJohnson 0:404f5a4f1385 112 * @retval None
MartinJohnson 0:404f5a4f1385 113 */
MartinJohnson 0:404f5a4f1385 114 void CRC_ResetDR(void)
MartinJohnson 0:404f5a4f1385 115 {
MartinJohnson 0:404f5a4f1385 116 /* Reset CRC generator */
MartinJohnson 0:404f5a4f1385 117 CRC->CR |= CRC_CR_RESET;
MartinJohnson 0:404f5a4f1385 118 }
MartinJohnson 0:404f5a4f1385 119
MartinJohnson 0:404f5a4f1385 120 /**
MartinJohnson 0:404f5a4f1385 121 * @brief Selects the polynomial size.
MartinJohnson 0:404f5a4f1385 122 * @param CRC_PolSize: Specifies the polynomial size.
MartinJohnson 0:404f5a4f1385 123 * This parameter can be:
MartinJohnson 0:404f5a4f1385 124 * @arg CRC_PolSize_7: 7-bit polynomial for CRC calculation
MartinJohnson 0:404f5a4f1385 125 * @arg CRC_PolSize_8: 8-bit polynomial for CRC calculation
MartinJohnson 0:404f5a4f1385 126 * @arg CRC_PolSize_16: 16-bit polynomial for CRC calculation
MartinJohnson 0:404f5a4f1385 127 * @arg CRC_PolSize_32: 32-bit polynomial for CRC calculation
MartinJohnson 0:404f5a4f1385 128 * @retval None
MartinJohnson 0:404f5a4f1385 129 */
MartinJohnson 0:404f5a4f1385 130 void CRC_PolynomialSizeSelect(uint32_t CRC_PolSize)
MartinJohnson 0:404f5a4f1385 131 {
MartinJohnson 0:404f5a4f1385 132 uint32_t tmpcr = 0;
MartinJohnson 0:404f5a4f1385 133
MartinJohnson 0:404f5a4f1385 134 /* Check the parameter */
MartinJohnson 0:404f5a4f1385 135 assert_param(IS_CRC_POL_SIZE(CRC_PolSize));
MartinJohnson 0:404f5a4f1385 136
MartinJohnson 0:404f5a4f1385 137 /* Get CR register value */
MartinJohnson 0:404f5a4f1385 138 tmpcr = CRC->CR;
MartinJohnson 0:404f5a4f1385 139
MartinJohnson 0:404f5a4f1385 140 /* Reset POL_SIZE bits */
MartinJohnson 0:404f5a4f1385 141 tmpcr &= (uint32_t)~((uint32_t)CRC_CR_POLSIZE);
MartinJohnson 0:404f5a4f1385 142 /* Set the polynomial size */
MartinJohnson 0:404f5a4f1385 143 tmpcr |= (uint32_t)CRC_PolSize;
MartinJohnson 0:404f5a4f1385 144
MartinJohnson 0:404f5a4f1385 145 /* Write to CR register */
MartinJohnson 0:404f5a4f1385 146 CRC->CR = (uint32_t)tmpcr;
MartinJohnson 0:404f5a4f1385 147 }
MartinJohnson 0:404f5a4f1385 148
MartinJohnson 0:404f5a4f1385 149 /**
MartinJohnson 0:404f5a4f1385 150 * @brief Selects the reverse operation to be performed on input data.
MartinJohnson 0:404f5a4f1385 151 * @param CRC_ReverseInputData: Specifies the reverse operation on input data.
MartinJohnson 0:404f5a4f1385 152 * This parameter can be:
MartinJohnson 0:404f5a4f1385 153 * @arg CRC_ReverseInputData_No: No reverse operation is performed
MartinJohnson 0:404f5a4f1385 154 * @arg CRC_ReverseInputData_8bits: reverse operation performed on 8 bits
MartinJohnson 0:404f5a4f1385 155 * @arg CRC_ReverseInputData_16bits: reverse operation performed on 16 bits
MartinJohnson 0:404f5a4f1385 156 * @arg CRC_ReverseInputData_32bits: reverse operation performed on 32 bits
MartinJohnson 0:404f5a4f1385 157 * @retval None
MartinJohnson 0:404f5a4f1385 158 */
MartinJohnson 0:404f5a4f1385 159 void CRC_ReverseInputDataSelect(uint32_t CRC_ReverseInputData)
MartinJohnson 0:404f5a4f1385 160 {
MartinJohnson 0:404f5a4f1385 161 uint32_t tmpcr = 0;
MartinJohnson 0:404f5a4f1385 162
MartinJohnson 0:404f5a4f1385 163 /* Check the parameter */
MartinJohnson 0:404f5a4f1385 164 assert_param(IS_CRC_REVERSE_INPUT_DATA(CRC_ReverseInputData));
MartinJohnson 0:404f5a4f1385 165
MartinJohnson 0:404f5a4f1385 166 /* Get CR register value */
MartinJohnson 0:404f5a4f1385 167 tmpcr = CRC->CR;
MartinJohnson 0:404f5a4f1385 168
MartinJohnson 0:404f5a4f1385 169 /* Reset REV_IN bits */
MartinJohnson 0:404f5a4f1385 170 tmpcr &= (uint32_t)~((uint32_t)CRC_CR_REV_IN);
MartinJohnson 0:404f5a4f1385 171 /* Set the reverse operation */
MartinJohnson 0:404f5a4f1385 172 tmpcr |= (uint32_t)CRC_ReverseInputData;
MartinJohnson 0:404f5a4f1385 173
MartinJohnson 0:404f5a4f1385 174 /* Write to CR register */
MartinJohnson 0:404f5a4f1385 175 CRC->CR = (uint32_t)tmpcr;
MartinJohnson 0:404f5a4f1385 176 }
MartinJohnson 0:404f5a4f1385 177
MartinJohnson 0:404f5a4f1385 178 /**
MartinJohnson 0:404f5a4f1385 179 * @brief Enables or disable the reverse operation on output data.
MartinJohnson 0:404f5a4f1385 180 * The reverse operation on output data is performed on 32-bit.
MartinJohnson 0:404f5a4f1385 181 * @param NewState: new state of the reverse operation on output data.
MartinJohnson 0:404f5a4f1385 182 * This parameter can be: ENABLE or DISABLE.
MartinJohnson 0:404f5a4f1385 183 * @retval None
MartinJohnson 0:404f5a4f1385 184 */
MartinJohnson 0:404f5a4f1385 185 void CRC_ReverseOutputDataCmd(FunctionalState NewState)
MartinJohnson 0:404f5a4f1385 186 {
MartinJohnson 0:404f5a4f1385 187 /* Check the parameters */
MartinJohnson 0:404f5a4f1385 188 assert_param(IS_FUNCTIONAL_STATE(NewState));
MartinJohnson 0:404f5a4f1385 189
MartinJohnson 0:404f5a4f1385 190 if (NewState != DISABLE)
MartinJohnson 0:404f5a4f1385 191 {
MartinJohnson 0:404f5a4f1385 192 /* Enable reverse operation on output data */
MartinJohnson 0:404f5a4f1385 193 CRC->CR |= CRC_CR_REV_OUT;
MartinJohnson 0:404f5a4f1385 194 }
MartinJohnson 0:404f5a4f1385 195 else
MartinJohnson 0:404f5a4f1385 196 {
MartinJohnson 0:404f5a4f1385 197 /* Disable reverse operation on output data */
MartinJohnson 0:404f5a4f1385 198 CRC->CR &= (uint32_t)~((uint32_t)CRC_CR_REV_OUT);
MartinJohnson 0:404f5a4f1385 199 }
MartinJohnson 0:404f5a4f1385 200 }
MartinJohnson 0:404f5a4f1385 201
MartinJohnson 0:404f5a4f1385 202 /**
MartinJohnson 0:404f5a4f1385 203 * @brief Initializes the INIT register.
MartinJohnson 0:404f5a4f1385 204 * @note After resetting CRC calculation unit, CRC_InitValue is stored in DR register
MartinJohnson 0:404f5a4f1385 205 * @param CRC_InitValue: Programmable initial CRC value
MartinJohnson 0:404f5a4f1385 206 * @retval None
MartinJohnson 0:404f5a4f1385 207 */
MartinJohnson 0:404f5a4f1385 208 void CRC_SetInitRegister(uint32_t CRC_InitValue)
MartinJohnson 0:404f5a4f1385 209 {
MartinJohnson 0:404f5a4f1385 210 CRC->INIT = CRC_InitValue;
MartinJohnson 0:404f5a4f1385 211 }
MartinJohnson 0:404f5a4f1385 212
MartinJohnson 0:404f5a4f1385 213 /**
MartinJohnson 0:404f5a4f1385 214 * @brief Initializes the polynomial coefficients.
MartinJohnson 0:404f5a4f1385 215 * @param CRC_Pol: Polynomial to be used for CRC calculation.
MartinJohnson 0:404f5a4f1385 216 * @retval None
MartinJohnson 0:404f5a4f1385 217 */
MartinJohnson 0:404f5a4f1385 218 void CRC_SetPolynomial(uint32_t CRC_Pol)
MartinJohnson 0:404f5a4f1385 219 {
MartinJohnson 0:404f5a4f1385 220 CRC->POL = CRC_Pol;
MartinJohnson 0:404f5a4f1385 221 }
MartinJohnson 0:404f5a4f1385 222
MartinJohnson 0:404f5a4f1385 223 /**
MartinJohnson 0:404f5a4f1385 224 * @}
MartinJohnson 0:404f5a4f1385 225 */
MartinJohnson 0:404f5a4f1385 226
MartinJohnson 0:404f5a4f1385 227 /** @defgroup CRC_Group2 CRC computation of one/many 32-bit data functions
MartinJohnson 0:404f5a4f1385 228 * @brief CRC computation of one/many 32-bit data functions
MartinJohnson 0:404f5a4f1385 229 *
MartinJohnson 0:404f5a4f1385 230 @verbatim
MartinJohnson 0:404f5a4f1385 231 ===============================================================================
MartinJohnson 0:404f5a4f1385 232 ##### CRC computation functions #####
MartinJohnson 0:404f5a4f1385 233 ===============================================================================
MartinJohnson 0:404f5a4f1385 234
MartinJohnson 0:404f5a4f1385 235 @endverbatim
MartinJohnson 0:404f5a4f1385 236 * @{
MartinJohnson 0:404f5a4f1385 237 */
MartinJohnson 0:404f5a4f1385 238
MartinJohnson 0:404f5a4f1385 239 /**
MartinJohnson 0:404f5a4f1385 240 * @brief Computes the 32-bit CRC of a given data word(32-bit).
MartinJohnson 0:404f5a4f1385 241 * @param CRC_Data: data word(32-bit) to compute its CRC
MartinJohnson 0:404f5a4f1385 242 * @retval 32-bit CRC
MartinJohnson 0:404f5a4f1385 243 */
MartinJohnson 0:404f5a4f1385 244 uint32_t CRC_CalcCRC(uint32_t CRC_Data)
MartinJohnson 0:404f5a4f1385 245 {
MartinJohnson 0:404f5a4f1385 246 CRC->DR = CRC_Data;
MartinJohnson 0:404f5a4f1385 247
MartinJohnson 0:404f5a4f1385 248 return (CRC->DR);
MartinJohnson 0:404f5a4f1385 249 }
MartinJohnson 0:404f5a4f1385 250
MartinJohnson 0:404f5a4f1385 251 /**
MartinJohnson 0:404f5a4f1385 252 * @brief Computes the 16-bit CRC of a given 16-bit data.
MartinJohnson 0:404f5a4f1385 253 * @param CRC_Data: data half-word(16-bit) to compute its CRC
MartinJohnson 0:404f5a4f1385 254 * @retval 16-bit CRC
MartinJohnson 0:404f5a4f1385 255 */
MartinJohnson 0:404f5a4f1385 256 uint32_t CRC_CalcCRC16bits(uint16_t CRC_Data)
MartinJohnson 0:404f5a4f1385 257 {
MartinJohnson 0:404f5a4f1385 258 *(uint16_t*)(CRC_BASE) = (uint16_t) CRC_Data;
MartinJohnson 0:404f5a4f1385 259
MartinJohnson 0:404f5a4f1385 260 return (CRC->DR);
MartinJohnson 0:404f5a4f1385 261 }
MartinJohnson 0:404f5a4f1385 262
MartinJohnson 0:404f5a4f1385 263 /**
MartinJohnson 0:404f5a4f1385 264 * @brief Computes the 8-bit CRC of a given 8-bit data.
MartinJohnson 0:404f5a4f1385 265 * @param CRC_Data: 8-bit data to compute its CRC
MartinJohnson 0:404f5a4f1385 266 * @retval 8-bit CRC
MartinJohnson 0:404f5a4f1385 267 */
MartinJohnson 0:404f5a4f1385 268 uint32_t CRC_CalcCRC8bits(uint8_t CRC_Data)
MartinJohnson 0:404f5a4f1385 269 {
MartinJohnson 0:404f5a4f1385 270 *(uint8_t*)(CRC_BASE) = (uint8_t) CRC_Data;
MartinJohnson 0:404f5a4f1385 271
MartinJohnson 0:404f5a4f1385 272 return (CRC->DR);
MartinJohnson 0:404f5a4f1385 273 }
MartinJohnson 0:404f5a4f1385 274
MartinJohnson 0:404f5a4f1385 275 /**
MartinJohnson 0:404f5a4f1385 276 * @brief Computes the 32-bit CRC of a given buffer of data word(32-bit).
MartinJohnson 0:404f5a4f1385 277 * @param pBuffer: pointer to the buffer containing the data to be computed
MartinJohnson 0:404f5a4f1385 278 * @param BufferLength: length of the buffer to be computed
MartinJohnson 0:404f5a4f1385 279 * @retval 32-bit CRC
MartinJohnson 0:404f5a4f1385 280 */
MartinJohnson 0:404f5a4f1385 281 uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength)
MartinJohnson 0:404f5a4f1385 282 {
MartinJohnson 0:404f5a4f1385 283 uint32_t index = 0;
MartinJohnson 0:404f5a4f1385 284
MartinJohnson 0:404f5a4f1385 285 for(index = 0; index < BufferLength; index++)
MartinJohnson 0:404f5a4f1385 286 {
MartinJohnson 0:404f5a4f1385 287 CRC->DR = pBuffer[index];
MartinJohnson 0:404f5a4f1385 288 }
MartinJohnson 0:404f5a4f1385 289 return (CRC->DR);
MartinJohnson 0:404f5a4f1385 290 }
MartinJohnson 0:404f5a4f1385 291
MartinJohnson 0:404f5a4f1385 292 /**
MartinJohnson 0:404f5a4f1385 293 * @brief Returns the current CRC value.
MartinJohnson 0:404f5a4f1385 294 * @param None
MartinJohnson 0:404f5a4f1385 295 * @retval 32-bit CRC
MartinJohnson 0:404f5a4f1385 296 */
MartinJohnson 0:404f5a4f1385 297 uint32_t CRC_GetCRC(void)
MartinJohnson 0:404f5a4f1385 298 {
MartinJohnson 0:404f5a4f1385 299 return (CRC->DR);
MartinJohnson 0:404f5a4f1385 300 }
MartinJohnson 0:404f5a4f1385 301
MartinJohnson 0:404f5a4f1385 302 /**
MartinJohnson 0:404f5a4f1385 303 * @}
MartinJohnson 0:404f5a4f1385 304 */
MartinJohnson 0:404f5a4f1385 305
MartinJohnson 0:404f5a4f1385 306 /** @defgroup CRC_Group3 CRC Independent Register (IDR) access functions
MartinJohnson 0:404f5a4f1385 307 * @brief CRC Independent Register (IDR) access (write/read) functions
MartinJohnson 0:404f5a4f1385 308 *
MartinJohnson 0:404f5a4f1385 309 @verbatim
MartinJohnson 0:404f5a4f1385 310 ===============================================================================
MartinJohnson 0:404f5a4f1385 311 ##### CRC Independent Register (IDR) access functions #####
MartinJohnson 0:404f5a4f1385 312 ===============================================================================
MartinJohnson 0:404f5a4f1385 313
MartinJohnson 0:404f5a4f1385 314 @endverbatim
MartinJohnson 0:404f5a4f1385 315 * @{
MartinJohnson 0:404f5a4f1385 316 */
MartinJohnson 0:404f5a4f1385 317
MartinJohnson 0:404f5a4f1385 318 /**
MartinJohnson 0:404f5a4f1385 319 * @brief Stores an 8-bit data in the Independent Data(ID) register.
MartinJohnson 0:404f5a4f1385 320 * @param CRC_IDValue: 8-bit value to be stored in the ID register
MartinJohnson 0:404f5a4f1385 321 * @retval None
MartinJohnson 0:404f5a4f1385 322 */
MartinJohnson 0:404f5a4f1385 323 void CRC_SetIDRegister(uint8_t CRC_IDValue)
MartinJohnson 0:404f5a4f1385 324 {
MartinJohnson 0:404f5a4f1385 325 CRC->IDR = CRC_IDValue;
MartinJohnson 0:404f5a4f1385 326 }
MartinJohnson 0:404f5a4f1385 327
MartinJohnson 0:404f5a4f1385 328 /**
MartinJohnson 0:404f5a4f1385 329 * @brief Returns the 8-bit data stored in the Independent Data(ID) register
MartinJohnson 0:404f5a4f1385 330 * @param None
MartinJohnson 0:404f5a4f1385 331 * @retval 8-bit value of the ID register
MartinJohnson 0:404f5a4f1385 332 */
MartinJohnson 0:404f5a4f1385 333 uint8_t CRC_GetIDRegister(void)
MartinJohnson 0:404f5a4f1385 334 {
MartinJohnson 0:404f5a4f1385 335 return (CRC->IDR);
MartinJohnson 0:404f5a4f1385 336 }
MartinJohnson 0:404f5a4f1385 337
MartinJohnson 0:404f5a4f1385 338 /**
MartinJohnson 0:404f5a4f1385 339 * @}
MartinJohnson 0:404f5a4f1385 340 */
MartinJohnson 0:404f5a4f1385 341
MartinJohnson 0:404f5a4f1385 342 /**
MartinJohnson 0:404f5a4f1385 343 * @}
MartinJohnson 0:404f5a4f1385 344 */
MartinJohnson 0:404f5a4f1385 345
MartinJohnson 0:404f5a4f1385 346 /**
MartinJohnson 0:404f5a4f1385 347 * @}
MartinJohnson 0:404f5a4f1385 348 */
MartinJohnson 0:404f5a4f1385 349
MartinJohnson 0:404f5a4f1385 350 /**
MartinJohnson 0:404f5a4f1385 351 * @}
MartinJohnson 0:404f5a4f1385 352 */
MartinJohnson 0:404f5a4f1385 353
MartinJohnson 0:404f5a4f1385 354 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/