📄 main.c
字号:
#include "2410addr.h"
#include "2410lib.h"
#include "def.h"
#include "nandflash.h"
void Main(void)
{
U32 i;
U8 buf[512];
U32 ID;
ChangeClockDivider(1,1);
ChangeMPllValue(0xa1,0x3,0x1);
Port_Init();
Uart_Select(0);
Uart_Init(0,115200);
Uart_Printf("Nand flash test \n");
InitNandCfg();
ID=ReadChipId();//ID=EC76
Uart_Printf("nand flash`s ID is:%x\n",ID);
if(EraseBlock(NFBlcokAddr))
{
Uart_Printf("block %4x is erased\n",NFBlcokAddr);
for(i=0; i<512; i++)
{
buf[i] = i;
Uart_Printf("%4x", buf[i]);
}
WritePage(NFBlcokAddr, buf);
for(i=0; i<512; i++)
buf[i] = 0;
ReadPage(NFBlcokAddr, buf);
for(i=0; i<512; i++)
Uart_Printf("%4x", buf[i]);
while(1);
}
Uart_Printf("block %4x erased is bad\n",NFBlcokAddr);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -