4.7 Functions for Specialized Copying and Initialization
These functions support specialized data copying and initialization.
Example of Use
#include "stdio.h"
#include "libpic30.h"
void display_mem(char *p, unsigned int len) {
int i;
for (i = 0; i < len; i++) {
printf(" %d", *p++);
}
printf("\n");
}
char __attribute__((space(prog))) dat[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
char buf[10];
int main() {
int i;
_prog_addressT p;
/* method 1 */
_init_prog_address(p, dat);
(void) _memcpy_p2d16(buf, p, 10);
display_mem(buf,10);
/* method 2 */
_init_prog_address(p, dat);
p = _memcpy_p2d16(buf, p, 4);
p = _memcpy_p2d16(&buf[4], p, 6);
display_mem(buf,10);
}