www.pudn.com > SMSC USB2.0.zip > protocol.c


/*============================================================================ 
  ____________________________________________________________________________ 
                                ______________________________________________ 
   SSSS  M   M          CCCC          Standard Microsystems Corporation 
  S      MM MM   SSSS  C                    Austin Design Center 
   SSS   M M M  S      C                 11000 N. Mopac Expressway 
      S  M   M   SSS   C                Stonelake Bldg. 6, Suite 500 
  SSSS   M   M      S   CCCC                Austin, Texas 78759 
                SSSS            ______________________________________________ 
  ____________________________________________________________________________ 
  Copyright(C) 1999, Standard Microsystems Corporation 
  All Rights Reserved. 
  This program code listing is proprietary to SMSC and may not be copied, 
  distributed, or used without a license to do so.  Such license may have 
  Limited or Restricted Rights. Please refer to the license for further 
  clarification. 
  ____________________________________________________________________________ 
  Notice: The program contained in this listing is a proprietary trade 
  secret of SMSC, Hauppauge, New York, and is copyrighted 
  under the United States Copyright Act of 1976 as an unpublished work, 
  pursuant to Section 104 and Section 408 of Title XVII of the United 
  States code. Unauthorized copying, adaption, distribution, use, or 
  display is prohibited by this law. 
  ____________________________________________________________________________ 
  Use, duplication, or disclosure by the Government is subject to 
  restrictions as set forth in subparagraph(c)(1)(ii) of the Rights 
  in Technical Data and Computer Software clause at DFARS 52.227-7013. 
  Contractor/Manufacturer is Standard Microsystems Corporation, 
  80 Arkay Drive, Hauppauge, New York, 1178-8847. 
  ____________________________________________________________________________ 
  ____________________________________________________________________________ 
  scsi.c - things required for scsi 
  ____________________________________________________________________________ 
  comments tbd 
  ____________________________________________________________________________ 
  Revision History 
  Date      Who  Comment 
  ________  ___  _____________________________________________________________ 
  12/06/01  tbh  initial version, munged from atapi.c 
  09/22/02  tbh  eliminated unused code on 242 builds 
============================================================================*/ 
#include "project.h" 
 
//------------------------------------------------------------------------------ 
// compile options 
#define k_dma_data_in 
#define k_dma_data_out 
 
//------------------------------------------------------------------------------ 
// module globals 
static bit _doing_dma ; 
 
