RTEMS CPU Kit with SuperCore  4.11.3
Macros | Typedefs | Functions
pgmspace.h File Reference

Definitions for ATmega640. More...

#include <inttypes.h>
#include <stddef.h>
#include <avr/io.h>
Include dependency graph for pgmspace.h:

Go to the source code of this file.

Macros

#define __need_size_t
 
#define __ATTR_CONST__   __attribute__((__const__))
 
#define __ATTR_PROGMEM__   __attribute__((__progmem__))
 
#define __ATTR_PURE__   __attribute__((__pure__))
 
#define PROGMEM   __ATTR_PROGMEM__
 Attribute to use in order to declare an object being located in flash ROM.
 
#define PSTR(s)   (__extension__({static char __c[] PROGMEM = (s); &__c[0];}))
 
#define __LPM_classic__(addr)
 
#define __LPM_enhanced__(addr)
 
#define __LPM_word_classic__(addr)
 
#define __LPM_word_enhanced__(addr)
 
#define __LPM_dword_classic__(addr)
 
#define __LPM_dword_enhanced__(addr)
 
#define __LPM_float_classic__(addr)
 
#define __LPM_float_enhanced__(addr)
 
#define __LPM(addr)   __LPM_classic__(addr)
 
#define __LPM_word(addr)   __LPM_word_classic__(addr)
 
#define __LPM_dword(addr)   __LPM_dword_classic__(addr)
 
#define __LPM_float(addr)   __LPM_float_classic__(addr)
 
#define pgm_read_byte_near(address_short)   __LPM((uint16_t)(address_short))
 Read a byte from the program space with a 16-bit (near) address. More...
 
#define pgm_read_word_near(address_short)   __LPM_word((uint16_t)(address_short))
 Read a word from the program space with a 16-bit (near) address. More...
 
#define pgm_read_dword_near(address_short)   __LPM_dword((uint16_t)(address_short))
 Read a double word from the program space with a 16-bit (near) address. More...
 
#define pgm_read_float_near(address_short)   __LPM_float((uint16_t)(address_short))
 Read a float from the program space with a 16-bit (near) address. More...
 
#define pgm_read_byte(address_short)   pgm_read_byte_near(address_short)
 Read a byte from the program space with a 16-bit (near) address. More...
 
#define pgm_read_word(address_short)   pgm_read_word_near(address_short)
 Read a word from the program space with a 16-bit (near) address. More...
 
#define pgm_read_dword(address_short)   pgm_read_dword_near(address_short)
 Read a double word from the program space with a 16-bit (near) address. More...
 
#define pgm_read_float(address_short)   pgm_read_float_near(address_short)
 Read a float from the program space with a 16-bit (near) address. More...
 
#define PGM_P   const prog_char *
 Used to declare a variable that is a pointer to a string in program space. More...
 
#define PGM_VOID_P   const prog_void *
 Used to declare a generic pointer to an object in program space. More...
 

Typedefs

typedef void prog_void PROGMEM
 

Functions

PGM_VOID_P memchr_P (PGM_VOID_P, int __val, size_t __len) __ATTR_CONST__
 
int memcmp_P (const void *, PGM_VOID_P, size_t) __ATTR_PURE__
 
void * memccpy_P (void *, PGM_VOID_P, int __val, size_t)
 
void * memcpy_P (void *, PGM_VOID_P, size_t)
 
void * memmem_P (const void *, size_t, PGM_VOID_P, size_t) __ATTR_PURE__
 
PGM_VOID_P memrchr_P (PGM_VOID_P, int __val, size_t __len) __ATTR_CONST__
 
char * strcat_P (char *, PGM_P)
 
PGM_P strchr_P (PGM_P, int __val) __ATTR_CONST__
 
PGM_P strchrnul_P (PGM_P, int __val) __ATTR_CONST__
 
int strcmp_P (const char *, PGM_P) __ATTR_PURE__
 
char * strcpy_P (char *, PGM_P)
 
int strcasecmp_P (const char *, PGM_P) __ATTR_PURE__
 
char * strcasestr_P (const char *, PGM_P) __ATTR_PURE__
 
size_t strcspn_P (const char *__s, PGM_P __reject) __ATTR_PURE__
 
size_t strlcat_P (char *, PGM_P, size_t)
 
size_t strlcpy_P (char *, PGM_P, size_t)
 
size_t strlen_P (PGM_P) __ATTR_CONST__
 
size_t strnlen_P (PGM_P, size_t) __ATTR_CONST__
 
int strncmp_P (const char *, PGM_P, size_t) __ATTR_PURE__
 
int strncasecmp_P (const char *, PGM_P, size_t) __ATTR_PURE__
 
char * strncat_P (char *, PGM_P, size_t)
 
char * strncpy_P (char *, PGM_P, size_t)
 
char * strpbrk_P (const char *__s, PGM_P __accept) __ATTR_PURE__
 
PGM_P strrchr_P (PGM_P, int __val) __ATTR_CONST__
 
char * strsep_P (char **__sp, PGM_P __delim)
 
size_t strspn_P (const char *__s, PGM_P __accept) __ATTR_PURE__
 
char * strstr_P (const char *, PGM_P) __ATTR_PURE__
 
char * strtok_P (char *__s, PGM_P __delim)
 
char * strtok_rP (char *__s, PGM_P __delim, char **__last)
 

Detailed Description

Definitions for ATmega640.

The functions in this module provide interfaces for a program to access data stored in program space (flash memory) of the device. In order to use these functions, the target device must support either the LPM or ELPM instructions.

Note
These functions are an attempt to provide some compatibility with header files that come with IAR C, to make porting applications between different compilers easier. This is not 100% compatibility though (GCC does not have full support for multiple address spaces yet).
If you are working with strings which are completely based in ram, use the standard string functions described in avr_string.
If possible, put your constant tables in the lower 64 KB and use pgm_read_byte_near() or pgm_read_word_near() instead of pgm_read_byte_far() or pgm_read_word_far() since it is more efficient that way, and you can still use the upper 64K for executable code. All functions that are suffixed with a _P require their arguments to be in the lower 64 KB of the flash ROM, as they do not use ELPM instructions. This is normally not a big concern as the linker setup arranges any program space constants declared using the macros from this header file so they are placed right after the interrupt vectors, and in front of any executable code. However, it can become a problem if there are too many of these constants, or for bootloaders on devices with more than 64 KB of ROM. All these functions will not work in that situation.

Contributors: Created by Marek Michalkiewicz marek.nosp@m.m@li.nosp@m.nux.o.nosp@m.rg.p.nosp@m.l Eric B. Weddington eric@.nosp@m.ecen.nosp@m.tral..nosp@m.com Wolfgang Haidinger wh@vm.nosp@m.ars..nosp@m.tuwie.nosp@m.n.ac.nosp@m..at (pgm_read_dword()) Ivanov Anton anton.nosp@m.@arc.nosp@m..com..nosp@m.ru (pgm_read_float())