fdrawcmd

Hurricane Electric Internet Services: Accounts starting at $9.95/month
Hurricane Electric Internet Services

NAME

       fdrawcmd - send raw commands to the floppy disk controller


SYNOPSIS

       rawcmd [drive=drive] [rate=rate] [length=length]
       [repeat=count] [seek=physical_track] command
       [parameters...]  [mode]


DESCRIPTION

       fdrawcmd 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.

       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.


OPTIONS

       All numbers may be given in octal (0209),  decimal  (137),
       or hexadecimal (0x89).

       drive=drive
              Selects   the   drive.   The  default  is  drive  0
              (/dev/fd0).

       rate=rate
              Selects the data transfer rate. Use 0 for high den-
              sity  disks, 1 for double density 5 1/4 disks (or 2
              Mbps tapes, if the appropriate rate  table  is  se-
              lected), and 2 for double density 3 1/2 disks.

       length=length
              Describes  the  length  of the transferred data for
              commands reading from and writing to the disk.  The
              default is to continue until EOF.

       repeat=count
              Repeat  the  command  count  times. This only works
              correctly for commands  which  don't  do  any  data
              transfer.

       command
              The  name of the command to send.  command may be a
              spelled out name (like read or write), or a number.
              A  named  command has already a mode, whereas for a
              number the mode parameter should be described using
              the appropriate option.

       parameter
              The parameter for the command.

       mode   Various flags or'ed together describing the proper-
              ties of the command.


COMMANDS

       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  http://www-tech-
       doc.intel.com/docs/periph/fd_contr/datasheets/.  Look  for
       the chapter COMMAND SET/DESCRIPTIONS .   Older  FDCs  only
       support  a  subset  of the commands described therein, but
       the syntax for the commands that do exist is the same.

   Commands available on all FDCs
       read drivesel track head sector  sizecode  sect_per_track
              rw_gap sizecode2
              Reads length bytes of data from the disk.  drivesel
              is  the  drive  selector.  Bit 0 and 1 describe the
              drive, and bit 2 describes the head.  The remaining
              parameters  give the track, head (yes, again), sec-
              tor, size of the sector (128 * 2 ^ sizecode),  sec-
              tors  per  track (used to switch to the second head
              when the first side has been read), and size of the
              read-write  gap.   sizecode2  should be 0xff.  read
              returns ST0 ST1 ST2 and track head sector  sizecode
              of  the  next  sector  to  be  read;  see  /usr/in-
              clude/linux/fdreg.h.

       write drivesel track head sector sizecode  sect_per_track
              rw_gap sizecode
              Analogous to read.

       sense drivesel
              Returns the third status byte (ST3).

       recalibrate drivesel
              Recalibrates the drive and returns ST0 ST1.

       seek drivesel track
              Moves the head to track and returns ST0 ST1.

       specify drivesel spec1 spec2
              Specify various parameters to the drive.

       format drivesel sizecode sect_per_track fmt_gap fmt_fill
              Formats the track. The new sectors are filled  with
              fmt_fill.   The  header  information comes from the
              input, which is made up of track head sector  size-
              code  quadruples.  The  sizecode parameter from the
              command line is used to describe the actual size of
              the  sectors,  and  the  sizecode from the input is
              used to write into the header. However,  the  first
              write to these sectors will use the header informa-
              tion, and might overwrite the following sectors  if
              the  sizecode  parameter  from the command line was
              too small.


       readid drivesel
              reads the first sector header that  comes  and  re-
              turns ST0 ST1 ST2 and track head sector sizecode of
              the encountered header.

   Commands available on 82072 and later
       dumpregs
              Prints the contents of the FDCs registers, if  sup-
              ported.

   Commands available on 82072A and later
       configure conf1 conf2 conf3
              Configures FIFO operation.

   Commands available on 82077 and later
       version
              Echoes  0x90 if the FDC is more recent than 82072A,
              and 0x80 otherwise

       perpendicular rate
              Sets the perpendicular mode.  Use 0 for  normal,  2
              for  500Kbps perpendicular, and 3 for 1Mbps perpen-
              dicular.

       seek_out drivesel n
              does a relative seek of n tracks towards track 0.

       seek_in drivesel n
              does a relative seek of n tracks towards  the  high
              numbered track.

   Commands available on 82077AA and later
       lock   Locks the FIFO configuration, so that it survives a
              FDC software reset.

       unlock Unlock the FIFO configuration

   Commands available on 82078
       partid echoes a byte describing the type of the FDC in the
              3  high  bits,  and  the  stepping in the three low
              bits.

       powerdown powerconf
              configures automatic power down of the FDC. The old
              configuration is echoed

       option iso
              enables/disables ISO formats. Odd values of iso en-
              able these formats,  whereas  even  values  disable
              them.  ISO  formats  don't  have index headers, and
              thus allow to fit slightly more data on a disk.

       save   prints out 16 internal registers of the FDC.

       restore r1 r2 r3 ... r16
              restores the 16 internal registers of the FDC.

       format_n_write drivesel sizecode sect_per_track fmt_gap
              fmt_fill
              formats  the  track  and writes initial data to it.
              The input data is made up of a sequence of  headers
              (4  bytes)  and data: header1 data1 header2 sector2
              ... headern sectorn

       drivespec dspec1 dspec2 ... specn terminator
              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 og  rate  1.  For
              table  0 (the default) rate 0 is 300 Kbps (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 termina-
              tor byte ends the drivespec command. It  is  either
              0xc0  or  0x80. If it is 0xc0, no result phase fol-
              lows; if it is 0x80, the current  data  rate  table
              configuration for the four drives is echoed.


MODES

       The  mode option is only needed when you describe the com-
       mand 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 oth-
       erwise.  If  you give a command name and an explicit mode,
       both the implicit flags of the command name, and  the  ex-
       plicit mode are or'ed together. Several modes may be or'ed
       together too.

       read   Read data from disk using DMA.

       write  Write data to the disk.

       intr   Wait for an interrupt.

       spin   wait for the disk to spin up

       need_seek
              Seeks the drives head to the correct track (as giv-
              en  by  the seek parameter) before sending the com-
              mand.

       disk   Aborts the operation if no disk is  in  the  drive.
              This only works if need_seek is also chosen.

       no_motor
              Don't  switch  on the drive motor while issuing the
              command

       no_motor_after
              Switch off the motor immediately after the  command
              returns.


RESET

       fdrawcmd  opens the device node with the NDELAY 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 sim-
       ply fails. If that happens, execute floppycontrol --reset-
       now 0, and try again.


FILES

       /dev/fd* - Floppy devices


AUTHOR

       Alain Knaff, Alain.Knaff@inrialpes.fr


SEE ALSO

       superformat(1), getfdprm(1), floppycontrol(1)
Hurricane Electric Internet Services: Accounts starting at $9.95/month
Hurricane Electric Internet Services
Copyright (C) 1998 Hurricane Electric. All Rights Reserved.