//------------------------------------------------------------------------------ 
// sense codes 
code t_sense sense_none = 
{ 
  0x70,                           // ErrorCode 
  0x00,                           // Reserved 
  0x00,                           // SenseKey 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificA[4] 
  sizeof(t_sense) - 8,            // AdditionalLength 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificB[4] 
  0x00,                           // AdditionalSenseCode 
  0x00,                           // AscQualifier 
  0x00,                           // FieldReplacableUnitCode 
  0x00, 0x00, 0x00                // SenseKeySpecific[3] 
}; 
#if 0 
code t_sense sense_bad_lun = 
{ 
  0x70,                           // ErrorCode 
  0x00,                           // Reserved 
  0x05,                           // SenseKey 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificA[4] 
  sizeof(t_sense) - 8,            // AdditionalLength 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificB[4] 
  0x25,                           // AdditionalSenseCode 
  0x00,                           // AscQualifier 
  0x00,                           // FieldReplacableUnitCode 
  0x00, 0x00, 0x00                // SenseKeySpecific[3] 
}; 
#endif 
code t_sense sense_media_change = 
{ 
  0x70,                           // ErrorCode 
  0x00,                           // Reserved 
  0x06,                           // SenseKey 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificA[4] 
  sizeof(t_sense) - 8,            // AdditionalLength 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificB[4] 
  0x28,                           // AdditionalSenseCode 
  0x00,                           // AscQualifier 
  0x00,                           // FieldReplacableUnitCode 
  0x00, 0x00, 0x00                // SenseKeySpecific[3] 
}; 
code t_sense sense_no_media = 
{ 
  0x70,                           // ErrorCode 
  0x00,                           // Reserved 
  0x02,                           // SenseKey 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificA[4] 
  sizeof(t_sense) - 8,            // AdditionalLength 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificB[4] 
  0x3A,                           // AdditionalSenseCode 
  0x00,                           // AscQualifier 
  0x00,                           // FieldReplacableUnitCode 
  0x00, 0x00, 0x00                // SenseKeySpecific[3] 
}; 
#if 0 
code t_sense sense_becoming_ready = 
{ 
  0x70,                           // ErrorCode 
  0x00,                           // Reserved 
  0x02,                           // SenseKey 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificA[4] 
  sizeof(t_sense) - 8,            // AdditionalLength 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificB[4] 
  0x04,                           // AdditionalSenseCode 
  0x01,                           // AscQualifier 
  0x00,                           // FieldReplacableUnitCode 
  0x00, 0x00, 0x00                // SenseKeySpecific[3] 
}; 
#endif 
code t_sense sense_read_error = 
{ 
  0x70,                           // ErrorCode 
  0x00,                           // Reserved 
  0x03,                           // SenseKey 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificA[4] 
  sizeof(t_sense) - 8,            // AdditionalLength 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificB[4] 
  0x11,                           // AdditionalSenseCode 
  0x00,                           // AscQualifier 
  0x00,                           // FieldReplacableUnitCode 
  0x00, 0x00, 0x00                // SenseKeySpecific[3] 
}; 
#if 0 
code t_sense sense_fmt_failed =  // format failed 
{ 
  0x70,                           // ErrorCode 
  0x00,                           // Reserved 
  0x03,                           // SenseKey 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificA[4] 
  sizeof(t_sense) - 8,            // AdditionalLength 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificB[4] 
  0x31,                           // AdditionalSenseCode 
  0x01,                           // AscQualifier 
  0x00,                           // FieldReplacableUnitCode 
  0x00, 0x00, 0x00                // SenseKeySpecific[3] 
}; 
#endif 
#if 0 
code t_sense sense_no_seek = 
{ 
  0x70,                           // ErrorCode 
  0x00,                           // Reserved 
  0x03,                           // SenseKey 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificA[4] 
  sizeof(t_sense) - 8,            // AdditionalLength 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificB[4] 
  0x02,                           // AdditionalSenseCode 
  0x00,                           // AscQualifier 
  0x00,                           // FieldReplacableUnitCode 
  0x00, 0x00, 0x00                // SenseKeySpecific[3] 
}; 
#endif 
code t_sense sense_por = 
{ 
  0x70,                           // ErrorCode 
  0x00,                           // Reserved 
  0x06,                           // SenseKey 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificA[4] 
  sizeof(t_sense) - 8,            // AdditionalLength 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificB[4] 
  0x29,                           // AdditionalSenseCode 
  0x00,                           // AscQualifier 
  0x00,                           // FieldReplacableUnitCode 
  0x00, 0x00, 0x00                // SenseKeySpecific[3] 
}; 
code t_sense sense_illegal_request = 
{ 
  0x70,                           // ErrorCode 
  0x00,                           // Reserved 
  0x05,                           // SenseKey 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificA[4] 
  sizeof(t_sense) - 8,            // AdditionalLength 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificB[4] 
  0x26,                           // AdditionalSenseCode 
  0x00,                           // AscQualifier 
  0x00,                           // FieldReplacableUnitCode 
  0x00, 0x00, 0x00                // SenseKeySpecific[3] 
}; 
code t_sense sense_write_error = 
{ 
  0x70,                           // ErrorCode 
  0x00,                           // Reserved 
  0x03,                           // SenseKey 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificA[4] 
  sizeof(t_sense) - 8,            // AdditionalLength 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificB[4] 
  0x03,                           // AdditionalSenseCode 
  0x00,                           // AscQualifier 
  0x00,                           // FieldReplacableUnitCode 
  0x00, 0x00, 0x00                // SenseKeySpecific[3] 
}; 
#if 0 
code t_sense sense_no_fmt = 
{ 
  0x70,                           // ErrorCode 
  0x00,                           // Reserved 
  0x03,                           // SenseKey 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificA[4] 
  sizeof(t_sense) - 8,            // AdditionalLength 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificB[4] 
  0x30,                           // AdditionalSenseCode 
  0x01,                           // AscQualifier 
  0x00,                           // FieldReplacableUnitCode 
  0x00, 0x00, 0x00                // SenseKeySpecific[3] 
}; 
#endif 
code t_sense sense_write_protect = 
{ 
  0x70,                           // ErrorCode 
  0x00,                           // Reserved 
  0x07,                           // SenseKey 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificA[4] 
  sizeof(t_sense) - 8,            // AdditionalLength 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificB[4] 
  0x27,                           // AdditionalSenseCode 
  0x00,                           // AscQualifier 
  0x00,                           // FieldReplacableUnitCode 
  0x00, 0x00, 0x00                // SenseKeySpecific[3] 
}; 
#if 0 
code t_sense sense_write_protect_hw = 
{ 
  0x70,                           // ErrorCode 
  0x00,                           // Reserved 
  0x07,                           // SenseKey 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificA[4] 
  sizeof(t_sense) - 8,            // AdditionalLength 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificB[4] 
  0x27,                           // AdditionalSenseCode 
  0x01,                           // AscQualifier 
  0x00,                           // FieldReplacableUnitCode 
  0x00, 0x00, 0x00                // SenseKeySpecific[3] 
}; 
#endif 
#if 0 
code t_sense sense_write_protect_sw_lun = 
{ 
  0x70,                           // ErrorCode 
  0x00,                           // Reserved 
  0x07,                           // SenseKey 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificA[4] 
  sizeof(t_sense) - 8,            // AdditionalLength 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificB[4] 
  0x27,                           // AdditionalSenseCode 
  0x02,                           // AscQualifier 
  0x00,                           // FieldReplacableUnitCode 
  0x00, 0x00, 0x00                // SenseKeySpecific[3] 
}; 
#endif 
#if 0 
code t_sense sense_write_protect_assoc = 
{ 
  0x70,                           // ErrorCode 
  0x00,                           // Reserved 
  0x07,                           // SenseKey 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificA[4] 
  sizeof(t_sense) - 8,            // AdditionalLength 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificB[4] 
  0x27,                           // AdditionalSenseCode 
  0x03,                           // AscQualifier 
  0x00,                           // FieldReplacableUnitCode 
  0x00, 0x00, 0x00                // SenseKeySpecific[3] 
}; 
#endif 
#if 0 
code t_sense sense_write_protect_persist = 
{ 
  0x70,                           // ErrorCode 
  0x00,                           // Reserved 
  0x07,                           // SenseKey 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificA[4] 
  sizeof(t_sense) - 8,            // AdditionalLength 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificB[4] 
  0x27,                           // AdditionalSenseCode 
  0x04,                           // AscQualifier 
  0x00,                           // FieldReplacableUnitCode 
  0x00, 0x00, 0x00                // SenseKeySpecific[3] 
}; 
#endif 
#if 0 
code t_sense sense_write_protect_perm = 
{ 
  0x70,                           // ErrorCode 
  0x00,                           // Reserved 
  0x07,                           // SenseKey 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificA[4] 
  sizeof(t_sense) - 8,            // AdditionalLength 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificB[4] 
  0x27,                           // AdditionalSenseCode 
  0x04,                           // AscQualifier 
  0x00,                           // FieldReplacableUnitCode 
  0x00, 0x00, 0x00                // SenseKeySpecific[3] 
}; 
#endif 
code t_sense sense_illegal_cmdpkt = 
{ 
  0x70,                           // ErrorCode 
  0x00,                           // Reserved 
  0x05,                           // SenseKey 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificA[4] 
  sizeof(t_sense) - 8,            // AdditionalLength 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificB[4] 
  0x24,                           // AdditionalSenseCode 
  0x00,                           // AscQualifier 
  0x00,                           // FieldReplacableUnitCode 
  0x00, 0x00, 0x00                // SenseKeySpecific[3] 
}; 
#if 0 
code t_sense sense_saving_not_support = 
{ 
  0x70,                           // ErrorCode 
  0x00,                           // Reserved 
  0x05,                           // SenseKey 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificA[4] 
  sizeof(t_sense) - 8,            // AdditionalLength 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificB[4] 
  0x39,                           // AdditionalSenseCode 
  0x00,                           // AscQualifier 
  0x00,                           // FieldReplacableUnitCode 
  0x00, 0x00, 0x00                // SenseKeySpecific[3] 
}; 
#endif 
code t_sense sense_illegal_length = 
{ 
  0x70,                           // ErrorCode 
  0x00,                           // Reserved 
  0x05,                           // SenseKey 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificA[4] 
  sizeof(t_sense) - 8,            // AdditionalLength 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificB[4] 
  0x1A,                           // AdditionalSenseCode 
  0x00,                           // AscQualifier 
  0x00,                           // FieldReplacableUnitCode 
  0x00, 0x00, 0x00                // SenseKeySpecific[3] 
}; 
code t_sense sense_illegal_address = 
{ 
  0x70,                           // ErrorCode 
  0x00,                           // Reserved 
  0x05,                           // SenseKey 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificA[4] 
  sizeof(t_sense) - 8,            // AdditionalLength 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificB[4] 
  0x21,                           // AdditionalSenseCode 
  0x00,                           // AscQualifier 
  0x00,                           // FieldReplacableUnitCode 
  0x00, 0x00, 0x00                // SenseKeySpecific[3] 
}; 
code t_sense sense_illegal_opcode = 
{ 
  0x70,                           // ErrorCode 
  0x00,                           // Reserved 
  0x05,                           // SenseKey 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificA[4] 
  sizeof(t_sense) - 8,            // AdditionalLength 
  0x00, 0x00, 0x00, 0x00,         // VendorSpecificB[4] 
  0x20,                           // AdditionalSenseCode 
  0x00,                           // AscQualifier 
  0x00,                           // FieldReplacableUnitCode 
  0x00, 0x00, 0x00                // SenseKeySpecific[3] 
}; 
 
 
//------------------------------------------------------------------------------ 
// mode pages 
// read-write-error recovery page 
#if 0 
code t_buf_mode_page_rw_err mode_page_rw_err = 
{ 
  k_mode_page_rw_err_recovery,    // page code 
  k_mode_page_rw_err_recovery_page_length,  // page length 
  0x00,                           // awre, arre, tb, rc, eer, per, dte, dcr 
  0x00,                           // read retry count 
  0x00,                           // correction span 
  0x00,                           // head offset count 
  0x00,                           // data strobe offset count 
  0x00,                           // reserved 
  0x00,                           // write retry count 
  0x00,                           // reserved 
  0x00, 0x00                      // recovery time limit 
}; 
// -- Disconnect-Reconnect Page 
code t_buf_mode_page_dct_rct mode_page_dct_rct = 
{ 
  k_mode_page_dct_rct,            // page code 
  k_mode_page_dct_rct_page_length,  // page length 
  0x00,                           // buffer full ratio 
  0x00,                           // buffer empty ratio 
  0x00, 0x00,                     // bus inactivity limit 
  0x00, 0x00,                     // disconnect time limit 
  0x00, 0x00,                     // connect time limit 
  0x00, 0x00,                     // maximum burst size (in 512 byte increments) 
  0x00,                           // EmdpFardFawrtFastatDimmDtdc 
  0x00,                           // reserved 
  0x00, 0x00                      // first burst size 
}; 
// format device page 
code t_buf_mode_page_format_device mode_page_format_device = 
{ 
  k_mode_page_format_device,      // page code 
  k_mode_page_format_device_page_length,  // page length 
  0x00, 0x00,                     // tracks per zone 
  0x00, 0x00,                     // alternate sectors per zone 
  0x00, 0x00,                     // alternate tracks per zone 
  0x00, 0x00,                     // alternate tracks per logical unit 
  0x00, 0x00,                     // sectors per track 
  0x00, 0x00,                     // data bytes per physical sector 
  0x00, 0x00,                     // interleave 
  0x00, 0x00,                     // track skew factor 
  0x00, 0x00,                     // cylinder skew factor 
  0x00,                           // ssec, hsec, rmb, surf 
  0x00, 0x00                      // reserved [2] 
}; 
// rigid disk page 
code t_buf_mode_page_rigid_disk mode_page_rigid_disk = 
{ 
  k_mode_page_rigid_disk,         // page code 
  k_mode_page_rigid_disk_page_length,  // length of page in bytes 
  0x00, 0x00,                     // number of cylinders 
  0x00,                           // number of heads 
  0x00, 0x00,                     // starting cylinder-write precompensation 
  0x00, 0x00,                     // starting cylinder-reduced write current 
  0x00, 0x00,                     // device step rate 
  0x00, 0x00,                     // landing zone cylinder 
  0x00,                           // rpl 
  0x00,                           // rotational offset 
  0x00,                           // reserved 
  0x00, 0x00,                     // medium rotation rate 
  0x00, 0x00                      // reserved [2] 
}; 
// flexible disk page 
#if 0 
code t_buf_flex_disk_page mode_page_flex_disk = 
{ 
  k_mode_page_flex_disk_page, 
  k_mode_page_flex_disk_page_length, 
  0x00, 0x00,                     // transfer rate 
  0x00,                           // number of heads 
  0x00,                           // sectors per track 
  0x00, 0x00,                     // bytes per sector 
  0x00, 0x00,                     // number of cylinders 
  0x00, 0x00,                     // start cylinder-write precompensation 
  0x00, 0x00,                     // start cylinder-reduced write current 
  0x00, 0x00,                     // device step rate 
  0x00,                           // device step pulse width 
  0x00, 0x00,                     // head settle delay 
  0x00,                           // motor on delay 
  0x00,                           // motor off delay 
  0x00,                           // options 
  0x00,                           // spc 
  0x00,                           // write recompensation 
  0x00,                           // head_load_delay 
  0x00,                           // head unload delay 
  0x00,                           // Pin34 | Pin 2 
  0x00,                           // Pin4  | Pin 1 
  0x00, 0x00,                     // medium rotation rate 
  0x00, 0x00                      // reserved 
} t_str_flex_disk_page; 
#endif 
// verify error recovery page 
code t_buf_verify_error_recovery_page mode_page_verify_error_recovery = 
{ 
  k_mode_page_verify_error_recovery,  // page code 
  k_mode_page_verify_error_recovery_page_length,  // parameter length 
  0x00,                           // eer, per, dte, dcr 
  0x00,                           // verify retry count 
  0x00,                           // verify correction span 
  0x00, 0x00, 0x00, 0x00, 0x00,   // reserved[5] 
  0x00, 0x00                      // verify recovery time-limit 
}; 
// caching page 
code t_buf_mode_page_caching mode_page_caching = 
{ 
  k_mode_page_caching,            // page code 
  k_mode_page_caching_page_length,  // page length 
  0x00,                           // ic, abpf, cap, disc, size, wce, mf, rcd 
  0x00,                           // demand retention priority, write retention priority 
  0x00, 0x00,                     // disable pre-fetch transfer length 
  0x00, 0x00,                     // minimum pre-fetch 
  0x00, 0x00,                     // maximum pre-fetch 
  0x00, 0x00,                     // maximum pre-fetch ceiling 
  0x00,                           // fsw, lbcss, dra, vs, vs 
  0x00,                           // number of cache segments 
  0x00, 0x00,                     // cache segment size 
  0x00,                           // reserved 
  0x00, 0x00, 0x00                // non-cache segment size 
}; 
// control 
code t_mode_page_control mode_page_control = 
{ 
  k_mode_page_control,            // page code 
  k_mode_page_control_page_length,  // page length 
  0x00,                           // GltsdRlec 
  0x00,                           // QueuemodQerrDQue 
  0x00,                           // RacSwpRaerpUaaerpEaerp 
  0x00,                           // reserved 
  0x00, 0x00,                     // ready aer holdoff period 
  0x00, 0x00,                     // busy timeout period 
  0x00, 0x00                      // reserved [2] 
}; 
// medium types supported 
code t_buf_medium_types_page mode_page_medium_types = 
{ 
  k_mode_page_medium_types,       // page code 
  k_mode_page_medium_types_page_length,  // page length 
  0x00, 0x00,                     // reserved [2] 
  0x00,                           // medium type 1 supported 
  0x00,                           // medium type 2 supported 
  0x00,                           // medium type 3 supported 
  0x00                            // medium type 4 supported 
}; 
// notch and partition page 
code t_buf_notch_page mode_page_notch = 
{ 
  k_mode_page_notch,              // page code 
  k_mode_page_notch_page_length,  // page length 
  0x00,                           // nd, lpn 
  0x00,                           // reserved 
  0x00, 0x00,                     // maximum number of notches 
  0x00, 0x00,                     // active notch 
  0x00, 0x00,                     // starting boundry 
  0x00, 0x00,                     // ending boundry 
  0x00, 0x00                      // pages notched 
}; 
// power condition 0d page (alternative to 1a) 
code t_buf_power_condition mode_page_power_condition = 
{ 
  k_mode_page_power_condition,    // page code 
  k_mode_page_power_condition_page_length,  // page length 
  0x00,                           // reserved 
  0x00,                           // idle, standby 
  0x00, 0x00, 0x00, 0x00,         // idle condition timer 
  0x00, 0x00, 0x00, 0x00          // standby condition timer 
}; 
// XOR Control Page 
code t_buf_xor_control_page mode_page_xor_control = 
{ 
  k_mode_page_xor_control,        // page code 
  k_mode_page_xor_control_page_length,  // page length 
  0x00,                           // options 2 
  0x00,                           // reserved 
  0x00, 0x00, 0x00, 0x00,         // max_xor_write_size 
  0x00, 0x00, 0x00, 0x00,         // reserved 
  0x00, 0x00, 0x00, 0x00,         // max_regenerate_size 
  0x00, 0x00, 0x00, 0x00,         // max_rebuild_read_size 
  0x00, 0x00,                     // reserved 
  0x00, 0x00                      // rebuild delay 
}; 
// Informational Exceptions Control 
code t_buf_info_excpt_ctl mode_page_info_excpt_ctl = 
{ 
  k_mode_page_info_excpt_ctl,     // PageCode 
  k_mode_page_info_excpt_ctl_page_length,  // PageLength 
  0x00,                           // PerfDExcptTestLogerr 
  0x00,                           // MRIE (method of reporting info exceptions 
  0x00, 0x00, 0x00, 0x00,         // interval timer 
  0x00, 0x00, 0x00, 0x00          // report count 
}; 
// all mode pages 
code uint8 mode_page_all[]= 
{ 
  // read-write-error recovery page 
  k_mode_page_rw_err_recovery,    // page code 
  k_mode_page_rw_err_recovery_page_length,  // page length 
  0x00,                           // awre, arre, tb, rc, eer, per, dte, dcr 
  0x00,                           // read retry count 
  0x00,                           // correction span 
  0x00,                           // head offset count 
  0x00,                           // data strobe offset count 
  0x00,                           // reserved 
  0x00,                           // write retry count 
  0x00,                           // reserved 
  0x00, 0x00,                     // recovery time limit 
  // Disconnect-Reconnect Page 
  k_mode_page_dct_rct,            // page code 
  k_mode_page_dct_rct_page_length,  // page length 
  0x00,                           // buffer full ratio 
  0x00,                           // buffer empty ratio 
  0x00, 0x00,                     // bus inactivity limit 
  0x00, 0x00,                     // disconnect time limit 
  0x00, 0x00,                     // connect time limit 
  0x00, 0x00,                     // maximum burst size (in 512 byte increments) 
  0x00,                           // EmdpFardFawrtFastatDimmDtdc 
  0x00,                           // reserved 
  0x00, 0x00,                     // first burst size 
  // format device page 
  k_mode_page_format_device,      // page code 
  k_mode_page_format_device_page_length,  // page length 
  0x00, 0x00,                     // tracks per zone 
  0x00, 0x00,                     // alternate sectors per zone 
  0x00, 0x00,                     // alternate tracks per zone 
  0x00, 0x00,                     // alternate tracks per logical unit 
  0x00, 0x00,                     // sectors per track 
  0x00, 0x00,                     // data bytes per physical sector 
  0x00, 0x00,                     // interleave 
  0x00, 0x00,                     // track skew factor 
  0x00, 0x00,                     // cylinder skew factor 
  0x00,                           // ssec, hsec, rmb, surf 
  0x00, 0x00,                     // reserved [2] 
  // rigid disk page 
  k_mode_page_rigid_disk,         // page code 
  k_mode_page_rigid_disk_page_length,  // length of page in bytes 
  0x00, 0x00,                     // number of cylinders 
  0x00,                           // number of heads 
  0x00, 0x00,                     // starting cylinder-write precompensation 
  0x00, 0x00,                     // starting cylinder-reduced write current 
  0x00, 0x00,                     // device step rate 
  0x00, 0x00,                     // landing zone cylinder 
  0x00,                           // rpl 
  0x00,                           // rotational offset 
  0x00,                           // reserved 
  0x00, 0x00,                     // medium rotation rate 
  0x00, 0x00,                     // reserved [2] 
#if 0 
  // flexible disk page 
  k_mode_page_flex_disk_page, 
  k_mode_page_flex_disk_page_length, 
  0x00, 0x00,                     // transfer rate 
  0x00,                           // number of heads 
  0x00,                           // sectors per track 
  0x00, 0x00,                     // bytes per sector 
  0x00, 0x00,                     // number of cylinders 
  0x00, 0x00,                     // start cylinder-write precompensation 
  0x00, 0x00,                     // start cylinder-reduced write current 
  0x00, 0x00,                     // device step rate 
  0x00,                           // device step pulse width 
  0x00, 0x00,                     // head settle delay 
  0x00,                           // motor on delay 
  0x00,                           // motor off delay 
  0x00,                           // options 
  0x00,                           // spc 
  0x00,                           // write recompensation 
  0x00,                           // head_load_delay 
  0x00,                           // head unload delay 
  0x00,                           // Pin34 | Pin 2 
  0x00,                           // Pin4  | Pin 1 
  0x00, 0x00,                     // medium rotation rate 
  0x00, 0x00,                     // reserved 
#endif 
  // verify error recovery page 
  k_mode_page_verify_error_recovery,  // page code 
  k_mode_page_verify_error_recovery_page_length,  // parameter length 
  0x00,                           // eer, per, dte, dcr 
  0x00,                           // verify retry count 
  0x00,                           // verify correction span 
  0x00, 0x00, 0x00, 0x00, 0x00,   // reserved[5] 
  0x00, 0x00,                     // verify recovery time-limit 
  // caching page 
  k_mode_page_caching,            // page code 
  k_mode_page_caching_page_length,  // page length 
  0x00,                           // ic, abpf, cap, disc, size, wce, mf, rcd 
  0x00,                           // demand retention priority, write retention priority 
  0x00, 0x00,                     // disable pre-fetch transfer length 
  0x00, 0x00,                     // minimum pre-fetch 
  0x00, 0x00,                     // maximum pre-fetch 
  0x00, 0x00,                     // maximum pre-fetch ceiling 
  0x00,                           // fsw, lbcss, dra, vs, vs 
  0x00,                           // number of cache segments 
  0x00, 0x00,                     // cache segment size 
  0x00,                           // reserved 
  0x00, 0x00, 0x00,               // non-cache segment size 
  // control 
  k_mode_page_control,            // page code 
  k_mode_page_control_page_length,  // page length 
  0x00,                           // GltsdRlec 
  0x00,                           // QueuemodQerrDQue 
  0x00,                           // RacSwpRaerpUaaerpEaerp 
  0x00,                           // reserved 
  0x00, 0x00,                     // ready aer holdoff period 
  0x00, 0x00,                     // busy timeout period 
  0x00, 0x00,                     // reserved [2] 
  // medium types supported 
  k_mode_page_medium_types,       // page code 
  k_mode_page_medium_types_page_length,  // page length 
  0x00, 0x00,                     // reserved [2] 
  0x00,                           // medium type 1 supported 
  0x00,                           // medium type 2 supported 
  0x00,                           // medium type 3 supported 
  0x00,                           // medium type 4 supported 
  // notch and partition page 
  k_mode_page_notch,              // page code 
  k_mode_page_notch_page_length,  // page length 
  0x00,                           // nd, lpn 
  0x00,                           // reserved 
  0x00, 0x00,                     // maximum number of notches 
  0x00, 0x00,                     // active notch 
  0x00, 0x00,                     // starting boundry 
  0x00, 0x00,                     // ending boundry 
  0x00, 0x00,                     // pages notched 
  // power condition page 
  k_mode_page_power_condition,    // page code 
  k_mode_page_power_condition_page_length,  // page length 
  0x00,                           // reserved 
  0x00,                           // idle, standby 
  0x00, 0x00, 0x00, 0x00,         // idle condition timer 
  0x00, 0x00, 0x00, 0x00,         // standby condition timer 
#if 0 
  // XOR Control Page 
  k_mode_page_xor_control,        // page code 
  k_mode_page_xor_control_page_length,  // page length 
  0x00,                           // options 2 
  0x00,                           // reserved 
  0x00, 0x00, 0x00, 0x00,         // max_xor_write_size 
  0x00, 0x00, 0x00, 0x00,         // reserved 
  0x00, 0x00, 0x00, 0x00,         // max_regenerate_size 
  0x00, 0x00, 0x00, 0x00,         // max_rebuild_read_size 
  0x00, 0x00,                     // reserved 
  0x00, 0x00,                     // rebuild delay 
#endif 
  // Informational Exceptions Control 
  k_mode_page_info_excpt_ctl,     // PageCode 
  k_mode_page_info_excpt_ctl_page_length,  // PageLength 
  0x00,                           // PerfDExcptTestLogerr 
  0x00,                           // MRIE (method of reporting info exceptions 
  0x00, 0x00, 0x00, 0x00,         // interval timer 
  0x00, 0x00, 0x00, 0x00,         // report count 
}; 
#endif 
 
//---eof------------------------------------------------------------------------