Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
SAM 32-bit cyclic redundancy check (CRC32) Driver

This driver for Atmel® | SMART ARM®-based microcontrollers provides an interface for the configuration and management of the device's CRC32 (via DSU) functionality.

The following driver API modes are covered by this manual:

The following peripheral is used by this module:

The following devices can use this module:

The outline of this documentation is as follows:

Prerequisites

There are no prerequisites for this module.

Module Overview

A cyclic redundancy check (CRC) is an error detection technique used to find accidental errors in data. It is commonly used to determine whether the data during a transmission, or data present in data and programme memories has been corrupted or not. A CRC takes a data stream or a block of data as input and generates a 16- or 32-bit output that can be appended to the data and used as a checksum. When the same data are later received or read, the device or application repeats the calculation. If the new CRC result does not match the one calculated earlier, the block contains a data error. The application will then detect this and may take a corrective action, such as requesting the data to be sent again or simply not using the incorrect data.

The DSU unit provides support for calculating a 32-bit cyclic redundancy check (CRC32) value for a memory area (including flash and AHB RAM).

Special Considerations

There are no special considerations for this module.

API Overview

Modules

 _quickstart Quick Start Guide(s)
 In this section you can find a list of all Quick Start guides related to the SAM 32-bit cyclic redundancy check (CRC32) Driver.
 

Functions

enum status_code dsu_crc32_cal (const uint32_t addr, const uint32_t len, uint32_t *pcrc32)
 Calculate CRC32 value of the input memory. More...
 
static void dsu_crc32_init (void)
 CRC initialization function. More...
 

enum status_code dsu_crc32_cal ( const uint32_t  addr,
const uint32_t  len,
uint32_t *  pcrc32 
)

Calculate CRC32 value of the input memory.

Calculate CRC32 value of the input memory.

The read value must be complemented to match standard CRC32 implementations or kept non-inverted if used as starting point for subsequent CRC32 calculations.

Parameters
[in]addrMemory address to calculate CRC32
[in]lenMemory length to calculate CRC32
[in,out]pcrc32Initial value used for the CRC32 calculation, and CRC32 result after calculation
Returns
Status of the configuration procedure.
Return values
STATUS_OKIf CRC32 calculation OK
STATUS_ERR_BAD_ADDRESSThe address was not aligned with 4 bytes.
STATUS_ERR_IOA bus error is detected

References STATUS_ERR_BAD_ADDRESS, STATUS_ERR_IO, STATUS_OK, system_interrupt_disable_global(), system_interrupt_enable_global(), SYSTEM_PERIPHERAL_ID, system_peripheral_lock(), and system_peripheral_unlock().

static void dsu_crc32_init ( void  )
inlinestatic

CRC initialization function.

Enables CRC peripheral, clocks and initializes CRC driver.

References system_apb_clock_set_mask(), and SYSTEM_CLOCK_APB_APBB.