1
/* Copyright (c) 2006, Carlos Lamas
3
based on libc/pmstring/memcpy_P.S which is
4
Copyright (c) 2002, Marek Michalkiewicz
8
Redistribution and use in source and binary forms, with or without
9
modification, are permitted provided that the following conditions are met:
11
* Redistributions of source code must retain the above copyright
12
notice, this list of conditions and the following disclaimer.
13
* Redistributions in binary form must reproduce the above copyright
14
notice, this list of conditions and the following disclaimer in
15
the documentation and/or other materials provided with the
17
* Neither the name of the copyright holders nor the names of
18
contributors may be used to endorse or promote products derived
19
from this software without specific prior written permission.
21
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31
POSSIBILITY OF SUCH DAMAGE. */
33
/* $Id: memcpy_PF.S 2191 2010-11-05 13:45:57Z arcanum $ */
35
#if !defined(__AVR_TINY__)
48
/** \ingroup avr_pgmspace
49
\fn void *memcpy_PF (void *dest, uint_farptr_t src, size_t n)
50
\brief Copy a memory block from flash to SRAM
52
The memcpy_PF() function is similar to memcpy(), except the data
53
is copied from the program space and is addressed using a far pointer
55
\param dst A pointer to the destination buffer
56
\param src A far pointer to the origin of data in flash memory
57
\param n The number of bytes to be copied
59
\returns The memcpy_PF() function returns a pointer to \e dst. The contents
60
of RAMPZ SFR are undefined when the function returns */
62
#if !defined(__DOXYGEN__)
66
.type _U(memcpy_PF), @function
70
LPM_R0_ZPLUS_INIT src_b2
77
rjmp .L_memcpy_PF_start
82
LPM_R0_ZPLUS_NEXT src_b2
87
LPM_R0_ZPLUS_NEXT src_b2
97
rjmp .L_memcpy_PF_start
101
LPM_R0_ZPLUS_NEXT src_b2
111
brcc .L_memcpy_PF_loop
113
; return dest (unchanged)
119
.size _U(memcpy_PF), .L_memcpy_PF_end - _U(memcpy_PF)
121
#endif /* not __DOXYGEN__ */
123
#endif /* !defined(__AVR_TINY__) */