| 1 |
.TH fdrawcmd 1 "27Jan21" fdutils-5.6 |
| 2 |
.SH Name |
| 3 |
fdrawcmd - send raw commands to the floppy disk controller |
| 4 |
'\" t |
| 5 |
.de TQ |
| 6 |
.br |
| 7 |
.ns |
| 8 |
.TP \\$1 |
| 9 |
.. |
| 10 |
|
| 11 |
.tr \(is' |
| 12 |
.tr \(if` |
| 13 |
.tr \(pd" |
| 14 |
|
| 15 |
.SH Note |
| 16 |
This manpage has been automatically generated from fdutils's texinfo |
| 17 |
documentation. However, this process is only approximative, and some |
| 18 |
items, such as cross-references, footnotes and indices are lost in this |
| 19 |
translation process. Indeed, these items have no appropriate |
| 20 |
representation in the manpage format. Moreover, only the items specific |
| 21 |
to each command have been translated, and the general information about |
| 22 |
fdutils has been dropped in the manpage version. Thus I strongly advise |
| 23 |
you to use the original texinfo doc. |
| 24 |
.TP |
| 25 |
* \ \ |
| 26 |
To generate a printable copy from the texinfo doc, run the following |
| 27 |
commands: |
| 28 |
|
| 29 |
.nf |
| 30 |
.ft 3 |
| 31 |
.in +0.3i |
| 32 |
./configure; make dvi; dvips fdutils.dvi |
| 33 |
.fi |
| 34 |
.in -0.3i |
| 35 |
.ft R |
| 36 |
|
| 37 |
\&\fR |
| 38 |
.TP |
| 39 |
* \ \ |
| 40 |
To generate a HTML copy, run: |
| 41 |
|
| 42 |
.nf |
| 43 |
.ft 3 |
| 44 |
.in +0.3i |
| 45 |
./configure; make html |
| 46 |
.fi |
| 47 |
.in -0.3i |
| 48 |
.ft R |
| 49 |
|
| 50 |
\&\fRA pre-made HTML can be found at: |
| 51 |
\&\fR\&\f(CW\(ifhttp://www.tux.org/pub/knaff/fdutils\(is\fR |
| 52 |
.TP |
| 53 |
* \ \ |
| 54 |
To generate an info copy (browsable using emacs' info mode), run: |
| 55 |
|
| 56 |
.nf |
| 57 |
.ft 3 |
| 58 |
.in +0.3i |
| 59 |
./configure; make info |
| 60 |
.fi |
| 61 |
.in -0.3i |
| 62 |
.ft R |
| 63 |
|
| 64 |
\&\fR |
| 65 |
.PP |
| 66 |
The texinfo doc looks most pretty when printed or as HTML. Indeed, in |
| 67 |
the info version certain examples are difficult to read due to the |
| 68 |
quoting conventions used in info. |
| 69 |
.SH Description |
| 70 |
.PP |
| 71 |
|
| 72 |
.nf |
| 73 |
.ft 3 |
| 74 |
.in +0.3i |
| 75 |
\&\fR\&\f(CWfdrawcmd [\fR\&\f(CWdrive=\fIdrive\fR\&\f(CW] [\fR\&\f(CWrate=\fIrate\fR\&\f(CW] |
| 76 |
[\fR\&\f(CWlength=\fIlength\fR\&\f(CW] [\fR\&\f(CWrepeat=\fIrepeat\fR\&\f(CW] |
| 77 |
[\fR\&\f(CWcylinder=\fIphysical-cyl\fR\&\f(CW] \fIcommand\fR\&\f(CW [\fIparameters\fR\&\f(CW \&...] [\fImode\fR\&\f(CW] |
| 78 |
.fi |
| 79 |
.in -0.3i |
| 80 |
.ft R |
| 81 |
|
| 82 |
\&\fR |
| 83 |
.PP |
| 84 |
\&\fR\&\f(CWfdrawcmd\fR |
| 85 |
is used to send raw commands to the floppy disk controller, after |
| 86 |
having selected a given drive. You must have write permission to the |
| 87 |
selected drive. |
| 88 |
.PP |
| 89 |
When writing to a disk, data is read from stdin; when reading, data |
| 90 |
is printed to stdout. Diagnostic messages, return values from the |
| 91 |
controller, and the value of the disk change line after the command are |
| 92 |
printed to stderr. |
| 93 |
.PP |
| 94 |
.SH Options |
| 95 |
.PP |
| 96 |
All numbers may be given in octal (0211), decimal (137), or hexadecimal |
| 97 |
(0x89). |
| 98 |
.IP |
| 99 |
.TP |
| 100 |
\&\fR\&\f(CWdrive=\fIdrive\fR\&\f(CW\fR\ |
| 101 |
Selects the drive. The default is drive 0 (\fR\&\f(CW\(if/dev/fd0\(is\fR). |
| 102 |
.TP |
| 103 |
\&\fR\&\f(CWrate=\fIrate\fR\&\f(CW\fR\ |
| 104 |
Selects the data transfer rate. Use 0 for high density disks, 1 for |
| 105 |
double density 5 1/4 disks (or 2 Mbps tapes, if the appropriate rate |
| 106 |
table is selected), and 2 for double density 3 1/2 disks. |
| 107 |
.TP |
| 108 |
\&\fR\&\f(CWlength=\fIlength\fR\&\f(CW\fR\ |
| 109 |
Describes the length of the transferred data for commands reading from |
| 110 |
and writing to the disk. The default is to continue until end of file. |
| 111 |
.TP |
| 112 |
\&\fR\&\f(CWrepeat=\fIcount\fR\&\f(CW\fR\ |
| 113 |
Repeat the command \fIcount\fR times. This only works correctly for |
| 114 |
commands which don't do any data transfer. |
| 115 |
.TP |
| 116 |
\&\fR\&\f(CWcylinder=\fIcount\fR\&\f(CW\fR\ |
| 117 |
Seek to the given cylinder before executing the command |
| 118 |
.TP |
| 119 |
\&\fR\&\f(CW\fIcommand\fR\&\f(CW\fR\ |
| 120 |
The name of the command to send. \fIcommand\fR may be a spelled out |
| 121 |
name (like \fR\&\f(CWread\fR or \fR\&\f(CWwrite\fR), or a number representing the |
| 122 |
commands floppy disk controller opcode. A named command has already a |
| 123 |
mode associated with it, whereas for a number the mode parameter should |
| 124 |
be described using the \fR\&\f(CWmode\fR option. |
| 125 |
.IP |
| 126 |
.TP |
| 127 |
\&\fR\&\f(CW\fIparameters\fR\&\f(CW\fR\ |
| 128 |
The parameters for the command (optional, not all commands need |
| 129 |
parameters). |
| 130 |
.TP |
| 131 |
\&\fR\&\f(CW\fImode\fR\&\f(CW\fR\ |
| 132 |
Various flags or'ed together describing the properties of the command. |
| 133 |
.PP |
| 134 |
.SH Commands |
| 135 |
.PP |
| 136 |
The description of the various floppy commands given in this manpage is |
| 137 |
very sketchy. For more details get the 82078 spec sheet which can be |
| 138 |
found at: |
| 139 |
|
| 140 |
.nf |
| 141 |
.ft 3 |
| 142 |
.in +0.3i |
| 143 |
http://www-techdoc.intel.com/docs/periph/fd_contr/datasheets/ |
| 144 |
.fi |
| 145 |
.in -0.3i |
| 146 |
.ft R |
| 147 |
|
| 148 |
\&\fR |
| 149 |
.PP |
| 150 |
Look for the chapter \fR\&\f(CWCOMMAND SET/DESCRIPTIONS\fR. Older FDCs only |
| 151 |
support a subset of the commands described therein, but the syntax for |
| 152 |
the commands that do exist is the same. |
| 153 |
.PP |
| 154 |
.SS Commands\ available\ on\ all\ FDCs |
| 155 |
.IP |
| 156 |
.TP |
| 157 |
\&\fR\&\f(CWread\ \fIdrvsel\ cyl\ head\ sect\ szcod\ spt\ rw-gap\ szcod2\fR\&\f(CW\fR\ |
| 158 |
Reads \fIlength\fR bytes of data from the disk. \fIdrvsel\fR is the |
| 159 |
drive selector. Bit 0 and 1 describe the drive, and bit 2 describes the |
| 160 |
head. The remaining parameters give the cylinder, head (yes, again), |
| 161 |
sector, size of the sector (128 * 2 ^ \fIszcod\fR), sectors per track |
| 162 |
(\fR\&\f(CWspt\fR, this is used to switch to the second head when the first |
| 163 |
side has been read), and size of the read-write gap. \fIszcod2\fR should |
| 164 |
be 0xff. \fR\&\f(CWread\fR returns \fIST0 ST1 ST2\fR and \fIcyl head sect |
| 165 |
szcod\fR of the next sector to be read; see |
| 166 |
\&\fR\&\f(CW\(if/usr/include/linux/fdreg.h\(is\fR . |
| 167 |
.IP |
| 168 |
N.B. Certain newer floppy disk controllers are buggy, and do not |
| 169 |
correctly recognize the end of transfer when operating in virtual DMA |
| 170 |
mode. For these, you need to set \fR\&\f(CWspt\fR to the id of the last |
| 171 |
sector to be read (for example, if you intend to read sectors 2, 3, 4, |
| 172 |
set \fR\&\f(CWspt\fR to 4, even if the disk has more sectors), and set the |
| 173 |
\&\fR\&\f(CWno-mt\fR flag. |
| 174 |
.TP |
| 175 |
\&\fR\&\f(CWwrite\ \fIdrvsel\ cyl\ head\ sect\ szcod\ spt\ rw-gap\ szcod2\fR\&\f(CW\fR\ |
| 176 |
Analogous to |
| 177 |
\&\fR\&\f(CWread\fR. |
| 178 |
.TP |
| 179 |
\&\fR\&\f(CWsense\ \fIdrvsel\fR\&\f(CW\fR\ |
| 180 |
Returns the third status byte (\fIST3\fR) |
| 181 |
.TP |
| 182 |
\&\fR\&\f(CWrecalibrate\ \fIdrvsel\fR\&\f(CW\fR\ |
| 183 |
Recalibrates the drive and returns \fIST0 ST1\fR. |
| 184 |
.TP |
| 185 |
\&\fR\&\f(CWseek\ \fIdrvsel\ cyl\fR\&\f(CW\fR\ |
| 186 |
Moves the head to \fIcyl\fR and returns \fIST0 ST1\fR. |
| 187 |
.TP |
| 188 |
\&\fR\&\f(CWspecify\ \fIdrvsel\ spec1\ spec2\fR\&\f(CW\fR\ |
| 189 |
Specify various parameters to the drive. |
| 190 |
.TP |
| 191 |
\&\fR\&\f(CWformat\ \fIdrvsel\ szcod\ sect-per-track\ fmt-gap\ fmt-fill\fR\&\f(CW\fR\ |
| 192 |
Formats the cylinder. The new sectors are filled with \fIfmt-fill\fR. |
| 193 |
The header information comes from the input, which is made up of |
| 194 |
\&\fIcyl head sect szcod\fR quadruples. The \fIszcod\fR parameter |
| 195 |
from the command line is used to describe the actual size of the |
| 196 |
sectors, and the \fIszcod\fR from the input is used to write into the |
| 197 |
header. However, the first write to these sectors will use the header |
| 198 |
information, and might overwrite the following sectors if the |
| 199 |
\&\fIszcod\fR parameter from the command line was too small. |
| 200 |
.TP |
| 201 |
\&\fR\&\f(CWreadid\ \fIdrvsel\fR\&\f(CW\fR\ |
| 202 |
reads the first sector header that comes and returns |
| 203 |
\&\fIST0 ST1 ST2 \fR |
| 204 |
and |
| 205 |
\&\fIcyl head sect szcod \fR |
| 206 |
of the encountered header. |
| 207 |
.PP |
| 208 |
.SS Commands\ available\ on\ 82072\ and\ later |
| 209 |
.TP |
| 210 |
\&\fR\&\f(CWdumpregs\fR\ |
| 211 |
Prints the contents of the FDCs registers, if supported. |
| 212 |
.PP |
| 213 |
.SS Commands\ available\ on\ 82072A\ and\ later |
| 214 |
.TP |
| 215 |
\&\fR\&\f(CWconfigure\ \fIconf1\ conf2\ conf3\fR\&\f(CW\fR\ |
| 216 |
Configures FIFO operation. |
| 217 |
.PP |
| 218 |
.SS Commands\ available\ on\ 82077\ and\ later |
| 219 |
.TP |
| 220 |
\&\fR\&\f(CWversion\fR\ |
| 221 |
Echoes 0x90 if the FDC is more recent than 82072A, and 0x80 otherwise |
| 222 |
.TP |
| 223 |
\&\fR\&\f(CWperpendicular\ \fIrate\fR\&\f(CW\fR\ |
| 224 |
Sets the perpendicular mode. Use 0 for normal, 2 for 500kb/s |
| 225 |
perpendicular, and 3 for 1 Mb/s perpendicular. |
| 226 |
.TP |
| 227 |
\&\fR\&\f(CWseek_out\ \fIdrvsel\ n\fR\&\f(CW\fR\ |
| 228 |
does a relative seek of |
| 229 |
\&\fIn\fR |
| 230 |
cylinders towards cylinder 0. |
| 231 |
.TP |
| 232 |
\&\fR\&\f(CWseek_in\ \ \fIdrvsel\ n\fR\&\f(CW\fR\ |
| 233 |
does a relative seek of \fIn\fR cylinders away from cylinder 0. |
| 234 |
.PP |
| 235 |
.SS Commands\ available\ on\ 82077AA\ and\ later |
| 236 |
.TP |
| 237 |
\&\fR\&\f(CWlock\fR\ |
| 238 |
Locks the FIFO configuration, so that it survives a FDC software reset. |
| 239 |
.TP |
| 240 |
\&\fR\&\f(CWunlock\fR\ |
| 241 |
Unlock the FIFO configuration |
| 242 |
.PP |
| 243 |
.SS Commands\ available\ on\ 82078 |
| 244 |
.TP |
| 245 |
\&\fR\&\f(CWpartid\fR\ |
| 246 |
echoes a byte describing the type of the FDC in the 3 high bits, and |
| 247 |
the stepping in the three low bits. |
| 248 |
.TP |
| 249 |
\&\fR\&\f(CWpowerdown\ \fIpowerconf\fR\&\f(CW\fR\ |
| 250 |
configures automatic power down of the FDC. The old configuration is echoed |
| 251 |
.TP |
| 252 |
\&\fR\&\f(CWoption\ \fIiso\fR\&\f(CW\fR\ |
| 253 |
enables/disables ISO formats. Odd values of |
| 254 |
\&\fIiso\fR |
| 255 |
enable these formats, whereas even values disable them. ISO formats |
| 256 |
don't have index headers, and thus allow one to fit slightly more data on |
| 257 |
a disk. |
| 258 |
.TP |
| 259 |
\&\fR\&\f(CWsave\fR\ |
| 260 |
prints out 16 internal registers of the FDC. |
| 261 |
.TP |
| 262 |
\&\fR\&\f(CWrestore\ \fIr1\ r2\ r3\ ...\ r16\fR\&\f(CW\fR\ |
| 263 |
restores the 16 internal registers of the FDC. |
| 264 |
.TP |
| 265 |
\&\fR\&\f(CWformat_n_write\ \fIdrvsel\ szcod\ sect-per-track\ fmt-gap\ fmt-fill\fR\&\f(CW\fR\ |
| 266 |
formats the cylinder and writes initial data to it. The input data is |
| 267 |
made up of a sequence of headers (4 bytes) and data: |
| 268 |
\&\fIheader1 data1 header2 data2 ... headern datan\fR |
| 269 |
.TP |
| 270 |
\&\fR\&\f(CWdrivespec\ \fIdspec1\ dspec2\ ...\ specn\ terminator\fR\&\f(CW\fR\ |
| 271 |
chooses rate tables for various drives. Each dspec byte describes one |
| 272 |
drive. Bits 0 and 1 say which drive is described. Bits 2 and 3 describe |
| 273 |
the rate table. Only tables 0 and 2 are interesting. Both tables only |
| 274 |
differ in the meaning of rate 1. For table 0 (the default) rate 0 is 300 |
| 275 |
kb/s (used for 5 1/4 DD disks), whereas for table 1 it is 2 Mbps (used |
| 276 |
for fast floppy tape drives). Bit 4 is the precompensation table select |
| 277 |
bit. It should be set to 0. Bit 5-7 should be zero as well. The |
| 278 |
\&\fIterminator\fR byte ends the \fR\&\f(CWdrivespec\fR command. It is either |
| 279 |
0xc0 or 0x80. If it is 0xc0, no result phase follows; if it is 0x80, the |
| 280 |
current data rate table configuration for the four drives is echoed. |
| 281 |
.PP |
| 282 |
.SH Modes |
| 283 |
The mode option is only needed when you describe the command as a |
| 284 |
numerical value. Some mode names are also valid command names. They |
| 285 |
are considered as command name if the command name has not yet been |
| 286 |
given, and as mode name otherwise. |
| 287 |
.PP |
| 288 |
If you give a command name followed by explicit modes, both the |
| 289 |
implicit flags of the command name, and the explicit modes are or'ed |
| 290 |
together. |
| 291 |
.PP |
| 292 |
If on the other hand you give a command name preceded by explicit |
| 293 |
modes, only the explicit modes are or'ed together. |
| 294 |
.TP |
| 295 |
\&\fR\&\f(CWread\fR\ |
| 296 |
Read data from disk using DMA. |
| 297 |
.TP |
| 298 |
\&\fR\&\f(CWwrite\fR\ |
| 299 |
Write data to the disk. |
| 300 |
.TP |
| 301 |
\&\fR\&\f(CWintr\fR\ |
| 302 |
Wait for an interrupt. |
| 303 |
.TP |
| 304 |
\&\fR\&\f(CWspin\fR\ |
| 305 |
wait for the disk to spin up |
| 306 |
.TP |
| 307 |
\&\fR\&\f(CWdisk\fR\ |
| 308 |
Aborts the operation if no disk is in the drive. This only works if you |
| 309 |
also chose a physical cylinder to seek to. |
| 310 |
.TP |
| 311 |
\&\fR\&\f(CWno-motor\fR\ |
| 312 |
Don't switch on the drive motor while issuing the command |
| 313 |
.TP |
| 314 |
\&\fR\&\f(CWno-motor-after\fR\ |
| 315 |
Switch off the motor immediately after the command returns. |
| 316 |
.TP |
| 317 |
\&\fR\&\f(CWfm\fR\ |
| 318 |
Uses the FM version of the \fR\&\f(CWread\fR, \fR\&\f(CWreadid\fR, \fR\&\f(CWwrite\fR and |
| 319 |
\&\fR\&\f(CWformat\fR commands. |
| 320 |
.TP |
| 321 |
\&\fR\&\f(CWno-mt\fR\ |
| 322 |
Do not use MT (multitrack) mode for the \fR\&\f(CWread\fR, \fR\&\f(CWreadid\fR and |
| 323 |
\&\fR\&\f(CWwrite\fR commands. This is needed on certain broken FDC's which |
| 324 |
don't recognize end of transfer when running in \fR\&\f(CWnodma\fR mode. In |
| 325 |
order to use these safely, set \fR\&\f(CWno-mt\fR, and chose the id of the |
| 326 |
last sector to be read as \fR\&\f(CWsect-per-track\fR. |
| 327 |
.PP |
| 328 |
\&\fR\&\f(CWfdrawcmd\fR opens the device node with the \fR\&\f(CWNDELAY\fR flag. This |
| 329 |
means that the driver should not try to autodetect the disk type (it |
| 330 |
might not be formatted), and that it should not reset the FDC. If a |
| 331 |
reset was needed, the command simply fails. If that happens, execute |
| 332 |
\&\fR\&\f(CWfloppycontrol \-\-resetnow 0\fR , and try again. |
| 333 |
.PP |
| 334 |
.SH See Also |
| 335 |
Fdutils' texinfo doc |