home *** CD-ROM | disk | FTP | other *** search
/ Fish 'n' More 2 / fishmore-publicdomainlibraryvol.ii1991xetec.iso / fish / devs&handlers / btntape / tape.doc < prev    next >
Text File  |  1990-10-27  |  22KB  |  450 lines

  1. ****    BTNtape:  a SCSI-Direct Tape Handler for AmigaDOS
  2. ****       Version 1.0   09/10/90
  3. ****       Freeware by Bob Rethemeyer   (DrBob@cup.portal.com)
  4. ****
  5. ****    (c) Copyright 1990 Robert Rethemeyer.
  6. ****      This software may be freely distributed and redistributed,
  7. ****      for non-commercial purposes, provided this notice is included.
  8. ****      All original files must included in the distribution.
  9.  
  10. BTNtape is a "Better Than Nothing" SCSI tape device handler.  It provides
  11. flat-file access to a SCSI tape drive from application programs using
  12. simple DOS calls to Read() and Write().  It can also be used with the Amiga
  13. TAR utility for disk backups.  Files may span multiple tape volumes
  14. and may start at any tape block.  This handler requires a "SCSI-direct"
  15. compatible hard disk driver.  It is known to work with a 3-M MCD-40 tape
  16. drive on the CBM 2091 controller, the CBM 2090A with an ST506 hard drive,
  17. and the Supra 4x4, and may also work with others (refer to the docs).
  18. Included is a monitoring program which prints useful information
  19. about handler activities, including error sense data.
  20.  
  21. This handler is probably not the all-purpose tape driver you have been waiting
  22. for.  It won't work with any backup program which requires Exec devices.
  23. I claim only that it works with the Amiga TAR program ported by Jonathan Hue.
  24. But until we see good commercial or shareware tape software, you might
  25. find this handler to be "better than nothing".
  26.  
  27. =================== ******> R E A D   T H I S <****** ======================
  28.  
  29. DISCLAIMER:
  30.  "This software is provided 'as-is', without warranty of any kind,
  31. either expressed or implied.  In no event will I, Robert Rethemeyer,
  32. be liable for direct, indirect, incidental or consequential damages or
  33. data loss resulting from the use or application of this software.  The entire
  34. risk as to the results and performance of this software is assumed by you."
  35.  
  36. I cannot guarantee that this software will work for any combinations
  37. of drives or controllers other than those I have specifically tested.
  38.  
  39. If you do not agree with this disclaimer,  I recommend you not use this
  40. software;  wait for good commercial tape drivers.
  41.  
  42. ============================================================================
  43.  
  44. I cannot at this time commit to adding further enhancements
  45. or special features requested by users.  This is not to say that I won't
  46. do these things, it's just that I can't guarantee I'll have the time
  47. or resources.
  48.  
  49. Although this documentation refers to alleged problems with some
  50. manufacturers' driver software, that should not be construed as a statement
  51. about the quality of their products.  In fact, there is still a possibility
  52. that the problems may be in my handler software or the equipment I used.
  53.  
  54. ==============================================================================
  55.  
  56. DISTRIBUTION:
  57.  
  58.   The distribution should contain the following files:
  59.         tape-handler          handler binary
  60.         tape.c                source for main handler program
  61.         tapeio.c              source for interface to SCSI-direct
  62.         pktstuff.c            source for packet handling, by Phillip Lindsay
  63.         tape.h                local include file
  64.         tplink.h              local include file for handler/monitor structure
  65.         tapemon               directory
  66.            tapemon               monitor program binary
  67.            tapemon.c             monitor source
  68.            tapemon.doc           documentation for the monitor program
  69.            tapemon.lmk           Lattice make file for tapemon
  70.         mountlist             example mountlist entry
  71.         formattape            raw command file for formatting tapes
  72.         lmkfile               Lattice make file for handler
  73.         makefile              Manx make file for handler
  74.         sense.codes           describes sense codes for 3-M MCD-40 drive
  75.         tape.doc              you're reading it
  76.  
  77.  
  78. COMPATIBILITY:
  79.  
  80.   You must have hard disk driver software which honors the SCSI-direct protocol
  81.   as defined in the "devices/scsidisk.h" include file.  Currently I know that
  82.   the CBM 2090A, 2091, and Supra Series-II v1.10 software support this protocol.
  83.   There are probably others which will support it also; check with your vendor.
  84.  
  85.   This handler is has been tested on the following equipment:
  86.  
  87.     Tape drives:  * 3-M Model MCD-40  40MB cartridge tape drive
  88.  
  89.     Controllers:  * Commodore 2091- works with no known problems.
  90.                   * Commodore 2090A- works *if* the hard drive is ST506.
  91.                   * Supra 4x4 (Amiga 1000)- works, but see Supra user notes.
  92.  
  93.   It may possibly work with other controllers:
  94.  
  95.     2090A with SCSI hard drive:  if the hard drive is on the same SCSI bus
  96.     with the tape drive, the 2090A driver seems to go into some kind of loop
  97.     when restoring files from tape to disk.  I believe this to be a problem
  98.     with the 2090A driver.  You can still restore the files to RAM or floppy.
  99.  
  100.     A3000:  It is my understanding that the Amiga 3000 built-in SCSI
  101.     controller is based on the 2091, so the handler should work with a 3000,
  102.     but I have not tested it on one.  Ditto for the A590.
  103.  
  104.     Other SUPRA controllers:  I believe that the same Supra driver software
  105.     is used on all their controllers.  I have only tried the handler on
  106.     the Supra 4x4 for the A1000, but it might work with their A2000 boards.
  107.  
  108.   Other tape drives:  the handler *might* work with another SCSI tape drive
  109.   if it supports the SCSI commands REZERO, REQUEST_SENSE, READ, and WRITE.
  110.   The drive must also support READ_CAPACITY for end-of-tape detection to work.
  111.   (If it does work for some other drive model, I would like to hear about it.)
  112.  
  113.  
  114. INSTALLATION:
  115.  
  116.   1.  Copy the TAPE-HANDLER file to L:TAPE-HANDLER.
  117.       Copy the TAPEMON program to C: or a directory appropriate for you.
  118.  
  119.   2.  Create an entry in DEVS:MOUNTLIST something like this:
  120.  
  121.         TAPE:  Handler = L:tape-handler
  122.                Priority = 5         /* use 11 for Supra */
  123.                Mount = 1            /* optional */
  124.                Stacksize = 4000
  125.                GlobVec = -1
  126.                Startup = "4/1/8192/1/0/yourscsi.device"
  127.                           | |  |   | |  |
  128.                           | |  |   | |  +---- name of your SCSI-direct driver
  129.                           | |  |   | +--- number of reserved tape blocks
  130.                           | |  |   +--- number of tape blocks per buffer
  131.                           | |  +---- tape drive block size (bytes)
  132.                           | +---- BufMemType
  133.                           +---- SCSI bus unit number to address tape drive
  134.  
  135.       There is nothing magic about the name TAPE:   You may use some
  136.       other valid device name if you like.
  137.  
  138.       The Startup parameter is used by the handler to determine how
  139.       to access your drive.  It should not have any embedded blanks
  140.       and should be enclosed in quotes.  The parts must be separated
  141.       by slashes. The numbers may be written as decimal, or hex in the
  142.       "0xNN" format.   FAILURE TO ENTER PROPER INFORMATION IN STARTUP MAY
  143.       RESULT IN PROBLEMS INCLUDING HANGS, VISITS FROM THE GURU,
  144.       OR DATA LOSS.
  145.  
  146.       The first number is the SCSI bus unit ID of your tape drive, as it
  147.       will be addressed by your SCSI-direct driver.  Presumably you have
  148.       set the tape drive ID switches or jumpers to a value that is unique
  149.       on the SCSI bus.  2090A owners- use the permuted (+3) unit number here.
  150.  
  151.       The second number is the same as BufMemType for mountlists.  Use
  152.       0 or 1 for "any", 2 or 3 for "chip", 4 or 5 for "fast".
  153.  
  154.       The third number is the number of bytes in a SCSI logical block
  155.       for your tape drive.
  156.  
  157.       The fourth number is the number of SCSI logical blocks to write or
  158.       read in one I/O operation.  Some drives may be mechanically more
  159.       efficient writing multiple blocks.  You may want to tweak this
  160.       parameter to find out, but start with 1 to be safe (some 2090A
  161.       owners report problems with multiple-block SCSI-direct I/O).
  162.       This parameter also determines how much storage is needed for
  163.       buffers.  The handler uses double buffering, so it will need
  164.       " 2 * blocksize * numberofblocks "  bytes when you Open it.
  165.       For example, for 8K blocks if you specify 8, then
  166.             2*8192*8 = 128K bytes are needed.
  167.  
  168.       The fifth number is like the Reserved parameter in mountlists. It tells
  169.       the handler how many SCSI logical blocks to skip at the beginning of
  170.       the tape before accessing data.  You may need it if there is something
  171.       on the front of the tape you want to preserve, like volume
  172.       information.  In most cases you can use zero.  To read a tape, you
  173.       must use the same reserved number with which it was written.
  174.  
  175.       The last part is the name of the device driver which provides
  176.       the SCSI-direct command protocol.  For 2090As this is "hddisk.device";
  177.       for Supra it is "supradirect.device".  Do not include any path
  178.       information.  You may need to include a special character in front
  179.       of the name to invoke bug circumventions- see the user notes below.
  180.  
  181.   3.  Install the handler in DOS using the CLI command "MOUNT TAPE:"
  182.        Unfortunately, if the handler fails due to a mountlist or OpenDevice
  183.        problem, there is no error indication [anyone know how I can?].
  184.        The device will show up in ASSIGN LIST, but no handler process.
  185.        Use ASSIGN dev REMOVE, fix the problem, and try again.
  186.  
  187.  
  188. 2090A USERS- NOTE
  189.  
  190.      Apparently (I don't own a 2090A) there is a software bug in the
  191.      CBM 2090A SCSI-direct driver that causes problems with tape
  192.      writes.  Bob Mitchell figured out that the problem can be
  193.      circumvented by asserting data address bit 24 for writes.
  194.      This handler can optionally invoke that circumvention.
  195.      To do so, prefix the driver name in the Startup parameter
  196.      with a dollar sign.  example: "4/1/8192/1/0/$hddisk.device"
  197.      The circumvention is NOT necessary for other controllers.
  198.  
  199.      A worse problem- the 2090A cannot seem to handle both the disk
  200.      and the tape drive on the same SCSI bus.  Strict reads and writes
  201.      to the tape work fine, but intermixed tape reads and disk writes
  202.      (such as during a restore) will cause the 2090A to get
  203.      stuck in a loop reading and rereading the same block.
  204.      This does not happen if the hard drive is on the ST506 bus.
  205.      It also does not happen if you restore the files to RAM or floppy.
  206.  
  207.      Make sure the tape is out of the drive when you boot
  208.      AmigaDOS;  otherwise, DOS never comes up.
  209.  
  210.      When you mount TAPE:,  make sure there is no cartridge in the
  211.      tape drive.  For some reason I do not understand, the 2090A
  212.      causes a reset to the tape drive when OpenDevice is called.
  213.      If a cartridge is in the drive at that time, the system
  214.      eventually enters an unusable state.  I recommend using
  215.      "Mount = 1" in your MountList entry for TAPE:.  When TAPE:
  216.      is mounted, it will put up a requester because the drive is
  217.      empty;  click on cancel, then everything will be happy.
  218.  
  219.  
  220. SUPRA USERS- NOTE
  221.  
  222.      Apparently (I DO own one) there is a problem with the Supra v1.10
  223.      SCSI-direct software that causes the host adapter to hang when a
  224.      non-zero byte count is supplied in the command (SCSICmd.scsi_Length).
  225.      It works fine when a data length of zero is used.  The handler can also
  226.      circumvent this problem. Prefix the driver name in the Startup parameter
  227.      with a plus sign.  Example:  "4/1/8192/1/0/+supradirect.device"
  228.      I have reported this to Supra, and they are looking into it.
  229.  
  230.      You *must* run the tape handler at a higher priority than the
  231.      Supra driver task.  You do this by changing the "Priority ="
  232.      line in the mountlist entry.  For Supra v1.10, the task runs
  233.      at priority 10.  Therefore, the tape handler should run at
  234.      "Priority = 11".  If some other Supra version runs at a different
  235.      priority, change the mountlist priority accordingly.
  236.      Use a utility such as Xoper or TaskX to find task priorities.
  237.  
  238.      If the cartridge is in the drive at the time you boot AmigaDOS,
  239.      SupraMount will hang the system if it touches the tape drive.
  240.      To avoid this, use the selective mount feature of SupraMount.
  241.      That is, SupraMount only your disk unit.  Example: "SupraMount 6".
  242.  
  243.  
  244. HOW TO USE IT
  245.  
  246.      Now that the handler is installed, how do you talk to it?
  247.      You can use TAR, or your own application program, including ARexx.
  248.      You can write data to the tape and later read it back in a manner
  249.      similar to other files, using DOS calls to Open, Read, Write, and Close.
  250.  
  251.      The handler makes the tape data look like a sequential AmigaDOS file.
  252.      There is NO FILE SYSTEM on the tape, but you may place multiple files
  253.      on a tape by positioning the tape to specific block numbers.
  254.      Also, files may span multiple tape volumes.
  255.  
  256.      You refer to the tape with one of the following file name forms:
  257.  
  258.        TAPE:            Rewind and open the tape at the first available block
  259.        TAPE:*           Opens the tape at the current position (no rewind)
  260.        TAPE:n           Opens the tape at block n  (n is a SCSI block number)
  261.        TAPE:$$RAWCMD$$  Sends a raw SCSI command to the drive (see below)
  262.  
  263.      The TAPE:n form works only if the tape drive supports direct block access.
  264.  
  265.      The handler does not support mixed reads and writes.  That is, you may
  266.      do only Reads or only Writes, but not both.  Seeks are not supported.
  267.      You cannot Open the tape in "append" mode.
  268.  
  269.      Be sure your cartridge is formatted.  If you try to write to an
  270.      unformatted tape, results will be non-optimal.  You can buy
  271.      preformatted tapes, or you can try formatting your own-
  272.      see the section on raw commands below.
  273.  
  274.      If there is no cartridge in the drive at the time TAPE: is
  275.      opened, DOS will put up a requester asking for volume "TAPE"
  276.      "in any drive".  Insert the cartridge (in the tape drive, not
  277.      a floppy drive :-)  and click on retry after tape motion stops.
  278.  
  279.      If the application reaches the end of the tape, the handler will put up
  280.      a requester  (if drive supports the "Read Capacity" SCSI command).
  281.      The requester asks you to insert the next tape and click "Continue",
  282.      or click "Quit".  The continue option allows the application program
  283.      to access a file across multiple tape volumes without interruption.
  284.      If you click quit, an I/O error indication is returned to the application.
  285.  
  286.      To use TAR, cd to the desired directory or partition ("cd DH0:"), then...
  287.  
  288.      To make a backup archive with TAR  :   tar -cv -f tape: ""
  289.      To add another archive file        :   tar -cv -f tape:* ""
  290.      To restore files from archive      :   tar -xv -f tape: *
  291.      To restore from archive at blk 840 :   tar -xv -f tape:840 *
  292.      To list the archive on the tape    :   tar -t  -f tape:
  293.      To make an archive log             :   tar >logfile -t -f tape:
  294.      To look at raw tape data           :   type tape: opt h  ... cntl-C
  295.  
  296.      When restoring files, TAR is case sensitive to the file names.
  297.      TAR can be aborted with cntl-C.
  298.      TAR can also make backups using a list of files from another file.
  299.      Refer to the TAR documentation for more information.
  300.  
  301.      HELPFUL HINTS:
  302.        - Label your tape cartridges.
  303.        - When writing multiple files to a tape, you must write down the
  304.           block numbers where each file starts.  Use the TAPEMON
  305.           program to obtain the block numbers.  Example:
  306.             File A starts at 0
  307.             File B starts at 48
  308.             File C starts at 224 ...
  309.        - First time, try backing up and restoring a floppy before doing the
  310.           same with your hard drive, to make sure the process works for you.
  311.           For the same reason, make a HD backup to floppies first.  Then
  312.           if the tape restore fails, you have something to fall back on.
  313.  
  314.  
  315. THE MONITOR PROGRAM
  316.  
  317.      Included in with the handler is the TAPEMON program.  TAPEMON is
  318.      a program that runs under a separate CLI and prints one-line
  319.      messages from the handler.  The messages include the current
  320.      tape operation and block number, and error and sense codes.
  321.      You will need to run this program to be able to place multiple
  322.      files on a tape.  Read TAPEMON.DOC for more information.
  323.  
  324.  
  325. FINE TUNING
  326.  
  327.      There are a few factors you can tweak to get good performance
  328.      on your particular system.  Good performance means the tape tends
  329.      to run continuously for long periods of time and does not have
  330.      to frequently back up to get a running start at the next block.
  331.      The tape usually has to stop while TAR gets more data from the
  332.      hard disk, but you can minimize it.
  333.  
  334.      The handler's "number of blocks" parameter can be increased from
  335.      one to some larger number as your memory allows.  With more handler
  336.      blocks, a large quantity of data is available to dump to the tape
  337.      (but creates potentially more "dead blocks" at the end of the tape).
  338.  
  339.      The TAR program also has a block parameter.  It controls how much
  340.      DOS data TAR collects before sending it to the handler.  If you
  341.      increase this parameter, it makes no sense to also increase the
  342.      handler block parameter, since the data has to go through both
  343.      buffers anyway.  You can increase the TAR blocks if your SCSI-
  344.      direct driver does not support multi-block operations.
  345.  
  346.      Some tape drives may support an interleave factor for the tape
  347.      that can be specified at the time the cartridge is formatted.
  348.      Interleave is the number of physical blocks separating adjacent
  349.      logical blocks.  The 3-M unit defaults to interleave 2, but I find
  350.      for my Supra that 3 prevents the tape from backing up frequently.
  351.      It doesn't seem to make much difference with the CBM controllers.
  352.  
  353.  
  354. HOW IT WORKS
  355.  
  356.      Writing to TAPE:, the handler collects the data in a memory buffer
  357.      until the buffer is full, then the buffer is written to
  358.      the current tape block.  Reads work in a similar manner but
  359.      in the other direction.
  360.  
  361.      Two buffers are maintained so that one buffer can be used by DOS
  362.      while the other is exchanging data with the drive.  This is
  363.      supposed to help keep the tape in motion, but it may not help much
  364.      with non-DMA controllers.
  365.  
  366.      This software does not write (or expect) anything special on
  367.      the tape for itself.  That is to say, the data written on the
  368.      tape is your raw data, nothing else.  If I were to use parts
  369.      of the tape for file system information, I would be
  370.      introducing a sort of standard-- I don't think that is a good
  371.      idea right now.  Raw data provides a lowest common denominator
  372.      which should help compatibility with other things.  For instance,
  373.      a TAR tape created on a non-Amiga system should be readable
  374.      using this handler and Amiga TAR.
  375.  
  376.      The handler does not provide a tape file system, and the tape
  377.      does not have a volume name.  The handler assumes the tape is
  378.      endless.  That is, it just keeps writing until you run out of tape.
  379.  
  380.  
  381. FORMATTING A TAPE- the raw command interface
  382.  
  383.      This handler provides a crude means of formatting cartridges,
  384.      without a special format program.  It's done with a built-in
  385.      raw command mode which allows you to send your own SCSI command to
  386.      the tape controller.  Although it might be used to send any
  387.      command, it's really designed only to make it easy to do a format.
  388.      There is no provision for any data transfer; don't try it.
  389.      (As you might guess, playing with raw mode can be dangerous.)
  390.  
  391.      The raw command mode is invoked by referencing the tape file as
  392.      "TAPE:$$RAWCMD$$".  The letters RAWCMD must be upper case and be
  393.      enclosed by the double dollar signs.  This magic word is how
  394.      the handler knows you want to do a raw command.
  395.  
  396.      To send a raw command, you enter the CLI command:
  397.  
  398.             TYPE filename TO TAPE:$$RAWCMD$$
  399.  
  400.      Line 1 of the file contains the bytes to be sent as the raw command,
  401.      in ASCII format.  Only the FIRST line of the file is significant;
  402.      you can use any following lines as comments, but the total size of
  403.      the file must be less than the size of a tape block.
  404.      The first line must contain ONLY hex digits and spaces.
  405.      Each byte of the raw command should be specified as a pair of hex
  406.      digits;  separate bytes by spaces.  Up to 32 bytes may be
  407.      specified, but only 6 or 10 are really needed.
  408.  
  409.      The supplied file "formattape" contains the raw command bytes
  410.      to initiate a format operation on the 3M tape drive.  Other
  411.      tape drive models may need different data; I can't help you there.
  412.      Look at the file for an explanation of the 3M format command bytes.
  413.  
  414.  
  415. BUGS
  416.  
  417.      The handler always assumes the tape device is LUN zero.
  418.  
  419.      I have not tested this software with AmigaDOS 1.2 or 2.0
  420.      (but it should work).
  421.  
  422.      The handler does not multi-task well, but I believe that to be
  423.      a characteristic of the SCSI-direct drivers, not the handler.
  424.      Don't expect to do much else while a backup is in progress.
  425.  
  426.      To read a file across multiple volumes, you must make sure that the
  427.      blocking factor specified in Startup is the same as when the tape
  428.      was written.  This is because there may be a few "dead blocks" at
  429.      the end of the tape which cannot be reached, and a different blocking
  430.      factor may make some previously written blocks unaccessible.
  431.  
  432.  
  433. AUTHOR:
  434.  
  435.   Email:  DrBob@cup.portal.com   OR   ...!sun!portal!cup.portal.com!DrBob
  436.  
  437.   USmail: Robert Rethemeyer
  438.           979-4 Belmont Terrace
  439.           Sunnyvale, CA  94086
  440.  
  441.  
  442. MANY THANKS GO TO:
  443.  
  444.   Bob Mitchell for the SCSI-direct programs I used to get started,
  445.     and the 2090A circumvention.
  446.   Phillip Lindsay for the my.handler example code.
  447.   Rene' Vega for advice and Manxification.
  448.   Gary Walborn, Don Camp, and Clay Jones for beta testing.
  449.  
  450.