|
| 1 | +/* |
| 2 | + Copyright (c) 2015 Hristo Gochkov. All rights reserved. |
| 3 | + This file is part of the RaspberryPi core for Arduino environment. |
| 4 | + |
| 5 | + This library is free software; you can redistribute it and/or |
| 6 | + modify it under the terms of the GNU Lesser General Public |
| 7 | + License as published by the Free Software Foundation; either |
| 8 | + version 2.1 of the License, or (at your option) any later version. |
| 9 | +
|
| 10 | + This library is distributed in the hope that it will be useful, |
| 11 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | + Lesser General Public License for more details. |
| 14 | +
|
| 15 | + You should have received a copy of the GNU Lesser General Public |
| 16 | + License along with this library; if not, write to the Free Software |
| 17 | + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | +*/ |
| 19 | +#ifndef PGMSPACE_INCLUDE |
| 20 | +#define PGMSPACE_INCLUDE |
| 21 | + |
| 22 | +typedef void prog_void; |
| 23 | +typedef char prog_char; |
| 24 | +typedef unsigned char prog_uchar; |
| 25 | +typedef char prog_int8_t; |
| 26 | +typedef unsigned char prog_uint8_t; |
| 27 | +typedef short prog_int16_t; |
| 28 | +typedef unsigned short prog_uint16_t; |
| 29 | +typedef long prog_int32_t; |
| 30 | +typedef unsigned long prog_uint32_t; |
| 31 | + |
| 32 | +#define PROGMEM |
| 33 | +#define PGM_P const char * |
| 34 | +#define PGM_VOID_P const void * |
| 35 | +#define PSTR(s) (s) |
| 36 | +#define _SFR_BYTE(n) (n) |
| 37 | + |
| 38 | +#define pgm_read_byte(addr) (*(const unsigned char *)(addr)) |
| 39 | +#define pgm_read_word(addr) ({ \ |
| 40 | + typeof(addr) _addr = (addr); \ |
| 41 | + *(const unsigned short *)(_addr); \ |
| 42 | +}) |
| 43 | +#define pgm_read_dword(addr) ({ \ |
| 44 | + typeof(addr) _addr = (addr); \ |
| 45 | + *(const unsigned long *)(_addr); \ |
| 46 | +}) |
| 47 | +#define pgm_read_float(addr) ({ \ |
| 48 | + typeof(addr) _addr = (addr); \ |
| 49 | + *(const float *)(_addr); \ |
| 50 | +}) |
| 51 | +#define pgm_read_ptr(addr) ({ \ |
| 52 | + typeof(addr) _addr = (addr); \ |
| 53 | + *(void * const *)(_addr); \ |
| 54 | +}) |
| 55 | + |
| 56 | +#define pgm_get_far_address(x) ((uint32_t)(&(x))) |
| 57 | + |
| 58 | +#define pgm_read_byte_near(addr) pgm_read_byte(addr) |
| 59 | +#define pgm_read_word_near(addr) pgm_read_word(addr) |
| 60 | +#define pgm_read_dword_near(addr) pgm_read_dword(addr) |
| 61 | +#define pgm_read_float_near(addr) pgm_read_float(addr) |
| 62 | +#define pgm_read_ptr_near(addr) pgm_read_ptr(addr) |
| 63 | +#define pgm_read_byte_far(addr) pgm_read_byte(addr) |
| 64 | +#define pgm_read_word_far(addr) pgm_read_word(addr) |
| 65 | +#define pgm_read_dword_far(addr) pgm_read_dword(addr) |
| 66 | +#define pgm_read_float_far(addr) pgm_read_float(addr) |
| 67 | +#define pgm_read_ptr_far(addr) pgm_read_ptr(addr) |
| 68 | + |
| 69 | +#define memcmp_P memcmp |
| 70 | +#define memccpy_P memccpy |
| 71 | +#define memmem_P memmem |
| 72 | +#define memcpy_P memcpy |
| 73 | +#define strcpy_P strcpy |
| 74 | +#define strncpy_P strncpy |
| 75 | +#define strcat_P strcat |
| 76 | +#define strncat_P strncat |
| 77 | +#define strcmp_P strcmp |
| 78 | +#define strncmp_P strncmp |
| 79 | +#define strcasecmp_P strcasecmp |
| 80 | +#define strncasecmp_P strncasecmp |
| 81 | +#define strlen_P strlen |
| 82 | +#define strnlen_P strnlen |
| 83 | +#define strstr_P strstr |
| 84 | +#define printf_P printf |
| 85 | +#define sprintf_P sprintf |
| 86 | +#define snprintf_P snprintf |
| 87 | +#define vsnprintf_P vsnprintf |
| 88 | + |
| 89 | +#endif |
0 commit comments