CHAPTER 5 APPLICATION EXAMPLES
Application Note U17121EJ1V1AN
80
#define IDEREG_ALTERNATE_STATUS
((VUBYTE*)(BASE_ADDRESS_ 0x0E))
#define IDEREG_DEVICE_CONTROL
((VUBYTE*)(BASE_ADDRESS_ 0x0E))
/////////////////////////
// Bus Master I/O Area //
/////////////////////////
#define IDEREG_BUSMASTER_START_STOP
((VUWORD*)(BASE_ADDRESS_ 0x10))
#define IDEREG_DSCTBL_START_ADDRESS
((VUWORD*)(BASE_ADDRESS_ 0x14))
#define IDEREG_INTERRUPT_CONTROL
((VUWORD*)(BASE_ADDRESS_ 0x18))
///////////////////////////
// Error code definition //
///////////////////////////
#define STATUS_SUCCESS 0
#define STATUS_TIMEOUT_BSY0_DRQ0 1
#define STATUS_TIMEOUT_DEVICE_SELECTION 1
#define STATUS_TIMEOUT_DRDY1 2
#define STATUS_TIMEOUT_BSY0 3
#define STATUS_TIMEOUT_INTRQ 4
#define STATUS_TIMEOUT_BMEND 5
#define STATUS_IDE_ERROR(IDE_ERROR_REG) (0x10000000 | (UWORD)(IDE_ERROR_REG))
///////////////////////////////////////////////////
// Transfer mode timing setting value definition //
///////////////////////////////////////////////////
// See IDE specifications for details of transfer mode timing setting values shown below.
// Setting value passed to SET_FEATURES command in Set_Transfer_mode()
#define PIO_MODE0 0x08
#define UDMA_MODE0 0x40
// Setting value of timing register (when IDE operation clock is 33 MHz)
#define IDE_PIO_TIMING_IDE33MHz_MODE0 (0x00020906)
#define IDE_UDMA_TIMING1_IDE33MHz_MODE0 (0x00000202)
#define IDE_UDMA_TIMING2_IDE33MHz_MODE0 (0x00000005)
////////////////////////////
// Structure declaration //
////////////////////////////
///////////////////////////////////////
// Structure for issuing ATA command //
///////////////////////////////////////
typedef struct{
UBYTE features;
// Features register
UBYTE sector_count;
// Sector Count register
UBYTE sector_number;
// Sector Number register