You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

138 lines
4.4 KiB

  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>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
  10. *
  11. * Redistribution and use in source and binary forms, with or without modification,
  12. * are permitted provided that the following conditions are met:
  13. * 1. Redistributions of source code must retain the above copyright notice,
  14. * this list of conditions and the following disclaimer.
  15. * 2. Redistributions in binary form must reproduce the above copyright notice,
  16. * this list of conditions and the following disclaimer in the documentation
  17. * and/or other materials provided with the distribution.
  18. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  19. * may be used to endorse or promote products derived from this software
  20. * without specific prior written permission.
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  23. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  24. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  25. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  26. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  27. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  28. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  29. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  30. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  31. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. *
  33. ******************************************************************************
  34. */
  35. #if defined(USE_FULL_LL_DRIVER)
  36. /* Includes ------------------------------------------------------------------*/
  37. #include "stm32f0xx_ll_crc.h"
  38. #ifdef USE_FULL_ASSERT
  39. #include "stm32_assert.h"
  40. #else
  41. #define assert_param(expr) ((void)0U)
  42. #endif
  43. /** @addtogroup STM32F0xx_LL_Driver
  44. * @{
  45. */
  46. #if defined (CRC)
  47. /** @addtogroup CRC_LL
  48. * @{
  49. */
  50. /* Private types -------------------------------------------------------------*/
  51. /* Private variables ---------------------------------------------------------*/
  52. /* Private constants ---------------------------------------------------------*/
  53. /* Private macros ------------------------------------------------------------*/
  54. /* Private function prototypes -----------------------------------------------*/
  55. /* Exported functions --------------------------------------------------------*/
  56. /** @addtogroup CRC_LL_Exported_Functions
  57. * @{
  58. */
  59. /** @addtogroup CRC_LL_EF_Init
  60. * @{
  61. */
  62. /**
  63. * @brief De-initialize CRC registers (Registers restored to their default values).
  64. * @param CRCx CRC Instance
  65. * @retval An ErrorStatus enumeration value:
  66. * - SUCCESS: CRC registers are de-initialized
  67. * - ERROR: CRC registers are not de-initialized
  68. */
  69. ErrorStatus LL_CRC_DeInit(CRC_TypeDef *CRCx)
  70. {
  71. ErrorStatus status = SUCCESS;
  72. /* Check the parameters */
  73. assert_param(IS_CRC_ALL_INSTANCE(CRCx));
  74. if (CRCx == CRC)
  75. {
  76. #if defined(CRC_PROG_POLYNOMIAL_SUPPORT)
  77. /* Set programmable polynomial size in CR register to reset value (32 bits)*/
  78. LL_CRC_SetPolynomialSize(CRCx, LL_CRC_POLYLENGTH_32B);
  79. /* Set programmable polynomial in POL register to reset value */
  80. LL_CRC_SetPolynomialCoef(CRCx, LL_CRC_DEFAULT_CRC32_POLY);
  81. #endif
  82. /* Set INIT register to reset value */
  83. LL_CRC_SetInitialData(CRCx, LL_CRC_DEFAULT_CRC_INITVALUE);
  84. /* Set Reversibility options on I/O data values in CR register to reset value */
  85. LL_CRC_SetInputDataReverseMode(CRCx, LL_CRC_INDATA_REVERSE_NONE);
  86. LL_CRC_SetOutputDataReverseMode(CRCx, LL_CRC_OUTDATA_REVERSE_NONE);
  87. /* Reset the CRC calculation unit */
  88. LL_CRC_ResetCRCCalculationUnit(CRCx);
  89. /* Reset IDR register */
  90. LL_CRC_Write_IDR(CRCx, 0x00U);
  91. }
  92. else
  93. {
  94. status = ERROR;
  95. }
  96. return (status);
  97. }
  98. /**
  99. * @}
  100. */
  101. /**
  102. * @}
  103. */
  104. /**
  105. * @}
  106. */
  107. #endif /* defined (CRC) */
  108. /**
  109. * @}
  110. */
  111. #endif /* USE_FULL_LL_DRIVER */
  112. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/