1fdio(7I) Ioctl Requests fdio(7I)
2
3
4
6 fdio - floppy disk control operations
7
9 #include <sys/fdio.h>
10
11
13 The Solaris floppy driver supports a set of ioctl(2) requests for get‐
14 ting and setting the floppy drive characteristics. Basic to these
15 ioctl() requests are the definitions in <sys/fdio.h>.
16
18 The following ioctl() requests are available on the Solaris floppy
19 driver.
20
21 FDDEFGEOCHAR x86 based systems: This ioctl() forces the floppy
22 driver to restore the diskette and drive characteris‐
23 tics and geometry, and partition information to default
24 values based on the device configuration.
25
26
27 FDGETCHANGE The argument is a pointer to an int. This ioctl()
28 returns the status of the diskette-changed signal from
29 the floppy interface. The following defines are pro‐
30 vided for cohesion.
31
32
33
34 Note: For x86 based systems, use FDGC_DETECTED (which is available only
35 on x86 based systems) instead of FDGC_HISTORY.
36
37 /*
38 * Used by FDGETCHANGE, returned state of the sense disk change bit.
39 */
40 #define FDGC_HISTORY 0x01 /* disk has changed since insertion or
41 last FDGETCHANGE call */
42 #define FDGC_CURRENT 0x02 /* if set, indicates drive has floppy,
43 > otherwise, drive is empty */
44 #define FDGC_CURWPROT 0x10 /* current state of write protect */
45 #define FDGC_DETECTED 0x20 /* previous state of DISK CHANGE */
46
47
48 FDIOGCHAR The argument is a pointer to an fd_char structure
49 (described below). This ioctl() gets the characteristics
50 of the floppy diskette from the floppy controller.
51
52
53 FDIOSCHAR The argument is a pointer to an fd_char structure
54 (described below). This ioctl() sets the characteristics
55 of the floppy diskette for the floppy controller. Typical
56 values in the fd_char structure for a high density
57 diskette:
58
59 field value
60 fdc_medium 0
61 fdc_transfer_rate 500
62 fdc_ncyl 80
63 fdc_nhead 2
64 fdc_sec_size 512
65 fdc_secptrack 18
66 fdc_steps -1 { This field doesn't apply. }
67
68
69
70 /*
71 * Floppy characteristics
72 */
73 struct fd_char {
74 uchar_t fdc_medium; /* equals 1 if floppy is medium density format */
75 int fdc_transfer_rate; /* transfer rate */
76 int fdc_ncyl; /* number of cylinders */
77 int fdc_nhead; /* number of heads */
78 int fdc_sec_size; /* sector size */
79 int fdc_secptrack; /* sectors per track */
80 int fdc_steps; /* no. of steps per data track */
81 };
82
83
84 FDGETDRIVECHAR The argument to this ioctl() is a pointer to an
85 fd_drive structure (described below). This ioctl()
86 gets the characteristics of the floppy drive from the
87 floppy controller.
88
89
90 FDSETDRIVECHAR x86 based systems: The argument to this ioctl() is a
91 pointer to an fd_drive structure (described below).
92 This ioctl() sets the characteristics of the floppy
93 drive for the floppy controller. Only fdd_steprate,
94 fdd_headsettle, fdd_motoron, and fdd_motoroff are
95 actually used by the floppy disk driver.
96
97
98 /*
99 * Floppy Drive characteristics
100 */
101 struct fd_drive {
102 int fdd_ejectable; /* does the drive support eject? */
103 int fdd_maxsearch; /* size of per-unit search table */
104 int fdd_writeprecomp; /* cyl to start write precompensation */
105 int fdd_writereduce; /* cyl to start recucing write current */
106 int fdd_stepwidth; /* width of step pulse in 1 us units */
107 int fdd_steprate; /* step rate in 100 us units */
108 int fdd_headsettle; /* delay, in 100 us units */
109 int fdd_headload; /* delay, in 100 us units */
110 int fdd_headunload; /* delay, in 100 us units */
111 int fdd_motoron; /* delay, in 100 ms units */
112 int fdd_motoroff; /* delay, in 100 ms units */
113 int fdd_precomplevel; /* bit shift, in nano-secs */
114 int fdd_pins; /* defines meaning of pin 1, 2, 4 and 34 */
115 int fdd_flags; /* TRUE READY, Starting Sector #, & Motor On */
116 };
117
118
119 FDGETSEARCH Not available.
120
121
122 FDSETSEARCH Not available.
123
124
125 FDEJECT SPARC: This ioctl() requests the floppy drive to eject
126 the diskette.
127
128
129 FDIOCMD The argument is a pointer to an fd_cmd structure
130 (described below). This ioctl() allows access to the
131 floppy diskette using the floppy device driver. Only
132 the FDCMD_WRITE, FDCMD_READ, and FDCMD_FORMAT_TRACK
133 commands are currently available.
134
135
136 struct fd_cmd {
137 ushort_t fdc_cmd; /* command to be executed */
138 int fdc_flags; /* execution flags (x86 only) */
139 daddr_t fdc_blkno; /* disk address for command */
140 int fdc_secnt; /* sector count for command */
141 caddr_t fdc_bufaddr; /* user's buffer address */
142 uint_t fdc_buflen; /* size of user's buffer */
143 };
144
145
146
147 Please note that the fdc_buflen field is currently unused. The
148 fdc_secnt field is used to calculate the transfer size, and the buffer
149 is assumed to be large enough to accommodate the transfer.
150
151 {
152 /*
153 * Floppy commands
154 */
155 #define FDCMD_WRITE 1
156 #define FDCMD_READ 2
157 #define FDCMD_SEEK 3
158 #define FDCMD_REZERO 4
159 #define FDCMD_FORMAT_UNIT 5
160 #define FDCMD_FORMAT_TRACK 6
161 };
162
163
164 FDRAW The argument is a pointer to an fd_raw structure (described
165 below). This ioctl() allows direct control of the floppy
166 drive using the floppy controller. Refer to the appropriate
167 floppy-controller data sheet for full details on required com‐
168 mand bytes and returned result bytes. The following commands
169 are supported.
170
171
172 /*
173 * Floppy raw commands
174 */
175 #define FDRAW_SPECIFY 0x03
176 #define FDRAW_READID 0x0a (x86 only)
177 #define FDRAW_SENSE_DRV 0x04
178 #define FDRAW_REZERO 0x07
179 #define FDRAW_SEEK 0x0f
180 #define FDRAW_SENSE_INT 0x08 (x86 only)
181 #define FDRAW_FORMAT 0x0d
182 #define FDRAW_READTRACK 0x02
183 #define FDRAW_WRCMD 0x05
184 #define FDRAW_RDCMD 0x06
185 #define FDRAW_WRITEDEL 0x09
186 #define FDRAW_READDEL 0x0c
187
188
189
190 Please note that when using FDRAW_SEEK or FDRAW_REZERO, the driver
191 automatically issues a FDRAW_SENSE_INT command to clear the interrupt
192 from the FDRAW_SEEK or the FDRAW_REZERO. The result bytes returned by
193 these commands are the results from the FDRAW_SENSE_INT command.
194 Please see the floppy-controller data sheet for more details on
195 FDRAW_SENSE_INT.
196
197 /*
198 * Used by FDRAW
199 */
200 struct fd_raw {
201 char fdr_cmd[10]; /* user-supplied command bytes */
202 short fdr_cnum; /* number of command bytes */
203 char fdr_result[10]; /* controller-supplied result bytes */
204 ushort_t fdr_nbytes; /* number to transfer if read/write command */
205 char *fdr_addr; /* where to transfer if read/write command */
206 };
207
208
210 ioctl(2), dkio(7I), fd(7D), hdio(7I)
211
212
213
214SunOS 5.11 26 April 2001 fdio(7I)