uavcan bootloader use new AppDes

This commit is contained in:
David Sidrane
2021-01-28 13:08:16 -08:00
committed by Daniel Agar
parent bfdc6cd675
commit 760e47bbf9
7 changed files with 239 additions and 86 deletions
+38
View File
@@ -132,6 +132,44 @@ uint16_t crc16_signature(uint16_t initial, size_t length, const uint8_t *bytes)
return initial ^ CRC16_OUTPUT_XOR;
}
/****************************************************************************
* Name: crc32_signature
*
* Description:
* Calculates a CRC-32 function
*
* Input Parameters:
* acc - The accumulator value to uses as the crc's starting point
* length - The number of bytes to add to the crc
* bytes - A pointer to any array of length bytes
*
* Returned Value:
* The crc32 of the array of bytes
*
****************************************************************************/
uint32_t crc32_signature(uint32_t acc, size_t length, const uint8_t *bytes)
{
size_t i;
const uint32_t poly = 0xedb88320u;
const uint8_t bits = 8u;
uint8_t w = bits;
for (i = 0u; i < length; i++) {
acc ^= bytes[i];
w = bits;
while (w--) {
const uint32_t xor = -(acc & 1);
acc >>= 1;
acc ^= (poly & xor);
}
}
return acc;
}
/****************************************************************************
* Name: crc64_add_word
*
+21
View File
@@ -96,6 +96,27 @@ uint16_t crc16_add(uint16_t crc, uint8_t value);
uint16_t crc16_signature(uint16_t initial, size_t length,
const uint8_t *bytes);
/****************************************************************************
* Name: crc32_signature
*
* Description:
* Calculates a CRC-32
* function
*
* Input Parameters:
* acc - The Initial value to uses as the crc's starting point
* length - The number of bytes to add to the crc
* bytes - A pointer to any array of length bytes
*
* Returned Value:
* The crc16 of the array of bytes
*
****************************************************************************/
uint32_t crc32_signature(uint32_t acc, size_t length,
const uint8_t *bytes);
/****************************************************************************
* Name: crc64_add_word
*