template <class UartDriver, template <typename, IoRegisterType> class IoProvider, class SyncPolicy, class IrqProvider>
class KernelDriver
Defined at line 567 of file ../../zircon/system/ulib/uart/include/lib/uart/uart.h
The KernelDriver template class is parameterized by those three to implement
actual driver logic for some environment.
The KernelDriver constructor just passes its arguments through to the
UartDriver constructor. So it can be created directly from a configuration
struct or copied from another UartDriver object. In this way, the device is
handed off from one KernelDriver instantiation to a different one using a
different IoProvider (physboot vs kernel) and/or Sync (polling vs blocking).
Public Methods
template <typename... Args>
void KernelDriver<UartDriver, IoProvider, SyncPolicy, IrqProvider> (Args &&... args)
This sets up the object but not the device itself. The device might
already have been set up by a previous instantiation's Init function,
or might never actually be set up because this instantiation gets
replaced with a different one before ever calling Init.
Defined at line 590 of file ../../zircon/system/ulib/uart/include/lib/uart/uart.h
template <typename LockPolicy = DefaultLockPolicy>
MmioRange mmio_range ()
Defined at line 601 of file ../../zircon/system/ulib/uart/include/lib/uart/uart.h
template <typename LockPolicy = DefaultLockPolicy>
IoPortRange ioports ()
Defined at line 608 of file ../../zircon/system/ulib/uart/include/lib/uart/uart.h
template <typename LockPolicy = DefaultLockPolicy>
uart_type TakeUart ()
Defined at line 614 of file ../../zircon/system/ulib/uart/include/lib/uart/uart.h
template <typename LockPolicy = DefaultLockPolicy>
config_type config ()
Returns a copy of the underlying uart config.
Defined at line 621 of file ../../zircon/system/ulib/uart/include/lib/uart/uart.h
auto & io ()
Access IoProvider object.
Defined at line 627 of file ../../zircon/system/ulib/uart/include/lib/uart/uart.h
auto & irq ()
Access IrqProvider object.
Defined at line 630 of file ../../zircon/system/ulib/uart/include/lib/uart/uart.h
template <typename LockPolicy = DefaultLockPolicy>
void Init ()
Set up the device for nonblocking output and polling input.
If the device is handed off from a different instantiation,
this won't be called in the new instantiation.
Defined at line 636 of file ../../zircon/system/ulib/uart/include/lib/uart/uart.h
template <typename LockPolicy = DefaultLockPolicy>
void Unparse (FILE * out)
Write out a string that Parse() can read back to recreate the driver
state. This doesn't preserve the driver state, only the configuration.
Defined at line 644 of file ../../zircon/system/ulib/uart/include/lib/uart/uart.h
template <typename LockPolicy = DefaultLockPolicy>
void Unparse (FILE * out)
Write out a string that Parse() can read back to recreate the driver
state. This doesn't preserve the driver state, only the configuration.
Defined at line 644 of file ../../zircon/system/ulib/uart/include/lib/uart/uart.h
template <typename LockPolicy = DefaultLockPolicy>
void SetLineControl (std::optional<DataBits> data_bits, std::optional<Parity> parity, std::optional<StopBits> stop_bits)
Configure the UART line control settings.
An individual setting given by std::nullopt signifies that it should be
left as previously configured.
TODO(https://fxbug.dev/42053694): Separate out the setting of baud rate.
Defined at line 656 of file ../../zircon/system/ulib/uart/include/lib/uart/uart.h
template <typename LockPolicy = DefaultLockPolicy>
void SetLineControl (std::optional<DataBits> data_bits, std::optional<Parity> parity, std::optional<StopBits> stop_bits)
Configure the UART line control settings.
An individual setting given by std::nullopt signifies that it should be
left as previously configured.
TODO(https://fxbug.dev/42053694): Separate out the setting of baud rate.
Defined at line 656 of file ../../zircon/system/ulib/uart/include/lib/uart/uart.h
template <typename LockPolicy = DefaultLockPolicy, typename... Args>
void InitInterrupt (Args &&... args)
TODO(https://fxbug.dev/42079801): Asses the need of |enable_interrupt_callback|.
Defined at line 665 of file ../../zircon/system/ulib/uart/include/lib/uart/uart.h
template <typename LockPolicy = DefaultLockPolicy>
void PrepareForSuspend ()
Defined at line 672 of file ../../zircon/system/ulib/uart/include/lib/uart/uart.h
template <typename LockPolicy = DefaultLockPolicy>
void WakeupFromSuspend ()
Defined at line 678 of file ../../zircon/system/ulib/uart/include/lib/uart/uart.h
template <typename Tx, typename Rx>
void Interrupt (Tx && tx, Rx && rx)
Defined at line 684 of file ../../zircon/system/ulib/uart/include/lib/uart/uart.h
template <typename LockPolicy = DefaultLockPolicy, typename... Args>
int Write (std::string_view str, Args &&... waiter_args)
This is the FILE-compatible API: `FILE::stdout_ = FILE{
&driver
};`.
Defined at line 692 of file ../../zircon/system/ulib/uart/include/lib/uart/uart.h
template <typename LockPolicy = DefaultLockPolicy, typename... Args>
int Write (std::string_view str, Args &&... waiter_args)
This is the FILE-compatible API: `FILE::stdout_ = FILE{
&driver
};`.
Defined at line 692 of file ../../zircon/system/ulib/uart/include/lib/uart/uart.h
template <typename LockPolicy = DefaultLockPolicy>
auto Read ()
This is a direct polling read, not used in interrupt-based operation.
Defined at line 719 of file ../../zircon/system/ulib/uart/include/lib/uart/uart.h
template <typename LockPolicy = DefaultLockPolicy>
void EnableRxInterrupt ()
Defined at line 725 of file ../../zircon/system/ulib/uart/include/lib/uart/uart.h