NEC V850E/MA1 Application Note page 85

32-bit single-chip microcontrollers pci host bridge macro
Hide thumbs Also See for V850E/MA1:
Table of Contents

Advertisement

// ATA command execution function //
////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
// Function name: ATA_Set_Features
// Function: Executes SET FEATURES command (Protocol:ND, Command:EFh). //
// Argument: dev_num : Device selection (0:Master/1:Slave)
// 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_Set_Features(int dev_num, int sub_cmd, int mode)
{
int status;
ATA_COMMAND ac;
ac.features
ac.sector_count
ac.sector_number = 0x00;
ac.cylinder_low
ac.cylinder_high = 0x00;
ac.device_head
ac.command
status = ATA_PIO_nondata(&ac);
return status;
}
//////////////////////////////////////////////////////////////////////////
// Function name: ATA_Idle_Immediate
// Function: Executes IDLE IMMEDIATE command (Protocol:ND, Command:E1h).//
// Argument: dev_num : Device selection (0:Master/1:Slave)
// 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_Idle_Immediate(int dev_num)
{
ATA_COMMAND ac;
CHAPTER 5 APPLICATION EXAMPLES
= sub_cmd;
// Features register
= mode;
// SectorCount register
// SectorNumber register
= 0x00;
// CylinderLow register
// CylinderHigh register
= dev_num<<4;
// Device/Head register
= 0xEF;
// Command register
Application Note U17121EJ1V1AN
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
85

Advertisement

Table of Contents
loading

This manual is also suitable for:

V850e/ma2V850e/ma3V850e/me2

Table of Contents