stm32f1xx_hal_crc.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. /**
  2. ******************************************************************************
  3. * @file stm32f1xx_hal_crc.h
  4. * @author MCD Application Team
  5. * @brief Header file of CRC HAL module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * Copyright (c) 2016 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. /* Define to prevent recursive inclusion -------------------------------------*/
  19. #ifndef STM32F1xx_HAL_CRC_H
  20. #define STM32F1xx_HAL_CRC_H
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. /* Includes ------------------------------------------------------------------*/
  25. #include "stm32f1xx_hal_def.h"
  26. /** @addtogroup STM32F1xx_HAL_Driver
  27. * @{
  28. */
  29. /** @addtogroup CRC
  30. * @{
  31. */
  32. /* Exported types ------------------------------------------------------------*/
  33. /** @defgroup CRC_Exported_Types CRC Exported Types
  34. * @{
  35. */
  36. /**
  37. * @brief CRC HAL State Structure definition
  38. */
  39. typedef enum
  40. {
  41. HAL_CRC_STATE_RESET = 0x00U, /*!< CRC not yet initialized or disabled */
  42. HAL_CRC_STATE_READY = 0x01U, /*!< CRC initialized and ready for use */
  43. HAL_CRC_STATE_BUSY = 0x02U, /*!< CRC internal process is ongoing */
  44. HAL_CRC_STATE_TIMEOUT = 0x03U, /*!< CRC timeout state */
  45. HAL_CRC_STATE_ERROR = 0x04U /*!< CRC error state */
  46. } HAL_CRC_StateTypeDef;
  47. /**
  48. * @brief CRC Handle Structure definition
  49. */
  50. typedef struct
  51. {
  52. CRC_TypeDef *Instance; /*!< Register base address */
  53. HAL_LockTypeDef Lock; /*!< CRC Locking object */
  54. __IO HAL_CRC_StateTypeDef State; /*!< CRC communication state */
  55. } CRC_HandleTypeDef;
  56. /**
  57. * @}
  58. */
  59. /* Exported constants --------------------------------------------------------*/
  60. /** @defgroup CRC_Exported_Constants CRC Exported Constants
  61. * @{
  62. */
  63. /**
  64. * @}
  65. */
  66. /* Exported macros -----------------------------------------------------------*/
  67. /** @defgroup CRC_Exported_Macros CRC Exported Macros
  68. * @{
  69. */
  70. /** @brief Reset CRC handle state.
  71. * @param __HANDLE__ CRC handle.
  72. * @retval None
  73. */
  74. #define __HAL_CRC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_CRC_STATE_RESET)
  75. /**
  76. * @brief Reset CRC Data Register.
  77. * @param __HANDLE__ CRC handle
  78. * @retval None
  79. */
  80. #define __HAL_CRC_DR_RESET(__HANDLE__) ((__HANDLE__)->Instance->CR |= CRC_CR_RESET)
  81. /**
  82. * @brief Store data in the Independent Data (ID) register.
  83. * @param __HANDLE__ CRC handle
  84. * @param __VALUE__ Value to be stored in the ID register
  85. * @note Refer to the Reference Manual to get the authorized __VALUE__ length in bits
  86. * @retval None
  87. */
  88. #define __HAL_CRC_SET_IDR(__HANDLE__, __VALUE__) (WRITE_REG((__HANDLE__)->Instance->IDR, (__VALUE__)))
  89. /**
  90. * @brief Return the data stored in the Independent Data (ID) register.
  91. * @param __HANDLE__ CRC handle
  92. * @note Refer to the Reference Manual to get the authorized __VALUE__ length in bits
  93. * @retval Value of the ID register
  94. */
  95. #define __HAL_CRC_GET_IDR(__HANDLE__) (((__HANDLE__)->Instance->IDR) & CRC_IDR_IDR)
  96. /**
  97. * @}
  98. */
  99. /* Private macros --------------------------------------------------------*/
  100. /** @defgroup CRC_Private_Macros CRC Private Macros
  101. * @{
  102. */
  103. /**
  104. * @}
  105. */
  106. /* Exported functions --------------------------------------------------------*/
  107. /** @defgroup CRC_Exported_Functions CRC Exported Functions
  108. * @{
  109. */
  110. /* Initialization and de-initialization functions ****************************/
  111. /** @defgroup CRC_Exported_Functions_Group1 Initialization and de-initialization functions
  112. * @{
  113. */
  114. HAL_StatusTypeDef HAL_CRC_Init(CRC_HandleTypeDef *hcrc);
  115. HAL_StatusTypeDef HAL_CRC_DeInit(CRC_HandleTypeDef *hcrc);
  116. void HAL_CRC_MspInit(CRC_HandleTypeDef *hcrc);
  117. void HAL_CRC_MspDeInit(CRC_HandleTypeDef *hcrc);
  118. /**
  119. * @}
  120. */
  121. /* Peripheral Control functions ***********************************************/
  122. /** @defgroup CRC_Exported_Functions_Group2 Peripheral Control functions
  123. * @{
  124. */
  125. uint32_t HAL_CRC_Accumulate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_t BufferLength);
  126. uint32_t HAL_CRC_Calculate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_t BufferLength);
  127. /**
  128. * @}
  129. */
  130. /* Peripheral State and Error functions ***************************************/
  131. /** @defgroup CRC_Exported_Functions_Group3 Peripheral State functions
  132. * @{
  133. */
  134. HAL_CRC_StateTypeDef HAL_CRC_GetState(const CRC_HandleTypeDef *hcrc);
  135. /**
  136. * @}
  137. */
  138. /**
  139. * @}
  140. */
  141. /**
  142. * @}
  143. */
  144. /**
  145. * @}
  146. */
  147. #ifdef __cplusplus
  148. }
  149. #endif
  150. #endif /* STM32F1xx_HAL_CRC_H */