MSP432E4 DriverLib API Guide  1.11.00.03
Functions
Crc_api

Functions

void CRCConfigSet (uint32_t ui32Base, uint32_t ui32CRCConfig)
 
void CRCSeedSet (uint32_t ui32Base, uint32_t ui32Seed)
 
void CRCDataWrite (uint32_t ui32Base, uint32_t ui32Data)
 
uint32_t CRCResultRead (uint32_t ui32Base, bool bPPResult)
 
uint32_t CRCDataProcess (uint32_t ui32Base, uint32_t *pui32DataIn, uint32_t ui32DataLength, bool bPPResult)
 

Detailed Description

Introduction

The CRC module driver provides a method for generating CRC checksums of various types. The configuration and feature highlights are:

API Functions

The CRC API consists of functions for configuring the CRC module, processing data, and reading the resultant checksum.

Programming Example

The following example sets up the CRC for basic CRC32 operation with a starting seed of zero.

uint32_t g_ui32Result;
//
// Random data for generating CRC.
//
uint32_t g_ui32RandomData[16] =
{
0x8a5f1b22, 0xcb935d29, 0xcc1ac092, 0x5dad8c9e,
0x6a83b39f, 0x8607dc60, 0xda0ba4d2, 0xf49b0fa2,
0xaf35d524, 0xffa8001d, 0xbcc931e8, 0x4a2c99ef,
0x7fa297ab, 0xab943bae, 0x07c61cc4, 0x47c8627d
};
int
main(void)
{
//
// Enable the CRC module.
//
//
// Wait for the CRC module to be ready.
//
{
}
//
// Configure the CRC module.
//
CRCConfigSet(EC_BASE,
//
// Set the seed value.
//
CRCSeedSet(EC_BASE, 0x5a5a5a5a);
//
// Process the data and get the result. The result should be
// 0x75fd6f5c.
//
g_ui32Result = CRCDataProcess(EC_BASE, g_ui32RandomData, 16, false);
}

Function Documentation

§ CRCConfigSet()

void CRCConfigSet ( uint32_t  ui32Base,
uint32_t  ui32CRCConfig 
)

Set the configuration of CRC functionality with the EC module.

Parameters
ui32Baseis the base address of the EC module.
ui32CRCConfigis the configuration of the CRC engine.

This function configures the operation of the CRC engine within the EC module. The configuration is specified with the ui32CRCConfig argument. It is the logical OR of any of the following options:

CRC Initialization Value

  • CRC_CFG_INIT_SEED - Initialize with seed value
  • CRC_CFG_INIT_0 - Initialize to all '0s'
  • CRC_CFG_INIT_1 - Initialize to all '1s'

Input Data Size

  • CRC_CFG_SIZE_8BIT - Input data size of 8 bits
  • CRC_CFG_SIZE_32BIT - Input data size of 32 bits

Post Process Reverse/Inverse

  • CRC_CFG_RESINV - Result inverse enable
  • CRC_CFG_OBR - Output reverse enable

Input Bit Reverse

  • CRC_CFG_IBR - Bit reverse enable

Endian Control

  • CRC_CFG_ENDIAN_SBHW - Swap byte in half-word
  • CRC_CFG_ENDIAN_SHW - Swap half-word

Operation Type

  • CRC_CFG_TYPE_P8005 - Polynomial 0x8005
  • CRC_CFG_TYPE_P1021 - Polynomial 0x1021
  • CRC_CFG_TYPE_P4C11DB7 - Polynomial 0x4C11DB7
  • CRC_CFG_TYPE_P1EDC6F41 - Polynomial 0x1EDC6F41
  • CRC_CFG_TYPE_TCPCHKSUM - TCP checksum
Returns
None.

References ASSERT, CCM_O_CRCCTRL, CRC_CFG_ENDIAN_SBHW, CRC_CFG_ENDIAN_SHW, CRC_CFG_IBR, CRC_CFG_INIT_0, CRC_CFG_INIT_1, CRC_CFG_INIT_SEED, CRC_CFG_OBR, CRC_CFG_RESINV, CRC_CFG_SIZE_32BIT, CRC_CFG_SIZE_8BIT, CRC_CFG_TYPE_P1021, CRC_CFG_TYPE_P1EDC6F41, CRC_CFG_TYPE_P4C11DB7, CRC_CFG_TYPE_P8005, CRC_CFG_TYPE_TCPCHKSUM, and HWREG.

§ CRCSeedSet()

void CRCSeedSet ( uint32_t  ui32Base,
uint32_t  ui32Seed 
)

Write the seed value for CRC operations in the EC module.

Parameters
ui32Baseis the base address of the EC module.
ui32Seedis the seed value.

This function writes the seed value for use with CRC operations in the EC module. This value is the start value for CRC operations. If this value is not written, then the residual seed from the previous operation is used as the starting value.

Note
The seed must be written only if CRC_CFG_INIT_SEED is set with the CRCConfigSet() function.

References ASSERT, CCM_O_CRCSEED, and HWREG.

§ CRCDataWrite()

void CRCDataWrite ( uint32_t  ui32Base,
uint32_t  ui32Data 
)

Write data into the EC module for CRC operations.

Parameters
ui32Baseis the base address of the EC module.
ui32Datais the data to be written.

This function writes either 8 or 32 bits of data into the EC module for CRC operations. The distinction between 8 and 32 bits of data is made when the CRC_CFG_SIZE_8BIT or CRC_CFG_SIZE_32BIT flag is set using the CRCConfigSet() function.

When writing 8 bits of data, ensure the data is in the least significant byte position. The remaining bytes should be written with zero. For example, when writing 0xAB, ui32Data should be 0x000000AB.

Returns
None

References ASSERT, CCM_O_CRCDIN, and HWREG.

§ CRCResultRead()

uint32_t CRCResultRead ( uint32_t  ui32Base,
bool  bPPResult 
)

Reads the result of a CRC operation in the EC module.

Parameters
ui32Baseis the base address of the EC module.
bPPResultis true to read the post-processed result, or false to read the unmodified result.

This function reads either the unmodified CRC result or the post processed CRC result from the EC module. The post-processing options are selectable through CRC_CFG_RESINV and CRC_CFG_OBR parameters in the CRCConfigSet() function.

Returns
The CRC result.

References ASSERT, CCM_O_CRCRSLTPP, CCM_O_CRCSEED, and HWREG.

Referenced by CRCDataProcess().

§ CRCDataProcess()

uint32_t CRCDataProcess ( uint32_t  ui32Base,
uint32_t *  pui32DataIn,
uint32_t  ui32DataLength,
bool  bPPResult 
)

Process data to generate a CRC with the EC module.

Parameters
ui32Baseis the base address of the EC module.
pui32DataInis a pointer to an array of data that is processed.
ui32DataLengthis the number of data items that are processed to produce the CRC.
bPPResultis true to read the post-processed result, or false to read the unmodified result.

This function processes an array of data to produce a CRC result.

The data in the array pointed to be pui32DataIn is either an array of bytes or an array or words depending on the selection of the input data size options CRC_CFG_SIZE_8BIT and CRC_CFG_SIZE_32BIT.

This function returns either the unmodified CRC result or the post- processed CRC result from the EC module. The post-processing options are selectable through CRC_CFG_RESINV and CRC_CFG_OBR parameters.

Returns
The CRC result.

References ASSERT, CCM_CRCCTRL_SIZE, CCM_O_CRCCTRL, CCM_O_CRCDIN, CRCResultRead(), and HWREG.

© Copyright 1995-2019, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale