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

📄 ide_base.h

📁 嵌入式系统中的完整FAT16和FAT32源码
💻 H
字号:
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//					    FAT32 File IO Library for AVR 
//								  V0.1c
// 	  							Rob Riglar
//							Copyright 2003,2004 
//
//   					  Email: rob@robriglar.com
//
//			    Compiled with Imagecraft C Compiler for the AVR series
//-----------------------------------------------------------------------------
//
// This file is part of FAT32 File IO Library.
//
// FAT32 File IO Library is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// FAT32 File IO Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with FAT32 File IO Library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
// Non-Board Specific ATA Parameters
//-----------------------------------------------------------------------------	
// IDE Registers
//		   		 		  	 		 	   RESET
//										   |DIOW
//										   ||DIOR
//										   |||DA0
//										   ||||DA1
//										   |||||DA2
//										   ||||||CS0
//										   |||||||CS1
//										   ||||||||	

   #define ATA_IO_HIZ		 	 		 0b11111111
   #define ALT_STATUS				     0b11101110
   #define ATA_IO_DEVICECNTL			 0b11101110

// Command Register Addresses
   #define DATA							 0b11100001
   #define ERROR						 0b11110001
   #define FURTHERFEATS					 0b11110001
   #define SECTOR_COUNT					 0b11101001
   #define START_SECTOR					 0b11111001
   #define CYLINDERLOW					 0b11100101
   #define CYLINDERHIGH					 0b11110101
   #define HEAD_DEVICE_PIO				 0b11101101
   #define STATUS						 0b11111101
   #define COMMAND					 	 0b11111101
	
// IDE Internal Commands
	#define 	RECALLIBRATE	0x10
	#define 	READ			0x20
	#define 	WRITE			0x30		
	#define 	DRIVEID			0xEC
	#define 	SPINDOWN		0xE0
	#define		SPINUP			0xE1

//-----------------------------------------------------------------------------
// Prototypes
//-----------------------------------------------------------------------------	 
void Set_Address(byte Address);
byte ReadReg(byte reg);
void Wait_ReadyBusy(void);
void WriteReg(byte Address, byte Data);
void Wait_DRQ(void);
word ReadWord(byte reg);
void WriteWord(byte Address, word Data);
byte CheckforError(void);
void ReadErrors(void);
void DataInputSetup(void);
UI32 Fetch_ID_Max_LBA(byte silent);

⌨️ 快捷键说明

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