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

📄 test.c

📁 ZLG/CF驱动接口函数实验,包括宏定义,函数原形及总线初始化函数,开关中断函数,读寄存器函数,写寄存器函数等
💻 C
字号:
/*所在文件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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -