Add SDMMC support.#315
Conversation
0f312c8 to
ea02eb0
Compare
| let mut block = [0; 512]; | ||
| self.sdmmc.read_block(addr, &mut block)?; | ||
| buf[0..len].copy_from_slice(&block[offset..(offset + len)]); | ||
| self.pos += len as u64; |
There was a problem hiding this comment.
@reitermarkus i wonder.. are reads and writes always going to be within a single block? or.. do you need to allow for reads across block boundaries and reads are longer than 512?
It looks like the [fscommon::BufStream[(https://github.com/rafalh/rust-fscommon/blob/89706258032efff88689f6083510ed34b845fe46/src/buf_stream.rs#L97-L109) impl expects that the reads/writes might exceed the block size (512)..
There was a problem hiding this comment.
Yes, for read it's guaranteed since we can choose freely how much to read and return the read size. The caller has to ensure to read again if it's not enough, which is why the default implementation of read_exact is implemented as a loop over read.
For read_exact on the other hand we would have to ensure we read across boundaries since read_exact only succeeds when the given buffer is filled completely.
Add SDMMC support, including implementations for
embedded_sdmmcas well asfatfs.