main.c

来自「一个简单的能够直接操作IDE接口的函数库」· C语言 代码 · 共 75 行

C
75
字号
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//					    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 + =
减小字号Ctrl + -
显示快捷键?