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