| Xmega IEC60730 Class B Library 1.0 |

All Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros
avr_compiler.h File Reference

## Detailed Description

Header file for compiler compatibility.

This file contains some general definitions and macros to ensure code compatibility with both IAR and GCC.

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

Documentation
  For comprehensive code documentation, supported compilers, compiler settings and supported devices see readme.html

Author:
  Atmel Corporation: http://www.atmel.com
  Support email: avr@a.nosp@m.tmel.nosp@m..com

Copyright (C) 2012 Atmel Corporation. All rights reserved.

Definition in file avr_compiler.h.

`#include <stdint.h>`
`#include <stdbool.h>`
`#include <stdlib.h>`
Include dependency graph for avr_compiler.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Macros
#define | CLASSB_EEMAP_BEGIN()
| Enable memory mapping of EEPROM, if it is not already enabled.
#define | CLASSB_EEMAP_END()
| Disable memory mapping of EEPROM, unless it was previously enabled.
#define | ENTER_CRITICAL_REGION()
#define | LEAVE_CRITICAL_REGION() SREG = saved_sreg;

## Macro Definition Documentation

#define CLASSB_EEMAP_BEGIN | ( |  | ) |

Value:
bool eemapEnabled; \
/* Check if memory mapping of EEPROM is already enabled. */ \
eemapEnabled = (NVM.CTRLB & NVM_EEMAPEN_bm) ? true : false; \
\
if (!eemapEnabled) { \
/* Ensure that NVM is ready before enabling memory mapping. */ \
do {} while (NVM.STATUS & NVM_NVMBUSY_bm); \
NVM.CTRLB |= NVM_EEMAPEN_bm; \
}

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.

Definition at line 81 of file avr_compiler.h.

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 (!eemapEnabled) { \
NVM.CTRLB &= ~NVM_EEMAPEN_bm; \
}

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

Note:
  Use this in conjunction with CLASSB_EEMAP_BEGIN().

Definition at line 96 of file avr_compiler.h.

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 ENTER_CRITICAL_REGION | ( |  | ) |

Value:
uint8_t volatile saved_sreg = SREG; \
cli();

This macro will protect the following code from interrupts.

Definition at line 103 of file avr_compiler.h.

#define LEAVE_CRITICAL_REGION | ( |  | ) | SREG = saved_sreg;

This macro must always be used in conjunction with ENTER_CRITICAL_REGION so that interrupts are enabled again.

Definition at line 110 of file avr_compiler.h.