.TH fdrawcmd 1 "27Jan21" fdutils-5.6 .SH Name fdrawcmd - send raw commands to the floppy disk controller '\" t .de TQ .br .ns .TP \\$1 .. .tr \(is' .tr \(if` .tr \(pd" .SH Note This manpage has been automatically generated from fdutils's texinfo documentation. However, this process is only approximative, and some items, such as cross-references, footnotes and indices are lost in this translation process. Indeed, these items have no appropriate representation in the manpage format. Moreover, only the items specific to each command have been translated, and the general information about fdutils has been dropped in the manpage version. Thus I strongly advise you to use the original texinfo doc. .TP * \ \ To generate a printable copy from the texinfo doc, run the following commands: .nf .ft 3 .in +0.3i ./configure; make dvi; dvips fdutils.dvi .fi .in -0.3i .ft R \&\fR .TP * \ \ To generate a HTML copy, run: .nf .ft 3 .in +0.3i ./configure; make html .fi .in -0.3i .ft R \&\fRA pre-made HTML can be found at: \&\fR\&\f(CW\(ifhttp://www.tux.org/pub/knaff/fdutils\(is\fR .TP * \ \ To generate an info copy (browsable using emacs' info mode), run: .nf .ft 3 .in +0.3i ./configure; make info .fi .in -0.3i .ft R \&\fR .PP The texinfo doc looks most pretty when printed or as HTML. Indeed, in the info version certain examples are difficult to read due to the quoting conventions used in info. .SH Description .PP .nf .ft 3 .in +0.3i \&\fR\&\f(CWfdrawcmd [\fR\&\f(CWdrive=\fIdrive\fR\&\f(CW] [\fR\&\f(CWrate=\fIrate\fR\&\f(CW] [\fR\&\f(CWlength=\fIlength\fR\&\f(CW] [\fR\&\f(CWrepeat=\fIrepeat\fR\&\f(CW] [\fR\&\f(CWcylinder=\fIphysical-cyl\fR\&\f(CW] \fIcommand\fR\&\f(CW [\fIparameters\fR\&\f(CW \&...] [\fImode\fR\&\f(CW] .fi .in -0.3i .ft R \&\fR .PP \&\fR\&\f(CWfdrawcmd\fR is used to send raw commands to the floppy disk controller, after having selected a given drive. You must have write permission to the selected drive. .PP When writing to a disk, data is read from stdin; when reading, data is printed to stdout. Diagnostic messages, return values from the controller, and the value of the disk change line after the command are printed to stderr. .PP .SH Options .PP All numbers may be given in octal (0211), decimal (137), or hexadecimal (0x89). .IP .TP \&\fR\&\f(CWdrive=\fIdrive\fR\&\f(CW\fR\ Selects the drive. The default is drive 0 (\fR\&\f(CW\(if/dev/fd0\(is\fR). .TP \&\fR\&\f(CWrate=\fIrate\fR\&\f(CW\fR\ Selects the data transfer rate. Use 0 for high density disks, 1 for double density 5 1/4 disks (or 2 Mbps tapes, if the appropriate rate table is selected), and 2 for double density 3 1/2 disks. .TP \&\fR\&\f(CWlength=\fIlength\fR\&\f(CW\fR\ Describes the length of the transferred data for commands reading from and writing to the disk. The default is to continue until end of file. .TP \&\fR\&\f(CWrepeat=\fIcount\fR\&\f(CW\fR\ Repeat the command \fIcount\fR times. This only works correctly for commands which don't do any data transfer. .TP \&\fR\&\f(CWcylinder=\fIcount\fR\&\f(CW\fR\ Seek to the given cylinder before executing the command .TP \&\fR\&\f(CW\fIcommand\fR\&\f(CW\fR\ The name of the command to send. \fIcommand\fR may be a spelled out name (like \fR\&\f(CWread\fR or \fR\&\f(CWwrite\fR), or a number representing the commands floppy disk controller opcode. A named command has already a mode associated with it, whereas for a number the mode parameter should be described using the \fR\&\f(CWmode\fR option. .IP .TP \&\fR\&\f(CW\fIparameters\fR\&\f(CW\fR\ The parameters for the command (optional, not all commands need parameters). .TP \&\fR\&\f(CW\fImode\fR\&\f(CW\fR\ Various flags or'ed together describing the properties of the command. .PP .SH Commands .PP The description of the various floppy commands given in this manpage is very sketchy. For more details get the 82078 spec sheet which can be found at: .nf .ft 3 .in +0.3i http://www-techdoc.intel.com/docs/periph/fd_contr/datasheets/ .fi .in -0.3i .ft R \&\fR .PP Look for the chapter \fR\&\f(CWCOMMAND SET/DESCRIPTIONS\fR. Older FDCs only support a subset of the commands described therein, but the syntax for the commands that do exist is the same. .PP .SS Commands\ available\ on\ all\ FDCs .IP .TP \&\fR\&\f(CWread\ \fIdrvsel\ cyl\ head\ sect\ szcod\ spt\ rw-gap\ szcod2\fR\&\f(CW\fR\ Reads \fIlength\fR bytes of data from the disk. \fIdrvsel\fR is the drive selector. Bit 0 and 1 describe the drive, and bit 2 describes the head. The remaining parameters give the cylinder, head (yes, again), sector, size of the sector (128 * 2 ^ \fIszcod\fR), sectors per track (\fR\&\f(CWspt\fR, this is used to switch to the second head when the first side has been read), and size of the read-write gap. \fIszcod2\fR should be 0xff. \fR\&\f(CWread\fR returns \fIST0 ST1 ST2\fR and \fIcyl head sect szcod\fR of the next sector to be read; see \&\fR\&\f(CW\(if/usr/include/linux/fdreg.h\(is\fR . .IP N.B. Certain newer floppy disk controllers are buggy, and do not correctly recognize the end of transfer when operating in virtual DMA mode. For these, you need to set \fR\&\f(CWspt\fR to the id of the last sector to be read (for example, if you intend to read sectors 2, 3, 4, set \fR\&\f(CWspt\fR to 4, even if the disk has more sectors), and set the \&\fR\&\f(CWno-mt\fR flag. .TP \&\fR\&\f(CWwrite\ \fIdrvsel\ cyl\ head\ sect\ szcod\ spt\ rw-gap\ szcod2\fR\&\f(CW\fR\ Analogous to \&\fR\&\f(CWread\fR. .TP \&\fR\&\f(CWsense\ \fIdrvsel\fR\&\f(CW\fR\ Returns the third status byte (\fIST3\fR) .TP \&\fR\&\f(CWrecalibrate\ \fIdrvsel\fR\&\f(CW\fR\ Recalibrates the drive and returns \fIST0 ST1\fR. .TP \&\fR\&\f(CWseek\ \fIdrvsel\ cyl\fR\&\f(CW\fR\ Moves the head to \fIcyl\fR and returns \fIST0 ST1\fR. .TP \&\fR\&\f(CWspecify\ \fIdrvsel\ spec1\ spec2\fR\&\f(CW\fR\ Specify various parameters to the drive. .TP \&\fR\&\f(CWformat\ \fIdrvsel\ szcod\ sect-per-track\ fmt-gap\ fmt-fill\fR\&\f(CW\fR\ Formats the cylinder. The new sectors are filled with \fIfmt-fill\fR. The header information comes from the input, which is made up of \&\fIcyl head sect szcod\fR quadruples. The \fIszcod\fR parameter from the command line is used to describe the actual size of the sectors, and the \fIszcod\fR from the input is used to write into the header. However, the first write to these sectors will use the header information, and might overwrite the following sectors if the \&\fIszcod\fR parameter from the command line was too small. .TP \&\fR\&\f(CWreadid\ \fIdrvsel\fR\&\f(CW\fR\ reads the first sector header that comes and returns \&\fIST0 ST1 ST2 \fR and \&\fIcyl head sect szcod \fR of the encountered header. .PP .SS Commands\ available\ on\ 82072\ and\ later .TP \&\fR\&\f(CWdumpregs\fR\ Prints the contents of the FDCs registers, if supported. .PP .SS Commands\ available\ on\ 82072A\ and\ later .TP \&\fR\&\f(CWconfigure\ \fIconf1\ conf2\ conf3\fR\&\f(CW\fR\ Configures FIFO operation. .PP .SS Commands\ available\ on\ 82077\ and\ later .TP \&\fR\&\f(CWversion\fR\ Echoes 0x90 if the FDC is more recent than 82072A, and 0x80 otherwise .TP \&\fR\&\f(CWperpendicular\ \fIrate\fR\&\f(CW\fR\ Sets the perpendicular mode. Use 0 for normal, 2 for 500kb/s perpendicular, and 3 for 1 Mb/s perpendicular. .TP \&\fR\&\f(CWseek_out\ \fIdrvsel\ n\fR\&\f(CW\fR\ does a relative seek of \&\fIn\fR cylinders towards cylinder 0. .TP \&\fR\&\f(CWseek_in\ \ \fIdrvsel\ n\fR\&\f(CW\fR\ does a relative seek of \fIn\fR cylinders away from cylinder 0. .PP .SS Commands\ available\ on\ 82077AA\ and\ later .TP \&\fR\&\f(CWlock\fR\ Locks the FIFO configuration, so that it survives a FDC software reset. .TP \&\fR\&\f(CWunlock\fR\ Unlock the FIFO configuration .PP .SS Commands\ available\ on\ 82078 .TP \&\fR\&\f(CWpartid\fR\ echoes a byte describing the type of the FDC in the 3 high bits, and the stepping in the three low bits. .TP \&\fR\&\f(CWpowerdown\ \fIpowerconf\fR\&\f(CW\fR\ configures automatic power down of the FDC. The old configuration is echoed .TP \&\fR\&\f(CWoption\ \fIiso\fR\&\f(CW\fR\ enables/disables ISO formats. Odd values of \&\fIiso\fR enable these formats, whereas even values disable them. ISO formats don't have index headers, and thus allow one to fit slightly more data on a disk. .TP \&\fR\&\f(CWsave\fR\ prints out 16 internal registers of the FDC. .TP \&\fR\&\f(CWrestore\ \fIr1\ r2\ r3\ ...\ r16\fR\&\f(CW\fR\ restores the 16 internal registers of the FDC. .TP \&\fR\&\f(CWformat_n_write\ \fIdrvsel\ szcod\ sect-per-track\ fmt-gap\ fmt-fill\fR\&\f(CW\fR\ formats the cylinder and writes initial data to it. The input data is made up of a sequence of headers (4 bytes) and data: \&\fIheader1 data1 header2 data2 ... headern datan\fR .TP \&\fR\&\f(CWdrivespec\ \fIdspec1\ dspec2\ ...\ specn\ terminator\fR\&\f(CW\fR\ chooses rate tables for various drives. Each dspec byte describes one drive. Bits 0 and 1 say which drive is described. Bits 2 and 3 describe the rate table. Only tables 0 and 2 are interesting. Both tables only differ in the meaning of rate 1. For table 0 (the default) rate 0 is 300 kb/s (used for 5 1/4 DD disks), whereas for table 1 it is 2 Mbps (used for fast floppy tape drives). Bit 4 is the precompensation table select bit. It should be set to 0. Bit 5-7 should be zero as well. The \&\fIterminator\fR byte ends the \fR\&\f(CWdrivespec\fR command. It is either 0xc0 or 0x80. If it is 0xc0, no result phase follows; if it is 0x80, the current data rate table configuration for the four drives is echoed. .PP .SH Modes The mode option is only needed when you describe the command as a numerical value. Some mode names are also valid command names. They are considered as command name if the command name has not yet been given, and as mode name otherwise. .PP If you give a command name followed by explicit modes, both the implicit flags of the command name, and the explicit modes are or'ed together. .PP If on the other hand you give a command name preceded by explicit modes, only the explicit modes are or'ed together. .TP \&\fR\&\f(CWread\fR\ Read data from disk using DMA. .TP \&\fR\&\f(CWwrite\fR\ Write data to the disk. .TP \&\fR\&\f(CWintr\fR\ Wait for an interrupt. .TP \&\fR\&\f(CWspin\fR\ wait for the disk to spin up .TP \&\fR\&\f(CWdisk\fR\ Aborts the operation if no disk is in the drive. This only works if you also chose a physical cylinder to seek to. .TP \&\fR\&\f(CWno-motor\fR\ Don't switch on the drive motor while issuing the command .TP \&\fR\&\f(CWno-motor-after\fR\ Switch off the motor immediately after the command returns. .TP \&\fR\&\f(CWfm\fR\ Uses the FM version of the \fR\&\f(CWread\fR, \fR\&\f(CWreadid\fR, \fR\&\f(CWwrite\fR and \&\fR\&\f(CWformat\fR commands. .TP \&\fR\&\f(CWno-mt\fR\ Do not use MT (multitrack) mode for the \fR\&\f(CWread\fR, \fR\&\f(CWreadid\fR and \&\fR\&\f(CWwrite\fR commands. This is needed on certain broken FDC's which don't recognize end of transfer when running in \fR\&\f(CWnodma\fR mode. In order to use these safely, set \fR\&\f(CWno-mt\fR, and chose the id of the last sector to be read as \fR\&\f(CWsect-per-track\fR. .PP \&\fR\&\f(CWfdrawcmd\fR opens the device node with the \fR\&\f(CWNDELAY\fR flag. This means that the driver should not try to autodetect the disk type (it might not be formatted), and that it should not reset the FDC. If a reset was needed, the command simply fails. If that happens, execute \&\fR\&\f(CWfloppycontrol \-\-resetnow 0\fR , and try again. .PP .SH See Also Fdutils' texinfo doc