Microchip® Advanced Software Framework

pcrc.c File Reference

PLC PRIME CRC calculation service.

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

#include "asf.h"
#include "string.h"

Macros

#define SNA_SIZE   6
 

Functions

static uint16_t _eval_crc_16 (const uint8_t *puc_buf_ptr, uint32_t ul_len, uint32_t ul_crc_init)
 This function calculates the CRC16 of the input data. More...
 
static uint32_t _eval_crc_32 (const uint8_t *puc_buf_ptr, uint32_t ul_len, uint32_t ul_crc_init)
 This function calculates the CRC32 of the input data. More...
 
static uint8_t _eval_crc_8 (const uint8_t *puc_buf_ptr, uint32_t ul_len, uint32_t ul_crc_init)
 This function calculates the CRC8 of the input data. More...
 
static uint8_t _eval_crc_8_usi (const uint8_t *puc_buf_ptr, uint32_t ul_len, uint32_t ul_crc_init)
 This function calculates the CRC8 of the input data for USI. More...
 
uint32_t pcrc_calculate_prime_crc (uint8_t *puc_buf, uint32_t ul_len, uint8_t uc_header_type, uint8_t uc_crc_type)
 Calculates the CRC of the input buffer according to the PRIME spec. More...
 
void pcrc_configure_sna (uint8_t *puc_sna)
 Through this function, the SNA is configured for the PCRC service. More...
 

Variables

static const uint8_t puc_crc8_table [256]
 
static uint8_t puc_SNA [SNA_SIZE] = {0, 0, 0, 0, 0, 0}
 
static const uint32_t pul_crc32_table [256]
 
static const uint16_t pus_crc16_table [256]
 
static uint8_t uc_SNA_crc_8 = 0
 
static uint32_t ul_SNA_crc_32 = 0