MEM_VAL_COPY_xxx()
These macros copy data values from any CPU memory address to any other memory address.
Files
lib_mem.h
Prototypes
MEM_VAL_COPY_08(addr_dest, addr_src); MEM_VAL_COPY_16(addr_dest, addr_src); MEM_VAL_COPY_32(addr_dest, addr_src); MEM_VAL_COPY(addr_dest, addr_src, val_size);
Arguments
addr_dest
Lowest CPU memory address to copy source address’s data value.
addr_src
Lowest CPU memory address of the data value to copy.
val_size
Number of data value octets to copy.
Returned Value
None.
Required Configuration
None.
Notes / Warnings
CPU memory addresses/pointers not checked for NULL
nor overlapping memory addresses which may result in undefined copy behavior.
MEM_VAL_COPY_xxx()
macros copy data values based on CPU’s native data-word order.
MEM_VAL_COPY_xxx()
macros copy data values without regard to CPU word-aligned addresses. Thus for processors that require data word alignment, data words can be copied to/from any CPU addresses, word-aligned or not, without generating data-word-alignment exceptions/faults.
Fixed-size copy MEM_VAL_COPY_xxx()
macros are more efficient than dynamic-size copy MEM_VAL_COPY()
macro and should be used whenever possible.
MEM_VAL_COPY_xxx()
macros are not atomic operations and must not be used on any non-static (i.e., volatile) variables, registers, hardware, etc; without the caller of the macros providing some form of additional protection (e.g. mutual exclusion).
Example Usage
CPU_INT16U *pmem; CPU_INT16U *pval; pmem = &SomeAddr; /* Any CPU address */ pval = &SomeVal; /* Any CPU address */ MEM_VAL_COPY_16(pmem, pval);