MCPcopy Create free account
hub / github.com/LibertyOS-Development/kernel / read

Method read

src/fs/ata.rs:276–297  ·  view source on GitHub ↗

READ

(&mut self, drive: u8, blk: u32, buffer: &mut [u8])

Source from the content-addressed store, hash-verified

274
275 // READ
276 fn read(&mut self, drive: u8, blk: u32, buffer: &mut [u8]) -> Result<(), ()>
277 {
278 // serprint!("{}", buffer.len() == BLKSIZE);
279 self.setup_pio(drive, blk)?;
280 self.writecmd(Command::Read)?;
281 for chunk in buffer.chunks_mut(2)
282 {
283 let data = self.data_read().to_le_bytes();
284 chunk.clone_from_slice(&data);
285 }
286
287 if self.error()
288 {
289 serprintln!("[ERR] DATA READ ERROR");
290 self.debug();
291 Err(())
292 }
293 else
294 {
295 Ok(())
296 }
297 }
298
299
300 // RESET

Callers 6

clrintrMethod · 0.45
data_readMethod · 0.45
lba1Method · 0.45
lba2Method · 0.45
statusMethod · 0.45
readFunction · 0.45

Calls 6

setup_pioMethod · 0.80
writecmdMethod · 0.80
data_readMethod · 0.80
errorMethod · 0.80
debugMethod · 0.80
ErrEnum · 0.50

Tested by

no test coverage detected