24 static uint32_t reverse_32_bits(uint32_t value)
26 uint32_t reverse_val = 0;
28 for (
uint8_t i = 0; i < 32; i++) {
29 if ((value & (1 << i))) {
30 reverse_val |= 1 << ((32 - 1) - i);
37 uint32_t cx_crc32(
const void *buf,
size_t len)
39 return cx_crc_hw(CRC_TYPE_CRC32, CX_CRC32_INIT, buf, len);
42 uint32_t cx_crc32_update(uint32_t crc_state,
const void *buf,
size_t len)
44 crc_state = reverse_32_bits(crc_state);
45 crc_state ^= 0xFFFFFFFF;
46 return cx_crc_hw(CRC_TYPE_CRC32, crc_state, buf, len);
CRC (Cyclic Redundancy Check).