TURAG-Feldbus
crc_checksum.h
Go to the documentation of this file.
1
6#ifndef __TINA_CRC_CRC_CHECKSUMS_H__
7#define __TINA_CRC_CRC_CHECKSUMS_H__
8
9
10#ifdef __cplusplus
11# include <cstddef>
12# include <cstdint>
13# include <cstdbool>
14#else
15# include <stdint.h>
16# include <stdbool.h>
17# include <stddef.h>
18#endif
19
20
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26
27/*
28 * CRC-8/I-CODE implementation
29 */
30/* Generated on Fri Nov 1 21:06:17 2013,
31 * by pycrc v0.8.1, http://www.tty1.net/pycrc/
32 * using the configuration:
33 * Width = 8
34 * Poly = 0x1d
35 * XorIn = 0xfd
36 * ReflectIn = False
37 * XorOut = 0x00
38 * ReflectOut = False
39 * Algorithm = table-driven
40 */
41
42
48uint8_t turag_crc8_calculate(const void* data, size_t length);
49
56static inline bool turag_crc8_check(const void* data, size_t length, uint8_t chksum) {
57 return chksum == turag_crc8_calculate(data, length);
58}
59
60
61
82uint16_t turag_crc16_calculate(const void* data, size_t length);
83
90static inline bool turag_crc16_check(const void* data, size_t length, uint16_t chksum) {
91 return chksum == turag_crc16_calculate(data, length);
92}
93
94
95
96
97
98#ifdef __cplusplus
99} /* closing brace for extern "C" */
100#endif
101
102
103#endif /* __TINA_CRC_CRC_CHECKSUMS_H__ */
uint8_t turag_crc8_calculate(const void *data, size_t length)
Calculates a CRC8-checksum (using CRC-8/I-CODE)
Definition: crc_checksum.c:10
uint16_t turag_crc16_calculate(const void *data, size_t length)
CRC-16/IBM-3740 implementation.
Definition: crc_checksum.c:21