1.6.6.15 DMAC_CRCRead Function

C

uint32_t DMAC_CRCRead( void )

Summary

DMA CRC read function

Description

Reads the generated DMA CRC value.

For some devices, It performs crc reverse and final xor operation based on setup parameters during DMAC_ChannelCRCSetup()

For some devices, when CRC-32 polynomial is used via CRCSetup, the final checksum read is bit reversed and complemented

Parameters

None

Returns

crc - Generated crc value

Example

Example of this function varies based on device family. Refer to the one which is applicable for the device being used.

DMAC_CRC_SETUP crcSetup = {0};
    transfer_completed = false;
    uint32_t crc = 0;
    
    crcSetup.reverse_data_input = true;
    crcSetup.polynomial_length = 32;
    crcSetup.polynomial = 0x04C11DB7;
    crcSetup.non_direct_seed = 0x46AF6449;
    crcSetup.reverse_crc_output = true;
    crcSetup.final_xor_value = 0xFFFFFFFF;
    
    DMAC_ChannelCRCSetup(DMAC_CHANNEL_0, crcSetup);
    
    DMAC_ChannelTransfer(...);
    
    if (transfer_completed == true)
    {
        crc = DMAC_CRCRead();
    }
    
DMAC_CRC_SETUP crcSetup = {0};
    transfer_completed = false;
    uint32_t crc = 0;
    
    crcSetup.polynomial_type = DMAC_CRC_TYPE_32;
    crcSetup.seed = 0xFFFFFFFF;
    
    DMAC_ChannelCRCSetup(DMAC_CHANNEL_0, crcSetup);
    
    DMAC_ChannelTransfer(...);
    
    if (transfer_completed == true)
    {
        crc = DMAC_CRCRead();
    }
    

Remarks

Once Read is done, DMAC_ChannelCRCSetup() has to be called again to setup the seed before performing DMA transfer for CRC generation.