MotorControlModuleSDFM_TMS3.../Projects/EFC_Application/UMLibrary/common/CrcDesc.hpp

141 lines
3.6 KiB
C++

/*
* CrcDesc.hpp
*
* Created on: 30 íîÿá. 2018 ã.
* Author: maksimenko
*/
#ifndef SOURCE_COMMON_CRCDESC_HPP_
#define SOURCE_COMMON_CRCDESC_HPP_
#include <cstddef>
namespace common {
namespace crc {
struct Crc32_ZLIB
{
static const uint32_t poly = 0xedb88320;// Áàçîâûé ïîëèíîì CRC
static const uint32_t width_bit = 32;// ×èñëî çíà÷àùèõ áèò ðàñ÷åòà
static const bool reflect = true;// Ïîðÿäîê áèòîâ â áàéòå b0->b7
static const uint32_t init = 0xFFFFFFFF;// Íà÷àëüíîå çíà÷åíèå CRC
static const uint32_t final = 0xFFFFFFFF;// Çíà÷åíèå çàâåðøàþùåãî XOR
typedef uint32_t res_t;// Òèï ïðåäñòàâëÿþùèé ðåçóëüòàò
typedef CrcVal<Crc32_ZLIB> crc_t;// Òèï ïåðåìåííîé ðàñ÷åòà CRC
};
struct Crc32_PRIME
{
static const uint32_t poly = 0x04c11db7;
static const uint32_t width_bit = 32;
static const bool reflect = false;
static const uint32_t init = 0x0;
static const uint32_t final = 0x0;
typedef uint32_t res_t;
typedef CrcVal<Crc32_PRIME> crc_t;
};
struct Crc16_802_15_4
{
static const uint32_t poly = 0x1021;
static const uint32_t width_bit = 16;
static const bool reflect = false;
static const uint32_t init = 0x0;
static const uint32_t final = 0x0;
typedef uint16_t res_t;
typedef CrcVal<Crc16_802_15_4> crc_t;
};
struct Crc16_ALT
{
static const uint32_t poly = 0x8005;
static const uint32_t width_bit = 16;
static const bool reflect = false;
static const uint32_t init = 0x0;
static const uint32_t final = 0x0;
typedef uint16_t res_t;
typedef CrcVal<Crc16_ALT> crc_t;
};
struct Crc16_IBM// CRC-16-ANSI (Modbus RTU,)
{
static const uint32_t poly = 0xA001;
static const uint32_t width_bit = 16;
static const bool reflect = true;
static const uint32_t init = 0xFFFF;
static const uint32_t final = 0x0;
typedef uint16_t res_t;
typedef CrcVal<Crc16_IBM> crc_t;
};
struct Crc8_PRIME
{
static const uint32_t poly = 0x07;
static const uint32_t width_bit = 8;
static const bool reflect = false;
static const uint32_t init = 0x0;
static const uint32_t final = 0x0;
typedef uint16_t res_t;
typedef CrcVal<Crc8_PRIME> crc_t;
};
struct Crc32_C
{
static const uint32_t poly = 0x1edc6f41;
static const uint32_t width_bit = 32;
static const bool reflect = false;
static const uint32_t init = 0x0;
static const uint32_t final = 0x0;
typedef uint32_t res_t;
typedef CrcVal<Crc32_C> crc_t;
};
struct Crc24_FLEXRAY
{
static const uint32_t poly = 0x005d6dcb;
static const uint32_t width_bit = 24;
static const bool reflect = false;
static const uint32_t init = 0x0;
static const uint32_t final = 0x0;
typedef uint32_t res_t;
typedef CrcVal<Crc24_FLEXRAY> crc_t;
};
struct Crc16_CCITT
{
static const uint32_t poly = 0x1021;
static const uint32_t width_bit = 16;
static const bool reflect = false;
static const uint32_t init = 0xFFFF;
static const uint32_t final = 0x0;
typedef uint16_t res_t;
typedef CrcVal<Crc16_CCITT> crc_t;
};
struct Crc6_BISS
{
static const uint32_t poly = 0x43;
static const uint32_t width_bit = 6;
static const bool reflect = true;
static const uint32_t init = 0x0;
static const uint32_t final = 0x3F;
typedef uint32_t res_t;
typedef CrcVal<Crc6_BISS> crc_t;
};
struct Crc3_GSM
{
static const uint32_t poly = 0x3;
static const uint32_t width_bit = 3;
static const bool reflect = false;
static const uint32_t init = 0x0;
static const uint32_t final = 0x7;
typedef uint16_t res_t;
typedef CrcVal<Crc3_GSM> crc_t;
};
} // namespace crc
} // namespace common
#endif /* SOURCE_COMMON_CRCDESC_HPP_ */