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

Method write

src/fs/ata.rs:346–367  ·  view source on GitHub ↗

WRITE

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

Source from the content-addressed store, hash-verified

344
345 // WRITE
346 fn write(&mut self, drive: u8, blk: u32, buffer: &[u8]) -> Result<(), ()>
347 {
348 serprint!("{}", buffer.len() == BLKSIZE);
349 self.setup_pio(drive, blk)?;
350 self.writecmd(Command::Write)?;
351 for chunk in buffer.chunks(2)
352 {
353 let data = u16::from_le_bytes(chunk.try_into().unwrap());
354 self.data_write(data);
355 }
356
357 if self.error()
358 {
359 serprintln!("[ERR] DATA WRITE ERROR");
360 self.debug();
361 Err(())
362 }
363 else
364 {
365 Ok(())
366 }
367 }
368
369 // WRITE COMMAND
370 fn writecmd(&mut self, cmd: Command) -> Result<(), ()>

Callers 6

data_writeMethod · 0.45
driveselMethod · 0.45
resetMethod · 0.45
writecmdMethod · 0.45
write_cmd_paramsMethod · 0.45
writeFunction · 0.45

Calls 6

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

Tested by

no test coverage detected