CHAPTER 5 APPLICATION EXAMPLES
Application Note U17121EJ1V1AN
95
wait(TIMER400ns); // Wait 400 ns
idestat = *IDEREG_ALT_STATUS; // Alt Status register empty read
*IDEREG_BUSMASTER_START_STOP |= 0x01; // Bus Master Start
status = Wait_IDE_BMEND();
if ( status != 0 ) {
return STATUS_TIMEOUT_BMEND; // BMEND timeout error end
}
status = Wait_IDE_INTRQ(); // Wait for INTRQ assert
if ( status != 0 ) {
return STATUS_TIMEOUT_INTRQ; // INTRQ timeout error end
}
idestat = *IDEREG_ALT_STATUS; // Alt Status register empty read
idestat = *IDEREG_STATUS; // Status register read
if ( idestat & IDEREG_ERROR_ERR_BIT ) {
return STATUS_IDE_ERROR(*IDEREG_ERROR); // Error end (after command execution)
}
return STATUS_SUCCESS; // Normal end
}
/////////////////////////////////////////////////////////////////
// Function name: ATA_Soft_Reset //
// Function: Performs software reset. //
// Argument: None //
// Return value: //
// STATUS_SUCCESS : Normal end //
// STATUS_TIMEOUT_BSY0 : BSY=0 timeout error end //
// //
/////////////////////////////////////////////////////////////////
int ATA_soft_reset(void)
{
int status;
*IDEREG_DEVICE_CONTROL = 0x04;
// Reset execution
wait(TIMER5ms);
// Wait 5 ms
*IDEREG_DEVICE_CONTROL = 0x00;
// Reset release
wait(TIMER5ms);
// Wait 5 ms
status = Wait_IDE_BSY0();
// Wait until BSY=0
if ( status != 0 ) {
return STATUS_TIMEOUT_BSY0;
// Timeout error end
}
return STATUS_SUCCESS;
}
Содержание V850E/MA1
Страница 2: ...Application Note U17121EJ1V1AN 2 MEMO ...