You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1090 lines
46 KiB
Groff
1090 lines
46 KiB
Groff
.TH "<avr/pgmspace.h>: Program Space Utilities" 3 "24 Jun 2019" "Version 2.0.0" "avr-libc" \" -*- nroff -*-
|
|
.ad l
|
|
.nh
|
|
.SH NAME
|
|
<avr/pgmspace.h>: Program Space Utilities \-
|
|
.SS "Defines"
|
|
|
|
.in +1c
|
|
.ti -1c
|
|
.RI "#define \fBPROGMEM\fP __ATTR_PROGMEM__"
|
|
.br
|
|
.ti -1c
|
|
.RI "#define \fBPGM_P\fP const char *"
|
|
.br
|
|
.ti -1c
|
|
.RI "#define \fBPGM_VOID_P\fP const void *"
|
|
.br
|
|
.ti -1c
|
|
.RI "#define \fBPSTR\fP(s) ((const PROGMEM char *)(s))"
|
|
.br
|
|
.ti -1c
|
|
.RI "#define \fBpgm_read_byte_near\fP(address_short) __LPM((\fBuint16_t\fP)(address_short))"
|
|
.br
|
|
.ti -1c
|
|
.RI "#define \fBpgm_read_word_near\fP(address_short) __LPM_word((\fBuint16_t\fP)(address_short))"
|
|
.br
|
|
.ti -1c
|
|
.RI "#define \fBpgm_read_dword_near\fP(address_short) __LPM_dword((\fBuint16_t\fP)(address_short))"
|
|
.br
|
|
.ti -1c
|
|
.RI "#define \fBpgm_read_float_near\fP(address_short) __LPM_float((\fBuint16_t\fP)(address_short))"
|
|
.br
|
|
.ti -1c
|
|
.RI "#define \fBpgm_read_ptr_near\fP(address_short) (void*)__LPM_word((\fBuint16_t\fP)(address_short))"
|
|
.br
|
|
.ti -1c
|
|
.RI "#define \fBpgm_read_byte_far\fP(address_long) __ELPM((\fBuint32_t\fP)(address_long))"
|
|
.br
|
|
.ti -1c
|
|
.RI "#define \fBpgm_read_word_far\fP(address_long) __ELPM_word((\fBuint32_t\fP)(address_long))"
|
|
.br
|
|
.ti -1c
|
|
.RI "#define \fBpgm_read_dword_far\fP(address_long) __ELPM_dword((\fBuint32_t\fP)(address_long))"
|
|
.br
|
|
.ti -1c
|
|
.RI "#define \fBpgm_read_float_far\fP(address_long) __ELPM_float((\fBuint32_t\fP)(address_long))"
|
|
.br
|
|
.ti -1c
|
|
.RI "#define \fBpgm_read_ptr_far\fP(address_long) (void*)__ELPM_word((\fBuint32_t\fP)(address_long))"
|
|
.br
|
|
.ti -1c
|
|
.RI "#define \fBpgm_read_byte\fP(address_short) pgm_read_byte_near(address_short)"
|
|
.br
|
|
.ti -1c
|
|
.RI "#define \fBpgm_read_word\fP(address_short) pgm_read_word_near(address_short)"
|
|
.br
|
|
.ti -1c
|
|
.RI "#define \fBpgm_read_dword\fP(address_short) pgm_read_dword_near(address_short)"
|
|
.br
|
|
.ti -1c
|
|
.RI "#define \fBpgm_read_float\fP(address_short) pgm_read_float_near(address_short)"
|
|
.br
|
|
.ti -1c
|
|
.RI "#define \fBpgm_read_ptr\fP(address_short) pgm_read_ptr_near(address_short)"
|
|
.br
|
|
.ti -1c
|
|
.RI "#define \fBpgm_get_far_address\fP(var)"
|
|
.br
|
|
.in -1c
|
|
.SS "Typedefs"
|
|
|
|
.in +1c
|
|
.ti -1c
|
|
.RI "typedef void PROGMEM \fBprog_void\fP"
|
|
.br
|
|
.ti -1c
|
|
.RI "typedef char PROGMEM \fBprog_char\fP"
|
|
.br
|
|
.ti -1c
|
|
.RI "typedef unsigned char PROGMEM \fBprog_uchar\fP"
|
|
.br
|
|
.ti -1c
|
|
.RI "typedef \fBint8_t\fP PROGMEM \fBprog_int8_t\fP"
|
|
.br
|
|
.ti -1c
|
|
.RI "typedef \fBuint8_t\fP PROGMEM \fBprog_uint8_t\fP"
|
|
.br
|
|
.ti -1c
|
|
.RI "typedef \fBint16_t\fP PROGMEM \fBprog_int16_t\fP"
|
|
.br
|
|
.ti -1c
|
|
.RI "typedef \fBuint16_t\fP PROGMEM \fBprog_uint16_t\fP"
|
|
.br
|
|
.ti -1c
|
|
.RI "typedef \fBint32_t\fP PROGMEM \fBprog_int32_t\fP"
|
|
.br
|
|
.ti -1c
|
|
.RI "typedef \fBuint32_t\fP PROGMEM \fBprog_uint32_t\fP"
|
|
.br
|
|
.ti -1c
|
|
.RI "typedef \fBint64_t\fP PROGMEM \fBprog_int64_t\fP"
|
|
.br
|
|
.ti -1c
|
|
.RI "typedef \fBuint64_t\fP PROGMEM \fBprog_uint64_t\fP"
|
|
.br
|
|
.in -1c
|
|
.SS "Functions"
|
|
|
|
.in +1c
|
|
.ti -1c
|
|
.RI "const void * \fBmemchr_P\fP (const void *, int __val, size_t __len)"
|
|
.br
|
|
.ti -1c
|
|
.RI "int \fBmemcmp_P\fP (const void *, const void *, size_t) __ATTR_PURE__"
|
|
.br
|
|
.ti -1c
|
|
.RI "void * \fBmemccpy_P\fP (void *, const void *, int __val, size_t)"
|
|
.br
|
|
.ti -1c
|
|
.RI "void * \fBmemcpy_P\fP (void *, const void *, size_t)"
|
|
.br
|
|
.ti -1c
|
|
.RI "void * \fBmemmem_P\fP (const void *, size_t, const void *, size_t) __ATTR_PURE__"
|
|
.br
|
|
.ti -1c
|
|
.RI "const void * \fBmemrchr_P\fP (const void *, int __val, size_t __len)"
|
|
.br
|
|
.ti -1c
|
|
.RI "char * \fBstrcat_P\fP (char *, const char *)"
|
|
.br
|
|
.ti -1c
|
|
.RI "const char * \fBstrchr_P\fP (const char *, int __val)"
|
|
.br
|
|
.ti -1c
|
|
.RI "const char * \fBstrchrnul_P\fP (const char *, int __val)"
|
|
.br
|
|
.ti -1c
|
|
.RI "int \fBstrcmp_P\fP (const char *, const char *) __ATTR_PURE__"
|
|
.br
|
|
.ti -1c
|
|
.RI "char * \fBstrcpy_P\fP (char *, const char *)"
|
|
.br
|
|
.ti -1c
|
|
.RI "int \fBstrcasecmp_P\fP (const char *, const char *) __ATTR_PURE__"
|
|
.br
|
|
.ti -1c
|
|
.RI "char * \fBstrcasestr_P\fP (const char *, const char *) __ATTR_PURE__"
|
|
.br
|
|
.ti -1c
|
|
.RI "size_t \fBstrcspn_P\fP (const char *__s, const char *__reject) __ATTR_PURE__"
|
|
.br
|
|
.ti -1c
|
|
.RI "size_t \fBstrlcat_P\fP (char *, const char *, size_t)"
|
|
.br
|
|
.ti -1c
|
|
.RI "size_t \fBstrlcpy_P\fP (char *, const char *, size_t)"
|
|
.br
|
|
.ti -1c
|
|
.RI "size_t \fBstrnlen_P\fP (const char *, size_t)"
|
|
.br
|
|
.ti -1c
|
|
.RI "int \fBstrncmp_P\fP (const char *, const char *, size_t) __ATTR_PURE__"
|
|
.br
|
|
.ti -1c
|
|
.RI "int \fBstrncasecmp_P\fP (const char *, const char *, size_t) __ATTR_PURE__"
|
|
.br
|
|
.ti -1c
|
|
.RI "char * \fBstrncat_P\fP (char *, const char *, size_t)"
|
|
.br
|
|
.ti -1c
|
|
.RI "char * \fBstrncpy_P\fP (char *, const char *, size_t)"
|
|
.br
|
|
.ti -1c
|
|
.RI "char * \fBstrpbrk_P\fP (const char *__s, const char *__accept) __ATTR_PURE__"
|
|
.br
|
|
.ti -1c
|
|
.RI "const char * \fBstrrchr_P\fP (const char *, int __val)"
|
|
.br
|
|
.ti -1c
|
|
.RI "char * \fBstrsep_P\fP (char **__sp, const char *__delim)"
|
|
.br
|
|
.ti -1c
|
|
.RI "size_t \fBstrspn_P\fP (const char *__s, const char *__accept) __ATTR_PURE__"
|
|
.br
|
|
.ti -1c
|
|
.RI "char * \fBstrstr_P\fP (const char *, const char *) __ATTR_PURE__"
|
|
.br
|
|
.ti -1c
|
|
.RI "char * \fBstrtok_P\fP (char *__s, const char *__delim)"
|
|
.br
|
|
.ti -1c
|
|
.RI "char * \fBstrtok_rP\fP (char *__s, const char *__delim, char **__last)"
|
|
.br
|
|
.ti -1c
|
|
.RI "size_t \fBstrlen_PF\fP (\fBuint_farptr_t\fP src)"
|
|
.br
|
|
.ti -1c
|
|
.RI "size_t \fBstrnlen_PF\fP (\fBuint_farptr_t\fP src, size_t len)"
|
|
.br
|
|
.ti -1c
|
|
.RI "void * \fBmemcpy_PF\fP (void *dest, \fBuint_farptr_t\fP src, size_t len)"
|
|
.br
|
|
.ti -1c
|
|
.RI "char * \fBstrcpy_PF\fP (char *dest, \fBuint_farptr_t\fP src)"
|
|
.br
|
|
.ti -1c
|
|
.RI "char * \fBstrncpy_PF\fP (char *dest, \fBuint_farptr_t\fP src, size_t len)"
|
|
.br
|
|
.ti -1c
|
|
.RI "char * \fBstrcat_PF\fP (char *dest, \fBuint_farptr_t\fP src)"
|
|
.br
|
|
.ti -1c
|
|
.RI "size_t \fBstrlcat_PF\fP (char *dst, \fBuint_farptr_t\fP src, size_t siz)"
|
|
.br
|
|
.ti -1c
|
|
.RI "char * \fBstrncat_PF\fP (char *dest, \fBuint_farptr_t\fP src, size_t len)"
|
|
.br
|
|
.ti -1c
|
|
.RI "int \fBstrcmp_PF\fP (const char *s1, \fBuint_farptr_t\fP s2) __ATTR_PURE__"
|
|
.br
|
|
.ti -1c
|
|
.RI "int \fBstrncmp_PF\fP (const char *s1, \fBuint_farptr_t\fP s2, size_t n) __ATTR_PURE__"
|
|
.br
|
|
.ti -1c
|
|
.RI "int \fBstrcasecmp_PF\fP (const char *s1, \fBuint_farptr_t\fP s2) __ATTR_PURE__"
|
|
.br
|
|
.ti -1c
|
|
.RI "int \fBstrncasecmp_PF\fP (const char *s1, \fBuint_farptr_t\fP s2, size_t n) __ATTR_PURE__"
|
|
.br
|
|
.ti -1c
|
|
.RI "char * \fBstrstr_PF\fP (const char *s1, \fBuint_farptr_t\fP s2)"
|
|
.br
|
|
.ti -1c
|
|
.RI "size_t \fBstrlcpy_PF\fP (char *dst, \fBuint_farptr_t\fP src, size_t siz)"
|
|
.br
|
|
.ti -1c
|
|
.RI "int \fBmemcmp_PF\fP (const void *, \fBuint_farptr_t\fP, size_t) __ATTR_PURE__"
|
|
.br
|
|
.ti -1c
|
|
.RI "static size_t \fBstrlen_P\fP (const char *s)"
|
|
.br
|
|
.in -1c
|
|
.SH "Detailed Description"
|
|
.PP
|
|
.PP
|
|
.nf
|
|
#include <avr/io.h>
|
|
#include <avr/pgmspace.h>
|
|
.fi
|
|
.PP
|
|
.PP
|
|
The functions in this module provide interfaces for a program to access data stored in program space (flash memory) of the device. In order to use these functions, the target device must support either the \fCLPM\fP or \fCELPM\fP instructions.
|
|
.PP
|
|
\fBNote:\fP
|
|
.RS 4
|
|
These functions are an attempt to provide some compatibility with header files that come with IAR C, to make porting applications between different compilers easier. This is not 100% compatibility though (GCC does not have full support for multiple address spaces yet).
|
|
.PP
|
|
If you are working with strings which are completely based in ram, use the standard string functions described in \fB<string.h>: Strings\fP.
|
|
.PP
|
|
If possible, put your constant tables in the lower 64 KB and use \fBpgm_read_byte_near()\fP or \fBpgm_read_word_near()\fP instead of \fBpgm_read_byte_far()\fP or \fBpgm_read_word_far()\fP since it is more efficient that way, and you can still use the upper 64K for executable code. All functions that are suffixed with a \fC_P\fP \fIrequire\fP their arguments to be in the lower 64 KB of the flash ROM, as they do not use ELPM instructions. This is normally not a big concern as the linker setup arranges any program space constants declared using the macros from this header file so they are placed right after the interrupt vectors, and in front of any executable code. However, it can become a problem if there are too many of these constants, or for bootloaders on devices with more than 64 KB of ROM. \fIAll these functions will not work in that situation.\fP
|
|
.PP
|
|
For \fBXmega\fP devices, make sure the NVM controller command register (\fCNVM.CMD\fP or \fCNVM_CMD\fP) is set to 0x00 (NOP) before using any of these functions.
|
|
.RE
|
|
.PP
|
|
|
|
.SH "Define Documentation"
|
|
.PP
|
|
.SS "#define pgm_get_far_address(var)"\fBValue:\fP
|
|
.PP
|
|
.nf
|
|
({ \
|
|
uint_farptr_t tmp; \
|
|
\
|
|
__asm__ __volatile__( \
|
|
\
|
|
'ldi %A0, lo8(%1)' '\n\t' \
|
|
'ldi %B0, hi8(%1)' '\n\t' \
|
|
'ldi %C0, hh8(%1)' '\n\t' \
|
|
'clr %D0' '\n\t' \
|
|
: \
|
|
'=d' (tmp) \
|
|
: \
|
|
'p' (&(var)) \
|
|
); \
|
|
tmp; \
|
|
})
|
|
.fi
|
|
This macro facilitates the obtention of a 32 bit 'far' pointer (only 24 bits used) to data even passed the 64KB limit for the 16 bit ordinary pointer. It is similar to the '&' operator, with some limitations.
|
|
.PP
|
|
Comments:
|
|
.PP
|
|
.IP "\(bu" 2
|
|
The overhead is minimal and it's mainly due to the 32 bit size operation.
|
|
.PP
|
|
.PP
|
|
.IP "\(bu" 2
|
|
24 bit sizes guarantees the code compatibility for use in future devices.
|
|
.PP
|
|
.PP
|
|
.IP "\(bu" 2
|
|
hh8() is an undocumented feature but seems to give the third significant byte of a 32 bit data and accepts symbols, complementing the functionality of hi8() and lo8(). There is not an equivalent assembler function to get the high significant byte.
|
|
.PP
|
|
.PP
|
|
.IP "\(bu" 2
|
|
'var' has to be resolved at linking time as an existing symbol, i.e, a simple type variable name, an array name (not an indexed element of the array, if the index is a constant the compiler does not complain but fails to get the address if optimization is enabled), a struct name or a struct field name, a function identifier, a linker defined identifier,...
|
|
.PP
|
|
.PP
|
|
.IP "\(bu" 2
|
|
The returned value is the identifier's VMA (virtual memory address) determined by the linker and falls in the corresponding memory region. The AVR Harvard architecture requires non overlapping VMA areas for the multiple address spaces in the processor: Flash ROM, RAM, and EEPROM. Typical offset for this are 0x00000000, 0x00800xx0, and 0x00810000 respectively, derived from the linker script used and linker options. The value returned can be seen then as a universal pointer.
|
|
.PP
|
|
|
|
.SS "#define PGM_P const char *"Used to declare a variable that is a pointer to a string in program space.
|
|
.SS "#define pgm_read_byte(address_short) pgm_read_byte_near(address_short)"Read a byte from the program space with a 16-bit (near) address.
|
|
.PP
|
|
\fBNote:\fP
|
|
.RS 4
|
|
The address is a byte address. The address is in the program space.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "#define pgm_read_byte_far(address_long) __ELPM((\fBuint32_t\fP)(address_long))"Read a byte from the program space with a 32-bit (far) address.
|
|
.PP
|
|
\fBNote:\fP
|
|
.RS 4
|
|
The address is a byte address. The address is in the program space.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "#define pgm_read_byte_near(address_short) __LPM((\fBuint16_t\fP)(address_short))"Read a byte from the program space with a 16-bit (near) address.
|
|
.PP
|
|
\fBNote:\fP
|
|
.RS 4
|
|
The address is a byte address. The address is in the program space.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "#define pgm_read_dword(address_short) pgm_read_dword_near(address_short)"Read a double word from the program space with a 16-bit (near) address.
|
|
.PP
|
|
\fBNote:\fP
|
|
.RS 4
|
|
The address is a byte address. The address is in the program space.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "#define pgm_read_dword_far(address_long) __ELPM_dword((\fBuint32_t\fP)(address_long))"Read a double word from the program space with a 32-bit (far) address.
|
|
.PP
|
|
\fBNote:\fP
|
|
.RS 4
|
|
The address is a byte address. The address is in the program space.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "#define pgm_read_dword_near(address_short) __LPM_dword((\fBuint16_t\fP)(address_short))"Read a double word from the program space with a 16-bit (near) address.
|
|
.PP
|
|
\fBNote:\fP
|
|
.RS 4
|
|
The address is a byte address. The address is in the program space.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "#define pgm_read_float(address_short) pgm_read_float_near(address_short)"Read a float from the program space with a 16-bit (near) address.
|
|
.PP
|
|
\fBNote:\fP
|
|
.RS 4
|
|
The address is a byte address. The address is in the program space.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "#define pgm_read_float_far(address_long) __ELPM_float((\fBuint32_t\fP)(address_long))"Read a float from the program space with a 32-bit (far) address.
|
|
.PP
|
|
\fBNote:\fP
|
|
.RS 4
|
|
The address is a byte address. The address is in the program space.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "#define pgm_read_float_near(address_short) __LPM_float((\fBuint16_t\fP)(address_short))"Read a float from the program space with a 16-bit (near) address.
|
|
.PP
|
|
\fBNote:\fP
|
|
.RS 4
|
|
The address is a byte address. The address is in the program space.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "#define pgm_read_ptr(address_short) pgm_read_ptr_near(address_short)"Read a pointer from the program space with a 16-bit (near) address.
|
|
.PP
|
|
\fBNote:\fP
|
|
.RS 4
|
|
The address is a byte address. The address is in the program space.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "#define pgm_read_ptr_far(address_long) (void*)__ELPM_word((\fBuint32_t\fP)(address_long))"Read a pointer from the program space with a 32-bit (far) address.
|
|
.PP
|
|
\fBNote:\fP
|
|
.RS 4
|
|
The address is a byte address. The address is in the program space.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "#define pgm_read_ptr_near(address_short) (void*)__LPM_word((\fBuint16_t\fP)(address_short))"Read a pointer from the program space with a 16-bit (near) address.
|
|
.PP
|
|
\fBNote:\fP
|
|
.RS 4
|
|
The address is a byte address. The address is in the program space.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "#define pgm_read_word(address_short) pgm_read_word_near(address_short)"Read a word from the program space with a 16-bit (near) address.
|
|
.PP
|
|
\fBNote:\fP
|
|
.RS 4
|
|
The address is a byte address. The address is in the program space.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "#define pgm_read_word_far(address_long) __ELPM_word((\fBuint32_t\fP)(address_long))"Read a word from the program space with a 32-bit (far) address.
|
|
.PP
|
|
\fBNote:\fP
|
|
.RS 4
|
|
The address is a byte address. The address is in the program space.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "#define pgm_read_word_near(address_short) __LPM_word((\fBuint16_t\fP)(address_short))"Read a word from the program space with a 16-bit (near) address.
|
|
.PP
|
|
\fBNote:\fP
|
|
.RS 4
|
|
The address is a byte address. The address is in the program space.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "#define PGM_VOID_P const void *"Used to declare a generic pointer to an object in program space.
|
|
.SS "#define PROGMEM __ATTR_PROGMEM__"Attribute to use in order to declare an object being located in flash ROM.
|
|
.SS "#define PSTR(s) ((const PROGMEM char *)(s))"Used to declare a static pointer to a string in program space.
|
|
.SH "Typedef Documentation"
|
|
.PP
|
|
.SS "\fBprog_char\fP"\fBNote:\fP
|
|
.RS 4
|
|
DEPRECATED
|
|
.RE
|
|
.PP
|
|
This typedef is now deprecated because the usage of the __progmem__ attribute on a type is not supported in GCC. However, the use of the __progmem__ attribute on a variable declaration is supported, and this is now the recommended usage.
|
|
.PP
|
|
The typedef is only visible if the macro __PROG_TYPES_COMPAT__ has been defined before including <\fBavr/pgmspace.h\fP> (either by a \fC#define\fP directive, or by a -D compiler option.)
|
|
.PP
|
|
Type of a 'char' object located in flash ROM.
|
|
.SS "\fBprog_int16_t\fP"\fBNote:\fP
|
|
.RS 4
|
|
DEPRECATED
|
|
.RE
|
|
.PP
|
|
This typedef is now deprecated because the usage of the __progmem__ attribute on a type is not supported in GCC. However, the use of the __progmem__ attribute on a variable declaration is supported, and this is now the recommended usage.
|
|
.PP
|
|
The typedef is only visible if the macro __PROG_TYPES_COMPAT__ has been defined before including <\fBavr/pgmspace.h\fP> (either by a \fC#define\fP directive, or by a -D compiler option.)
|
|
.PP
|
|
Type of an 'int16_t' object located in flash ROM.
|
|
.SS "\fBprog_int32_t\fP"\fBNote:\fP
|
|
.RS 4
|
|
DEPRECATED
|
|
.RE
|
|
.PP
|
|
This typedef is now deprecated because the usage of the __progmem__ attribute on a type is not supported in GCC. However, the use of the __progmem__ attribute on a variable declaration is supported, and this is now the recommended usage.
|
|
.PP
|
|
The typedef is only visible if the macro __PROG_TYPES_COMPAT__ has been defined before including <\fBavr/pgmspace.h\fP> (either by a \fC#define\fP directive, or by a -D compiler option.)
|
|
.PP
|
|
Type of an 'int32_t' object located in flash ROM.
|
|
.SS "\fBprog_int64_t\fP"\fBNote:\fP
|
|
.RS 4
|
|
DEPRECATED
|
|
.RE
|
|
.PP
|
|
This typedef is now deprecated because the usage of the __progmem__ attribute on a type is not supported in GCC. However, the use of the __progmem__ attribute on a variable declaration is supported, and this is now the recommended usage.
|
|
.PP
|
|
The typedef is only visible if the macro __PROG_TYPES_COMPAT__ has been defined before including <\fBavr/pgmspace.h\fP> (either by a \fC#define\fP directive, or by a -D compiler option.)
|
|
.PP
|
|
Type of an 'int64_t' object located in flash ROM.
|
|
.PP
|
|
\fBNote:\fP
|
|
.RS 4
|
|
This type is not available when the compiler option -mint8 is in effect.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "\fBprog_int8_t\fP"\fBNote:\fP
|
|
.RS 4
|
|
DEPRECATED
|
|
.RE
|
|
.PP
|
|
This typedef is now deprecated because the usage of the __progmem__ attribute on a type is not supported in GCC. However, the use of the __progmem__ attribute on a variable declaration is supported, and this is now the recommended usage.
|
|
.PP
|
|
The typedef is only visible if the macro __PROG_TYPES_COMPAT__ has been defined before including <\fBavr/pgmspace.h\fP> (either by a \fC#define\fP directive, or by a -D compiler option.)
|
|
.PP
|
|
Type of an 'int8_t' object located in flash ROM.
|
|
.SS "\fBprog_uchar\fP"\fBNote:\fP
|
|
.RS 4
|
|
DEPRECATED
|
|
.RE
|
|
.PP
|
|
This typedef is now deprecated because the usage of the __progmem__ attribute on a type is not supported in GCC. However, the use of the __progmem__ attribute on a variable declaration is supported, and this is now the recommended usage.
|
|
.PP
|
|
The typedef is only visible if the macro __PROG_TYPES_COMPAT__ has been defined before including <\fBavr/pgmspace.h\fP> (either by a \fC#define\fP directive, or by a -D compiler option.)
|
|
.PP
|
|
Type of an 'unsigned char' object located in flash ROM.
|
|
.SS "\fBprog_uint16_t\fP"\fBNote:\fP
|
|
.RS 4
|
|
DEPRECATED
|
|
.RE
|
|
.PP
|
|
This typedef is now deprecated because the usage of the __progmem__ attribute on a type is not supported in GCC. However, the use of the __progmem__ attribute on a variable declaration is supported, and this is now the recommended usage.
|
|
.PP
|
|
The typedef is only visible if the macro __PROG_TYPES_COMPAT__ has been defined before including <\fBavr/pgmspace.h\fP> (either by a \fC#define\fP directive, or by a -D compiler option.)
|
|
.PP
|
|
Type of an 'uint16_t' object located in flash ROM.
|
|
.SS "\fBprog_uint32_t\fP"\fBNote:\fP
|
|
.RS 4
|
|
DEPRECATED
|
|
.RE
|
|
.PP
|
|
This typedef is now deprecated because the usage of the __progmem__ attribute on a type is not supported in GCC. However, the use of the __progmem__ attribute on a variable declaration is supported, and this is now the recommended usage.
|
|
.PP
|
|
The typedef is only visible if the macro __PROG_TYPES_COMPAT__ has been defined before including <\fBavr/pgmspace.h\fP> (either by a \fC#define\fP directive, or by a -D compiler option.)
|
|
.PP
|
|
Type of an 'uint32_t' object located in flash ROM.
|
|
.SS "\fBprog_uint64_t\fP"\fBNote:\fP
|
|
.RS 4
|
|
DEPRECATED
|
|
.RE
|
|
.PP
|
|
This typedef is now deprecated because the usage of the __progmem__ attribute on a type is not supported in GCC. However, the use of the __progmem__ attribute on a variable declaration is supported, and this is now the recommended usage.
|
|
.PP
|
|
The typedef is only visible if the macro __PROG_TYPES_COMPAT__ has been defined before including <\fBavr/pgmspace.h\fP> (either by a \fC#define\fP directive, or by a -D compiler option.)
|
|
.PP
|
|
Type of an 'uint64_t' object located in flash ROM.
|
|
.PP
|
|
\fBNote:\fP
|
|
.RS 4
|
|
This type is not available when the compiler option -mint8 is in effect.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "\fBprog_uint8_t\fP"\fBNote:\fP
|
|
.RS 4
|
|
DEPRECATED
|
|
.RE
|
|
.PP
|
|
This typedef is now deprecated because the usage of the __progmem__ attribute on a type is not supported in GCC. However, the use of the __progmem__ attribute on a variable declaration is supported, and this is now the recommended usage.
|
|
.PP
|
|
The typedef is only visible if the macro __PROG_TYPES_COMPAT__ has been defined before including <\fBavr/pgmspace.h\fP> (either by a \fC#define\fP directive, or by a -D compiler option.)
|
|
.PP
|
|
Type of an 'uint8_t' object located in flash ROM.
|
|
.SS "\fBprog_void\fP"\fBNote:\fP
|
|
.RS 4
|
|
DEPRECATED
|
|
.RE
|
|
.PP
|
|
This typedef is now deprecated because the usage of the __progmem__ attribute on a type is not supported in GCC. However, the use of the __progmem__ attribute on a variable declaration is supported, and this is now the recommended usage.
|
|
.PP
|
|
The typedef is only visible if the macro __PROG_TYPES_COMPAT__ has been defined before including <\fBavr/pgmspace.h\fP> (either by a \fC#define\fP directive, or by a -D compiler option.)
|
|
.PP
|
|
Type of a 'void' object located in flash ROM. Does not make much sense by itself, but can be used to declare a 'void *' object in flash ROM.
|
|
.SH "Function Documentation"
|
|
.PP
|
|
.SS "void * memccpy_P (void * dest, const void * src, int val, size_t len)"This function is similar to \fBmemccpy()\fP except that \fCsrc\fP is pointer to a string in program space.
|
|
.SS "const void * memchr_P (const void * s, int val, size_t len)"
|
|
.PP
|
|
Scan flash memory for a character. The \fBmemchr_P()\fP function scans the first \fClen\fP bytes of the flash memory area pointed to by \fCs\fP for the character \fCval\fP. The first byte to match \fCval\fP (interpreted as an unsigned character) stops the operation.
|
|
.PP
|
|
\fBReturns:\fP
|
|
.RS 4
|
|
The \fBmemchr_P()\fP function returns a pointer to the matching byte or \fCNULL\fP if the character does not occur in the given memory area.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "int memcmp_P (const void * s1, const void * s2, size_t len)"
|
|
.PP
|
|
Compare memory areas. The \fBmemcmp_P()\fP function compares the first \fClen\fP bytes of the memory areas \fCs1\fP and flash \fCs2\fP. The comparision is performed using unsigned char operations.
|
|
.PP
|
|
\fBReturns:\fP
|
|
.RS 4
|
|
The \fBmemcmp_P()\fP function returns an integer less than, equal to, or greater than zero if the first \fClen\fP bytes of \fCs1\fP is found, respectively, to be less than, to match, or be greater than the first \fClen\fP bytes of \fCs2\fP.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "int memcmp_PF (const void * s1, \fBuint_farptr_t\fP s2, size_t len)"
|
|
.PP
|
|
Compare memory areas. The \fBmemcmp_PF()\fP function compares the first \fClen\fP bytes of the memory areas \fCs1\fP and flash \fCs2\fP. The comparision is performed using unsigned char operations. It is an equivalent of \fBmemcmp_P()\fP function, except that it is capable working on all FLASH including the exteded area above 64kB.
|
|
.PP
|
|
\fBReturns:\fP
|
|
.RS 4
|
|
The \fBmemcmp_PF()\fP function returns an integer less than, equal to, or greater than zero if the first \fClen\fP bytes of \fCs1\fP is found, respectively, to be less than, to match, or be greater than the first \fClen\fP bytes of \fCs2\fP.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "void * memcpy_P (void * dest, const void * src, size_t n)"The \fBmemcpy_P()\fP function is similar to \fBmemcpy()\fP, except the src string resides in program space.
|
|
.PP
|
|
\fBReturns:\fP
|
|
.RS 4
|
|
The \fBmemcpy_P()\fP function returns a pointer to dest.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "void * memcpy_PF (void * dest, \fBuint_farptr_t\fP src, size_t n)"
|
|
.PP
|
|
Copy a memory block from flash to SRAM. The \fBmemcpy_PF()\fP function is similar to \fBmemcpy()\fP, except the data is copied from the program space and is addressed using a far pointer.
|
|
.PP
|
|
\fBParameters:\fP
|
|
.RS 4
|
|
\fIdest\fP A pointer to the destination buffer
|
|
.br
|
|
\fIsrc\fP A far pointer to the origin of data in flash memory
|
|
.br
|
|
\fIn\fP The number of bytes to be copied
|
|
.RE
|
|
.PP
|
|
\fBReturns:\fP
|
|
.RS 4
|
|
The \fBmemcpy_PF()\fP function returns a pointer to \fIdst\fP. The contents of RAMPZ SFR are undefined when the function returns.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "void * memmem_P (const void * s1, size_t len1, const void * s2, size_t len2)"The \fBmemmem_P()\fP function is similar to \fBmemmem()\fP except that \fCs2\fP is pointer to a string in program space.
|
|
.SS "const void memrchr_P (const void * src, int val, size_t len)"The \fBmemrchr_P()\fP function is like the \fBmemchr_P()\fP function, except that it searches backwards from the end of the \fClen\fP bytes pointed to by \fCsrc\fP instead of forwards from the front. (Glibc, GNU extension.)
|
|
.PP
|
|
\fBReturns:\fP
|
|
.RS 4
|
|
The \fBmemrchr_P()\fP function returns a pointer to the matching byte or \fCNULL\fP if the character does not occur in the given memory area.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "int strcasecmp_P (const char * s1, const char * s2)"
|
|
.PP
|
|
Compare two strings ignoring case. The \fBstrcasecmp_P()\fP function compares the two strings \fCs1\fP and \fCs2\fP, ignoring the case of the characters.
|
|
.PP
|
|
\fBParameters:\fP
|
|
.RS 4
|
|
\fIs1\fP A pointer to a string in the devices SRAM.
|
|
.br
|
|
\fIs2\fP A pointer to a string in the devices Flash.
|
|
.RE
|
|
.PP
|
|
\fBReturns:\fP
|
|
.RS 4
|
|
The \fBstrcasecmp_P()\fP function returns an integer less than, equal to, or greater than zero if \fCs1\fP is found, respectively, to be less than, to match, or be greater than \fCs2\fP. A consequence of the ordering used by \fBstrcasecmp_P()\fP is that if \fCs1\fP is an initial substring of \fCs2\fP, then \fCs1\fP is considered to be 'less than' \fCs2\fP.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "int strcasecmp_PF (const char * s1, \fBuint_farptr_t\fP s2)"
|
|
.PP
|
|
Compare two strings ignoring case. The \fBstrcasecmp_PF()\fP function compares the two strings \fIs1\fP and \fIs2\fP, ignoring the case of the characters.
|
|
.PP
|
|
\fBParameters:\fP
|
|
.RS 4
|
|
\fIs1\fP A pointer to the first string in SRAM
|
|
.br
|
|
\fIs2\fP A far pointer to the second string in Flash
|
|
.RE
|
|
.PP
|
|
\fBReturns:\fP
|
|
.RS 4
|
|
The \fBstrcasecmp_PF()\fP function returns an integer less than, equal to, or greater than zero if \fIs1\fP is found, respectively, to be less than, to match, or be greater than \fIs2\fP. The contents of RAMPZ SFR are undefined when the function returns.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "char * strcasestr_P (const char * s1, const char * s2)"This funtion is similar to \fBstrcasestr()\fP except that \fCs2\fP is pointer to a string in program space.
|
|
.SS "char * strcat_P (char * dest, const char * src)"The \fBstrcat_P()\fP function is similar to \fBstrcat()\fP except that the \fIsrc\fP string must be located in program space (flash).
|
|
.PP
|
|
\fBReturns:\fP
|
|
.RS 4
|
|
The \fBstrcat()\fP function returns a pointer to the resulting string \fIdest\fP.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "char * strcat_PF (char * dst, \fBuint_farptr_t\fP src)"
|
|
.PP
|
|
Concatenates two strings. The \fBstrcat_PF()\fP function is similar to \fBstrcat()\fP except that the \fIsrc\fP string must be located in program space (flash) and is addressed using a far pointer
|
|
.PP
|
|
\fBParameters:\fP
|
|
.RS 4
|
|
\fIdst\fP A pointer to the destination string in SRAM
|
|
.br
|
|
\fIsrc\fP A far pointer to the string to be appended in Flash
|
|
.RE
|
|
.PP
|
|
\fBReturns:\fP
|
|
.RS 4
|
|
The \fBstrcat_PF()\fP function returns a pointer to the resulting string \fIdst\fP. The contents of RAMPZ SFR are undefined when the function returns
|
|
.RE
|
|
.PP
|
|
|
|
.SS "const char * strchr_P (const char * s, int val)"
|
|
.PP
|
|
Locate character in program space string. The \fBstrchr_P()\fP function locates the first occurrence of \fCval\fP (converted to a char) in the string pointed to by \fCs\fP in program space. The terminating null character is considered to be part of the string.
|
|
.PP
|
|
The \fBstrchr_P()\fP function is similar to \fBstrchr()\fP except that \fCs\fP is pointer to a string in program space.
|
|
.PP
|
|
\fBReturns:\fP
|
|
.RS 4
|
|
The \fBstrchr_P()\fP function returns a pointer to the matched character or \fCNULL\fP if the character is not found.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "const char * strchrnul_P (const char * s, int c)"The \fBstrchrnul_P()\fP function is like \fBstrchr_P()\fP except that if \fCc\fP is not found in \fCs\fP, then it returns a pointer to the null byte at the end of \fCs\fP, rather than \fCNULL\fP. (Glibc, GNU extension.)
|
|
.PP
|
|
\fBReturns:\fP
|
|
.RS 4
|
|
The \fBstrchrnul_P()\fP function returns a pointer to the matched character, or a pointer to the null byte at the end of \fCs\fP (i.e., \fCs+strlen\fP(s)) if the character is not found.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "int strcmp_P (const char * s1, const char * s2)"The \fBstrcmp_P()\fP function is similar to \fBstrcmp()\fP except that \fCs2\fP is pointer to a string in program space.
|
|
.PP
|
|
\fBReturns:\fP
|
|
.RS 4
|
|
The \fBstrcmp_P()\fP function returns an integer less than, equal to, or greater than zero if \fCs1\fP is found, respectively, to be less than, to match, or be greater than \fCs2\fP. A consequence of the ordering used by \fBstrcmp_P()\fP is that if \fCs1\fP is an initial substring of \fCs2\fP, then \fCs1\fP is considered to be 'less than' \fCs2\fP.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "int strcmp_PF (const char * s1, \fBuint_farptr_t\fP s2)"
|
|
.PP
|
|
Compares two strings. The \fBstrcmp_PF()\fP function is similar to \fBstrcmp()\fP except that \fIs2\fP is a far pointer to a string in program space.
|
|
.PP
|
|
\fBParameters:\fP
|
|
.RS 4
|
|
\fIs1\fP A pointer to the first string in SRAM
|
|
.br
|
|
\fIs2\fP A far pointer to the second string in Flash
|
|
.RE
|
|
.PP
|
|
\fBReturns:\fP
|
|
.RS 4
|
|
The \fBstrcmp_PF()\fP function returns an integer less than, equal to, or greater than zero if \fIs1\fP is found, respectively, to be less than, to match, or be greater than \fIs2\fP. The contents of RAMPZ SFR are undefined when the function returns.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "char * strcpy_P (char * dest, const char * src)"The \fBstrcpy_P()\fP function is similar to \fBstrcpy()\fP except that src is a pointer to a string in program space.
|
|
.PP
|
|
\fBReturns:\fP
|
|
.RS 4
|
|
The \fBstrcpy_P()\fP function returns a pointer to the destination string dest.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "char * strcpy_PF (char * dst, \fBuint_farptr_t\fP src)"
|
|
.PP
|
|
Duplicate a string. The \fBstrcpy_PF()\fP function is similar to \fBstrcpy()\fP except that \fIsrc\fP is a far pointer to a string in program space.
|
|
.PP
|
|
\fBParameters:\fP
|
|
.RS 4
|
|
\fIdst\fP A pointer to the destination string in SRAM
|
|
.br
|
|
\fIsrc\fP A far pointer to the source string in Flash
|
|
.RE
|
|
.PP
|
|
\fBReturns:\fP
|
|
.RS 4
|
|
The \fBstrcpy_PF()\fP function returns a pointer to the destination string \fIdst\fP. The contents of RAMPZ SFR are undefined when the funcion returns.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "size_t strcspn_P (const char * s, const char * reject)"The \fBstrcspn_P()\fP function calculates the length of the initial segment of \fCs\fP which consists entirely of characters not in \fCreject\fP. This function is similar to \fBstrcspn()\fP except that \fCreject\fP is a pointer to a string in program space.
|
|
.PP
|
|
\fBReturns:\fP
|
|
.RS 4
|
|
The \fBstrcspn_P()\fP function returns the number of characters in the initial segment of \fCs\fP which are not in the string \fCreject\fP. The terminating zero is not considered as a part of string.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "size_t strlcat_P (char * dst, const char * src, size_t siz)"
|
|
.PP
|
|
Concatenate two strings. The \fBstrlcat_P()\fP function is similar to \fBstrlcat()\fP, except that the \fCsrc\fP string must be located in program space (flash).
|
|
.PP
|
|
Appends \fCsrc\fP to string \fCdst\fP of size \fCsiz\fP (unlike \fBstrncat()\fP, \fCsiz\fP is the full size of \fCdst\fP, not space left). At most \fCsiz-1\fP characters will be copied. Always NULL terminates (unless \fCsiz\fP <= \fCstrlen(dst)\fP).
|
|
.PP
|
|
\fBReturns:\fP
|
|
.RS 4
|
|
The \fBstrlcat_P()\fP function returns strlen(src) + MIN(siz, strlen(initial dst)). If retval >= siz, truncation occurred.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "size_t strlcat_PF (char * dst, \fBuint_farptr_t\fP src, size_t n)"
|
|
.PP
|
|
Concatenate two strings. The \fBstrlcat_PF()\fP function is similar to \fBstrlcat()\fP, except that the \fIsrc\fP string must be located in program space (flash) and is addressed using a far pointer.
|
|
.PP
|
|
Appends src to string dst of size \fIn\fP (unlike \fBstrncat()\fP, \fIn\fP is the full size of \fIdst\fP, not space left). At most \fIn-1\fP characters will be copied. Always NULL terminates (unless \fIn\fP <= strlen(\fIdst\fP)).
|
|
.PP
|
|
\fBParameters:\fP
|
|
.RS 4
|
|
\fIdst\fP A pointer to the destination string in SRAM
|
|
.br
|
|
\fIsrc\fP A far pointer to the source string in Flash
|
|
.br
|
|
\fIn\fP The total number of bytes allocated to the destination string
|
|
.RE
|
|
.PP
|
|
\fBReturns:\fP
|
|
.RS 4
|
|
The \fBstrlcat_PF()\fP function returns strlen(\fIsrc\fP) + MIN(\fIn\fP, strlen(initial \fIdst\fP)). If retval >= \fIn\fP, truncation occurred. The contents of RAMPZ SFR are undefined when the funcion returns.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "size_t strlcpy_P (char * dst, const char * src, size_t siz)"
|
|
.PP
|
|
Copy a string from progmem to RAM. Copy \fCsrc\fP to string \fCdst\fP of size \fCsiz\fP. At most \fCsiz-1\fP characters will be copied. Always NULL terminates (unless \fCsiz\fP == 0). The \fBstrlcpy_P()\fP function is similar to \fBstrlcpy()\fP except that the \fCsrc\fP is pointer to a string in memory space.
|
|
.PP
|
|
\fBReturns:\fP
|
|
.RS 4
|
|
The \fBstrlcpy_P()\fP function returns strlen(src). If retval >= siz, truncation occurred.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "size_t strlcpy_PF (char * dst, \fBuint_farptr_t\fP src, size_t siz)"
|
|
.PP
|
|
Copy a string from progmem to RAM. Copy src to string dst of size siz. At most siz-1 characters will be copied. Always NULL terminates (unless siz == 0).
|
|
.PP
|
|
\fBReturns:\fP
|
|
.RS 4
|
|
The \fBstrlcpy_PF()\fP function returns strlen(src). If retval >= siz, truncation occurred. The contents of RAMPZ SFR are undefined when the function returns.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "size_t strlen_P (const char * src)\fC [static]\fP"The \fBstrlen_P()\fP function is similar to \fBstrlen()\fP, except that src is a pointer to a string in program space.
|
|
.PP
|
|
\fBReturns:\fP
|
|
.RS 4
|
|
The \fBstrlen_P()\fP function returns the number of characters in src.
|
|
.RE
|
|
.PP
|
|
\fBNote:\fP
|
|
.RS 4
|
|
\fBstrlen_P()\fP is implemented as an inline function in the \fBavr/pgmspace.h\fP header file, which will check if the length of the string is a constant and known at compile time. If it is not known at compile time, the macro will issue a call to __strlen_P() which will then calculate the length of the string as normal.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "size_t strlen_PF (\fBuint_farptr_t\fP s)"
|
|
.PP
|
|
Obtain the length of a string. The \fBstrlen_PF()\fP function is similar to \fBstrlen()\fP, except that \fIs\fP is a far pointer to a string in program space.
|
|
.PP
|
|
\fBParameters:\fP
|
|
.RS 4
|
|
\fIs\fP A far pointer to the string in flash
|
|
.RE
|
|
.PP
|
|
\fBReturns:\fP
|
|
.RS 4
|
|
The \fBstrlen_PF()\fP function returns the number of characters in \fIs\fP. The contents of RAMPZ SFR are undefined when the function returns.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "int strncasecmp_P (const char * s1, const char * s2, size_t n)"
|
|
.PP
|
|
Compare two strings ignoring case. The \fBstrncasecmp_P()\fP function is similar to \fBstrcasecmp_P()\fP, except it only compares the first \fCn\fP characters of \fCs1\fP.
|
|
.PP
|
|
\fBParameters:\fP
|
|
.RS 4
|
|
\fIs1\fP A pointer to a string in the devices SRAM.
|
|
.br
|
|
\fIs2\fP A pointer to a string in the devices Flash.
|
|
.br
|
|
\fIn\fP The maximum number of bytes to compare.
|
|
.RE
|
|
.PP
|
|
\fBReturns:\fP
|
|
.RS 4
|
|
The \fBstrncasecmp_P()\fP function returns an integer less than, equal to, or greater than zero if \fCs1\fP (or the first \fCn\fP bytes thereof) is found, respectively, to be less than, to match, or be greater than \fCs2\fP. A consequence of the ordering used by \fBstrncasecmp_P()\fP is that if \fCs1\fP is an initial substring of \fCs2\fP, then \fCs1\fP is considered to be 'less than' \fCs2\fP.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "int strncasecmp_PF (const char * s1, \fBuint_farptr_t\fP s2, size_t n)"
|
|
.PP
|
|
Compare two strings ignoring case. The \fBstrncasecmp_PF()\fP function is similar to \fBstrcasecmp_PF()\fP, except it only compares the first \fIn\fP characters of \fIs1\fP and the string in flash is addressed using a far pointer.
|
|
.PP
|
|
\fBParameters:\fP
|
|
.RS 4
|
|
\fIs1\fP A pointer to a string in SRAM
|
|
.br
|
|
\fIs2\fP A far pointer to a string in Flash
|
|
.br
|
|
\fIn\fP The maximum number of bytes to compare
|
|
.RE
|
|
.PP
|
|
\fBReturns:\fP
|
|
.RS 4
|
|
The \fBstrncasecmp_PF()\fP function returns an integer less than, equal to, or greater than zero if \fIs1\fP (or the first \fIn\fP bytes thereof) is found, respectively, to be less than, to match, or be greater than \fIs2\fP. The contents of RAMPZ SFR are undefined when the function returns.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "char * strncat_P (char * dest, const char * src, size_t len)"
|
|
.PP
|
|
Concatenate two strings. The \fBstrncat_P()\fP function is similar to \fBstrncat()\fP, except that the \fIsrc\fP string must be located in program space (flash).
|
|
.PP
|
|
\fBReturns:\fP
|
|
.RS 4
|
|
The \fBstrncat_P()\fP function returns a pointer to the resulting string dest.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "char * strncat_PF (char * dst, \fBuint_farptr_t\fP src, size_t n)"
|
|
.PP
|
|
Concatenate two strings. The \fBstrncat_PF()\fP function is similar to \fBstrncat()\fP, except that the \fIsrc\fP string must be located in program space (flash) and is addressed using a far pointer.
|
|
.PP
|
|
\fBParameters:\fP
|
|
.RS 4
|
|
\fIdst\fP A pointer to the destination string in SRAM
|
|
.br
|
|
\fIsrc\fP A far pointer to the source string in Flash
|
|
.br
|
|
\fIn\fP The maximum number of bytes to append
|
|
.RE
|
|
.PP
|
|
\fBReturns:\fP
|
|
.RS 4
|
|
The \fBstrncat_PF()\fP function returns a pointer to the resulting string \fIdst\fP. The contents of RAMPZ SFR are undefined when the function returns.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "int strncmp_P (const char * s1, const char * s2, size_t n)"The \fBstrncmp_P()\fP function is similar to \fBstrcmp_P()\fP except it only compares the first (at most) n characters of s1 and s2.
|
|
.PP
|
|
\fBReturns:\fP
|
|
.RS 4
|
|
The \fBstrncmp_P()\fP function returns an integer less than, equal to, or greater than zero if s1 (or the first n bytes thereof) is found, respectively, to be less than, to match, or be greater than s2.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "int strncmp_PF (const char * s1, \fBuint_farptr_t\fP s2, size_t n)"
|
|
.PP
|
|
Compare two strings with limited length. The \fBstrncmp_PF()\fP function is similar to \fBstrcmp_PF()\fP except it only compares the first (at most) \fIn\fP characters of \fIs1\fP and \fIs2\fP.
|
|
.PP
|
|
\fBParameters:\fP
|
|
.RS 4
|
|
\fIs1\fP A pointer to the first string in SRAM
|
|
.br
|
|
\fIs2\fP A far pointer to the second string in Flash
|
|
.br
|
|
\fIn\fP The maximum number of bytes to compare
|
|
.RE
|
|
.PP
|
|
\fBReturns:\fP
|
|
.RS 4
|
|
The \fBstrncmp_PF()\fP function returns an integer less than, equal to, or greater than zero if \fIs1\fP (or the first \fIn\fP bytes thereof) is found, respectively, to be less than, to match, or be greater than \fIs2\fP. The contents of RAMPZ SFR are undefined when the function returns.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "char * strncpy_P (char * dest, const char * src, size_t n)"The \fBstrncpy_P()\fP function is similar to \fBstrcpy_P()\fP except that not more than n bytes of src are copied. Thus, if there is no null byte among the first n bytes of src, the result will not be null-terminated.
|
|
.PP
|
|
In the case where the length of src is less than that of n, the remainder of dest will be padded with nulls.
|
|
.PP
|
|
\fBReturns:\fP
|
|
.RS 4
|
|
The \fBstrncpy_P()\fP function returns a pointer to the destination string dest.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "char * strncpy_PF (char * dst, \fBuint_farptr_t\fP src, size_t n)"
|
|
.PP
|
|
Duplicate a string until a limited length. The \fBstrncpy_PF()\fP function is similar to \fBstrcpy_PF()\fP except that not more than \fIn\fP bytes of \fIsrc\fP are copied. Thus, if there is no null byte among the first \fIn\fP bytes of \fIsrc\fP, the result will not be null-terminated.
|
|
.PP
|
|
In the case where the length of \fIsrc\fP is less than that of \fIn\fP, the remainder of \fIdst\fP will be padded with nulls.
|
|
.PP
|
|
\fBParameters:\fP
|
|
.RS 4
|
|
\fIdst\fP A pointer to the destination string in SRAM
|
|
.br
|
|
\fIsrc\fP A far pointer to the source string in Flash
|
|
.br
|
|
\fIn\fP The maximum number of bytes to copy
|
|
.RE
|
|
.PP
|
|
\fBReturns:\fP
|
|
.RS 4
|
|
The \fBstrncpy_PF()\fP function returns a pointer to the destination string \fIdst\fP. The contents of RAMPZ SFR are undefined when the function returns.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "size_t strnlen_P (const char * src, size_t len)"
|
|
.PP
|
|
Determine the length of a fixed-size string. The \fBstrnlen_P()\fP function is similar to \fBstrnlen()\fP, except that \fCsrc\fP is a pointer to a string in program space.
|
|
.PP
|
|
\fBReturns:\fP
|
|
.RS 4
|
|
The strnlen_P function returns strlen_P(src), if that is less than \fClen\fP, or \fClen\fP if there is no '\\0' character among the first \fClen\fP characters pointed to by \fCsrc\fP.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "size_t strnlen_PF (\fBuint_farptr_t\fP s, size_t len)"
|
|
.PP
|
|
Determine the length of a fixed-size string. The \fBstrnlen_PF()\fP function is similar to \fBstrnlen()\fP, except that \fIs\fP is a far pointer to a string in program space.
|
|
.PP
|
|
\fBParameters:\fP
|
|
.RS 4
|
|
\fIs\fP A far pointer to the string in Flash
|
|
.br
|
|
\fIlen\fP The maximum number of length to return
|
|
.RE
|
|
.PP
|
|
\fBReturns:\fP
|
|
.RS 4
|
|
The strnlen_PF function returns strlen_P(\fIs\fP), if that is less than \fIlen\fP, or \fIlen\fP if there is no '\\0' character among the first \fIlen\fP characters pointed to by \fIs\fP. The contents of RAMPZ SFR are undefined when the function returns.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "char * strpbrk_P (const char * s, const char * accept)"The \fBstrpbrk_P()\fP function locates the first occurrence in the string \fCs\fP of any of the characters in the flash string \fCaccept\fP. This function is similar to \fBstrpbrk()\fP except that \fCaccept\fP is a pointer to a string in program space.
|
|
.PP
|
|
\fBReturns:\fP
|
|
.RS 4
|
|
The \fBstrpbrk_P()\fP function returns a pointer to the character in \fCs\fP that matches one of the characters in \fCaccept\fP, or \fCNULL\fP if no such character is found. The terminating zero is not considered as a part of string: if one or both args are empty, the result will \fCNULL\fP.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "const char * strrchr_P (const char * s, int val)"
|
|
.PP
|
|
Locate character in string. The \fBstrrchr_P()\fP function returns a pointer to the last occurrence of the character \fCval\fP in the flash string \fCs\fP.
|
|
.PP
|
|
\fBReturns:\fP
|
|
.RS 4
|
|
The \fBstrrchr_P()\fP function returns a pointer to the matched character or \fCNULL\fP if the character is not found.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "char * strsep_P (char ** sp, const char * delim)"
|
|
.PP
|
|
Parse a string into tokens. The \fBstrsep_P()\fP function locates, in the string referenced by \fC*sp\fP, the first occurrence of any character in the string \fCdelim\fP (or the terminating '\\0' character) and replaces it with a '\\0'. The location of the next character after the delimiter character (or \fCNULL\fP, if the end of the string was reached) is stored in \fC*sp\fP. An ``empty'' field, i.e. one caused by two adjacent delimiter characters, can be detected by comparing the location referenced by the pointer returned in \fC*sp\fP to '\\0'. This function is similar to \fBstrsep()\fP except that \fCdelim\fP is a pointer to a string in program space.
|
|
.PP
|
|
\fBReturns:\fP
|
|
.RS 4
|
|
The \fBstrsep_P()\fP function returns a pointer to the original value of \fC*sp\fP. If \fC*sp\fP is initially \fCNULL\fP, \fBstrsep_P()\fP returns \fCNULL\fP.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "size_t strspn_P (const char * s, const char * accept)"The \fBstrspn_P()\fP function calculates the length of the initial segment of \fCs\fP which consists entirely of characters in \fCaccept\fP. This function is similar to \fBstrspn()\fP except that \fCaccept\fP is a pointer to a string in program space.
|
|
.PP
|
|
\fBReturns:\fP
|
|
.RS 4
|
|
The \fBstrspn_P()\fP function returns the number of characters in the initial segment of \fCs\fP which consist only of characters from \fCaccept\fP. The terminating zero is not considered as a part of string.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "char * strstr_P (const char * s1, const char * s2)"
|
|
.PP
|
|
Locate a substring. The \fBstrstr_P()\fP function finds the first occurrence of the substring \fCs2\fP in the string \fCs1\fP. The terminating '\\0' characters are not compared. The \fBstrstr_P()\fP function is similar to \fBstrstr()\fP except that \fCs2\fP is pointer to a string in program space.
|
|
.PP
|
|
\fBReturns:\fP
|
|
.RS 4
|
|
The \fBstrstr_P()\fP function returns a pointer to the beginning of the substring, or NULL if the substring is not found. If \fCs2\fP points to a string of zero length, the function returns \fCs1\fP.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "char * strstr_PF (const char * s1, \fBuint_farptr_t\fP s2)"
|
|
.PP
|
|
Locate a substring. The \fBstrstr_PF()\fP function finds the first occurrence of the substring \fCs2\fP in the string \fCs1\fP. The terminating '\\0' characters are not compared. The \fBstrstr_PF()\fP function is similar to \fBstrstr()\fP except that \fCs2\fP is a far pointer to a string in program space.
|
|
.PP
|
|
\fBReturns:\fP
|
|
.RS 4
|
|
The \fBstrstr_PF()\fP function returns a pointer to the beginning of the substring, or NULL if the substring is not found. If \fCs2\fP points to a string of zero length, the function returns \fCs1\fP. The contents of RAMPZ SFR are undefined when the function returns.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "char * strtok_P (char * s, const char * delim)"
|
|
.PP
|
|
Parses the string into tokens. \fBstrtok_P()\fP parses the string \fCs\fP into tokens. The first call to \fBstrtok_P()\fP should have \fCs\fP as its first argument. Subsequent calls should have the first argument set to NULL. If a token ends with a delimiter, this delimiting character is overwritten with a '\\0' and a pointer to the next character is saved for the next call to \fBstrtok_P()\fP. The delimiter string \fCdelim\fP may be different for each call.
|
|
.PP
|
|
The \fBstrtok_P()\fP function is similar to \fBstrtok()\fP except that \fCdelim\fP is pointer to a string in program space.
|
|
.PP
|
|
\fBReturns:\fP
|
|
.RS 4
|
|
The \fBstrtok_P()\fP function returns a pointer to the next token or NULL when no more tokens are found.
|
|
.RE
|
|
.PP
|
|
\fBNote:\fP
|
|
.RS 4
|
|
\fBstrtok_P()\fP is NOT reentrant. For a reentrant version of this function see \fBstrtok_rP()\fP.
|
|
.RE
|
|
.PP
|
|
|
|
.SS "char * strtok_rP (char * string, const char * delim, char ** last)"
|
|
.PP
|
|
Parses string into tokens. The \fBstrtok_rP()\fP function parses \fCstring\fP into tokens. The first call to \fBstrtok_rP()\fP should have string as its first argument. Subsequent calls should have the first argument set to NULL. If a token ends with a delimiter, this delimiting character is overwritten with a '\\0' and a pointer to the next character is saved for the next call to \fBstrtok_rP()\fP. The delimiter string \fCdelim\fP may be different for each call. \fClast\fP is a user allocated char* pointer. It must be the same while parsing the same string. \fBstrtok_rP()\fP is a reentrant version of \fBstrtok_P()\fP.
|
|
.PP
|
|
The \fBstrtok_rP()\fP function is similar to \fBstrtok_r()\fP except that \fCdelim\fP is pointer to a string in program space.
|
|
.PP
|
|
\fBReturns:\fP
|
|
.RS 4
|
|
The \fBstrtok_rP()\fP function returns a pointer to the next token or NULL when no more tokens are found.
|
|
.RE
|
|
.PP
|
|
|
|
.SH "Author"
|
|
.PP
|
|
Generated automatically by Doxygen for avr-libc from the source code.
|