Print this page
10519 Convert fdio(7I) to mandoc
   1 '\" te
   2 .\"  Copyright (c) 2001, Sun Microsystems, Inc.  All Rights Reserved
   3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
   4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
   5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
   6 .TH FDIO 7I "Apr 26, 2001"
   7 .SH NAME
   8 fdio \- floppy disk control operations
   9 .SH SYNOPSIS
  10 .LP
  11 .nf
  12 \fB#include <sys/fdio.h>\fR
  13 .fi
  14 
  15 .SH DESCRIPTION
  16 .sp
  17 .LP
  18 The Solaris floppy driver supports a set of \fBioctl\fR(2) requests for getting
  19 and setting the floppy drive characteristics. Basic to these  \fBioctl\fR(\|)
  20 requests are the definitions in \fB<sys/fdio.h>\fR\&.
  21 .SH IOCTLS
  22 .sp
  23 .LP
  24 The following \fBioctl\fR(\|) requests are available on the Solaris floppy
  25 driver.
  26 .sp
  27 .ne 2
  28 .na
  29 \fB\fBFDDEFGEOCHAR\fR\fR
  30 .ad
  31 .RS 16n
  32 x86 based systems:  This \fBioctl\fR(\|) forces the floppy driver to restore










  33 the diskette and drive characteristics and geometry, and partition information
  34 to default values based on the device configuration.
  35 .RE
  36 
  37 .sp
  38 .ne 2
  39 .na
  40 \fB\fBFDGETCHANGE\fR\fR
  41 .ad
  42 .RS 16n
  43 The argument is a pointer to an \fBint.\fR This \fBioctl\fR(\|) returns the
  44 status of the diskette-changed signal from the floppy interface. The following
  45 defines are provided for cohesion.
  46 .RE
  47 
  48 .sp
  49 .LP
  50 Note: For x86 based systems, use \fBFDGC_DETECTED\fR (which is available only
  51 on x86 based systems) instead of \fBFDGC_HISTORY.\fR
  52 .sp
  53 .in +2
  54 .nf
  55 /*
  56  * Used by FDGETCHANGE, returned state of the sense disk change bit.
  57  */
  58 #define FDGC_HISTORY  0x01       /* disk has changed since insertion or
  59                                   last FDGETCHANGE call */
  60 #define FDGC_CURRENT  0x02       /* if set, indicates drive has floppy,
  61 >                                 otherwise, drive is empty */




  62 #define FDGC_CURWPROT 0x10       /* current state of write protect */
  63 #define FDGC_DETECTED 0x20       /* previous state of DISK CHANGE */
  64 .fi
  65 .in -2
  66 
  67 .sp
  68 .ne 2
  69 .na
  70 \fB\fBFDIOGCHAR\fR\fR
  71 .ad
  72 .RS 13n
  73 The argument is a pointer to an \fBfd_char\fR structure (described below). This
  74 \fBioctl\fR(\|) gets the characteristics of the floppy diskette from the floppy
  75 controller.
  76 .RE
  77 
  78 .sp
  79 .ne 2
  80 .na
  81 \fB\fBFDIOSCHAR\fR\fR
  82 .ad
  83 .RS 13n
  84 The argument is a pointer to an \fBfd_char\fR structure (described below). This
  85 \fBioctl\fR(\|) sets the characteristics of the floppy diskette for the floppy
  86 controller. Typical values in the  \fBfd_char\fR structure for a high density
  87 diskette:
  88 .sp
  89 .in +2
  90 .nf
  91 field value
  92 fdc_medium      0
  93 fdc_transfer_rate       500
  94 fdc_ncyl        80
  95 fdc_nhead       2
  96 fdc_sec_size    512
  97 fdc_secptrack   18
  98 fdc_steps       -1      { This field doesn't apply. }
  99 .fi
 100 .in -2
 101 
 102 .RE
 103 
 104 .sp
 105 .in +2
 106 .nf
 107 /*
 108  * Floppy characteristics
 109  */
 110 struct fd_char {
 111  uchar_t fdc_medium;     /* equals 1 if floppy is medium density format */
 112  int fdc_transfer_rate;  /* transfer rate */
 113  int fdc_ncyl;           /* number of cylinders */
 114  int fdc_nhead;          /* number of heads */
 115  int fdc_sec_size;       /* sector size */
 116  int fdc_secptrack;      /* sectors per track */
 117  int fdc_steps;          /* no. of steps per data track */
 118 };
 119 .fi
 120 .in -2
 121 
 122 .sp
 123 .ne 2
 124 .na
 125 \fB\fBFDGETDRIVECHAR\fR\fR
 126 .ad
 127 .RS 18n
 128 The argument to this \fBioctl\fR(\|) is a pointer to an \fBfd_drive\fR
 129 structure (described below). This \fBioctl\fR(\|) gets the characteristics of
 130 the floppy drive from the floppy controller.
 131 .RE
 132 
 133 .sp
 134 .ne 2
 135 .na
 136 \fB\fBFDSETDRIVECHAR\fR\fR
 137 .ad
 138 .RS 18n
 139 x86 based systems:  The argument to this \fBioctl\fR(\|) is a pointer to an
 140 \fBfd_drive\fR structure (described below). This \fBioctl\fR(\|) sets the
 141 characteristics of the floppy drive for the floppy controller. Only
 142 \fBfdd_steprate\fR, \fBfdd_headsettle\fR, \fBfdd_motoron\fR, and
 143 \fBfdd_motoroff\fR are actually used by the floppy disk driver.
 144 .RE
 145 
 146 .sp
 147 .in +2
 148 .nf
 149 /*
 150  * Floppy Drive characteristics
 151  */
 152 struct fd_drive {
 153         int     fdd_ejectable;    /* does the drive support eject? */
 154         int     fdd_maxsearch;    /* size of per-unit search table */
 155         int     fdd_writeprecomp; /* cyl to start write precompensation */
 156         int     fdd_writereduce;  /* cyl to start recucing write current */
 157         int     fdd_stepwidth;    /* width of step pulse in 1 us units */
 158         int     fdd_steprate;     /* step rate in 100 us units */
 159         int     fdd_headsettle;   /* delay, in 100 us units */
 160         int     fdd_headload;     /* delay, in 100 us units */
 161         int     fdd_headunload;   /* delay, in 100 us units */
 162         int     fdd_motoron;      /* delay, in 100 ms units */
 163         int     fdd_motoroff;     /* delay, in 100 ms units */
 164         int     fdd_precomplevel; /* bit shift, in nano-secs */
 165         int     fdd_pins;         /* defines meaning of pin 1, 2, 4 and 34 */
 166         int     fdd_flags;        /* TRUE READY, Starting Sector #, & Motor On */
 167 };
 168 .fi
 169 .in -2
 170 
 171 .sp
 172 .ne 2
 173 .na
 174 \fB\fBFDGETSEARCH\fR\fR
 175 .ad
 176 .RS 15n
 177 Not available.
 178 .RE
 179 
 180 .sp
 181 .ne 2
 182 .na
 183 \fB\fBFDSETSEARCH\fR\fR
 184 .ad
 185 .RS 15n
 186 Not available.
 187 .RE
 188 
 189 .sp
 190 .ne 2
 191 .na
 192 \fB\fBFDEJECT\fR\fR
 193 .ad
 194 .RS 15n
 195 SPARC:  This \fBioctl\fR(\|) requests the floppy drive to eject the diskette.
 196 .RE
 197 
 198 .sp
 199 .ne 2
 200 .na
 201 \fB\fBFDIOCMD\fR\fR
 202 .ad
 203 .RS 15n
 204 The argument is a pointer to an \fBfd_cmd\fR structure (described below). This
 205 \fBioctl\fR(\|) allows access to the floppy diskette using the floppy device
 206 driver.  Only the \fBFDCMD_WRITE\fR, \fBFDCMD_READ\fR, and
 207 \fBFDCMD_FORMAT_TRACK\fR commands are currently available.
 208 .RE
 209 
 210 .sp
 211 .in +2
 212 .nf
 213 struct fd_cmd {
 214         ushort_t fdc_cmd;      /* command to be executed */
 215         int      fdc_flags;    /* execution flags (x86 only) */
 216         daddr_t  fdc_blkno;    /* disk address for command */
 217         int      fdc_secnt;    /* sector count for command */
 218         caddr_t  fdc_bufaddr;  /* user's buffer address */
 219         uint_t   fdc_buflen;   /* size of user's buffer */
 220 };
 221 .fi
 222 .in -2
 223 
 224 .sp
 225 .LP
 226 Please note that the \fBfdc_buflen\fR field is currently unused. The
 227 \fBfdc_secnt\fR field is used to calculate the transfer size, and the buffer is

 228 assumed to be large enough to accommodate the transfer.
 229 .sp
 230 .in +2
 231 .nf
 232 {
 233 /*
 234 * Floppy commands
 235  */
 236 #define FDCMD_WRITE     1
 237 #define FDCMD_READ      2
 238 #define FDCMD_SEEK      3
 239 #define FDCMD_REZERO    4
 240 #define FDCMD_FORMAT_UNIT       5
 241 #define FDCMD_FORMAT_TRACK      6
 242 };
 243 .fi
 244 .in -2
 245 
 246 .sp
 247 .ne 2
 248 .na
 249 \fB\fBFDRAW\fR\fR
 250 .ad
 251 .RS 9n
 252 The argument is a pointer to an \fBfd_raw\fR structure (described below).
 253 This \fBioctl\fR(\|) allows direct control of the floppy drive using the floppy
 254 controller. Refer to the appropriate floppy-controller data sheet for full
 255 details on required command bytes and returned result bytes. The following
 256 commands are supported.
 257 .RE
 258 
 259 .sp
 260 .in +2
 261 .nf
 262 /*
 263 * Floppy raw commands
 264 */
 265 #define FDRAW_SPECIFY   0x03
 266 #define FDRAW_READID    0x0a    (x86 only)
 267 #define FDRAW_SENSE_DRV 0x04
 268 #define FDRAW_REZERO    0x07
 269 #define FDRAW_SEEK      0x0f
 270 #define FDRAW_SENSE_INT 0x08    (x86 only)
 271 #define FDRAW_FORMAT    0x0d
 272 #define FDRAW_READTRACK 0x02
 273 #define FDRAW_WRCMD     0x05
 274 #define FDRAW_RDCMD     0x06
 275 #define FDRAW_WRITEDEL  0x09
 276 #define FDRAW_READDEL   0x0c
 277 .fi
 278 .in -2
 279 
 280 .sp
 281 .LP
 282 Please note that when using  \fBFDRAW_SEEK\fR or  \fBFDRAW_REZERO,\fR the
 283 driver automatically issues a  \fBFDRAW_SENSE_INT\fR command to clear the
 284 interrupt from the  \fBFDRAW_SEEK\fR or the  \fBFDRAW_REZERO.\fR The result
 285 bytes returned by these commands are the results from the
 286 \fBFDRAW_SENSE_INT\fR command.  Please see the floppy-controller data sheet for
 287 more details on \fBFDRAW_SENSE_INT.\fR
 288 .sp
 289 .in +2
 290 .nf





 291 /*
 292  * Used by FDRAW
 293  */
 294 struct    fd_raw {
 295  char     fdr_cmd[10];     /* user-supplied command bytes */
 296  short    fdr_cnum;        /* number of command bytes */
 297  char     fdr_result[10];  /* controller-supplied result bytes */
 298  ushort_t fdr_nbytes;      /* number to transfer if read/write command */
 299  char     *fdr_addr;       /* where to transfer if read/write command */
 300 };
 301 .fi
 302 .in -2
 303 
 304 .SH SEE ALSO
 305 .sp
 306 .LP
 307 \fBioctl\fR(2), \fBdkio\fR(7I), \fBfd\fR(7D), \fBhdio\fR(7I)

   1 .\"  Copyright (c) 2001, Sun Microsystems, Inc.  All Rights Reserved
   2 .\"  Copyright (c) 2017, Joyent, Inc.
   3 .\" The contents of this file are subject to the terms of the
   4 .\" Common Development and Distribution License (the "License").
   5 .\" You may not use this file except in compliance with the License.
   6 .\"
   7 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   8 .\" or http://www.opensolaris.org/os/licensing.
   9 .\" See the License for the specific language governing permissions
  10 .\" and limitations under the License.
  11 .\"
  12 .\" When distributing Covered Code, include this CDDL HEADER in each
  13 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  14 .\" If applicable, add the following below this CDDL HEADER, with the
  15 .\" fields enclosed by brackets "[]" replaced with your own identifying
  16 .\" information: Portions Copyright [yyyy] [name of copyright owner]
  17 .Dd October 22, 2017
  18 .Dt FDIO 7I
  19 .Os
  20 .Sh NAME
  21 .Nm fdio
  22 .Nd floppy disk control operations
  23 .Sh SYNOPSIS
  24 .In sys/fdio.h
  25 .Sh DESCRIPTION
  26 The Solaris floppy driver supports a set of
  27 .Xr ioctl 2
  28 requests for getting and setting the floppy drive characteristics.
  29 Basic to these
  30 .Xr ioctl 2
  31 requests are the definitions in
  32 .In sys/fdio.h .
  33 .Sh IOCTLS
  34 The following
  35 .Xr ioctl 2
  36 requests are available on the Solaris floppy driver.
  37 .Bl -tag -width FDDEFGEOCHAR
  38 .It Dv FDDEFGEOCHAR
  39 x86 based systems:  This
  40 .Xr ioctl 2
  41 forces the floppy driver to restore
  42 the diskette and drive characteristics and geometry, and partition information
  43 to default values based on the device configuration.
  44 .It Dv FDGETCHANGE
  45 The argument is a pointer to an
  46 .Vt int .
  47 This
  48 .Xr ioctl 2
  49 returns the status of the diskette-changed signal from the floppy interface.
  50 The following defines are provided for cohesion.
  51 .El
  52 .Pp
  53 Note: For x86 based systems, use
  54 .Dv FDGC_DETECTED
  55 (which is available only on x86 based systems) instead of
  56 .Dv FDGC_HISTORY .
  57 .Bd -literal -offset 2n






  58 /*
  59  * Used by FDGETCHANGE, returned state of the sense disk change bit.
  60  */
  61 #define FDGC_HISTORY  0x01       /*
  62                                   * disk has changed since insertion or
  63                                   * last FDGETCHANGE call
  64                                   */
  65 #define FDGC_CURRENT  0x02       /*
  66                                   * if set, indicates drive has floppy,
  67                                   * otherwise, drive is empty
  68                                   */
  69 #define FDGC_CURWPROT 0x10       /* current state of write protect */
  70 #define FDGC_DETECTED 0x20       /* previous state of DISK CHANGE */
  71 .Ed
  72 .Bl -tag -width FDIOGCHAR
  73 .It Dv FDIOGCHAR
  74 The argument is a pointer to an
  75 .Vt fd_char
  76 structure (described below).
  77 This
  78 .Xr ioctl 2
  79 gets the characteristics of the floppy diskette from the floppy controller.
  80 .It Dv FDIOSCHAR
  81 The argument is a pointer to an
  82 .Vt fd_char
  83 structure (described below).
  84 This
  85 .Xr ioctl 2
  86 sets the characteristics of the floppy diskette for the floppy controller.
  87 Typical values in the
  88 .Vt fd_char
  89 structure for a high density diskette:
  90 .Bl -column fdc_stransfer_rate value "{ This field doesn't apply. }"
  91 .It Field Ta Value Ta
  92 .It fdc_medium Ta 0 Ta
  93 .It fdc_transfer_rate Ta 500 Ta
  94 .It fdc_ncyl Ta 80 Ta
  95 .It fdc_nhead Ta 2 Ta
  96 .It fdc_sec_size Ta 512 Ta
  97 .It fdc_secptrack Ta 18 Ta
  98 .It fdc_steps Ta -1 Ta { This field doesn't apply. }
  99 .El
 100 .El
 101 .Bd -literal -offset 2n












 102 /*
 103  * Floppy characteristics
 104  */
 105 struct fd_char {
 106  uchar_t fdc_medium;    /* equals 1 if floppy is medium density format */
 107  int fdc_transfer_rate; /* transfer rate */
 108  int fdc_ncyl;          /* number of cylinders */
 109  int fdc_nhead;         /* number of heads */
 110  int fdc_sec_size;      /* sector size */
 111  int fdc_secptrack;     /* sectors per track */
 112  int fdc_steps;         /* no. of steps per data track */
 113 };
 114 .Ed
 115 .Bl -tag -width FDGETDRIVECHAR
 116 .It Dv FDGETDRIVECHAR
 117 The argument to this
 118 .Xr ioctl 2
 119 is a pointer to an
 120 .Vt fd_drive
 121 structure (described below).
 122 This
 123 .Xr ioctl 2
 124 gets the characteristics of the floppy drive from the floppy controller.
 125 .It Dv FDSETDRIVECHAR
 126 x86 based systems:  The argument to this
 127 .Xr ioctl 2
 128 is a pointer to an
 129 .Vt fd_drive
 130 structure (described below).
 131 This
 132 .Xr ioctl 2
 133 sets the characteristics of the floppy drive for the floppy controller.
 134 Only
 135 .Fa fdd_steprate ,
 136 .Fa fdd_headsettle ,
 137 .Fa fdd_motoron ,
 138 and
 139 .Fa fdd_motoroff
 140 are actually used by the floppy disk driver.
 141 .El
 142 .Bd -literal -offset 2n

 143 /*
 144  * Floppy Drive characteristics
 145  */
 146 struct fd_drive {
 147     int fdd_ejectable;    /* does the drive support eject? */
 148     int fdd_maxsearch;    /* size of per-unit search table */
 149     int fdd_writeprecomp; /* cyl to start write precompensation */
 150     int fdd_writereduce;  /* cyl to start recucing write current */
 151     int fdd_stepwidth;    /* width of step pulse in 1 us units */
 152     int fdd_steprate;     /* step rate in 100 us units */
 153     int fdd_headsettle;   /* delay, in 100 us units */
 154     int fdd_headload;     /* delay, in 100 us units */
 155     int fdd_headunload;   /* delay, in 100 us units */
 156     int fdd_motoron;      /* delay, in 100 ms units */
 157     int fdd_motoroff;     /* delay, in 100 ms units */
 158     int fdd_precomplevel; /* bit shift, in nano-secs */
 159     int fdd_pins;         /* defines meaning of pin 1, 2, 4 and 34 */
 160     int fdd_flags;        /* TRUE READY, Starting Sector #, & Motor On */
 161 };
 162 .Ed
 163 .Bl -tag -width FDGETSEARCH
 164 .It Dv FDGETSEARCH






 165 Not available.
 166 .It Dv FDSETSEARCH







 167 Not available.
 168 .It Dv FDEJECT
 169 SPARC:  This
 170 .Xr ioctl 2
 171 requests the floppy drive to eject the diskette.
 172 .It Dv FDIOCMD
 173 The argument is a pointer to an
 174 .Vt fd_cmd
 175 structure (described below).
 176 This
 177 .Xr ioctl 2
 178 allows access to the floppy diskette using the floppy device driver.
 179 Only the
 180 .Dv FDCMD_WRITE ,
 181 .Dv FDCMD_READ ,
 182 and
 183 .Dv FDCMD_FORMAT_TRACK
 184 commands are currently available.
 185 .El
 186 .Bd -literal -offset 2n







 187 struct fd_cmd {
 188         ushort_t fdc_cmd;      /* command to be executed */
 189         int      fdc_flags;    /* execution flags (x86 only) */
 190         daddr_t  fdc_blkno;    /* disk address for command */
 191         int      fdc_secnt;    /* sector count for command */
 192         caddr_t  fdc_bufaddr;  /* user's buffer address */
 193         uint_t   fdc_buflen;   /* size of user's buffer */
 194 };
 195 .Ed
 196 .Pp
 197 Please note that the
 198 .Fa fdc_buflen
 199 field is currently unused.
 200 The
 201 .Fa fdc_secnt
 202 field is used to calculate the transfer size, and the buffer is
 203 assumed to be large enough to accommodate the transfer.
 204 .Bd -literal -offset 2n



 205 /*
 206  * Floppy commands
 207  */
 208 #define FDCMD_WRITE     1
 209 #define FDCMD_READ      2
 210 #define FDCMD_SEEK      3
 211 #define FDCMD_REZERO    4
 212 #define FDCMD_FORMAT_UNIT       5
 213 #define FDCMD_FORMAT_TRACK      6
 214 .Ed
 215 .Bl -tag -width FDRAW
 216 .It Dv FDRAW
 217 The argument is a pointer to an
 218 .Vt fd_raw
 219 structure (described below).
 220 This
 221 .Xr ioctl 2
 222 allows direct control of the floppy drive using the floppy controller.
 223 Refer to the appropriate floppy-controller data sheet for full
 224 details on required command bytes and returned result bytes.
 225 The following commands are supported.
 226 .El
 227 .Bd -literal -offset 2n






 228 /*
 229  * Floppy raw commands
 230  */
 231 #define FDRAW_SPECIFY   0x03
 232 #define FDRAW_READID    0x0a    (x86 only)
 233 #define FDRAW_SENSE_DRV 0x04
 234 #define FDRAW_REZERO    0x07
 235 #define FDRAW_SEEK      0x0f
 236 #define FDRAW_SENSE_INT 0x08    (x86 only)
 237 #define FDRAW_FORMAT    0x0d
 238 #define FDRAW_READTRACK 0x02
 239 #define FDRAW_WRCMD     0x05
 240 #define FDRAW_RDCMD     0x06
 241 #define FDRAW_WRITEDEL  0x09
 242 #define FDRAW_READDEL   0x0c
 243 .Ed
 244 .Pp
 245 Please note that when using
 246 .Dv FDRAW_SEEK
 247 or
 248 .Dv FDRAW_REZERO ,
 249 the driver automatically issues a
 250 .Dv FDRAW_SENSE_INT
 251 command to clear the interrupt from the
 252 .Dv FDRAW_SEEK
 253 or the
 254 .Dv FDRAW_REZERO .
 255 The result bytes returned by these commands are the results from the
 256 .Dv DRAW_SENSE_INT
 257 command.
 258 Please see the floppy-controller data sheet for
 259 more details on
 260 .Dv FDRAW_SENSE_INT .
 261 .Bd -literal -offset 2n
 262 /*
 263  * Used by FDRAW
 264  */
 265 struct    fd_raw {
 266    char     fdr_cmd[10];   /* user-supplied command bytes */
 267    short    fdr_cnum;      /* number of command bytes */
 268    char     fdr_result[10];  /* controller-supplied result bytes */
 269    ushort_t fdr_nbytes;    /* number to transfer if read/write command */
 270    char     *fdr_addr;     /* where to transfer if read/write command */
 271 };
 272 .Ed
 273 .Sh SEE ALSO
 274 .Xr ioctl 2 ,
 275 .Xr fd 7D ,
 276 .Xr dkio 7I ,
 277 .Xr hdio 7I