Subject: Some fd.c patches
To: None <amiga-dev@sun-lamp.cs.berkeley.edu>
From: Ty Sarna <tsarna@endicor.com>
List: amiga-dev
Date: 04/17/1994 08:06:42
The following patches do two things. First they add support for the
A1020 5.25" drive (tested, and it works.... well, it suffers the same
problems as 3.5" drives, but is no worse). 

Second, it provides partition information that is more correct.  It now
fills in the rpm value.  It is currently incorrect (someone please fix),
but at least it prevents the "warning! zero revolutions/minute" message. 

I also changed the reported pack name from "some pack" to the
size/format of the disk...  that's at least marginally more useful
information. :-)


*** fd.c.orig	Fri Apr  8 05:12:49 1994
--- fd.c	Sat Apr 16 20:56:34 1994
***************
*** 110,117 ****
  
  /* drive type values */
  #define FD_NONE		0x00000000
! #define FD_DD_3		0xffffffff	/* double-density 3.5" (880K) */
! #define FD_HD_3		0x55555555	/* high-density 3.5" (1760K) */
  
  struct fd_type {
  	int id;
--- 110,118 ----
  
  /* drive type values */
  #define FD_NONE		0x00000000
! #define FD_DD_3		0xFFFFFFFF	/* double-density 3.5" (880K)  */
! #define FD_HD_3		0x55555555	/* high-density 3.5" (1760K)   */
! #define FD_DD_5		0xAAAAAAAA	/* double-density 5.25" (440K) */
  
  struct fd_type {
  	int id;
***************
*** 130,137 ****
  
  struct fd_type drive_types[] = {
  /*	    id       name      tr he  rdsz   wrsz  sm pc1  pc2 sd  st st  */
! 	{ FD_DD_3, "DD 3.5", 80, 2, 14716, 13630, 1, 80, 161, 3, 18, 1 },
! 	{ FD_HD_3, "HD 3.5", 80, 2, 29432, 27260, 2, 80, 161, 3, 18, 1 },
  	{ FD_NONE, "No Drive", 0, }
  };
  int num_dr_types = sizeof(drive_types) / sizeof(drive_types[0]);
--- 131,139 ----
  
  struct fd_type drive_types[] = {
  /*	    id       name      tr he  rdsz   wrsz  sm pc1  pc2 sd  st st  */
! 	{ FD_DD_3, "DD 3.5\"", 80, 2, 14716, 13630, 1, 80, 161, 3, 18, 1 },
! 	{ FD_HD_3, "HD 3.5\"", 80, 2, 29432, 27260, 2, 80, 161, 3, 18, 1 },
! 	{ FD_DD_5, "DD 5.25\"",40, 2, 14716, 13630, 1, 80, 161, 3, 18, 1 },
  	{ FD_NONE, "No Drive", 0, }
  };
  int num_dr_types = sizeof(drive_types) / sizeof(drive_types[0]);
***************
*** 1130,1141 ****
  	fd_label->d_magic = DISKMAGIC;
  	fd_label->d_type = DTYPE_FLOPPY;
  	strncpy(fd_label->d_typename, "fd", sizeof(fd_label->d_typename) - 1);
! 	strcpy(fd_label->d_packname, "some pack");
  
  	fd_label->d_secsize = 512;
! 	fd_label->d_nsectors = 11;
! 	fd_label->d_ntracks = 2;
! 	fd_label->d_ncylinders = 80;
  	fd_label->d_secpercyl = fd_label->d_nsectors * fd_label->d_ntracks;
  	fd_label->d_secperunit= fd_label->d_ncylinders * fd_label->d_secpercyl;
  
--- 1132,1145 ----
  	fd_label->d_magic = DISKMAGIC;
  	fd_label->d_type = DTYPE_FLOPPY;
  	strncpy(fd_label->d_typename, "fd", sizeof(fd_label->d_typename) - 1);
! 	strcpy(fd_label->d_packname, fd->ft->name);
  
+ 	fd_label->d_rpm = 42 / fd->ft->sect_mult; /* XXXX replace 42 with
+ 	                                correct value for a 880K floppy */
  	fd_label->d_secsize = 512;
! 	fd_label->d_nsectors = 11 * fd->ft->sect_mult;
! 	fd_label->d_ntracks = fd->ft->heads;
! 	fd_label->d_ncylinders = fd->ft->tracks;
  	fd_label->d_secpercyl = fd_label->d_nsectors * fd_label->d_ntracks;
  	fd_label->d_secperunit= fd_label->d_ncylinders * fd_label->d_secpercyl;
  

------------------------------------------------------------------------------