⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 atadrvr.ug

📁 ATADRVR是DOS下的磁盘驱动程序,采用PIO传输 ,PCI DMA传输,ATA包,等非常全面代码示例... 内部有C与Asm描述. 编译环境:Borland C/C++ 4.52 与 Bo
💻 UG
📖 第 1 页 / 共 4 页
字号:
                         unsigned int cyl,       // CHS cylinder high/low
                         int head,               // CHS head
                         int sect,               // CHS sector
                         unsigned seg,           // buffer address
                         unsigned off,           // buffer address
                         int numSect,            // number of sectors to transfer
                         int multiCnt );         // current multiple count

   Execute an ATA PIO Data In command in CHS sector addressing
   mode.

   numSect is the actual number of sectors to be transferred.
   This value may be different than the sc value.

   If cmd is C4H (Read Multiple) then multiCnt MUST be set to the
   current sectors per block.

   Returns 0 if no error or 1 if there is an error.  See the
   contents of reg_cmd_info.

int reg_pio_data_in_lba28( int dev,            // device (0 or 1)
                           int cmd,            // command register
                           int fr,             // feature register
                           int sc,             // sector count
                           long lba,           // LBA
                           unsigned seg,       // buffer address
                           unsigned off,       // buffer address
                           int numSect,        // number of sectors to transfer
                           int multiCnt );     // current multiple count

   Execute an ATA PIO Data In command in LBA sector addressing
   mode.

   numSect is the actual number of sectors to be transferred.
   This value may be different than the sc value.

   If cmd is C4H (Read Multiple) then multiCnt MUST be set to the
   current sectors per block.

   Returns 0 if no error or 1 if there is an error.  See the
   contents of reg_cmd_info.

int reg_pio_data_in_lba48( int dev,            // device (0 or 1)
                           int cmd,            // command register
                           int fr,             // feature register
                           int sc,             // sector count
                           long lbahi,         // LBA upper 16-bits
                           long lbalo,         // LBA lower 32 bits
                           unsigned seg,       // buffer address
                           unsigned off,       // buffer address
                           int numSect,        // number of sectors to transfer
                           int multiCnt );     // current multiple count

   Execute an ATA PIO Data In command in LBA sector addressing
   mode.

   numSect is the actual number of sectors to be transferred.
   This value may be different than the sc value.

   If cmd is C4H (Read Multiple) then multiCnt MUST be set to the
   current sectors per block.

   Returns 0 if no error or 1 if there is an error.  See the
   contents of reg_cmd_info.

int reg_pio_data_out_chs( int dev,               // device (0 or 1)
                          int cmd,               // command register
                          int fr,                // feature register
                          int sc,                // sector count
                          unsigned int cyl,      // CHS cylinder high/low
                          int head,              // CHS head
                          int sect,              // CHS sector
                          unsigned seg,          // buffer address
                          unsigned off,          // buffer address
                          int numSect,           // number of sectors to transfer
                          int multiCnt );        // current multiple count

   Execute an ATA PIO Data Out command in CHS sector addressing
   mode.

   numSect is the actual number of sectors to be transferred.
   This value may be different than the sc value.

   If cmd is C5H (Write Multiple) then multiCnt MUST be set to
   the current sectors per block.

   Returns 0 if no error or 1 if there is an error.  See the
   contents of reg_cmd_info.

int reg_pio_data_out_lba28( int dev,           // device (0 or 1)
                            int cmd,           // command register
                            int fr,            // feature register
                            int sc,            // sector count
                            long lba,          // LBA
                            unsigned seg,      // buffer address
                            unsigned off,      // buffer address
                            int numSect,       // number of sectors to transfer
                            int multiCnt );    // current multiple count

   Execute an ATA PIO Data Out command in LBA sector addressing
   mode.

   numSect is the actual number of sectors to be transferred.
   This value may be different than the sc value.

   If cmd is C5H (Write Multiple) then multiCnt MUST be set to
   the current sectors per block.

   Returns 0 if no error or 1 if there is an error.  See the
   contents of reg_cmd_info.

int reg_pio_data_out_lba48( int dev,           // device (0 or 1)
                            int cmd,           // command register
                            int fr,            // feature register
                            int sc,            // sector count
                            long lbahi,        // LBA upper 16-bits
                            long lbalo,        // LBA lower 32 bits
                            unsigned seg,      // buffer address
                            unsigned off,      // buffer address
                            int numSect,       // number of sectors to transfer
                            int multiCnt );    // current multiple count

   Execute an ATA PIO Data Out command in LBA sector addressing
   mode.

   numSect is the actual number of sectors to be transferred.
   This value may be different than the sc value.

   If cmd is C5H (Write Multiple) then multiCnt MUST be set to
   the current sectors per block.

   Returns 0 if no error or 1 if there is an error.  See the
   contents of reg_cmd_info.

