?? main.c
字號:
/****************************************************************************/
/* */
/* FILE NAME VERSION */
/* */
/* CF.C 1.0 */
/* */
/* DESCRIPTION */
/* */
/* JXARM9-2410(S3C2410X)CF卡驅動實驗 */
/* */
/* */
/* DATA STRUCTURES */
/* */
/* FUNCTIONS : */
/* 在JXARM9-2410教學實驗箱進行CF卡讀寫的實驗 */
/* */
/* DEPENDENCIES */
/* JXARM9-2410-1 */
/* JXARM9-2410-2 */
/* JXARM9-2410-3 */
/* */
/* */
/* NAME: */
/* REMARKS: */
/* */
/* Copyright (C) 2003 Wuhan CVTECH CO.,LTD */
/****************************************************************************/
/****************************************************************************/
/* 學習JXARM9-2410中CF卡操作函數的編寫方法: */
/* 注意: */
/* 1. 程序運行前請插入CF卡到CF卡座 */
/* 2. 請不要帶電拔插CF卡 */
/* 3. 寫CF卡操作將破壞CF卡中的數據,請小心實驗,并備份您的數據 */
/****************************************************************************/
/* 包含文件 */
#include "def.h"
#include "2410lib.h"
#include "option.h"
#include "2410addr.h"
#include "interrupt.h"
void Main()
{
int i = 0;
unsigned char cf_cis_string[512];
unsigned char ch1, ch2, ch3, ch4;
/* 配置系統時鐘 */
ChangeClockDivider(1,1); // 1:2:4
ChangeMPllValue(0xa1,0x3,0x1); // FCLK=202.8MHz
/* 初始化端口 */
Port_Init();
/* 初始化串口 */
Uart_Init(0,115200);
Uart_Select(0);
/* 打印提示信息 */
PRINTF("\n---Compact Flash Card測試程序---\n請先將CF卡插入CF卡插座\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 + -