Xmega Application Note


progmem.h

Go to the documentation of this file.
00001 
00038 #ifndef UTILS_PROGMEM_H
00039 #define UTILS_PROGMEM_H
00040 
00047 #if defined(__GNUC__) || defined(__DOXYGEN__)
00048 # include <avr/pgmspace.h>
00049 # define PROGMEM_LOCATION(type, name, loc) \
00050                 type name __attribute__((section (#loc)))
00051 # define PROGMEM_DECLARE(type, name) type name __attribute__((__progmem__))
00052 # define PROGMEM_STRING(x) PSTR(x)
00053 # define PROGMEM_STRING_T  PGM_P
00054 # define PROGMEM_T
00055 # define PROGMEM_PTR_T *
00056 # define PROGMEM_BYTE_ARRAY_T uint8_t*
00057 # define PROGMEM_WORD_ARRAY_T uint16_t*
00058 # define PROGMEM_READ_BYTE(x) pgm_read_byte(x)
00059 # define PROGMEM_READ_WORD(x) pgm_read_word(x)
00060 
00061 #elif defined(__ICCAVR__)
00062 # include <pgmspace.h>
00063 # ifndef __HAS_ELPM__
00064 #  define _MEMATTR  __flash
00065 # else /* __HAS_ELPM__ */
00066 #  define _MEMATTR  __farflash
00067 # endif /* __HAS_ELPM__ */
00068 # define PROGMEM_LOCATION(type, name, loc) const _MEMATTR type name @ loc
00069 # define PROGMEM_DECLARE(type, name) _MEMATTR type name
00070 # define PROGMEM_STRING(x) ((_MEMATTR const char *)(x))
00071 # define PROGMEM_STRING_T  char const _MEMATTR *
00072 # define PROGMEM_T const _MEMATTR
00073 # define PROGMEM_PTR_T const _MEMATTR *
00074 # define PROGMEM_BYTE_ARRAY_T uint8_t const _MEMATTR *
00075 # define PROGMEM_WORD_ARRAY_T uint16_t const _MEMATTR *
00076 # define PROGMEM_READ_BYTE(x) *(x)
00077 # define PROGMEM_READ_WORD(x) *(x)
00078 #endif
00079 
00080 
00081 #endif /* UTILS_PROGMEM_H */
@DOC_TITLE@
Generated on Fri Oct 22 12:15:25 2010 for AVR1300 Using the Xmega ADC by doxygen 1.6.3