Macros | Functions
CRC32

Module to interact with the Cyclic Redundancy Check 32 (CRC32) hardware accelerator with support for CRC16 signatures. More...

Macros

#define CRC16_MODE   0x00
 
#define CRC32_MODE   0x01
 
#define CRC32_setSeedMultipleInstance(a, b, c)   CRC32_setSeed(b,c)
 
#define CRC32_set8BitDataMultipleInstance(a, b, c)   CRC32_set8BitData(b,c)
 
#define CRC32_set16BitDataMultipleInstance(a, b, c)   CRC32_set16BitData(b,c)
 
#define CRC32_set32BitDataMultipleInstance(a, b)   CRC32_set32BitData(b)
 
#define CRC32_set8BitDataReversedMultipleInstance(a, b, c)   CRC32_set8BitDataReversed(b,c)
 
#define CRC32_set16BitDataReversedMultipleInstance(a, b, c)   CRC32_set16BitDataReversed(b,c)
 
#define CRC32_set32BitDataReversedMultipleInstance(a, b)   CRC32_set32BitDataReversed(b)
 
#define CRC32_getResultMultipleInstance(a, b)   CRC32_getResult()
 
#define CRC32_getResultReversedMultipleInstance(a, b)   CRC32_getResultReversed(b)
 

Functions

void CRC32_setSeed (uint32_t seed, uint_fast8_t crcType)
 
void CRC32_set8BitData (uint8_t dataIn, uint_fast8_t crcType)
 
void CRC32_set16BitData (uint16_t dataIn, uint_fast8_t crcType)
 
void CRC32_set32BitData (uint32_t dataIn)
 
void CRC32_set8BitDataReversed (uint8_t dataIn, uint_fast8_t crcType)
 
void CRC32_set16BitDataReversed (uint16_t dataIn, uint_fast8_t crcType)
 
void CRC32_set32BitDataReversed (uint32_t dataIn)
 
uint32_t CRC32_getResult (uint_fast8_t crcType)
 
uint32_t CRC32_getResultReversed (uint_fast8_t crcType)
 

Detailed Description

Module to interact with the Cyclic Redundancy Check 32 (CRC32) hardware accelerator with support for CRC16 signatures.


Module Operation


The Cyclic Redundancy Check 32 (CRC32) API provides a set of functions for using the SDK CRC32 module. Functions are provided to initialize the CRC and create a CRC signature to check the validity of data. This is mostly useful in the communication of data, or as a startup procedure to as a more complex and accurate check of data.

The CRC32 module offers no interrupts and is used only to generate CRC signatures to verify against pre-made CRC signatures (Checksums).

The CRC32 module provides the capability for both 32-bit and 16-bit calculations. As such, the DriverLib API provides functionality for the user to provide variable bit-length data for either 16-bit or 32-bit calculations.


Programming Example


The DriverLib package contains a variety of different code examples that demonstrate the usage of the CRC32 module. These code examples are accessible under the examples/ folder of the SDK release as well as through TI Resource Explorer if using Code Composer Studio. These code examples provide a comprehensive list of use cases as well as practical applications involving each module.

In the following very simple code example, an array of data is fed into the CRC32 module and the 32-bit calculation is retrieved:

Macro Definition Documentation

#define CRC16_MODE   0x00
#define CRC32_MODE   0x01
#define CRC32_setSeedMultipleInstance (   a,
  b,
 
)    CRC32_setSeed(b,c)
#define CRC32_set8BitDataMultipleInstance (   a,
  b,
 
)    CRC32_set8BitData(b,c)
#define CRC32_set16BitDataMultipleInstance (   a,
  b,
 
)    CRC32_set16BitData(b,c)
#define CRC32_set32BitDataMultipleInstance (   a,
 
)    CRC32_set32BitData(b)
#define CRC32_set8BitDataReversedMultipleInstance (   a,
  b,
 
)    CRC32_set8BitDataReversed(b,c)
#define CRC32_set16BitDataReversedMultipleInstance (   a,
  b,
 
)    CRC32_set16BitDataReversed(b,c)
#define CRC32_set32BitDataReversedMultipleInstance (   a,
 
)    CRC32_set32BitDataReversed(b)
#define CRC32_getResultMultipleInstance (   a,
 
)    CRC32_getResult()
#define CRC32_getResultReversedMultipleInstance (   a,
 
)    CRC32_getResultReversed(b)

Function Documentation

void CRC32_setSeed ( uint32_t  seed,
uint_fast8_t  crcType 
)

Sets the seed for the CRC.

Parameters
seedis the seed for the CRC to start generating a signature from. Modified bits are CRC16INIRESL0 of CRC16INIRESL0 register. CRC32INIRESL0 of CRC32INIRESL0 register
crcTypeselects between CRC32 and CRC16 Valid values are CRC16_MODE and CRC32_MODE

This function sets the seed for the CRC to begin generating a signature with the given seed and all passed data. Using this function resets the CRC32 signature.

