pub struct Pl011 { /* private fields */ }Expand description
PL011 UART 驱动结构体
Implementations§
Source§impl Pl011
impl Pl011
Sourcepub fn new_no_clock(base: NonNull<u8>) -> Self
pub fn new_no_clock(base: NonNull<u8>) -> Self
pub fn new(base: NonNull<u8>, clock_freq: u32) -> Self
pub fn set_irq_mask(&mut self, mask: InterruptMask)
pub fn get_irq_mask(&self) -> InterruptMask
pub fn pending(&mut self, direction: SerialDirection) -> bool
pub fn poll_status(&mut self) -> SerialEvent
pub fn try_write(&mut self, bytes: &[u8]) -> usize
pub fn try_read(&mut self, bytes: &mut [u8]) -> Result<usize, TransBytesError>
pub fn handle_irq(&mut self) -> SerialEvent
pub fn write_byte(&mut self, byte: u8)
pub fn read_byte( &mut self, status: SerialEvent, ) -> Option<Result<u8, TransferError>>
pub fn take_irq_snapshot(&mut self) -> IrqSnapshot
pub fn read_rx(&mut self) -> Option<RxSample>
Source§impl Pl011
impl Pl011
Sourcepub fn enable_fifo(&self, enable: bool)
pub fn enable_fifo(&self, enable: bool)
启用或禁用 FIFO
Sourcepub fn set_fifo_trigger_level(&self, rx_level: u8, tx_level: u8)
pub fn set_fifo_trigger_level(&self, rx_level: u8, tx_level: u8)
设置 FIFO 触发级别
Trait Implementations§
Source§impl RawUart for Pl011
impl RawUart for Pl011
fn name(&self) -> &'static str
fn base_addr(&self) -> usize
fn clock_freq(&self) -> Option<NonZeroU32>
Source§fn startup(&mut self, config: &Config) -> Result<(), ConfigError>
fn startup(&mut self, config: &Config) -> Result<(), ConfigError>
初始化 FIFO、控制寄存器和线路参数。 Read more
Source§fn set_config(&mut self, config: &Config) -> Result<(), ConfigError>
fn set_config(&mut self, config: &Config) -> Result<(), ConfigError>
调整 baud/data bits/parity/stop bits。 Read more
fn baudrate(&self) -> u32
fn data_bits(&self) -> DataBits
fn stop_bits(&self) -> StopBits
fn parity(&self) -> Parity
fn enable_loopback(&mut self)
fn disable_loopback(&mut self)
fn is_loopback_enabled(&self) -> bool
Source§fn set_irq_mask(&mut self, mask: InterruptMask)
fn set_irq_mask(&mut self, mask: InterruptMask)
写设备侧 IRQ mask。它只管理设备中断,不是同步原语。
Source§fn take_irq_snapshot(&mut self) -> IrqSnapshot
fn take_irq_snapshot(&mut self) -> IrqSnapshot
读取并按硬件要求确认当前 IRQ source。
Source§fn tx_load_size(&self) -> usize
fn tx_load_size(&self) -> usize
一轮 IRQ 建议写入的最大字节数。
Source§fn poll_status(&mut self) -> SerialEvent
fn poll_status(&mut self) -> SerialEvent
Read a raw hardware status snapshot. Read more
Source§fn write_byte(&mut self, byte: u8)
fn write_byte(&mut self, byte: u8)
Direct polling helper for early console users.
Source§fn read_byte(
&mut self,
status: SerialEvent,
) -> Option<Result<u8, TransferError>>
fn read_byte( &mut self, status: SerialEvent, ) -> Option<Result<u8, TransferError>>
Consume one byte/error according to caller-owned polling state.
fn ack_modem_status(&mut self)
fn ack_busy_detect(&mut self)
Auto Trait Implementations§
impl !RefUnwindSafe for Pl011
impl !UnwindSafe for Pl011
impl Freeze for Pl011
impl Send for Pl011
impl Sync for Pl011
impl Unpin for Pl011
impl UnsafeUnpin for Pl011
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more