Cyclic Redundancy Check Calculation Unit (CRCCU) example for SAM.
Copyright (c) 2012-2018 Microchip Technology Inc. and its subsidiaries.
Macros | |
#define | BUFFER_LENGTH 64 |
CRC data buffer size (in byte) More... | |
#define | CRCCU_TIMEOUT 0xFFFFFFFF |
CRCCU operation time out value. More... | |
#define | FLASH_BUFFER_ADDRESS (FLASH_ADDR + FLASH_SIZE / 2 - FLASH_BUFFER_SIZE) |
Flash buffer address. More... | |
#define | STRING_EOL "\r" |
#define | STRING_HEADER |
Functions | |
static uint32_t | compute_crc (uint8_t *p_buffer, uint32_t ul_length, uint32_t ul_polynomial_type) |
Compute CRC of a buffer. More... | |
static uint32_t | compute_crc_and_compare (uint8_t *p_buffer, uint32_t ul_length, uint32_t ul_type, uint32_t ul_ref_crc) |
Compute CRC of a buffer and compare it with the reference CRC. More... | |
static void | configure_console (void) |
Configure serial console. More... | |
int | main (void) |
Application entry point for CRCCU example. More... | |
Variables | |
crccu_dscr_type_t | crc_dscr |
CRC descriptor. More... | |
uint8_t | g_uc_data_buf [BUFFER_LENGTH] |
CRC data buffer. More... | |
#define BUFFER_LENGTH 64 |
CRC data buffer size (in byte)
Referenced by main().
#define CRCCU_TIMEOUT 0xFFFFFFFF |
CRCCU operation time out value.
Referenced by compute_crc().
#define FLASH_BUFFER_ADDRESS (FLASH_ADDR + FLASH_SIZE / 2 - FLASH_BUFFER_SIZE) |
Flash buffer address.
Referenced by main().
#define STRING_EOL "\r" |
#define STRING_HEADER |
Referenced by main().
|
static |
Compute CRC of a buffer.
p_buffer | The buffer holding the data. |
ul_length | The buffer length. |
ul_polynomial_type | The polynomial type(CRCCU_MR_PTYPE_XXX). |
References crccu_configure_descriptor(), crccu_configure_mode(), crccu_enable_dma(), crccu_get_dma_status(), crccu_read_crc_value(), crccu_reset(), CRCCU_TIMEOUT, CRCCU_TR_CTRL_IEN_ENABLE, CRCCU_TR_CTRL_TRWIDTH_BYTE, crccu_dscr_type::ul_tr_addr, and crccu_dscr_type::ul_tr_ctrl.
Referenced by compute_crc_and_compare(), and main().
|
static |
Compute CRC of a buffer and compare it with the reference CRC.
p_Buffer | The buffer holding the data. |
ul_length | The buffer length. |
ul_type | The polynomial type(CRCCU_MR_PTYPE_XXX). |
ul_ref_crc | Reference CRC for the buffer. |
References compute_crc().
Referenced by main().
|
static |
Configure serial console.
References uart_rs232_options::baudrate, CONF_UART, CONF_UART_BAUDRATE, CONF_UART_CHAR_LENGTH, CONF_UART_PARITY, CONF_UART_STOP_BITS, and stdio_serial_init().
Referenced by main().
int main | ( | void | ) |
Application entry point for CRCCU example.
References board_init(), BUFFER_LENGTH, compute_crc(), compute_crc_and_compare(), configure_console(), FLASH_BUFFER_ADDRESS, flashcalw_memcpy(), g_uc_data_buf, STRING_HEADER, sysclk_enable_peripheral_clock(), and sysclk_init().
crccu_dscr_type_t crc_dscr |
CRC descriptor.
uint8_t g_uc_data_buf[BUFFER_LENGTH] |
CRC data buffer.
Referenced by main().