furi_hal_crc.h 876 B

1234567891011121314151617181920212223242526272829303132333435
  1. #pragma once
  2. #include <stdint.h>
  3. #include <stdbool.h>
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /** Configure for CRC32 calculation
  8. * @param synchronize enforce acquisition & release in multithreaded environment
  9. */
  10. void furi_hal_crc_init(bool synchronize);
  11. /** Blocking call to get control of CRC block. Mandatory while RTOS is running
  12. * @param timeout time to wait for CRC to be available. Can be osWaitForever
  13. * @return bool acquisition success
  14. */
  15. bool furi_hal_crc_acquire(uint32_t timeout);
  16. /** Reset current calculation state and release CRC block
  17. */
  18. void furi_hal_crc_reset();
  19. /** Process data block. Does not reset current state,
  20. * allowing to process arbitrary data lengths
  21. * @param data pointer to data
  22. * @param length data length
  23. * @return uint32_t CRC32 value
  24. */
  25. uint32_t furi_hal_crc_feed(void* data, uint16_t length);
  26. #ifdef __cplusplus
  27. }
  28. #endif