Arduino Core for STM32  1.0
HardwareCRC.h File Reference

This file contains class, that provides hardware CRC calculation. More...

#include "wirish.h"
Include dependency graph for HardwareCRC.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  HardwareCRC
 Calculate CRC simply and fast using this class. Calculation is done using hardware CRC calculation unit. More...
 

Macros

#define CRC_X0   (0x01UL)
 
#define CRC_X1   (0x01UL << 1U)
 
#define CRC_X2   (0x01UL << 2U)
 
#define CRC_X3   (0x01UL << 3U)
 
#define CRC_X4   (0x01UL << 4U)
 
#define CRC_X5   (0x01UL << 5U)
 
#define CRC_X6   (0x01UL << 6U)
 
#define CRC_X7   (0x01UL << 7U)
 
#define CRC_X8   (0x01UL << 8U)
 
#define CRC_X9   (0x01UL << 9U)
 
#define CRC_X10   (0x01UL << 10U)
 
#define CRC_X11   (0x01UL << 11U)
 
#define CRC_X12   (0x01UL << 12U)
 
#define CRC_X13   (0x01UL << 13U)
 
#define CRC_X14   (0x01UL << 14U)
 
#define CRC_X15   (0x01UL << 15U)
 
#define CRC_X16   (0x01UL << 16U)
 
#define CRC_X17   (0x01UL << 17U)
 
#define CRC_X18   (0x01UL << 18U)
 
#define CRC_X19   (0x01UL << 19U)
 
#define CRC_X20   (0x01UL << 20U)
 
#define CRC_X21   (0x01UL << 21U)
 
#define CRC_X22   (0x01UL << 22U)
 
#define CRC_X23   (0x01UL << 23U)
 
#define CRC_X24   (0x01UL << 24U)
 
#define CRC_X25   (0x01UL << 25U)
 
#define CRC_X26   (0x01UL << 26U)
 
#define CRC_X27   (0x01UL << 27U)
 
#define CRC_X28   (0x01UL << 28U)
 
#define CRC_X29   (0x01UL << 29U)
 
#define CRC_X30   (0x01UL << 30U)
 
#define CRC_X31   (0x01UL << 31U)
 
#define CRC32_POLY   (0x04C11DB7UL) /* X^32 + X^26 + X^23 + X^22 + X^16 + X^12 + X^11 + X^10 +X^8 + X^7 + X^5 + X^4 + X^2+ X +1 */
 
#define CRC16_POLY   (0x8005UL) /* X^16 + X^15 + X^2 + 1 - IBM CRC polynomial*/
 
#define CRC8_POLY   (0x31UL) /* X^8 + X^5 + X^4 + 1 - I2C CRC polynomial*/
 
#define CRC7_POLY   (0x09UL) /* X^7 + X^3 + 1 */
 
#define DEFAULT_HCRC_INITVAL   (0xFFFFFFFFUL)
 
#define HCRC_POLYSIZE_MASK   (0x18)
 
#define HCRC_32BIT_POLYSIZE   (0x00)
 
#define HCRC_16BIT_POLYSIZE   (0x08)
 
#define HCRC_8BIT_POLYSIZE   (0x10)
 
#define HCRC_7BIT_POLYSIZE   (HCRC_POLYSIZE_MASK)
 
#define HCRC_OUT_REVERSE_MASK   (0x80)
 
#define HCRC_OUT_REVERSE_ENABLED   HCRC_OUT_REVERSE_MASK
 
#define HCRC_OUT_REVERSE_DISABLED   (0x0)
 
#define HCRC_IN_REVERSE_MASK   (0x60)
 
#define HCRC_IN_REVERSE_ENABLED_BYTE   (0x20)
 
#define HCRC_IN_REVERSE_ENABLED_HALFWORD   (0x40)
 
#define HCRC_IN_REVERSE_ENABLED_WORD   HCRC_IN_REVERSE_MASK
 
#define HCRC_IN_REVERSE_DISABLED   (0x0)
 

Variables

HardwareCRC crc
 

Detailed Description

This file contains class, that provides hardware CRC calculation.

Credits

Author
Matej Fitoš
Date
Sept 27, 2021
See also
HardwareCRC
Default CRC polynomials
CRC polynomial terms
Hardware CRC documentation

Macro Definition Documentation

◆ DEFAULT_HCRC_INITVAL

#define DEFAULT_HCRC_INITVAL   (0xFFFFFFFFUL)

◆ HCRC_POLYSIZE_MASK

#define HCRC_POLYSIZE_MASK   (0x18)

◆ HCRC_32BIT_POLYSIZE

#define HCRC_32BIT_POLYSIZE   (0x00)

◆ HCRC_16BIT_POLYSIZE

#define HCRC_16BIT_POLYSIZE   (0x08)

◆ HCRC_8BIT_POLYSIZE

#define HCRC_8BIT_POLYSIZE   (0x10)

◆ HCRC_7BIT_POLYSIZE

#define HCRC_7BIT_POLYSIZE   (HCRC_POLYSIZE_MASK)

◆ HCRC_OUT_REVERSE_MASK

#define HCRC_OUT_REVERSE_MASK   (0x80)

◆ HCRC_OUT_REVERSE_ENABLED

#define HCRC_OUT_REVERSE_ENABLED   HCRC_OUT_REVERSE_MASK

◆ HCRC_OUT_REVERSE_DISABLED

#define HCRC_OUT_REVERSE_DISABLED   (0x0)

◆ HCRC_IN_REVERSE_MASK

#define HCRC_IN_REVERSE_MASK   (0x60)

◆ HCRC_IN_REVERSE_ENABLED_BYTE

#define HCRC_IN_REVERSE_ENABLED_BYTE   (0x20)

◆ HCRC_IN_REVERSE_ENABLED_HALFWORD

#define HCRC_IN_REVERSE_ENABLED_HALFWORD   (0x40)

◆ HCRC_IN_REVERSE_ENABLED_WORD

#define HCRC_IN_REVERSE_ENABLED_WORD   HCRC_IN_REVERSE_MASK

◆ HCRC_IN_REVERSE_DISABLED

#define HCRC_IN_REVERSE_DISABLED   (0x0)

Variable Documentation

◆ crc