Atmel Software Framework

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Compiler abstraction layer and code utilities

Compiler abstraction layer and code utilities for 32-bit AVR.

This module provides various abstraction layers and utilities to make code compatible between different compilers.

Modules

 Preprocessor - Stringize
 
 Preprocessor - Token Paste
 
 Status Codes
 
 Preprocessor - Macro Repeat
 

Macros

#define barrier()   asm volatile("" ::: "memory")
 Memory barrier. More...
 
#define COMPILER_ALIGNED(a)   __attribute__((__aligned__(a)))
 Set aligned boundary. More...
 
#define COMPILER_PACK_RESET()   COMPILER_PRAGMA(pack())
 Set default alignment for subsequent struct and union definitions. More...
 
#define COMPILER_PACK_SET(alignment)   COMPILER_PRAGMA(pack(alignment))
 Set maximum alignment for subsequent struct and union definitions to alignment. More...
 
#define COMPILER_PRAGMA(arg)   _Pragma(#arg)
 Emit the compiler pragma arg. More...
 
#define COMPILER_WORD_ALIGNED   __attribute__((__aligned__(4)))
 Set word-aligned boundary. More...
 
#define Get_system_register(reg)   sysreg_read(reg)
 
#define Set_system_register(reg, val)   sysreg_write(reg, val)
 
#define sysreg_write(reg, val)   __builtin_mtsr(reg, val)
 Set value of system register. More...
 
#define UNUSED(v)   (void)(v)
 Marking v as a unused parameter or value. More...
 
#define unused(v)   do { (void)(v); } while(0)
 Marking v as a unused parameter or value. More...
 

System Register Access

#define sysreg_read(reg)   __builtin_mfsr(reg)
 Get value of system register. More...
 

Tag functions as deprecated

Tagging a function as deprecated will produce a warning when and only when the function is called.

Usage is to add the DEPRECATED symbol before the function definition. E.g.: DEPRECATED uint8_t some_deprecated_function (void) { ... }

Note
Only supported by GCC 3.1 and above, no IAR support
#define __DEPRECATED__   __attribute__((__deprecated__))
 

#define __DEPRECATED__   __attribute__((__deprecated__))
#define COMPILER_ALIGNED (   a)    __attribute__((__aligned__(a)))

Set aligned boundary.

Referenced by stream_mem_to_mem().

#define COMPILER_PACK_RESET ( )    COMPILER_PRAGMA(pack())

Set default alignment for subsequent struct and union definitions.

#define COMPILER_PACK_SET (   alignment)    COMPILER_PRAGMA(pack(alignment))

Set maximum alignment for subsequent struct and union definitions to alignment.

#define COMPILER_PRAGMA (   arg)    _Pragma(#arg)

Emit the compiler pragma arg.

Parameters
argThe pragma directive as it would appear after #pragma (i.e. not stringified).
#define COMPILER_WORD_ALIGNED   __attribute__((__aligned__(4)))

Set word-aligned boundary.

#define sysreg_read (   reg)    __builtin_mfsr(reg)

Get value of system register.

Parameters
regAddress of the system register of which to get the value.
Returns
Value of system register reg.

Referenced by cpu_irq_save(), twi_master_init(), and twi_slave_init().

#define sysreg_write (   reg,
  val 
)    __builtin_mtsr(reg, val)

Set value of system register.

Parameters
regAddress of the system register of which to set the value.
valValue to set the system register reg to.
#define UNUSED (   v)    (void)(v)

Marking v as a unused parameter or value.

#define unused (   v)    do { (void)(v); } while(0)

Marking v as a unused parameter or value.