gd32f4xx_crc.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*!
  2. \file gd32f4xx_crc.h
  3. \brief definitions for the CRC
  4. */
  5. /*
  6. Copyright (C) 2016 GigaDevice
  7. 2016-08-15, V1.0.0, firmware for GD32F4xx
  8. */
  9. #ifndef GD32F4XX_CRC_H
  10. #define GD32F4XX_CRC_H
  11. #include "gd32f4xx.h"
  12. /* CRC definitions */
  13. #define CRC CRC_BASE
  14. /* registers definitions */
  15. #define CRC_DATA REG32(CRC + 0x00U) /*!< CRC data register */
  16. #define CRC_FDATA REG32(CRC + 0x04U) /*!< CRC free data register */
  17. #define CRC_CTL REG32(CRC + 0x08U) /*!< CRC control register */
  18. /* bits definitions */
  19. /* CRC_DATA */
  20. #define CRC_DATA_DATA BITS(0,31) /*!< CRC calculation result bits */
  21. /* CRC_FDATA */
  22. #define CRC_FDATA_FDATA BITS(0,7) /*!< CRC free data bits */
  23. /* CRC_CTL */
  24. #define CRC_CTL_RST BIT(0) /*!< CRC reset CRC_DATA register bit */
  25. /* function declarations */
  26. /* deinit CRC calculation unit */
  27. void crc_deinit(void);
  28. /* reset data register to the value of initializaiton data register */
  29. void crc_data_register_reset(void);
  30. /* read the data register */
  31. uint32_t crc_data_register_read(void);
  32. /* read the free data register */
  33. uint8_t crc_free_data_register_read(void);
  34. /* write the free data register */
  35. void crc_free_data_register_write(uint8_t free_data);
  36. /* CRC calculate a 32-bit data */
  37. uint32_t crc_single_data_calculate(uint32_t sdata);
  38. /* CRC calculate a 32-bit data array */
  39. uint32_t crc_block_data_calculate(uint32_t array[], uint32_t size);
  40. #endif /* GD32F4XX_CRC_H */