00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef __PGMSPACE_H_
00026 #define __PGMSPACE_H_ 1
00027
00028 #define __need_size_t
00029 #include <stddef.h>
00030
00031
00032
00033 #ifndef __ATTR_CONST__
00034 #define __ATTR_CONST__ __attribute__((__const__))
00035 #endif
00036
00037 #ifndef __ATTR_PROGMEM__
00038 #define __ATTR_PROGMEM__ __attribute__((__progmem__))
00039 #endif
00040
00041 #ifndef __ATTR_PURE__
00042 #define __ATTR_PURE__ __attribute__((__pure__))
00043 #endif
00044
00045 #define PROGMEM __ATTR_PROGMEM__
00046
00047 typedef void prog_void PROGMEM;
00048 typedef char prog_char PROGMEM;
00049 typedef unsigned char prog_uchar PROGMEM;
00050 typedef int prog_int PROGMEM;
00051 typedef long prog_long PROGMEM;
00052 typedef long long prog_long_long PROGMEM;
00053
00054 #define PSTR(s) ({static char __c[] PROGMEM = (s); __c;})
00055
00056
00057 #include <ina90.h>
00058
00059 static inline unsigned char __lpm_inline(unsigned short __addr) __ATTR_CONST__;
00060 static inline unsigned char __lpm_inline(unsigned short __addr)
00061 {
00062 return _LPM(__addr);
00063 }
00064
00065 #ifdef RAMPZ
00066
00067
00068
00069
00070
00071
00072
00073 static inline unsigned char __elpm_inline(unsigned long __addr) __ATTR_CONST__;
00074 static inline unsigned char __elpm_inline(unsigned long __addr)
00075 {
00076 return _ELPM(__addr);
00077 }
00078 #endif
00079
00080 #if 0
00081 #define PRG_RDB(addr) __lpm_inline((unsigned short)(addr))
00082 #else
00083 #define PRG_RDB(addr) _LPM((unsigned short)(addr))
00084 #endif
00085
00086 #ifndef PGM_P
00087 #define PGM_P const prog_char *
00088 #endif
00089
00090 #ifndef PGM_VOID_P
00091 #define PGM_VOID_P const prog_void *
00092 #endif
00093
00094 extern void *memcpy_P(void *, PGM_VOID_P, size_t);
00095 extern char *strcat_P(char *, PGM_P);
00096 extern int strcmp_P(const char *, PGM_P) __ATTR_PURE__;
00097 extern char *strcpy_P(char *, PGM_P);
00098 extern int strcasecmp_P(const char *, PGM_P) __ATTR_PURE__;
00099 extern size_t strlen_P(PGM_P) __ATTR_CONST__;
00100 extern int strncmp_P(const char *, PGM_P, size_t) __ATTR_PURE__;
00101 extern int strncasecmp_P(const char *, PGM_P) __ATTR_PURE__;
00102 extern char *strncpy_P(char *, PGM_P, size_t);
00103
00104 #if 0
00105 extern int printf_P(PGM_P, ...);
00106 extern int puts_P(PGM_P);
00107 extern int scanf_P(PGM_P, ...);
00108 extern int sprintf_P(char *, PGM_P, ...);
00109 extern int sscanf_P(const char *, PGM_P, ...);
00110 extern PGM_P strerror_P(int);
00111 #endif
00112
00113 #endif
00114