Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Current »

These macros decode data values from any CPU memory address.

Files

lib_mem.h

Prototypes

Arguments

addr

Lowest CPU memory address of the data value to decode.

Returned Value

Decoded data value from CPU memory address.

Required Configuration

None.

Notes / Warnings

CPU memory addresses/pointers not checked for NULL.

Decode data values based on the values’ data-word order in CPU memory:

MEM_VAL_GET_xxx_BIG()

Decode big-endian data values — data words’ most significant octet at lowest memory address

MEM_VAL_GET_xxx_LITTLE()

Decode little-endian data values — data words’ least significant octet at lowest memory address

MEM_VAL_GET_xxx()

Decode data values using CPU’s native or configured data-word order

MEM_VAL_GET_xxx() macros decode data values without regard to CPU word-aligned addresses. Thus for processors that require data word alignment, data words can be decoded from any CPU address, word-aligned or not, without generating data-word-alignment exceptions/faults. However, any variable to receive the returned data value must start on an appropriate CPU word-aligned address.

MEM_VAL_COPY_GET_xxx() macros are more efficient than MEM_VAL_GET_xxx() macros and are also fully independent of CPU data-word-alignment and should be used whenever possible.

MEM_VAL_GET_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

  • No labels