Availability:
     Level A    , 'Q'

  Quick Help:
     Write, Read, Read LBA, Q[Lba],[NumLbas],[Opts]

  Description:
    This command performs a write, read, read operation starting at the specified LBA
    (Logical Block Address) for the specified number of LBAs.  The LBAs are written
    with the data contained in the Diagnostic Write Buffer and they are read into the
    Diagnostic Read Buffer.

  Input Parameters:

     0 - LBA.
    
         If Parameter 2 bit 5 is set, then this parameter specifies the address of the
         first System Area LBA to be written and read, else it specifies the address of
         the first User Area LBA to be written and read.
    
           Type:    Unsigned 32-bit value
    
           Range:   0 to maximum User Area LBA, if parameter 2 bit 5 is cleared
                    0 to maximum System Area LBA, if parameter 2 bit 5 is set
    
           Default: Current Target Address
    
     1 - Transfer Length.
    
         This parameter specifies the number of consecutive LBAs to written.
    
           Type:    Unsigned 32-bit value
    
           Range:   0 to 0xFFFFFFFF
    
           Default: If the LBA (Parameter 0) was entered and the Transfer Length (Parameter 1)
                    was not entered, then only the specified LBA will be written and read.
    
                    If both the LBA (Parameter 0) and Transfer Length (Parameter 1) are not
                    entered, then the Transfer Length will be set based on the Test Space
                    that is selected.  If the Random Transfer Length option is selected, a
                    random value will be used that is less than or equal to the number of LBAs
                    remaining in the Test Space.  If the Random Transfer Length option is not
                    selected, the number of LBAs remaining on the track containing the current
                    Target LBA will be written and read.
    
                    If a Transfer Length is entered, it will be limited to the number of
                    LBAs remaining in the Test Space.
    
     2 - Options.
    
         This parameter is a bit-significant value that allows the user to select the
         following options.
    
           Bits 15-6:  not used.
    
           Bit 5:      Write and Read System Area LBAs.
    
                       If this bit is set, then Parameter 0 specifies a System Area LBA,
                       else Parameter 0 specifies a User Area LBA.
    
           Bit 4:      Write and Read All Test Space LBAs.
    
                       If this bit is set, all of the LBAs in the Test Space will be
                       written and read, else only the LBAs specified by Parameters 0
                       and 1 will be written and read.
    
           Bit 3:      not used.
     
           Bit 2:      Rotate Buffer Sector Offset.
     
                       If this bit is set, the Target Buffer Sector Offset will be rotated
                       by 1 prior to the execution of this diagnostic command.
                       This bit was originally added to help writing random data pattern
                       reduce execution time by not having to re-fill the diagnostic buffer
                       with new random data pattern, which takes great amount of time,
                       but just rotating the Target Buffer Sector Offset at every time this
                       diagnostic command is executed with this option set.
                       To see or change the current Targer Buffer Sector Offset, please refer
                       all Level 'A', Set Test Space, diagnostic command for detail how-to.
    
    
           Bit 1:      Enable Dynamic Sparing.
    
                       If this bit is set, sectors containing media defects that meet the
                       failure criteria will be spared.
    
    
           Bit 0:      Continue On Error.
     
                       If this bit is set and an error occurs, the write and read operations
                       will continue and attempt to write and read all of the requested
                       sectors.  Each error encountered will be displayed.
    
           Type:    Unsigned 16-bit value
    
           Range:   0 to 0xFFFF
    
           Default: 0    (Write and Read User Area LBAs,
                          Write and Read the requested LBAs,
                          Disable Dynamic Sparing,
                          Stop On Error)
    
  Output Data:

    If an error occurred, the following information will be displayed.
    
          "DiagError aaaaaaaa R/W Status c R/W Error dddddddd"
    
       and
    
          "Next User LBA eeeeeeee LLL CHS ffffff.g.hhhh PLP CHS iiiiii.j.kkkk"
          "Remaining Transfer Length llllllll"
    
       or
    
          "Next System LBA eeeeeeee LLL CHS ffffff.g.hhhh PLP CHS iiiiii.j.kkkk"
          "Remaining Transfer Length llllllll"
    
       where
    
          aaaaaaaa is the Diagnostic Error Code
    
          c is the status returned by the R/W subsystem
    
                0 = R/W request completed successfully with error recovery
                1 = R/W request completed successfully (no error recovery performed)
                2 = R/W request failed
    
          dddddddd is the error code returned by the R/W subsystem
    
          eeeeeeee is the Disk Logical Block Address of the sector in error
    
          ffffff is the Logical Cylinder Address of the sector in error
    
          g is the Logical Head Address of the sector in error
    
          hhhh is the Logical Sector Address of the sector in error
    
          iiiiii is the Physical Cylinder Address of the sector in error
    
          j is the Logical Head Address of the sector in error
    
          kkkk is the Physical Sector Address of the sector in error
    
          llllllll is the number of sectors remaining to be read or written
    
    If the Verbose Formatted ASCII Data Output Mode is selected, the Verbose Mode option
    bits will enable the following data to be output when set.
    
       Bit 0:      Enables the R/W Status and R/W Error to be displayed
       Bit 1:      Enable the Next Address to be displayed
       Bit 2:      Enables the Track Position and Track Follow Offset to be displayed
       Bit 3:      Enables the Target Address to be displayed
       Bit 4:      Enables the Recovery Status to be displayed
       Bit 5:      Enables the Fault Status to be displayed
       Bit 6:      Enables the Elapsed Time to be displayed
       Bits 31-7:  NA
    
    If Bit 0 is set, the R/W Status and R/W Error will be displayed even if no error
    occurred.  The data displayed will be formatted as shown above.
    
    If Bit 1 is set, the Next Address will be displayed even if no error occurred.  The
    data displayed will be formatted as shown above.
    
    If Bit 2 is set, the Track Position and Track Follow Offset will be displayed as
    follows.
    
          "Read Position, Persistent Offset m.m% Total Offset n.n%"          or
          "Write Position, Persistent Offset m.m% Total Offset n.n%"         or
          "Write Header Position, Persistent Offset m.m% Total Offset n.n%"
    
       where
    
          m.m is the Persistent Track Follow Offset in units of percentage of track width
    
          n.n is the Total Track Follow Offset in units of percentage of track width
    
    If Bit 3 is set, the Target Address will be displayed as follows.
    
          "Target User LBA pppppppp LLL CHS qqqqqq.r.ssss PLP CHS tttttt.u.vvvv"
          "Starting Transfer Length wwwwwwww"
    
       or
    
          "Target System LBA pppppppp LLL CHS qqqqqq.r.ssss PLP CHS tttttt.u.vvvv"
          "Starting Transfer Length wwwwwwww"
    
       where
    
          pppppppp is the starting Disk Logical Block Address
    
          qqqqqq is the starting Logical Cylinder Address
    
          r is the starting Logical Head Address
    
          ssss is the starting Logical Sector Address
    
          tttttt is the starting Physical Cylinder Address
    
          u is the starting Logical Head Address
    
          vvvv is the starting Physical Sector Address
    
          wwwwwwww is the starting Transfer Length
    
    If Bit 4 is set, the Recovery Status will be displayed as follows.
    
          "Recovered User LBA AAAAAAAA LLL CHS BBBBBB.C.DDDD PLP CHS EEEEEE.F.GGGG"
          "Recovery Flags HHHH Count II"
    
       or
    
          "Recovered System LBA AAAAAAAA LLL CHS BBBBBB.C.DDDD PLP CHS EEEEEE.F.GGGG"
          "Recovery Flags HHHH Count II"
    
       where
    
          AAAAAAAA is the Disk Logical Block Address of the last recovered sector
    
          BBBBBB is the Logical Cylinder Address of the last recovered sector
    
          C is the Logical Head Address of the last recovered sector
    
          DDDD is the Logical Sector Address of the last recovered sector
    
          EEEEEE is the Physical Cylinder Address of the last recovered sector
    
          F is the Logical Head Address of the last recovered sector
    
          GGGG is the Physical Sector Address of the last recovered sector
    
          HHHH are the Recovery Flags reported by the Read/Write code
    
          II is the Recovery Count reported by the Read/Write code
    
    If Bit 5 is set, the Fault Status will be displayed as follows.
    
          "Drive Fault Status JJJJ Preamp Fault Status KKKK"
          "Read Channel Faults:
           SRC Fault Reg 190 = aaaa
           SRC Fault Reg 191 = bbbb
           SID Reg 20B = cccc
           SID Reg 26C = dddd
           SID Reg 26F = eeee
           SID Reg 251 = fffff
    
       where
    
          JJJJ is the Drive Fault Status reported by the Read/Write code
    
          KKKK is the Preamp Fault Status reported by the Read/Write code
    
          aaaa  is the SRC channel fault Register 190h value
    
          bbbb is the SRC channel fault register 191h value
    
          cccc is the SID channel fault register 20bh   value
    
          dddd is the SID channel fault reg 26ch   value
    
          eeee is the SID Channel fault reg 251h value
    
    If Bit 6 is set, the Elapsed Time for the read/write operation will be displayed.

    
       "Elapsed Time a mins b secs"  or
       "Elapsed Time b.c secs"       or
       "Elapsed Time c.d msecs"
    
    where
    
       a is minutes
       b is seconds
       c is milliseconds
       d is microseconds
    
  Examples:
    Example #1:
       To write and read a single LBA
       (in this case LBA 51237)

          F3 A>Q51237

    Example #2:
       To write and read multiple LBAs
       (in this case LBAs 51237 to 51247)

          F3 A>Q51237,11

    Example #3:
       To write and read all of the LBAs remaining on the track containing the target LBA
       (in this case all LBAs remaining on the cylinder that contains LBA 51237)

          F3 A>S51237
          F3 A>Q

    Example #4:
       To write and read all of the LBAs remaining on the track containing the target LBA
       and continue on error
       (in this case all LBAs remaining on the cylinder that contains LBA 51237)

       Note: An error message will be displayed for each LBA in error.

          F3 A>S51237
          F3 A>Q,,1

    Example #5:
       To write and read all of the LBAs in the test space and continue on error

       Note: The Test Space is selected by the all level 'A' command.  An error
       message will be displayed for each LBA in error.

          F3 A>Q,,11

    Example #6:
       To write and read a single system LBA
       (in this case system LBA 1237)

          F3 A>Q1237,,20

    Example #7:
       To write and read multiple system LBAs
       (in this case system LBAs 1237 to 1247)

          F3 A>Q1237,11,20

    Example #8:
       To write and read all of the LBAs remaining on the track containing the target
       system LBA
       (in this case all LBAs remaining on the cylinder that contains LBA 1237)

          F3 A>S1237,,,,,1
          F3 A>Q,,20

    Example #9:
       To write a single LBA with data at a specific sector offset in the diagnostic write
       buffer and read it to the sector offset in the diagnostic read buffer
       (in this case LBA 51237,
        write with data at the sector offset of 5 in the diagnostic write buffer,
        read to the sector offset of 5 in the diagnostic read buffer)

          F3 A>AF,5
          F3 A>Q51237

    Example #10:
       To rotate the buffer sector offset by 1, write a single LBA with data at the rotated
       sector offset in the diagnostic write buffer, then read it to the rotated sector
       offset in the diagnostic read buffer
       (This example assumes user ran the Example #9 above right before this example,
        in this case LBA 51238,
        write with data at the sector offset of 6 in the diagnostic write buffer,
        read to the sector offset of 6 in the diagnostic read buffer)

          F3 A>Q51238,,4

  Revision History:

    0001.0000   Initial revision.
    0001.0001   Eliminated the Enable ZAP Updates and Enable Track Skipping option.
    0001.0002   Modified to write and read only the LBAs remaining on the track containing
                the target LBA, if the LBA and Transfer Length are not entered by the user.
    0001.0003   Added new Rotate Buffer Sector Offset option to the bit 2 of the parameter 2.
    0011.0000   Combined the PSG Diagnostic Error Codes (PSGDEC) and the Diagnostic External
                Test Service Error Codes (DETSEC) into a single set of Diagnostic Error Codes
                (DiagError).