Returns
NONE

References ASSERT, CRC16_MODE, and CRC32_MODE.

void CRC32_set8BitData ( uint8_t  dataIn,
uint_fast8_t  crcType 
)

Sets the 8 Bit data to add into the CRC module to generate a new signature.

Parameters
dataInis the data to be added, through the CRC module, to the signature. Modified bits are CRC16DIB0 of CRC16DIB0 register. CRC32DIB0 of CRC32DIB0 register.
crcTypeselects between CRC32 and CRC16 Valid values are CRC16_MODE and CRC32_MODE

This function sets the given data into the CRC module to generate the new signature from the current signature and new data. Bit 0 is treated as LSB.

Returns
NONE

References ASSERT, CRC16_MODE, CRC32_MODE, and HWREG8.

void CRC32_set16BitData ( uint16_t  dataIn,
uint_fast8_t  crcType 
)

Sets the 16 Bit data to add into the CRC module to generate a new signature.

Parameters
dataInis the data to be added, through the CRC module, to the signature. Modified bits are CRC16DIW0 of CRC16DIW0 register. CRC32DIW0 of CRC32DIW0 register.
crcTypeselects between CRC32 and CRC16 Valid values are CRC16_MODE and CRC32_MODE

This function sets the given data into the CRC module to generate the new signature from the current signature and new data. Bit 0 is treated as LSB

Returns
NONE

References ASSERT, CRC16_MODE, and CRC32_MODE.

void CRC32_set32BitData ( uint32_t  dataIn)

Sets the 32 Bit data to add into the CRC module to generate a new signature. Available only for CRC32_MODE and not for CRC16_MODE

Parameters
dataInis the data to be added, through the CRC module, to the signature. Modified bits are CRC32DIL0 of CRC32DIL0 register.

This function sets the given data into the CRC module to generate the new signature from the current signature and new data. Bit 0 is treated as LSB

Returns
NONE

References HWREG16.

void CRC32_set8BitDataReversed ( uint8_t  dataIn,
uint_fast8_t  crcType 
)

Translates the data by reversing the bits in each 8 bit data and then sets this data to add into the CRC module to generate a new signature.

Parameters
dataInis the data to be added, through the CRC module, to the signature. Modified bits are CRC16DIRBB0 of CRC16DIRBB0 register. CRC32DIRBB0 of CRC32DIRBB0 register.
crcTypeselects between CRC32 and CRC16 Valid values are CRC16_MODE and CRC32_MODE

This function first reverses the bits in each byte of the data and then generates the new signature from the current signature and new translated data. Bit 0 is treated as MSB.

Returns
NONE

References ASSERT, CRC16_MODE, CRC32_MODE, and HWREG8.

void CRC32_set16BitDataReversed ( uint16_t  dataIn,
uint_fast8_t  crcType 
)

Translates the data by reversing the bits in each 16 bit data and then sets this data to add into the CRC module to generate a new signature.

Parameters
dataInis the data to be added, through the CRC module, to the signature. Modified bits are CRC16DIRBW0 of CRC16DIRBW0 register. CRC32DIRBW0 of CRC32DIRBW0 register.
crcTypeselects between CRC32 and CRC16 Valid values are CRC16_MODE and CRC32_MODE

This function first reverses the bits in each byte of the data and then generates the new signature from the current signature and new translated data. Bit 0 is treated as MSB.

Returns
NONE

References ASSERT, CRC16_MODE, and CRC32_MODE.

void CRC32_set32BitDataReversed ( uint32_t  dataIn)

Translates the data by reversing the bits in each 32 Bit Data and then sets this data to add into the CRC module to generate a new signature. Available only for CRC32 mode and not for CRC16 mode

Parameters
dataInis the data to be added, through the CRC module, to the signature. Modified bits are CRC32DIRBL0 of CRC32DIRBL0 register.

This function first reverses the bits in each byte of the data and then generates the new signature from the current signature and new translated data. Bit 0 is treated as MSB.

Returns
NONE

References HWREG16.

uint32_t CRC32_getResult ( uint_fast8_t  crcType)

Returns the value of CRC Signature Result.

Parameters
crcTypeselects between CRC32 and CRC16 Valid values are CRC16_MODE and CRC32_MODE

This function returns the value of the signature result generated by the CRC. Bit 0 is treated as LSB.

Returns
uint32_t Result

References ASSERT, CRC16_MODE, and CRC32_MODE.

uint32_t CRC32_getResultReversed ( uint_fast8_t  crcType)

Returns the bit-wise reversed format of the 32 bit Signature Result.

Parameters
crcTypeselects between CRC32 and CRC16 Valid values are CRC16_MODE and CRC32_MODE

This function returns the bit-wise reversed format of the Signature Result. Bit 0 is treated as MSB.

Returns
uint32_t Result

References ASSERT, CRC16_MODE, and CRC32_MODE.


Copyright 2018, Texas Instruments Incorporated