/* * CrcDesc.hpp * * Created on: 30 нояб. 2018 г. * Author: maksimenko */ #ifndef SOURCE_COMMON_CRCDESC_HPP_ #define SOURCE_COMMON_CRCDESC_HPP_ #include 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 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 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 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 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 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 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 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 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 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 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 crc_t; }; } // namespace crc } // namespace common #endif /* SOURCE_COMMON_CRCDESC_HPP_ */