31,7 → 31,7 |
*/ |
|
/** @file |
* General CRC computation. |
* General CRC and checksum computation. |
*/ |
|
#ifndef __NET_CRC_H__ |
69,6 → 69,21 |
*/ |
uint32_t compute_crc32_be( uint32_t seed, uint8_t * data, int length ); |
|
/** Computes sum of the 2 byte fields. |
* Padds one zero (0) byte if odd. |
* @param seed Initial value. Often used as 0 or ~0. Input parameter. |
* @param data Pointer to the beginning of data to process. Input parameter. |
* @param length Length of the data in bytes. Input parameter. |
* @returns The computed checksum of the length bytes of the data. |
*/ |
uint32_t compute_checksum( uint32_t seed, uint8_t * data, int length ); |
|
/** Compacts the computed checksum to the 16 bit number adding the carries. |
* @param Computed checksum. Input parameter. |
* @returns Compacted computed checksum to the 16 bits. |
*/ |
uint16_t compact_checksum( uint32_t sum ); |
|
#endif |
|
/** @} |