Public Member Functions | |
MbedCRC (uint32_t initial_xor, uint32_t final_xor, bool reflect_data, bool reflect_remainder) | |
Lifetime of CRC object. More... | |
int32_t | compute (void *buffer, crc_data_size_t size, uint32_t *crc) |
Compute CRC for the data input Compute CRC performs the initialization, computation and collection of final CRC. More... | |
int32_t | compute_partial (void *buffer, crc_data_size_t size, uint32_t *crc) |
Compute partial CRC for the data input. More... | |
int32_t | compute_partial_start (uint32_t *crc) |
Compute partial start, indicate start of partial computation. More... | |
int32_t | compute_partial_stop (uint32_t *crc) |
Get the final CRC value of partial computation. More... | |
uint32_t | get_polynomial (void) const |
Get the current CRC polynomial. More... | |
uint8_t | get_width (void) const |
Get the current CRC width. More... | |
MbedCRC | ( | uint32_t | initial_xor, |
uint32_t | final_xor, | ||
bool | reflect_data, | ||
bool | reflect_remainder | ||
) |
Lifetime of CRC object.
initial_xor | Inital value/seed to Xor |
final_xor | Final Xor value |
reflect_data | |
reflect_remainder |
int32_t compute | ( | void * | buffer, |
crc_data_size_t | size, | ||
uint32_t * | crc | ||
) |
int32_t compute_partial | ( | void * | buffer, |
crc_data_size_t | size, | ||
uint32_t * | crc | ||
) |
Compute partial CRC for the data input.
CRC data if not available fully, CRC can be computed in parts with available data.
In case of hardware, intermediate values and states are saved by hardware. Mutex locking is used to serialize access to hardware CRC.
In case of software CRC, previous CRC output should be passed as argument to the current compute_partial call. Please note the intermediate CRC value is maintained by application and not the driver.
compute_partial_start
to start the partial CRC calculation. compute_partial_stop
to get the final CRC value.buffer | Data bytes |
size | Size of data |
crc | CRC value is intermediate CRC value filled by API. |
compute_partial_stop
to get final correct CRC value. int32_t compute_partial_start | ( | uint32_t * | crc | ) |
Compute partial start, indicate start of partial computation.
This API should be called before performing any partial computation with compute_partial API.
crc | Initial CRC value set by the API |
compute_partial_stop
without any modifications in application. int32_t compute_partial_stop | ( | uint32_t * | crc | ) |
Get the final CRC value of partial computation.
CRC value available in partial computation is not correct CRC, as some algorithms require remainder to be reflected and final value to be XORed This API is used to perform final computation to get correct CRC value.
crc | CRC result |
uint32_t get_polynomial | ( | void | ) | const |