34 #define isFlashPtr(ptr) ((uint32_t)ptr >= 0x40200000) 39 #define IS_ALIGNED(_x) (((uint32_t)(_x)&3) == 0) 44 #define ALIGNUP(_n) (((_n) + 3) & ~3) 49 #define ALIGNDOWN(_n) ((_n) & ~3) 51 #define printf_P_heap(f_P, ...) \ 53 char* __localF = (char*)malloc(strlen_P(f_P) + 1); \ 54 strcpy_P(__localF, f_P); \ 55 int __result = os_printf_plus(__localF, ##__VA_ARGS__); \ 60 #define printf_P_stack(f_P, ...) \ 63 strncpy_P(__localF, f_P, sizeof(__localF)); \ 64 __localF[sizeof(__localF) - 1] = '\0'; \ 65 m_printf(__localF, ##__VA_ARGS__); \ 68 #define printf_P printf_P_stack 77 #define PSTR_COUNTED(str) \ 79 static const char __pstr__[] PROGMEM = str; \ 90 DEFINE_PSTR_LOCAL(__pstr__, str); \ 91 LOAD_PSTR(buf, __pstr__); \ 118 int memcmp_aligned(
const void* ptr1,
const void* ptr2,
unsigned len);
124 #define DEFINE_PSTR(name, str) const char name[] PROGMEM_PSTR = str; 130 #define DEFINE_PSTR_LOCAL(name, str) static DEFINE_PSTR(name, str) 136 #define DECLARE_PSTR(name) extern const char name[] PROGMEM; 154 #define LOAD_PSTR(name, flash_str) \ 155 char name[ALIGNUP(sizeof(flash_str))] __attribute__((aligned(4))); \ 156 memcpy_aligned(name, flash_str, sizeof(flash_str)); 158 #define _FLOAD(pstr) \ 160 LOAD_PSTR(_buf, pstr); \ 182 #define PSTR_ARRAY(name, str) \ 183 DEFINE_PSTR_LOCAL(__pstr__##name, str); \ 184 LOAD_PSTR(name, __pstr__##name)
void * memcpy_aligned(void *dst, const void *src, unsigned len)
copy memory aligned to word boundaries
int memcmp_aligned(const void *ptr1, const void *ptr2, unsigned len)
compare memory aligned to word boundaries