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

📄 main.c

📁 ARM SYS CODE 用于ARM上的各种原代码,包括当前最常用的驱动程序
💻 C
字号:
#include <string.h>
#include <stdio.h>
#include "Target\44b.h"
#include "Target\44blib.h"

#define YEAR 	(0x99)
#define MONTH 	(0x12)
#define DAY		(0x31)
#define DATE    (0x06)  // SUN:1 MON:2 TUE:3 WED:4 THU:5 FRI:6 SAT:7   
#define HOUR	(0x23)
#define MIN		(0x59)
#define SEC		(0x30)
extern void Rtc_Init(void);
extern void Flash_Tools(void);
extern void fat16_Nandflash_test(void);
/********************************************/
//   ARMSYS实验二十四:FAT16文件系统的移植与应用
//   描述:对Nandflash进行格式化,完成文件系统初
//   始化,并利用FAT16提供的API函数进行文件操作。
//   另有:flash_tools,观察nandflash扇区内容的工具
/********************************************/
void * function[][2]=
{
	(void *)fat16_Nandflash_test, "Fat16 test",
	(void *)Flash_Tools, "Flash Read",
	0,0
};
	

void Rtc_Init(void)
{
    rRTCCON = 0x01;	
    rBCDYEAR = YEAR;
    rBCDMON  = MONTH;
    rBCDDAY  = DAY;	// SUN:1 MON:2 TUE:3 WED:4 THU:5 FRI:6 SAT:7
    rBCDDATE = DATE;
    rBCDHOUR = HOUR;
    rBCDMIN  = MIN;
    rBCDSEC  = SEC;
	rRTCCON = 0x0;    
}
	
void Main(void)
{
	char aa;
	int i;
	rSYSCFG=CACHECFG;	// Using 8KB Cache//
	Port_Init();
	Rtc_Init();
	Uart_Init(0,115200);
	Led_Display(0xf);
	Delay(0);
	Beep(0x1);
	Uart_Select(0); //Select UART0//
	Uart_Printf("\n\n*************************************************************************");
	Beep(0x0);
	Uart_Printf("\n*                          立泰电子                                      *");
	Uart_Printf("\n*                     -文件系统测试:FAT16test-                           *");
	Uart_Printf("\n*                        Version 1.10                                   *");    
	Uart_Printf("\n*                    Email:rao_dali@263.net                             *");
	Uart_Printf("\n*               UART Config--COM:115.2kbps,8Bit,NP,UART0                *");
	Uart_Printf("\n*----------------Begin to run File System test? (Y/N)-------------------*\n");
    
	Led_Display(0x0);
	aa= Uart_Getch();
	if((aa=='Y')||(aa=='y'))
	while(1)
	{
			i=0;
			Uart_Printf("\n");
			while(1)
			{   //display menu
				Uart_Printf("%2d:%s",i+1,function[i][1]);
				i++;
				if((int)(function[i][0])==0)
				{
					Uart_Printf("\n");
					break;
				}
				if((i%4)==0)
					Uart_Printf("\n");
			}
			Uart_Printf("\nSelect the function to test?");
			i=Uart_GetIntNum();
			i--;
			Uart_Printf("\n");
			if(i>=0 && (i<(sizeof(function)/8)) ) 
				( (void (*)(void)) (function[i][0]) )();
	}
}

⌨️ 快捷键说明

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