📄 ide_test.c
字号:
/*
Copyright (C) 2003 Bart Bilos <boombox666@yahoo.com>.
Adapted from original work by Paul Stoffregen.
http://www.pjrc.com/tech/8051/ide/
This program 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.
This program 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 this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <Dallas\REG320.H> /* Declaration for the 8051 Regs */
#include <stdio.h> /* prototype declarations for I/O functions */
#include "IDE_LIB.h" /* IDE working variables */
#include "timertick.h" /* timer subsystem */
// Small delay subroutine
void delay(unsigned int delay) {
unsigned int i,j;
for(i = 0; i < delay ;i++)
for(j = 0; j < 255 ;j++);
}
void init(void){
inittimer();
ide_hard_reset();
ide_init();
}
/*------------------------------------------------\
Test program to see if the IDE_8255 is functioning
------------------------------------------------*/
void main (void) {
xdata char sector[512];
int seconden = getseconds();
long int sectoren=0,sects=0;
init();
printf(" IDE TEST PROGRAM \n");
for(sectoren = 0 ;sectoren < 0x60000 ;sectoren++) {
if(read_sector(sectoren,sector) != 0) {
printf("READ ERROR @ %ld ",sectoren);
}
P1 = sector[0];
sects++;
sectoren++;
if((getseconds() - seconden) > 0){
printf(" %ld Kbs, %ld sectoren read \n",sects>>1,sects);
seconden = getseconds();
sects=0;
}
}
printf(" %ld sectors read total %ld MB read in %ld seconds ",sectoren,sectoren>>11,getseconds());
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -