class Driver

Defined at line 95 of file ../../zircon/system/ulib/uart/include/lib/uart/mock.h

uart::KernelDriver UartDriver API

This pretends to be a hardware driver but is just a mock for tests. If

uart::mock::Sync is also used to instantiate uart::KernelDriver, then the

expected synchronization calls are primed into the Driver mock so their

ordering relative to the hardware driver calls can be tested. The mock

hardware Driver can also be used with other Sync API providers.

Public Members

static IoRegisterType kIoType

Public Methods

void Driver ()

Defined at line 99 of file ../../zircon/system/ulib/uart/include/lib/uart/mock.h

void Driver (const Driver & )

Defined at line 100 of file ../../zircon/system/ulib/uart/include/lib/uart/mock.h

void Driver (Driver && )

Defined at line 101 of file ../../zircon/system/ulib/uart/include/lib/uart/mock.h

config_type config ()

Defined at line 104 of file ../../zircon/system/ulib/uart/include/lib/uart/mock.h

size_t io_slots ()

Defined at line 105 of file ../../zircon/system/ulib/uart/include/lib/uart/mock.h

Driver & ExpectInit ()

Fluent API for priming and checking the mock.

Defined at line 110 of file ../../zircon/system/ulib/uart/include/lib/uart/mock.h

Driver & ExpectTxReady (bool ready)

Defined at line 115 of file ../../zircon/system/ulib/uart/include/lib/uart/mock.h

template <typename Char>
Driver & ExpectWrite (const std::basic_string_view<Char> chars)

Note this takes the chars that the Write call will consume, not the chars

it expects to be called with. The Write call might be passed more chars

and will consume (and verify) only this many.

Defined at line 124 of file ../../zircon/system/ulib/uart/include/lib/uart/mock.h

Driver & ExpectLock ()

Defined at line 135 of file ../../zircon/system/ulib/uart/include/lib/uart/mock.h

Driver & ExpectUnlock ()

Defined at line 140 of file ../../zircon/system/ulib/uart/include/lib/uart/mock.h

Driver & ExpectWait (bool block)

Defined at line 145 of file ../../zircon/system/ulib/uart/include/lib/uart/mock.h

Driver & ExpectAssertHeld ()

Defined at line 150 of file ../../zircon/system/ulib/uart/include/lib/uart/mock.h

Driver & ExpectEnableTxInterrupt ()

Defined at line 155 of file ../../zircon/system/ulib/uart/include/lib/uart/mock.h

void VerifyAndClear ()

Defined at line 160 of file ../../zircon/system/ulib/uart/include/lib/uart/mock.h

void ~Driver ()

Defined at line 162 of file ../../zircon/system/ulib/uart/include/lib/uart/mock.h

void Init (IoProviderType & io)

uart::KernelDriver UartDriver API

Each method is a template parameterized by an an IoProvider type that

provides access to hwreg-compatible types accessing the hardware registers

via hwreg ReadFrom and WriteTo methods. Real Driver types can be used

with hwreg::mock::IoProvider in tests independent of actual hardware

access. The mock Driver to be used with hwreg::mock::IoProvider, but it

never makes any calls.

Defined at line 173 of file ../../zircon/system/ulib/uart/include/lib/uart/mock.h

bool TxReady (IoProviderType & io)

Return true if Write can make forward progress right now.

Defined at line 176 of file ../../zircon/system/ulib/uart/include/lib/uart/mock.h

template <typename It1, typename It2>
auto Write (IoProviderType & io, bool , It1 it, const It2 & end)

This is called only when TxReady() has just returned true. Advance

the iterator at least one and as many as is convenient but not past

end, outputting each character before advancing.

Defined at line 182 of file ../../zircon/system/ulib/uart/include/lib/uart/mock.h

void EnableTxInterrupt (IoProviderType & io)

Defined at line 191 of file ../../zircon/system/ulib/uart/include/lib/uart/mock.h

Records

Friends

class Waiter
class Lock