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

📄 main.c

📁 一个简单的能够直接操作IDE接口的函数库
💻 C
字号:
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//					    ATA Disc Raw IO Library for AVR 
//								  V0.1a
// 	  							Rob Riglar
//							Copyright 2003,2004 
//
//   					  Email: rob@robriglar.com
//
//			    Compiled with Imagecraft C Compiler for the AVR series
//-----------------------------------------------------------------------------
//
// This file is part of ATA Disc Raw IO Library.
//
// ATA Disc Raw 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.
//
// ATA Disc Raw 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 ATA Disc Raw IO Library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------

#include <iom128.h>
#include <stdio.h>
#include <stdlib.h>
#include <macros.h>

#define debug 0

#include "drivers\drivers.c"

#include "ide\IDE_BoardSetup.h"
#include "ide\IDE_Base.h"
#include "ide\IDE_Base.c"
#include "ide\IDE_Access.h"
#include "ide\IDE_Access.c"


//-----------------------------------------------------------------------------
// Main
//-----------------------------------------------------------------------------
void main(void)
{
	  int i;

      // Init UART1
 	  InitUART(15); // 15 = 57K @ 14MHz
	  
	  // My Board Specific Power On Stuff
	  Setup128Ports_EDTPBoard();
	  
	  // IDE Hard Disc Master Initialisation
	  IDE_Reset();	   	  // Reset IDE device 	
	  delay_ms(500);	  // Wait
	  IDE_InitDrive();	  // Send initialise commands to drive
	    

	  // Read MBA which is sector 0 into buffer
	  IDE_BufferSector(0); 

	  // Printf results to console
	  for (i=0; i<512;i++)
		{ 
		printf("0x%X   ", IDE_SectorByte(i));
		}

}

⌨️ 快捷键说明

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