test.c

来自「周立功easyarm2200平台第5章试验代码」· C语言 代码 · 共 36 行

C
36
字号
/*所在文件test.c*/
#include "config.h"
uint8	temp1,temp2,temp3,temp4,temp5,temp6,temp7;
uint16	temp16;
int main(void)
{
	SYS_BusIni();
	/*探测设备是否存在函数测试*/
	if(SYS_HaveCard())				//探测CF卡是否存在
	{	/*复位及读寄存器函数测试*/
		SYS_IdeHardReset();			//ATA设备硬件复位
		SYS_WaitInUS(48000);		//复位后ATA设备需在480mS内完成硬件初始化和自检
		temp1 = GetSECCNT();		//复位该寄存器的值为0x01
		if(0x01!=temp1)
		{
			while(1);				//读函数有误或设备无效
		}
		temp2 = GetSector();			//复位该寄存器的值为0x01
		temp3 = GetCylinderLow();		//复位该寄存器的值为0x00
		temp4 = GetCylinderHigh();		//复位该寄存器的值为0x00
		temp5 = GetDeviceHead();		//复位该寄存器的值为0x00
		temp6 = GetStatus();			//复位该寄存器的值为0x50
		temp7 = GetAStatus();			//复位该寄存器的值为0x50
	
		/*写函数测试*/
		SetSector(0xaa);				//写数据寄存器
		temp16 = GetSector();	
		if(0xaa!=temp16)			//比较写入与读出的值
		{
			while(1);				//写函数有误
		}
	}
	while(1);
	
}

⌨️ 快捷键说明

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