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
Sourcepub fn open(&mut self) -> Result<(), ConfigError>
pub fn open(&mut self) -> Result<(), ConfigError>
初始化 PL011 UART
pub fn set_irq_mask(&mut self, events: SerialEventSet)
pub fn get_irq_mask(&self) -> SerialEventSet
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 write_byte(&mut self, byte: u8)
pub fn read_byte( &mut self, status: SerialEvent, ) -> Option<Result<u8, TransferError>>
pub fn read_rx(&mut self) -> Option<RxSample>
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 PollingUart for Pl011
impl PollingUart for Pl011
fn poll_status(&mut self) -> SerialEvent
fn write_byte(&mut self, byte: u8)
fn read_byte( &mut self, status: SerialEvent, ) -> Option<Result<u8, TransferError>>
Source§impl SplitUart for Pl011
impl SplitUart for Pl011
type Control = Pl011
type Irq = Pl011Irq
type EmergencyTx = Pl011EmergencyTx
fn runtime_info(&self) -> UartInfo
fn split(self) -> SerialParts<Self::Control, Self::Irq, Self::EmergencyTx>
Source§impl UartPort for Pl011
impl UartPort for Pl011
Source§fn startup(&mut self, config: &Config) -> Result<(), ConfigError>
fn startup(&mut self, config: &Config) -> Result<(), ConfigError>
Initializes the UART while leaving every device interrupt source masked. Read more
fn shutdown(&mut self)
fn set_config(&mut self, config: &Config) -> Result<(), ConfigError>
Source§fn read_rx(&mut self) -> Option<RxSample>
fn read_rx(&mut self) -> Option<RxSample>
Reads one normalized hardware sample without consulting IRQ state.
Source§fn discard_rx(&mut self)
fn discard_rx(&mut self)
Discards bytes and error state pending in the hardware receiver.
Source§fn discard_tx(&mut self) -> bool
fn discard_tx(&mut self) -> bool
Discards bytes queued in the hardware transmitter. A byte already in
the shift register may still complete.
Returns whether the hardware supports an independent TX-only discard.
Source§fn write_tx(&mut self, bytes: &[u8]) -> usize
fn write_tx(&mut self, bytes: &[u8]) -> usize
Writes as much of
bytes as the hardware can currently accept.Source§fn tx_idle(&mut self) -> bool
fn tx_idle(&mut self) -> bool
Returns whether both the FIFO and transmitter shift register are empty.
Source§fn mask(&mut self, sources: SerialEventSet)
fn mask(&mut self, sources: SerialEventSet)
Masks only the requested device-local interrupt sources.
fn mask_all(&mut self)
Source§fn rearm(&mut self, sources: SerialEventSet) -> SerialEventSet
fn rearm(&mut self, sources: SerialEventSet) -> SerialEventSet
Rearms
sources and closes the enable/readiness race. Read moreAuto 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