Microchip® Advanced Software Framework

crc.h File Reference

Cyclic Redundancy Check module driver.

Copyright (c) 2011-2018 Microchip Technology Inc. and its subsidiaries.

#include <compiler.h>
#include <stdint.h>
#include <stdbool.h>
#include <nvm.h>

Macros

#define CRC_APP   NVM_CMD_APP_CRC_gc
 Perform a CRC calculation on the boot loader section. More...
 
#define CRC_BOOT   NVM_CMD_BOOT_CRC_gc
 Perform a CRC calculation on the application section. More...
 
#define CRC_FLASH_RANGE   NVM_CMD_FLASH_RANGE_CRC_gc
 Perform a CRC calculation on an address range in flash. More...
 
#define DMA_SUPPORTED
 Flag to indicate whether DMA is supported. More...
 

Enumerations

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

Functions

void crc16_append_value (uint16_t value, void *ptr)
 Appends a CRC value to the given pointer. More...
 
void crc32_append_value (uint32_t value, void *ptr)
 Get and append data to generate checksum zero with CRC32. More...
 
void crc_dma_checksum_start (uint8_t dma_channel, enum crc_16_32_t crc_16_32)
 Start CRC calculations on data passing through a DMA channel. More...
 
uint32_t crc_dma_checksum_stop (void)
 Disable CRC module and return checksum after DMA transfer. 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_add (uint8_t data)
 Add one byte of data to CRC performed on I/O interface. 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...
 
uint32_t crc_io_checksum_byte_stop (void)
 Disable CRC module and return checksum. More...
 
void crc_set_initial_value (uint32_t value)
 Set initial CRC value for next CRC calculation. More...