avr-libc  2.2.0git
Standard C library for AVR-GCC

AVR Libc Home Page

AVRs

AVR Libc Development Pages

Main Page

User Manual

Library Reference

FAQ

Example Projects

pgmspace.h
Go to the documentation of this file.
1/* Copyright (c) 2002-2007 Marek Michalkiewicz
2 Copyright (c) 2006, Carlos Lamas
3 Copyright (c) 2009-2010, Jan Waclawek
4 All rights reserved.
5
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met:
8
9 * Redistributions of source code must retain the above copyright
10 notice, this list of conditions and the following disclaimer.
11 * Redistributions in binary form must reproduce the above copyright
12 notice, this list of conditions and the following disclaimer in
13 the documentation and/or other materials provided with the
14 distribution.
15 * Neither the name of the copyright holders nor the names of
16 contributors may be used to endorse or promote products derived
17 from this software without specific prior written permission.
18
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 POSSIBILITY OF SUCH DAMAGE. */
30
31/* $Id$ */
32
33/*
34 pgmspace.h
35
36 Contributors:
37 Created by Marek Michalkiewicz <marekm@linux.org.pl>
38 Eric B. Weddington <eric@ecentral.com>
39 Wolfgang Haidinger <wh@vmars.tuwien.ac.at> (pgm_read_dword())
40 Ivanov Anton <anton@arc.com.ru> (pgm_read_float())
41 */
42
43/** \file */
44/** \defgroup avr_pgmspace <avr/pgmspace.h>: Program Space Utilities
45 \code
46 #include <avr/io.h>
47 #include <avr/pgmspace.h>
48 \endcode
49
50 The functions in this module provide interfaces for a program to access
51 data stored in program space (flash memory) of the device. In order to
52 use these functions, the target device must support either the \c LPM or
53 \c ELPM instructions.
54
55 \note These functions are an attempt to provide some compatibility with
56 header files that come with IAR C, to make porting applications between
57 different compilers easier. This is not 100% compatibility though (GCC
58 does not have full support for multiple address spaces yet).
59
60 \note If you are working with strings which are completely based in ram,
61 use the standard string functions described in \ref avr_string.
62
63 \note If possible, put your constant tables in the lower 64 KB and use
64 pgm_read_byte_near() or pgm_read_word_near() instead of
65 pgm_read_byte_far() or pgm_read_word_far() since it is more efficient that
66 way, and you can still use the upper 64K for executable code.
67 All functions that are suffixed with a \c _P \e require their
68 arguments to be in the lower 64 KB of the flash ROM, as they do
69 not use ELPM instructions. This is normally not a big concern as
70 the linker setup arranges any program space constants declared
71 using the macros from this header file so they are placed right after
72 the interrupt vectors, and in front of any executable code. However,
73 it can become a problem if there are too many of these constants, or
74 for bootloaders on devices with more than 64 KB of ROM.
75 <em>All these functions will not work in that situation.</em>
76
77 \note For <b>Xmega</b> devices, make sure the NVM controller
78 command register (\c NVM.CMD or \c NVM_CMD) is set to 0x00 (NOP)
79 before using any of these functions.
80*/
81
82#ifndef __PGMSPACE_H_
83#define __PGMSPACE_H_ 1
84
85#ifndef __DOXYGEN__
86#define __need_size_t
87#endif
88#include <inttypes.h>
89#include <stddef.h>
90#include <avr/io.h>
91
92#ifndef __DOXYGEN__
93#ifndef __ATTR_CONST__
94#define __ATTR_CONST__ __attribute__((__const__))
95#endif
96
97#ifndef __ATTR_PROGMEM__
98#define __ATTR_PROGMEM__ __attribute__((__progmem__))
99#endif
100
101#ifndef __ATTR_PURE__
102#define __ATTR_PURE__ __attribute__((__pure__))
103#endif
104#endif /* !__DOXYGEN__ */
105
106/**
107 \ingroup avr_pgmspace
108 \def PROGMEM
109
110 Attribute to use in order to declare an object being located in
111 flash ROM.
112 */
113#define PROGMEM __ATTR_PROGMEM__
114
115#ifdef __cplusplus
116extern "C" {
117#endif
118
119#if defined(__DOXYGEN__)
120/*
121 * Doxygen doesn't grok the appended attribute syntax of
122 * GCC, and confuses the typedefs with function decls, so
123 * supply a doxygen-friendly view.
124 */
125
126/**
127 \ingroup avr_pgmspace
128 \typedef prog_void
129 \note DEPRECATED
130
131 This typedef is now deprecated because the usage of the __progmem__
132 attribute on a type is not supported in GCC. However, the use of the
133 __progmem__ attribute on a variable declaration is supported, and this is
134 now the recommended usage.
135
136 The typedef is only visible if the macro __PROG_TYPES_COMPAT__
137 has been defined before including <avr/pgmspace.h> (either by a
138 \c \#define directive, or by a -D compiler option.)
139
140 Type of a "void" object located in flash ROM. Does not make much
141 sense by itself, but can be used to declare a "void *" object in
142 flash ROM.
143*/
144typedef void PROGMEM prog_void;
145
146/**
147 \ingroup avr_pgmspace
148 \typedef prog_char
149 \note DEPRECATED
150
151 This typedef is now deprecated because the usage of the __progmem__
152 attribute on a type is not supported in GCC. However, the use of the
153 __progmem__ attribute on a variable declaration is supported, and this is
154 now the recommended usage.
155
156 The typedef is only visible if the macro __PROG_TYPES_COMPAT__
157 has been defined before including <avr/pgmspace.h> (either by a
158 \c \#define directive, or by a -D compiler option.)
159
160 Type of a "char" object located in flash ROM.
161*/
162typedef char PROGMEM prog_char;
163
164/**
165 \ingroup avr_pgmspace
166 \typedef prog_uchar
167 \note DEPRECATED
168
169 This typedef is now deprecated because the usage of the __progmem__
170 attribute on a type is not supported in GCC. However, the use of the
171 __progmem__ attribute on a variable declaration is supported, and this is
172 now the recommended usage.
173
174 The typedef is only visible if the macro __PROG_TYPES_COMPAT__
175 has been defined before including <avr/pgmspace.h> (either by a
176 \c \#define directive, or by a -D compiler option.)
177
178 Type of an "unsigned char" object located in flash ROM.
179*/
180typedef unsigned char PROGMEM prog_uchar;
181
182/**
183 \ingroup avr_pgmspace
184 \typedef prog_int8_t
185 \note DEPRECATED
186
187 This typedef is now deprecated because the usage of the __progmem__
188 attribute on a type is not supported in GCC. However, the use of the
189 __progmem__ attribute on a variable declaration is supported, and this is
190 now the recommended usage.
191
192 The typedef is only visible if the macro __PROG_TYPES_COMPAT__
193 has been defined before including <avr/pgmspace.h> (either by a
194 \c \#define directive, or by a -D compiler option.)
195
196 Type of an "int8_t" object located in flash ROM.
197*/
199
200/**
201 \ingroup avr_pgmspace
202 \typedef prog_uint8_t
203 \note DEPRECATED
204
205 This typedef is now deprecated because the usage of the __progmem__
206 attribute on a type is not supported in GCC. However, the use of the
207 __progmem__ attribute on a variable declaration is supported, and this is
208 now the recommended usage.
209
210 The typedef is only visible if the macro __PROG_TYPES_COMPAT__
211 has been defined before including <avr/pgmspace.h> (either by a
212 \c \#define directive, or by a -D compiler option.)
213
214 Type of an "uint8_t" object located in flash ROM.
215*/
217
218/**
219 \ingroup avr_pgmspace
220 \typedef prog_int16_t
221 \note DEPRECATED
222
223 This typedef is now deprecated because the usage of the __progmem__
224 attribute on a type is not supported in GCC. However, the use of the
225 __progmem__ attribute on a variable declaration is supported, and this is
226 now the recommended usage.
227
228 The typedef is only visible if the macro __PROG_TYPES_COMPAT__
229 has been defined before including <avr/pgmspace.h> (either by a
230 \c \#define directive, or by a -D compiler option.)
231
232 Type of an "int16_t" object located in flash ROM.
233*/
235
236/**
237 \ingroup avr_pgmspace
238 \typedef prog_uint16_t
239 \note DEPRECATED
240
241 This typedef is now deprecated because the usage of the __progmem__
242 attribute on a type is not supported in GCC. However, the use of the
243 __progmem__ attribute on a variable declaration is supported, and this is
244 now the recommended usage.
245
246 The typedef is only visible if the macro __PROG_TYPES_COMPAT__
247 has been defined before including <avr/pgmspace.h> (either by a
248 \c \#define directive, or by a -D compiler option.)
249
250 Type of an "uint16_t" object located in flash ROM.
251*/
253
254/**
255 \ingroup avr_pgmspace
256 \typedef prog_int32_t
257 \note DEPRECATED
258
259 This typedef is now deprecated because the usage of the __progmem__
260 attribute on a type is not supported in GCC. However, the use of the
261 __progmem__ attribute on a variable declaration is supported, and this is
262 now the recommended usage.
263
264 The typedef is only visible if the macro __PROG_TYPES_COMPAT__
265 has been defined before including <avr/pgmspace.h> (either by a
266 \c \#define directive, or by a -D compiler option.)
267
268 Type of an "int32_t" object located in flash ROM.
269*/
271
272/**
273 \ingroup avr_pgmspace
274 \typedef prog_uint32_t
275 \note DEPRECATED
276
277 This typedef is now deprecated because the usage of the __progmem__
278 attribute on a type is not supported in GCC. However, the use of the
279 __progmem__ attribute on a variable declaration is supported, and this is
280 now the recommended usage.
281
282 The typedef is only visible if the macro __PROG_TYPES_COMPAT__
283 has been defined before including <avr/pgmspace.h> (either by a
284 \c \#define directive, or by a -D compiler option.)
285
286 Type of an "uint32_t" object located in flash ROM.
287*/
289
290/**
291 \ingroup avr_pgmspace
292 \typedef prog_int64_t
293 \note DEPRECATED
294
295 This typedef is now deprecated because the usage of the __progmem__
296 attribute on a type is not supported in GCC. However, the use of the
297 __progmem__ attribute on a variable declaration is supported, and this is
298 now the recommended usage.
299
300 The typedef is only visible if the macro __PROG_TYPES_COMPAT__
301 has been defined before including <avr/pgmspace.h> (either by a
302 \c \#define directive, or by a -D compiler option.)
303
304 Type of an "int64_t" object located in flash ROM.
305
306 \note This type is not available when the compiler
307 option -mint8 is in effect.
308*/
310
311/**
312 \ingroup avr_pgmspace
313 \typedef prog_uint64_t
314 \note DEPRECATED
315
316 This typedef is now deprecated because the usage of the __progmem__
317 attribute on a type is not supported in GCC. However, the use of the
318 __progmem__ attribute on a variable declaration is supported, and this is
319 now the recommended usage.
320
321 The typedef is only visible if the macro __PROG_TYPES_COMPAT__
322 has been defined before including <avr/pgmspace.h> (either by a
323 \c \#define directive, or by a -D compiler option.)
324
325 Type of an "uint64_t" object located in flash ROM.
326
327 \note This type is not available when the compiler
328 option -mint8 is in effect.
329*/
331
332/** \ingroup avr_pgmspace
333 \def PGM_P
334
335 Used to declare a variable that is a pointer to a string in program
336 space. */
337
338#ifndef PGM_P
339#define PGM_P const char *
340#endif
341
342/** \ingroup avr_pgmspace
343 \def PGM_VOID_P
344
345 Used to declare a generic pointer to an object in program space. */
346
347#ifndef PGM_VOID_P
348#define PGM_VOID_P const void *
349#endif
350
351#elif defined(__PROG_TYPES_COMPAT__) /* !DOXYGEN */
352
353typedef void prog_void __attribute__((__progmem__,deprecated("prog_void type is deprecated.")));
354typedef char prog_char __attribute__((__progmem__,deprecated("prog_char type is deprecated.")));
355typedef unsigned char prog_uchar __attribute__((__progmem__,deprecated("prog_uchar type is deprecated.")));
356typedef int8_t prog_int8_t __attribute__((__progmem__,deprecated("prog_int8_t type is deprecated.")));
357typedef uint8_t prog_uint8_t __attribute__((__progmem__,deprecated("prog_uint8_t type is deprecated.")));
358typedef int16_t prog_int16_t __attribute__((__progmem__,deprecated("prog_int16_t type is deprecated.")));
359typedef uint16_t prog_uint16_t __attribute__((__progmem__,deprecated("prog_uint16_t type is deprecated.")));
360typedef int32_t prog_int32_t __attribute__((__progmem__,deprecated("prog_int32_t type is deprecated.")));
361typedef uint32_t prog_uint32_t __attribute__((__progmem__,deprecated("prog_uint32_t type is deprecated.")));
362#if !__USING_MINT8
363typedef int64_t prog_int64_t __attribute__((__progmem__,deprecated("prog_int64_t type is deprecated.")));
364typedef uint64_t prog_uint64_t __attribute__((__progmem__,deprecated("prog_uint64_t type is deprecated.")));
365#endif
366
367#ifndef PGM_P
368#define PGM_P const prog_char *
369#endif
370
371#ifndef PGM_VOID_P
372#define PGM_VOID_P const prog_void *
373#endif
374
375#else /* !defined(__DOXYGEN__), !defined(__PROG_TYPES_COMPAT__) */
376
377#ifndef PGM_P
378#define PGM_P const char *
379#endif
380
381#ifndef PGM_VOID_P
382#define PGM_VOID_P const void *
383#endif
384#endif /* defined(__DOXYGEN__), defined(__PROG_TYPES_COMPAT__) */
385
386/* Although in C, we can get away with just using __c, it does not work in
387 C++. We need to use &__c[0] to avoid the compiler puking. Dave Hylands
388 explaned it thusly,
389
390 Let's suppose that we use PSTR("Test"). In this case, the type returned
391 by __c is a prog_char[5] and not a prog_char *. While these are
392 compatible, they aren't the same thing (especially in C++). The type
393 returned by &__c[0] is a prog_char *, which explains why it works
394 fine. */
395
396#if defined(__DOXYGEN__)
397/*
398 * The #define below is just a dummy that serves documentation
399 * purposes only.
400 */
401/** \ingroup avr_pgmspace
402 \def PSTR(s)
403
404 Used to declare a static pointer to a string in program space. */
405# define PSTR(s) ((const PROGMEM char *)(s))
406#else /* !DOXYGEN */
407/* The real thing. */
408# define PSTR(s) (__extension__({static const char __c[] PROGMEM = (s); &__c[0];}))
409#endif /* DOXYGEN */
410
411#ifndef __DOXYGEN__ /* Internal macros, not documented. */
412#define __LPM_classic__(addr) \
413(__extension__({ \
414 uint16_t __addr16 = (uint16_t)(addr); \
415 uint8_t __result; \
416 __asm__ __volatile__ \
417 ( \
418 "lpm" "\n\t" \
419 "mov %0, r0" "\n\t" \
420 : "=r" (__result) \
421 : "z" (__addr16) \
422 : "r0" \
423 ); \
424 __result; \
425}))
426
427#define __LPM_enhanced__(addr) \
428(__extension__({ \
429 uint16_t __addr16 = (uint16_t)(addr); \
430 uint8_t __result; \
431 __asm__ __volatile__ \
432 ( \
433 "lpm %0, Z" "\n\t" \
434 : "=r" (__result) \
435 : "z" (__addr16) \
436 ); \
437 __result; \
438}))
439
440#define __LPM_word_classic__(addr) \
441(__extension__({ \
442 uint16_t __addr16 = (uint16_t)(addr); \
443 uint16_t __result; \
444 __asm__ __volatile__ \
445 ( \
446 "lpm" "\n\t" \
447 "mov %A0, r0" "\n\t" \
448 "adiw r30, 1" "\n\t" \
449 "lpm" "\n\t" \
450 "mov %B0, r0" "\n\t" \
451 : "=r" (__result), "=z" (__addr16) \
452 : "1" (__addr16) \
453 : "r0" \
454 ); \
455 __result; \
456}))
457
458#define __LPM_word_enhanced__(addr) \
459(__extension__({ \
460 uint16_t __addr16 = (uint16_t)(addr); \
461 uint16_t __result; \
462 __asm__ __volatile__ \
463 ( \
464 "lpm %A0, Z+" "\n\t" \
465 "lpm %B0, Z" "\n\t" \
466 : "=r" (__result), "=z" (__addr16) \
467 : "1" (__addr16) \
468 ); \
469 __result; \
470}))
471
472#define __LPM_dword_classic__(addr) \
473(__extension__({ \
474 uint16_t __addr16 = (uint16_t)(addr); \
475 uint32_t __result; \
476 __asm__ __volatile__ \
477 ( \
478 "lpm" "\n\t" \
479 "mov %A0, r0" "\n\t" \
480 "adiw r30, 1" "\n\t" \
481 "lpm" "\n\t" \
482 "mov %B0, r0" "\n\t" \
483 "adiw r30, 1" "\n\t" \
484 "lpm" "\n\t" \
485 "mov %C0, r0" "\n\t" \
486 "adiw r30, 1" "\n\t" \
487 "lpm" "\n\t" \
488 "mov %D0, r0" "\n\t" \
489 : "=r" (__result), "=z" (__addr16) \
490 : "1" (__addr16) \
491 : "r0" \
492 ); \
493 __result; \
494}))
495
496#define __LPM_dword_enhanced__(addr) \
497(__extension__({ \
498 uint16_t __addr16 = (uint16_t)(addr); \
499 uint32_t __result; \
500 __asm__ __volatile__ \
501 ( \
502 "lpm %A0, Z+" "\n\t" \
503 "lpm %B0, Z+" "\n\t" \
504 "lpm %C0, Z+" "\n\t" \
505 "lpm %D0, Z" "\n\t" \
506 : "=r" (__result), "=z" (__addr16) \
507 : "1" (__addr16) \
508 ); \
509 __result; \
510}))
511
512#define __LPM_float_classic__(addr) \
513(__extension__({ \
514 uint16_t __addr16 = (uint16_t)(addr); \
515 float __result; \
516 __asm__ __volatile__ \
517 ( \
518 "lpm" "\n\t" \
519 "mov %A0, r0" "\n\t" \
520 "adiw r30, 1" "\n\t" \
521 "lpm" "\n\t" \
522 "mov %B0, r0" "\n\t" \
523 "adiw r30, 1" "\n\t" \
524 "lpm" "\n\t" \
525 "mov %C0, r0" "\n\t" \
526 "adiw r30, 1" "\n\t" \
527 "lpm" "\n\t" \
528 "mov %D0, r0" "\n\t" \
529 : "=r" (__result), "=z" (__addr16) \
530 : "1" (__addr16) \
531 : "r0" \
532 ); \
533 __result; \
534}))
535
536#define __LPM_float_enhanced__(addr) \
537(__extension__({ \
538 uint16_t __addr16 = (uint16_t)(addr); \
539 float __result; \
540 __asm__ __volatile__ \
541 ( \
542 "lpm %A0, Z+" "\n\t" \
543 "lpm %B0, Z+" "\n\t" \
544 "lpm %C0, Z+" "\n\t" \
545 "lpm %D0, Z" "\n\t" \
546 : "=r" (__result), "=z" (__addr16) \
547 : "1" (__addr16) \
548 ); \
549 __result; \
550}))
551
552#if defined (__AVR_HAVE_LPMX__)
553#define __LPM(addr) __LPM_enhanced__(addr)
554#define __LPM_word(addr) __LPM_word_enhanced__(addr)
555#define __LPM_dword(addr) __LPM_dword_enhanced__(addr)
556#define __LPM_float(addr) __LPM_float_enhanced__(addr)
557#else
558#define __LPM(addr) __LPM_classic__(addr)
559#define __LPM_word(addr) __LPM_word_classic__(addr)
560#define __LPM_dword(addr) __LPM_dword_classic__(addr)
561#define __LPM_float(addr) __LPM_float_classic__(addr)
562#endif
563
564#endif /* !__DOXYGEN__ */
565
566/** \ingroup avr_pgmspace
567 \def pgm_read_byte_near(address_short)
568 Read a byte from the program space with a 16-bit (near) address.
569 \note The address is a byte address.
570 The address is in the program space. */
571
572#define pgm_read_byte_near(address_short) __LPM((uint16_t)(address_short))
573
574/** \ingroup avr_pgmspace
575 \def pgm_read_word_near(address_short)
576 Read a word from the program space with a 16-bit (near) address.
577 \note The address is a byte address.
578 The address is in the program space. */
579
580#define pgm_read_word_near(address_short) __LPM_word((uint16_t)(address_short))
581
582/** \ingroup avr_pgmspace
583 \def pgm_read_dword_near(address_short)
584 Read a double word from the program space with a 16-bit (near) address.
585 \note The address is a byte address.
586 The address is in the program space. */
587
588#define pgm_read_dword_near(address_short) \
589 __LPM_dword((uint16_t)(address_short))
590
591/** \ingroup avr_pgmspace
592 \def pgm_read_float_near(address_short)
593 Read a float from the program space with a 16-bit (near) address.
594 \note The address is a byte address.
595 The address is in the program space. */
596
597#define pgm_read_float_near(address_short) \
598 __LPM_float((uint16_t)(address_short))
599
600/** \ingroup avr_pgmspace
601 \def pgm_read_ptr_near(address_short)
602 Read a pointer from the program space with a 16-bit (near) address.
603 \note The address is a byte address.
604 The address is in the program space. */
605
606#define pgm_read_ptr_near(address_short) \
607 (void*)__LPM_word((uint16_t)(address_short))
608
609#if defined(RAMPZ) || defined(__DOXYGEN__)
610
611/* Only for devices with more than 64K of program memory.
612 RAMPZ must be defined (see iom103.h, iom128.h).
613*/
614
615/* The classic functions are needed for ATmega103. */
616#ifndef __DOXYGEN__ /* These are internal macros, avoid "is
617 not documented" warnings. */
618#define __ELPM_classic__(addr) \
619(__extension__({ \
620 uint32_t __addr32 = (uint32_t)(addr); \
621 uint8_t __result; \
622 __asm__ __volatile__ \
623 ( \
624 "out %2, %C1" "\n\t" \
625 "mov r31, %B1" "\n\t" \
626 "mov r30, %A1" "\n\t" \
627 "elpm" "\n\t" \
628 "mov %0, r0" "\n\t" \
629 : "=r" (__result) \
630 : "r" (__addr32), \
631 "I" (_SFR_IO_ADDR(RAMPZ)) \
632 : "r0", "r30", "r31" \
633 ); \
634 __result; \
635}))
636
637#define __ELPM_enhanced__(addr) \
638(__extension__({ \
639 uint32_t __addr32 = (uint32_t)(addr); \
640 uint8_t __result; \
641 __asm__ __volatile__ \
642 ( \
643 "out %2, %C1" "\n\t" \
644 "movw r30, %1" "\n\t" \
645 "elpm %0, Z+" "\n\t" \
646 : "=r" (__result) \
647 : "r" (__addr32), \
648 "I" (_SFR_IO_ADDR(RAMPZ)) \
649 : "r30", "r31" \
650 ); \
651 __result; \
652}))
653
654#define __ELPM_xmega__(addr) \
655(__extension__({ \
656 uint32_t __addr32 = (uint32_t)(addr); \
657 uint8_t __result; \
658 __asm__ __volatile__ \
659 ( \
660 "in __tmp_reg__, %2" "\n\t" \
661 "out %2, %C1" "\n\t" \
662 "movw r30, %1" "\n\t" \
663 "elpm %0, Z+" "\n\t" \
664 "out %2, __tmp_reg__" \
665 : "=r" (__result) \
666 : "r" (__addr32), \
667 "I" (_SFR_IO_ADDR(RAMPZ)) \
668 : "r30", "r31" \
669 ); \
670 __result; \
671}))
672
673#define __ELPM_word_classic__(addr) \
674(__extension__({ \
675 uint32_t __addr32 = (uint32_t)(addr); \
676 uint16_t __result; \
677 __asm__ __volatile__ \
678 ( \
679 "out %2, %C1" "\n\t" \
680 "mov r31, %B1" "\n\t" \
681 "mov r30, %A1" "\n\t" \
682 "elpm" "\n\t" \
683 "mov %A0, r0" "\n\t" \
684 "in r0, %2" "\n\t" \
685 "adiw r30, 1" "\n\t" \
686 "adc r0, __zero_reg__" "\n\t" \
687 "out %2, r0" "\n\t" \
688 "elpm" "\n\t" \
689 "mov %B0, r0" "\n\t" \
690 : "=r" (__result) \
691 : "r" (__addr32), \
692 "I" (_SFR_IO_ADDR(RAMPZ)) \
693 : "r0", "r30", "r31" \
694 ); \
695 __result; \
696}))
697
698#define __ELPM_word_enhanced__(addr) \
699(__extension__({ \
700 uint32_t __addr32 = (uint32_t)(addr); \
701 uint16_t __result; \
702 __asm__ __volatile__ \
703 ( \
704 "out %2, %C1" "\n\t" \
705 "movw r30, %1" "\n\t" \
706 "elpm %A0, Z+" "\n\t" \
707 "elpm %B0, Z" "\n\t" \
708 : "=r" (__result) \
709 : "r" (__addr32), \
710 "I" (_SFR_IO_ADDR(RAMPZ)) \
711 : "r30", "r31" \
712 ); \
713 __result; \
714}))
715
716#define __ELPM_word_xmega__(addr) \
717(__extension__({ \
718 uint32_t __addr32 = (uint32_t)(addr); \
719 uint16_t __result; \
720 __asm__ __volatile__ \
721 ( \
722 "in __tmp_reg__, %2" "\n\t" \
723 "out %2, %C1" "\n\t" \
724 "movw r30, %1" "\n\t" \
725 "elpm %A0, Z+" "\n\t" \
726 "elpm %B0, Z" "\n\t" \
727 "out %2, __tmp_reg__" \
728 : "=r" (__result) \
729 : "r" (__addr32), \
730 "I" (_SFR_IO_ADDR(RAMPZ)) \
731 : "r30", "r31" \
732 ); \
733 __result; \
734}))
735
736#define __ELPM_dword_classic__(addr) \
737(__extension__({ \
738 uint32_t __addr32 = (uint32_t)(addr); \
739 uint32_t __result; \
740 __asm__ __volatile__ \
741 ( \
742 "out %2, %C1" "\n\t" \
743 "mov r31, %B1" "\n\t" \
744 "mov r30, %A1" "\n\t" \
745 "elpm" "\n\t" \
746 "mov %A0, r0" "\n\t" \
747 "in r0, %2" "\n\t" \
748 "adiw r30, 1" "\n\t" \
749 "adc r0, __zero_reg__" "\n\t" \
750 "out %2, r0" "\n\t" \
751 "elpm" "\n\t" \
752 "mov %B0, r0" "\n\t" \
753 "in r0, %2" "\n\t" \
754 "adiw r30, 1" "\n\t" \
755 "adc r0, __zero_reg__" "\n\t" \
756 "out %2, r0" "\n\t" \
757 "elpm" "\n\t" \
758 "mov %C0, r0" "\n\t" \
759 "in r0, %2" "\n\t" \
760 "adiw r30, 1" "\n\t" \
761 "adc r0, __zero_reg__" "\n\t" \
762 "out %2, r0" "\n\t" \
763 "elpm" "\n\t" \
764 "mov %D0, r0" "\n\t" \
765 : "=r" (__result) \
766 : "r" (__addr32), \
767 "I" (_SFR_IO_ADDR(RAMPZ)) \
768 : "r0", "r30", "r31" \
769 ); \
770 __result; \
771}))
772
773#define __ELPM_dword_enhanced__(addr) \
774(__extension__({ \
775 uint32_t __addr32 = (uint32_t)(addr); \
776 uint32_t __result; \
777 __asm__ __volatile__ \
778 ( \
779 "out %2, %C1" "\n\t" \
780 "movw r30, %1" "\n\t" \
781 "elpm %A0, Z+" "\n\t" \
782 "elpm %B0, Z+" "\n\t" \
783 "elpm %C0, Z+" "\n\t" \
784 "elpm %D0, Z" "\n\t" \
785 : "=r" (__result) \
786 : "r" (__addr32), \
787 "I" (_SFR_IO_ADDR(RAMPZ)) \
788 : "r30", "r31" \
789 ); \
790 __result; \
791}))
792
793#define __ELPM_dword_xmega__(addr) \
794(__extension__({ \
795 uint32_t __addr32 = (uint32_t)(addr); \
796 uint32_t __result; \
797 __asm__ __volatile__ \
798 ( \
799 "in __tmp_reg__, %2" "\n\t" \
800 "out %2, %C1" "\n\t" \
801 "movw r30, %1" "\n\t" \
802 "elpm %A0, Z+" "\n\t" \
803 "elpm %B0, Z+" "\n\t" \
804 "elpm %C0, Z+" "\n\t" \
805 "elpm %D0, Z" "\n\t" \
806 "out %2, __tmp_reg__" \
807 : "=r" (__result) \
808 : "r" (__addr32), \
809 "I" (_SFR_IO_ADDR(RAMPZ)) \
810 : "r30", "r31" \
811 ); \
812 __result; \
813}))
814
815#define __ELPM_float_classic__(addr) \
816(__extension__({ \
817 uint32_t __addr32 = (uint32_t)(addr); \
818 float __result; \
819 __asm__ __volatile__ \
820 ( \
821 "out %2, %C1" "\n\t" \
822 "mov r31, %B1" "\n\t" \
823 "mov r30, %A1" "\n\t" \
824 "elpm" "\n\t" \
825 "mov %A0, r0" "\n\t" \
826 "in r0, %2" "\n\t" \
827 "adiw r30, 1" "\n\t" \
828 "adc r0, __zero_reg__" "\n\t" \
829 "out %2, r0" "\n\t" \
830 "elpm" "\n\t" \
831 "mov %B0, r0" "\n\t" \
832 "in r0, %2" "\n\t" \
833 "adiw r30, 1" "\n\t" \
834 "adc r0, __zero_reg__" "\n\t" \
835 "out %2, r0" "\n\t" \
836 "elpm" "\n\t" \
837 "mov %C0, r0" "\n\t" \
838 "in r0, %2" "\n\t" \
839 "adiw r30, 1" "\n\t" \
840 "adc r0, __zero_reg__" "\n\t" \
841 "out %2, r0" "\n\t" \
842 "elpm" "\n\t" \
843 "mov %D0, r0" "\n\t" \
844 : "=r" (__result) \
845 : "r" (__addr32), \
846 "I" (_SFR_IO_ADDR(RAMPZ)) \
847 : "r0", "r30", "r31" \
848 ); \
849 __result; \
850}))
851
852#define __ELPM_float_enhanced__(addr) \
853(__extension__({ \
854 uint32_t __addr32 = (uint32_t)(addr); \
855 float __result; \
856 __asm__ __volatile__ \
857 ( \
858 "out %2, %C1" "\n\t" \
859 "movw r30, %1" "\n\t" \
860 "elpm %A0, Z+" "\n\t" \
861 "elpm %B0, Z+" "\n\t" \
862 "elpm %C0, Z+" "\n\t" \
863 "elpm %D0, Z" "\n\t" \
864 : "=r" (__result) \
865 : "r" (__addr32), \
866 "I" (_SFR_IO_ADDR(RAMPZ)) \
867 : "r30", "r31" \
868 ); \
869 __result; \
870}))
871
872#define __ELPM_float_xmega__(addr) \
873(__extension__({ \
874 uint32_t __addr32 = (uint32_t)(addr); \
875 float __result; \
876 __asm__ __volatile__ \
877 ( \
878 "in __tmp_reg__, %2" "\n\t" \
879 "out %2, %C1" "\n\t" \
880 "movw r30, %1" "\n\t" \
881 "elpm %A0, Z+" "\n\t" \
882 "elpm %B0, Z+" "\n\t" \
883 "elpm %C0, Z+" "\n\t" \
884 "elpm %D0, Z" "\n\t" \
885 "out %2, __tmp_reg__" \
886 : "=r" (__result) \
887 : "r" (__addr32), \
888 "I" (_SFR_IO_ADDR(RAMPZ)) \
889 : "r30", "r31" \
890 ); \
891 __result; \
892}))
893
894/*
895Check for architectures that implement RAMPD (avrxmega5, avrxmega7)
896as they need to save/restore RAMPZ for ELPM macros so it does
897not interfere with data accesses.
898*/
899#if defined (__AVR_HAVE_RAMPD__)
900
901#define __ELPM(addr) __ELPM_xmega__(addr)
902#define __ELPM_word(addr) __ELPM_word_xmega__(addr)
903#define __ELPM_dword(addr) __ELPM_dword_xmega__(addr)
904#define __ELPM_float(addr) __ELPM_float_xmega__(addr)
905
906#else
907
908#if defined (__AVR_HAVE_LPMX__)
909
910#define __ELPM(addr) __ELPM_enhanced__(addr)
911#define __ELPM_word(addr) __ELPM_word_enhanced__(addr)
912#define __ELPM_dword(addr) __ELPM_dword_enhanced__(addr)
913#define __ELPM_float(addr) __ELPM_float_enhanced__(addr)
914
915#else
916
917#define __ELPM(addr) __ELPM_classic__(addr)
918#define __ELPM_word(addr) __ELPM_word_classic__(addr)
919#define __ELPM_dword(addr) __ELPM_dword_classic__(addr)
920#define __ELPM_float(addr) __ELPM_float_classic__(addr)
921
922#endif /* __AVR_HAVE_LPMX__ */
923
924#endif /* __AVR_HAVE_RAMPD__ */
925
926#endif /* !__DOXYGEN__ */
927
928/** \ingroup avr_pgmspace
929 \def pgm_read_byte_far(address_long)
930 Read a byte from the program space with a 32-bit (far) address.
931
932 \note The address is a byte address.
933 The address is in the program space. */
934
935#define pgm_read_byte_far(address_long) __ELPM((uint32_t)(address_long))
936
937/** \ingroup avr_pgmspace
938 \def pgm_read_word_far(address_long)
939 Read a word from the program space with a 32-bit (far) address.
940
941 \note The address is a byte address.
942 The address is in the program space. */
943
944#define pgm_read_word_far(address_long) __ELPM_word((uint32_t)(address_long))
945
946/** \ingroup avr_pgmspace
947 \def pgm_read_dword_far(address_long)
948 Read a double word from the program space with a 32-bit (far) address.
949
950 \note The address is a byte address.
951 The address is in the program space. */
952
953#define pgm_read_dword_far(address_long) __ELPM_dword((uint32_t)(address_long))
954
955/** \ingroup avr_pgmspace
956 \def pgm_read_float_far(address_long)
957 Read a float from the program space with a 32-bit (far) address.
958
959 \note The address is a byte address.
960 The address is in the program space. */
961
962#define pgm_read_float_far(address_long) __ELPM_float((uint32_t)(address_long))
963
964/** \ingroup avr_pgmspace
965 \def pgm_read_ptr_far(address_long)
966 Read a pointer from the program space with a 32-bit (far) address.
967
968 \note The address is a byte address.
969 The address is in the program space. */
970
971#define pgm_read_ptr_far(address_long) (void*)__ELPM_word((uint32_t)(address_long))
972
973#endif /* RAMPZ or __DOXYGEN__ */
974
975/** \ingroup avr_pgmspace
976 \def pgm_read_byte(address_short)
977 Read a byte from the program space with a 16-bit (near) address.
978
979 \note The address is a byte address.
980 The address is in the program space. */
981
982#define pgm_read_byte(address_short) pgm_read_byte_near(address_short)
983
984/** \ingroup avr_pgmspace
985 \def pgm_read_word(address_short)
986 Read a word from the program space with a 16-bit (near) address.
987
988 \note The address is a byte address.
989 The address is in the program space. */
990
991#define pgm_read_word(address_short) pgm_read_word_near(address_short)
992
993/** \ingroup avr_pgmspace
994 \def pgm_read_dword(address_short)
995 Read a double word from the program space with a 16-bit (near) address.
996
997 \note The address is a byte address.
998 The address is in the program space. */
999
1000#define pgm_read_dword(address_short) pgm_read_dword_near(address_short)
1001
1002/** \ingroup avr_pgmspace
1003 \def pgm_read_float(address_short)
1004 Read a float from the program space with a 16-bit (near) address.
1005
1006 \note The address is a byte address.
1007 The address is in the program space. */
1008
1009#define pgm_read_float(address_short) pgm_read_float_near(address_short)
1010
1011/** \ingroup avr_pgmspace
1012 \def pgm_read_ptr(address_short)
1013 Read a pointer from the program space with a 16-bit (near) address.
1014
1015 \note The address is a byte address.
1016 The address is in the program space. */
1017
1018#define pgm_read_ptr(address_short) pgm_read_ptr_near(address_short)
1019
1020/** \ingroup avr_pgmspace
1021 \def pgm_get_far_address(var)
1022
1023 This macro facilitates the obtention of a 32 bit "far" pointer (only 24 bits
1024 used) to data even passed the 64KB limit for the 16 bit ordinary pointer. It
1025 is similar to the '&' operator, with some limitations.
1026
1027 Comments:
1028
1029 - The overhead is minimal and it's mainly due to the 32 bit size operation.
1030
1031 - 24 bit sizes guarantees the code compatibility for use in future devices.
1032
1033 - hh8() is an undocumented feature but seems to give the third significant byte
1034 of a 32 bit data and accepts symbols, complementing the functionality of hi8()
1035 and lo8(). There is not an equivalent assembler function to get the high
1036 significant byte.
1037
1038 - 'var' has to be resolved at linking time as an existing symbol, i.e, a simple
1039 type variable name, an array name (not an indexed element of the array, if the
1040 index is a constant the compiler does not complain but fails to get the address
1041 if optimization is enabled), a struct name or a struct field name, a function
1042 identifier, a linker defined identifier,...
1043
1044 - The returned value is the identifier's VMA (virtual memory address) determined
1045 by the linker and falls in the corresponding memory region. The AVR Harvard
1046 architecture requires non overlapping VMA areas for the multiple address spaces
1047 in the processor: Flash ROM, RAM, and EEPROM. Typical offset for this are
1048 0x00000000, 0x00800xx0, and 0x00810000 respectively, derived from the linker
1049 script used and linker options. The value returned can be seen then as a
1050 universal pointer.
1051*/
1052
1053#define pgm_get_far_address(var) \
1054({ \
1055 uint_farptr_t tmp; \
1056 \
1057 __asm__ __volatile__( \
1058 \
1059 "ldi %A0, lo8(%1)" "\n\t" \
1060 "ldi %B0, hi8(%1)" "\n\t" \
1061 "ldi %C0, hh8(%1)" "\n\t" \
1062 "clr %D0" "\n\t" \
1063 : \
1064 "=d" (tmp) \
1065 : \
1066 "p" (&(var)) \
1067 ); \
1068 tmp; \
1069})
1070
1071
1072
1073/** \ingroup avr_pgmspace
1074 \fn const void * memchr_P(const void *s, int val, size_t len)
1075 \brief Scan flash memory for a character.
1076
1077 The memchr_P() function scans the first \p len bytes of the flash
1078 memory area pointed to by \p s for the character \p val. The first
1079 byte to match \p val (interpreted as an unsigned character) stops
1080 the operation.
1081
1082 \return The memchr_P() function returns a pointer to the matching
1083 byte or \c NULL if the character does not occur in the given memory
1084 area. */
1085extern const void * memchr_P(const void *, int __val, size_t __len) __ATTR_CONST__;
1086
1087/** \ingroup avr_pgmspace
1088 \fn int memcmp_P(const void *s1, const void *s2, size_t len)
1089 \brief Compare memory areas
1090
1091 The memcmp_P() function compares the first \p len bytes of the memory
1092 areas \p s1 and flash \p s2. The comparision is performed using unsigned
1093 char operations.
1094
1095 \returns The memcmp_P() function returns an integer less than, equal
1096 to, or greater than zero if the first \p len bytes of \p s1 is found,
1097 respectively, to be less than, to match, or be greater than the first
1098 \p len bytes of \p s2. */
1099extern int memcmp_P(const void *, const void *, size_t) __ATTR_PURE__;
1100
1101/** \ingroup avr_pgmspace
1102 \fn void *memccpy_P (void *dest, const void *src, int val, size_t len)
1103
1104 This function is similar to memccpy() except that \p src is pointer
1105 to a string in program space. */
1106extern void *memccpy_P(void *, const void *, int __val, size_t);
1107
1108/** \ingroup avr_pgmspace
1109 \fn void *memcpy_P(void *dest, const void *src, size_t n)
1110
1111 The memcpy_P() function is similar to memcpy(), except the src string
1112 resides in program space.
1113
1114 \returns The memcpy_P() function returns a pointer to dest. */
1115extern void *memcpy_P(void *, const void *, size_t);
1116
1117/** \ingroup avr_pgmspace
1118 \fn void *memmem_P(const void *s1, size_t len1, const void *s2, size_t len2)
1119
1120 The memmem_P() function is similar to memmem() except that \p s2 is
1121 pointer to a string in program space. */
1122extern void *memmem_P(const void *, size_t, const void *, size_t) __ATTR_PURE__;
1123
1124/** \ingroup avr_pgmspace
1125 \fn const void +memrchr_P(const void *src, int val, size_t len)
1126
1127 The memrchr_P() function is like the memchr_P() function, except
1128 that it searches backwards from the end of the \p len bytes pointed
1129 to by \p src instead of forwards from the front. (Glibc, GNU extension.)
1130
1131 \return The memrchr_P() function returns a pointer to the matching
1132 byte or \c NULL if the character does not occur in the given memory
1133 area. */
1134extern const void * memrchr_P(const void *, int __val, size_t __len) __ATTR_CONST__;
1135
1136/** \ingroup avr_pgmspace
1137 \fn char *strcat_P(char *dest, const char *src)
1138
1139 The strcat_P() function is similar to strcat() except that the \e src
1140 string must be located in program space (flash).
1141
1142 \returns The strcat() function returns a pointer to the resulting string
1143 \e dest. */
1144extern char *strcat_P(char *, const char *);
1145
1146/** \ingroup avr_pgmspace
1147 \fn const char *strchr_P(const char *s, int val)
1148 \brief Locate character in program space string.
1149
1150 The strchr_P() function locates the first occurrence of \p val
1151 (converted to a char) in the string pointed to by \p s in program
1152 space. The terminating null character is considered to be part of
1153 the string.
1154
1155 The strchr_P() function is similar to strchr() except that \p s is
1156 pointer to a string in program space.
1157
1158 \returns The strchr_P() function returns a pointer to the matched
1159 character or \c NULL if the character is not found. */
1160extern const char * strchr_P(const char *, int __val) __ATTR_CONST__;
1161
1162/** \ingroup avr_pgmspace
1163 \fn const char *strchrnul_P(const char *s, int c)
1164
1165 The strchrnul_P() function is like strchr_P() except that if \p c is
1166 not found in \p s, then it returns a pointer to the null byte at the
1167 end of \p s, rather than \c NULL. (Glibc, GNU extension.)
1168
1169 \return The strchrnul_P() function returns a pointer to the matched
1170 character, or a pointer to the null byte at the end of \p s (i.e.,
1171 \c s+strlen(s)) if the character is not found. */
1172extern const char * strchrnul_P(const char *, int __val) __ATTR_CONST__;
1173
1174/** \ingroup avr_pgmspace
1175 \fn int strcmp_P(const char *s1, const char *s2)
1176
1177 The strcmp_P() function is similar to strcmp() except that \p s2 is
1178 pointer to a string in program space.
1179
1180 \returns The strcmp_P() function returns an integer less than, equal
1181 to, or greater than zero if \p s1 is found, respectively, to be less
1182 than, to match, or be greater than \p s2. A consequence of the
1183 ordering used by strcmp_P() is that if \p s1 is an initial substring
1184 of \p s2, then \p s1 is considered to be "less than" \p s2. */
1185extern int strcmp_P(const char *, const char *) __ATTR_PURE__;
1186
1187/** \ingroup avr_pgmspace
1188 \fn char *strcpy_P(char *dest, const char *src)
1189
1190 The strcpy_P() function is similar to strcpy() except that src is a
1191 pointer to a string in program space.
1192
1193 \returns The strcpy_P() function returns a pointer to the destination
1194 string dest. */
1195extern char *strcpy_P(char *, const char *);
1196
1197/** \ingroup avr_pgmspace
1198 \fn int strcasecmp_P(const char *s1, const char *s2)
1199 \brief Compare two strings ignoring case.
1200
1201 The strcasecmp_P() function compares the two strings \p s1 and \p s2,
1202 ignoring the case of the characters.
1203
1204 \param s1 A pointer to a string in the devices SRAM.
1205 \param s2 A pointer to a string in the devices Flash.
1206
1207 \returns The strcasecmp_P() function returns an integer less than,
1208 equal to, or greater than zero if \p s1 is found, respectively, to
1209 be less than, to match, or be greater than \p s2. A consequence of
1210 the ordering used by strcasecmp_P() is that if \p s1 is an initial
1211 substring of \p s2, then \p s1 is considered to be "less than" \p s2. */
1212extern int strcasecmp_P(const char *, const char *) __ATTR_PURE__;
1213
1214/** \ingroup avr_pgmspace
1215 \fn char *strcasestr_P(const char *s1, const char *s2)
1216
1217 This funtion is similar to strcasestr() except that \p s2 is pointer
1218 to a string in program space. */
1219extern char *strcasestr_P(const char *, const char *) __ATTR_PURE__;
1220
1221/** \ingroup avr_pgmspace
1222 \fn size_t strcspn_P(const char *s, const char *reject)
1223
1224 The strcspn_P() function calculates the length of the initial segment
1225 of \p s which consists entirely of characters not in \p reject. This
1226 function is similar to strcspn() except that \p reject is a pointer
1227 to a string in program space.
1228
1229 \return The strcspn_P() function returns the number of characters in
1230 the initial segment of \p s which are not in the string \p reject.
1231 The terminating zero is not considered as a part of string. */
1232extern size_t strcspn_P(const char *__s, const char * __reject) __ATTR_PURE__;
1233
1234/** \ingroup avr_pgmspace
1235 \fn size_t strlcat_P(char *dst, const char *src, size_t siz)
1236 \brief Concatenate two strings.
1237
1238 The strlcat_P() function is similar to strlcat(), except that the \p src
1239 string must be located in program space (flash).
1240
1241 Appends \p src to string \p dst of size \p siz (unlike strncat(),
1242 \p siz is the full size of \p dst, not space left). At most \p siz-1
1243 characters will be copied. Always NULL terminates (unless \p siz <=
1244 \p strlen(dst)).
1245
1246 \returns The strlcat_P() function returns strlen(src) + MIN(siz,
1247 strlen(initial dst)). If retval >= siz, truncation occurred. */
1248extern size_t strlcat_P (char *, const char *, size_t );
1249
1250/** \ingroup avr_pgmspace
1251 \fn size_t strlcpy_P(char *dst, const char *src, size_t siz)
1252 \brief Copy a string from progmem to RAM.
1253
1254 Copy \p src to string \p dst of size \p siz. At most \p siz-1
1255 characters will be copied. Always NULL terminates (unless \p siz == 0).
1256 The strlcpy_P() function is similar to strlcpy() except that the
1257 \p src is pointer to a string in memory space.
1258
1259 \returns The strlcpy_P() function returns strlen(src). If
1260 retval >= siz, truncation occurred. */
1261extern size_t strlcpy_P (char *, const char *, size_t );
1262
1263/** \ingroup avr_pgmspace
1264 \fn size_t strnlen_P(const char *src, size_t len)
1265 \brief Determine the length of a fixed-size string.
1266
1267 The strnlen_P() function is similar to strnlen(), except that \c src is a
1268 pointer to a string in program space.
1269
1270 \returns The strnlen_P function returns strlen_P(src), if that is less than
1271 \c len, or \c len if there is no '\\0' character among the first \c len
1272 characters pointed to by \c src. */
1273extern size_t strnlen_P(const char *, size_t) __ATTR_CONST__; /* program memory can't change */
1274
1275/** \ingroup avr_pgmspace
1276 \fn int strncmp_P(const char *s1, const char *s2, size_t n)
1277
1278 The strncmp_P() function is similar to strcmp_P() except it only compares
1279 the first (at most) n characters of s1 and s2.
1280
1281 \returns The strncmp_P() function returns an integer less than, equal to,
1282 or greater than zero if s1 (or the first n bytes thereof) is found,
1283 respectively, to be less than, to match, or be greater than s2. */
1284extern int strncmp_P(const char *, const char *, size_t) __ATTR_PURE__;
1285
1286/** \ingroup avr_pgmspace
1287 \fn int strncasecmp_P(const char *s1, const char *s2, size_t n)
1288 \brief Compare two strings ignoring case.
1289
1290 The strncasecmp_P() function is similar to strcasecmp_P(), except it
1291 only compares the first \p n characters of \p s1.
1292
1293 \param s1 A pointer to a string in the devices SRAM.
1294 \param s2 A pointer to a string in the devices Flash.
1295 \param n The maximum number of bytes to compare.
1296
1297 \returns The strncasecmp_P() function returns an integer less than,
1298 equal to, or greater than zero if \p s1 (or the first \p n bytes
1299 thereof) is found, respectively, to be less than, to match, or be
1300 greater than \p s2. A consequence of the ordering used by
1301 strncasecmp_P() is that if \p s1 is an initial substring of \p s2,
1302 then \p s1 is considered to be "less than" \p s2. */
1303extern int strncasecmp_P(const char *, const char *, size_t) __ATTR_PURE__;
1304
1305/** \ingroup avr_pgmspace
1306 \fn char *strncat_P(char *dest, const char *src, size_t len)
1307 \brief Concatenate two strings.
1308
1309 The strncat_P() function is similar to strncat(), except that the \e src
1310 string must be located in program space (flash).
1311
1312 \returns The strncat_P() function returns a pointer to the resulting string
1313 dest. */
1314extern char *strncat_P(char *, const char *, size_t);
1315
1316/** \ingroup avr_pgmspace
1317 \fn char *strncpy_P(char *dest, const char *src, size_t n)
1318
1319 The strncpy_P() function is similar to strcpy_P() except that not more
1320 than n bytes of src are copied. Thus, if there is no null byte among the
1321 first n bytes of src, the result will not be null-terminated.
1322
1323 In the case where the length of src is less than that of n, the remainder
1324 of dest will be padded with nulls.
1325
1326 \returns The strncpy_P() function returns a pointer to the destination
1327 string dest. */
1328extern char *strncpy_P(char *, const char *, size_t);
1329
1330/** \ingroup avr_pgmspace
1331 \fn char *strpbrk_P(const char *s, const char *accept)
1332
1333 The strpbrk_P() function locates the first occurrence in the string
1334 \p s of any of the characters in the flash string \p accept. This
1335 function is similar to strpbrk() except that \p accept is a pointer
1336 to a string in program space.
1337
1338 \return The strpbrk_P() function returns a pointer to the character
1339 in \p s that matches one of the characters in \p accept, or \c NULL
1340 if no such character is found. The terminating zero is not considered
1341 as a part of string: if one or both args are empty, the result will
1342 \c NULL. */
1343extern char *strpbrk_P(const char *__s, const char * __accept) __ATTR_PURE__;
1344
1345/** \ingroup avr_pgmspace
1346 \fn const char *strrchr_P(const char *s, int val)
1347 \brief Locate character in string.
1348
1349 The strrchr_P() function returns a pointer to the last occurrence of
1350 the character \p val in the flash string \p s.
1351
1352 \return The strrchr_P() function returns a pointer to the matched
1353 character or \c NULL if the character is not found. */
1354extern const char * strrchr_P(const char *, int __val) __ATTR_CONST__;
1355
1356/** \ingroup avr_pgmspace
1357 \fn char *strsep_P(char **sp, const char *delim)
1358 \brief Parse a string into tokens.
1359
1360 The strsep_P() function locates, in the string referenced by \p *sp,
1361 the first occurrence of any character in the string \p delim (or the
1362 terminating '\\0' character) and replaces it with a '\\0'. The
1363 location of the next character after the delimiter character (or \c
1364 NULL, if the end of the string was reached) is stored in \p *sp. An
1365 ``empty'' field, i.e. one caused by two adjacent delimiter
1366 characters, can be detected by comparing the location referenced by
1367 the pointer returned in \p *sp to '\\0'. This function is similar to
1368 strsep() except that \p delim is a pointer to a string in program
1369 space.
1370
1371 \return The strsep_P() function returns a pointer to the original
1372 value of \p *sp. If \p *sp is initially \c NULL, strsep_P() returns
1373 \c NULL. */
1374extern char *strsep_P(char **__sp, const char * __delim);
1375
1376/** \ingroup avr_pgmspace
1377 \fn size_t strspn_P(const char *s, const char *accept)
1378
1379 The strspn_P() function calculates the length of the initial segment
1380 of \p s which consists entirely of characters in \p accept. This
1381 function is similar to strspn() except that \p accept is a pointer
1382 to a string in program space.
1383
1384 \return The strspn_P() function returns the number of characters in
1385 the initial segment of \p s which consist only of characters from \p
1386 accept. The terminating zero is not considered as a part of string. */
1387extern size_t strspn_P(const char *__s, const char * __accept) __ATTR_PURE__;
1388
1389/** \ingroup avr_pgmspace
1390 \fn char *strstr_P(const char *s1, const char *s2)
1391 \brief Locate a substring.
1392
1393 The strstr_P() function finds the first occurrence of the substring
1394 \p s2 in the string \p s1. The terminating '\\0' characters are not
1395 compared. The strstr_P() function is similar to strstr() except that
1396 \p s2 is pointer to a string in program space.
1397
1398 \returns The strstr_P() function returns a pointer to the beginning
1399 of the substring, or NULL if the substring is not found. If \p s2
1400 points to a string of zero length, the function returns \p s1. */
1401extern char *strstr_P(const char *, const char *) __ATTR_PURE__;
1402
1403/** \ingroup avr_pgmspace
1404 \fn char *strtok_P(char *s, const char * delim)
1405 \brief Parses the string into tokens.
1406
1407 strtok_P() parses the string \p s into tokens. The first call to
1408 strtok_P() should have \p s as its first argument. Subsequent calls
1409 should have the first argument set to NULL. If a token ends with a
1410 delimiter, this delimiting character is overwritten with a '\\0' and a
1411 pointer to the next character is saved for the next call to strtok_P().
1412 The delimiter string \p delim may be different for each call.
1413
1414 The strtok_P() function is similar to strtok() except that \p delim
1415 is pointer to a string in program space.
1416
1417 \returns The strtok_P() function returns a pointer to the next token or
1418 NULL when no more tokens are found.
1419
1420 \note strtok_P() is NOT reentrant. For a reentrant version of this
1421 function see strtok_rP().
1422 */
1423extern char *strtok_P(char *__s, const char * __delim);
1424
1425/** \ingroup avr_pgmspace
1426 \fn char *strtok_rP (char *string, const char *delim, char **last)
1427 \brief Parses string into tokens.
1428
1429 The strtok_rP() function parses \p string into tokens. The first call to
1430 strtok_rP() should have string as its first argument. Subsequent calls
1431 should have the first argument set to NULL. If a token ends with a
1432 delimiter, this delimiting character is overwritten with a '\\0' and a
1433 pointer to the next character is saved for the next call to strtok_rP().
1434 The delimiter string \p delim may be different for each call. \p last is
1435 a user allocated char* pointer. It must be the same while parsing the
1436 same string. strtok_rP() is a reentrant version of strtok_P().
1437
1438 The strtok_rP() function is similar to strtok_r() except that \p delim
1439 is pointer to a string in program space.
1440
1441 \returns The strtok_rP() function returns a pointer to the next token or
1442 NULL when no more tokens are found. */
1443extern char *strtok_rP(char *__s, const char * __delim, char **__last);
1444
1445/** \ingroup avr_pgmspace
1446 \fn size_t strlen_PF(uint_farptr_t s)
1447 \brief Obtain the length of a string
1448
1449 The strlen_PF() function is similar to strlen(), except that \e s is a
1450 far pointer to a string in program space.
1451
1452 \param s A far pointer to the string in flash
1453
1454 \returns The strlen_PF() function returns the number of characters in
1455 \e s. The contents of RAMPZ SFR are undefined when the function returns. */
1456extern size_t strlen_PF(uint_farptr_t src) __ATTR_CONST__; /* program memory can't change */
1457
1458/** \ingroup avr_pgmspace
1459 \fn size_t strnlen_PF(uint_farptr_t s, size_t len)
1460 \brief Determine the length of a fixed-size string
1461
1462 The strnlen_PF() function is similar to strnlen(), except that \e s is a
1463 far pointer to a string in program space.
1464
1465 \param s A far pointer to the string in Flash
1466 \param len The maximum number of length to return
1467
1468 \returns The strnlen_PF function returns strlen_P(\e s), if that is less
1469 than \e len, or \e len if there is no '\\0' character among the first \e
1470 len characters pointed to by \e s. The contents of RAMPZ SFR are
1471 undefined when the function returns. */
1472extern size_t strnlen_PF(uint_farptr_t src, size_t len) __ATTR_CONST__; /* program memory can't change */
1473
1474/** \ingroup avr_pgmspace
1475 \fn void *memcpy_PF(void *dest, uint_farptr_t src, size_t n)
1476 \brief Copy a memory block from flash to SRAM
1477
1478 The memcpy_PF() function is similar to memcpy(), except the data
1479 is copied from the program space and is addressed using a far pointer.
1480
1481 \param dest A pointer to the destination buffer
1482 \param src A far pointer to the origin of data in flash memory
1483 \param n The number of bytes to be copied
1484
1485 \returns The memcpy_PF() function returns a pointer to \e dst. The contents
1486 of RAMPZ SFR are undefined when the function returns. */
1487extern void *memcpy_PF(void *dest, uint_farptr_t src, size_t len);
1488
1489/** \ingroup avr_pgmspace
1490 \fn char *strcpy_PF(char *dst, uint_farptr_t src)
1491 \brief Duplicate a string
1492
1493 The strcpy_PF() function is similar to strcpy() except that \e src is a far
1494 pointer to a string in program space.
1495
1496 \param dst A pointer to the destination string in SRAM
1497 \param src A far pointer to the source string in Flash
1498
1499 \returns The strcpy_PF() function returns a pointer to the destination
1500 string \e dst. The contents of RAMPZ SFR are undefined when the funcion
1501 returns. */
1502extern char *strcpy_PF(char *dest, uint_farptr_t src);
1503
1504/** \ingroup avr_pgmspace
1505 \fn char *strncpy_PF(char *dst, uint_farptr_t src, size_t n)
1506 \brief Duplicate a string until a limited length
1507
1508 The strncpy_PF() function is similar to strcpy_PF() except that not more
1509 than \e n bytes of \e src are copied. Thus, if there is no null byte among
1510 the first \e n bytes of \e src, the result will not be null-terminated.
1511
1512 In the case where the length of \e src is less than that of \e n, the
1513 remainder of \e dst will be padded with nulls.
1514
1515 \param dst A pointer to the destination string in SRAM
1516 \param src A far pointer to the source string in Flash
1517 \param n The maximum number of bytes to copy
1518
1519 \returns The strncpy_PF() function returns a pointer to the destination
1520 string \e dst. The contents of RAMPZ SFR are undefined when the function
1521 returns. */
1522extern char *strncpy_PF(char *dest, uint_farptr_t src, size_t len);
1523
1524/** \ingroup avr_pgmspace
1525 \fn char *strcat_PF(char *dst, uint_farptr_t src)
1526 \brief Concatenates two strings
1527
1528 The strcat_PF() function is similar to strcat() except that the \e src
1529 string must be located in program space (flash) and is addressed using
1530 a far pointer
1531
1532 \param dst A pointer to the destination string in SRAM
1533 \param src A far pointer to the string to be appended in Flash
1534
1535 \returns The strcat_PF() function returns a pointer to the resulting
1536 string \e dst. The contents of RAMPZ SFR are undefined when the function
1537 returns */
1538extern char *strcat_PF(char *dest, uint_farptr_t src);
1539
1540/** \ingroup avr_pgmspace
1541 \fn size_t strlcat_PF(char *dst, uint_farptr_t src, size_t n)
1542 \brief Concatenate two strings
1543
1544 The strlcat_PF() function is similar to strlcat(), except that the \e src
1545 string must be located in program space (flash) and is addressed using
1546 a far pointer.
1547
1548 Appends src to string dst of size \e n (unlike strncat(), \e n is the
1549 full size of \e dst, not space left). At most \e n-1 characters
1550 will be copied. Always NULL terminates (unless \e n <= strlen(\e dst)).
1551
1552 \param dst A pointer to the destination string in SRAM
1553 \param src A far pointer to the source string in Flash
1554 \param n The total number of bytes allocated to the destination string
1555
1556 \returns The strlcat_PF() function returns strlen(\e src) + MIN(\e n,
1557 strlen(initial \e dst)). If retval >= \e n, truncation occurred. The
1558 contents of RAMPZ SFR are undefined when the funcion returns. */
1559extern size_t strlcat_PF(char *dst, uint_farptr_t src, size_t siz);
1560
1561/** \ingroup avr_pgmspace
1562 \fn char *strncat_PF(char *dst, uint_farptr_t src, size_t n)
1563 \brief Concatenate two strings
1564
1565 The strncat_PF() function is similar to strncat(), except that the \e src
1566 string must be located in program space (flash) and is addressed using a
1567 far pointer.
1568
1569 \param dst A pointer to the destination string in SRAM
1570 \param src A far pointer to the source string in Flash
1571 \param n The maximum number of bytes to append
1572
1573 \returns The strncat_PF() function returns a pointer to the resulting
1574 string \e dst. The contents of RAMPZ SFR are undefined when the function
1575 returns. */
1576extern char *strncat_PF(char *dest, uint_farptr_t src, size_t len);
1577
1578/** \ingroup avr_pgmspace
1579 \fn int strcmp_PF(const char *s1, uint_farptr_t s2)
1580 \brief Compares two strings
1581
1582 The strcmp_PF() function is similar to strcmp() except that \e s2 is a far
1583 pointer to a string in program space.
1584
1585 \param s1 A pointer to the first string in SRAM
1586 \param s2 A far pointer to the second string in Flash
1587
1588 \returns The strcmp_PF() function returns an integer less than, equal to,
1589 or greater than zero if \e s1 is found, respectively, to be less than, to
1590 match, or be greater than \e s2. The contents of RAMPZ SFR are undefined
1591 when the function returns. */
1592extern int strcmp_PF(const char *s1, uint_farptr_t s2) __ATTR_PURE__;
1593
1594/** \ingroup avr_pgmspace
1595 \fn int strncmp_PF(const char *s1, uint_farptr_t s2, size_t n)
1596 \brief Compare two strings with limited length
1597
1598 The strncmp_PF() function is similar to strcmp_PF() except it only
1599 compares the first (at most) \e n characters of \e s1 and \e s2.
1600
1601 \param s1 A pointer to the first string in SRAM
1602 \param s2 A far pointer to the second string in Flash
1603 \param n The maximum number of bytes to compare
1604
1605 \returns The strncmp_PF() function returns an integer less than, equal
1606 to, or greater than zero if \e s1 (or the first \e n bytes thereof) is found,
1607 respectively, to be less than, to match, or be greater than \e s2. The
1608 contents of RAMPZ SFR are undefined when the function returns. */
1609extern int strncmp_PF(const char *s1, uint_farptr_t s2, size_t n) __ATTR_PURE__;
1610
1611/** \ingroup avr_pgmspace
1612 \fn int strcasecmp_PF(const char *s1, uint_farptr_t s2)
1613 \brief Compare two strings ignoring case
1614
1615 The strcasecmp_PF() function compares the two strings \e s1 and \e s2, ignoring
1616 the case of the characters.
1617
1618 \param s1 A pointer to the first string in SRAM
1619 \param s2 A far pointer to the second string in Flash
1620
1621 \returns The strcasecmp_PF() function returns an integer less than, equal
1622 to, or greater than zero if \e s1 is found, respectively, to be less than, to
1623 match, or be greater than \e s2. The contents of RAMPZ SFR are undefined
1624 when the function returns. */
1625extern int strcasecmp_PF(const char *s1, uint_farptr_t s2) __ATTR_PURE__;
1626
1627/** \ingroup avr_pgmspace
1628 \fn int strncasecmp_PF(const char *s1, uint_farptr_t s2, size_t n)
1629 \brief Compare two strings ignoring case
1630
1631 The strncasecmp_PF() function is similar to strcasecmp_PF(), except it
1632 only compares the first \e n characters of \e s1 and the string in flash is
1633 addressed using a far pointer.
1634
1635 \param s1 A pointer to a string in SRAM
1636 \param s2 A far pointer to a string in Flash
1637 \param n The maximum number of bytes to compare
1638
1639 \returns The strncasecmp_PF() function returns an integer less than, equal
1640 to, or greater than zero if \e s1 (or the first \e n bytes thereof) is found,
1641 respectively, to be less than, to match, or be greater than \e s2. The
1642 contents of RAMPZ SFR are undefined when the function returns. */
1643extern int strncasecmp_PF(const char *s1, uint_farptr_t s2, size_t n) __ATTR_PURE__;
1644
1645/** \ingroup avr_pgmspace
1646 \fn char *strstr_PF(const char *s1, uint_farptr_t s2)
1647 \brief Locate a substring.
1648
1649 The strstr_PF() function finds the first occurrence of the substring \c s2
1650 in the string \c s1. The terminating '\\0' characters are not
1651 compared.
1652 The strstr_PF() function is similar to strstr() except that \c s2 is a
1653 far pointer to a string in program space.
1654
1655 \returns The strstr_PF() function returns a pointer to the beginning of the
1656 substring, or NULL if the substring is not found.
1657 If \c s2 points to a string of zero length, the function returns \c s1. The
1658 contents of RAMPZ SFR are undefined when the function returns. */
1659extern char *strstr_PF(const char *s1, uint_farptr_t s2);
1660
1661/** \ingroup avr_pgmspace
1662 \fn size_t strlcpy_PF(char *dst, uint_farptr_t src, size_t siz)
1663 \brief Copy a string from progmem to RAM.
1664
1665 Copy src to string dst of size siz. At most siz-1 characters will be
1666 copied. Always NULL terminates (unless siz == 0).
1667
1668 \returns The strlcpy_PF() function returns strlen(src). If retval >= siz,
1669 truncation occurred. The contents of RAMPZ SFR are undefined when the
1670 function returns. */
1671extern size_t strlcpy_PF(char *dst, uint_farptr_t src, size_t siz);
1672
1673/** \ingroup avr_pgmspace
1674 \fn int memcmp_PF(const void *s1, uint_farptr_t s2, size_t len)
1675 \brief Compare memory areas
1676
1677 The memcmp_PF() function compares the first \p len bytes of the memory
1678 areas \p s1 and flash \p s2. The comparision is performed using unsigned
1679 char operations. It is an equivalent of memcmp_P() function, except
1680 that it is capable working on all FLASH including the exteded area
1681 above 64kB.
1682
1683 \returns The memcmp_PF() function returns an integer less than, equal
1684 to, or greater than zero if the first \p len bytes of \p s1 is found,
1685 respectively, to be less than, to match, or be greater than the first
1686 \p len bytes of \p s2. */
1687extern int memcmp_PF(const void *, uint_farptr_t, size_t) __ATTR_PURE__;
1688
1689#ifdef __DOXYGEN__
1690/** \ingroup avr_pgmspace
1691 \fn size_t strlen_P(const char *src)
1692
1693 The strlen_P() function is similar to strlen(), except that src is a
1694 pointer to a string in program space.
1695
1696 \returns The strlen_P() function returns the number of characters in src.
1697
1698 \note strlen_P() is implemented as an inline function in the avr/pgmspace.h
1699 header file, which will check if the length of the string is a constant
1700 and known at compile time. If it is not known at compile time, the macro
1701 will issue a call to __strlen_P() which will then calculate the length
1702 of the string as normal.
1703*/
1704static inline size_t strlen_P(const char * s);
1705#else
1706extern size_t __strlen_P(const char *) __ATTR_CONST__; /* internal helper function */
1707__attribute__((__always_inline__)) static __inline__ size_t strlen_P(const char * s);
1708static __inline__ size_t strlen_P(const char *s) {
1709 return __builtin_constant_p(__builtin_strlen(s))
1710 ? __builtin_strlen(s) : __strlen_P(s);
1711}
1712#endif
1713
1714#ifdef __cplusplus
1715}
1716#endif
1717
1718#endif /* __PGMSPACE_H_ */
uint32_t uint_farptr_t
Definition: inttypes.h:81
char * strstr_PF(const char *s1, uint_farptr_t s2)
Locate a substring.
int strncasecmp_PF(const char *s1, uint_farptr_t s2, size_t n) __ATTR_PURE__
Compare two strings ignoring case.
const char * strchrnul_P(const char *, int __val)
const char * strchr_P(const char *, int __val)
Locate character in program space string.
void * memcpy_PF(void *dest, uint_farptr_t src, size_t len)
Copy a memory block from flash to SRAM.
char * strsep_P(char **__sp, const char *__delim)
Parse a string into tokens.
char * strncpy_P(char *, const char *, size_t)
int strncmp_P(const char *, const char *, size_t) __ATTR_PURE__
int strcasecmp_PF(const char *s1, uint_farptr_t s2) __ATTR_PURE__
Compare two strings ignoring case.
uint32_t PROGMEM prog_uint32_t
Definition: pgmspace.h:288
int strncmp_PF(const char *s1, uint_farptr_t s2, size_t n) __ATTR_PURE__
Compare two strings with limited length.
uint8_t PROGMEM prog_uint8_t
Definition: pgmspace.h:216
const void * memchr_P(const void *, int __val, size_t __len)
Scan flash memory for a character.
void * memccpy_P(void *, const void *, int __val, size_t)
int8_t PROGMEM prog_int8_t
Definition: pgmspace.h:198
char * strtok_rP(char *__s, const char *__delim, char **__last)
Parses string into tokens.
char * strncpy_PF(char *dest, uint_farptr_t src, size_t len)
Duplicate a string until a limited length.
int strcasecmp_P(const char *, const char *) __ATTR_PURE__
Compare two strings ignoring case.
size_t strlen_PF(uint_farptr_t src)
Obtain the length of a string.
size_t strnlen_P(const char *, size_t)
Determine the length of a fixed-size string.
char * strcpy_P(char *, const char *)
int64_t PROGMEM prog_int64_t
Definition: pgmspace.h:309
char * strcat_P(char *, const char *)
size_t strlcpy_PF(char *dst, uint_farptr_t src, size_t siz)
Copy a string from progmem to RAM.
const char * strrchr_P(const char *, int __val)
Locate character in string.
#define PROGMEM
Definition: pgmspace.h:113
int strncasecmp_P(const char *, const char *, size_t) __ATTR_PURE__
Compare two strings ignoring case.
unsigned char PROGMEM prog_uchar
Definition: pgmspace.h:180
int memcmp_PF(const void *, uint_farptr_t, size_t) __ATTR_PURE__
Compare memory areas.
size_t strnlen_PF(uint_farptr_t src, size_t len)
Determine the length of a fixed-size string.
size_t strlcat_P(char *, const char *, size_t)
Concatenate two strings.
char * strncat_P(char *, const char *, size_t)
Concatenate two strings.
size_t strcspn_P(const char *__s, const char *__reject) __ATTR_PURE__
const void * memrchr_P(const void *, int __val, size_t __len)
char * strncat_PF(char *dest, uint_farptr_t src, size_t len)
Concatenate two strings.
uint16_t PROGMEM prog_uint16_t
Definition: pgmspace.h:252
char * strcat_PF(char *dest, uint_farptr_t src)
Concatenates two strings.
size_t strspn_P(const char *__s, const char *__accept) __ATTR_PURE__
char * strtok_P(char *__s, const char *__delim)
Parses the string into tokens.
char * strstr_P(const char *, const char *) __ATTR_PURE__
Locate a substring.
char PROGMEM prog_char
Definition: pgmspace.h:162
uint64_t PROGMEM prog_uint64_t
Definition: pgmspace.h:330
int32_t PROGMEM prog_int32_t
Definition: pgmspace.h:270
int16_t PROGMEM prog_int16_t
Definition: pgmspace.h:234
int strcmp_P(const char *, const char *) __ATTR_PURE__
int memcmp_P(const void *, const void *, size_t) __ATTR_PURE__
Compare memory areas.
size_t strlcpy_P(char *, const char *, size_t)
Copy a string from progmem to RAM.
char * strcasestr_P(const char *, const char *) __ATTR_PURE__
char * strcpy_PF(char *dest, uint_farptr_t src)
Duplicate a string.
int strcmp_PF(const char *s1, uint_farptr_t s2) __ATTR_PURE__
Compares two strings.
void * memcpy_P(void *, const void *, size_t)
void PROGMEM prog_void
Definition: pgmspace.h:144
static size_t strlen_P(const char *s)
void * memmem_P(const void *, size_t, const void *, size_t) __ATTR_PURE__
char * strpbrk_P(const char *__s, const char *__accept) __ATTR_PURE__
size_t strlcat_PF(char *dst, uint_farptr_t src, size_t siz)
Concatenate two strings.
unsigned int uint16_t
Definition: stdint.h:93
unsigned long int uint32_t
Definition: stdint.h:103
signed long long int int64_t
Definition: stdint.h:110
signed int int16_t
Definition: stdint.h:88
unsigned char uint8_t
Definition: stdint.h:83
unsigned long long int uint64_t
Definition: stdint.h:117
signed long int int32_t
Definition: stdint.h:98
signed char int8_t
Definition: stdint.h:78
static __inline void __attribute__((__always_inline__)) __power_all_enable()
Definition: power.h:1188