Skip to main content

Pl011

Struct Pl011 

Source
pub struct Pl011 { /* private fields */ }
Expand description

PL011 UART 驱动结构体

Implementations§

Source§

impl Pl011

Source

pub fn new_no_clock(base: NonNull<u8>) -> Self

创建新的 PL011 实例(仅基地址,使用默认配置)

§Arguments
  • base - UART 寄存器基地址
Source

pub fn new(base: NonNull<u8>, clock_freq: u32) -> Self

Source

pub fn open(&mut self)

初始化 PL011 UART

Source

pub fn set_irq_mask(&mut self, events: SerialEventSet)

Source

pub fn get_irq_mask(&self) -> SerialEventSet

Source

pub fn pending(&mut self, direction: SerialDirection) -> bool

Source

pub fn poll_status(&mut self) -> SerialEvent

Source

pub fn try_write(&mut self, bytes: &[u8]) -> usize

Source

pub fn try_read(&mut self, bytes: &mut [u8]) -> Result<usize, TransBytesError>

Source

pub fn write_byte(&mut self, byte: u8)

Source

pub fn read_byte( &mut self, status: SerialEvent, ) -> Option<Result<u8, TransferError>>

Source

pub fn read_rx(&mut self) -> Option<RxSample>

Source§

impl Pl011

Source

pub fn enable_fifo(&self, enable: bool)

启用或禁用 FIFO

Source

pub fn set_fifo_trigger_level(&self, rx_level: u8, tx_level: u8)

设置 FIFO 触发级别

Trait Implementations§

Source§

impl PollingUart for Pl011

Source§

fn poll_status(&mut self) -> SerialEvent

Source§

fn write_byte(&mut self, byte: u8)

Source§

fn read_byte( &mut self, status: SerialEvent, ) -> Option<Result<u8, TransferError>>

Source§

impl SplitUart for Pl011

Source§

impl UartPort for Pl011

Source§

fn startup(&mut self, config: &Config) -> Result<(), ConfigError>

Initializes the UART while leaving every device interrupt source masked.
Source§

fn shutdown(&mut self)

Source§

fn set_config(&mut self, config: &Config) -> Result<(), ConfigError>

Source§

fn read_rx(&mut self) -> Option<RxSample>

Reads one normalized hardware sample without consulting IRQ state.
Source§

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

Returns whether both the FIFO and transmitter shift register are empty.
Source§

fn mask_all(&mut self)

Source§

fn rearm(&mut self, sources: SerialEventSet) -> SerialEventSet

Rearms sources and closes the enable/readiness race. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.