Skip to main content

Uart

Struct Uart 

Source
pub struct Uart {
    state: AtomicU8,
    base_addr: u16,
}
Expand description

x86_64 UART driver implementing UartOps

Fields§

§state: AtomicU8§base_addr: u16

Implementations§

Source§

impl Uart

Source

const INIT_CALLED: u8

Source

const USABLE: u8

Source

pub fn new(base_addr: u16) -> Self

Constructor; creates a new uninitialized Uart device with the given base_addr

Source

pub fn com1() -> Self

Wrapper around Self::new; creates a Uart device with a base_addr of 0x3F8

Source

pub fn com2() -> Self

Wrapper around Self::new; creates a Uart device with a base_addr of 0x2F8

Source

pub fn com3() -> Self

Wrapper around Self::new; creates a Uart device with a base_addr of 0x3E8

Source

pub fn com4() -> Self

Wrapper around Self::new; creates a Uart device with a base_addr of 0x2E8

Source

fn reg(&self, offset: u16) -> Port<u8>

Returns the I/O port at offset from this UART device’s base_addr

Source

fn is_usable(&self) -> bool

Checks if the given device is usable (fully initialized)

Trait Implementations§

Source§

impl UartOps for Uart

Source§

fn init(&mut self) -> Result<(), UartError>

Initialize the UART device
Source§

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

Read one byte from the UART device
Source§

fn write_byte(&mut self, byte: u8) -> Result<(), UartError>

Write one byte to the UART device
Source§

fn write_string(&mut self, string: &str) -> Result<(), UartError>

Write a string to the serial device Default implementation calls Self::write_byte for each byte in the string

Auto Trait Implementations§

§

impl !Freeze for Uart

§

impl RefUnwindSafe for Uart

§

impl Send for Uart

§

impl Sync for Uart

§

impl Unpin for Uart

§

impl UnsafeUnpin for Uart

§

impl UnwindSafe for Uart

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.