stm32f1xx_ll_crc.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. /**
  2. ******************************************************************************
  3. * @file stm32f1xx_ll_crc.h
  4. * @author MCD Application Team
  5. * @version V1.1.1
  6. * @date 12-May-2017
  7. * @brief Header file of CRC LL module.
  8. ******************************************************************************
  9. * @attention
  10. *
  11. * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
  12. *
  13. * Redistribution and use in source and binary forms, with or without modification,
  14. * are permitted provided that the following conditions are met:
  15. * 1. Redistributions of source code must retain the above copyright notice,
  16. * this list of conditions and the following disclaimer.
  17. * 2. Redistributions in binary form must reproduce the above copyright notice,
  18. * this list of conditions and the following disclaimer in the documentation
  19. * and/or other materials provided with the distribution.
  20. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  21. * may be used to endorse or promote products derived from this software
  22. * without specific prior written permission.
  23. *
  24. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  25. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  26. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  27. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  28. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  29. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  30. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  31. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  32. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  33. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  34. *
  35. ******************************************************************************
  36. */
  37. /* Define to prevent recursive inclusion -------------------------------------*/
  38. #ifndef __STM32F1xx_LL_CRC_H
  39. #define __STM32F1xx_LL_CRC_H
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif
  43. /* Includes ------------------------------------------------------------------*/
  44. #include "stm32f1xx.h"
  45. /** @addtogroup STM32F1xx_LL_Driver
  46. * @{
  47. */
  48. #if defined(CRC)
  49. /** @defgroup CRC_LL CRC
  50. * @{
  51. */
  52. /* Private types -------------------------------------------------------------*/
  53. /* Private variables ---------------------------------------------------------*/
  54. /* Private constants ---------------------------------------------------------*/
  55. /* Private macros ------------------------------------------------------------*/
  56. /* Exported types ------------------------------------------------------------*/
  57. /* Exported constants --------------------------------------------------------*/
  58. /* Exported macro ------------------------------------------------------------*/
  59. /** @defgroup CRC_LL_Exported_Macros CRC Exported Macros
  60. * @{
  61. */
  62. /** @defgroup CRC_LL_EM_WRITE_READ Common Write and read registers Macros
  63. * @{
  64. */
  65. /**
  66. * @brief Write a value in CRC register
  67. * @param __INSTANCE__ CRC Instance
  68. * @param __REG__ Register to be written
  69. * @param __VALUE__ Value to be written in the register
  70. * @retval None
  71. */
  72. #define LL_CRC_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
  73. /**
  74. * @brief Read a value in CRC register
  75. * @param __INSTANCE__ CRC Instance
  76. * @param __REG__ Register to be read
  77. * @retval Register value
  78. */
  79. #define LL_CRC_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
  80. /**
  81. * @}
  82. */
  83. /**
  84. * @}
  85. */
  86. /* Exported functions --------------------------------------------------------*/
  87. /** @defgroup CRC_LL_Exported_Functions CRC Exported Functions
  88. * @{
  89. */
  90. /** @defgroup CRC_LL_EF_Configuration CRC Configuration functions
  91. * @{
  92. */
  93. /**
  94. * @brief Reset the CRC calculation unit.
  95. * @rmtoll CR RESET LL_CRC_ResetCRCCalculationUnit
  96. * @param CRCx CRC Instance
  97. * @retval None
  98. */
  99. __STATIC_INLINE void LL_CRC_ResetCRCCalculationUnit(CRC_TypeDef *CRCx)
  100. {
  101. WRITE_REG(CRCx->CR, CRC_CR_RESET);
  102. }
  103. /**
  104. * @}
  105. */
  106. /** @defgroup CRC_LL_EF_Data_Management Data_Management
  107. * @{
  108. */
  109. /**
  110. * @brief Write given 32-bit data to the CRC calculator
  111. * @rmtoll DR DR LL_CRC_FeedData32
  112. * @param CRCx CRC Instance
  113. * @param InData value to be provided to CRC calculator between between Min_Data=0 and Max_Data=0xFFFFFFFF
  114. * @retval None
  115. */
  116. __STATIC_INLINE void LL_CRC_FeedData32(CRC_TypeDef *CRCx, uint32_t InData)
  117. {
  118. WRITE_REG(CRCx->DR, InData);
  119. }
  120. /**
  121. * @brief Return current CRC calculation result. 32 bits value is returned.
  122. * @rmtoll DR DR LL_CRC_ReadData32
  123. * @param CRCx CRC Instance
  124. * @retval Current CRC calculation result as stored in CRC_DR register (32 bits).
  125. */
  126. __STATIC_INLINE uint32_t LL_CRC_ReadData32(CRC_TypeDef *CRCx)
  127. {
  128. return (uint32_t)(READ_REG(CRCx->DR));
  129. }
  130. /**
  131. * @brief Return data stored in the Independent Data(IDR) register.
  132. * @note This register can be used as a temporary storage location for one byte.
  133. * @rmtoll IDR IDR LL_CRC_Read_IDR
  134. * @param CRCx CRC Instance
  135. * @retval Value stored in CRC_IDR register (General-purpose 8-bit data register).
  136. */
  137. __STATIC_INLINE uint32_t LL_CRC_Read_IDR(CRC_TypeDef *CRCx)
  138. {
  139. return (uint32_t)(READ_REG(CRCx->IDR));
  140. }
  141. /**
  142. * @brief Store data in the Independent Data(IDR) register.
  143. * @note This register can be used as a temporary storage location for one byte.
  144. * @rmtoll IDR IDR LL_CRC_Write_IDR
  145. * @param CRCx CRC Instance
  146. * @param InData value to be stored in CRC_IDR register (8-bit) between between Min_Data=0 and Max_Data=0xFF
  147. * @retval None
  148. */
  149. __STATIC_INLINE void LL_CRC_Write_IDR(CRC_TypeDef *CRCx, uint32_t InData)
  150. {
  151. *((uint8_t __IO *)(&CRCx->IDR)) = (uint8_t) InData;
  152. }
  153. /**
  154. * @}
  155. */
  156. #if defined(USE_FULL_LL_DRIVER)
  157. /** @defgroup CRC_LL_EF_Init Initialization and de-initialization functions
  158. * @{
  159. */
  160. ErrorStatus LL_CRC_DeInit(CRC_TypeDef *CRCx);
  161. /**
  162. * @}
  163. */
  164. #endif /* USE_FULL_LL_DRIVER */
  165. /**
  166. * @}
  167. */
  168. /**
  169. * @}
  170. */
  171. #endif /* defined(CRC) */
  172. /**
  173. * @}
  174. */
  175. #ifdef __cplusplus
  176. }
  177. #endif
  178. #endif /* __STM32F1xx_LL_CRC_H */
  179. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/