[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cdi-devel] [PATCH] floppy: Fix step_rate_time for SPECIFY



The code was apparently based on the osdev.org wiki, which confused
seconds and microseconds for step_rate_time, so we're off by a factor of
1000. It's fixed in the wiki for a couple of years now, so it might be
time to fix it in this driver as well.

Signed-off-by: Kevin Wolf <kevin@xxxxxxxxxx>
---
 floppy/device.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/floppy/device.c b/floppy/device.c
index c5c75a5..76a27d8 100755
--- a/floppy/device.c
+++ b/floppy/device.c
@@ -286,10 +286,10 @@ static void floppy_drive_specify(struct floppy_device* device)
     // Der hier einzustellende Wert ist genau wie die vorderen 2 abhaengig von
     // der Datenrate.
     // Aus dem OSdev-Wiki stammt die folgende Formel fuer die Berechnung:
-    //      step_rate_time = 16 - seconds * data_rate / 500000
+    //      SRT_value = 16 - (milliseconds * data_rate / 500000)
     // Fuer die Zeit wird 8ms empfohlen.
-    step_rate_time = 16 - 8 * FLOPPY_DATA_RATE(device) / 500000 / 1000;
-    
+    step_rate_time = 16 - 8 * FLOPPY_DATA_RATE(device) / 500 / 1000;
+
     // Befehl und Argumente Senden
     // Byte 0:  FLOPPY_CMD_SPECIFY
     // Byte 1:  Bits 0 - 3: Head unload time
-- 
1.7.7