63 [[nodiscard]]
auto GetChar() const -> uint8_t {
84 [[nodiscard]]
auto HasData() const ->
bool {
auto TryGetChar() const -> std::optional< uint8_t >
非阻塞式尝试读取一个字符
static constexpr uint8_t kRegTHR
write mode: Transmit Holding Reg
auto PutChar(uint8_t c) const -> void
写入一个字符
static constexpr uint8_t kRegIER
write mode: interrupt enable reg
Ns16550a(const Ns16550a &)=delete
static constexpr uint8_t kUartDLM
MSB of divisor Latch when enabled.
auto operator=(const Ns16550a &) -> Ns16550a &=delete
static constexpr uint8_t kRegLSR
read mode: Line Status Reg
Ns16550a(Ns16550a &&)=default
static constexpr uint8_t kRegISR
read mode: Interrupt Status Reg
static constexpr uint8_t kRegMCR
write mode: Modem Control Reg
static constexpr uint8_t kRegFCR
write mode: FIFO control Reg
static auto Create(uint64_t dev_addr) -> Expected< Ns16550a >
工厂方法:创建并初始化 NS16550A 驱动
Ns16550a(uint64_t dev_addr)
auto HasData() const -> bool
检查接收缓冲区是否有数据可读(不消耗数据)
static constexpr uint8_t kRegMSR
read mode: Modem Status Reg
auto GetChar() const -> uint8_t
阻塞式读取一个字符
static constexpr uint8_t kRegLCR
write mode: Line Control Reg
auto operator=(Ns16550a &&) -> Ns16550a &=default
auto IsInterruptPending() const -> bool
检查是否有中断挂起
static constexpr uint8_t kRegRHR
read mode: Receive holding reg
auto GetInterruptId() const -> uint8_t
读取中断标识寄存器(ISR / IIR)
static constexpr uint8_t kUartDLL
LSB of divisor Latch when enabled.
std::expected< T, Error > Expected
std::expected 别名模板
auto Write(size_t offset, T val) const -> void
Write to MMIO register.
auto Read(size_t offset) const -> T
Read from MMIO register.
volatile uint8_t * uart
TODO: Add description.