flashrom.c
来自「An interrest demo of uCGUI base S3C44B0X」· C语言 代码 · 共 54 行
C
54 行
#include "flashrom.h"
#include "def.h"
int SST39VF160_CheckBlank(U32 addr,U32 WordSize)
{
U32 i,temp;
for (i=addr;i<(addr+WordSize);i++)
{
temp=*((volatile U16 *)(i<<1));
if(temp!=0xffff)
return 0;
}
return 1;
}
int Waitfor_endofprg(void) //Check if the bit6 toggle ends.
{
volatile U16 flashStatus,old;
old=*((volatile U16 *)0x0);
while(1)
{
flashStatus=*((volatile U16 *)0x0);
if( (old&0x40) == (flashStatus&0x40) )
break;
else
old=flashStatus;
}
return 1;
}
int SST39VF160_WordProg (U32 addr,U16 dat)
{
Writeflash (0x5555,0xAA);
Writeflash (0x2AAA,0x55);
Writeflash (0x5555,0xA0);
Writeflash (addr,dat);
return(Waitfor_endofprg());
}
void SST39VF160_SectorErase(U32 SAaddr)
{
Writeflash(0x5555,0xAA);
Writeflash(0x2AAA,0x55);
Writeflash(0x5555,0x80);
Writeflash(0x5555,0xAA);
Writeflash(0x2AAA,0x55);
Writeflash(SAaddr,0x30);
Waitfor_endofprg();
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?