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.
 
 
 

154 lines
4.6 KiB

  1. /**
  2. ******************************************************************************
  3. * @file stm32wbxx_hal_crc_ex.h
  4. * @author MCD Application Team
  5. * @brief Header file of CRC HAL extended module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; Copyright (c) 2019 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 STM32WBxx_HAL_CRC_EX_H
  21. #define STM32WBxx_HAL_CRC_EX_H
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. /* Includes ------------------------------------------------------------------*/
  26. #include "stm32wbxx_hal_def.h"
  27. /** @addtogroup STM32WBxx_HAL_Driver
  28. * @{
  29. */
  30. /** @addtogroup CRCEx
  31. * @{
  32. */
  33. /* Exported types ------------------------------------------------------------*/
  34. /* Exported constants --------------------------------------------------------*/
  35. /** @defgroup CRCEx_Exported_Constants CRC Extended Exported Constants
  36. * @{
  37. */
  38. /** @defgroup CRCEx_Input_Data_Inversion Input Data Inversion Modes
  39. * @{
  40. */
  41. #define CRC_INPUTDATA_INVERSION_NONE 0x00000000U /*!< No input data inversion */
  42. #define CRC_INPUTDATA_INVERSION_BYTE CRC_CR_REV_IN_0 /*!< Byte-wise input data inversion */
  43. #define CRC_INPUTDATA_INVERSION_HALFWORD CRC_CR_REV_IN_1 /*!< HalfWord-wise input data inversion */
  44. #define CRC_INPUTDATA_INVERSION_WORD CRC_CR_REV_IN /*!< Word-wise input data inversion */
  45. /**
  46. * @}
  47. */
  48. /** @defgroup CRCEx_Output_Data_Inversion Output Data Inversion Modes
  49. * @{
  50. */
  51. #define CRC_OUTPUTDATA_INVERSION_DISABLE 0x00000000U /*!< No output data inversion */
  52. #define CRC_OUTPUTDATA_INVERSION_ENABLE CRC_CR_REV_OUT /*!< Bit-wise output data inversion */
  53. /**
  54. * @}
  55. */
  56. /**
  57. * @}
  58. */
  59. /* Exported macro ------------------------------------------------------------*/
  60. /** @defgroup CRCEx_Exported_Macros CRC Extended Exported Macros
  61. * @{
  62. */
  63. /**
  64. * @brief Set CRC output reversal
  65. * @param __HANDLE__ CRC handle
  66. * @retval None
  67. */
  68. #define __HAL_CRC_OUTPUTREVERSAL_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= CRC_CR_REV_OUT)
  69. /**
  70. * @brief Unset CRC output reversal
  71. * @param __HANDLE__ CRC handle
  72. * @retval None
  73. */
  74. #define __HAL_CRC_OUTPUTREVERSAL_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(CRC_CR_REV_OUT))
  75. /**
  76. * @brief Set CRC non-default polynomial
  77. * @param __HANDLE__ CRC handle
  78. * @param __POLYNOMIAL__ 7, 8, 16 or 32-bit polynomial
  79. * @retval None
  80. */
  81. #define __HAL_CRC_POLYNOMIAL_CONFIG(__HANDLE__, __POLYNOMIAL__) ((__HANDLE__)->Instance->POL = (__POLYNOMIAL__))
  82. /**
  83. * @}
  84. */
  85. /* Private macros --------------------------------------------------------*/
  86. /** @defgroup CRCEx_Private_Macros CRC Extended Private Macros
  87. * @{
  88. */
  89. #define IS_CRC_INPUTDATA_INVERSION_MODE(MODE) (((MODE) == CRC_INPUTDATA_INVERSION_NONE) || \
  90. ((MODE) == CRC_INPUTDATA_INVERSION_BYTE) || \
  91. ((MODE) == CRC_INPUTDATA_INVERSION_HALFWORD) || \
  92. ((MODE) == CRC_INPUTDATA_INVERSION_WORD))
  93. #define IS_CRC_OUTPUTDATA_INVERSION_MODE(MODE) (((MODE) == CRC_OUTPUTDATA_INVERSION_DISABLE) || \
  94. ((MODE) == CRC_OUTPUTDATA_INVERSION_ENABLE))
  95. /**
  96. * @}
  97. */
  98. /* Exported functions --------------------------------------------------------*/
  99. /** @addtogroup CRCEx_Exported_Functions
  100. * @{
  101. */
  102. /** @addtogroup CRCEx_Exported_Functions_Group1
  103. * @{
  104. */
  105. /* Initialization and de-initialization functions ****************************/
  106. HAL_StatusTypeDef HAL_CRCEx_Polynomial_Set(CRC_HandleTypeDef *hcrc, uint32_t Pol, uint32_t PolyLength);
  107. HAL_StatusTypeDef HAL_CRCEx_Input_Data_Reverse(CRC_HandleTypeDef *hcrc, uint32_t InputReverseMode);
  108. HAL_StatusTypeDef HAL_CRCEx_Output_Data_Reverse(CRC_HandleTypeDef *hcrc, uint32_t OutputReverseMode);
  109. /**
  110. * @}
  111. */
  112. /**
  113. * @}
  114. */
  115. /**
  116. * @}
  117. */
  118. /**
  119. * @}
  120. */
  121. #ifdef __cplusplus
  122. }
  123. #endif
  124. #endif /* STM32WBxx_HAL_CRC_EX_H */
  125. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/