Atmel Software Framework

classb_crc_hw.h File Reference

Definitions and settings for the CRC hardware module driver.

Application note:
AVR1610: Guide to IEC60730 Class B compliance with XMEGA

Copyright (C) 2011-2015 Atmel Corporation. All rights reserved.

#include <asf.h>
#include "classb_crc.h"

Macros

NVM Commands

NVM commands for 32-bit CRC of flash memory.

These are only used by CLASSB_CRC32_Flash_HW.

#define CRC_FLASH_RANGE   NVM_CMD_FLASH_RANGE_CRC_gc
 Compute a CRC checksum on an address range. More...
 
#define CRC_BOOT   NVM_CMD_BOOT_CRC_gc
 Compute a CRC checksum on the application section. More...
 
#define CRC_APP   NVM_CMD_APP_CRC_gc
 Compute a CRC checksum on the boot section. More...
 

Enumerations

enum  crc_16_32_t {
  CRC_16BIT,
  CRC_32BIT,
  CRC_16BIT,
  CRC_32BIT
}
 Enum for indicating whether to use 16- or 32-bits CRC. More...
 

Functions

CRC tests

Invariant memory tests based on CRC that are compliant with IEC60730 Class B.

uint16_t CLASSB_CRC16_EEPROM_HW (eepromptr_t dataptr, const crcbytenum_t numBytes, eeprom_uint16ptr_t pchecksum)
 Compute 16-bit CRC for EEPROM address range using hardware CRC module. More...
 
uint16_t CLASSB_CRC16_Flash_HW (flashptr_t dataptr, const crcbytenum_t numBytes, eeprom_uint16ptr_t pchecksum)
 Compute 16-bit CRC for Flash address range using hardware CRC module. More...
 
uint32_t CLASSB_CRC32_EEPROM_HW (eepromptr_t dataptr, const crcbytenum_t numBytes, eeprom_uint32ptr_t pchecksum)
 Compute 32-bit CRC for EEPROM address range using hardware CRC module. More...
 
uint32_t CLASSB_CRC32_Flash_HW (NVM_CMD_t crc_type, flashptr_t dataptr, const crcbytenum_t numBytes, eeprom_uint32ptr_t pchecksum)
 Compute 32-bit CRC for Flash address range using hardware CRC module. More...
 
Internal functions

These are functions from the CRC module driver.

void crc_set_initial_value (uint32_t value)
 Set initial CRC value for next CRC calculation. More...
 
void crc32_append_value (uint32_t value, void *ptr)
 Get and append data to generate checksum zero with CRC32. More...
 
void crc16_append_value (uint16_t value, void *ptr)
 Appends a CRC value to the given pointer. More...
 
uint32_t crc_flash_checksum (NVM_CMD_t crc_type, flash_addr_t flash_addr, uint32_t len)
 Perform a CRC-32 calculation on part of or entire flash. More...
 
uint32_t crc_io_checksum (void *data, uint16_t len, enum crc_16_32_t crc_16_32)
 Calculate the CRC checksum for data in a buffer. More...
 
void crc_io_checksum_byte_start (enum crc_16_32_t crc_16_32)
 Reset CRC module and set source to I/O interface. More...
 
void crc_io_checksum_byte_add (uint8_t data)
 Add one byte of data to CRC performed on I/O interface. More...
 
uint32_t crc_io_checksum_byte_stop (void)
 Disable CRC module and return checksum. More...
 
void nvm_issue_flash_range_crc (flash_addr_t start_addr, flash_addr_t end_addr)
 Issue flash range CRC command. More...