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

📄 cf.c

📁 一个用samsung s3c44b0x arm7读取cf卡接口的例子
💻 C
字号:
/****************************************************************************/
/*                                                                          */
/* FILE NAME                                      VERSION                   */
/*                                                                          */
/* CF.C                                            1.0                      */
/*                                                                          */
/* DESCRIPTION                                                              */
/*                                                                          */
/*     JX44B0(S3C44B0X)CF卡驱动实验                                         */
/*                                                                          */
/*                                                                          */
/* DATA STRUCTURES                                                          */
/*                                                                          */
/* FUNCTIONS :                                                              */
/*     在JX44B0教学实验箱进行CF卡读写的实验                                 */
/*                                                                          */
/* DEPENDENCIES                                                             */
/*     JX44B0-1                                                             */
/*     JX44B0-2                                                             */
/*     JX44B0-3                                                             */
/*                                                                          */
/*                                                                          */
/* NAME:                                                                    */
/* REMARKS:                                                                 */
/*                                                                          */
/*								Copyright (C) 2003 Wuhan CVTECH CO.,LTD     */
/****************************************************************************/

/****************************************************************************/
/* 学习JX44B0中CF卡操作函数的编写方法:                                     */
/* 注意:                                                                   */
/*     1. 程序运行前请插入CF卡到CF卡座                                      */
/*     2. 请不要带电拔插CF卡                                                */
/*     3. 写CF卡操作将破坏CF卡中的数据,请小心实验,并备份您的数据          */
/****************************************************************************/

/* 包含文件 */
#include "44b.h"
#include "44blib.h"
#include "rtc.h"

void Main()
{
	int i = 0;
	unsigned char cf_cis_string[512];
	unsigned char ch1, ch2, ch3, ch4;
	
	Uart_Printf("Compact Flash Card Test!\n");
	
	memset(cf_cis_string, 0x0, 512);

	cf_init();
		
	// read cis
	/* 读取CF卡信息 */
	cf_read_cis(cf_cis_string);
	Uart_Printf("\nManufacturer Information Stored in CIS:\n");
	Uart_Printf(cf_cis_string);
	Uart_Printf("\n");
		
	/* 写数据到BLOCK0 */
	for(i=0; i<512; i++)
		cf_cis_string[i] = i;
	cf_memory_write_block(cf_cis_string, 0);
		
	while(1)
	{
		static int ncount = 0;
		Uart_Printf("ncount = %d\n", ncount);

	/* 读取CF卡ncount BLOCK的数据到cf_cis_string中,并打印 */
		memset(cf_cis_string, 0x0, 512);
		cf_memory_read_block(cf_cis_string, ncount);
		{
			int loopcnt;
			for(loopcnt = 0; loopcnt < 512; loopcnt ++)
			{
				if(loopcnt % 0x10 == 0)
					Uart_Printf("\n");
				Uart_Printf("%02x ", cf_cis_string[loopcnt]);
			}	
			Uart_Printf("\n");
		}
		Uart_Getch();
		ncount++;
	}
	
	while(1);	/* dead here! */
}

⌨️ 快捷键说明

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