/* Calculate CRC32 value of the input memory. 
The read value must be complemented to match standard CRC32 implementations or kept non-inverted if used as starting point for subsequent CRC32 calculations. */
enum status_code dsu_crc32_cal(const uint32_t addr, const uint32_t len, uint32_t *pcrc32)
/* Calculate CRC32 value of the input memory. 
The read value must be complemented to match standard CRC32 implementations or kept non-inverted if used as starting point for subsequent CRC32 calculations. */
enum status_code dsu_crc32_cal(const uint32_t addr, const uint32_t len, uint32_t *pcrc32)
{
	if (addr & 0x00000003) {
		return STATUS_ERR_BAD_ADDRESS;
	}
	DSU->DATA.reg = *pcrc32;
	DSU->ADDR.reg = addr;
	DSU->LENGTH.reg = len;
	DSU->CTRL.bit.CRC = 1;
	while ((DSU->STATUSA.reg & DSU_STATUSA_DONE) != 1) {	}
	if (DSU->STATUSA.reg & DSU_STATUSA_BERR) {
		return STATUS_ERR_IO;
	}
	*pcrc32 = DSU->DATA.reg;
	DSU->STATUSA.reg = DSU_STATUSA_DONE;
	return STATUS_OK;
}