[SeaBIOS] [PATCH 4/6] Move the code that turns on the floppy motor to floppy_turn_on_motor()

Nikolay Nikolov nickysn at users.sourceforge.net
Sat Feb 3 18:32:53 CET 2018


Signed-off-by: Nikolay Nikolov <nickysn at users.sourceforge.net>
---
 src/hw/floppy.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/hw/floppy.c b/src/hw/floppy.c
index 573c45f..b5bc114 100644
--- a/src/hw/floppy.c
+++ b/src/hw/floppy.c
@@ -337,6 +337,16 @@ floppy_enable_controller(void)
     return floppy_pio(FC_CHECKIRQ, param);
 }
 
+static void
+floppy_turn_on_motor(u8 floppyid)
+{
+    // reset the disk motor timeout value of INT 08
+    SET_BDA(floppy_motor_counter, FLOPPY_MOTOR_TICKS);
+
+    // Turn on motor of selected drive, DMA & int enabled, normal operation
+    floppy_dor_write((floppyid ? FLOPPY_DOR_MOTOR_B : FLOPPY_DOR_MOTOR_A) | FLOPPY_DOR_IRQ | FLOPPY_DOR_RESET | floppyid);
+}
+
 // Activate a drive and send a command to it.
 static int
 floppy_drive_pio(u8 floppyid, int command, u8 *param)
@@ -348,11 +358,8 @@ floppy_drive_pio(u8 floppyid, int command, u8 *param)
             return ret;
     }
 
-    // reset the disk motor timeout value of INT 08
-    SET_BDA(floppy_motor_counter, FLOPPY_MOTOR_TICKS);
-
-    // Turn on motor of selected drive, DMA & int enabled, normal operation
-    floppy_dor_write((floppyid ? FLOPPY_DOR_MOTOR_B : FLOPPY_DOR_MOTOR_A) | FLOPPY_DOR_IRQ | FLOPPY_DOR_RESET | floppyid);
+    // Turn on motor of selected drive
+    floppy_turn_on_motor(floppyid);
 
     // Send command.
     int ret = floppy_pio(command, param);
-- 
2.14.3




More information about the SeaBIOS mailing list