- 
                Notifications
    You must be signed in to change notification settings 
- Fork 108
Add SDMMC support. #315
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add SDMMC support. #315
Conversation
0f312c8    to
    ea02eb0      
    Compare
  
            
          
                src/sdmmc.rs
              
                Outdated
          
        
      | 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.