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>) -> Serial<Self>

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

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

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

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

Source§

fn clone(&self) -> Pl011

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Register for Pl011

Source§

fn write_byte(&mut self, byte: u8)

Source§

fn read_byte(&mut self) -> Result<u8, TransferError>

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 clean_interrupt_status(&mut self) -> InterruptMask

获取并清除所有中断状态
Source§

fn line_status(&mut self) -> LineStatus

获取线路状态
Source§

fn read_reg(&self, offset: usize) -> u32

直接读取寄存器
Source§

fn write_reg(&mut self, offset: usize, value: u32)

直接写入寄存器
Source§

fn get_base(&self) -> usize

Source§

fn set_base(&mut self, base: usize)

Source§

fn clock_freq(&self) -> u32

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 read_buf(&mut self, buf: &mut [u8]) -> Result<usize, TransferError>

Source§

fn write_buf(&mut self, buf: &[u8]) -> usize

Source§

impl Send for Pl011

Source§

impl Sync for Pl011

Auto Trait Implementations§

§

impl Freeze for Pl011

§

impl !RefUnwindSafe 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.