Main Page
Modules
Namespaces
Classes
Files
File List
File Members
common
FastCRC
FastCRC.h
Go to the documentation of this file.
1
/* FastCRC library code is placed under the MIT license
2
* Copyright (c) 2014,2015 Frank Bosing
3
*
4
* Permission is hereby granted, free of charge, to any person obtaining
5
* a copy of this software and associated documentation files (the
6
* "Software"), to deal in the Software without restriction, including
7
* without limitation the rights to use, copy, modify, merge, publish,
8
* distribute, sublicense, and/or sell copies of the Software, and to
9
* permit persons to whom the Software is furnished to do so, subject to
10
* the following conditions:
11
*
12
* The above copyright notice and this permission notice shall be
13
* included in all copies or substantial portions of the Software.
14
*
15
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
* SOFTWARE.
23
*/
24
25
// Teensy 3.0, Teensy 3.1:
26
// See K20P64M72SF1RM.pdf (Kinetis), Pages 638 - 641 for documentation of CRC
27
// Device See KINETIS_4N30D.pdf for Errata (Errata ID 2776)
28
//
29
// So, ALL HW-calculations are done as 32 bit.
30
//
31
//
32
//
33
// Thanks to:
34
// - Catalogue of parametrised CRC algorithms, CRC RevEng
35
// http://reveng.sourceforge.net/crc-catalogue/
36
//
37
// - Danjel McGougan (CRC-Table-Generator)
38
//
39
40
//
41
// modify from FastCRC library @ 2018/11/20
42
//
43
44
#ifndef FASTCRC_FASTCRC_H_
45
#define FASTCRC_FASTCRC_H_
46
47
#include <
stdint.h
>
48
49
// ================= 16-BIT CRC ===================
50
51
class
FastCRC16
{
52
public
:
53
FastCRC16
(
uint16_t
seed);
54
55
// change function name from mcrf4xx_upd to mcrf4xx
56
uint16_t
mcrf4xx_calc
(
57
const
uint8_t
*data,
58
const
uint16_t
datalen);
// Equivalent to _crc_ccitt_update() in
59
// crc16.h from avr_libc
60
61
private
:
62
uint16_t
seed_
;
63
};
64
65
// ================= 32-BIT CRC ===================
66
67
class
FastCRC32
{
68
public
:
69
FastCRC32
(
uint32_t
seed);
70
71
// change function name from crc32_upd to crc32
72
uint32_t
crc32_calc(
73
const
uint8_t
*data,
74
uint16_t
len);
// Call for subsequent calculations with previous seed
75
76
private
:
77
uint32_t
seed_
;
78
};
79
80
#endif // FASTCRC_FASTCRC_H_
FastCRC16::FastCRC16
FastCRC16(uint16_t seed)
Definition:
FastCRCsw.cpp:43
FastCRC16::seed_
uint16_t seed_
Definition:
FastCRC.h:62
FastCRC32::seed_
uint32_t seed_
Definition:
FastCRC.h:77
FastCRC32
Definition:
FastCRC.h:67
uint16_t
unsigned short uint16_t
Definition:
stdint.h:126
uint8_t
unsigned char uint8_t
Definition:
stdint.h:125
FastCRC16::mcrf4xx_calc
uint16_t mcrf4xx_calc(const uint8_t *data, const uint16_t datalen)
Definition:
FastCRCsw.cpp:57
uint32_t
unsigned int uint32_t
Definition:
stdint.h:127
stdint.h
FastCRC16
Definition:
FastCRC.h:51
livox_ros_driver
Author(s): Livox Dev Team
autogenerated on Mon Mar 15 2021 02:40:46