Microchip® Advanced Software Framework

classb_crc.h File Reference

Settings and defines used in connection with CRC memory tests.

Application note:
AVR1610: Guide to IEC60730 Class B compliance with XMEGA

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

#include <asf.h>
#include "error_handler.h"
#include "classb_crc_hw.h"
#include "classb_crc_sw.h"

Macros

#define CLASSB_CRC_16_BIT
 Compile 16-bit CRC functions. More...
 
#define CLASSB_CRC_32_BIT
 Compile 32-bit CRC functions. More...
 
#define CLASSB_CRC_USE_HW
 Compile hardware implementation. More...
 
#define CLASSB_CRC_USE_SW
 Compile software implementation. More...
 
#define CRC16_INITIAL_REMAINDER   (uint16_t)0x0000
 Initial remainder for the 16-bit CRC. More...
 
#define CRC32_INITIAL_REMAINDER   (uint32_t)0xFFFFFFFF
 Initial remainder for the 32-bit CRC. More...
 
EEPROM Mapping defines
#define CLASSB_EEMAP_BEGIN()
 Enable memory mapping of EEPROM, if it is not already enabled. More...
 
#define CLASSB_EEMAP_END()
 Disable memory mapping of EEPROM, unless it was previously enabled. More...
 

Typedefs

typedef uint32_t crcbytenum_t
 Data type to use for byte counts in CRC computations. More...
 
Pointer types for CRC functions

These are needed for IAR and GCC compatibility.

typedef const void * eepromptr_t
 Generic pointer to EEPROM. More...
 
typedef const uint8_t * eeprom_uint8ptr_t
 Pointer to a byte in EEPROM. More...
 
typedef const uint16_t * eeprom_uint16ptr_t
 Pointer to two bytes in EEPROM. More...
 
typedef const uint32_t * eeprom_uint32ptr_t
 Pointer to four bytes in EEPROM. More...
 
typedef flash_addr_t flashptr_t
 Generic pointer to Flash. More...
 
typedef flash_addr_t flash_uint8ptr_t
 Pointer to a byte in Flash. More...
 

#define CLASSB_EEMAP_BEGIN ( )
Value:
bool eemap_is_enabled; \
/* Check if memory mapping of EEPROM is already enabled. */ \
eemap_is_enabled = (NVM.CTRLB & NVM_EEMAPEN_bm) ? true : false; \
if (!eemap_is_enabled) { \
/* Ensure that NVM is ready before enabling memory mapping. */ \
do { \
} while (NVM.STATUS & NVM_NVMBUSY_bm); \
NVM.CTRLB |= NVM_EEMAPEN_bm; \
}
if((SERIAL_RX_BUF_SIZE_NCP-1)==serial_rx_buf_tail)
Definition: sio2ncp.c:249

Enable memory mapping of EEPROM, if it is not already enabled.

Note
Use this in conjunction with CLASSB_EEMAP_END() to ensure that the prior configuration of memory-mapping is preserved.

Referenced by CLASSB_CRC16_EEPROM_HW(), CLASSB_CRC16_EEPROM_SW(), CLASSB_CRC16_Flash_HW(), CLASSB_CRC16_Flash_SW(), CLASSB_CRC32_EEPROM_HW(), CLASSB_CRC32_EEPROM_SW(), CLASSB_CRC32_Flash_HW(), and CLASSB_CRC32_Flash_SW().

#define CLASSB_EEMAP_END ( )
Value:
if (!eemap_is_enabled) { \
NVM.CTRLB &= ~NVM_EEMAPEN_bm; \
}

Disable memory mapping of EEPROM, unless it was previously enabled.

Note
Use this in conjunction with CLASSB_EEMAP_BEGIN().

Referenced by CLASSB_CRC16_EEPROM_HW(), CLASSB_CRC16_EEPROM_SW(), CLASSB_CRC16_Flash_HW(), CLASSB_CRC16_Flash_SW(), CLASSB_CRC32_EEPROM_HW(), CLASSB_CRC32_EEPROM_SW(), CLASSB_CRC32_Flash_HW(), and CLASSB_CRC32_Flash_SW().