Microchip® Advanced Software Framework

classb_crc_sw.h File Reference

Definitions and settings for the CRC implemented in software.

Application note:
AVR1610: Guide to IEC60730 Class B compliance with XMEGA

Copyright (c) 2011-2018 Microchip Technology Inc. and its subsidiaries.

#include <asf.h>
#include "classb_crc.h"

Macros

Configuration settings for CRC software implementation

Symbols used to choose between lookup table or direct computation.

They should be defined for lookup table implementation and commented out otherwise.

#define CRC_USE_16BIT_LOOKUP_TABLE
 Select the lookup table method for 16-bit CRC. More...
 
#define CRC_USE_32BIT_LOOKUP_TABLE
 Select the lookup table method for 32-bit CRC. More...
 
Constants for internal use

This options make sure that the CRC computation complies with the standard 16-bit CCITT CRC and IEE802.3 32-bit CRC.

Attention
These should not be modified by user!
#define CRC16_POLYNOMIAL   (uint16_t)0x1021
 Polynomial used for computation of CRC16 (software, not lookup table) More...
 
#define CRC32_POLYNOMIAL   (uint32_t)0xEDB88320UL
 Polynomial used for computation of CRC32 (software, not lookup table) More...
 
#define CRC32_FINAL_XOR_VALUE   (uint32_t)0xFFFFFFFF
 Final XOR Value for CRC32. More...
 
Internal macros used for CRC computation
#define CLASSB_CRC(data, crc, poly, crcbits)
 Update CRC value for one input byte. More...
 
#define CLASSB_CRC_REFL(data, crc, poly, crcbits)
 Update CRC value for one input byte (reflected polynomial). More...
 
#define CLASSB_CRC_REFL_TABLE_32(data, crc, table)
 Update 32-bit CRC value for one input byte (reflected polynomial). More...
 
#define CLASSB_CRC_TABLE_16(data, crc, table)
 Update 16-bit CRC value for one input byte. More...
 

Functions

CRC tests

Invariant memory tests based on CRC that are compliant with IEC60730 Class B.

uint16_t CLASSB_CRC16_EEPROM_SW (eepromptr_t dataptr, const crcbytenum_t numBytes, eeprom_uint16ptr_t pchecksum)
 Compute 16-bit CRC for EEPROM address range using table lookup. More...
 
uint16_t CLASSB_CRC16_Flash_SW (flashptr_t dataptr, const crcbytenum_t numBytes, eeprom_uint16ptr_t pchecksum)
 Compute 16-bit CRC for Flash address range using table lookup. More...
 
uint32_t CLASSB_CRC32_EEPROM_SW (eepromptr_t dataptr, const crcbytenum_t numBytes, eeprom_uint32ptr_t pchecksum)
 Compute 32-bit CRC for EEPROM address range using table lookup. More...
 
uint32_t CLASSB_CRC32_Flash_SW (flashptr_t dataptr, const crcbytenum_t numBytes, eeprom_uint32ptr_t pchecksum)
 Compute 32-bit CRC for Flash address range using table lookup. More...