[][src]Trait sunrise_libutils::io::Io

pub trait Io {
    type Value: Copy;
    fn read(&self) -> Self::Value;
fn write(&mut self, value: Self::Value); fn readf(&self, flags: Self::Value) -> bool
    where
        Self::Value: PartialEq + BitAnd<Output = Self::Value>
, { ... }
fn writef(&mut self, flags: Self::Value, value: bool)
    where
        Self::Value: PartialEq + BitAnd<Output = Self::Value> + BitOr<Output = Self::Value> + Not<Output = Self::Value>
, { ... } }

The Io trait allows for accessing device IO in a generic way, abstracting over different IO accesses (Port IO and Memory Mapped IO).

Associated Types

type Value: Copy

The width of the IO access. Should be a primitive type like u8, u16, u32...

Loading content...

Required methods

fn read(&self) -> Self::Value

Reads from this Io.

fn write(&mut self, value: Self::Value)

Writes value to this Io.

Loading content...

Provided methods

fn readf(&self, flags: Self::Value) -> bool where
    Self::Value: PartialEq + BitAnd<Output = Self::Value>, 

Read from this Io, and mask the value with flags.

fn writef(&mut self, flags: Self::Value, value: bool) where
    Self::Value: PartialEq + BitAnd<Output = Self::Value> + BitOr<Output = Self::Value> + Not<Output = Self::Value>, 

Mask value with flags, and write it to this device address. Note that this causes a read!

Loading content...

Implementors

impl Io for Pio<u8>[src]

Read/Write for byte PIO

type Value = u8

fn read(&self) -> u8[src]

Read

fn write(&mut self, value: u8)[src]

Write

impl Io for Pio<u16>[src]

Read/Write for word PIO

type Value = u16

fn read(&self) -> u16[src]

Read

fn write(&mut self, value: u16)[src]

Write

impl Io for Pio<u32>[src]

Read/Write for doubleword PIO

type Value = u32

fn read(&self) -> u32[src]

Read

fn write(&mut self, value: u32)[src]

Write

impl<T> Io for Mmio<T> where
    T: Copy
[src]

type Value = T

fn read(&self) -> T[src]

Performs a volatile read of the value.

fn write(&mut self, value: T)[src]

Performs a volatile write of the value.

Loading content...