Projet voilier 4IRA1 Arnaud Vergnet Marino Benassai Bastien Picco Yohan Simard
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.

stm32f1xx_ll_crc.h 5.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. /**
  2. ******************************************************************************
  3. * @file stm32f1xx_ll_crc.h
  4. * @author MCD Application Team
  5. * @brief Header file of CRC LL module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; 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. /* Define to prevent recursive inclusion -------------------------------------*/
  20. #ifndef STM32F1xx_LL_CRC_H
  21. #define STM32F1xx_LL_CRC_H
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. /* Includes ------------------------------------------------------------------*/
  26. #include "stm32f1xx.h"
  27. /** @addtogroup STM32F1xx_LL_Driver
  28. * @{
  29. */
  30. #if defined(CRC)
  31. /** @defgroup CRC_LL CRC
  32. * @{
  33. */
  34. /* Private types -------------------------------------------------------------*/
  35. /* Private variables ---------------------------------------------------------*/
  36. /* Private constants ---------------------------------------------------------*/
  37. /* Private macros ------------------------------------------------------------*/
  38. /* Exported types ------------------------------------------------------------*/
  39. /* Exported constants --------------------------------------------------------*/
  40. /** @defgroup CRC_LL_Exported_Constants CRC Exported Constants
  41. * @{
  42. */
  43. /**
  44. * @}
  45. */
  46. /* Exported macro ------------------------------------------------------------*/
  47. /** @defgroup CRC_LL_Exported_Macros CRC Exported Macros
  48. * @{
  49. */
  50. /** @defgroup CRC_LL_EM_WRITE_READ Common Write and read registers Macros
  51. * @{
  52. */
  53. /**
  54. * @brief Write a value in CRC register
  55. * @param __INSTANCE__ CRC Instance
  56. * @param __REG__ Register to be written
  57. * @param __VALUE__ Value to be written in the register
  58. * @retval None
  59. */
  60. #define LL_CRC_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, __VALUE__)
  61. /**
  62. * @brief Read a value in CRC register
  63. * @param __INSTANCE__ CRC Instance
  64. * @param __REG__ Register to be read
  65. * @retval Register value
  66. */
  67. #define LL_CRC_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
  68. /**
  69. * @}
  70. */
  71. /**
  72. * @}
  73. */
  74. /* Exported functions --------------------------------------------------------*/
  75. /** @defgroup CRC_LL_Exported_Functions CRC Exported Functions
  76. * @{
  77. */
  78. /** @defgroup CRC_LL_EF_Configuration CRC Configuration functions
  79. * @{
  80. */
  81. /**
  82. * @brief Reset the CRC calculation unit.
  83. * @note If Programmable Initial CRC value feature
  84. * is available, also set the Data Register to the value stored in the
  85. * CRC_INIT register, otherwise, reset Data Register to its default value.
  86. * @rmtoll CR RESET LL_CRC_ResetCRCCalculationUnit
  87. * @param CRCx CRC Instance
  88. * @retval None
  89. */
  90. __STATIC_INLINE void LL_CRC_ResetCRCCalculationUnit(CRC_TypeDef *CRCx)
  91. {
  92. SET_BIT(CRCx->CR, CRC_CR_RESET);
  93. }
  94. /**
  95. * @}
  96. */
  97. /** @defgroup CRC_LL_EF_Data_Management Data_Management
  98. * @{
  99. */
  100. /**
  101. * @brief Write given 32-bit data to the CRC calculator
  102. * @rmtoll DR DR LL_CRC_FeedData32
  103. * @param CRCx CRC Instance
  104. * @param InData value to be provided to CRC calculator between between Min_Data=0 and Max_Data=0xFFFFFFFF
  105. * @retval None
  106. */
  107. __STATIC_INLINE void LL_CRC_FeedData32(CRC_TypeDef *CRCx, uint32_t InData)
  108. {
  109. WRITE_REG(CRCx->DR, InData);
  110. }
  111. /**
  112. * @brief Return current CRC calculation result. 32 bits value is returned.
  113. * @rmtoll DR DR LL_CRC_ReadData32
  114. * @param CRCx CRC Instance
  115. * @retval Current CRC calculation result as stored in CRC_DR register (32 bits).
  116. */
  117. __STATIC_INLINE uint32_t LL_CRC_ReadData32(CRC_TypeDef *CRCx)
  118. {
  119. return (uint32_t)(READ_REG(CRCx->DR));
  120. }
  121. /**
  122. * @brief Return data stored in the Independent Data(IDR) register.
  123. * @note This register can be used as a temporary storage location for one byte.
  124. * @rmtoll IDR IDR LL_CRC_Read_IDR
  125. * @param CRCx CRC Instance
  126. * @retval Value stored in CRC_IDR register (General-purpose 8-bit data register).
  127. */
  128. __STATIC_INLINE uint32_t LL_CRC_Read_IDR(CRC_TypeDef *CRCx)
  129. {
  130. return (uint32_t)(READ_REG(CRCx->IDR));
  131. }
  132. /**
  133. * @brief Store data in the Independent Data(IDR) register.
  134. * @note This register can be used as a temporary storage location for one byte.
  135. * @rmtoll IDR IDR LL_CRC_Write_IDR
  136. * @param CRCx CRC Instance
  137. * @param InData value to be stored in CRC_IDR register (8-bit) between Min_Data=0 and Max_Data=0xFF
  138. * @retval None
  139. */
  140. __STATIC_INLINE void LL_CRC_Write_IDR(CRC_TypeDef *CRCx, uint32_t InData)
  141. {
  142. *((uint8_t __IO *)(&CRCx->IDR)) = (uint8_t) InData;
  143. }
  144. /**
  145. * @}
  146. */
  147. #if defined(USE_FULL_LL_DRIVER)
  148. /** @defgroup CRC_LL_EF_Init Initialization and de-initialization functions
  149. * @{
  150. */
  151. ErrorStatus LL_CRC_DeInit(CRC_TypeDef *CRCx);
  152. /**
  153. * @}
  154. */
  155. #endif /* USE_FULL_LL_DRIVER */
  156. /**
  157. * @}
  158. */
  159. /**
  160. * @}
  161. */
  162. #endif /* defined(CRC) */
  163. /**
  164. * @}
  165. */
  166. #ifdef __cplusplus
  167. }
  168. #endif
  169. #endif /* STM32F1xx_LL_CRC_H */
  170. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/