Microchip® Advanced Software Framework

crccu_example_flashcalw.c File Reference

Cyclic Redundancy Check Calculation Unit (CRCCU) example for SAM.

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

#include <asf.h>
#include <string.h>
#include "conf_crccu_example.h"

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
Value:
"-- CRCCU Example --\r\n" \
"-- "BOARD_NAME" --\r\n" \
"-- Compiled: "__DATE__" "__TIME__" --"STRING_EOL
#define BOARD_NAME
Name string macro.
Definition: sam4l8_xplained_pro.h:86
#define STRING_EOL
Definition: crccu_example_flashcalw.c:106

Referenced by main().

static uint32_t compute_crc ( uint8_t *  p_buffer,
uint32_t  ul_length,
uint32_t  ul_polynomial_type 
)
static

Compute CRC of a buffer.

Parameters
p_bufferThe buffer holding the data.
ul_lengthThe buffer length.
ul_polynomial_typeThe polynomial type(CRCCU_MR_PTYPE_XXX).
Returns
CRC of the buffer.

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 uint32_t compute_crc_and_compare ( uint8_t *  p_buffer,
uint32_t  ul_length,
uint32_t  ul_type,
uint32_t  ul_ref_crc 
)
static

Compute CRC of a buffer and compare it with the reference CRC.

Parameters
p_BufferThe buffer holding the data.
ul_lengthThe buffer length.
ul_typeThe polynomial type(CRCCU_MR_PTYPE_XXX).
ul_ref_crcReference CRC for the buffer.
Returns
CRC of the buffer.

References compute_crc().

Referenced by main().

static void configure_console ( void  )
static
int main ( void  )

CRC descriptor.

uint8_t g_uc_data_buf[BUFFER_LENGTH]

CRC data buffer.

Referenced by main().