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)