IDE knowledge anyone?

Oliver Lehmann lehmann at ans-netz.de
Thu Dec 10 02:18:47 CST 2015


Chuck Guzis <cclist at sydex.com> wrote:

> On 12/09/2015 09:58 PM, Oliver Lehmann wrote:
>
>> And this is whst I do/did. The drive supports LBA. I also tried CHS
>> with it and oft course i used cyl 0, head 0 and sector 1 without
>> success.
>>
>> I now ordered a cheap chinese LA
>
> When you say that you get an error, exactly what is the error  
> (status bytes)?   Before you issue the command, exactly what do the  
> drive registers contain?

After the command is issued, The status register has the ERR bit set,
and the error register has the ABRT bit set. With drive registers you
mean sector, cylinder and so on?

for LBA:

     while ( pata_bsy() ) {}

     write_io_register ( PATA_RW_SECTOR_COUNT_REGISTER, 1 );
     write_io_register ( PATA_RW_SECTOR_NUMBER_REGISTER, 0 );
     write_io_register ( PATA_RW_CYLINDER_LOW_REGISTER, 0 );
     write_io_register ( PATA_RW_CYLINDER_HIGH_REGISTER, 0 );
     write_io_register ( PATA_RW_DEVICE_HEAD_REGISTER, 0xa0 );

     write_io_register ( PATA_W_COMMAND_REGISTER, 0x21 );

         while ( pata_bsy() ) {}
         if ( pata_err() ) {
             return;
         }
         while ( !pata_drq() ) {}

pata_bsy, _drq and _err check the status registers for the relevant
bits. pata_err returns true. right after the command was issued.

I also checked after each register set - the status is always
correct, just after the command register is set, the drive goes
from busy to 0x59 (DRQ + ERR set).


More information about the cctech mailing list