123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190 |
- /**
- * Marlin 3D Printer Firmware
- * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
- *
- * Based on Sprinter and grbl.
- * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- *
- */
- #pragma once
-
- #ifndef __AVR__
- #ifndef __PGMSPACE_H_
- // This define should prevent reading the system pgmspace.h if included elsewhere
- // This is not normally needed.
- #define __PGMSPACE_H_ 1
- #endif
-
- #ifndef PROGMEM
- #define PROGMEM
- #endif
- #ifndef PGM_P
- #define PGM_P const char *
- #endif
- #ifndef PSTR
- #define PSTR(str) (str)
- #endif
- #ifndef F
- class __FlashStringHelper;
- #define F(str) (reinterpret_cast<const __FlashStringHelper *>(PSTR(str)))
- #endif
- #ifndef _SFR_BYTE
- #define _SFR_BYTE(n) (n)
- #endif
- #ifndef memchr_P
- #define memchr_P(str, c, len) memchr((str), (c), (len))
- #endif
- #ifndef memcmp_P
- #define memcmp_P(a, b, n) memcmp((a), (b), (n))
- #endif
- #ifndef memcpy_P
- #define memcpy_P(dest, src, num) memcpy((dest), (src), (num))
- #endif
- #ifndef memmem_P
- #define memmem_P(a, alen, b, blen) memmem((a), (alen), (b), (blen))
- #endif
- #ifndef memrchr_P
- #define memrchr_P(str, val, len) memrchr((str), (val), (len))
- #endif
- #ifndef strcat_P
- #define strcat_P(dest, src) strcat((dest), (src))
- #endif
- #ifndef strchr_P
- #define strchr_P(str, c) strchr((str), (c))
- #endif
- #ifndef strchrnul_P
- #define strchrnul_P(str, c) strchrnul((str), (c))
- #endif
- #ifndef strcmp_P
- #define strcmp_P(a, b) strcmp((a), (b))
- #endif
- #ifndef strcpy_P
- #define strcpy_P(dest, src) strcpy((dest), (src))
- #endif
- #ifndef strcasecmp_P
- #define strcasecmp_P(a, b) strcasecmp((a), (b))
- #endif
- #ifndef strcasestr_P
- #define strcasestr_P(a, b) strcasestr((a), (b))
- #endif
- #ifndef strlcat_P
- #define strlcat_P(dest, src, len) strlcat((dest), (src), (len))
- #endif
- #ifndef strlcpy_P
- #define strlcpy_P(dest, src, len) strlcpy((dest), (src), (len))
- #endif
- #ifndef strlen_P
- #define strlen_P(s) strlen((const char *)(s))
- #endif
- #ifndef strnlen_P
- #define strnlen_P(str, len) strnlen((str), (len))
- #endif
- #ifndef strncmp_P
- #define strncmp_P(a, b, n) strncmp((a), (b), (n))
- #endif
- #ifndef strncasecmp_P
- #define strncasecmp_P(a, b, n) strncasecmp((a), (b), (n))
- #endif
- #ifndef strncat_P
- #define strncat_P(a, b, n) strncat((a), (b), (n))
- #endif
- #ifndef strncpy_P
- #define strncpy_P(a, b, n) strncpy((a), (b), (n))
- #endif
- #ifndef strpbrk_P
- #define strpbrk_P(str, chrs) strpbrk((str), (chrs))
- #endif
- #ifndef strrchr_P
- #define strrchr_P(str, c) strrchr((str), (c))
- #endif
- #ifndef strsep_P
- #define strsep_P(pstr, delim) strsep((pstr), (delim))
- #endif
- #ifndef strspn_P
- #define strspn_P(str, chrs) strspn((str), (chrs))
- #endif
- #ifndef strstr_P
- #define strstr_P(a, b) strstr((a), (b))
- #endif
- #ifndef sprintf_P
- #define sprintf_P(s, ...) sprintf((s), __VA_ARGS__)
- #endif
- #ifndef vfprintf_P
- #define vfprintf_P(s, ...) vfprintf((s), __VA_ARGS__)
- #endif
- #ifndef printf_P
- #define printf_P(...) printf(__VA_ARGS__)
- #endif
- #ifndef snprintf_P
- #define snprintf_P(s, n, ...) snprintf((s), (n), __VA_ARGS__)
- #endif
- #ifndef vsprintf_P
- #define vsprintf_P(s, ...) vsprintf((s),__VA_ARGS__)
- #endif
- #ifndef vsnprintf_P
- #define vsnprintf_P(s, n, ...) vsnprintf((s), (n),__VA_ARGS__)
- #endif
- #ifndef fprintf_P
- #define fprintf_P(s, ...) fprintf((s), __VA_ARGS__)
- #endif
-
- #ifndef pgm_read_byte
- #define pgm_read_byte(addr) (*(const unsigned char *)(addr))
- #endif
- #ifndef pgm_read_word
- #define pgm_read_word(addr) (*(const unsigned short *)(addr))
- #endif
- #ifndef pgm_read_dword
- #define pgm_read_dword(addr) (*(const unsigned long *)(addr))
- #endif
- #ifndef pgm_read_float
- #define pgm_read_float(addr) (*(const float *)(addr))
- #endif
-
- #ifndef pgm_read_byte_near
- #define pgm_read_byte_near(addr) pgm_read_byte(addr)
- #endif
- #ifndef pgm_read_word_near
- #define pgm_read_word_near(addr) pgm_read_word(addr)
- #endif
- #ifndef pgm_read_dword_near
- #define pgm_read_dword_near(addr) pgm_read_dword(addr)
- #endif
- #ifndef pgm_read_float_near
- #define pgm_read_float_near(addr) pgm_read_float(addr)
- #endif
- #ifndef pgm_read_byte_far
- #define pgm_read_byte_far(addr) pgm_read_byte(addr)
- #endif
- #ifndef pgm_read_word_far
- #define pgm_read_word_far(addr) pgm_read_word(addr)
- #endif
- #ifndef pgm_read_dword_far
- #define pgm_read_dword_far(addr) pgm_read_dword(addr)
- #endif
- #ifndef pgm_read_float_far
- #define pgm_read_float_far(addr) pgm_read_float(addr)
- #endif
-
- #ifndef pgm_read_pointer
- #define pgm_read_pointer
- #endif
-
- // Fix bug in pgm_read_ptr
- #undef pgm_read_ptr
- #define pgm_read_ptr(addr) (*((void**)(addr)))
-
- #endif // __AVR__
|