Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 2 | mjames | 1 | /** |
| 2 | ****************************************************************************** |
||
| 3 | * @file stm32f0xx_ll_crc.c |
||
| 4 | * @author MCD Application Team |
||
| 5 | * @brief CRC LL module driver. |
||
| 6 | ****************************************************************************** |
||
| 7 | * @attention |
||
| 8 | * |
||
| 9 | * <h2><center>© Copyright (c) 2016 STMicroelectronics. |
||
| 10 | * All rights reserved.</center></h2> |
||
| 11 | * |
||
| 12 | * This software component is licensed by ST under BSD 3-Clause license, |
||
| 13 | * the "License"; You may not use this file except in compliance with the |
||
| 14 | * License. You may obtain a copy of the License at: |
||
| 15 | * opensource.org/licenses/BSD-3-Clause |
||
| 16 | * |
||
| 17 | ****************************************************************************** |
||
| 18 | */ |
||
| 19 | #if defined(USE_FULL_LL_DRIVER) |
||
| 20 | |||
| 21 | /* Includes ------------------------------------------------------------------*/ |
||
| 22 | #include "stm32f0xx_ll_crc.h" |
||
| 23 | #include "stm32f0xx_ll_bus.h" |
||
| 24 | |||
| 25 | #ifdef USE_FULL_ASSERT |
||
| 26 | #include "stm32_assert.h" |
||
| 27 | #else |
||
| 28 | #define assert_param(expr) ((void)0U) |
||
| 6 | mjames | 29 | #endif /* USE_FULL_ASSERT */ |
| 2 | mjames | 30 | |
| 31 | /** @addtogroup STM32F0xx_LL_Driver |
||
| 32 | * @{ |
||
| 33 | */ |
||
| 34 | |||
| 35 | #if defined (CRC) |
||
| 36 | |||
| 37 | /** @addtogroup CRC_LL |
||
| 38 | * @{ |
||
| 39 | */ |
||
| 40 | |||
| 41 | /* Private types -------------------------------------------------------------*/ |
||
| 42 | /* Private variables ---------------------------------------------------------*/ |
||
| 43 | /* Private constants ---------------------------------------------------------*/ |
||
| 44 | /* Private macros ------------------------------------------------------------*/ |
||
| 45 | /* Private function prototypes -----------------------------------------------*/ |
||
| 46 | |||
| 47 | /* Exported functions --------------------------------------------------------*/ |
||
| 48 | /** @addtogroup CRC_LL_Exported_Functions |
||
| 49 | * @{ |
||
| 50 | */ |
||
| 51 | |||
| 52 | /** @addtogroup CRC_LL_EF_Init |
||
| 53 | * @{ |
||
| 54 | */ |
||
| 55 | |||
| 56 | /** |
||
| 57 | * @brief De-initialize CRC registers (Registers restored to their default values). |
||
| 58 | * @param CRCx CRC Instance |
||
| 59 | * @retval An ErrorStatus enumeration value: |
||
| 60 | * - SUCCESS: CRC registers are de-initialized |
||
| 61 | * - ERROR: CRC registers are not de-initialized |
||
| 62 | */ |
||
| 63 | ErrorStatus LL_CRC_DeInit(CRC_TypeDef *CRCx) |
||
| 64 | { |
||
| 65 | ErrorStatus status = SUCCESS; |
||
| 66 | |||
| 67 | /* Check the parameters */ |
||
| 68 | assert_param(IS_CRC_ALL_INSTANCE(CRCx)); |
||
| 69 | |||
| 70 | if (CRCx == CRC) |
||
| 71 | { |
||
| 72 | #if defined(CRC_POL_POL) |
||
| 73 | /* Set programmable polynomial size in CR register to reset value (32 bits)*/ |
||
| 74 | LL_CRC_SetPolynomialSize(CRCx, LL_CRC_POLYLENGTH_32B); |
||
| 75 | |||
| 76 | /* Set programmable polynomial in POL register to reset value */ |
||
| 77 | LL_CRC_SetPolynomialCoef(CRCx, LL_CRC_DEFAULT_CRC32_POLY); |
||
| 78 | #endif /* CRC_POL_POL */ |
||
| 79 | |||
| 80 | /* Set INIT register to reset value */ |
||
| 81 | LL_CRC_SetInitialData(CRCx, LL_CRC_DEFAULT_CRC_INITVALUE); |
||
| 82 | |||
| 83 | /* Set Reversibility options on I/O data values in CR register to reset value */ |
||
| 84 | LL_CRC_SetInputDataReverseMode(CRCx, LL_CRC_INDATA_REVERSE_NONE); |
||
| 85 | LL_CRC_SetOutputDataReverseMode(CRCx, LL_CRC_OUTDATA_REVERSE_NONE); |
||
| 86 | |||
| 87 | /* Reset the CRC calculation unit */ |
||
| 88 | LL_CRC_ResetCRCCalculationUnit(CRCx); |
||
| 89 | |||
| 90 | /* Reset IDR register */ |
||
| 91 | LL_CRC_Write_IDR(CRCx, 0x00U); |
||
| 92 | } |
||
| 93 | else |
||
| 94 | { |
||
| 95 | status = ERROR; |
||
| 96 | } |
||
| 97 | |||
| 98 | return (status); |
||
| 99 | } |
||
| 100 | |||
| 101 | /** |
||
| 102 | * @} |
||
| 103 | */ |
||
| 104 | |||
| 105 | /** |
||
| 106 | * @} |
||
| 107 | */ |
||
| 108 | |||
| 109 | /** |
||
| 110 | * @} |
||
| 111 | */ |
||
| 112 | |||
| 113 | #endif /* defined (CRC) */ |
||
| 114 | |||
| 115 | /** |
||
| 116 | * @} |
||
| 117 | */ |
||
| 118 | |||
| 119 | #endif /* USE_FULL_LL_DRIVER */ |
||
| 120 | |||
| 121 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
||
| 122 |