Livox SDK API
V2.0.0
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
26
// Teensy 3.0, Teensy 3.1:
27
// See K20P64M72SF1RM.pdf (Kinetis), Pages 638 - 641 for documentation of CRC Device
28
// See KINETIS_4N30D.pdf for Errata (Errata ID 2776)
29
//
30
// So, ALL HW-calculations are done as 32 bit.
31
//
32
//
33
//
34
// Thanks to:
35
// - Catalogue of parametrised CRC algorithms, CRC RevEng
36
// http://reveng.sourceforge.net/crc-catalogue/
37
//
38
// - Danjel McGougan (CRC-Table-Generator)
39
//
40
41
//
42
// modify from FastCRC library @ 2018/11/20
43
//
44
45
#ifndef FASTCRC_FASTCRC_H_
46
#define FASTCRC_FASTCRC_H_
47
48
#include <stdint.h>
49
50
51
// ================= 16-BIT CRC ===================
52
53
class
FastCRC16
{
54
public
:
55
FastCRC16
(uint16_t seed);
56
57
// change function name from mcrf4xx_upd to mcrf4xx
58
uint16_t
mcrf4xx_calc
(
const
uint8_t *
data
,
const
uint16_t datalen);
// Equivalent to _crc_ccitt_update() in crc16.h from avr_libc
59
60
private
:
61
uint16_t seed_;
62
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
(
const
uint8_t *
data
, uint16_t len);
// Call for subsequent calculations with previous seed
73
74
private
:
75
uint32_t seed_;
76
};
77
78
#endif // FASTCRC_FASTCRC_H_
79
fmt::v5::internal::data
basic_data data
Definition:
format.h:764
FastCRC32
Definition:
FastCRC.h:67
FastCRC16::FastCRC16
FastCRC16(uint16_t seed)
FastCRC32::crc32_calc
uint32_t crc32_calc(const uint8_t *data, uint16_t len)
FastCRC16::mcrf4xx_calc
uint16_t mcrf4xx_calc(const uint8_t *data, const uint16_t datalen)
FastCRC32::FastCRC32
FastCRC32(uint32_t seed)
FastCRC16
Definition:
FastCRC.h:53
sdk_core
include
third_party
FastCRC
FastCRC.h
Generated by
1.8.16