📄 advdrvr.ug
字号:
Execute an ATA Non-Data command using CHS sector addressing.
Returns 0 if no error or 1 if there is an error.
int reg_non_data_lba28( int cmd, // command register
int fr, // feature register
int sc, // sector count
long lba ); // LBA
Execute an ATA Non-Data command using LBA sector addressing.
Returns 0 if no error or 1 if there is an error.
int reg_non_data_lba48( int cmd, // command register
int fr, // feature register
int sc, // sector count
long lbahi, // LBA upper 16-bits
long lbalo ); // LBA lower 32 bits
Execute an ATA Non-Data command using LBA sector addressing.
Returns 0 if no error or 1 if there is an error.
int reg_packet( unsigned int cpbc, // command packet size
unsigned int cpseg, // command packet buffer
unsigned int cpoff, // command packet buffer
int dir, // 0 for no data or read, 1 for write
unsigned int dpbc, // max data packet size
unsigned int dpseg, // data packet buffer
unsigned int dpoff ); // data packet buffer
Execute an ATAPI Packet (A0H) command in PIO mode. Note that
the first byte of the Commmand Packet buffer is the command
code of the "SCSI CDB" that is to be executed by the device.
Returns 0 if no error or 1 if there is an error.
int reg_pio_data_in_chs( 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 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.
int reg_pio_data_in_lba28( 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.
int reg_pio_data_in_lba48( 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.
int reg_pio_data_out_chs( 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.
int reg_pio_data_out_lba28( 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.
int reg_pio_data_out_lba48( 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.
int reg_reset( int skipFlag ); // skip flag
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).
Functions And Data In ADVIOTMR.C
--------------------------------
These functions provide the command timeout functions used by
ADVDRVR. Normally these functions are called only by ADVDRVR.
int tmr_chk_timeout( void );
Used by ADVDRVR 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 ADVDRVR 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 ADVDRVR to set the timeout time for a command or
reset. The value tmr_time_out is added to the current time
and this becomes the time that is checked whenever
tmr_chk_timeout() is called.
long tmr_time_out;
This value is the command timeout value in seconds. ADVDRVR
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_time_out_time;
This value is valid only while a command is executing. It is
the BIOS timer value for the time when the command will
timeout.
Functions And Data In ADVIOTRC.C
--------------------------------
These functions are the public interface to the command history
and low level trace facility or ADVDRVR.
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 ADVIO.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
ADVDRVR 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
ADVIO.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 + -