
CHAPTER 5 APPLICATION EXAMPLES
Application Note U17121EJ1V1AN
86
ac.features
ac.sector_count
ac.sector_number
ac.cylinder_low
ac.cylinder_high
ac.device_head
ac.command
status = ATA_PIO_nondata(&ac);
return status;
}
///////////////////////////////////////////////////////////////////////////
// Function name: ATA_Identify_Device //
// Function: Executes IDENTIFY DEVICE command (Protocol:PI, Command:ECh).//
// Argument: dev_num : Device selection (0:Master/1:Slave) //
// buff : Buffer pointer //
// Return value: //
// STATUS_SUCCESS : Normal end //
// STATUS_TIMEOUT_DEVICE_SELECTION : DEVICE SELECTION error end //
// STATUS_TIMEOUT_DRDY1 : DRDY=1 timeout error end //
// STATUS_TIMEOUT_INTRQ : INTRQ timeout error end //
// STATUS_IDE_ERROR : Error end after command execution //
// //
///////////////////////////////////////////////////////////////////////////
int ATA_Identify_Device(int dev_num, void *buff)
{
ATA_COMMAND ac;
int status;
ac.features
= 0x00;
ac.sector_count
= 0x00;
ac.sector_number
= 0x00;
ac.cyliner_low
= 0x00;
ac.cylinder_high
= 0x00;
ac.dev_head
= dev_num << 4;
ac.command
= 0xEC;
status = ATA_PIO_datain(&ac, 1, buff);
return status;
}
//////////////////////////////////////////////////////////////////////////
// Function name: ATA_Read_Sector //
= 0x00;
= 0x00;
= 0x00;
= 0x00;
= 0x00;
= dev_num<<4;
= 0xE1;
// Features register
// SectorCount register
// SectorNumber register
// CylinderLow register
// CylinderHigh register
// Device/Head register
// Command register
// Features register
// SectorCount register
// SectorNumber register
// CylinderLow register
// CylinderHigh register
// Device/Head register
// Command register