📄 main.c
字号:
#include "2410addr.h"
#include "2410lib.h"
#include "def.h"
#define NFBlcokAddr 0x3ffc000
U32 ReadChipId(void);
U32 EraseBlock(U32 addr);
void ReadPage(U32 addr, U8 *buf);
U32 WritePage(U32 addr, U8 *buf);
void InitNandCfg(void);
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);
InitNandCfg();
ID=ReadChipId();//ID=EC76
Uart_Printf("nand flash`s ID is:%x\n",ID);
if(EraseBlock(NFBlcokAddr>>9)==0)
{
Uart_Printf("block %4d is erased\n",NFBlcokAddr>>14);
Uart_Printf("Writed datas are:\n");
for(i=0; i<512; i++)
{
buf[i] =0x88;
Uart_Printf("%4x", buf[i]);
}
WritePage(NFBlcokAddr>>9, buf);
for(i=0; i<512; i++)
buf[i] = 1;
ReadPage(NFBlcokAddr>>9, buf);
Uart_Printf("Read datas are:\n");
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 + -