]> xenbits.xensource.com Git - seabios.git/commitdiff
floppy: Minor cleanup - reduce some cut-and-paste code.
authorKevin O'Connor <kevin@koconnor.net>
Mon, 26 Nov 2012 16:14:00 +0000 (11:14 -0500)
committerKevin O'Connor <kevin@koconnor.net>
Mon, 26 Nov 2012 16:14:00 +0000 (11:14 -0500)
The diskette_param_table is a copy of diskette_param_table2 - just
memcpy it at runtime instead of duplicating the configuration in the
code.

Also, setup the floppy interrupt vector in the floppy.c code instead
of the post.c code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
src/floppy.c
src/post.c

index ce54d0c678f424780109b852da7d85a1590e18fa..3c8ae5a944d29a7e1c1622553f63c7d64e69579a 100644 (file)
@@ -47,22 +47,7 @@ struct floppy_ext_dbt_s diskette_param_table2 VAR16VISIBLE = {
     .drive_type     = 4,    // drive type in cmos
 };
 
-// Since no provisions are made for multiple drive types, most
-// values in this table are ignored.  I set parameters for 1.44M
-// floppy here
-struct floppy_dbt_s diskette_param_table VAR16FIXED(0xefc7) = {
-    .specify1       = 0xAF,
-    .specify2       = 0x02,
-    .shutoff_ticks  = FLOPPY_MOTOR_TICKS,
-    .bps_code       = FLOPPY_SIZE_CODE,
-    .sectors        = 18,
-    .interblock_len = FLOPPY_GAPLEN,
-    .data_len       = FLOPPY_DATALEN,
-    .gap_len        = FLOPPY_FORMAT_GAPLEN,
-    .fill_byte      = FLOPPY_FILLBYTE,
-    .settle_time    = 0x0F,
-    .startup_time   = 0x08,
-};
+struct floppy_dbt_s diskette_param_table VAR16FIXED(0xefc7);
 
 struct floppyinfo_s {
     struct chs_s chs;
@@ -131,6 +116,11 @@ addFloppy(int floppyid, int ftype)
 void
 floppy_setup(void)
 {
+    memcpy(&diskette_param_table, &diskette_param_table2
+           , sizeof(diskette_param_table));
+    SET_IVT(0x1E, SEGOFF(SEG_BIOS
+                         , (u32)&diskette_param_table2 - BUILD_BIOS_ADDR));
+
     if (! CONFIG_FLOPPY)
         return;
     dprintf(3, "init floppy drives\n");
index 0133f753e1b17f120f5470e544e3e7f37cd10edc..9a6dd3fd15094d1a6da9e5b15b07efa5132ad93a 100644 (file)
@@ -73,8 +73,6 @@ init_ivt(void)
     // set vector 0x79 to zero
     // this is used by 'gardian angel' protection system
     SET_IVT(0x79, SEGOFF(0, 0));
-
-    SET_IVT(0x1E, SEGOFF(SEG_BIOS, (u32)&diskette_param_table2 - BUILD_BIOS_ADDR));
 }
 
 static void