PGM_STR(): New macro.
authorbernie <bernie@38d2e660-2303-0410-9eaa-f027e97ec537>
Tue, 19 Jul 2005 07:24:57 +0000 (07:24 +0000)
committerbernie <bernie@38d2e660-2303-0410-9eaa-f027e97ec537>
Tue, 19 Jul 2005 07:24:57 +0000 (07:24 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@423 38d2e660-2303-0410-9eaa-f027e97ec537

mware/pgm.h

index 87b46b2822c49ba598766fb9163cef380d5e9b65..ea28043e98587cdf166bffec5c81844cecff752c 100755 (executable)
@@ -23,6 +23,7 @@
 #define MWARE_PGM_H
 
 #include <cfg/cpu_detect.h>
+#include <cfg/compiler.h> /* For intXX_t */
 
 #if CPU_AVR
 
 
        #endif
 
+       #ifndef PROGMEM
        #define PROGMEM  __attribute__((__progmem__))
+       #endif
+       #ifndef PSTR
        #define PSTR(s) ({ static const char __c[] PROGMEM = (s); &__c[0]; })
+       #endif
 
 #elif CPU_HARVARD
        #error Missing CPU support
@@ -197,10 +202,12 @@ typedef PROGMEM uint32_t pgm_uint32_t;
 #ifdef _PROGMEM
        #define PGM_READ_CHAR(s) pgm_read_char(s)
        #define PGM_FUNC(x)      x ## _P
+       #define PGM_STR(x)       PSTR(x)
        #define PGM_ATTR         PROGMEM
 #else
        #define PGM_READ_CHAR(s) (*(s))
        #define PGM_FUNC(x)      x
+       #define PGM_STR(x)       x
        #define PGM_ATTR         /* nothing */
 #endif
 /* \} */