Cyclic redundancy check (CRC) See (german): http://de.wikipedia.org/wiki/Zyklische_Redundanzpr%C3%BCfung.
More...
#include <Imt.Base.Core.Util/Crc.h>
|
static bool | createCRC16LookupTable (const uint16_t generatorPolynom, uint32_t &lookupTableIndex) |
| Create a crc lookup table for 16bit crc-codes. More...
|
|
static bool | releaseCRC16LookupTable (const uint32_t index) |
| Releases the created CRC lookup table. More...
|
|
static uint16_t | crc16 (const uint8_t *const pData, const uint32_t dataSize, const uint16_t crcInit, const uint16_t xorOut, const bool isReflected, uint32_t lookupTableIndex=0U) |
| Compute 16bit CRC code. More...
|
|
static uint32_t | crc32 (const uint8_t *pData, const uint32_t dataSize, const uint32_t crcInit) |
| Compute 32bit CRC code. More...
|
|
static uint8_t | crc8 (const uint8_t *pData, const uint32_t dataSize, const uint8_t crcInit) |
| Calculate the CRC-8 according to SFM3019 datasheet. More...
|
|
static uint8_t | crc4 (const uint16_t *const pData) |
| Calculate the CRC-4 according to AN520 (MS5607) More...
|
|
◆ crc16()
Compute 16bit CRC code.
The default generator polynom is x^16+x^12+x^5+1. This is equal to 0x11021. With only 16 bits, 0x1021 results. This polynom is commonly known as CRC-CCIT ( used by Xmodem-CRC telecommunication protocol, takes its name from the CCIT worldwide standards organization).
- Parameters
-
pData | Data for which the CRC is caculated. |
dataSize | Data size in bytes. |
crcInit | Initial CRC value. |
xorOut | XOR. |
isReflected | Reverse. |
lookupTableIndex | Index of the lookup table to compute the CRC with (optional). |
- Returns
- CRC-16 value.
◆ crc32()
Compute 32bit CRC code.
- Parameters
-
pData | Data for which the CRC is caculated. |
dataSize | Data size in bytes. |
crcInit | Initial CRC value. |
- Returns
- CRC-32 value.
◆ crc4()
static uint8_t imt::base::core::util::Crc::crc4 |
( |
const uint16_t *const |
pData | ) |
|
|
static |
Calculate the CRC-4 according to AN520 (MS5607)
- Parameters
-
pData | Data for which the CRC is caculated. |
- Returns
- CRC-4 value.
◆ crc8()
Calculate the CRC-8 according to SFM3019 datasheet.
Polynom 0x31 No input and output reflection Final XOR 0x00 Example: crc8(0xbeef, 0xff) = 0x92
- Parameters
-
pData | Data for which the CRC is caculated. |
dataSize | Data size in bytes. |
crcInit | Initial CRC value. |
- Returns
- CRC-8 value.
◆ createCRC16LookupTable()
static bool imt::base::core::util::Crc::createCRC16LookupTable |
( |
const uint16_t |
generatorPolynom, |
|
|
uint32_t & |
lookupTableIndex |
|
) |
| |
|
static |
Create a crc lookup table for 16bit crc-codes.
The lookup table has to be released on application exit. The generatorPolynom must be greater than zero.
- Parameters
-
generatorPolynom | Generator polynomial. |
lookupTableIndex | Result containing an index to the internal lookup table list. May be used with the method crc16(..,int tableIndex). |
- Returns
- True if successful.
◆ releaseCRC16LookupTable()
static bool imt::base::core::util::Crc::releaseCRC16LookupTable |
( |
const uint32_t |
index | ) |
|
|
static |
Releases the created CRC lookup table.
- Parameters
-
index | Index of the lookup table to release. |
- Returns
- True if successful.
The documentation for this class was generated from the following file:
- D:/_Work/10/s/Imt.Base/Imt.Base.Core.Util/Crc.h