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

📄 ide_base.h

📁 此程序是在blackfin下实在的ide硬盘的程序
💻 H
字号:

#ifndef _BF533_IDE_TEST_
#define _BF533_IDE_TEST_


#define BYTE unsigned char 
#define WORD unsigned short 
#define DWORD unsigned long 


//IDE Register Address
#define IDECS0BASEADDR		0x20300000 
#define pDataPort 		(volatile unsigned short *)(IDECS0BASEADDR +(0x00<<1))
#define pPreComp 		(volatile unsigned char *)(IDECS0BASEADDR + (0x01<<1))
#define pSectorCount		(volatile unsigned char *)(IDECS0BASEADDR + (0x02<<1))
#define pSectorNumber	(volatile unsigned char *)(IDECS0BASEADDR + (0x03<<1))
#define pCylinderLow		(volatile unsigned char *)(IDECS0BASEADDR + (0x04<<1))
#define pCylinderHigh		(volatile unsigned char *)(IDECS0BASEADDR + (0x05<<1))
#define pDriveHead		(volatile unsigned char *)(IDECS0BASEADDR + (0x06<<1))
#define pCommand 		(volatile unsigned char *)(IDECS0BASEADDR + (0x07<<1))

#define pStatus			(volatile unsigned char *)(IDECS0BASEADDR + (0x07<<1))
#define pErrorReg 		(volatile unsigned char *)(IDECS0BASEADDR + (0x01<<1))








//IDE Status Register Bit
#define IDE_BUSY 	0x80		//系统忙标志
#define IDE_DRDY 	0x40		//系统ready标志
#define IDE_DWF  	0x20		//写误差
#define IDE_DSC		0x10		//完成搜索标志,
#define IDE_DRQ		0x08		//数据请求
#define IDE_CORR	0x04		//修正数据
#define IDE_INDEX	0x02		//
#define IDE_ERROR	0x01

//IDE Command 
#define IDE_CMD_CHECKPOWERMODE 	0x98 	// Check Power Mode  校核电源模式  
#define IDE_CMD_CHECKPOWERMODE2 0xE5 	//Check Power Mode (same as 98h) 
#define IDE_CMD_DRIVEDIAG 	0x90     // Execute Drive Diagnostic  可执行的设备诊断       |             D+  |
#define IDE_CMD_FORMAT		0x50   	// Format Track                格式轨迹    |          V  V   |
#define	IDE_CMD_IDENTIFY	0xEC	// Identify Drive              鉴别设备    |             D   |
#define IDE_CMD_IDLE		0x97	//Idle                         空闲   |    V        D   |
#define IDE_CMD_IDLE2		0xE3	//Idle (same as 97h)              |    V        D   |
#define IDE_CMD_IDLEIMMEDIATE	0x95	//Idle Immediate            立即空闲      |             D   |
#define IDE_CMD_IDLEIMMEDIATE2	0xE1	//Idle Immadiate (same as 95h)  立即空闲  |             D   |
#define IDE_CMD_INITDRIVERPARAM	0x91	//Initialize Drive Parameters   初始化设备参量  |    V        V   |
#define IDE_CMD_READBUFFER	0xE4	//Read Buffer                     	读buff|             D   |
#define IDE_CMD_READDMARETRY	0xC8	//Read DMA With Retry           读DMA |  >> Unknown <<  |
#define IDE_CMD_READDMA		0xC9	//Read DMA                        	|  >> Unknown <<  |
#define IDE_CMD_READMILTI	0xC4	//Read Multiple                   	多次读|    V  V  V  V   |
#define IDE_CMD_READSECTORRETRY	0x20	//Read Sectors With Retry        再次读扇区 |    V  V  V  V   |
#define IDE_CMD_READSECTOR	0x21	//Read Sectors                    		|    V  V  V  V   |
#define IDE_CMD_READLONGRETRY	0x22	//Read Long With Retry            |    V  V  V  V   |
#define IDE_CMD_READLONG	0x23	//Read Long                       |    V  V  V  V   |
#define IDE_CMD_READVERSECRETRY	0x40	//Read Verify Sectors With Retry  再次验证读扇区|    V  V  V  V   |
#define IDE_CMD_READVERSEC	0x41	//Read Verify Sectors             		读验证扇区|    V  V  V  V   |
#define IDE_CMD_SETFEATURES	0xEF	//Set Features                    		设置特色|  V          D   |
#define IDE_CMD_SETMULTIMODE	0xC6	//Set Multiple Mode               多设置模式|    V        D   |
#define IDE_CMD_SETSLEEPMODE	0x99	//Set Sleep Mode                  设置睡眠模式|             D   |
#define IDE_CMD_SETSLEEPMODE2	0xE6	//Set Sleep Mode (same as 99h)    |             D   |
#define IDE_CMD_STANDY		0x96	//Standby                         		待命|    V        D   |
#define IDE_CMD_STANDY2		0xE2	//Standby (same as 96h)           |    V        D   |
#define IDE_CMD_STANDYIMMEDIATE	0x94	//Standby Immediate               直接待命|             D   |
#define IDE_CMD_STANDYIMMEDIATE2 0xE0	//Standby Immediate (same as 94h) 	|             D  


#define SECTORWORDSIZE 256


#else
#endif




⌨️ 快捷键说明

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