Software APIs
Data Fields
mock_mmio::MaskedBitField Struct Reference

Represents a single bit field in an integer, similar to BitField. More...

#include <sw/device/lib/base/mock_mmio_test_utils.h>

Data Fields

uintptr_t offset
 
uintptr_t mask
 
uintptr_t value
 

Detailed Description

Represents a single bit field in an integer, similar to BitField.

It can be used in most places that need a BitField, as well as in EXPECT_MASK macros.

Like with BitFields, we can express the integer 0b0000'0000'1100'0101 as a list of BitFieldMasks: {{0x0, 0x1, 1}, {0x1, 0x1, 0}, {0x2, 0x1, 1}, {0x3, 0x1, 0}, {0x4, 0xff, 12}}

In addition to showing how the integer is broken up, it also expresses the lengths of fields, so it is clear that 0x0 and 0x2 are one-bit fields. This also allows us to formally express that the fields 0x1 and 0x3 are unset.

In practice, this might use generated register constants, and look like {{FIELD_FOO_OFFSET, FIELD_FOO_MASK, 1}, ...}

Definition at line 59 of file mock_mmio_test_utils.h.

Field Documentation

◆ mask

uintptr_t mock_mmio::MaskedBitField::mask

Definition at line 61 of file mock_mmio_test_utils.h.

◆ offset

uintptr_t mock_mmio::MaskedBitField::offset

Definition at line 60 of file mock_mmio_test_utils.h.

◆ value

uintptr_t mock_mmio::MaskedBitField::value

Definition at line 62 of file mock_mmio_test_utils.h.