From ff026bff7cab2f84de878c2fe4b56edaa07bedb3 Mon Sep 17 00:00:00 2001 From: Julien CLEMENT Date: Thu, 15 Dec 2022 21:08:31 +0100 Subject: [PATCH] add wait command end Signed-off-by: Julien CLEMENT --- src/drivers/atapi/mod.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/drivers/atapi/mod.rs b/src/drivers/atapi/mod.rs index 6fc896c..590c24e 100644 --- a/src/drivers/atapi/mod.rs +++ b/src/drivers/atapi/mod.rs @@ -330,6 +330,8 @@ impl ATABus { // Wait command end (*INTERRUPT_FUTURE).await; println!("Command sent"); + + self.wait_command_end(); } fn wait_busy(&mut self) { @@ -360,6 +362,15 @@ impl ATABus { } } } + + fn wait_command_end(&mut self) { + let mut status = ATA_BSY; + while (status & ATA_BSY) != 0 && (status & ATA_DRQ) != 0 { + unsafe { + status = self.status.read(); + } + } + } }