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.

stm32l1xx_hal_crc.h 5.0KB

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