class Register
Defined at line 27 of file ../../sdk/lib/driver/mock-mmio/cpp/register.h
Mocks a single MMIO register. This class is intended to be used with a fdf::MmioBuffer;
operations on an instance of that class will be directed to the mock if the mock-mmio library
is a dependency of the test.
Each ExpectRead() and ExpectWrite() call adds to the Register's list of expected transactions
in FIFO order and must be added before the actual read or write call. When the Register receives
a Read() or Write() call, it removes the next expected transaction in the list and verifies that
it matches the Read() or Write() call.
At the end of the test, VerifyAndClear() should be called to verify that the Register has no
outstanding expected transactions.
Public Methods
uint64_t Read ()
Reads from the mocked register. Returns the value set by the next expectation, or the default
value. The default is initially zero and can be set by calling ReadReturns() or Write(). This
method is expected to be called (indirectly) by the code under test.
Defined at line 12 of file ../../sdk/lib/driver/mock-mmio/cpp/register.cc
void Write (uint64_t value)
Writes to the mocked register. This method is expected to be called (indirectly) by the code
under test.
Defined at line 27 of file ../../sdk/lib/driver/mock-mmio/cpp/register.cc
Register & ExpectRead (uint64_t value)
Matches a register read and returns the specified value.
Defined at line 41 of file ../../sdk/lib/driver/mock-mmio/cpp/register.cc
Register & ExpectRead ()
Matches a register read and returns the default value.
Defined at line 49 of file ../../sdk/lib/driver/mock-mmio/cpp/register.cc
Register & ReadReturns (uint64_t value)
Sets the default register read value.
Defined at line 56 of file ../../sdk/lib/driver/mock-mmio/cpp/register.cc
Register & ExpectWrite (uint64_t value)
Matches a register write with the specified value.
Defined at line 62 of file ../../sdk/lib/driver/mock-mmio/cpp/register.cc
Register & ExpectWrite ()
Matches any register write.
Defined at line 70 of file ../../sdk/lib/driver/mock-mmio/cpp/register.cc
void Clear ()
Removes and ignores all expectations and resets the default read value.
Defined at line 76 of file ../../sdk/lib/driver/mock-mmio/cpp/register.cc
void VerifyAndClear ()
Removes all expectations and resets the default value. The presence of any outstanding
expectations causes a test failure.
Defined at line 90 of file ../../sdk/lib/driver/mock-mmio/cpp/register.cc