stm32f3xx_ll_crc.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /**
  2. ******************************************************************************
  3. * @file stm32f3xx_ll_crc.c
  4. * @author MCD Application Team
  5. * @brief CRC LL module driver.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * Copyright (c) 2017 STMicroelectronics.
  10. * All rights reserved.
  11. *
  12. * This software is licensed under terms that can be found in the LICENSE file
  13. * in the root directory of this software component.
  14. * If no LICENSE file comes with this software, it is provided AS-IS.
  15. *
  16. ******************************************************************************
  17. */
  18. #if defined(USE_FULL_LL_DRIVER)
  19. /* Includes ------------------------------------------------------------------*/
  20. #include "stm32f3xx_ll_crc.h"
  21. #include "stm32f3xx_ll_bus.h"
  22. #ifdef USE_FULL_ASSERT
  23. #include "stm32_assert.h"
  24. #else
  25. #define assert_param(expr) ((void)0U)
  26. #endif /* USE_FULL_ASSERT */
  27. /** @addtogroup STM32F3xx_LL_Driver
  28. * @{
  29. */
  30. #if defined (CRC)
  31. /** @addtogroup CRC_LL
  32. * @{
  33. */
  34. /* Private types -------------------------------------------------------------*/
  35. /* Private variables ---------------------------------------------------------*/
  36. /* Private constants ---------------------------------------------------------*/
  37. /* Private macros ------------------------------------------------------------*/
  38. /* Private function prototypes -----------------------------------------------*/
  39. /* Exported functions --------------------------------------------------------*/
  40. /** @addtogroup CRC_LL_Exported_Functions
  41. * @{
  42. */
  43. /** @addtogroup CRC_LL_EF_Init
  44. * @{
  45. */
  46. /**
  47. * @brief De-initialize CRC registers (Registers restored to their default values).
  48. * @param CRCx CRC Instance
  49. * @retval An ErrorStatus enumeration value:
  50. * - SUCCESS: CRC registers are de-initialized
  51. * - ERROR: CRC registers are not de-initialized
  52. */
  53. ErrorStatus LL_CRC_DeInit(CRC_TypeDef *CRCx)
  54. {
  55. ErrorStatus status = SUCCESS;
  56. /* Check the parameters */
  57. assert_param(IS_CRC_ALL_INSTANCE(CRCx));
  58. if (CRCx == CRC)
  59. {
  60. /* Set programmable polynomial size in CR register to reset value (32 bits)*/
  61. LL_CRC_SetPolynomialSize(CRCx, LL_CRC_POLYLENGTH_32B);
  62. /* Set programmable polynomial in POL register to reset value */
  63. LL_CRC_SetPolynomialCoef(CRCx, LL_CRC_DEFAULT_CRC32_POLY);
  64. /* Set INIT register to reset value */
  65. LL_CRC_SetInitialData(CRCx, LL_CRC_DEFAULT_CRC_INITVALUE);
  66. /* Set Reversibility options on I/O data values in CR register to reset value */
  67. LL_CRC_SetInputDataReverseMode(CRCx, LL_CRC_INDATA_REVERSE_NONE);
  68. LL_CRC_SetOutputDataReverseMode(CRCx, LL_CRC_OUTDATA_REVERSE_NONE);
  69. /* Reset the CRC calculation unit */
  70. LL_CRC_ResetCRCCalculationUnit(CRCx);
  71. /* Reset IDR register */
  72. LL_CRC_Write_IDR(CRCx, 0x00U);
  73. }
  74. else
  75. {
  76. status = ERROR;
  77. }
  78. return (status);
  79. }
  80. /**
  81. * @}
  82. */
  83. /**
  84. * @}
  85. */
  86. /**
  87. * @}
  88. */
  89. #endif /* defined (CRC) */
  90. /**
  91. * @}
  92. */
  93. #endif /* USE_FULL_LL_DRIVER */