WRITE COMMAND
(&mut self, cmd: Command)
| 368 | |
| 369 | // WRITE COMMAND |
| 370 | fn writecmd(&mut self, cmd: Command) -> Result<(), ()> |
| 371 | { |
| 372 | unsafe |
| 373 | { |
| 374 | self.cmd_reg.write(cmd as u8) |
| 375 | } |
| 376 | |
| 377 | // Wait for 400 nanoseconds |
| 378 | self.wait(400); |
| 379 | |
| 380 | // Ignore first read |
| 381 | self.status(); |
| 382 | self.clrintr(); |
| 383 | |
| 384 | // If drive does not exist |
| 385 | if self.status() == 0 |
| 386 | { |
| 387 | return Err(()); |
| 388 | } |
| 389 | |
| 390 | self.poll(Status::BUSY, false)?; |
| 391 | self.poll(Status::DRQ, true)?; |
| 392 | |
| 393 | Ok(()) |
| 394 | } |
| 395 | |
| 396 | |
| 397 | // WRITE COMMAND PARAMETERS |