Availability:
     Level E    , 'o'

  Quick Help:
     Fine RW Offset Measurement, o[NumAvgs],[TrkStepSize],[NumGuardTrks]

  Description:
    This command measures the Fine Reader/Writer Offset at the current track.
    The algorithm used here to measure the offset, a.k.a. micro-jog or MR offset,
    was basically ported from ST-10 code. Please see Pete Harllee for more detail about it.
 
    The algorithm used here can be divided into two big steps.
 
    The first step is to find a legitimate coarse MSE tub.
    Since the real offset is unknown, conventional method to find the tub is to sweep certain
    ranges of the offset with coarse offset increment. The range must be wide enough to cover
    the worst(biggest) ever heads and the increment must be narrow enough not to miss the tub.
    Because of this dilemma, finding the coase rw offset can be a very time consuming process.
    
    However, the alogorithm used here uses a different approach to find the coarse tub.
    Assuming the real offset should be fairly close to the current default, it scans one
    direction from the current default with a coarse increment of the offset. It then repeats
    the same process, alternating the direction, until a valid tub is found. If three
    measurements with finding good sync marks at more than half number of wedges in a track,
    it's regarded as having found a valid tub. This method is very fast especially if the
    real offset is close to the current default because the code would find the coarse tub
    after even a few measurements.
 
    The second step is to find the fine rw offset.
    The conventional method for doing this is to scan small range, for example, one track,
    with a fine, in many cases, the smallest possible, offset increments. This is also a time
    consuming process because the increment is very small even though the range is fairly
    small.
 
    The algorithm used here does this job differently from the conventional method.
    Once the coarse tub is found, the code tried to balance two sides of the tub since it's
    assumed that the MSE tub is bowl shaped and it is. If the code finds it's at the left
    side of the tub, it'll move to right direction and vice versa. When the code changes the
    scanning direction, it reduces the increment. If the increment becomes to zero or the MSE
    curve is so well balanced at both ends, the code calculates the fine rw offset that gives
    the same off-track margin(read capability) at both sides.

  Input Parameters:

    0 - Number of averages.
    
        This parameter specifies the number of target tracks to measure fine rw offset then
        average the measurement results to filter out any possible outliers.
    
          Type:    Unsigned 16-bit value
    
          Range:   1 to 0xFFFF
    
          Default: 5
    
    1 - Track step size.
    
        This parameter specifies the number of tracks between the sample tracks where
        the measurements occur.
    
          Type:    Unsigned 16-bit value
    
          Range:   0 to 0xFFFF
    
          Default: 4
    
    2 - Number of guard tracks.
    
        This parameter specifies the number of guard tracks at each side, ID and OD, of the
        sample tracks. These areas will be erased.
    
          Type:    Unsigned 16-bit value
    
          Range:   0 to 0xFFFF
    
          Default: 10
    
  Output Data:


    If an error occurred, the following information will be displayed.
    
          "DiagError aaaaaaaa"
    
       where
    
          aaaaaaaa is the Diagnostic Error Code
    
    If no error occurred, the Fine R/W Offset information will be displayed as follows.
    
          "Cyl/Hd cccccc/d OffsetPerTrk: eeeee OffsetDelta: fffff(sh.iiiEsj)"
    
       where
    
          cccccc      is the physical cylinder number where the fine RW Offset measurement occurred
    
          d           is the logical head number where the fine RW Offset measurement occurred
    
          eeeee       is the RW Offset amount value for a data track at the target track
    
          ffffff      is the measured RW offset difference(delta) from the current default offset
    
          sh.iiiEsj   is the floating point value for the RW offset delta value, in percentage,
                      over the Offset amount value for a data track
    
  Revision History:

    0001.0000   Initial revision.
    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).