hc32f4a0_crc.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /**
  2. *******************************************************************************
  3. * @file hc32f4a0_crc.h
  4. * @brief This file contains all the functions prototypes of the CRC driver
  5. * library.
  6. @verbatim
  7. Change Logs:
  8. Date Author Notes
  9. 2020-06-12 Heqb First version
  10. @endverbatim
  11. *******************************************************************************
  12. * Copyright (C) 2020, Huada Semiconductor Co., Ltd. All rights reserved.
  13. *
  14. * This software component is licensed by HDSC under BSD 3-Clause license
  15. * (the "License"); You may not use this file except in compliance with the
  16. * License. You may obtain a copy of the License at:
  17. * opensource.org/licenses/BSD-3-Clause
  18. *
  19. *******************************************************************************
  20. */
  21. #ifndef __HC32F4A0_CRC_H__
  22. #define __HC32F4A0_CRC_H__
  23. /* C binding of definitions if building with C++ compiler */
  24. #ifdef __cplusplus
  25. extern "C"
  26. {
  27. #endif
  28. /*******************************************************************************
  29. * Include files
  30. ******************************************************************************/
  31. #include "hc32_common.h"
  32. #include "ddl_config.h"
  33. /**
  34. * @addtogroup HC32F4A0_DDL_Driver
  35. * @{
  36. */
  37. /**
  38. * @addtogroup DDL_CRC
  39. * @{
  40. */
  41. #if (DDL_CRC_ENABLE == DDL_ON)
  42. /*******************************************************************************
  43. * Global type definitions ('typedef')
  44. ******************************************************************************/
  45. /*******************************************************************************
  46. * Global pre-processor symbols/macros ('#define')
  47. ******************************************************************************/
  48. /* Bits definitions of CRC control register(CRC_CR). */
  49. /**
  50. * @defgroup CRC_Global_Macros CRC Global Macros
  51. * @{
  52. */
  53. /**
  54. * @defgroup CRC_Protocol_Control_Bit CRC Protocol Control Bit
  55. * @note: - CRC16 polynomial is X16 + X12 + X5 + 1
  56. * - CRC32 polynomial is X32 + X26 + X23 + X22 + X16 + X12 + X11 + X10 + \
  57. * X8 + X7 + X5 + X4 + X2 + X + 1
  58. * @{
  59. */
  60. #define CRC_CRC16 (0x0UL)
  61. #define CRC_CRC32 (CRC_CR_CR)
  62. /**
  63. * @}
  64. */
  65. /**
  66. * @defgroup CRC_Flag_Bit_Mask CRC Flag Bit Mask
  67. * @{
  68. */
  69. #define CRC_FLAG_MASK (CRC_CR_FLAG)
  70. /**
  71. * @}
  72. */
  73. /**
  74. * @defgroup CRC_Bit_Width CRC Bit Width
  75. * @{
  76. */
  77. #define CRC_BW_8 (8U)
  78. #define CRC_BW_16 (16U)
  79. #define CRC_BW_32 (32U)
  80. /**
  81. * @}
  82. */
  83. /**
  84. * @}
  85. */
  86. /*******************************************************************************
  87. * Global variable definitions ('extern')
  88. ******************************************************************************/
  89. /*******************************************************************************
  90. Global function prototypes (definition in C source)
  91. ******************************************************************************/
  92. /**
  93. * @addtogroup CRC_Global_Functions
  94. * @{
  95. */
  96. uint32_t CRC_Calculate(uint32_t u32CrcProtocol,
  97. const void *pvData,
  98. uint32_t u32InitVal,
  99. uint32_t u32Length,
  100. uint8_t u8BitWidth);
  101. en_flag_status_t CRC_Check(uint32_t u32CrcProtocol,
  102. uint32_t u32CheckSum,
  103. const void *pvData,
  104. uint32_t u32InitVal,
  105. uint32_t u32Length,
  106. uint8_t u8BitWidth);
  107. /**
  108. * @}
  109. */
  110. #endif /* DDL_CRC_ENABLE */
  111. /**
  112. * @}
  113. */
  114. /**
  115. * @}
  116. */
  117. #ifdef __cplusplus
  118. }
  119. #endif
  120. #endif /* __HC32F4A0_CRC_H__ */
  121. /*******************************************************************************
  122. * EOF (not truncated)
  123. ******************************************************************************/