GCRC Module

The Generic CRC (GCRC) API provides a set of functions for configuring the GCRC cmodule. Functions are provided for configuring the CRC parameters and for providing tha data for which CRC needs to be calculated.

group gcrc_api

This module is used for CRC calculations using GCRC.

Defines

GCRC_ENDIANNESS_LITTLE 0x00000000U

Little Endian.

GCRC_ENDIANNESS_BIG 0x00000040U

Big Endian.

GCRC_DATATYPE_8BIT 0x00000000U

Byte data type.

GCRC_DATATYPE_16BIT 0x00000100U

16-bit data type

GCRC_DATATYPE_32BIT 0x00000200U

32 bit data type

GCRC_FIXEDPATH_POLY 0x04c11db7U

32 bit polynomial

GCRC_FIXEDPATH_POLYSIZE 0x00000020U

32 bit polynomial

GCRC_FIXEDPATH_ENDIANNESS GCRC_ENDIANNESS_LITTLE

Little Endian.

GCRC_FIXEDPATH_BITREVERSE 0U

No bit reversal.

GCRC_FIXEDPATH_DATATYPE GCRC_DATATYPE_32BIT

32 bit datatype

GCRC_FIXEDPATH_DATAMASK 0U

No masking.

GCRC_POLYSIZE_MAXVALUE 0x20U

field in CRCCTRL register

Max value possible for POLYSIZE

Functions

void GCRC_setPolynomial(uint32_t base, uint32_t poly, uint32_t polySize)

Sets the generator polynomial.

This function sets the generator polynomial for computing CRC.

Parameters
  • base: is the base address of the GCRC instance used

  • poly: is the generator polynomial

  • polySize: is the order of the polynomial (1 - 32)

Return

None.

void GCRC_setDataEndianness(uint32_t base, uint32_t endianness)

Sets the endianness of the data.

This function sets the endianness of the data.

Parameters
  • base: is the base address of the GCRC instance used

  • endianness: is the data endianness. Use macros GCRC_ENDIANNESS_LITTLE or GCRC_ENDIANNESS_BIG

Return

None.

void GCRC_setDataType(uint32_t base, uint32_t dataType)

Sets the datatype of the data.

This function set the data type of the element of the data array, on which CRC is to be computed..

Parameters
  • base: is the base address of the GCRC instance used

  • dataType: is the data type of the input data. Use macros GCRC_DATATYPE_8BIT, GCRC_DATATYPE_16BIT, GCRC_DATATYPE_32BIT

Return

None.

void GCRC_enableBitReverse(uint32_t base, bool enable)

Enable/Disable bit reverse feature.

This function enables/disables the bit reverse of the input data

Parameters
  • base: is the base address of the GCRC instance used

  • enable: : TRUE if bit reverse needs to be enabled. : FALSE if bit reverse needs to be disabled

Return

None.

void GCRC_setDataMask(uint32_t base, uint32_t dataMask)

Sets the data mask for the input data.

This function set the data mask for the input data. For example, dataMask equals 0x3, 3 most significant bits of data will be masked.

Parameters
  • base: is the base address of the GCRC instance used

  • dataMask: is the number of bits to be masked.

Return

None.

void GCRC_setSeedValue(uint32_t base, uint32_t value)

Sets the seed value.

This function sets the seed value for CRC computation.

Parameters
  • base: is the base address of the GCRC instance used

  • value: is the seed value that needs to be set.

Return

None.

uint32_t GCRC_readResult(uint32_t base)

Reads the computed CRC value.

This function read the computed CRC value.

Parameters
  • base: is the base address of the GCRC instance used

Note

Reads from CRCDATAOUT register will be stalled if CRC engine is busy computing CRC

Return

None.

uint32_t GCRC_getTransData(uint32_t base)

Reads the transformed data

This function returns the data value as seen by the core CRC engine after endianess, bit reversal and masking transformation

Parameters
  • base: is the base address of the GCRC instance used

Return

None.

void GCRC_setFixedPolynomialDataPath(uint32_t base)

Sets the fixed polynomial data path.

This function sets the fixed polynomial data path which computes the CRC in a single cycle.

Parameters
  • base: is the base address of the GCRC instance used

Note

Only 32-bit writes. Byte and halfword accesses would take the generic CRC data path.

Return

None.

void GCRC_writeData(uint32_t base, uint32_t data, uint32_t dataSize)

Writes the input data.

This function writes the input data for the CRC computation.

Parameters
  • base: is the base address of the GCRC instance used

  • data: is value that needs to be written.

  • dataSize: is the size of the data. Use macros GCRC_DATATYPE_8BIT, GCRC_DATATYPE_16BIT, GCRC_DATATYPE_32BIT

Note

Writes to CRCDATAIN register will be stalled if CRC engine is busy computing CRC

Return

None.

The code for this module is contained in driverlib_cm/gcrc.c, with driverlib_cm/gcrc.h containing the API declarations for use by applications.