Struct SpiRegs

Source
#[repr(C)]
pub struct SpiRegs { /* private fields */ }

Implementations§

Source§

impl SpiRegs

Source

pub fn hsfsts_ctl(&self) -> HsfStsCtl

Examples found in repository?
examples/read.rs (line 14)
11fn main() {
12    let mut spi = unsafe { util::get_spi() };
13
14    eprintln!("SPI HSFSTS_CTL: {:?}", spi.regs.hsfsts_ctl());
15
16    let len = spi.len().unwrap();
17    eprintln!("SPI ROM: {} KB", len / 1024);
18
19    let mut data = Vec::with_capacity(len);
20    while data.len() < len {
21        let mut buf = [0; 65536];
22        let read = spi.read(data.len(), &mut buf).unwrap();
23        data.extend_from_slice(&buf[..read]);
24        eprint!("\rSPI READ: {} KB", data.len() / 1024);
25    }
26
27    eprintln!();
28
29    fs::write("read.rom", &data).unwrap();
30}
Source

pub fn set_hsfsts_ctl(&mut self, value: HsfStsCtl)

Source

pub fn fdo(&mut self, section: FdoSection, index: u16) -> u32

Trait Implementations§

Source§

impl Spi for SpiRegs

Source§

fn len(&mut self) -> Result<usize, SpiError>

Source§

fn read(&mut self, address: usize, buf: &mut [u8]) -> Result<usize, SpiError>

Source§

fn erase(&mut self, address: usize) -> Result<(), SpiError>

Source§

fn write(&mut self, address: usize, buf: &[u8]) -> Result<usize, SpiError>

Auto Trait Implementations§

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.