A MockDevice represents a mock implementation of an MMIO device. More...
#include <sw/device/lib/base/mock_mmio.h>
Public Member Functions | |
| MockDevice (const MockDevice &)=delete | |
| MockDevice & | operator= (const MockDevice &)=delete |
| MockDevice (MockDevice &&)=delete | |
| MockDevice & | operator= (MockDevice &&)=delete |
| mmio_region_t | region () |
Converts this MockDevice into a mmio_region_t opaque object, which is compatible with mmio.h functions. | |
| MOCK_METHOD (uint8_t, Read8,(ptrdiff_t offset)) | |
| MOCK_METHOD (uint32_t, Read32,(ptrdiff_t offset)) | |
| MOCK_METHOD (void, Write8,(ptrdiff_t offset, uint8_t value)) | |
| MOCK_METHOD (void, Write32,(ptrdiff_t offset, uint32_t value)) | |
| template<typename Int> | |
| Int | GarbageMemory () |
| Generates "garbage memory" for use in tests. | |
A MockDevice represents a mock implementation of an MMIO device.
MockDevice provides two mockable member functions, representing a read and a write at a particular offset from the base address. This class can be converted into a mmio_region_t value, which, when used in mmio.h functions like read32(), will map to the appropriate mock member function calls.
To maintain sequencing, ReadN() and WriteN() should not be EXPECT_CALL'ed directly; instead, EXPECT_READN and EXPECT_WRITEN should be used, instead.
To use this class, -DMOCK_MMIO must be enabled in all translation units using mmio.h.
Definition at line 48 of file mock_mmio.h.
|
inline |
Generates "garbage memory" for use in tests.
This function should not be called directly.
Definition at line 74 of file mock_mmio.h.
|
inline |
Converts this MockDevice into a mmio_region_t opaque object, which is compatible with mmio.h functions.
Definition at line 61 of file mock_mmio.h.