pub struct MmioSerialPort { /* private fields */ }
Expand description
A memory-mapped UART.
Implementations§
Source§impl MmioSerialPort
impl MmioSerialPort
Sourcepub const unsafe fn new(base: usize) -> Self
pub const unsafe fn new(base: usize) -> Self
Creates a new UART interface on the given memory mapped address.
This function is unsafe because the caller must ensure that the given base address really points to a serial port device.
Sourcepub const unsafe fn new_with_stride(base: usize, stride: usize) -> Self
pub const unsafe fn new_with_stride(base: usize, stride: usize) -> Self
Creates a new UART interface on the given memory mapped address with a given register stride.
This function is unsafe because the caller must ensure that the given base address really points to a serial port device.
Sourcepub fn init(&mut self)
pub fn init(&mut self)
Initializes the memory-mapped UART.
The default configuration of 38400/8-N-1 is used.
Sourcepub fn send_raw(&mut self, data: u8)
pub fn send_raw(&mut self, data: u8)
Sends a raw byte on the serial port, intended for binary data.
Sourcepub fn try_send_raw(&mut self, data: u8) -> Result<(), WouldBlockError>
pub fn try_send_raw(&mut self, data: u8) -> Result<(), WouldBlockError>
Tries to send a raw byte on the serial port, intended for binary data.
Sourcepub fn try_receive(&mut self) -> Result<u8, WouldBlockError>
pub fn try_receive(&mut self) -> Result<u8, WouldBlockError>
Tries to receive a byte on the serial port.
Trait Implementations§
Source§impl Debug for MmioSerialPort
impl Debug for MmioSerialPort
Auto Trait Implementations§
impl !Freeze for MmioSerialPort
impl RefUnwindSafe for MmioSerialPort
impl Send for MmioSerialPort
impl Sync for MmioSerialPort
impl Unpin for MmioSerialPort
impl UnwindSafe for MmioSerialPort
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