From 80382da44362f47107e5aab12a7e56f4cc011926 Mon Sep 17 00:00:00 2001 From: Tilman Sauerbeck Date: Wed, 8 Jan 2020 12:43:14 +0100 Subject: [PATCH] common: Implement Storage::size() in Mx25l. --- src/common/mx25l.rs | 4 ++++ src/common/storage.rs | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/common/mx25l.rs b/src/common/mx25l.rs index ea2b8c1..ecc42ba 100644 --- a/src/common/mx25l.rs +++ b/src/common/mx25l.rs @@ -157,6 +157,10 @@ impl Mx25l { } impl Storage for Mx25l { + fn size(&self) -> usize { + 2 << 20 + } + fn read(&self, address: usize, buffer: &mut [u8]) { self.with_selected(|| { spi::tx8(spi::SPI0, Command::READ as u8); diff --git a/src/common/storage.rs b/src/common/storage.rs index c6d3fb7..ebebe79 100644 --- a/src/common/storage.rs +++ b/src/common/storage.rs @@ -26,6 +26,8 @@ pub enum Error { } pub trait Storage { + fn size(&self) -> usize; + fn read(&self, address: usize, buffer: &mut [u8]); fn write(&mut self, address: usize, buffer: &[u8; 4096]) -> Result<(), Error>; -- 2.30.2