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 new_boxed(base: NonNull<u8>, clock_freq: u32) -> BSerial

Source

pub fn task_tx(&mut self) -> Option<Sender>

Source

pub fn task_rx(&mut self) -> Option<Reciever>

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 InterfaceRaw for Pl011

Source§

type IrqHandler = Pl011IrqHandler

Source§

type Sender = Sender

Source§

type Reciever = Reciever

Source§

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

Source§

fn baudrate(&self) -> u32

Source§

fn data_bits(&self) -> DataBits

Source§

fn stop_bits(&self) -> StopBits

Source§

fn parity(&self) -> Parity

Source§

fn open(&mut self)

Source§

fn close(&mut self)

Source§

fn clock_freq(&self) -> Option<NonZeroU32>

Source§

fn enable_loopback(&mut self)

启用回环模式
Source§

fn disable_loopback(&mut self)

禁用回环模式
Source§

fn is_loopback_enabled(&self) -> bool

检查回环模式是否启用
Source§

fn set_irq_mask(&mut self, mask: InterruptMask)

设置中断使能掩码
Source§

fn get_irq_mask(&self) -> InterruptMask

获取当前中断使能掩码
Source§

fn base_addr(&self) -> usize

Source§

fn irq_handler(&mut self) -> Option<Self::IrqHandler>

Source§

fn take_tx(&mut self) -> Option<Self::Sender>

Source§

fn take_rx(&mut self) -> Option<Self::Reciever>

Source§

fn set_tx(&mut self, tx: Self::Sender) -> Result<(), SetBackError>

Source§

fn set_rx(&mut self, rx: Self::Reciever) -> Result<(), SetBackError>

Auto Trait Implementations§

§

impl Freeze for Pl011

§

impl !RefUnwindSafe for Pl011

§

impl Send for Pl011

§

impl !Sync for Pl011

§

impl Unpin for Pl011

§

impl !UnwindSafe 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.