⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ide.h

📁 ATMEL 89c51sndc mp3外接硬盘源码
💻 H
字号:
/*H**************************************************************************
* NAME:         ide.h         
*----------------------------------------------------------------------------
* Copyright (c) 2002 Atmel.
*----------------------------------------------------------------------------
* RELEASE:      snd1c-demo-hdd-0_2_0      
* REVISION:     1.1     
*----------------------------------------------------------------------------
* PURPOSE:
* This file contains the file function definition
*****************************************************************************/

#ifndef _IDE_H_
#define _IDE_H_

#include "..\..\lib_demob\board.h"     /*  The system definitions          */


/*_____ D E F I N I T I O N ______________________________________________*/


/* IDE/ATA Status and Alternate Status register bit */
#define IDE_BSY             0x80
#define IDE_DRDY            0x40
#define IDE_DF              0x20
#define IDE_DSC             0x10
#define IDE_DRQ             0x08
#define IDE_CORR            0x04
#define IDE_IDX             0x02
#define IDE_ERR             0x01


#define IDE_ENABLE_BYTE_TRANSFERT     (0x01)

/*_____ D E F I N I T I O N ______________________________________________*/

#define ide_command         ide_status
#define ide_device_control  ide_alt_status
#define ide_feature         ide_error

#define Ide_set_ide_mode()      \
  AUXR |= MSK_EXT16;            \
  AUXR &= ~MSK_DPHDIS

/*_____ D E C L A R A T I O N ______________________________________________*/

#define Ide_notbsy()              (((ide_status & (IDE_BSY | IDE_DSC )) == IDE_DSC) ? OK : KO)
#define Ide_notbsy_drdy()         (((ide_status & (IDE_BSY | IDE_DRDY | IDE_DSC)) == (IDE_DRDY | IDE_DSC)) ? OK : KO)
#define Ide_notbsy_notdrq()       (((ide_status & (IDE_BSY | IDE_DRQ | IDE_DSC)) == IDE_DSC) ? OK : KO)
#define Ide_notbsy_drq()          (((ide_status & (IDE_BSY | IDE_DRQ | IDE_DSC)) == (IDE_DRQ | IDE_DSC)) ? OK : KO)
#define Ide_notbsy_notdrq_drdy()  (((ide_status & (IDE_BSY | IDE_DRQ | IDE_DRDY |IDE_DSC)) == (IDE_DSC | IDE_DRDY)) ? OK : KO)
#define Ide_error_detect()        (((ide_status & (IDE_ERR)) == IDE_ERR) ? TRUE : FALSE)
#define Ide_notbsy_alt()          (((ide_status & (IDE_BSY | IDE_DSC )) == IDE_DSC) ? OK : KO)


/* IDE low level routines */
#define Ide_set_drive_head(d)     (ide_drive_head = d)
#define Ide_set_cylinder_low(d)   (ide_cylinder_low = d)
#define Ide_set_cylinder_high(d)  (ide_cylinder_high = d)
#define Ide_set_sector_count(d)   (ide_sector_count = d)
#define Ide_set_sector_number(d)  (ide_sector_number = d)
#define Ide_set_feature(d)        (ide_feature = d)
#define Ide_send_command(c)       (ide_status = c)
#define Ide_read_databyte()       (ide_data)
#define Ide_write_databyte(d)     (ide_data = d)

#define Ide_get_status()          (ide_status)

/* IDE function declaration */
Uint16 ide_read_dataword();             /* Read data word */
Byte ide_read_databyte (void);          /* read data byte */
void ide_write_databyte (Byte );        /* write data byte */

#endif  /* _IDE_H_ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -