Store a temporary copy of the block on the stack to do our checksumming
on. This allows us to zero out the CRC32 field.
(There is a way to include the CRC32 field in the checksum itself, but
haven't figured out the mathematics needed yet.)
git-svn-id: https://svn.code.sf.net/p/freetel/code@2400
01035d8c-6547-0410-b346-
abe4f91aad63
static uint32_t vrom_crc32(
const struct vrom_data_block_t* const block)
{
+ struct vrom_data_block_t temp_block;
+ uint32_t size = sizeof(temp_block);
+ const uint8_t* in = (const uint8_t*)(&temp_block);
uint32_t tmp;
uint32_t crc;
- uint32_t size = VROM_BLOCK_SZ - sizeof(uint32_t);
- const uint8_t* in = (const uint8_t*)(&(block->header.rom));
+
+ memcpy(&temp_block, block, sizeof(temp_block));
+ temp_block.header.crc32 = 0;
CRC_ResetDR();
while(size) {