Cyclic Redundancy Check module driver.
Copyright (c) 2011-2018 Microchip Technology Inc. and its subsidiaries.
Functions | |
void | crc16_append_value (uint16_t value, void *ptr) |
Appends a CRC value to the given pointer. More... | |
static uint16_t | crc16_checksum_read (void) |
Read CRC-16 checksum. More... | |
void | crc32_append_value (uint32_t value, void *ptr) |
Get and append data to generate checksum zero with CRC32. More... | |
static uint32_t | crc32_checksum_read (void) |
Read CRC-32 checksum. More... | |
static void | crc_32_enable (void) |
Enable CRC-32. More... | |
static uint32_t | crc_bit_revert (uint32_t value) |
Bit reverse the given value. More... | |
static uint32_t | crc_checksum_complete (void) |
Complete CRC calculation by reading checksum and disabling module. More... | |
static uint32_t | crc_checksum_read (void) |
Read checksum. More... | |
static void | crc_disable (void) |
Disable the CRC module. 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 length) |
Perform a CRC-32 calculation on the entire flash memory, on only the application section, on only the boot section, or on a selectable range of the flash memory. 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... | |
static bool | crc_is_busy (void) |
Check if the CRC module is busy. More... | |
static void | crc_reset (void) |
Reset CRC module and set CHECKSUM to initial value. More... | |
void | crc_set_initial_value (uint32_t value) |
Set initial CRC value for next CRC calculation. More... | |
static void | crc_set_source (CRC_SOURCE_t source) |
Set data source for the CRC module after reset. More... | |
Variables | |
uint32_t | crc_initial_value = 0 |
Initial CRC value to use on next CRC calculation. More... | |
|
inlinestatic |
Read CRC-16 checksum.
This function returns the computed CRC-16 checksum.
Referenced by crc_checksum_read().
|
inlinestatic |
Read CRC-32 checksum.
This function extracts the CRC-32 checksum from the registers.
References crc_bit_revert().
Referenced by crc_checksum_read().
|
inlinestatic |
Enable CRC-32.
This function will set the CRC-32 polynomial to be used to generate the checksum.
Referenced by crc_flash_checksum(), and crc_io_checksum_byte_start().
|
inlinestatic |
Bit reverse the given value.
value | the value to bit revert |
Referenced by crc32_append_value(), and crc32_checksum_read().
|
inlinestatic |
Complete CRC calculation by reading checksum and disabling module.
References crc_checksum_read(), and crc_disable().
Referenced by crc_dma_checksum_stop(), crc_flash_checksum(), and crc_io_checksum_byte_stop().
|
inlinestatic |
Read checksum.
This function waits until the CRC conversion is complete and returns either the 32 bit or 16 bit checksum as a 32 bit value.
References crc16_checksum_read(), crc32_checksum_read(), and crc_is_busy().
Referenced by crc_checksum_complete().
|
inlinestatic |
uint32_t crc_dma_checksum_stop | ( | void | ) |
Disable CRC module and return checksum after DMA transfer.
References crc_checksum_complete().
Referenced by example_crc_dma_transfer_done().
|
inlinestatic |
Check if the CRC module is busy.
This function can be used to see if a CRC checksum generation is completed.
true | if module is busy |
false | if module is not busy |
Referenced by crc_checksum_read().
|
inlinestatic |
Reset CRC module and set CHECKSUM to initial value.
The CRC registers will be reset one peripheral clock cycle after the RESET[1] bit is set. The initial value is reset to 0 after loading it into the CHECKSUM registers.
References crc_initial_value.
Referenced by crc_flash_checksum(), and crc_io_checksum_byte_start().
|
inlinestatic |
Set data source for the CRC module after reset.
The selected source is locked until either the CRC generation is completed or the CRC module is reset. CRC generation complete is generated and signalled from the selected source when used with the DMA controller or flash memory. To disable the CRC module, use CRC_SOURCE_DISABLE_gc as source.
source | the data source for the CRC module |
References source.
Referenced by crc_disable(), crc_flash_checksum(), and crc_io_checksum_byte_start().
uint32_t crc_initial_value = 0 |
Initial CRC value to use on next CRC calculation.
Referenced by crc_reset(), and crc_set_initial_value().