DMI_FIELD_EXTENDED

Synopsis

#include <opendmi/field.h>

DMI_FIELD_EXTENDED(structure, member, wire_type, ...)

Description

The specification widens a field by leaving the plain one in place and adding a wider one to a later version, which the plain one points at by holding a value of its own, e.g. 0xFFFF. Both fields name the same member: the plain one, declared with DMI_FIELD, decodes into it, and the extended one replaces the value when the plain one says that the real value is there.

The extended field is read wherever it is declared even when the plain one does not point at it, since it occupies its bytes either way. On encoding, the plain field takes the value whenever it fits, and points at the extended one otherwise; in the preserve mode, the representation of the source data is kept as long as the value fits it.

Parameters

structure, member

Structure and member the plain field and the extended one decode into.

wire_type

Type the extended field is written with.

…​

Further parameters, given as the designated initializers of dmi_field_params_t:

.when_raw

Value of the plain field which says that the extended field carries the real value.

.when

Member whose plain field says so, for a run of extended fields the specification keys on one plain field, which are widened together. Left unset for the extended fields answering to their own member.

.decode, .encode

Handlers of the extended field, see DMI_FIELD.

Example

Start and end addresses of a memory device mapped address, both widened when the start one says so:

DMI_FIELD_GROUP(.since = DMI_VERSION(2, 7, 0)),
DMI_FIELD_EXTENDED(dmi_memory_device_addr_t, start_address, dmi_qword_t,
                   .when_raw = 0xFFFFFFFFu),
DMI_FIELD_EXTENDED(dmi_memory_device_addr_t, end_address, dmi_qword_t,
                   .when     = dmi_member(dmi_memory_device_addr_t, start_address),
                   .when_raw = 0xFFFFFFFFu),