py32f0xx_hal_crc.h 5.4 KB

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