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"
8 fdio \- floppy disk control operations
12 \fB#include <sys/fdio.h>\fR
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\&.
24 The following \fBioctl\fR(\|) requests are available on the Solaris floppy
29 \fB\fBFDDEFGEOCHAR\fR\fR
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.
40 \fB\fBFDGETCHANGE\fR\fR
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.
50 Note: For x86 based systems, use \fBFDGC_DETECTED\fR (which is available only
51 on x86 based systems) instead of \fBFDGC_HISTORY.\fR
56 * Used by FDGETCHANGE, returned state of the sense disk change bit.
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 */
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
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
98 fdc_steps -1 { This field doesn't apply. }
108 * Floppy characteristics
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 */
125 \fB\fBFDGETDRIVECHAR\fR\fR
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.
136 \fB\fBFDSETDRIVECHAR\fR\fR
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.
150 * Floppy Drive characteristics
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 */
174 \fB\fBFDGETSEARCH\fR\fR
183 \fB\fBFDSETSEARCH\fR\fR
195 SPARC: This \fBioctl\fR(\|) requests the floppy drive to eject the diskette.
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.
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 */
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.
236 #define FDCMD_WRITE 1
239 #define FDCMD_REZERO 4
240 #define FDCMD_FORMAT_UNIT 5
241 #define FDCMD_FORMAT_TRACK 6
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.
263 * Floppy raw commands
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
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
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 */
307 \fBioctl\fR(2), \fBdkio\fR(7I), \fBfd\fR(7D), \fBhdio\fR(7I)