int reg_reset( int skipFlag,                 // skip flag
               int devRtrn );                // device's data returned

   Execute an ATA Soft Reset.  Set skipFlag to a non-zero value
   to bypass the setting of the SRST bit to 0 and then to 1 (used
   in some diagnostic programs).  Set devRtrn to 0 or 1 to
   determine which device's register contents are returned in
   reg_cmd_info.

int reg_slow_xfer_flag;

   Set this word to a non-zero value to cause ATADRVR to insert a
   0 to 55ms delay into ATA and ATAPI commands in PIO mode.  This
   simulates a very slow host system and is know to cause various
   problems for devices (such as buffer overruns and or
   underruns, firmware hangs, etc).

   For ATA PIO commands, if the value is zero or greater than
   numSect, no delay is inserted, else the delay is inserted when
   the number of sector remaining to be transferred is less than
   this value.

   For ATAPI PIO commands, if the value is zero or greater than
   the number of DRQ blocks transferred by the device, no delay
   is inserted, else the delay is inserted prior to the DRQ block
   number specified by this value.


Functions And Data In ATAIOTMR.C
--------------------------------

These functions provide the command timeout functions used by
ATADRVR.  Normally these functions are called only by ATADRVR.

int tmr_chk_timeout( void );

   Used by ATADRVR to check if a command or reset has timed out.
   The function tmr_set_timeout() MUST be called before using
   this function to time a command or reset.

long tmr_read_bios_timer( void );

   Used by ATADRVR to read the current contents of the BIOS
   timer.  Normally this value increments every 55ms and is reset
   to zero at midnight.

void tmr_set_timeout( void );

   Used by ATADRVR to start the timeout timer for a command or
   reset.

long tmr_time_out;

   This value is the command timeout value in seconds.  ATADRVR
   assumes a device is hung if a command or reset requires more
   than this number of seconds to complete.  The default is 20
   (20 seconds).  Note that some ATA commands (such as power
   management may require this value be set larger (perhaps to
   40).

long tmr_cmd_start_time;

   This value is valid only while a command is executing.  It is
   the BIOS timer value when tmr_set_timeout() was last called.


Functions And Data In ATAIOTRC.C
--------------------------------

These functions are the public interface to the command history
and low level trace facility or ATADRVR.

unsigned char * trc_get_cmd_name( unsigned char flg,
                                  unsigned char cc );

   Return a pointer to a character string that is the name of an
   ATA command. flg MUST be one of the following values (as
   defined in ATAIO.H):  TRC_FLAG_SRST or TRC_FLAG_ATA or
   TRC_FLAG_ATAPI. cc is the ATA command code (the value is
   ignored if flg is TRC_FLAG_SRST).

unsigned char * trc_get_er_bit_name( unsigned char er );

   Return a pointer to a character string that is the list of
   error bits that are 1 in the ATA Error register. er is assumed
   to be a value read from the ATA Error register.

unsigned char * trc_get_err_name( int ec );

   Return a pointer to a character string that describes the
   ATADRVR error code (ec).

unsigned char * trc_get_st_bit_name( unsigned char st );

   Return a pointer to a character string that is the list of
   status bits that are 1 in the ATA Error register. st is
   assumed to be a value read from the ATA Status or Alternate
   Status register.

void trc_err_dump1( void );
unsigned char * trc_err_dump2( void );

   Use these funcitons to return a set of character strings that
   describe the results of the last command executed.  See
   EXAMPLE1.C or EXAMPLE2.C for details on how to call these
   functions.

void trc_cht_dump0( void );
void trc_cht_dump1( void );
unsigned char * trc_cht_dump2( void );

   Use these funcitons to return a set of character strings that
   are the current contents of the command history trace buffer.
   See EXAMPLE1.C or EXAMPLE2.C for details on how to call these
   functions.  Note that these strings are formated to make it
   easy to create an ATADEMO script file (convert the comma
   characters to new-line characters).

void trc_cht_types( int type );

   The types of commands that are traced in the command history
   can be restricted to the types specified in this function
   call. type MUST be one of these values (as defined in
   ATAIO.H):  TRC_TYPE_ALL, TRC_TYPE_NONE, TRC_TYPE_ADMAI,
   TRC_TYPE_ADMAO, TRC_TYPE_AND, TRC_TYPE_APDI, TRC_TYPE_APDO,
   TRC_TYPE_ASR, TRC_TYPE_PDMAI, TRC_TYPE_PDMAO, TRC_TYPE_PND,
   TRC_TYPE_PPDI, TRC_TYPE_PPDO.

void trc_llt_dump0( void );
void trc_llt_dump1( void );
unsigned char * trc_llt_dump2( void );

   Use these funcitons to return a set of character strings that
   are the current contents of the low level trace buffer.  See
   EXAMPLE1.C or EXAMPLE2.C for details on how to call these
   functions.


QUESTIONS OR PROBLEMS?
----------------------

Send your question(s) or problem description(s) to Hale Landis
via email at this address:

   hlandis@ata-atapi.com

Visit Hale's web site:

   www.ata-atapi.com

/end/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -