Rev 4075 | Rev 4558 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4075 | Rev 4505 | ||
---|---|---|---|
Line 29... | Line 29... | ||
29 | /** @addtogroup net |
29 | /** @addtogroup net |
30 | * @{ |
30 | * @{ |
31 | */ |
31 | */ |
32 | 32 | ||
33 | /** @file |
33 | /** @file |
34 | * General CRC computation. |
34 | * General CRC and checksum computation. |
35 | */ |
35 | */ |
36 | 36 | ||
37 | #ifndef __NET_CRC_H__ |
37 | #ifndef __NET_CRC_H__ |
38 | #define __NET_CRC_H__ |
38 | #define __NET_CRC_H__ |
39 | 39 | ||
Line 67... | Line 67... | ||
67 | * @param length Length of the data in bits. Input parameter. |
67 | * @param length Length of the data in bits. Input parameter. |
68 | * @returns The computed CRC32 of the length bits of the data. |
68 | * @returns The computed CRC32 of the length bits of the data. |
69 | */ |
69 | */ |
70 | uint32_t compute_crc32_be( uint32_t seed, uint8_t * data, int length ); |
70 | uint32_t compute_crc32_be( uint32_t seed, uint8_t * data, int length ); |
71 | 71 | ||
- | 72 | /** Computes sum of the 2 byte fields. |
|
- | 73 | * Padds one zero (0) byte if odd. |
|
- | 74 | * @param seed Initial value. Often used as 0 or ~0. Input parameter. |
|
- | 75 | * @param data Pointer to the beginning of data to process. Input parameter. |
|
- | 76 | * @param length Length of the data in bytes. Input parameter. |
|
- | 77 | * @returns The computed checksum of the length bytes of the data. |
|
- | 78 | */ |
|
- | 79 | uint32_t compute_checksum( uint32_t seed, uint8_t * data, int length ); |
|
- | 80 | ||
- | 81 | /** Compacts the computed checksum to the 16 bit number adding the carries. |
|
- | 82 | * @param Computed checksum. Input parameter. |
|
- | 83 | * @returns Compacted computed checksum to the 16 bits. |
|
- | 84 | */ |
|
- | 85 | uint16_t compact_checksum( uint32_t sum ); |
|
- | 86 | ||
72 | #endif |
87 | #endif |
73 | 88 | ||
74 | /** @} |
89 | /** @} |
75 | */ |
90 | */ |